CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   "=" or "==" when I modify BC (fixedGradient) during run ? (http://www.cfd-online.com/Forums/openfoam-programming-development/83086-when-i-modify-bc-fixedgradient-during-run.html)

Cyp December 14, 2010 09:12

"=" or "==" when I modify BC (fixedGradient) during run ?
 
Hi!

I wonder what is the correct code form to modify the BC during runs.

I know that for a fixedValue BC the "==" sign is required to overwrite the orginal BC. For example:

Code:

phiS.boundaryField()[patchID]== phib.boundaryField()[patchID];
Now, if I want to modify a fixedGradient, it seems to me that "==" doesn't overwrite the orginal BC but "=" does. My piece of code is the following:

Code:

    fixedGradientFvPatchScalarField& gradpPatch=refCast<fixedGradientFvPatchScalarField>(p.boundaryField()[patchID]);
    scalarField& gradpField =  gradpPatch.gradient();
    gradpField = fluxP;

Do you have an explanation ?

Best regards,
Cyp


All times are GMT -4. The time now is 05:02.