CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Structure of momentum equation in mhdFoam (https://www.cfd-online.com/Forums/main/224848-structure-momentum-equation-mhdfoam.html)

edmund32 March 5, 2020 12:09

Structure of momentum equation in mhdFoam
 
Hi,
I was just looking at the momentum equation for an incompressible MHD flow online (https://www.openfoam.com/documentati...utorialse4.php) and saw that is was slightly different in mhdfoam.C:
The equation in that link is:
Code:

fvm::ddt(U) + fvm::div(U, U)
 - fvc::div(B, 2.0*DBU*B)
 - fvm::div(nu, U)
 + fvc::grad(DBU*magSqr(B))

 == -fvc::grad(p));


While the one in mhdFoam is



Code:

fvm::ddt(U) + fvm::div(phi, U)
 - fvc::div(phiB, 2.0*DBU*B)
 - fvm::laplacian(nu, U)
 + fvc::grad(DBU*magSqr(B))

 == -fvc::grad(p));


I know I'm just being stupid, but why is phi and phiB used instead of U and B? And why is the vicosity term a laplacian operator rather than a divergence?

Thanks!
Edmund

FMDenaro March 5, 2020 12:26

To be honest, I would say an error the use of "phi". See https://www.openfoam.com/documentati...utorialse4.php
However, I suggest to post in the OF forum.





The viscous term in the momentum reduces to the laplacian of the velocity when the velocity is divergence-free.

edmund32 March 5, 2020 12:35

Oh sorry! I thought I had posted in the Openfoam forum, I guess I forgot to check. Is it worth re-posting?

LuckyTran March 5, 2020 12:54

In OpenFOAM phi is preferred for the fluxes even for incompressible cases where rho doesn't exist. phi is a face flux interpolated/constructed from U and is a surfaceScalarField whereas U is a volumeVectorField. So even though mathematically div(UU) and div(phi*U) are in principle the same for the incompressible case, there's lot of practical programming reasons to still use phi and not U.


tl;dr phi appearing in the governing equations for incompressible cases is not an error in OpenFOAM


The other question on the laplacian term is answered already. The choice of taking the full divergence of the viscous stress and applying the the divergence free velocity constraint or choosing instead to just use the laplacian has different implications for numerical stability.

FMDenaro March 5, 2020 13:08

Quote:

Originally Posted by LuckyTran (Post 760599)
In OpenFOAM phi is preferred for the fluxes even for incompressible cases where rho doesn't exist. phi is a face flux interpolated/constructed from U and is a surfaceScalarField whereas U is a volumeVectorField. So even though mathematically div(UU) and div(phi*U) are in principle the same for the incompressible case, there's lot of practical programming reasons to still use phi and not U.


tl;dr phi appearing in the governing equations for incompressible cases is not an error in OpenFOAM


The other question on the laplacian term is answered already. The choice of taking the full divergence of the viscous stress and applying the the divergence free velocity constraint or choosing instead to just use the laplacian has different implications for numerical stability.






I am not expert in OF, I wonder what is the issue in the fact that UU is a tensor and phi*U is a vector...


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