|
[Sponsors] |
Reading a value from fvSolution into custom simpleFoam |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 17, 2020, 10:08 |
Reading a value from fvSolution into custom simpleFoam
|
#1 |
Senior Member
Klaus
Join Date: Mar 2009
Posts: 260
Rep Power: 22 |
I want to use an additional value in my custom simpleFoam solver but am not able to read it from the fvSolution dictionary "SIMPLE" section.
The default value should be 4. I tried: Code:
const int A_ = controlDict_.lookupOrDefault<label> ("A", 4); Code:
SIMPLE { nNonOrthogonalCorrectors 0; pRefCell 0; pRefValue 0; A 4; } |
|
August 17, 2020, 10:58 |
|
#2 |
Senior Member
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 414
Rep Power: 17 |
It looks like you are trying to read the value from controlDict, not fvSolution.
|
|
August 17, 2020, 11:27 |
|
#3 |
Senior Member
Klaus
Join Date: Mar 2009
Posts: 260
Rep Power: 22 |
It's not that simple, I tried fvSolution too but the problem seems to be related to the definition of the dictionary to be accessed. Unfortunately I can only find examples related to custom dictionaries, not the standard ones.
|
|
August 17, 2020, 13:03 |
|
#4 |
Senior Member
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 414
Rep Power: 17 |
Fair enough, but aribitrarily trying to read it from the wrong dictionary is sure to fail!
|
|
August 17, 2020, 13:12 |
|
#5 |
Senior Member
Klaus
Join Date: Mar 2009
Posts: 260
Rep Power: 22 |
I tried different ways and dictionaries including a custom dictionary. I did it when I used pervious versions of OpenFOAM. Maybe something changed with OF7.
|
|
August 17, 2020, 13:13 |
|
#6 |
Senior Member
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 414
Rep Power: 17 |
Check out the class definition for fvSolution:
Code:
Class Foam::fvSolution Description Selector class for finite volume solution solution. fvMesh is derived from fvSolution so that all fields have access to the fvSolution from the mesh reference they hold. Code:
fvSolution(static_cast<const objectRegistry&>(*this)) |
|
August 18, 2020, 06:47 |
|
#7 |
Senior Member
Klaus
Join Date: Mar 2009
Posts: 260
Rep Power: 22 |
This is, how it worked:
Code:
const word dictName("fvSolution"); IOdictionary solutionDict ( IOobject ( dictName, runTime.system(), //folder where the fvSolution file is located runTime, IOobject::MUST_READ ) ); dictionary& mysimplesubDict = solutionDict.subDict("mySIMPLE"); // subsection where the values are stored int A1_ = (mysimplesubDict.lookupOrDefault<label>("A1", 2)); int A2_ = (mysimplesubDict.lookupOrDefault<label>("A2", 2)); |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Parallel Block Size Issue | ChiefSeaBiscuit | CONVERGE | 5 | July 22, 2016 14:03 |
OpenFOAM floating point Error | upuli | OpenFOAM Programming & Development | 5 | June 20, 2016 03:19 |
Cht tutorial in 15 | braennstroem | OpenFOAM Running, Solving & CFD | 197 | June 10, 2015 03:02 |
Possible Bug in pimpleFoam (or createPatch) (or fluent3DMeshToFoam) | cfdonline2mohsen | OpenFOAM | 3 | October 21, 2013 09:28 |
[GAMBIT] periodic faces not matching | Aadhavan | ANSYS Meshing & Geometry | 6 | August 31, 2013 11:25 |