CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Adding of a new thermotype (https://www.cfd-online.com/Forums/openfoam-programming-development/179822-adding-new-thermotype.html)

FlyingCat November 8, 2016 06:05

Adding of a new thermotype
 
Hi everybody,

I hope ereything is good for you.

I am struggling to add a new thermotype. I would like to use perfectfluid for my problem :

thermoType
{
type hePsiThermo;
mixture singleStepReactingMixture;
transport sutherland;
thermo janaf;
energy sensibleEnthalpy;
equationOfState perfectFluid;
specie specie;
}

I think I add all that openfoam needs:

1) In psiReactionThermos.C,

makeReactionThermo
(
psiThermo,
psiReactionThermo,
hePsiThermo,
singleStepReactingMixture,
sutherlandTransport,
sensibleEnthalpy,
janafThermo,
perfectFluid,
specie
);

2) In thermoPhysicsTypes.H,

typedef
sutherlandTransport
<
species::thermo
<
janafThermo
<
perfectFluid<specie>
>,
sensibleEnthalpy
>
> perfectFluidPhysics;

3) In reactionsTypes.H,

typedef Reaction<perfectFluidPhysics> perfectFluidReaction;

4) In makeReactions.C,

makeReactions(perfectFluidPhysics, perfectFluidReaction)

5) I even add something pointless for me (I think) in makeChemistryReaders.C:

makeChemistryReader(perfectFluidPhysics);
makeChemistryReaderType(foamChemistryReader, perfectFluidPhysics);


I compiled all of this and all OpenFOAM-dev. It works until I want to use the solver. I am using fireFoam but it is the same for an other solver, it stops at the beginning of the solver. I do not know if the case is important, I do not think so because it runs when I use perfectGas. I do not understand the error, the thermotype is added, I am sure of that it does not work. The message is:

Code:

Create time

Create mesh for time = 0


PIMPLE: Operating solver in PISO mode

Creating combustion model

Selecting combustion model infinitelyFastChemistry<psiThermoCombustion,gasHThermoPhysics>
Selecting thermodynamics package
{
    type            hePsiThermo;
    mixture        singleStepReactingMixture;
    transport      sutherland;
    thermo          janaf;
    energy          sensibleEnthalpy;
    equationOfState perfectFluid;
    specie          specie;
}

Selecting chemistryReader foamChemistryReader
    elements not defined in "/mnt/homesalmon/OpenFOAM/salmon-3.0.1/run/test2/constant/reactions"
Fuel heat of combustion :1.44058e+07
stoichiometric air-fuel ratio :5.7373
stoichiometric oxygen-fuel ratio :1.33583
Maximum products mass concentrations:
    H2O: 0.0869927
    CO2: 0.2598
    N2: 0.653207
[3] #0  Foam::error::printStack(Foam::Ostream&)[0] #0  Foam::error::printStack(Foam::Ostream&) at ??:?
[3] #1  Foam::sigFpe::sigHandler(int) at ??:?
[0] #1  Foam::sigFpe::sigHandler(int) at ??:?
[3] #2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
[3] #3  Foam::multiComponentMixture<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::perfectFluid<Foam::specie> >, Foam::sensibleEnthalpy> > >::patchFaceMixture(int, int) const at ??:?
[0] #2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
[0] #3  Foam::multiComponentMixture<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::perfectFluid<Foam::specie> >, Foam::sensibleEnthalpy> > >::patchFaceMixture(int, int) const at ??:?
[3] #4  Foam::heThermo<Foam::psiReactionThermo, Foam::SpecieMixture<Foam::singleStepReactingMixture<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::perfectFluid<Foam::specie> >, Foam::sensibleEnthalpy> > > > >::he(Foam::Field<double> const&, Foam::Field<double> const&, int) const at ??:?
[3] #5  Foam::heThermo<Foam::psiReactionThermo, Foam::SpecieMixture<Foam::singleStepReactingMixture<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::perfectFluid<Foam::specie> >, Foam::sensibleEnthalpy> > > > >::heThermo(Foam::fvMesh const&, Foam::word const&) at ??:?
[0] #4  Foam::heThermo<Foam::psiReactionThermo, Foam::SpecieMixture<Foam::singleStepReactingMixture<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::perfectFluid<Foam::specie> >, Foam::sensibleEnthalpy> > > > >::he(Foam::Field<double> const&, Foam::Field<double> const&, int) const at ??:?
[0] #5  Foam::heThermo<Foam::psiReactionThermo, Foam::SpecieMixture<Foam::singleStepReactingMixture<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::perfectFluid<Foam::specie> >, Foam::sensibleEnthalpy> > > > >::heThermo(Foam::fvMesh const&, Foam::word const&) at ??:?
[3] #6  Foam::psiReactionThermo::addfvMeshConstructorToTable<Foam::hePsiThermo<Foam::psiReactionThermo, Foam::SpecieMixture<Foam::singleStepReactingMixture<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::perfectFluid<Foam::specie> >, Foam::sensibleEnthalpy> > > > > >::New(Foam::fvMesh const&, Foam::word const&) at ??:?
[3] #7  Foam::autoPtr<Foam::psiReactionThermo> Foam::basicThermo::New<Foam::psiReactionThermo>(Foam::fvMesh const&, Foam::word const&) at ??:?
[0] #6  Foam::psiReactionThermo::addfvMeshConstructorToTable<Foam::hePsiThermo<Foam::psiReactionThermo, Foam::SpecieMixture<Foam::singleStepReactingMixture<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::perfectFluid<Foam::specie> >, Foam::sensibleEnthalpy> > > > > >::New(Foam::fvMesh const&, Foam::word const&) at ??:?
[3] #8  Foam::psiReactionThermo::New(Foam::fvMesh const&, Foam::word const&) at ??:?
[0] #7  Foam::autoPtr<Foam::psiReactionThermo> Foam::basicThermo::New<Foam::psiReactionThermo>(Foam::fvMesh const&, Foam::word const&) at ??:?
[0] #8  Foam::psiReactionThermo::New(Foam::fvMesh const&, Foam::word const&) at ??:?
[3] #9  Foam::combustionModels::psiThermoCombustion::psiThermoCombustion(Foam::word const&, Foam::fvMesh const&, Foam::word const&) at ??:?
[3] #10  Foam::combustionModels::singleStepCombustion<Foam::combustionModels::psiThermoCombustion, Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::perfectGas<Foam::specie> >, Foam::sensibleEnthalpy> > >::singleStepCombustion(Foam::word const&, Foam::fvMesh const&, Foam::word const&) at ??:?
[3] #11  Foam::combustionModels::psiCombustionModel::adddictionaryConstructorToTable<Foam::combustionModels::infinitelyFastChemistry<Foam::combustionModels::psiThermoCombustion, Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::perfectGas<Foam::specie> >, Foam::sensibleEnthalpy> > > >::New(Foam::word const&, Foam::fvMesh const&, Foam::word const&) at ??:?
[0] #9  Foam::combustionModels::psiThermoCombustion::psiThermoCombustion(Foam::word const&, Foam::fvMesh const&, Foam::word const&) at ??:?
[3] #12  Foam::combustionModels::psiCombustionModel::New(Foam::fvMesh const&, Foam::word const&) at ??:?
[0] #10  Foam::combustionModels::singleStepCombustion<Foam::combustionModels::psiThermoCombustion, Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::perfectGas<Foam::specie> >, Foam::sensibleEnthalpy> > >::singleStepCombustion(Foam::word const&, Foam::fvMesh const&, Foam::word const&) at ??:?
[3] #13  at ??:?
[0] #11  Foam::combustionModels::psiCombustionModel::adddictionaryConstructorToTable<Foam::combustionModels::infinitelyFastChemistry<Foam::combustionModels::psiThermoCombustion, Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::perfectGas<Foam::specie> >, Foam::sensibleEnthalpy> > > >::New(Foam::word const&, Foam::fvMesh const&, Foam::word const&)? at ??:?
[0] #12  Foam::combustionModels::psiCombustionModel::New(Foam::fvMesh const&, Foam::word const&) at ??:?
[3] #14  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
[3] #15  at ??:?
[0] #13  ?? at ??:?
[pouillot:28627] *** Process received signal ***
[pouillot:28627] Signal: Floating point exception (8)
[pouillot:28627] Signal code:  (-6)
[pouillot:28627] Failing at address: 0x71c300006fd3
[pouillot:28627] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x36d40)[0x7fe31bc22d40]
[pouillot:28627] [ 1] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x39)[0x7fe31bc22cc9]
[pouillot:28627] [ 2] /lib/x86_64-linux-gnu/libc.so.6(+0x36d40)[0x7fe31bc22d40]
[pouillot:28627] [ 3] /mnt/homesalmon/OpenFOAMdev/OpenFOAM-dev/platforms/linux64Gcc48DPInt32Opt/lib/libreactionThermophysicalModels.so(_ZNK4Foam21multiComponentMixtureINS_19sutherlandTransportINS_7species6thermoINS_11janafThermoINS_12perfectFluidINS_6specieEEEEENS_16sensibleEnthalpyEEEEEE16patchFaceMixtureEii+0xb71)[0x7fe3208f1831]
[pouillot:28627] [ 4] /mnt/homesalmon/OpenFOAMdev/OpenFOAM-dev/platforms/linux64Gcc48DPInt32Opt/lib/libreactionThermophysicalModels.so(_ZNK4Foam8heThermoINS_17psiReactionThermoENS_13SpecieMixtureINS_25singleStepReactingMixtureINS_19sutherlandTransportINS_7species6thermoINS_11janafThermoINS_12perfectFluidINS_6specieEEEEENS_16sensibleEnthalpyEEEEEEEEEE2heERKNS_5FieldIdEESL_i+0x9e)[0x7fe3208f1f7e]
[pouillot:28627] [ 5] /mnt/homesalmon/OpenFOAMdev/OpenFOAM-dev/platforms/linux64Gcc48DPInt32Opt/lib/libreactionThermophysicalModels.so(_ZN4Foam8heThermoINS_17psiReactionThermoENS_13SpecieMixtureINS_25singleStepReactingMixtureINS_19sutherlandTransportINS_7species6thermoINS_11janafThermoINS_12perfectFluidINS_6specieEEEEENS_16sensibleEnthalpyEEEEEEEEEEC2ERKNS_6fvMeshERKNS_4wordE+0x3c3)[0x7fe320947133]
[pouillot:28627] [ 6] /mnt/homesalmon/OpenFOAMdev/OpenFOAM-dev/platforms/linux64Gcc48DPInt32Opt/lib/libreactionThermophysicalModels.so(_ZN4Foam17psiReactionThermo27addfvMeshConstructorToTableINS_11hePsiThermoIS0_NS_13SpecieMixtureINS_25singleStepReactingMixtureINS_19sutherlandTransportINS_7species6thermoINS_11janafThermoINS_12perfectFluidINS_6specieEEEEENS_16sensibleEnthalpyEEEEEEEEEEEE3NewERKNS_6fvMeshERKNS_4wordE+0x2e)[0x7fe32094729e]
[pouillot:28627] [ 7] /mnt/homesalmon/OpenFOAMdev/OpenFOAM-dev/platforms/linux64Gcc48DPInt32Opt/lib/libreactionThermophysicalModels.so(_ZN4Foam11basicThermo3NewINS_17psiReactionThermoEEENS_7autoPtrIT_EERKNS_6fvMeshERKNS_4wordE+0x1b0)[0x7fe3208d15d0]
[pouillot:28627] [ 8] /mnt/homesalmon/OpenFOAMdev/OpenFOAM-dev/platforms/linux64Gcc48DPInt32Opt/lib/libreactionThermophysicalModels.so(_ZN4Foam17psiReactionThermo3NewERKNS_6fvMeshERKNS_4wordE+0x9)[0x7fe3208cf739]
[pouillot:28627] [ 9] /mnt/homesalmon/OpenFOAMdev/OpenFOAM-dev/platforms/linux64Gcc48DPInt32Opt/lib/libcombustionModels.so(_ZN4Foam16combustionModels19psiThermoCombustionC1ERKNS_4wordERKNS_6fvMeshES4_+0x3c)[0x7fe31f36de3c]
[pouillot:28627] [10] /mnt/homesalmon/OpenFOAMdev/OpenFOAM-dev/platforms/linux64Gcc48DPInt32Opt/lib/libcombustionModels.so(_ZN4Foam16combustionModels20singleStepCombustionINS0_19psiThermoCombustionENS_19sutherlandTransportINS_7species6thermoINS_11janafThermoINS_10perfectGasINS_6specieEEEEENS_16sensibleEnthalpyEEEEEEC1ERKNS_4wordERKNS_6fvMeshESH_+0x1c)[0x7fe31f394c8c]
[pouillot:28627] [11] /mnt/homesalmon/OpenFOAMdev/OpenFOAM-dev/platforms/linux64Gcc48DPInt32Opt/lib/libcombustionModels.so(_ZN4Foam16combustionModels18psiCombustionModel31adddictionaryConstructorToTableINS0_23infinitelyFastChemistryINS0_19psiThermoCombustionENS_19sutherlandTransportINS_7species6thermoINS_11janafThermoINS_10perfectGasINS_6specieEEEEENS_16sensibleEnthalpyEEEEEEEE3NewERKNS_4wordERKNS_6fvMeshESK_+0x38)[0x7fe31f39f6c8]
[pouillot:28627] [12] /mnt/homesalmon/OpenFOAMdev/OpenFOAM-dev/platforms/linux64Gcc48DPInt32Opt/lib/libcombustionModels.so(_ZN4Foam16combustionModels18psiCombustionModel3NewERKNS_6fvMeshERKNS_4wordE+0x347)[0x7fe31f36d6b7]
[pouillot:28627] [13] fireFoam[0x43ca21]
[pouillot:28627] [14] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7fe31bc0dec5]
[pouillot:28627] [15] fireFoam[0x443246]
[pouillot:28627] *** End of error message ***
--------------------------------------------------------------------------
mpirun noticed that process rank 3 with PID 28627 on node pouillot exited on signal 8 (Floating point exception).
--------------------------------------------------------------------------

Thanks for your help if you can.

FlyingCat November 18, 2016 03:45

No help ?
 
Hello,

nobody has suggestion ? If someone could tell me what can be wrong in the steps.

Have a good day.

cecile May 19, 2017 08:57

New equation of state
 
Hello Fabien,

I am trying to do the same thing as you, but i have difficulties so i was wondering if you managed to do what you wanted...
I created a new thermophysical model in order to implement a new equation of state with a custom solver derived from reactingFoam.
It works when i am in a non reacting case, but when i add combustion, my solver don't recognize my new equation of state any more.

If you succeeded in your task, you maybe have some advices for me to make it work ...?

Thanks in advance,

Have a nice day,

Cécile

FlyingCat May 19, 2017 09:19

Hello,

I gave up (sorry) concerning this implementation because actually, it was not usefull for me.

However, I think you should put the error message that you have because it can help me (perhaps).

An other possibility is to use an eos that is recognized by reactingFoam and modify within the eos file (do not do that for perfect gas because it is linked with janaf and I think you cannot).

Moreover, have you done all the steps that I had done ?

Have a good day (if you can:p)

cecile May 19, 2017 10:19

Thank you so much for answering me !

Yes i have done all the steps that you have done.

I have created new libspecie.so and libreactionThermophysicalModels.so libraries with my eos. But when i run a reacting case it doesn't see the new libraries, execution fails because of the wrong thermo model while it runs well in a cold case.

You gave me a clue because my custom eos is derived from parfectGas and i use janaf thermo tables, i am going to look this point further...

Thanks again!
Cécile

FlyingCat May 19, 2017 10:32

Ok keep me up to date, I am still interested.

Swagga5aur May 20, 2017 08:00

Hello you two, I don't know if this is of any help, but I implemented a new thermo type with a new janaf model(note that this janaf model is equal to the one implemetented in openFOAM) and transport model, which I used with the multiRegionSimpleReactingFoam solver, link: https://github.com/TonkomoLLC/multiRegionReactingFoam.

I have linked a dropbox link to the developed thermotype ready to be build as well as a case with the solver and thermotype implemented.
The mentioned solver is also included in the dropbox link.

Hope its to any help.

https://www.dropbox.com/s/7igba23zvj...er.tar.gz?dl=0
Please note if you wan't to run my example, run the AllMesh, then copy the content of the .org folders to the respective directories and then run the Allrun.

cecile May 22, 2017 10:00

Thank you for your files!
I'm gonna have a look and try to understand how it works.

Swagga5aur May 22, 2017 10:11

Let me know if there is any issues with running the example case.

LennyZ February 16, 2019 06:02

openFOAM 6 -- add thermoType
 
Hi There!


Trying to add e.g. a custom equation of state:


thermoType
{
type heRhoThermo;
mixture pureMixture;
transport const;
thermo hConst;
equationOfState myState;
specie specie;
energy sensibleEnthalpy;

}


It used to work perfectly well under opneFOAM 4.x in the sense that it recognized the combination while running a CHT multi-region solver. Now that combustion has been added to the multi-region solver, the combination is not recognized even though I have done everything previously used in 4.x and what is described in the beginning of this thread. The 4.x CHT multi-region solver recompiled for openFOAM 6 also works fine. The error I get is Unknown rhoReactionThermo Type ... as if it is not part of thermos.



https://www.cfd-online.com/Forums/da...AASUVORK5CYII=


And the confusing thing is that if I add a thermo to rhoReacationThermos.C it also works ... but there is no pureMixture.


Has anyone seen this before?



Thanks!

Swagga5aur February 16, 2019 10:45

Hello LennyZ,

Are you able to upload a compile ready case of the custom thermoType so that I can try to solve the issue?

Regards Lasse

LennyZ February 17, 2019 00:50

Hello Lasse,


It'll take a bit of effort to upload something as an example. What I can say is that is quite standard -- the usual changes in therrmophicalModels/specie & basic described above (very top) in the thread. I am sure it is not syntax since, like I said, if I simply change the solvers from this new (openFOAM 6) chtMultiRegionFoam to my old 4.x (but recompiled to openFOAM 6) solver the thermoType combination -- there is no issue. Frankly, it is not just the equation of state -- all of the entries are custom: transport, thermo and equation of state, and am I talking about heRhoThermo.


chtMultiRegionFoam.C includes these, and it looks like rhoReactionThermo.H here instead of rhoThermo.H is responsible ... requires something I do not do, or do something I should not do. There is a detailed wiki on chtMultiRegionFoam.C.



#include "fvCFD.H"

#include "turbulentFluidThermoModel.H" #include "rhoReactionThermo.H" #include "CombustionModel.H" #include "fixedGradientFvPatchFields.H" #include "regionProperties.H" #include "compressibleCourantNo.H" #include "solidRegionDiffNo.H" #include "solidThermo.H" #include "radiationModel.H" #include "fvOptions.H" #include "coordinateSystem.H" #include "pimpleMultiRegionControl.H" #include "pressureControl.H"

LennyZ February 18, 2019 07:39

Solved, perhaps
 
... I think I have figured out this one out. There is quite a few things I have tried in "reactionThermo" ... but the key element that I missed is probably a "makeThermoPhysicsReactionThermo" in "rhoReactionThermos.C" like this:


makeThermoPhysicsReactionThermo
(
rhoReactionThermo,
heRhoThermo,
singleComponentMixture,
my_blah_blah_Physics

);


This way the CHT solver somehow finds its way to specie and rhoThermo, to rhoThermos.C where the type combination with a pureMixture is listed as a Thermos.


So for now I think that is issue is closed (this is again: openFOAM 6). And it is probably similar in openFOAM 4.x too and elsewhere.


All times are GMT -4. The time now is 13:09.