Update all cells in volVectorField from my BC
Hi,
I would like to update all cell values from my boundary condition. This is what I have done so far Code:
const volVectorField& U = db().lookupObject<volVectorField>("U"); Code:
forAll(U.internalField(), cellID) Code:
error: assignment of read-only location Any advice? |
I have also tried
Code:
U.internalField()[cellID].x().value() = ... Any hint? |
You are trying to modify a const reference to the U field. Remove the const keyword.
|
Hello Ruggiero,
could you solve the issue? In my case with version 17.12 I have to const cast the field (I know it is not the best solution, but at least it works) and modify the fields with using the primitiveFieldRef const volVectorField& U = db().lookupObject<volVectorField>("U"); velVectorField& Umod = const_cast<volVectorField&>(U); Umod.primitiveFieldRef()[cellID] = ... Regards Alex |
All times are GMT -4. The time now is 13:43. |