CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   how to calculate the magnitude (module) of a gradient (http://www.cfd-online.com/Forums/openfoam/93823-how-calculate-magnitude-module-gradient.html)

Alucard October 27, 2011 09:32

how to calculate the magnitude (module) of a gradient
 
Goodmorning, I'm working in the frame of phase field models for solidification.
I've to solve a transport equation for the phase field (-1 in one phase,1 in the other one and a smooth passage atthe interface).
The equation i've to solve present the module of the gradient |grad f| (the vector magnitude):

df/dt+V*grad f=a*[ laplacian f+f*(1-f)/b-|grad f| div [ grad f/|grad f|]]
with a,b parameters (or constants).

how can I calculate the |grad f| term when I want to solve the equation?


I tried that way:

1) |grad f| ==== mag(fvc::grad(phase))
where phase is my "f"

2)otherwise I also tried to first define:
volVectorField gradphase = fvc::grad(phase);
and after
|grad f| ==== mag(gradphase)

are they equivalent? or at least, is one correct?

Thank you in advance, I'm quite new in openfoam (and in c++).

ata October 28, 2011 03:33

Hi
I think they are equivalent but what is "===="?

Alucard October 28, 2011 04:43

Quote:

Originally Posted by ata (Post 329838)
Hi
I think they are equivalent but what is "===="?

Sorry , it is just a symbolic way to indicate how I calculate the term,look at it like an arrow if you prefere -->.


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