|April 27, 2012, 06:48||
Join Date: Apr 2012
Posts: 8Rep Power: 6
I'm a student and new user of OpenFOAM, I am currently trying to modify the solver twoLiquidMixingFoam by adding the energy equation. Since I haven't use C++ so far, I'm having some trouble when I use the instruction if, for example in my case I just want to implement these simple lines :
if ( alpha1 == 0 ) // l : 34
I have the following error :
energyEqn.H:34: error: could not convert ‘alpha1.Foam::GeometricField<Type, PatchField, GeoMesh>:perator== [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh](((const Foam::dimensioned<double>&)(& Foam::dimensioned<double>(((const double&)((const double*)(&0.0)))))))’ to ‘bool’
Since alpha1 is an object, I don't think this is the appropriated way to do this. Is it possible to have some help ?
|April 29, 2012, 04:25||
Join Date: Sep 2009
Posts: 790Rep Power: 14
Welcome to CFD-online!
The method you found should work fine, but it really depends on what you want to obtain. If you can explain a bit more on what you want exactly, there may be a nicer way.
|April 29, 2012, 13:28||
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 436Rep Power: 14
Seconded. What you've got now is an indexed for loop over all elements in the mesh. These types of loops should be avoided whenever possible as they can be 10x slower than OpenFOAM's built-in field operations, which use optimised pointer loops.
Follow me on twitter @DavidGaden
|June 14, 2016, 14:14||
Problem with if Loop in interFoam
Join Date: Jan 2016
Posts: 25Rep Power: 3
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.
|Thread||Thread Starter||Forum||Replies||Last Post|
|Instalation on ubuntu 710||basilwatson||OpenFOAM Installation||17||March 16, 2012 21:16|
|Pls help last problem to be solved for installing OPENfoam||daydayuper||OpenFOAM Installation||5||November 9, 2008 05:59|
|Who help to give a instruction how to install paraFoam correctly||liugx212||OpenFOAM Paraview & paraFoam||0||April 17, 2006 15:32|
|64-bit processors for home computing||Ananda Himansu||Main CFD Forum||2||March 16, 2004 13:48|
|Web-based CFD/HT instruction||Graham de Vahl Davis||Main CFD Forum||0||April 2, 1999 16:49|