|
[Sponsors] |
Convert volScalarField to dimensionedScalar to be defined in transportProperties |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 6, 2015, 13:04 |
Convert volScalarField to dimensionedScalar to be defined in transportProperties
|
#1 |
Member
Sandra
Join Date: Oct 2014
Posts: 58
Rep Power: 11 |
Hello OpenFOAMers
I have a variable,x that is mapped in my code so it's a volScalarField and I would like to fix it in the transportProperties dictionary as a dimensionedScalar. Originally, x was set in the 0 folder but I want to fix it in transportProperties so that it doesn't go to zero as it currently does. I've seen a few posts about converting a dimensioned scalar to volScalarField but I wasn't successful with those methods. Any ideas? Best, Sandra |
|
May 10, 2015, 03:18 |
|
#2 |
Senior Member
|
Hi,
Here is an example from laminar turbulence model: Code:
... new volScalarField ( IOobject ( "nut", runTime_.timeName(), mesh_, IOobject::NO_READ, IOobject::NO_WRITE ), mesh_, dimensionedScalar("nut", nu()().dimensions(), 0.0) ) ... |
|
May 14, 2015, 12:17 |
|
#3 | |
Member
Sandra
Join Date: Oct 2014
Posts: 58
Rep Power: 11 |
Quote:
Hi Alexey! Thank you for that contructor. Here's what I did volScalarField jbvagCell ( IOobject ( "jbvag", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh, dimensionedScalar("jbvag", dimensionSet(0,-3,0,0,0,1,0), 2e6) ); where 2e6 is the value that I want to fix. wmake for the solver works fine. However, in the .H file where I use jbvag, I have Info<<jbvag<<endl; to show me the values as the simulation proceeds and for some reason jbvag is zero. Any thoughts please? Best, Sandra |
||
May 14, 2015, 13:58 |
|
#4 |
Senior Member
|
Hi,
Your volScalarField is called jbvagCell, in your output statement variable is jbvag. Also if you would like to create volScalarField from dimensionedScalar (so there is no need to create file in 0 folder), you should not use read-constructor (i.e. with IOobject::MUST_READ flag, as you can see in the example the flag has value IOobject::NO_READ). |
|
May 14, 2015, 14:05 |
|
#5 |
Member
Sandra
Join Date: Oct 2014
Posts: 58
Rep Power: 11 |
Hello!
I don't have files in the 0 folder for this variable. Here's what I have now volScalarField jbvagCell ( IOobject ( "jbvagCell", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensionedScalar("jbvagCell", dimensionSet(0,-3,0,0,0,1,0), 2e6) jbvagCell still goes to zero when I check. Sandra |
|
May 14, 2015, 16:40 |
|
#6 |
Senior Member
|
Hi,
Post your code or at least relevant parts. I can continue guessing what is wrong but I do not want to. |
|
June 1, 2015, 10:36 |
|
#7 |
Member
Sandra
Join Date: Oct 2014
Posts: 58
Rep Power: 11 |
Hi Alexey!
Here's the equation that I'm trying to solve jbvagCell = iagCell*((Foam::exp(alphaaa*F*EttaaCell/(Rg*T)))-(Foam::exp(-alphaca*F*EttaaCell/(Rg*T)))); where jbvagCell is the fixed value in the createFields.H; iagCell is calculated elsewhere just fine. alphaaa, F, Rg, T and alphaca are constants in the transportProperties. And EttaaCell is what I'm solving for. Please note that this equation cannot be rearranged such that EttaaCell is the subject of the equation. Note: when I rewrite the equation as f(EttaaCell) = 0; jbvagCell is fixed but EttaaCell remains zero! Many thanks in advance. Sandra |
|
June 1, 2015, 11:12 |
|
#8 |
Senior Member
|
Hi,
Unfortunately during the whole thread you are trying to show how you create volume field. Yet the most interesting parts are elsewhere and it is not possible to deduce: - What do you do with the field after creation? - What do you mean by "...still goes to zero when I check."? - How do you check the values of the field? - When do you check these values? - Are you sure you do not modify the field? You have shown this piece of code: Code:
jbvagCell = iagCell*((Foam::exp(alphaaa*F*EttaaCell/(Rg*T)))-(Foam::exp(-alphaca*F*EttaaCell/(Rg*T)))); |
|
June 1, 2015, 12:11 |
|
#9 |
Member
Sandra
Join Date: Oct 2014
Posts: 58
Rep Power: 11 |
-What do you do with the field after creation?
I set the field in createFields.H then use it in the above equation in a file.H and that's all I do with it. - What do you mean by "...still goes to zero when I check."? - How do you check the values of the field? - When do you check these values? In file.H, under the above eqn I have... Info<<jbvagCell>>endl; Info<<EttaaCell>>endl; Info<<iagCell>>endl; and that's how I track the values. - Are you sure you do not modify the field? I'm quite sure...the variable jbvagCell only appears twice; in the createFields.H and file.H Sandra |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[openSmoke] libOpenSMOKE | Tobi | OpenFOAM Community Contributions | 562 | January 25, 2023 09:21 |
[ICEM] How can I define different zones in ICEM? | llrr | ANSYS Meshing & Geometry | 14 | February 12, 2017 13:44 |
define volscalarfield | vahidzanganeh | OpenFOAM | 6 | January 21, 2013 06:35 |
OpenFOAM static build on Cray XT5 | asaijo | OpenFOAM Installation | 9 | April 6, 2011 12:21 |
OpenFOAM13 for Mac OSX Darwin 104 | hjasak | OpenFOAM Installation | 70 | September 24, 2010 05:06 |