CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   dimensioned volScalarField (https://www.cfd-online.com/Forums/openfoam/70006-dimensioned-volscalarfield.html)

lions85 November 11, 2009 11:54

dimensioned volScalarField
 
Hi,

I'm programming in OpenFoam and I have a problem.

I am using a chemistry solver for some simple burners simulation.

In the transport equation I need to put the reaction velocity with its unit measures (so it has to be dimensioned). my velocity is a volScalarField, and when I declare a volScalarField I use this way:

volScalarField RR_Fuel
(
IOobject
(
"RR_Fuel",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("RRfuel", dimensionSet(1,-3,-1,0,0,0,0), 0)
);

Then in the program I initialize the field, but in this case when I do that the right hand side and the left hand side of the equation need to be dimensioned with the same units.

The problem is that I want to initialize the scalarfield with a undimensioned right hand side. If I do that in the declaration after dimensionSet where instead of 0 I put for example 5, it works, the RR_Fuel will be dimensioned and with the value 5. I want to do the same but not in the declaration, and this is impossible because when I run the program it stops for the inconsistency of the units.

I hope you can understand my question, I was nebulous but it's very difficult to speak in english about this staff.

Thank you for your help
bye
EManuele

olesen November 12, 2009 02:41

Quote:

Originally Posted by lions85 (Post 235881)
The problem is that I want to initialize the scalarfield with a undimensioned right hand side. If I do that in the declaration after dimensionSet where instead of 0 I put for example 5, it works, the RR_Fuel will be dimensioned and with the value 5. I want to do the same but not in the declaration, and this is impossible because when I run the program it stops for the inconsistency of the units.

You should be able to address (read/write) the dimensions and the values of the field separately. The doxygen docs
http://foam.sourceforge.net/doc/Doxy...onedField.html mention both a dimensions() method and a field() method. The latter is probably good starting place for solving your problem.


All times are GMT -4. The time now is 07:31.