|
[Sponsors] |
modify reactingFoam in order to make it a steady state solver |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 7, 2014, 12:14 |
modify reactingFoam in order to make it a steady state solver
|
#1 |
New Member
Pedro Obando
Join Date: Jun 2014
Posts: 3
Rep Power: 12 |
Hi
I have tried to modify reactingFoam in order to make it a steady state solver, so I took as base file rhoSimpleFoam and added the YEqn term on the main .C file of the solver and also the corresponding terms on theEEqn. The problem is that when I run it, the Temperature increase as well as the CO2 production are much lower than the results obtained using Fluent, which I was using in order to validate the solver, or even the same case using reactingFoam after a long time. Actually I donīt know where the error is, whether in the solver itself, in the relaxation parameters or tolerances and numerical solvers defined in fvSolution. Iīve tryed to check as much as I can, but I have no clue. Here I attach the solver, I couldnīt attach the case Iīm modelling since itīs a little heavy, but I would have no problem also sending it. Iīm new in the whole CFD world and this is my first customized solver so would really appreciate any help I could get. |
|
August 17, 2014, 13:53 |
|
#2 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Greetings Pedro,
If the case is too big, then it's best that you create a much smaller test case that you can share, because it will also make it easier for anyone to help you. Beyond this, I'm not so certain that it's possible to create a steady-state reaction solver, since it might not be able to release the heat fast enough, therefore the temperature would continue to rise continually. Keep in mind that steady-state simulations are almost an averaging of the flow over a long time frame. Here are a few more ideas/hints:
Best regards, Bruno
__________________
|
|
August 21, 2014, 07:01 |
|
#3 |
New Member
Pedro Obando
Join Date: Jun 2014
Posts: 3
Rep Power: 12 |
Hi Bruno
Thank you for replying, as a simpler case here I attach the modified counterFlowFlame2D case in order to be solved with the steady state solver that I previously uploaded. When comparing the results obtained with this solver when it converges (according to the tolerances that I stated that Iīm also not sure if are ok) with the ones obtained with the transient solver after 10s (when I assumed that it was long enough as to have reached steady state) the differences in the obtained temperatures and CO2 concentrations are huge. I have found this steady state solver with chemical reactions https://github.com/Unofficial-Extend...rnateChemistry Itīs just that its in an older OF version which I havenīt installed so I couldnīt test it, however by checking the code, it seemed to me that it followed pretty much the same logic as the modifications I tried to implement, except that on the Yeqn they include a some controling loops in order to stabilize the solution. thanks Pedro |
|
April 5, 2015, 16:59 |
|
#4 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Greetings Pedro,
Sorry for the reaaaallly late reply, but only today did I finally managed to look into this. Technically I'm not an expert on this topic, but as I stated in the previous post, the issue seems to be related to problems on how the heat is injected and extracted from the domain. Transient simulations are time dependant and steady-state simulations usually are not. And heat transfer is usually very time dependant, which is very likely why your simulations were either crashing or increasing too much in temperature. And from what I could figure out, you used OpenFOAM 2.2 (not sure which minor version). In file "EEqn.H", you have this line: Code:
reaction->Sh() // THIS IS THE TERM THAT BLOWS IT OFF!!!!! Code:
dimEnergy/dimVolume/dimTime If we look at the source code for "AlternateChemistry" repository you pointed out, you'll notice a few important details:
Code:
fvScalarMatrix EEqn ( fvm::div(phi, he) + ( he.name() == "e" ? fvc::div(phi, volScalarField("Ekp", 0.5*magSqr(U) + p/rho)) : fvc::div(phi, volScalarField("K", 0.5*magSqr(U))) ) - fvm::laplacian(turbulence->alphaEff(), he) == radiation->Sh(thermo) + fvOptions(rho, he) ); Weirder still is that I've taken a look at the source code for reactingParcelFoam and simpleReactingParcelFoam, which are essentially the same changes you've tried to do. So I took another glance at the tutorials for these two solvers and found that there the chemistry solver cannot use the ODE option, in the file "constant/chemistryProperties". By using the following in your test case, the simulation worked fine: Code:
chemistryType { //chemistrySolver ode; chemistrySolver noChemistrySolver; chemistryThermo psi; } I then tried: Code:
chemistryType { //chemistrySolver ode; chemistrySolver sequential; //noChemistrySolver; chemistryThermo psi; } chemistry on; initialChemicalTimeStep 1e-07; sequentialCoeffs { cTauChem 0.001; equilibriumRateLimiter on; } In addition, I removed the residual stopping criteria and at around iteration 4410 it was as good as stable. I then compared with the run in the original tutorial "combustion/reactingFoam/ras/counterFlowFlame2D" and it gave closer results. Attached is this last test case I used, in the package "steady_counterFlowFlame2D_v2.tar.gz". The values I got:
By the way, I used your solver without additional modifications. Best regards, Bruno
__________________
|
|
April 7, 2015, 14:31 |
|
#5 |
New Member
Ali Kadar
Join Date: Oct 2014
Location: Delft
Posts: 25
Rep Power: 12 |
Thank you very much Pedro and Bruno! I
Now have some good hopes with my masters thesis!!. The current simulation time for our furnace application using reactingFoam is in days. Hope we will bring it to hours using the steady state version(hope it works!!). Earlier I was planning to accelerate the simulation using the idea of more outer correctors and under-relaxation with PIMPLE. But it is good to know that SIMPLE can be used too! I will soon let you guys know how my results with the new solver compare to the existing reactingFoam results(after a long time).
__________________
A good solution is one which does justice to the inner nature of the problem- Cornelius Lanczos in a letter to Albert Einstein on March 9, 1947 |
|
April 10, 2015, 13:14 |
|
#6 |
New Member
Ali Kadar
Join Date: Oct 2014
Location: Delft
Posts: 25
Rep Power: 12 |
Hello Bruno,
If you could find time please can you have a look. I tested the solver simpleReactingFoam in OF2.2.2 with the following problem. 1. Non-premixed turbulent gaseous combustion in a furnace. 2. Swirling Flow at Inlet. 3. Global 1 step irreversible reaction mechanism for CH4. I used all the settings with the counterFlowFlame2D tutorial(except 0 and polyMesh) provided by you. The simulation in the beginning throws janafThermo error but later(after many iterations) the simulation proceeds without error. However the result compared to reactingFoam and Fluent is completely wrong. The max temperatures falls to 1200K where it should be ~2000K . I dont know what am I doing wrong or the solver is not completely correct. ?? The mesh is very refined and therefore the simulation takes many hours(5-6) for convergence. I increased the max steps to 10000. Code:
SIMPLE: no convergence criteria found. Calculations will run for 4410 steps. Creating reaction model Selecting combustion model PaSR<psiChemistryCombustion> Selecting chemistry type { chemistrySolver sequential; chemistryThermo psi; } Selecting thermodynamics package { type hePsiThermo; mixture reactingMixture; transport sutherland; thermo janaf; energy sensibleEnthalpy; equationOfState perfectGas; specie specie; } Selecting chemistryReader foamChemistryReader chemistryModel: Number of species = 5 and reactions = 1 Reading field U Reading/calculating face flux field phi Creating turbulence model. Selecting turbulence model type RASModel Selecting RAS turbulence model kEpsilon kEpsilonCoeffs { Cmu 0.09; C1 1.44; C2 1.92; C3 -0.33; sigmak 1; sigmaEps 1.3; Prt 1; } Creating field kinetic energy K No finite volume options present Reading g Courant Number mean: 109.439 max: 21454.1 Starting time loop Time = 1 smoothSolver: Solving for Ux, Initial residual = 0.00530601, Final residual = 0.000446973, No Iterations 2 smoothSolver: Solving for Uy, Initial residual = 0.0424394, Final residual = 0.00302406, No Iterations 2 smoothSolver: Solving for Uz, Initial residual = 0.00906213, Final residual = 0.000165917, No Iterations 4 DILUPBiCG: Solving for O2, Initial residual = 1, Final residual = 6.42829e+09, No Iterations 1001 DILUPBiCG: Solving for H2O, Initial residual = 0, Final residual = 0, No Iterations 0 DILUPBiCG: Solving for CH4, Initial residual = 1, Final residual = 4.10261e+10, No Iterations 1001 DILUPBiCG: Solving for CO2, Initial residual = 0, Final residual = 0, No Iterations 0 DILUPBiCG: Solving for h, Initial residual = 1, Final residual = 0.0107451, No Iterations 1 min/max(T) = 300, 2102.62 GAMG: Solving for p, Initial residual = 1, Final residual = 0.0378342, No Iterations 16 time step continuity errors : sum local = 0.124907, global = -0.123693, cumulative = -0.123693 rho max/min : 1.14168 0.174843 smoothSolver: Solving for epsilon, Initial residual = 0.190803, Final residual = 0.0150082, No Iterations 2 smoothSolver: Solving for k, Initial residual = 1, Final residual = 0.040656, No Iterations 4 ExecutionTime = 1.97 s ClockTime = 2 s Time = 2 smoothSolver: Solving for Ux, Initial residual = 0.0950581, Final residual = 0.00133338, No Iterations 4 smoothSolver: Solving for Uy, Initial residual = 0.156577, Final residual = 0.0023826, No Iterations 4 smoothSolver: Solving for Uz, Initial residual = 0.0181092, Final residual = 0.000291685, No Iterations 4 --> FOAM Warning : From function janafThermo<EquationOfState>::limit(const scalar T) const in file /opt/apps/openfoam-2.2.2/OpenFOAM-2.2.2/src/thermophysicalModels/specie/lnInclude/janafThermoI.H at line 108 attempt to use janafThermo<EquationOfState> out of temperature range 200 -> 5000; T = 5748.93 --> FOAM Warning : From function janafThermo<EquationOfState>::limit(const scalar T) const in file /opt/apps/openfoam-2.2.2/OpenFOAM-2.2.2/src/thermophysicalModels/specie/lnInclude/janafThermoI.H at line 108 attempt to use janafThermo<EquationOfState> out of temperature range 200 -> 5000; T = 6743.5
__________________
A good solution is one which does justice to the inner nature of the problem- Cornelius Lanczos in a letter to Albert Einstein on March 9, 1947 |
|
April 16, 2015, 03:41 |
|
#7 |
Member
Join Date: May 2013
Location: Netherlands
Posts: 30
Rep Power: 13 |
Interesting discussion how to make reactingFoam steady state, looking forward to the results. Might be worth implementing it in OF 2.3 instead of 2.2. Some new solvers have been added in OF 2.3 which can speed up the chemistry calculations significantly. For some reason, OF 2.2 is relatively slow with chemistry (compared to OF 2.1 and OF 2.3). Running similations with chemFoam (which basically uses the same chemistry models and solvers as reactingFoam, but only for a single cell) are much faster in versions other than 2.2.
|
|
September 20, 2015, 15:58 |
|
#8 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Greetings to all!
@Ali: Sorry for the very late reply, but only today did I finally manage to give at least a quick look into this. I guess that since so much time as passed, you've already moved on and/or solver your problem. Either way, as pointed out by TBO in another thread: http://www.cfd-online.com/Forums/ope...tml#post542001 post #108 - the LTSReactingFoam solver would be a preferable approach. Because steady state heat transfer and chemical reactions, when done incorrectly, can result in having the whole fluid domain populated by the maximum temperature, due to averaging effects (not the actual technical term, but I can't remember right now which one is the correct term). I'll answer your other question on the thread I mentioned. Best regards, Bruno
__________________
|
|
October 9, 2015, 14:15 |
Experiments with LTSReactingParcelFoam
|
#9 |
New Member
Martina Blank
Join Date: Feb 2014
Posts: 8
Rep Power: 12 |
Dear all,
I have been reading this (and the related) threads with great interest, since I also want to have a steady state solver for combustion. Following the suggestions posted above, I made some experiments with LTSReactingParcelFoam, based on the counterFlowFlame2D tutorial. At first, it looked really promising, but I found a problem. Maybe you can shed some light. This is what I did: Test 1: No modifications, I just ran the tutorial. After 2000 iterations, the maximal temperature was 2432 K. Test 2: I changed the maximal Courant number from 1 to 5 in fvSolution: Code:
maxCo 5; Test 3: I used a Courant number smaller than one. Code:
maxCo 0.5; Test 4: Code:
maxCo 0.1; Can anyone explain this behaviour? The Courant number gives - as far as I understand it - a maximum limit for the "time-step". Why does the temperature change if I make the time step smaller? I suspect that there are problems in the solver (or the chemistryModel, or both) concerning the modeling of the species and energy source terms for combustion. The source terms seem to depend on the time step, even though the solver is steady-state. A related question: Did anyone ever successfully use simpleReactingParcelFoam for a combustion case? |
|
October 10, 2015, 04:18 |
|
#10 |
Senior Member
anonymous
Join Date: Aug 2014
Posts: 205
Rep Power: 13 |
Because if you reduce the time step you reduce the time discretization errors and thus your solution is less diffusive
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Solver for transonic flow? | Martin Hegedus | OpenFOAM Running, Solving & CFD | 22 | December 16, 2015 05:59 |
Is steady state solver grid dependent? | mmkr825 | OpenFOAM | 4 | March 22, 2013 13:46 |
convergence issues on steady state solver | icemaniac178 | CFX | 1 | March 30, 2011 20:11 |
time step and iterations in steady state problem using transient solver | jing113cn | FLUENT | 2 | January 15, 2010 04:18 |
Steady state solver for chemical reaction | hamburgFoam | OpenFOAM Running, Solving & CFD | 2 | January 8, 2010 09:34 |