CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   differentiation in one direction (http://www.cfd-online.com/Forums/openfoam-solving/91146-differentiation-one-direction.html)

 ziemowitzima August 1, 2011 18:39

[solved]differentiation in one direction

Dear Foamers,

Does anyone of you know what is the best way to dicsretize following problem:
we have: f(x,y) -- scalar function

we need: f_xxxx
(fourth order) differentiation but only in one direction.

i.e.
laplacian(f) = f_xx + f_yy
but I need only f_xx (in fact I need f_xxxx)

Thanks
ZM

 gautcho August 2, 2011 01:55

You should use a difference quoutient, like you have propably seen for f_x. You can perform the difference quotient "four" times or you can have a look here (they have already done it for you):

http://en.wikipedia.org/wiki/Difference_quotient

Probably it should be the best for you to read the whole article, but you can also jump ahead to:

http://en.wikipedia.org/wiki/Differe....C5.83th_Order

 ziemowitzima August 2, 2011 11:10

Thanks :)
This I know.
I didn't put it explicit in my question but I need to know how to make it in OpenFOAM.

-Best

 ziemowitzima August 2, 2011 17:52

so far I found such explicit solution:

volScalarField Txxxx = gradT.component(0); // T_x

Maybe someone have some better idea ?
Is it possible to descritize T_xxxx implicitly ?

-ZM

 ziemowitzima August 4, 2011 12:24

It seems that problem can be solved (after Akidess suggestion ):

"... it sounds like you want anisotropic diffusion - why not just pass a diffusion coefficient tensor to laplacian instead of a scalar?..."
from:
http://www.cfd-online.com/Forums/ope...-operator.html

So,
x - direction diffusion:
DTe1D DTe1D [ 0 2 -1 0 0 0 0 ] (3e-02 0 0 0 0 0 0 0 0 );

x,y and - directions diffusion:
DTe3D DTe3D [ 0 2 -1 0 0 0 0 ] (3e-02 0 0 0 3e-02 0 0 0 3e-02 );

for f_xxxx it can be done as follows :
suppose we have equation f_xxxx = g(x,y),
substitution: h = f_xx
so we have two "one-directional" Poison equations to solve:
h_xx = g(x,y)
f_xx = h(x,y)

in OF:
fvm::laplacian(DTe1D, h) == g
fvm::laplacian(DTe1D, f) == h

 All times are GMT -4. The time now is 12:42.