if statement for volScalarField
hi
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
|
2 Attachment(s)
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 Attachment 48270 I am getting this error Attachment 48269 I am new to openfoam and C++ coding so not familiar with how to write this. Kind Regards Rimsha |
You can't put a for loop within a function call like that.
Code:
return tmp<surfaceScalarField> Code:
if (condition) |
2 Attachment(s)
Quote:
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 Attachment 48418 wrote this loop before the equation that i imposed in runtime. Attachment 48419 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. Thanks again. Rimsha |
All times are GMT -4. The time now is 17:43. |