CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Adding of a new thermotype

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By Swagga5aur

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 8, 2016, 07:05
Default Adding of a new thermotype
  #1
Member
 
Jean bon
Join Date: Sep 2016
Posts: 43
Rep Power: 10
FlyingCat is on a distinguished road
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 is offline   Reply With Quote

Old   November 18, 2016, 04:45
Default No help ?
  #2
Member
 
Jean bon
Join Date: Sep 2016
Posts: 43
Rep Power: 10
FlyingCat is on a distinguished road
Hello,

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

Have a good day.
FlyingCat is offline   Reply With Quote

Old   May 19, 2017, 09:57
Default New equation of state
  #3
New Member
 
cecile
Join Date: Oct 2015
Posts: 6
Rep Power: 11
cecile is on a distinguished road
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
cecile is offline   Reply With Quote

Old   May 19, 2017, 10:19
Default
  #4
Member
 
Jean bon
Join Date: Sep 2016
Posts: 43
Rep Power: 10
FlyingCat is on a distinguished road
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)
FlyingCat is offline   Reply With Quote

Old   May 19, 2017, 11:19
Default
  #5
New Member
 
cecile
Join Date: Oct 2015
Posts: 6
Rep Power: 11
cecile is on a distinguished road
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
cecile is offline   Reply With Quote

Old   May 19, 2017, 11:32
Default
  #6
Member
 
Jean bon
Join Date: Sep 2016
Posts: 43
Rep Power: 10
FlyingCat is on a distinguished road
Ok keep me up to date, I am still interested.
FlyingCat is offline   Reply With Quote

Old   May 20, 2017, 09:00
Post
  #7
Senior Member
 
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 118
Rep Power: 11
Swagga5aur is on a distinguished road
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.
mickbatti and luonghungtruyen like this.
Swagga5aur is offline   Reply With Quote

Old   May 22, 2017, 11:00
Default
  #8
New Member
 
cecile
Join Date: Oct 2015
Posts: 6
Rep Power: 11
cecile is on a distinguished road
Thank you for your files!
I'm gonna have a look and try to understand how it works.
cecile is offline   Reply With Quote

Old   May 22, 2017, 11:11
Post
  #9
Senior Member
 
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 118
Rep Power: 11
Swagga5aur is on a distinguished road
Let me know if there is any issues with running the example case.
Swagga5aur is offline   Reply With Quote

Old   February 16, 2019, 07:02
Default openFOAM 6 -- add thermoType
  #10
New Member
 
Join Date: Nov 2016
Posts: 8
Rep Power: 10
LennyZ is on a distinguished road
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.






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!
LennyZ is offline   Reply With Quote

Old   February 16, 2019, 11:45
Default
  #11
Senior Member
 
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 118
Rep Power: 11
Swagga5aur is on a distinguished road
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
Swagga5aur is offline   Reply With Quote

Old   February 17, 2019, 01:50
Default
  #12
New Member
 
Join Date: Nov 2016
Posts: 8
Rep Power: 10
LennyZ is on a distinguished road
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 is offline   Reply With Quote

Old   February 18, 2019, 08:39
Default Solved, perhaps
  #13
New Member
 
Join Date: Nov 2016
Posts: 8
Rep Power: 10
LennyZ is on a distinguished road
... 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.
LennyZ is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How I can introduce my power heat (W) in chtMultiRegionFoam? aminem OpenFOAM Pre-Processing 32 August 29, 2019 03:23
conjugateHeatFoam + interFoam farhagim OpenFOAM Programming & Development 15 July 19, 2016 08:55
chtMultiRegionSimpleFoam 3D problem Lucie OpenFOAM Pre-Processing 2 June 21, 2016 06:23
chtMultiRegionSimpleFoam samiam1000 OpenFOAM Running, Solving & CFD 39 March 31, 2016 09:43
Help with chtMultiRegionFoam jbvw96 OpenFOAM Running, Solving & CFD 2 December 26, 2010 18:16


All times are GMT -4. The time now is 07:01.