CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

SonicFoamC

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

Reply
 
LinkBack Thread Tools Display Modes
Old   September 17, 2006, 23:26
Default Hello all, Can someone plea
  #1
Member
 
Shaun Cooper
Join Date: Mar 2009
Posts: 54
Rep Power: 7
coops is on a distinguished road
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
coops is offline   Reply With Quote

Old   September 18, 2006, 02:19
Default This is the density predictor.
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,730
Rep Power: 20
hjasak will become famous soon enough
This is the density predictor. A new time-step 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
hjasak is offline   Reply With Quote

Old   September 26, 2006, 18:04
Default Just a quick question for you
  #3
Member
 
Shaun Cooper
Join Date: Mar 2009
Posts: 54
Rep Power: 7
coops is on a distinguished road
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
coops is offline   Reply With Quote

Old   September 27, 2006, 03:45
Default Hi Shaun! "Normally needs a
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,772
Rep Power: 37
gschaider will become famous soon enoughgschaider will become famous soon enough
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 source-term is in the 1-line 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
gschaider is offline   Reply With Quote

Old   May 28, 2007, 08:52
Default Hello All, I have a questio
  #5
Member
 
Shaun Cooper
Join Date: Mar 2009
Posts: 54
Rep Power: 7
coops is on a distinguished road
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
coops is offline   Reply With Quote

Old   May 28, 2007, 11:20
Default Hi Shaun, the energy equation
  #6
Senior Member
 
Markus Hartinger
Join Date: Mar 2009
Posts: 102
Rep Power: 7
hartinger is on a distinguished road
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 foam-speak 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
hartinger is offline   Reply With Quote

Old   May 29, 2007, 02:11
Default Hi all, Thanks Markus that
  #7
Member
 
Shaun Cooper
Join Date: Mar 2009
Posts: 54
Rep Power: 7
coops is on a distinguished road
Hi all,

Thanks Markus that did help

Shaun
coops 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



All times are GMT -4. The time now is 10:04.