How to calculate the divergence of the gradient of a scalar?

Miscellaneous discussion topics about Code_Saturne (development, ...)
Post Reply
Yuan Huang

How to calculate the divergence of the gradient of a scalar?

Post by Yuan Huang »

Hi, everyone!
 
I
define a user scalar (marked by “f”) in the program, and I want to calculate
the divergence of the gradient of the scalar.
 
I
want to calculate it in the following way.
 
First,
the gradient of “f” can be obtained by calling the subroutine “grdcel”,
the three components of the gradient are “fx”, “fy” and “fz”.
Second, the gradient of “fx” can also be obtained by calling the subroutine
“grdcel”, the three components of the gradient of “fx” are “fxx”, “fxy”
and “fxz”. The gradient of “fy” and “fz” can be obtained in the same way, the components
of the gradient of “fy” are “fyx”, “fyy” and “fyz”, the components of the gradient of “fz” are “fzx”, “fzy” and “fzz”. So the divergence of
the gradient of “f” is equal to “fxx” +”fyy”+”fzz”.
 
But
there is a problem, calling the subroutine “grdcel” need the boundary
coefficients. The coefficients of “f” is known, the coefficients of “fx”, “fy”
and “fz” are unkown, how to get the boundary coefficients of “fx”, “fy” and “fz”?
 


      Is there another way to calculate the divergence
of the gradient of a scalar ?       Thanks very much!       Yuan Huang
Jacques Fontaine

Re: How to calculate the divergence of the gradient of a scalar?

Post by Jacques Fontaine »

Hello,
What do you mean by coefficients of f? The boundary coefficients (coefa and coefb) have to be fixed only for the variable f (f_boundary = coefa + coefb* f_I'), and normally you have already defined your BC in usclim.f90.
By the way, why do you want calculate the divergence?
JF
Post Reply