
[Sponsors] 
September 17, 2006, 23:26 
Hello all,
Can someone plea

#1 
Member
Shaun Cooper
Join Date: Mar 2009
Posts: 54
Rep Power: 7 
Hello all,
Can someone please tell why, in SonicFoam.C, the rhoEqn.H is included at the start of the runtime loop. Is this used to determine rho? What if (for the first time step) a rho field is already known? Then at the end of the PISO loop rho is determined from psi*p, this seems to be the rho field that is then written. For the next time step the continiuty equation, from the inclusion of rhoEqn.H, is then used again. Does this create another rho field that is then used in the PISO loop? Hope this question makes sense. Thanks in advance, Shaun 

September 18, 2006, 02:19 
This is the density predictor.

#2 
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,730
Rep Power: 20 
This is the density predictor. A new timestep has started and we can update the density field from the equation:
ddt(rho) + div(rho U) = 0 Fluxes (rho U) are known so there's no problem. The above is a predictor, meaning it is there to make life easier for PISO. This is the only density consistent with the pressure and that's what we need for continuity. Hope this helps  enjoy, Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk 

September 26, 2006, 18:04 
Just a quick question for you

#3 
Member
Shaun Cooper
Join Date: Mar 2009
Posts: 54
Rep Power: 7 
Just a quick question for you all. When people create their own solvers starting from one of the existing solvers how much of the code normally needs altering. Is it only the equations for the dependant variables that are altered or does most of the code need to be altered for new applications? Also, does modelling turbulence make a model run more stable?
Thanks Shaun 

September 27, 2006, 03:45 
Hi Shaun!
"Normally needs a

#4 
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,772
Rep Power: 37 
Hi Shaun!
"Normally needs altering": The answer "between 1 and 100s line of code, depending on the application" won't make you happy, will it? It really depends: adding some new sourceterm is in the 1line range from then on it gets more complicated, but if there is an existing solver that has most of your needed functionality, then you'll spend more time reading docu (and sources) than coding. For the first one. (it gets better after that)
__________________
Note: I don't use "Friend"feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request 

May 28, 2007, 08:52 
Hello All,
I have a questio

#5 
Member
Shaun Cooper
Join Date: Mar 2009
Posts: 54
Rep Power: 7 
Hello All,
I have a question regarding the following lines in the sonicFoam.C file: mu*magSqr(symm(fvc::grad(U))) from the energy equation. What is this line saying mathematically? I don't understand the magSqr function. I looked at Doxygen and found: template<> inline tmp<volscalarfield> magSqr<tensor>::operator() ( const volTensorField& phi ) const { return Foam::tr(phi); } where tr is the trace. Can someone let help me understand what this means physically? Thanks Shaun 

May 28, 2007, 11:20 
Hi Shaun,
the energy equation

#6 
Senior Member
Markus Hartinger
Join Date: Mar 2009
Posts: 102
Rep Power: 7 
Hi Shaun,
the energy equation in sonicFoam is based on the internal energy // rate of change fvm::ddt(rho, e) // convection + fvm::div(phi, e) // conduction  fvm::laplacian(mu, e) == // pressure work  p*fvc::div(phi/fvc::interpolate(rho)) // viscous dissipation + mu*magSqr(symm(fvc::grad(U))) viscous dissipation is the negative double dot product of stress tensor tau and grad(U): tau && grad(U); in foamspeak tau: // stress tensor volTensorField tau =  mu * (gradU + gradU.T()) + (2.0/3.0 * mu * fvc::div(U)) * I; with the definition of the double dot product: (see "Transport Phenomena", 2nd edition, b. bird, p82) (tau && grad(U)) = mu/2.0 * sqr(gradU + gradU.T()  (2.0/3.0 * fvc::div(U)) * I) neglecting the influence of 2.0/3.0 * fvc::div(U)) * I and with symm(grad(U)) = 0.5 * ( grad(U) + grad(U).T()) we arrive at mu*magSqr(symm(fvc::grad(U))) where magSqr is the magnitude of a tensor and that result is squared. definition of mag(tensor): sqrt(0.5 * sum_i(sum_j(sqr(tensor_ij)))) you can puzzle that together yourself by using the programmers guide and "tranport phenomena" by bird hope that helps markus 

May 29, 2007, 02:11 
Hi all,
Thanks Markus that

#7 
Member
Shaun Cooper
Join Date: Mar 2009
Posts: 54
Rep Power: 7 
Hi all,
Thanks Markus that did help Shaun 

Thread Tools  
Display Modes  

