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/)
-   -   fixedGradient boundary condition (https://www.cfd-online.com/Forums/openfoam-solving/70223-fixedgradient-boundary-condition.html)

skabilan November 17, 2009 20:44

fixedGradient boundary condition
 
Hi All,

I am working with scalarTransportFoam. I have specified a fixedGradient boundary condition at one of the boundary patches.

inlet
{
type fixedGradient;
gradient uniform 1.5;
}

I need to change the gradient value (i.e, 1.5) between iterations.

Any suggestions?

Thanks in advance!
Senthil

skabilan November 18, 2009 14:43

Finally, I figured out how to do it...

if(mesh.boundaryField()[patchIMesh1].type() == "fixedGradient")
{
fixedGradientFvPatchScalarField& bufferMesh1= refCast<fixedgradientfvpatchscalarfield>(T.boundar yField()[patchIMesh1]);
scalarField& gradMesh1 = bufferMesh1.gradient();
forAll (bufferMesh1, faceI)
{
gradMesh1[faceI] = ...
}
}

Dont forget to include fixedGradientFvPatchScalarFields.H file before main()

Senthil

skabilan December 3, 2009 13:55

There is an error in the aforementioned code...it should be

if(T.boundaryField()[patchIMesh1].type() == "fixedGradient")

not

if(mesh.boundaryField()[patchIMesh1].type() == "fixedGradient")

Where T is the field that needs to be altered.


All times are GMT -4. The time now is 18:57.