CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   one question about representation of equations? (http://www.cfd-online.com/Forums/openfoam-programming-development/90107-one-question-about-representation-equations.html)

lfgmarc June 30, 2011 13:22

one question about representation of equations?
 
Hi, I am new in openFoam, and I try to understand this equation from XiFoam solver:

{
fvScalarMatrix hEqn
(
fvm::ddt(rho, h)
+ mvConvection->fvmDiv(phi, h)
- fvm::laplacian(turbulence->alphaEff(), h)
==
DpDt
);
hEqn.relax();
hEqn.solve();

thermo.correct();
}

This is the enthalpy equation, I want to understand what is the meaning of each term, I understand that fvm::ddt(rho, h) is the representation of the time derivative, fvmDiv(phy,h) represent the convective term, but in this stage I am some confused about what is the meaning of the mvConvection->here, the next term is the diffusive term (fvm::laplacian(turbulence->alphaEff(), h)) here I am confused with the meaning of turbulence->alphaEff().

I will be a lot thankful if someone can explain me this.

thanks for your help

Best Regards

marupio June 30, 2011 17:51

You have to remember, this is still C++ code. They've overloaded the operators and created namespaces in an elegant way so it looks like you are typing in an equation, but it is still just C++, and sometimes the syntax gets in the way a little.

Code:

+ mvConvection->fvmDiv(phi, h)
This whole thing is the convection term. Normally it would look something like:
Code:

+ fvm::div(phi, h)
but they are creating the convection scheme before the equation. Somewhere above this, you'll see where mvConvection gets created. This is not common, but there are reasons for this. The normal method would have OpenFOAM looking in your system/fvSchemes dictionary for a div(phi, h) scheme defined... then it would use that convection scheme. However, if only a specific convection scheme will do, it creates that one above the equation and forces the equation to use it. In this case, the user has no control over the convection scheme by changing the fvSchemes file.

Another reason for this may be because there are a lot of variables using a common convectionScheme... so rather than clutter up your fvSchemes file with entries for each variable, they define a common one, and only look that one up.

Code:

turbulence->alphaEff()
This is C++. turbulence is a pointer to a turbulenceModel, and the -> is the syntax we use to access the function alphaEff()... which basically just returns the effective alpha (I forget what alpha is in the world of turbulence). So this whole thing is simply the variable alphaEff().

Hope that helps.

lfgmarc June 30, 2011 18:52

Thanks for the reply David, was very helpful for me. Another question, the last term , DpDt is like an assignment ?

Best regards

chegdan July 1, 2011 18:57

Quote:

Originally Posted by marupio (Post 314311)
Code:

turbulence->alphaEff()
I forget what alpha is in the world of turbulence

alphaEff is the effective thermal diffusivity that uses the gradient diffusion hypothesis to relate the influence of turbulence on thermal diffusion through a turbulent Prandtl (Prt in OF set to 1 by default) and the turbulent viscosity calculated in your turbulence model. You can look in the compressible RANS models ($FOAM_SRC/turbulenceModels/compressible/RAS/) for alphat (turbulent thermal diffusivity) = mut/Prt. There is an explanation of the gradient diffusion hypothesis in here ..sorry...shameless plug. More detailed discussions are in books by Rodney Fox and Stephen Pope for those interested.

Dan

lfgmarc July 1, 2011 23:49

thanks for your reply Dan

marupio July 2, 2011 12:02

Thanks Dan. Your article looks like a good read... relevant to my stuff, too.

Felipe, the last term DpDt isn't an assignment. It's the "equal to" operator. It behaves as an equals sign would in the equation you are creating.

derkermit August 18, 2011 07:21

Quote:

Originally Posted by marupio (Post 314489)
Felipe, the last term DpDt isn't an assignment. It's the "equal to" operator. It behaves as an equals sign would in the equation you are creating.

Can you explain that a little more detailed? In another Thread (http://www.cfd-online.com/Forums/ope...tml#post206283) i found this one:
Quote:

DpDt = ddt(p) + U . grad(p)
Is the meaning of "behaves like an operator" and the statement in the last quote the same?

Thx, Alex

EDIT:
Just figured it out:
DpDt is the total differentiation Dp = dp/dt + dp/dx Dx + dp/dy Dy + dp/dz Dz divided by Dt. With Dx/Dt = u, Dy/Dt = v, ... the above equation follows. My Question now is: Where is the implementation of this operator? I had no success by searching in the User Guide and neither was there a found in the Programming Guide. I also found a table with most of the operators (e.g. ddt(p)) but no word about DpDt.

EDITē:
Found the implementation in createFields.H. The "find" command under linux seems to be very helpful in such cases =)


All times are GMT -4. The time now is 00:50.