CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM

How to convert psiChemistryModel for multi Zone?

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   November 21, 2012, 03:17
Default How to convert psiChemistryModel for multi Zone?
Join Date: Nov 2010
Location: Tokyo / Japan
Posts: 40
Rep Power: 7
Hanzo is on a distinguished road

I am currently working on a code to use chemistry in different zones. I started with chtMultiRegionFoam solver as basis source code. I basically try to realize chemFoam behavior for all fluid zones (solid zones are removed completely).

So far, I managed to read initial conditions, chemKin input files and chemistry properties for each region. The next step is to create an instance of psiChemistryModel for each region. In chemFoam (or rhoReactionFoam) this is done doing the following:
00026     Info<< nl << "Reading thermophysicalProperties" << endl;
00027     autoPtr<psiChemistryModel> pChemistry(psiChemistryModel::New(mesh));
So in a regional context the variable mesh should be replaced by the mesh of the current region which is stored as fluidRegions[i]
autoPtr<psiChemistryModel> pChemistry(psiChemistryModel::New(fluidRegions[i]));
Compiling works fine but when OpenFoam initiates the chemistryReader I get a floating point exception:

Reading initial conditions.

    Adding to YdefaultFluid

Selecting psiChemistryModel ODEChemistryModel<gasThermoPhysics>

Selecting thermodynamics package hsPsiMixtureThermo<reactingMixture<gasThermoPhysics>>

Selecting chemistryReader chemkinReader

#0  Foam::error::printStack(Foam::Ostream&) in "/opt/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64GccDPOpt/lib/"
#1  Foam::sigFpe::sigHandler(int) in "/opt/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64GccDPOpt/lib/"
#2   in "/lib/"
#3  Foam::fvPatchField<double>::operator/=(Foam::fvPatchField<double> const&) in "/home/florian/OpenFOAM/florian-2.0.x/platforms/linux64GccDPOpt/bin/multiRegionChemFoam"
#4  Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::operator/=(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) in "/opt/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64GccDPOpt/lib/"
#5  Foam::multiComponentMixture<Foam::sutherlandTransport<Foam::specieThermo<Foam::janafThermo<Foam::perfectGas> > > >::correctMassFractions() in "/opt/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64GccDPOpt/lib/"
#6  Foam::multiComponentMixture<Foam::sutherlandTransport<Foam::specieThermo<Foam::janafThermo<Foam::perfectGas> > > >::multiComponentMixture(Foam::dictionary const&, Foam::List<Foam::word> const&, Foam::HashPtrTable<Foam::sutherlandTransport<Foam::specieThermo<Foam::janafThermo<Foam::perfectGas> > >, Foam::word, Foam::string::hash> const&, Foam::fvMesh const&) in "/opt/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64GccDPOpt/lib/"
#7  Foam::reactingMixture<Foam::sutherlandTransport<Foam::specieThermo<Foam::janafThermo<Foam::perfectGas> > > >::reactingMixture(Foam::dictionary const&, Foam::fvMesh const&) in "/opt/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64GccDPOpt/lib/"
#8  Foam::hsPsiMixtureThermo<Foam::reactingMixture<Foam::sutherlandTransport<Foam::specieThermo<Foam::janafThermo<Foam::perfectGas> > > > >::hsPsiMixtureThermo(Foam::fvMesh const&) in "/opt/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64GccDPOpt/lib/"
#9  Foam::hsCombustionThermo::addfvMeshConstructorToTable<Foam::hsPsiMixtureThermo<Foam::reactingMixture<Foam::sutherlandTransport<Foam::specieThermo<Foam::janafThermo<Foam::perfectGas> > > > > >::New(Foam::fvMesh const&) in "/opt/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64GccDPOpt/lib/"
#10  Foam::hsCombustionThermo::NewType(Foam::fvMesh const&, Foam::word const&) in "/opt/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64GccDPOpt/lib/"
#11  Foam::psiChemistryModel::psiChemistryModel(Foam::fvMesh const&, Foam::word const&) in "/opt/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64GccDPOpt/lib/"
#12  Foam::ODEChemistryModel<Foam::psiChemistryModel, Foam::sutherlandTransport<Foam::specieThermo<Foam::janafThermo<Foam::perfectGas> > > >::ODEChemistryModel(Foam::fvMesh const&, Foam::word const&, Foam::word const&) in "/opt/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64GccDPOpt/lib/"
#13  Foam::ode<Foam::ODEChemistryModel<Foam::psiChemistryModel, Foam::sutherlandTransport<Foam::specieThermo<Foam::janafThermo<Foam::perfectGas> > > > >::ode(Foam::fvMesh const&, Foam::word const&, Foam::word const&) in "/opt/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64GccDPOpt/lib/"
#14  Foam::psiChemistryModel::addfvMeshConstructorToTable<Foam::ode<Foam::ODEChemistryModel<Foam::psiChemistryModel, Foam::sutherlandTransport<Foam::specieThermo<Foam::janafThermo<Foam::perfectGas> > > > > >::New(Foam::fvMesh const&, Foam::word const&, Foam::word const&) in "/opt/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64GccDPOpt/lib/"
#15  Foam::psiChemistryModel::New(Foam::fvMesh const&) in "/opt/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64GccDPOpt/lib/"
 in "/home/florian/OpenFOAM/florian-2.0.x/platforms/linux64GccDPOpt/bin/multiRegionChemFoam"
#17  __libc_start_main in "/lib/"
 in "/home/florian/OpenFOAM/florian-2.0.x/platforms/linux64GccDPOpt/bin/multiRegionChemFoam"
I assume that the call psiChemistryModel::New(fluidRegions[i]) uses the appropriate region mesh but does not load T,p, and Y fields from the $CASE_DIR/0/region/ folder.

In chtMultiRegionFoam there is an analog line where the current region mesh is plugged into a constructor of similar type (it only takes a const mesh as input):
00029         thermoFluid.set
00030 (
00031             i,
00032             basicRhoThermo::New(fluidRegions[i]).ptr() 
00033         );
except that here the result is stored in a pointer list.

So I wonder if anybody has an idea why I cannot do this in the same manner for the psiChemistryModel constructor.

Any hints or comments are highly appreciated.
Hanzo is offline   Reply With Quote

Old   November 21, 2012, 05:16
Default Reason found
Join Date: Nov 2010
Location: Tokyo / Japan
Posts: 40
Rep Power: 7
Hanzo is on a distinguished road
Looks like I found the reason for my floating point error

First of all, the constructor for psiChemistryModel can be used for zonal calculations in the same way as for example basicRhoThermo.

What actually caused the problems were zero boundary values. On the interface boundary between my regions, I had zero values for the species in the field Ydefault.
So setting this to zeroGradient or any nonzeroValue solved the problem.

I realised that for a boundary I cannot define all species to be zero.
Looking at line 5 of my previously posted error message
#5  Foam::multiComponentMixture<Foam::sutherlandTransport<Foam::specieThermo<Foam::janafThermo<Foam::perfectGas> > > >::correctMassFractions()
At a certain point in the code the sum of all Yi is taken and then Y are corrected by a similar computation like Yi = Yi/Ytot.
Hanzo is offline   Reply With Quote


Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
fluentMeshToFoam multidomain mesh conversion problem Attesz OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 12 May 2, 2013 10:52
[ICEM] Export ICEM mesh to Gambit / Fluent romekr ANSYS Meshing & Geometry 1 November 26, 2011 13:11
Problem in running ICEM grid in Openfoam Tarak OpenFOAM 6 September 9, 2011 17:51
Problem in IMPORT of ICEM input file in FLUENT csvirume FLUENT 2 September 9, 2009 01:08
Sliding mesh error Karl Kevala FLUENT 4 February 21, 2001 16:52

All times are GMT -4. The time now is 11:59.