if statement for volScalarField
i'm a new user of openFoam, i try to do something when a volScalarFied like p is in the specific number like smaller than 1 i tried this in solver.
if ( p < 1)
when p is volScalarField and i got som error for operator <
thanks to help me.
It depends a bit of what you want to do precisely. It is always a good idea to carefully read the errormessages. If you don't understand them, it is still worth to post them in a thread.
See also: http://www.cfd-online.com/Forums/ope...uction-if.html
Thanks dear Bernhard, you got me and my problem has been solved. :D
Hi guys i am trying to implement a if loop in one of the libraries of interFoam where a variable called "kappaf" is depend on the alpha1f value, where i want to impose a condition where kappaf is alpha1f * DI for alpha1f >0.5 or zero if alphaf < 0.5.
I have written the loop
I am getting this error
I am new to openfoam and C++ coding so not familiar with how to write this.
You can't put a for loop within a function call like that.
Thank you so much for helping. I have taken your advice and imposed the for loop just before the equation instead and it works fine.
Below is the procedure i followed.
I imposed the two diffusion coefficients in create fields for the solver
wrote this loop before the equation that i imposed in runtime.
In the above loop i am trying to switch between diffusion coefficient depending on the cell face value of the alpha (a phase volume fraction in interFoam).
Hope this helps anyone trying to do something similar.
|All times are GMT -4. The time now is 12:04.|