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/)
-   -   porous media models (https://www.cfd-online.com/Forums/openfoam-programming-development/126946-porous-media-models.html)

gooya_kabir November 29, 2013 10:23

porous media models
 
Hi Dear FOAMers,

I'm working on modification of porous media models in OF. I'm trying to change Darcy-Forchheimer model, in new model there is second derivatives of U in x and y direction. It seems that source term for Darcy-Forchheimer model is defined in src/finiteVolume/cfdTools/general/porosityModels as follow:

forAll(cells, i)
{
const label cellI = cells[i];

const tensor Cd = mu[cellI]*D + (rho[cellI]*mag(U[cellI]))*F
const scalar isoCd = tr(Cd);

Udiag[cellI] += V[cellI]*isoCd;
Usource[cellI] -= V[cellI]*((Cd - I*isoCd) & U[cellI]);
}
, which D and F are constants of model.
Now, I want to change the second part of Cd, ((rho[cellI]*mag(U[cellI]))*F) to
mu * ((d2U/dx2)+(d2U/dy2)).

My questions are:
mag(U[cellI]) means that it's not a vector more?
What is difference of U and V?
I tried to apply laplacian U in second part of Cd, but it seems laplacian and div cannot be read here since we did not define argc and argv, right?
and finally, if it's not possible to apply derivatives here, how can I change the model?

Thank you in advance for your help and comments.

nimasam December 1, 2013 11:04

1- mag returns the magnitude the vector
2-what is V? you should look the source code to find it
3-obviously you are not supposed to do such an action, because laplacian operator is defined for volField variable not an specific scalar
4- to general question

i suggest, first of all, you start to find how the existing model works , then try to adapt your own code, OpenFOAM is Open-source code, so dont limit your self to a specific part of it, read code from every where :D and give idea from other libraries

gooya_kabir December 2, 2013 10:10

Thank you for help. just an easy question (maybe!), what's the mathematical description of below equation in OF???

mu * (d2U/dx2)+(d2U/dy2)

(it's a 3-d structure and we have z direction also)

Quote:

Originally Posted by nimasam (Post 464248)
1- mag returns the magnitude the vector
2-what is V? you should look the source code to find it
3-obviously you are not supposed to do such an action, because laplacian operator is defined for volField variable not an specific scalar
4- to general question

i suggest, first of all, you start to find how the existing model works , then try to adapt your own code, OpenFOAM is Open-source code, so dont limit your self to a specific part of it, read code from every where :D and give idea from other libraries


nimasam December 2, 2013 10:17

it is :
Code:

laplacian(mu,U)
if mu multiples in the whole terms ;)

gooya_kabir December 2, 2013 10:25

so, what's the difference between:
(d2U/dx2) + (d2U/dy2) + (d2U/dz2) and (d2U/dx2) + (d2U/dy2) ?
I thought laplacian means : laplacian (U)=(d2U/dx2) + (d2U/dy2) + (d2U/dz2)
and I just want the first two terms!
Quote:

Originally Posted by nimasam (Post 464413)
it is :
Code:

laplacian(mu,U)
if mu multiples in the whole terms ;)


nimasam December 2, 2013 13:53

is it a 2D simulation or 3D ?

gooya_kabir December 2, 2013 14:26

it's 3D simulation
Quote:

Originally Posted by nimasam (Post 464453)
is it a 2D simulation or 3D ?


gooya_kabir December 3, 2013 07:30

I have to generate this kind of derivatives?

nimasam December 3, 2013 08:24

i guess so, you need to modify a higher classes, see source code how laplacian has been implemented :), i guess you need to follow the similar approach to implement your special laplacian

gooya_kabir December 4, 2013 09:19

again Hi ;)
I tried to search the web and also OF to see what I can get. In src/finiteVolume/finiteVolume directory, there are two directory with laplacian 1)laplacianSchemes* and 2)fvm/fvmLaplacian*
when I want to change the laplacian procedure, probably I have to change all parts(1, 2)?
and also when I want to change fvm/fvmLaplacian(2), there is no file related to this in original Make/files to copy it into my run directory, am I right? what could I do?
and when I want to use new laplacian, I should add the library into my solver.C? since it make error when I add this : libs ("libmyfiniteVolume.so")?!
Quote:

Originally Posted by nimasam (Post 464587)
i guess so, you need to modify a higher classes, see source code how laplacian has been implemented :), i guess you need to follow the similar approach to implement your special laplacian



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