CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   About usage of fvm::laplacian (https://www.cfd-online.com/Forums/openfoam-programming-development/254769-about-usage-fvm-laplacian.html)

songyi719 March 1, 2024 04:28

About usage of fvm::laplacian
 
I have a bit confusing part about laplacian operator of openfoam, so I am writing the thread to ask some question


https://www.openfoam.com/documentati...laplacian.html


When we look at this guide, it says fvm::laplacian can be used as not only laplacian operator, but as combination of divergence and gradient. But since they mentioned diffusion coefficient as example, I initially thought it is actually meaningless, since it is meaningless to put constant coefficient before or after the gradient operator and has no difference.


However, I was trying to modify some scalartransport code, and I found that they use fvm::laplacian(rho*D(), s_) and rho is definitely non-constant operator. In this case, is it used as div(rho*D*grad(s))or just laplacian(rho*D*s)?



Can anybody give exact description of how fvm:: functions are used?

dlahaye March 1, 2024 05:14

Not sure.

Does it help to write out definition of

div( grad s) aka div( D grad s) with D = 1

and

div( D grad s) where D is a function of e.g. x and y ?

songyi719 March 1, 2024 05:37

Quote:

Originally Posted by dlahaye (Post 865574)
Not sure.

Does it help to write out definition of

div( grad s) aka div( D grad s) with D = 1

and

div( D grad s) where D is a function of e.g. x and y ?

So, we can put any scalar at location of D, even if it isn't constant by time and space, right?

dlahaye March 1, 2024 05:51

Depends on what you are trying to obtain.

songyi719 March 1, 2024 06:06

What does that imply?

I know that when used with single variable as input, fvm::laplacian will be used as pure laplacian operator. Are you trying to say about this functionality?

Tobermory March 1, 2024 11:07

fvm::laplacian is defined in fvmLaplacian.C (https://cpp.openfoam.org/v8/fvmLaplacian_8C_source.html) and like many OpenFOAM functions is overloaded, so can be called in many different ways. Regardless, all of them evaluate the quantity
\nabla \cdot ( \Gamma \nabla \phi ), albeit in a fashion that is suitable for an implicit discretisation. \Gamma may be a constant or may vary spatially ... it is still a "Laplacian".

Quote:

Can anybody give exact description of how fvm:: functions are used?
You might need to be more specific with your question here, my friend! In general, we can say that the fvm functions like fvm::laplacian are all implicit discretisations of the relevant functions, fit for a finite volume model.

songyi719 March 2, 2024 03:17

Oh, I got it now! Thanks for the reply

I was curious about how they actually work, since I only knew that they do something about solving PDE. Now I found that it involves with fvm namespace implicitly, while fvc does it explicitly. Thanks again.


All times are GMT -4. The time now is 02:03.