|
[Sponsors] |
May 18, 2013, 13:02 |
passive scalar increases
|
#1 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 |
I have written a passive scalar equation that should be used in a compressible solver like rhoCentralFoam but in each test case i use that the passive scalar (gas) itself and also its residuals increases during the run.
i thought its because of included rho but don't know how to remove rho from the equation because at least phi includes rho in it and the code doesn't accept dividing by rho. how to overcome the situation of issue?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
May 21, 2013, 13:55 |
|
#2 | |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Quote:
Hi, as we wrote the last weeks via PM I 'll share everything now with the other peoples. I am not sure if its working with the "rhoCentralFoam" couse in the describtion there is a line that this solver works with central schemes. So I am not sure if that is working with my suggestions. Here are the steps building a new solver with a conserved scalar: Create a new solver (example is a compressible sovler) --------------------------------------------------------------------------------------- 1. go into your $FOAM_RUN dictionary 2. go one folder back (cd ..) 3. create a folder Code:
mkdir -p applications/solvers/compressible 5. copy existing solver to that one Code:
cp -r $FOAM_SOLVERS/compressible/rhoSimpleFoam scalarRhoSimpleFoam Rename and rebuild the new solver --------------------------------------------------------------------------------------- 1. wclean 2. rename the rhoSimpleFoam.C into scalarRhoSimpleFoam.C 3. change the file Make/files Code:
scalarRhoSimpleFoam.C EXE = $(FOAM_USER_APPBIN)/scalarRhoSimpleFoam 5. wclean Add new conserved scalar --------------------------------------------------------------------------------------- 1. create a new file (e.g. scalarEqn.H; here its ZEqn.H) 2. insert the following lines: Code:
//- Solving equation of conserved scalar (Z) fvScalarMatrix ZEqn ( ( fvm::ddt(rho, Z) + fvm::div(phi, Z) - fvm::laplacian(turbulence->muEff(), Z) ) ); ZEqn.relax(); ZEqn.solve(mesh.solver("Z")); Code:
volScalarField Z ( IOobject ( "Z", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Code:
// Pressure-velocity SIMPLE corrector { #include "UEqn.H" #include "EEqn.H" #include "pEqn.H" #include "ZEqn.H" } 6. finished Congratulations --------------------------------------------------------------------------------------- - a friend used my solver for prediction of a mixture of methan - air - gives very good results, only weakness is the constant density. For that I build a new one with two different densitys (not tested). In the attachment are pictures of my test case (laminar + turbulent). The conserved scalar is between 0 and 1. Hope that helps. |
||
May 21, 2013, 14:17 |
|
#3 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 |
Hi Tobias
could you please have a look into rhoCentralFoamModified I have put in the above post? Code:
tmp<fvScalarMatrix> gasEqn ( fvm::ddt(rho,gas) + fvm::div(phi, gas) -fvm::Sp(fvc::div(phi), gas) - fvm::laplacian(turbulence->muEff(), gas) ); gasEqn().relax(); gasEqn().solve(mesh.solver("gas")); Code:
-fvm::Sp(fvc::div(phi), gas) Code:
#include "gasEqn.H" thanks.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
May 21, 2013, 14:20 |
|
#4 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Hi,
the term for stabilisation dont have to be removed. In OF2.2.x you can activate that term in the fvSchemes file Code:
bounded In my opinion the problem depends on the centralFoam. I have no idea how that algo is working. So you should change to the rhoSimpleFoam. |
|
May 21, 2013, 14:35 |
|
#5 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 |
my case is treansient so rhoSimpleFoam may not be appropriate for my case.
I also have used rhoPimpleFoam with the same problem(not be scalar between 0 and 1) that term is necessarily have to be there? could you have a look into rhoPimpleFoamModified?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
May 21, 2013, 15:27 |
|
#6 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Hi,
okay for a transient solver you have to use the following conserved equation: Code:
//- Solving equation of variance of mixture fraction fvScalarMatrix ZEqn ( fvm::ddt(rho, Z) - fvm::Sp(fvc::ddt(rho), Z) + fvm::div(phi, Z) - fvm::Sp(fvc::div(phi), Z) - fvm::laplacian(turbulence->muEff(), Z) ); ZEqn.relax(); ZEqn.solve(mesh.solver("Z")); Seems that everything is working fine. Hope it helps Have fun Tobi |
|
May 21, 2013, 16:36 |
|
#7 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 |
thanks.I'm testing it now.but residuals of scalar still are higher than other equations. isn't it wrong?
and should I also add "bounded" in fvSchemes for all terms in 2.2.0 like Code:
ddt(rho, h) bounded Euler;
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
May 21, 2013, 16:38 |
|
#8 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Hi,
with that code above you do not have to use bounded schemes. If you do so, you ll do it twice! Thats wrong. The scalar must be between 0-1 or the value you use in the 0/Scalar file |
|
May 21, 2013, 17:32 |
|
#9 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 |
Thank you dear Tobias.Its exactly between 0 and 1 now.
I didn't grasp what did that openfoam.org page say. it says in line 8 that: Code:
For transient solutions, it is usually better to implement only the fvm::div(phi, h) term Code:
Compressible solvers for transient problems generally use the PIMPLE algorithm, which supports partial convergence of intermediate iterations. The solution may benefit from the use of the bounded form of convection but, in such cases, the corresponding bounded time derivative must also be included like the example: Code:
ddtSchemes { default Euler; ddt(rho, h) bounded Euler; } what means at all! thank you for a bit clarification.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
May 21, 2013, 17:45 |
|
#10 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 |
and also I forgot to ask about its residual.only want to know does it has a specific reason or its ordinary and hasn't anything wrong.
the residuals of passive scalar are of order of .001 while others are lower,does it have any specific reason?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
May 22, 2013, 08:31 |
|
#11 | |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 |
since the problem is resolved now,I put this answer by dear Tobias in private(by his permission),here so that someone needs now or in future knows more about what I asked:
Quote:
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
||
May 22, 2013, 13:47 |
|
#12 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Hi,
for clearness - please note that I meant the following: if you are using the bounded time derivation you are not allowed to set the d efault value to "bounded" couse the implemented scalar has this line explicit in the code. For that you have to use default as standard and modify the other values: Code:
ddt(rho,U) bounded ... Code:
fvScalarMatrix ZEqn ( fvm::ddt(rho, Z) - fvm::Sp(fvc::ddt(rho), Z) + fvm::div(phi, Z) - fvm::Sp(fvc::div(phi), Z) - fvm::laplacian(turbulence->muEff(), Z) ); |
|
May 22, 2013, 14:15 |
|
#13 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 |
thank you for summary.
and what I haven't understood yet is that when we have to use a bounded term in both steasy and unsteady,compressible and incompressible cases? some more clarification is good.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
May 23, 2013, 06:57 |
|
#14 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 |
Hi again before close the issue dossier!
when I used linear scheme for probably more accuracy it didn't get a good result(not good appearance and also higher than 1) Code:
div(phi,gas) Gauss linear; the question is:why its so?!
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
May 23, 2013, 07:15 |
|
#15 | |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Quote:
That depend on the schemes. On my Homepage you can find a summary about that Topic (unfortunatelly only in german). But the grapics show everything I think. http://www.holzmann-cfd.de/index.php...rische-schemen |
||
May 23, 2013, 08:18 |
|
#17 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 |
thanks Tobias
related to vanLeer nothing has said but it has nice results,then what do you suggest for better accurate and physical results for passive scalar transport?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
May 23, 2013, 11:44 |
|
#18 | |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Quote:
For the scalar I prefer Code:
limitedLimitedLinear 1 0 1 |
||
May 23, 2013, 14:45 |
|
#19 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 |
thanks.
vanLeer isn't a second order scheme? what do 1 0 1 refer to respectively in the scheme?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
May 23, 2013, 15:05 |
|
#20 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
vanLeer is a second order scheme.
To prevent unphysical results (the only scheme which is not producing unphysical results is gauss upwind 1st order) you can use limited schemes and schemes that are bouding the values: Code:
limtiedLinear 1 limitedLinear 0.33 limitedLinear 0 = linear Code:
limitedLimitedLinear 1 0 1 - the second one is the lower bouding value - the third one is the upper bouding value As you set your scalar between 0-13.54 you should write: Code:
limitedLimitedLinear 1 0 13.54 Last edited by Tobi; May 24, 2013 at 07:38. Reason: prefent :D |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
whats the cause of error? | immortality | OpenFOAM Running, Solving & CFD | 13 | March 24, 2021 07:15 |
dieselFoam problem!! trying to introduce a new heat transfer model | vivek070176 | OpenFOAM Programming & Development | 10 | December 23, 2014 23:48 |
compressible flow in turbocharger | riesotto | OpenFOAM | 50 | May 26, 2014 01:47 |
is internalField(U) equivalent to zeroGradient? | immortality | OpenFOAM Running, Solving & CFD | 7 | March 29, 2013 01:27 |
passive scalar for carbon monoxide | kraizy | STAR-CCM+ | 0 | October 12, 2009 20:13 |