CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   assigning a value to the specific zone in OpenFOAM (https://www.cfd-online.com/Forums/openfoam-solving/127450-assigning-value-specific-zone-openfoam.html)

Daniel_Khazaei December 11, 2013 11:51

assigning a value to the specific zone in OpenFOAM
 
Hello foamers


I am trying to add a source term to the UEqn in icoFoam. Now I will describe my question in details:

1- I have a fluent mesh (.msh) which consist of two different zones.

2- I know how to add my source to the UEqn which is a function of beta.

3- beta has a value of zero in the first zone.

4- beta has a value of non-zero in the second zone.

5- Doing so, the solver will add the source term to the second zone, while beta = 0 ensures that the source term remains zero in the first zone.


beta will remain constant in the whole simulation, I have defined it as follow:

volScalarField beta
(
IOobject
(
"beta",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

is there any way (like setField) to initiate beta before running the simulation according to the zones which are defined in the mesh?

thanks in advance

regards

Daniel_Khazaei December 12, 2013 08:02

well, I have found a way by searching in OpenFOAM sources (src and utilities).

I have generated the cell ID numbers belong to that specific zone from cellSet utility. Then I have added a bit of code to icoFoam, so it can read that list and assign values acooriding to that ID list.


regards


All times are GMT -4. The time now is 17:13.