|
[Sponsors] |
January 20, 2020, 03:50 |
create time independent volScalarField
|
#1 |
Member
ssa
Join Date: Sep 2018
Posts: 93
Rep Power: 7 |
Hi all,
I am trying to create a volScalarField for storing reaction rates kf and kr in my calculation. In my simulation case, the kf and kr variables are constant throughout the simulation. I created a volScalarFields for the reaction rates as follows. Code:
PtrList<volScalarField> kf(N); Info << "Creating fields for kf" << endl; for(int i = 0; i < N; i++) { word kfi ("kf-un-named-reaction-" + name(i)); kf.set ( i, new volScalarField ( IOobject ( kfi, runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh , dimensionedScalar(kfi, dimless, 0.0) ) ); } PtrList<volScalarField> kr(N); Info << "Creating fields for kr" << endl; for(int i = 0; i < N; i++) { word kri ("kr-un-named-reaction-" + name(i)); kr.set ( i, new volScalarField ( IOobject ( kri, runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh , dimensionedScalar(kri, dimless, 0.0) ) ); } But when I check, it creates volScalarField also for the Previous Iteration. It creates 4 volScalarFields for each reaction. (kf, kfPrevIter, kr, krPrevIter). Since the number of reactions is large, the simulation takes too much memory and slows down the simulation. I want to make it constant such that it creates only two volScalarField (kf and kr). Does anyone know how to do it.? Thanks in advance, ssa. |
|
January 20, 2020, 13:50 |
|
#2 |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 15 |
Would it help if you do not register the variables?
Code:
kf.set ( i, new volScalarField ( IOobject ( kfi, runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE, false ), mesh, dimensionedScalar(kfi, dimless, 0.0) ) ); |
|
January 21, 2020, 03:25 |
|
#3 |
Member
ssa
Join Date: Sep 2018
Posts: 93
Rep Power: 7 |
If I do not register the fields, it deletes all the four (kf, kfPrevIter, kr, krPrevIter) volScalarFields.
I couldn't access kf and kr in the calculations. |
|
January 24, 2020, 10:27 |
|
#4 |
Member
ssa
Join Date: Sep 2018
Posts: 93
Rep Power: 7 |
I found a function called checkout() in the regIOobject.c ,
but it also deletes all the four fields. Does someone know how to delete only the prevIter fields?? |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Time Step Continuity Errors simpleFoam | Dorian1504 | OpenFOAM Running, Solving & CFD | 1 | October 9, 2022 09:23 |
Setting up Lid driven Cavity Benchmark with 1M cells for multiple cores | puneet336 | OpenFOAM Running, Solving & CFD | 11 | April 7, 2019 00:58 |
same geometry,structured and unstructured mesh,different behaviour. | sharonyue | OpenFOAM Running, Solving & CFD | 13 | January 2, 2013 22:40 |
Where's the singularity/mesh flaw? | audrich | FLUENT | 3 | August 4, 2009 01:07 |
fluent add additional zones for the mesh file | SSL | FLUENT | 2 | January 26, 2008 11:55 |