CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Syntax question relating volScalarField (https://www.cfd-online.com/Forums/openfoam-programming-development/86521-syntax-question-relating-volscalarfield.html)

sabin.ceuca March 24, 2011 12:04

Syntax question relating volScalarField
 
Hi Foamers,
I have the following question is it possible to "force" a volScalarField in this way?

volScalarField somethingSomething
(
IOobject
(
"somethingSomething",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero",dimensionSet(1,0-1,0,0,0,0),A*B)
);
with the product of A*B having a different dimension, i.e. to overwrite the dimension?

niklas March 24, 2011 13:46

So basically this

Code:

volScalarField somethingSomething
(
    IOobject
    (
        "somethingSomething",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    mesh,
    A*B,
    ...boundary conditions...
);

If A and B are dimensionedScalars

if they form a volScalarField, you just remove mesh, like this
Code:

volScalarField somethingSomething
(
    IOobject
    (
        "somethingSomething",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    A*B
);


l_r_mcglashan March 24, 2011 14:24

Quote:

Originally Posted by sabin.ceuca (Post 300916)
with the product of A*B having a different dimension, i.e. to overwrite the dimension?

I found the best thing to do is define another dimensionedScalar with value 1.0 (call it, say, dimensionConversionAB) that has the dimensions required to convert from the dimensions of A*B to the dimensions you require. That way you don't forget that you're doing something a bit dodgy when you come to look back at your code.

pgiannatselis April 2, 2015 04:05

Quote:

Originally Posted by sabin.ceuca (Post 300916)
Hi Foamers,
I have the following question is it possible to "force" a volScalarField in this way?

volScalarField somethingSomething
(
IOobject
(
"somethingSomething",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero",dimensionSet(1,0-1,0,0,0,0),A*B)
);
with the product of A*B having a different dimension, i.e. to overwrite the dimension?


dimensionSet(1,0,-1,0,0,0,0) is the correct.... a "," was misssing


All times are GMT -4. The time now is 14:08.