CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   calculated type of primitive boundary field (https://www.cfd-online.com/Forums/openfoam/72826-calculated-type-primitive-boundary-field.html)

suniljain February 19, 2010 01:35

calculated type of primitive boundary field
 
hi .
what is the syntax of calculated type of primitive boundary field.my case has three coupled equation with 3 variables. i have a relation between two variables (fields) at a particular patch , say x=constant *y. so how to give boundary condition for x and y at that patch. please help me.

benk February 19, 2010 17:19

If I understand your question, you have 2 equations coupled via a fixedValue boundary condition. Something like this should work for your boundary condition (although I'd be interested to know if there's a better way):

Code:

label wall2 = mesh.boundaryMesh().findPatchID("boundaryWall2");
fixedValueFvPatchScalarField& bufferT = refCast<fixedValueFvPatchScalarField>(T.boundaryField()[wall2]);

scalarField& valT  = bufferT;

forAll (valT, faceI)
{
  valT[faceI] =  c.boundaryField()[wall2][faceI];
}

This code will set the boundary condition for T equal to c at the boundary labeled "boundaryWall2".

For a gradient boundary condition, it's similar (described here: http://www.cfd-online.com/Forums/ope...ed-system.html)


All times are GMT -4. The time now is 16:03.