|
[Sponsors] |
converting from dimensionedScalar to volScalarField |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 3, 2012, 05:19 |
converting from dimensionedScalar to volScalarField
|
#1 |
Member
shiv
Join Date: Jun 2012
Location: Lucknow, IN
Posts: 51
Rep Power: 14 |
hi openfoamers,
i was working with twophaseeulerfoam solver and i am required to change the rhoa from being a constant value to a scalar field , i modified the createfields.H . only relevant code is copied volVectorField& Ua = phasea->U(); surfaceScalarField& phia = phasea->phi(); // const dimensionedScalar& rhoa = phasea->rho(); const dimensionedScalar& nua = phasea->nu(); volVectorField& Ub = phaseb->U(); surfaceScalarField& phib = phaseb->phi(); const dimensionedScalar& rhob = phaseb->rho(); const dimensionedScalar& nub = phaseb->nu(); Info<< "Reading field alpha\n" << endl; volScalarField alpha ( IOobject ( "alpha", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); volScalarField beta ( IOobject ( "beta", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), scalar(1) - alpha Info<< "Reading field s1\n" << endl; volScalarField s1 ( IOobject ( "s1", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<< "Reading field rhoa\n" << endl; volScalarField rhoa ( IOobject ( "rhoa", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), ((phasea->rho)+(1041* s1))/2 ); volScalarField rho ( IOobject ( "rho", runTime.timeName(), mesh ), alpha*rhoa + beta*rhob ); |
|
July 3, 2012, 14:17 |
|
#3 |
Member
shiv
Join Date: Jun 2012
Location: Lucknow, IN
Posts: 51
Rep Power: 14 |
yaa its a question , i am getting errors while trying to convert rhoa from dimensionedscalar to volscalarfield . can you please suggest the correct modification in the code.
|
|
July 5, 2012, 01:44 |
|
#5 |
Member
shiv
Join Date: Jun 2012
Location: Lucknow, IN
Posts: 51
Rep Power: 14 |
hi akidess ,
i tried even resetting dimension yet getting errors, modification were: rhoa.dimensions().reset(dimless); rhoa = (998 + (1041 * s1))/2; rhoa.dimensions().reset(rhoa1); can you please suggest what's wrong ??? |
|
July 5, 2012, 03:36 |
|
#6 |
Senior Member
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30 |
Indeed I overlooked the dimensions. What units does s1 have, and is it also a scalar?
__________________
*On twitter @akidTwit *Spend as much time formulating your questions as you expect people to spend on their answer. |
|
July 5, 2012, 05:48 |
|
#7 |
Member
shiv
Join Date: Jun 2012
Location: Lucknow, IN
Posts: 51
Rep Power: 14 |
s1 is dimensionless and scalarfield as in code.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[openSmoke] libOpenSMOKE | Tobi | OpenFOAM Community Contributions | 562 | January 25, 2023 10:21 |
Problem with pow and volScalarField | _Stefan_ | OpenFOAM Programming & Development | 15 | April 14, 2019 23:20 |
changing a volScalarField to a dimensionedScalar | wschosta | OpenFOAM Running, Solving & CFD | 5 | May 6, 2015 11:20 |
dimensionedScalar + volScalarField is evaluated elementwisely ? | tianyikillua | OpenFOAM Programming & Development | 1 | March 30, 2012 04:12 |
Confused about how OF handles operation between volScalarField and dimensionedScalar | Edy | OpenFOAM | 3 | September 30, 2010 11:07 |