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/)
-   -   Problems with FAM (fac::grad) (https://www.cfd-online.com/Forums/openfoam-programming-development/196735-problems-fam-fac-grad.html)

martinK. December 14, 2017 05:14

Problems with FAM (fac::grad)
 
Hello Dear Forum Users,
as I'm new to the forum firstly I would like to say hi and thank you for all the helpful answers you've done already. I started of with OpenFoam few weeks ago and found help here multiple times yet.
Right now I'm stuck for quite a while and can't help me for myself (still I hope it's quite an easy and trivial problem and it's just due to my inability)...

I'm using foam extend 3.2 and try to write a solver for the shallow water equations based on the finite-area-method. Implementing the equations was straight-forward but while performing some calculations I get an error when compiling:

Code:

// S and H: areaScalarFields, g: dimensionedScalar
areaScalarField  absWL = g*(S+H);
edgeScalarField absWLEdge = fac::interpolate(absWL);
areaVectorField absWLGrad = fac::grad(absWLEdge);

throws:
Code:

/foam-extend-3.2/foam-extend-3.2/src/finiteArea/lnInclude/facGrad.C:58:47:
error: ‘const Mesh’ has no member named ‘Sf’
    return fac::edgeIntegrate(ssf.mesh().Sf() * ssf);

What I've found out:
- fac::grad(ssf) just calls fac::edgeIntegrate(ssf.mesh().Sf() * ssf)
(where ssf is an edgeMesh)
- ssf.mesh() returns acess to the polyMesh of the faMesh
- the polyMesh should have the member Sf() (returning the surface normal vectors)

Playing around, I tried for example
Code:

areaVectorField absWLGrad = fac::edgeIntegrate(absWLEdge.mesh().Le() * absWLEdge);
where .Le() is the corresponding member function of the faMesh returning the edge normal vectors.
This compiled but I got unphysical results...
And, first of all, I do think that the errors much more likely to be caused by me than by a bug ;)

I'm a little desperate right now and can't find that much documentation about the FAM... any help or comment would be appreciated!

Thank you very much!

Martin

martinK. January 17, 2018 09:34

Just in case anybody else stumbles across this:
In the end it worked fine for me when I just left out the middle-line:
Code:

areaScalarField absWL = g*(S+H);
areaVectorField absWLGrad = fac::grad(absWL);

seems like the fac::grad doesn't need an edgeMesh as input...

liuxiaojian2015 March 13, 2018 08:08

Quote:

Originally Posted by martinK. (Post 678462)
Just in case anybody else stumbles across this:
In the end it worked fine for me when I just left out the middle-line:
Code:

areaScalarField absWL = g*(S+H);
areaVectorField absWLGrad = fac::grad(absWL);

seems like the fac::grad doesn't need an edgeMesh as input...

Hi martink,

I found there is a problem related to fac::grad() in patch junction. Which I explained here: https://www.cfd-online.com/Forums/op...-2-famesh.html.

If you have understand how to use it or also in doubt, welcome you to discuss it. Thank you.


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