passive scalar increases
3 Attachment(s)
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? |
2 Attachment(s)
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 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) Code:
volScalarField Z Code:
// Pressure-velocity SIMPLE corrector 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. |
Hi Tobias
could you please have a look into rhoCentralFoamModified I have put in the above post? Code:
tmp<fvScalarMatrix> gasEqn Code:
-fvm::Sp(fvc::div(phi), gas) Code:
#include "gasEqn.H" thanks. |
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. |
1 Attachment(s)
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? |
3 Attachment(s)
Hi,
okay for a transient solver you have to use the following conserved equation: Code:
//- Solving equation of variance of mixture fraction Seems that everything is working fine. Hope it helps :) Have fun Tobi |
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; |
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 |
Thank you dear Tobias.Its exactly between 0 and 1 now.:D
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 what means at all! thank you for a bit clarification.:confused: |
2 Attachment(s)
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? |
since the problem is resolved now,I put this answer by dear Tobias in private(by his permission:D),here so that someone needs now or in future knows more about what I asked:
Quote:
|
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:
Code:
fvScalarMatrix ZEqn :) |
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. |
2 Attachment(s)
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?!;) |
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 |
|
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? |
Quote:
For the scalar I prefer Code:
|
thanks.
vanLeer isn't a second order scheme? what do 1 0 1 refer to respectively in the scheme? |
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:
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 |
thank you for your full clarification.:)
|
Hi again!
and what will be the proper code for an incompressible case? I wrote sp(rho,gas) in pimpleFoam and it got an error and when removed rho from equation in got another error:http://www.cfd-online.com/Forums/ope...tml#post430020 so whats the correct equation? |
Quote:
Hi Code:
|
Hi,sure it needs to be modified:
Code:
fvScalarMatrix gasEqn Code:
Making dependency list for source file pimpleFoamModified.C |
Sorry... my fault:
Code:
|
Hi tobias
I changed it: Code:
fvScalarMatrix gasEqn Code:
ehsan@Ehsan-com:~/Desktop/Solvers/pimpleFoamModified$ wmake I don't know yet exactly when we have to use Sp term.could you please clarify again for me? |
Hi dear Tobias
this link has been broken,could you give me another link for referencing? thanks. http://www.holzmann-cfd.de/index.php...rische-schemen |
Greetings to all!
@Ehsan: Quote:
Best regards, Bruno |
|
Quote:
A while ago you also mentioned this solution to me on the libOpenSmoke forum. However I think it is more appropriate to ask you here, since this is about the scalar solver. Can you share your solver with two different densities for the mixing of air and methane? As background, I want to model the mixing of a fuel (methane) with air. Regards, |
Hi dear Tobias,
for an unsteady flow,are these schemes appropriate?is bounded scheme suitable for ddt(rho,gas)? the results seemed fine and now I noticed about maybe excess "bounded" term in schemes.are they OK in your opinion? Code:
ddtSchemes Code:
// --- Scalar Transport( Solving equation of variance of mixture fraction ) |
Quote:
yes I have that solver - anywhere on my Harddisc :D - Is it possible that you share your results? Regards Tobi PS: Further answer to the schemes is comming (no time at the moment) |
Quote:
I would be very happy to test this solver, since it would help a lot to model a steady state mixing of gases with different densities. My main goal is to run combustion simulations (with the use of libOpenSmoke/ flameletSimple/PisoFOam). However as step before and to assess nozzle designs I would like to model fuel and air mixing without chemical reactions involved, for this the scalar solver could be very helpful, since steady state is almost the only option. The simulations I am doing on real geometries are strictly confidential, so there is no way of sharing them :(. For the cold flow mixing I will also run some academic cases (when I have time...) and it should be possible to share some of those results. Mit freundlichen Grüßen, |
All times are GMT -4. The time now is 08:09. |