CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

how to add a new gas

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

Reply
 
LinkBack Thread Tools Display Modes
Old   June 12, 2012, 15:15
Default how to add a new gas
  #1
Member
 
Join Date: Jun 2012
Posts: 65
Rep Power: 5
conceptone is on a distinguished road
hi everyone, I am a new openfoam user. I wonder how to add a gas and how to define its properties in the openfoam. The gas is not defined in openfoam dictionary, so I got to define it by myself. Below is the error message. Thanks your guys' help!


Selecting chemistryReader chemkinReader
[5]
[5]
[5] --> FOAM FATAL ERROR:
[5] C12H26 not found in table. Valid entries:
820
(
CL3SISICL
A2C2HB*
SIF3NH2
...)
conceptone is offline   Reply With Quote

Old   June 12, 2012, 20:51
Default
  #2
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Pennsylvania, United States
Posts: 101
Rep Power: 6
adhiraj is on a distinguished road
It seems you are running a solver like reactingFoam, and using CHEMKIN input.
You probably have a species defined in the chem.inp file that is missing in the therm.dat file. Just make sure the two files are compatible, and you should be good to go.
adhiraj is offline   Reply With Quote

Old   June 12, 2012, 22:22
Default
  #3
Member
 
Join Date: Jun 2012
Posts: 65
Rep Power: 5
conceptone is on a distinguished road
thanks dude!yep, you are right, I should check the two files.but the question is how can I reach the two files? I mean, in the thermophysicalProperties it states that
CHEMKINFile "$FOAM_CASE/chemkin/chem.inp";

CHEMKINThermoFile "~OpenFOAM/thermoData/therm.dat";
while if I enter "cd $FOAM_CASE/chemkin/chem.inp" or "cd ~OpenFOAM/thermoData/therm.dat" in linux the system errors there is no such variable. Meanwhile, I've already modified the chem.inp and therm.dat files which are included in the chemkin file. But it doesn't work. So what should I do?
conceptone is offline   Reply With Quote

Old   June 13, 2012, 22:47
Default
  #4
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Pennsylvania, United States
Posts: 101
Rep Power: 6
adhiraj is on a distinguished road
The tag
Quote:
$FOAM_CASE
refers to the working main directory for the case when you run it. It cannot be resolved by bash otherwise.
For the other one, maybe you do not have a directory with the name.
Just copy both files to a directory (say chemkin under the case directory) and then edit the paths in the constant/thermophysicalProperties file.
For instance, if you have both the chem.inp and therm.dat under chemkin directory, this is what you need:
Quote:
CHEMKINFile "$FOAM_CASE/chemkin/chem.inp";

CHEMKINThermoFile "
$FOAM_CASE/chemkin/therm.dat";
Hope this helps.
adhiraj is offline   Reply With Quote

Old   June 13, 2012, 23:40
Default
  #5
Member
 
Join Date: Jun 2012
Posts: 65
Rep Power: 5
conceptone is on a distinguished road
Quote:
Originally Posted by adhiraj View Post
The tag refers to the working main directory for the case when you run it. It cannot be resolved by bash otherwise.
For the other one, maybe you do not have a directory with the name.
Just copy both files to a directory (say chemkin under the case directory) and then edit the paths in the constant/thermophysicalProperties file.
For instance, if you have both the chem.inp and therm.dat under chemkin directory, this is what you need:
Hope this helps.
Hi adhiraj,thanks again for your help!
I did do that modification, but later I met a new problem.when the case runs a few steps, it cracks. It stopped at 0.00151s.The error is like below:

Courant Number mean: 3.71158e-05 max: 0.0695979
deltaT = 1.25e-06
Time = 0.001515

Solving cloud sprayCloud

--> Cloud: sprayCloud
Added 6 new parcels

[6] #0 Foam::error:rintStack(Foam::Ostream&) in "/usr/apps1/openfoam-2.1.0/OpenFOAM-2.1.0/platforms/linux64Gcc44DPOpt/lib/libOpenFOAM.so"
[6] #1 Foam::sigFpe::sigHandler(int) in "/usr/apps1/openfoam-2.1.0/OpenFOAM-2.1.0/platforms/linux64Gcc44DPOpt/lib/libOpenFOAM.so"
[6] #2 __restore_rt at sigaction.c:0
[6] #3 __ieee754_exp at interp.c:0
[6] #4 exp in "/lib64/libm.so.6"
[6] #5 Foam::LiquidEvaporation<Foam::ReactingCloud<Foam:: ThermoCloud<Foam::KinematicCloud<Foam::Cloud<Foam: :SprayParcel<Foam::ReactingParcel<Foam::ThermoParc el<Foam::KinematicParcel<Foam:article> > > > > > > > >::calculate(double, int, double, double, double, double, double, double, Foam::Field<double>&) const in "/usr/apps1/openfoam-2.1.0/OpenFOAM-2.1.0/platforms/linux64Gcc44DPOpt/lib/liblagrangianSpray.so"
[6] #6 void Foam::ReactingParcel<Foam::ThermoParcel<Foam::Kine maticParcel<Foam:article> > >::calc<Foam::ReactingParcel<Foam::ThermoParcel< Fo am::KinematicParcel<Foam:article> > >::TrackingData<Foam::SprayCloud<Foam::ReactingC lo ud<Foam::ThermoCloud<Foam::KinematicCloud<Foam::Cl oud<Foam::SprayParcel<Foam::ReactingParcel<Foam::T hermoParcel<Foam::KinematicParcel<Foam:article> > > > > > > > > > >(Foam::ReactingParcel<Foam::ThermoParcel<Foam:: Ki nematicParcel<Foam:article> > >::TrackingData<Foam::SprayCloud<Foam::ReactingC lo ud<Foam::ThermoCloud<Foam::KinematicCloud<Foam::Cl oud<Foam::SprayParcel<Foam::ReactingParcel<Foam::T hermoParcel<Foam::KinematicParcel<Foam:article> > > > > > > > > >&, double, int) in "/usr/apps1/openfoam-2.1.0/OpenFOAM-2.1.0/platforms/linux64Gcc44DPOpt/bin/sprayFoam"

......

what's the problem here? I guess it should be caused by particle or parcel parameters set in spraycloudProperties file, so I attached it. It can be open by word.
Thanks !
Attached Files
File Type: docx sprayCloudProperties_copy.docx (26.5 KB, 9 views)
conceptone is offline   Reply With Quote

Old   June 15, 2012, 04:03
Default
  #6
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Pennsylvania, United States
Posts: 101
Rep Power: 6
adhiraj is on a distinguished road
Seems like floating point exception; I'd check the case set up, and numerical parameters for the case.
I am not familiar with the spray models and stuff, so unfortunately I cannot help with that.
adhiraj is offline   Reply With Quote

Old   June 15, 2012, 12:37
Default
  #7
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 725
Rep Power: 18
mturcios777 will become famous soon enough
Debugging the spray class can be quite painful since everything is templated to allow a completely runtime selectable spray model. I would recommend running the debug version so that you can find the line number of where things go wrong.

Just from the surface, it appears that the exponential function in the math library is having problems. Maybe the argument is far too large (or small). What is happening with your temperature and pressure at this point; judging from the time of the error and your dictionary the spray must already be evolving?
mturcios777 is offline   Reply With Quote

Old   June 15, 2012, 12:49
Default
  #8
Member
 
Join Date: Jun 2012
Posts: 65
Rep Power: 5
conceptone is on a distinguished road
Yes, you're right, it's the floating point error. I forgot to copy this message.

But still thank man!
conceptone is offline   Reply With Quote

Old   June 16, 2012, 16:46
Default
  #9
Member
 
Join Date: Jun 2012
Posts: 65
Rep Power: 5
conceptone is on a distinguished road
Thanks your help man! I'm gona try debug version. But what does "the spray must already be evolving?" mean at last? Sorry I didn't get you..
conceptone is offline   Reply With Quote

Old   June 16, 2012, 17:26
Default
  #10
Member
 
Join Date: Jun 2012
Posts: 65
Rep Power: 5
conceptone is on a distinguished road
Oh by the way is it true that if I want to run the debug version the openfoam should be installed on my own computer? I mean my openfoam is installed on the service computer, so I can't modify the bashrc file.
conceptone is offline   Reply With Quote

Old   June 16, 2012, 17:41
Default
  #11
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,251
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Quote:
Originally Posted by conceptone View Post
Oh by the way is it true that if I want to run the debug version the openfoam should be installed on my own computer? I mean my openfoam is installed on the service computer, so I can't modify the bashrc file.
Already answered here: wired error in sprayFoam - post #5
wyldckat is online now   Reply With Quote

Old   June 21, 2012, 12:24
Default
  #12
Member
 
Join Date: Jun 2012
Posts: 65
Rep Power: 5
conceptone is on a distinguished road
Hi man, I have checked with debug version. I believe it's caused by the NSRDSfunction. Can you tell me the meaning of a,b,c,d,e,f in the function? Thanks. Below is the error message by debug version.

[6] #0 Foam::error:rintStack(Foam::Ostream&) at /usr/apps1/openfoam-2.1.1/OpenFOAM-2.1.1/src/OSspecific/POSIX/printStack.C:201
[6] #1 Foam::sigFpe::sigHandler(int) at /usr/apps1/openfoam-2.1.1/OpenFOAM-2.1.1/src/OSspecific/POSIX/signals/sigFpe.C:117
[6] #2 __restore_rt at sigaction.c:0
[6] #3 __ieee754_exp at interp.c:0
[6] #4 exp in "/lib64/libm.so.6"
[6] #5 Foam::exp(double) at /usr/apps1/openfoam-2.1.1/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/Scalar.H:260
[6] #6 Foam::NSRDSfunc1::f(double, double) const at /usr/apps1/openfoam-2.1.1/OpenFOAM-2.1.1/src/thermophysicalModels/thermophysicalFunctions/lnInclude/NSRDSfunc1.H:108
[6] #7 Foam::C12H26:v(double, double) const at /usr/apps1/openfoam-2.1.1/OpenFOAM-2.1.1/src/thermophysicalModels/properties/liquidProperties/C12H26/C12H26I.H:34
[6] #8 Foam::LiquidEvaporation<Foam::ReactingCloud<Foam:: ThermoCloud<Foam::KinematicCloud<Foam::Cloud<Foam: :SprayParcel<Foam::ReactingParcel<Foam::ThermoParc el<Foam::KinematicParcel<Foam:article> > > > > > > > >::calculate(double, int, double, double, double, double, double, double, double, double, Foam::Field<double> const&, Foam::Field<double>&) const at /usr/apps1/openfoam-2.1.1/OpenFOAM-2.1.1/src/lagrangian/intermediate/lnInclude/LiquidEvaporation.C:172
[6] #9 void Foam::ReactingParcel<Foam::ThermoParcel<Foam::Kine maticParcel<Foam:article> > >::calcPhaseChange<Foam::ReactingParcel<Foam::Th er moParcel<Foam::KinematicParcel<Foam:article> > >::TrackingData<Foam::SprayCloud<Foam::ReactingC lo ud<Foam::ThermoCloud<Foam::KinematicCloud<Foam::Cl oud<Foam::SprayParcel<Foam::ReactingParcel<Foam::T hermoParcel<Foam::KinematicParcel<Foam:article> > > > > > > > > > >(Foam::ReactingParcel<Foam::ThermoParcel<Foam:: Ki nematicParcel<Foam:article> > >::TrackingData<Foam::SprayCloud<Foam::ReactingC lo ud<Foam::ThermoCloud<Foam::KinematicCloud<Foam::Cl oud<Foam::SprayParcel<Foam::ReactingParcel<Foam::T hermoParcel<Foam::KinematicParcel<Foam:article> > > > > > > > > >&, double, int, double, double, double, double, double, double, double, int, double, Foam::Field<double> const&, Foam::Field<double>&, double&, double&, double&, Foam::Field<double>&) at /usr/apps1/openfoam-2.1.1/OpenFOAM-2.1.1/src/lagrangian/intermediate/lnInclude/ReactingParcel.C:517
...
[pn1:29034] [21] sprayFoam [0x472099]
[pn1:29034] *** End of error message ***
--------------------------------------------------------------------------
mpiexec noticed that process rank 6 with PID 29034 on node pn1 exited on signal 8 (Floating point exception).
------------------------------------------
conceptone is offline   Reply With Quote

Old   June 21, 2012, 12:40
Default
  #13
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 725
Rep Power: 18
mturcios777 will become famous soon enough
The NSRDS function are mathematical fomulas that are frequently used when calculating material properties. You can find what the form of the function is by src/thermophysicalModels/thermophysicalFunctions/ NSRDSfunctions/NSRDSfunc1/NSRDSfunc1.H.

This tells you where the code is crashing, but I'm sure the problem is with the values you are passing to the NSRDS function. Look at the code in src/thermophysicalModels/properties/liquidProperties/C12H26, and look at what scalars are being passed to calculate the vapour pressure (pressure, temperature and the constant coefficients of the NSRDS function). One of these is causing the call to exp() to fail, which usually means there is something wrong with your case setup or boundary conditions that your pressure or temperature manages to get in that range.

When I mentioned spray evolution, I meant that your spray had already been injecting parcels into the domain for a few timesteps before the crash. In the solver code, you'll see the function that causes the spray to be calculated is called parcels.evolve().
mturcios777 is offline   Reply With Quote

Old   June 21, 2012, 16:47
Default
  #14
Member
 
Join Date: Jun 2012
Posts: 65
Rep Power: 5
conceptone is on a distinguished road
Thanks at first.
I checked with the error message and found the bug should be caused by pv(p,T) function and NSRDS function1. The NSRDS function1, which returns the value exp(a_ + b_/T + c_*log(T) + d_*pow(T, e_)) with the coefficients pv_(137.47, -11976.0, -16.698, 8.0906e-06, 2.0), was calculated by myself and the value is 1235.9759. So I didn't see any problem here. But I am not sure about the T in the function. Should it be the fuel initial temperature or ambient temperature? In the pv(p,T) function, the vapour pressure looks to be calculated by pressure and temperature, are they fuel's values or ambient values? Thanks
conceptone is offline   Reply With Quote

Old   June 21, 2012, 16:51
Default
  #15
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 725
Rep Power: 18
mturcios777 will become famous soon enough
I think its the ambient temperature, as we want to know what the vapour pressure should be to determine how much to evaporate (if call to pv happens through the liquidEvaporation model).
mturcios777 is offline   Reply With Quote

Old   June 21, 2012, 17:12
Default
  #16
Member
 
Join Date: Jun 2012
Posts: 65
Rep Power: 5
conceptone is on a distinguished road
Then I really can't find where's wrong. The ambient temperature is 900k and pressure is 6MPa,which is set as follows:

FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// ************************************************** *********************** //

dimensions [ 1 -1 -2 0 0 0 0 ];

internalField uniform 6e+06;

boundaryField
{
walls
{
type zeroGradient;
}
}


FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}
// ************************************************** *********************** //

dimensions [ 0 0 0 1 0 0 0 ];

internalField uniform 900;

boundaryField
{
walls
{
type zeroGradient;
}
}
conceptone is offline   Reply With Quote

Old   June 21, 2012, 17:16
Default
  #17
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 725
Rep Power: 18
mturcios777 will become famous soon enough
Your initial internal fields seem reasonable (though why are your walls zero gradient), but you should be looking at the pressure and temperature right before you crash (try writing every timestep for 10 timesteps before you crash).
mturcios777 is offline   Reply With Quote

Old   June 21, 2012, 17:50
Default
  #18
Member
 
Join Date: Jun 2012
Posts: 65
Rep Power: 5
conceptone is on a distinguished road
If using the temperature ambient, the NSRDS fuction1 value should be 27517468.395187, it seems quite large. Previously I used the fuel temperature so the value is much smaller. But I don't think it has sth. to do with the floating point error.

By the way, how can I find the calculated pressure and temperature data? I mean in every time sub-file the results are binary files
conceptone is offline   Reply With Quote

Old   June 21, 2012, 18:01
Default
  #19
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 725
Rep Power: 18
mturcios777 will become famous soon enough
You can post-process the results to find the values. Or switch to write ASCII to have the actual numbers output. This results in bigger files, but for debugging its quite useful.

Write out the last few timesteps before the crash and have a look. Exp usually only returns an error if the argument is out of bounds/wrong type/etc. There is a log(T), pow(T,e) and 1/T inside the exponential, which are the first culprits with this kind of thing. If your temperature becomes very small (or even <= 0) you could end up with problems here.
mturcios777 is offline   Reply With Quote

Old   June 21, 2012, 18:08
Default
  #20
Member
 
Join Date: Jun 2012
Posts: 65
Rep Power: 5
conceptone is on a distinguished road
OK, I got you. Yes, if T is too small then floating point error occurs. But isn't T the ambient temperature? Then it should be a constant. I mean which file is calculating the temperature? And is the input of the calculation the initial ambient temperature?
Thanks
conceptone is offline   Reply With Quote

Reply

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
error message cuteapathy CFX 14 March 20, 2012 07:45
Constant velocity of the material Sas CFX 15 July 13, 2010 08:56
mass flow in is not equal to mass flow out saii CFX 2 September 18, 2009 08:07
Two-Phase Buoyant Flow Issue Miguel Baritto CFX 4 August 31, 2006 12:02
Gas pressure question Dan Moskal Main CFD Forum 0 October 24, 2002 22:02


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