|
[Sponsors] |
July 22, 2022, 01:42 |
Adding new lookup parameter to OF21
|
#1 |
Senior Member
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 8 |
Hello all
I want to add a new dimensionless parameter to pimpleFoam in OF21. I know that if I add these lines to OF6 or OF7, it will work, but it does not work in OF21; Code:
dimensionedScalar FFarzad ( "FFarzad", dimless, transportProperties.lookup("FFarzad") ); Error; Code:
pimpleFoamEpsilonGeneral.C: In function ‘int main(int, char**)’: pimpleFoamEpsilonGeneral.C:205:6: error: ‘transportProperties’ was not declared in this scope transportProperties.lookup("FFarzad") ^~~~~~~~~~~~~~~~~~~ pimpleFoamEpsilonGeneral.C:205:6: note: suggested alternative: ‘transportModel_H’ transportProperties.lookup("FFarzad") ^~~~~~~~~~~~~~~~~~~ transportModel_H In file included from pimpleFoamEpsilonGeneral.C:353:0: Farzas |
|
July 22, 2022, 02:52 |
|
#2 |
Member
Join Date: Jan 2022
Location: Germany
Posts: 72
Rep Power: 4 |
The reason for that is, that the transport properties dictionary gets defined within the createFields.H file in OF6. I assume that it gets initialized somewhere else
Most probably this dictionary is defined elsewhere (after the createFields.H) file or within an object. Since I'm not familiar with the ESI version, but maybe this will work out for you: Make a reference to the dictionary Code:
const dictionary& transportProperties = db().lookupObject<IOdictionary>("transportProperties"); Code:
dimensionedScalar FFarzad ( "FFarzad", dimless, transportProperties.lookup("FFarzad") ); It should also be possible to gain acces by following code, but I dont know exactly. Code:
dimensionedScalar FFarzad ( "FFarzad", dimless, db().lookupObject<IOdictionary> ( "transportProperties" ).lookup("FFarzad") ); Last edited by überschwupper; July 22, 2022 at 03:00. Reason: i dont get the formatting... |
|
July 22, 2022, 23:00 |
|
#3 |
Senior Member
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 8 |
Thanks überschwupper. It worked, but what about scalar lookup?
I used below code and it gives me error; Code:
scalar prescribedTKE; prescribedTKE(transportProperties.lookup("prescribedTKE")); Code:
pimpGeneral.C:217:61: error: ‘prescribedTKE’ cannot be used as a function prescribedTKE(transportProperties.lookup("prescribedTKE")); Farzad |
|
July 23, 2022, 04:25 |
|
#4 | |
Senior Member
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 8 |
This solves the problem for scalars;
Code:
IOdictionary transportProperties ( IOobject ( "transportProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); scalar prescribedTKE; transportProperties.lookup("prescribedTKE") >> prescribedTKE ; Quote:
|
||
July 25, 2022, 05:21 |
|
#5 | |
Member
Join Date: Jan 2022
Location: Germany
Posts: 72
Rep Power: 4 |
Quote:
When you want to initialize your variable, then you need a declarator to use the direct initialization. If you want to seperate the declaration and the definition you have to use the assignment operator, otherwise it will be regocnized as a function. Code:
scalar prescribedTKE(transportProperties.lookup<scalar>("prescribedTKE")); should work fine. |
||
Tags |
lookup, new parameter, of21, openfoam2106 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
multiRegionHeater error | ordinary | OpenFOAM Running, Solving & CFD | 2 | June 9, 2020 18:43 |
Long output in terminal. | ssa_cfd | OpenFOAM Running, Solving & CFD | 1 | March 18, 2019 06:25 |
DPMFoam - Serious Error --particle-laden flow in simple geometric config | benz25 | OpenFOAM Running, Solving & CFD | 27 | December 19, 2017 21:47 |
conjugateHeatFoam + interFoam | farhagim | OpenFOAM Programming & Development | 15 | July 19, 2016 08:55 |
Convergence on anisotropic tetahedral meshes | pbo | OpenFOAM Running, Solving & CFD | 12 | December 14, 2010 12:59 |