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

Using PengRobinsonGas EoS with sprayFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree17Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 25, 2014, 07:51
Default Using PengRobinsonGas EoS with sprayFoam
  #1
New Member
 
James Guthrie
Join Date: Sep 2014
Posts: 16
Rep Power: 12
Jabo is on a distinguished road
Hi guys,

My first post here.

I'm modifying the existing aachenBomb tutorial, to simulate the experiments done by Mayer et. al. - "Raman Measurements of Cryogenic Injection at Supercritical Pressure"

I need to be able to use the PengRobinsonGas equation of state. I've built OF 2.3.x from the GitHub source today.

I modified my thermophysicalProperties as such:

Code:
thermoType
{
    type            hePsiThermo;
    mixture         pureMixture;
    transport       sutherland;
    thermo          hConst;
    energy          sensibleEnthalpy;
    equationOfState PengRobinsonGas;
    specie          specie;
}
and my combustionProperties as such:

Code:
combustionModel noCombustion<psiThermoCombustion>;
active    false;
I made those modifications as that's what's details in the psiThermos source, https://github.com/OpenFOAM/OpenFOAM...o/psiThermos.C

chemistryProperties is set as such:

Code:
chemistryType
{
    chemistrySolver   noChemistrySolver;
    chemistryThermo   psi;
}

chemistry       off;
This produces an 'Unknown psiReactionThermo type' error and the valid types listed does not contain PengRobinsonGas under the equationOfState. Only perfectGas.

So how do I go about making this work or is it a bug?
Jabo is offline   Reply With Quote

Old   September 27, 2014, 00:08
Question
  #2
New Member
 
James Guthrie
Join Date: Sep 2014
Posts: 16
Rep Power: 12
Jabo is on a distinguished road
So I realised I had to build a new psiReactionThermo:

Code:
makeReactionThermo
(
    psiThermo,
    psiReactionThermo,
    hePsiThermo,
    reactingMixture,
    sutherlandTransport,
    sensibleEnthalpy,
    janafThermo,
    PengRobinsonGas,
    specie
);
I compiled the psiReactionThermo without error but attempting to compile sprayFoam gave this error:

/home/james/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/lib/libreactionThermophysicalModels.so: undefined reference to `Foam::chemistryReader<Foam::sutherlandTransport<F oam::species::thermo<Foam::janafThermo<Foam::PengR obinsonGas<Foam::specie> >, Foam::sensibleEnthalpy> > >::dictionaryConstructorTablePtr_'
collect2: error: ld returned 1 exit status
make: *** [/home/james/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/bin/sprayFoam] Error 1


I've tried cleaning and making the model and the solver.

Please help!

Last edited by Jabo; September 27, 2014 at 01:33. Reason: Updated
Jabo is offline   Reply With Quote

Old   September 27, 2014, 17:17
Default
  #3
New Member
 
James Guthrie
Join Date: Sep 2014
Posts: 16
Rep Power: 12
Jabo is on a distinguished road
I think I'm not rebuilding everything that I should be or I'm just missing a step. I edited the thermo model, rebuilt it and rebuilt the solver.

What have I missed?
Jabo is offline   Reply With Quote

Old   September 29, 2014, 18:00
Cool
  #4
New Member
 
James Guthrie
Join Date: Sep 2014
Posts: 16
Rep Power: 12
Jabo is on a distinguished road
Ok, here's what I missed.

To run my simulations with:

Code:
thermoType
{
    type            hePsiThermo;
    mixture         reactingMixture;
    transport       sutherland;
    thermo          janaf;
    energy          sensibleEnthalpy;
    equationOfState PengRobinsonGas;
    specie          specie;
}
I had to create:
Code:
typedef
    sutherlandTransport
    <
        species::thermo
        <
            janafThermo
            <
                PengRobinsonGas<specie>
            >,
            sensibleEnthalpy
        >
    > PengRobinsonGasPhysics;
in thermophysicalModels/species/include/thermoPhysicsTypes.H

and,

Code:
 typedef Reaction<PengRobinsonGasPhysics> PengRobinsonGasReaction;
in reactionTypes.H in that folder,

and,

Code:
makeReactionMixtureThermo
(
    psiThermo,
    psiReactionThermo,
    hePsiThermo,
    reactingMixture,
    PengRobinsonGasPhysics
);
in psiReactionThermos.C, and

Code:
makeChemistryReader(PengRobinsonGasPhysics);
makeChemistryReaderType(foamChemistryReader, PengRobinsonGasPhysics);
in reactionThermo/chemistryReaders/chemistryReader/makeChemistryReaders.C, and

Code:
makeReactions(PengRobinsonGasPhysics, PengRobinsonGasReaction)
in specie/reaction/reactions/makeReactions.C

I believe that's it. Allwmake the thermophysicalModels and the sprayFoam solver.

Figured that all out by myself
Bahram likes this.
Jabo is offline   Reply With Quote

Old   September 30, 2014, 15:23
Default
  #5
Member
 
Arash Mahboubidoust
Join Date: Jun 2013
Location: Iran
Posts: 58
Rep Power: 13
arashfluid is on a distinguished road
Send a message via Yahoo to arashfluid
Did you fix undefined reference error?
arashfluid is offline   Reply With Quote

Old   September 30, 2014, 15:27
Default
  #6
New Member
 
James Guthrie
Join Date: Sep 2014
Posts: 16
Rep Power: 12
Jabo is on a distinguished road
Yeah, my modifications fixed that error.
Jabo is offline   Reply With Quote

Old   September 30, 2014, 15:45
Default
  #7
Member
 
Arash Mahboubidoust
Join Date: Jun 2013
Location: Iran
Posts: 58
Rep Power: 13
arashfluid is on a distinguished road
Send a message via Yahoo to arashfluid
Which of the above code you added recently?
I have added variable and source term equation to icoflow.H and icoflow.C files.Should I add something else?
arashfluid is offline   Reply With Quote

Old   September 30, 2014, 15:47
Default
  #8
New Member
 
James Guthrie
Join Date: Sep 2014
Posts: 16
Rep Power: 12
Jabo is on a distinguished road
I don't know about that one. My solution is to add new equations of state to the existing psiReactionThermo model. I think ours problems are unrelated.
Jabo is offline   Reply With Quote

Old   January 17, 2015, 07:34
Default
  #9
New Member
 
Peter Bishop
Join Date: Jan 2012
Posts: 20
Rep Power: 14
PeterBishop is on a distinguished road
Hi Jabo,
I'm trying to modify the source code according to your suggestions but with no succes!

Could you please share your files to let me understand where I'm wrong, thank you!
PeterBishop is offline   Reply With Quote

Old   October 12, 2018, 06:42
Default
  #10
Member
 
Join Date: Sep 2018
Location: France
Posts: 62
Rep Power: 8
john myce is on a distinguished road
Hi everyone,

I am working on the same subject, did you succeed to set up the sprayFoam solver to visualise LN2 with the Janaf table ? Because the initial range of temperature is from 200 K to 6000 K.

Cheers

Last edited by john myce; October 16, 2018 at 07:42.
john myce is offline   Reply With Quote

Old   October 17, 2018, 13:49
Default
  #11
Member
 
Join Date: Sep 2018
Location: France
Posts: 62
Rep Power: 8
john myce is on a distinguished road
By the way the method written by James works for me.
I have attached my files in case someone has an error.

Make for specie directory:

Code:
atomicWeights/atomicWeights.C
specie/specie.C
reaction/reactions/makeReactions.C
reaction/reactions/makeLangmuirHinshelwoodReactions.C

LIB = $(FOAM_USER_LIBBIN)/libspecie
Make for reactionthermo directory:

Code:
chemistryReaders/chemkinReader/chemkinReader.C
chemistryReaders/chemkinReader/chemkinLexer.L
chemistryReaders/chemistryReader/makeChemistryReaders.C

mixtures/basicMultiComponentMixture/basicMultiComponentMixture.C
mixtures/basicSpecieMixture/basicSpecieMixture.C
mixtures/basicCombustionMixture/basicCombustionMixture.C

psiReactionThermo/psiReactionThermo.C
psiReactionThermo/psiReactionThermos.C

psiuReactionThermo/psiuReactionThermo.C
psiuReactionThermo/psiuReactionThermos.C

rhoReactionThermo/rhoReactionThermo.C
rhoReactionThermo/rhoReactionThermos.C

derivedFvPatchFields/fixedUnburntEnthalpy/fixedUnburntEnthalpyFvPatchScalarField.C
derivedFvPatchFields/gradientUnburntEnthalpy/gradientUnburntEnthalpyFvPatchScalarField.C
derivedFvPatchFields/mixedUnburntEnthalpy/mixedUnburntEnthalpyFvPatchScalarField.C

functionObjects/moleFractions/moleFractionsFunctionObjects.C

LIB = $(FOAM_USER_LIBBIN)/libreactionThermophysicalModels
Code:
EXE_INC = \
    -I$(LIB_SRC)/transportModels/compressible/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
    -I$(WM_PROJECT_USER_DIR)/src/thermophysicalModels/specie/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude \
    -I$(LIB_SRC)/finiteVolume/lnInclude

LIB_LIBS = \
    -lcompressibleTransportModels \
    -lfluidThermophysicalModels \
    -L$(FOAM_USER_LIBBIN)/lspecie \
    -lsolidSpecie \
    -lfiniteVolume
Attached Files
File Type: h reactionTypes.H (2.6 KB, 58 views)
File Type: h thermoPhysicsTypes.H (4.8 KB, 51 views)
File Type: c psiReactionThermos.C (5.5 KB, 50 views)
File Type: c makeChemistryReaders.C (3.5 KB, 41 views)
File Type: c makeReactions.C (5.2 KB, 46 views)
mickbatti and m.omair like this.
john myce is offline   Reply With Quote

Old   October 23, 2018, 19:37
Default
  #12
New Member
 
Join Date: Jul 2012
Posts: 10
Rep Power: 14
mickbatti is on a distinguished road
Hi John

I am trying to use your files, based on the method described by James. I compiled my thermophysicalModels library and also compiled a new reactingFoam with this library.
Now, if I test the solver using PengRobinsonGas on the tutorial case counterFlowFlame2D, deactivating the combustion as above, I get stuck. The code does not give me errors, but it stops after "foamChemistryReader"

Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  3.0.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 3.0.1-d8a290b55d28
Exec   : myReactingFoam
Date   : Oct 24 2018
Time   : 00:28:40
PID    : 4838
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


PIMPLE: Operating solver in PISO mode


Reading g
Creating reaction model

Selecting combustion model noCombustion<psiThermoCombustion>
Selecting thermodynamics package
{
    type            hePsiThermo;
    mixture         reactingMixture;
    transport       sutherland;
    thermo          janaf;
    energy          sensibleEnthalpy;
    equationOfState PengRobinsonGas;
    specie          specie;
}

Selecting chemistryReader foamChemistryReader

Any ideas why?
I think the foamChemistryReader needs some modifications to work with PengRobinsonGas, but can't figure it out
mickbatti is offline   Reply With Quote

Old   October 24, 2018, 15:14
Default
  #13
Member
 
Join Date: Sep 2018
Location: France
Posts: 62
Rep Power: 8
john myce is on a distinguished road
Hi,

Strange.. since we have added the pengrobinson physics to the foamChemistryReader I don t think it needs something else. Maybe try to run the simulation with the basic solver and add in the controlDict file the modified reactionthermo and the specie libraries.

Like:

Code:
libs
{
        "libname.so"
        "libname.so"
}
Another question: Did you just add the pengrobinsongas instead of perfectGas or you made some others modifications in the initial tutorial case.
labyrinth01 likes this.
john myce is offline   Reply With Quote

Old   October 24, 2018, 18:04
Default
  #14
New Member
 
Join Date: Jul 2012
Posts: 10
Rep Power: 14
mickbatti is on a distinguished road
I put PengRobinson in the thermoType and adapted the test case setup, turning off combustion and providing necessary information for PR for each species.
I’ve tried with including libs in the controlDict and using the base solver, but same problem.
I'm using of301.

Can you tell me if you have tried with reactingFoam? Or just with sprayFoam?
mickbatti is offline   Reply With Quote

Old   October 25, 2018, 06:35
Default
  #15
Member
 
Join Date: Sep 2018
Location: France
Posts: 62
Rep Power: 8
john myce is on a distinguished road
Hello,

Just with sprayFoam.
john myce is offline   Reply With Quote

Old   November 12, 2018, 06:50
Default
  #16
Member
 
Join Date: Sep 2018
Location: France
Posts: 62
Rep Power: 8
john myce is on a distinguished road
Hi Mick


Did you solve your pb ?
john myce is offline   Reply With Quote

Old   November 12, 2018, 16:50
Default
  #17
New Member
 
Join Date: Jul 2012
Posts: 10
Rep Power: 14
mickbatti is on a distinguished road
Hi John

yes, I solved moving to openfoam 6. Not sure if this was the only possibility, but now I am able to compile a custom reactingFoam with a mixture of PR fluids.
m.omair, john myce and labyrinth01 like this.
mickbatti is offline   Reply With Quote

Old   March 8, 2019, 05:42
Default
  #18
New Member
 
Tiziano Maffei
Join Date: Jun 2013
Location: Milan (Italy)
Posts: 11
Rep Power: 13
tmaffei is on a distinguished road
Hi Mick,

I am trying to add PengRobinson EoS to reactingFoam in oF-6 following the tips provided by John.
I have adopted the case accordingly, adding equationOfState parameters for each species. My domain is a 2D planar system in which occurs a single step reaction A->B.

As happened to you, the simulation stops after "foamChemistryReader" with the following list of error:
Code:
#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigFpe::sigHandler(int) at ??:?
#2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3  Foam::Reaction<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleEnthalpy> > >::setThermo(Foam::HashPtrTable<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleEnthalpy> >, Foam::word, Foam::string::hash> const&) at ??:?
#4  Foam::Reaction<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleEnthalpy> > >::Reaction(Foam::hashedWordList const&, Foam::HashPtrTable<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleEnthalpy> >, Foam::word, Foam::string::hash> const&, Foam::dictionary const&) at ??:?
#5  Foam::Reaction<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleEnthalpy> > >::adddictionaryConstructorToTable<Foam::IrreversibleReaction<Foam::Reaction, Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleEnthalpy> >, Foam::ArrheniusReactionRate> >::New(Foam::hashedWordList const&, Foam::HashPtrTable<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleEnthalpy> >, Foam::word, Foam::string::hash> const&, Foam::dictionary const&) at ??:?
#6  Foam::Reaction<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleEnthalpy> > >::New(Foam::hashedWordList const&, Foam::HashPtrTable<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleEnthalpy> >, Foam::word, Foam::string::hash> const&, Foam::dictionary const&) at ??:?
#7  Foam::ReactionList<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleEnthalpy> > >::readReactionDict() at ??:?
#8  Foam::foamChemistryReader<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleEnthalpy> > >::foamChemistryReader(Foam::dictionary const&, Foam::hashedWordList&) at ??:?
#9  Foam::chemistryReader<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleEnthalpy> > >::adddictionaryConstructorToTable<Foam::foamChemistryReader<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleEnthalpy> > > >::New(Foam::dictionary const&, Foam::hashedWordList&) at ??:?
#10  Foam::chemistryReader<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleEnthalpy> > >::New(Foam::dictionary const&, Foam::hashedWordList&) at ??:?
#11  Foam::reactingMixture<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleEnthalpy> > >::reactingMixture(Foam::dictionary const&, Foam::fvMesh const&, Foam::word const&) at ??:?
#12  Foam::heThermo<Foam::psiReactionThermo, Foam::SpecieMixture<Foam::reactingMixture<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleEnthalpy> > > > >::heThermo(Foam::fvMesh const&, Foam::word const&) at ??:?
#13  Foam::psiReactionThermo::addfvMeshConstructorToTable<Foam::hePsiThermo<Foam::psiReactionThermo, Foam::SpecieMixture<Foam::reactingMixture<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleEnthalpy> > > > > >::New(Foam::fvMesh const&, Foam::word const&) at ??:?
#14  Foam::autoPtr<Foam::psiReactionThermo> Foam::basicThermo::New<Foam::psiReactionThermo>(Foam::fvMesh const&, Foam::word const&) at ??:?
#15  Foam::psiReactionThermo::New(Foam::fvMesh const&, Foam::word const&) at ??:?
#16  ? in "/opt/OpenFOAM/OpenFOAM-6/platforms/linux64GccDPInt64Opt/bin/reactingFoam"
#17  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#18  ? in "/opt/OpenFOAM/OpenFOAM-6/platforms/linux64GccDPInt64Opt/bin/reactingFoam"
Could you help me?

Thanks in advance

Tiziano
tmaffei is offline   Reply With Quote

Old   March 10, 2019, 18:07
Default
  #19
New Member
 
Join Date: Jul 2012
Posts: 10
Rep Power: 14
mickbatti is on a distinguished road
Hi Tiziano,
my problem was with of301, then moving to of6 and recompiling again I didn't get the foamChemistryReader error anymore.
My error was without messages, so somewhat different from yours. What type of thermoType are you using? Mine was:

thermoType
{
type hePsiThermo;
mixture reactingMixture;
transport sutherland;
thermo janaf;
energy sensibleEnthalpy;
equationOfState PengRobinsonGas;
specie specie;
}
labyrinth01 likes this.
mickbatti is offline   Reply With Quote

Old   March 14, 2019, 05:33
Default
  #20
New Member
 
Tiziano Maffei
Join Date: Jun 2013
Location: Milan (Italy)
Posts: 11
Rep Power: 13
tmaffei is on a distinguished road
Hi Mick,

thanks for your answer. At the end I have found the error and now I can able to use PengRobinsonGas Eos with reactingFoam.
Furthermore, I have modified the mixing rules applied to critical pressure, temperature and so on using molar fraction instead of mass fraction. In this way my results are more similar to ones obtained with other software like fluent or unisim.

Thanks for your availability

Tiziano
m.omair and labyrinth01 like this.
tmaffei 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
Error using kOmegaSST in sprayFoam CFDUser_ OpenFOAM Running, Solving & CFD 17 November 20, 2023 16:29
SprayFOAM with manualInjection marcomacchi OpenFOAM Running, Solving & CFD 0 June 16, 2014 12:25
sprayFoam crashes lukasfischer OpenFOAM Running, Solving & CFD 3 July 14, 2013 12:08
Fluent & Barotropic EOS fivos FLUENT 0 July 11, 2013 04:32
Solid EOS adam Main CFD Forum 5 March 18, 2008 14:12


All times are GMT -4. The time now is 10:47.