How to change the value of an argument of an if-test within the if-scope
I have a problem which is probably very simple to solve.
In my program, I would like to change, within an if-scope, the value of the variable used in the if-test.
Basically, what i want to do looks like this :
volScalarField Tsub = Tsat - Tb;
if (Tsub <= 0.05)
Tsub = 0.0;
BHowever, OpenFOAM operator<= should normally take references to constant volScalarField as arguments. But then I cannot modify these arguments within the if-scope...
Thanks in advance.
you have to do the change element-wise:
It works. It was obviously something quite easy but I am still not very familiar with OF, i just started few days ago and have a lot to learn.
One more question.
Tsub is defined as a volScalarField with the dimension of temperature. Is it licit to write a test as you wrote though the LHS has a dimension and the RHS is just a scalar: Or should i define a new temperature dimensioned variable equal to 2 for the RHS of the test?
|All times are GMT -4. The time now is 07:16.|