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

Combustion model:PaSR model in ReactingFoam2.2.1

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

Like Tree1Likes
  • 1 Post By mturcios777

Reply
 
LinkBack Thread Tools Display Modes
Old   November 5, 2013, 09:03
Default Combustion model:PaSR model in ReactingFoam2.2.1
  #1
Member
 
赵庆良
Join Date: Aug 2013
Posts: 56
Rep Power: 3
zqlhzx is on a distinguished road
Hi Foamers,
The species eqn inReactingFoam is :
Code:
 
            fvScalarMatrix YiEqn
            (
                fvm::ddt(rho, Yi)
              + mvConvection->fvmDiv(phi, Yi)
              - fvm::laplacian(turbulence->muEff(), Yi)
             ==
                reaction->R(Yi)
              + fvOptions(rho, Yi)
            );
and reactingFoam2.2.1 use PaSR combustion model(Partially stirred reactor combustion model).The difficult term is reaction->R(Yi),and it is the source termo for species i(expressed as RRi) . It is necesssary to use some form of treatment for chemistry and turbulent mixing,So for PaSR model,the source termo for species i become k(kappa)*RRi.

I found the following codes in src/combustionModels/PaSR/PaSR.C:
Code:
template<class Type>
Foam::tmp<Foam::fvScalarMatrix>
Foam::combustionModels::PaSR<Type>::R(volScalarField& Y) const
{
    tmp<fvScalarMatrix> tSu(new fvScalarMatrix(Y, dimMass/dimTime));
    fvScalarMatrix& Su = tSu();
    if (this->active())
    {
        const label specieI = this->thermo().composition().species()[Y.name()];
        Su += kappa_*this->chemistryPtr_->RR(specieI);
    }
    return tSu;
}
Howerer,I still can not know "this->chemistryPtr_->RR(specieI);",and I can not find the function this->chemistryPtr_->RR(specieI),Where can I find the its define ?
zqlhzx is offline   Reply With Quote

Old   March 5, 2014, 06:44
Default
  #2
Member
 
Thamali
Join Date: Jul 2013
Posts: 53
Rep Power: 3
Thamali is on a distinguished road
I do not know whether you solved your problem.But I think you can refer chemistryModel.C file,although I have no idea how this "chemistryPtr" pointer connects to it.
If you have any idea please help me too.

Thamali
Thamali is offline   Reply With Quote

Old   March 5, 2014, 12:53
Default
  #3
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 673
Rep Power: 17
mturcios777 will become famous soon enough
For more information on the usage of this:

http://www.tutorialspoint.com/cplusp...is_pointer.htm

The reasons is that the chemistryType is templated on the thermo types. Thamali is right that the function you want is in chemistryModel.C. One way to see this is to look at the online code documentation for OpenFOAM, as you can trace the inheritance diagram.

http://www.openfoam.org/docs/cpp/
Thamali likes this.
mturcios777 is offline   Reply With Quote

Old   March 6, 2014, 01:04
Default
  #4
Member
 
Thamali
Join Date: Jul 2013
Posts: 53
Rep Power: 3
Thamali is on a distinguished road
Marco,
Thanks for your reply.I need more help.
If we are using following in PaSR model,do we have to switch on the chemistry in reactingFoam.
Code:
combustionModel  PaSR<psiChemistryCombustion>; 
active  true;

PaSRCoeffs
{
    Cmix                0.147;
    turbulentReaction   on;
    useReactionRate     yes;
}
actually in my case,it does not run when Chemistry is on.
To find out about this error and to understand about more on the usage of
Code:
chemistry on
switch,I went through the codes.But,I don't see it is using in any code.
In PaSR,it handles chemistry on its own,when
Code:
useReactionRate yes
so,I am thinking we don't have to switch on chemistry at all,when using PaSR with
Code:
useReactionRate yes
am I correct?
If so,whether chemistry is on/off,the other properties in "chemistryProperties" file are active,is it?
What really happens when chemistry switch is on?I am confused.(you may think this must be the 1st question)
Thanks in advance.
Thamali
Thamali is offline   Reply With Quote

Old   March 6, 2014, 12:35
Default
  #5
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 673
Rep Power: 17
mturcios777 will become famous soon enough
If you look in the file PaSR.C, in the combustion->correct() function you will see this if statement:

Code:
if (this->active())
. The active function for the combustion object checks is the swtich active is on. It then proceeds to calculate the turbulent mixing parameters.

The second question about useReactionRate can be also answered by looking at the correct() function. I'll leave you to figure that one out and post the answer.

When you are unsure what a keyword or parameter does that is in a Coeffs dictionary, have a look at the constructor for the object, see where the value of the key is stored and where it is later used (grep is your friend)
mturcios777 is offline   Reply With Quote

Old   April 21, 2014, 05:27
Default Foam::combustionModels::PaSR<Foam::combustionModel s::psiChemistryCombustion>::correct
  #6
Member
 
Thamali
Join Date: Jul 2013
Posts: 53
Rep Power: 3
Thamali is on a distinguished road
Dear Marco and other foamers,

I am sorry for not replying the former thread.I am really stucked with running a case which is necessary for completion of my MSc.Actually my major part of MSc was to develop a solver to model a packed bed in a wood chip combustion boiler.I have completed that part(though it is not very advanced).My next part is to use resulting packed bed parameters to be used to model free-board region combustion.

I have uploaded it to the following link.
https://www.dropbox.com/sh/4jew3uxfrt7ddtd/cazVzK0X3F

For that case I am using "reactingFoam" and "PaSR" as combustion model.I have so much of doubts in presenting reactions,turbulence property values,etc.
  1. I have created single folder to present 4 major reactions which are CO,CH4,CxHyOz combustion and then H2 combustion chain reaction which converted to a foam file using utility chemkinToFoam.(please refer reactions file).Dont know whether this method is correct.If someone have any idea please help.
  2. Cmix,k,mut,initial Chemical time step,deltaT value,odeCoeffs.etc were put referring to some literature,but the error which occurs making me doubt about all those values

Case always stops at some point with Floating Point Exception and I have failed to figure out where is the problem.
The error is;
PHP Code:
 Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigFpe::sigHandler(int) at ??:?
#2   in "/lib/x86_64-linux-gnu/libc.so.6"
#3  Foam::combustionModels::PaSR<Foam::combustionModels::psiChemistryCombustion>::correct() at ??:?
#4  
 
at ??:?
#5  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#6  
 
at ??:?
Floating point exception (core dumped
I highly appreciate even a very little idea to solve my problem.


Thanks.
Thamali
Thamali is offline   Reply With Quote

Old   April 22, 2014, 12:49
Default
  #7
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 673
Rep Power: 17
mturcios777 will become famous soon enough
Thamali, have you run your solver/cases with a debug version of OpenFOAM. The error message you have is pretty vague and doesn't give much indication as to where the code dies.

Could you also post the last few timesteps and all associated error messages?
mturcios777 is offline   Reply With Quote

Old   April 23, 2014, 02:07
Default simplified case
  #8
Member
 
Thamali
Join Date: Jul 2013
Posts: 53
Rep Power: 3
Thamali is on a distinguished road
Dear Marco,
I am very glad you replied.I did not run with Debug version.
I did some simplifications for the case for now to solve this issue.
  1. I removed gas components,temperature,velocity non-uniform inlet field for now and added uniform fields to them.
  2. removed chain reaction of H2 and other reactions are still there.
  3. Cmix=0.9
  4. case is running up to 0.0217(I have attached last three time directories and the log file to look at any errors shown)
the link for the new case is follows;
https://www.dropbox.com/sh/gbwuj5xxhaxew3s/ZU8ncig617

  • Actually I have not run any case/solver with debug version.If you think it is helpful for me?I would appreciate any documentation related to that.I have little idea but not much.
  • I am now trying to make an LTS solver out of reactingFoam(Actually I did and it is compiling without errors.),because my solver for packed bed is for steady state.I am willing to share it with anyone interested.I would love for your comments on that too.Here is the link.
https://www.dropbox.com/sh/od60ye13oyv0v3s/QgPk3MyF6n
  • I tried to run the case with above LTS solvers,but still the same error occurs.
(when running janaf thermo out of range is occurring at several time.Does that may be the reason,which makes Temperature at some points are 5000(or 200).pls refer folder 0.0217 line 114-122 in https://www.dropbox.com/sh/gbwuj5xxhaxew3s/ZU8ncig617).

when looking at Residulas at the time of error residuals seems like go to infinity.


Thank you very much again for your reply and eager for a reply.

With Regards,
Thamali

Last edited by Thamali; April 23, 2014 at 04:04. Reason: error
Thamali is offline   Reply With Quote

Old   April 23, 2014, 12:51
Default
  #9
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 673
Rep Power: 17
mturcios777 will become famous soon enough
Whenever you are making your own solvers with custom sub-models, the debug version can help greatly as the stack track will give you the line numbers where the crash occurs (99% of the time anyway).

To set this up, you need to change the WM_COMPILE_OPTION from "Opt" to "Debug", source your bashrc file and then recompile the entire OpenFOAM installation, including your solver and models.
mturcios777 is offline   Reply With Quote

Old   April 28, 2014, 04:09
Default Debug version run
  #10
Member
 
Thamali
Join Date: Jul 2013
Posts: 53
Rep Power: 3
Thamali is on a distinguished road
Dear Marco,
I ran the case in Debug version following your instructions.(for the same case in
https://www.dropbox.com/sh/gbwuj5xxhaxew3s/ZU8ncig617 ).

Now the error is as follows,
Code:
#0  Foam::error::printStack(Foam::Ostream&) at ~/OpenFOAM/OpenFOAM-2.2.2/src/OSspecific/POSIX/printStack.C:221
#1  Foam::sigFpe::sigHandler(int) at ~/OpenFOAM/OpenFOAM-2.2.2/src/OSspecific/POSIX/signals/sigFpe.C:117
#2   in "/lib/x86_64-linux-gnu/libc.so.6"
#3   in "/lib/x86_64-linux-gnu/libm.so.6"
#4  Foam::sqrt(double) at ~/OpenFOAM/OpenFOAM-2.2.2/src/OpenFOAM/lnInclude/Scalar.H:258
#5  Foam::combustionModels::PaSR<Foam::combustionModels::psiChemistryCombustion>::correct() at ~/OpenFOAM/OpenFOAM-2.2.2/src/combustionModels/PaSR/PaSR.C:111 (discriminator 2)
#6  
 at ~/OpenFOAM/OpenFOAM-2.2.2/applications/solvers/combustion/reactingFoam/YEqn.H:14
#7  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#8  
 at ??:?
Floating point exception (core dumped)
PaSR.C:111 is equation for calculating for tk(mixing time scale) which is;

HTML Code:
 Cmix_*Foam::sqrt(muEff[i]/rho[i]/(epsilon[i] + SMALL))
and the error Floating point Exception is shown in calcullating square root which is;

HTML Code:
sqrt(muEff[i]/rho[i]/(epsilon[i] + SMALL))
so,the reasons should be one of the following as I think;
  • muEff<0
  • rho=<0
  • (epsilon+SMALL)=<0
Now,I am trying to put a write() function to "rho" and see whether it is becoming "zero".
Yeaaaah,
It is this "rho" value is (-)ve at 3 points in time=0.0217543.I am adding "rho" file 0.0217543 to the link https://www.dropbox.com/sh/gbwuj5xxhaxew3s/ZU8ncig617 .

Do you have any idea which could lead to this? and also I cannot find from where this "rhoEqn.H" come to "reactingFoam.C"?

Please try to help.
Thanks in advance.
Thamali

Last edited by Thamali; April 28, 2014 at 04:47. Reason: adding more results
Thamali is offline   Reply With Quote

Old   April 28, 2014, 13:30
Default
  #11
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 673
Rep Power: 17
mturcios777 will become famous soon enough
reactingFoam uses the compressible rhoEqn from the default CFD library in $FOAM_SRC/finiteVolume/cfdTools/compressible/rhoEqn.H. If your density is becoming negative, I would check your boundar conditions and chemistry. Also, I would be sure that the density works properly with chemistry off first.
mturcios777 is offline   Reply With Quote

Old   May 29, 2014, 02:10
Default Thanking
  #12
Member
 
Thamali
Join Date: Jul 2013
Posts: 53
Rep Power: 3
Thamali is on a distinguished road
Dear Marco,

It was an error in initial conditions which made sum of initial mass fractions were greater than 1.
Took a long time to point out that since i never thought that type of error would occur.
Anyway thank you very much for your kind help.
Regards,
Thamali
Thamali is offline   Reply With Quote

Old   September 3, 2014, 20:37
Default reactingFoam: Floating Point Exception
  #13
New Member
 
Francis Lee
Join Date: Jul 2013
Location: Jiangsu, China
Posts: 14
Rep Power: 3
epi_c is on a distinguished road
Dear Thamali

I have the same problem (FPE) you posted in this thread, and congratulations you have solved the problem.

But I can't open the links you gave, could you share me your case settings? So I can set my case with reference to your settings (Cmix, k, mut, initial Chemical time step, odeCoeffs and initial and boundary conditions).

Regards
Francis
epi_c is offline   Reply With Quote

Old   September 4, 2014, 00:11
Default
  #14
Member
 
Thamali
Join Date: Jul 2013
Posts: 53
Rep Power: 3
Thamali is on a distinguished road
Dear Francis,
I will put you a working case .
https://www.dropbox.com/sh/6edomtqox...tW153vFaa?dl=0

but,i do not know your real problem.If this does not work;you can tell us more detail to see whether we can help.
Thanks
Thamali
Thamali 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
Liquid rocket engine non-premixed combustion model Erik FLUENT 2 November 28, 2013 14:09
eddy dissipation model: combustion doesn't occur roukaia FLUENT 0 December 25, 2011 13:50
eddy dissipation model: combustion doesn't occur roukaia FLUENT 0 December 24, 2011 09:10
Combustion Model for CAI/HCCI - AVL FIRE Patryk Main CFD Forum 0 July 24, 2009 16:43
combustion model Hennie van der Westhuizen CD-adapco 7 February 27, 2002 02:10


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