CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   "=" or "==" when I modify BC (fixedGradient) during run ? (

Cyp December 14, 2010 09:12

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

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:


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:


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

Do you have an explanation ?

Best regards,

All times are GMT -4. The time now is 12:59.