CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

finite area method

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   October 14, 2011, 11:47
Default finite area method
  #1
Member
 
luca
Join Date: Feb 2011
Posts: 34
Rep Power: 6
lulo is on a distinguished road
Hi all.

I am trying to use the finite area method. I need to calculate the divergence of a boundary field q_b.

I am trying to initialize my areaVectorField without success:

Code:
  
    areaVectorField q_bed
    (
        IOobject
        (
            "q_bed",
            runTime.timeName(),
            faMesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        faMesh
    );
then (from what i understand) i would need an internal field which is an interpolation of my boundary field q_b:

Code:
     q_bed.internalField() = volSurfaceMapping.mapToSurface(q_b.boundaryField());
So I could finally obtain the divergence of q_bed:

Code:
   volScalarField dh_dt  =  fam::div ( q_bed.boundaryField() )
Can anyone help me writing these lines in the correct way? I know there are many errors

Thanks
lulo is offline   Reply With Quote

Old   October 17, 2011, 11:40
Default
  #2
Senior Member
 
kmooney's Avatar
 
Kyle Mooney
Join Date: Jul 2009
Location: Amherst, MA USA - San Diego, CA USA
Posts: 285
Rep Power: 9
kmooney is on a distinguished road
What kind of errors are being thrown? This would help get to the bottom of your issues.
kmooney is offline   Reply With Quote

Old   October 18, 2011, 06:10
Default
  #3
Member
 
luca
Join Date: Feb 2011
Posts: 34
Rep Power: 6
lulo is on a distinguished road
Ok.

I am trying to declare volSurfaceMupping:
Code:
volSurfaceMapping vsm(aMesh);
and got this error:
Code:
undefined reference to `Foam::faMesh::faMesh(Foam::polyMesh const&)'
lulo is offline   Reply With Quote

Old   October 18, 2011, 07:25
Default
  #4
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 8
Arnoldinho is on a distinguished road
It depends on where your error is located/comes from.

But it seems as if you are mixing aMesh and faMesh? Give it the same "name" everywhere. Also, did you include the necessary libraries in your options file (Make folder)?
Arnoldinho is offline   Reply With Quote

Old   October 18, 2011, 08:14
Default
  #5
Senior Member
 
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 8
kathrin_kissling is on a distinguished road
Hi Guys,

the problem starts with your initialization:
Code:
areaVectorField q_bed
    (
        IOobject
        (
            "q_bed",
            runTime.timeName(),
            faMesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        faMesh
    );
As Arnoldinho already pointed out, don't mix class names and the name of your variables.

Code:
areaVectorField q_bed
    (
        IOobject
        (
            "q_bed",
            runTime.timeName(),
            aMesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        aMesh
    );
This will still not work!
The second more important point is, that faMeshes are not directly connected to the objectRegistry, because in contrary to fvMesh it is not derived from polyMesh but from GeoMesh<polyMesh>. The first is derived from the objectRegistry the latter not. Because of that you need to use

Code:
areaVectorField q_bed
    (
        IOobject
        (
            "q_bed",
            runTime.timeName(),
            aMesh.thisDb(),
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        aMesh
    );
Hope this helps to get your initialization running.

Best

Kathrin

Last edited by kathrin_kissling; October 18, 2011 at 08:31.
kathrin_kissling is offline   Reply With Quote

Old   October 18, 2011, 08:27
Default
  #6
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 8
Arnoldinho is on a distinguished road
Thanks Kathrin,

Quote:
aMesh.thisDb
is new to me, but also gives an error:

Quote:
error: no matching function for call to ‘Foam::IOobject::IOobject(const char [6], Foam::word, <unresolved overloaded function type>, Foam::IOobject::readOption, Foam::IOobject::writeOption)’
Using

Code:
areaVectorField q_bed
    (
        IOobject
        (
            "q_bed",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        aMesh,
        dimensionedVector ("q_bed", dimensionSet(0, 2, -1, 0, 0, 0, 0), vector::zero)
    );
I have not had any problems (at least what I have seen so far). What do you think?

Arne
Arnoldinho is offline   Reply With Quote

Old   October 18, 2011, 08:30
Default
  #7
Senior Member
 
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 8
kathrin_kissling is on a distinguished road
Sorry,

a () was missing

aMesh.thisDB();

works for me! And now the data is registered where it belongs to: the faMesh. Otherwise you register it to the fvMesh, what is not wrong, but imagine you come to a point, where there is no fvMesh present. That what has happened to me.

Best

Kathrin

PS: I will edit the previous snippet
kathrin_kissling is offline   Reply With Quote

Old   October 18, 2011, 08:34
Default
  #8
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 8
Arnoldinho is on a distinguished road
Ok, it compiles. As I guess you already had some experience with faMeshes and the objectRegistry, could you tell me a bit more about differences of using "mesh" and "aMesh.thisDb()" in IOobject? This would be great.

Arne

Edit: Ok. In the meantime you already answered my question ;-) Thanks. That sounds reasonable.
Arnoldinho is offline   Reply With Quote

Old   October 18, 2011, 09:07
Default
  #9
Member
 
luca
Join Date: Feb 2011
Posts: 34
Rep Power: 6
lulo is on a distinguished road
Which are the library needed for this?

I added:
Code:
#include "faCFD.H"  
#include "createFaMesh.H"
and still got the same error.
lulo is offline   Reply With Quote

Old   October 18, 2011, 09:25
Default
  #10
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,619
Rep Power: 25
ngj will become famous soon enoughngj will become famous soon enough
You would also need:

Code:
#include "faMesh.H"
Kind regards,

Niels
ngj is offline   Reply With Quote

Old   October 18, 2011, 10:36
Default
  #11
Member
 
luca
Join Date: Feb 2011
Posts: 34
Rep Power: 6
lulo is on a distinguished road
Thanks

I added that one as well. still, I can see that the error appear when I introduce
Code:
#include "createFaMesh.H"
the error is :
Code:
 pimpleMyDyMFoam.C:(.text+0x5346): undefined reference to `Foam::faMesh::faMesh(Foam::polyMesh const&)'
lulo is offline   Reply With Quote

Old   October 18, 2011, 10:46
Default
  #12
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,619
Rep Power: 25
ngj will become famous soon enoughngj will become famous soon enough
Have you remembered to add the necessary lines in Make/options for you to work with FAM?
ngj is offline   Reply With Quote

Old   October 18, 2011, 11:53
Default
  #13
Senior Member
 
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 8
kathrin_kissling is on a distinguished road
Hi Nils,

i think the latter is more important, since the faMesh.H is already introduced by faCFD.H

@lulo
By the way is this your first error in the line?
kathrin_kissling is offline   Reply With Quote

Old   October 19, 2011, 06:46
Default
  #14
Member
 
luca
Join Date: Feb 2011
Posts: 34
Rep Power: 6
lulo is on a distinguished road
Thanks to all of you!

I have compiled it correctly.
Now I have solved the exner equation:
Code:
   areaVectorField q_bed
    (
        IOobject
        (
            "q_bed",
            runTime.timeName(),
            aMesh.thisDb(),
            IOobject::READ_IF_PRESENT,
            IOobject::NO_WRITE
        ),
        aMesh,
        dimensionedVector ("q_bed", dimensionSet(0, 2, -1, 0, 0, 0, 0), vector::zero)
    ); 

volSurfaceMapping vsm(aMesh);
q_bed.internalField() = vsm.mapToSurface(q_b_slide.boundaryField());

areaScalarField dh_dt = - fac::div(q_bed) * 1.0/ (1-n);
now I need to interpolate the areaScalarField to obtain a tetPointVectorField for the MotionU file.

I could see that there are some interpolation method in src/finiteArea/interpolation.
I think I should use edgeInterpolation and I tried:
Code:
edgeInterpolation interpolateE(aMesh);
pointScalarField dh_dt_points_1 = interpolateE.edgeInterpolation(dh_dt); // This is of course wrong
Do you know how to correct this?
lulo is offline   Reply With Quote

Old   October 15, 2014, 10:41
Default
  #15
Member
 
Fei Fan
Join Date: Jun 2013
Location: NanJing, China
Posts: 44
Rep Power: 4
Fanfei is on a distinguished road
Quote:
Originally Posted by ngj View Post
You would also need:

Code:
#include "faMesh.H"
Kind regards,

Niels
Hi Niels:
I want to use FAM to solve Exner equation. my of version is foam-extend-3.1. Before the FAM used, everything is ok. However, as the q_bed of volMesh mapping to areaMesh and faCFD.H creatfamesh.H famesh.H are introduce, some errors occured, as below:

Code:
In file included from /home/administrator/foam/foam-extend-3.1/src/foam/lnInclude/MeshObject.H:39:0,
                 from /home/administrator/foam/foam-extend-3.1/src/finiteArea/lnInclude/faMesh.H:40,
                 from /home/administrator/foam/foam-extend-3.1/src/finiteArea/lnInclude/faCFD.H:7,
                 from pimpFoam.C:49:
/home/administrator/foam/foam-extend-3.1/src/foam/lnInclude/meshObjectBase.H: In function ‘int main(int, char**)’:
/home/administrator/foam/foam-extend-3.1/src/foam/lnInclude/meshObjectBase.H:45:1: error: ‘namespace’ definition is not allowed here
 namespace Foam
 ^
In file included from /home/administrator/foam/foam-extend-3.1/src/finiteArea/lnInclude/faMesh.H:40:0,
                 from /home/administrator/foam/foam-extend-3.1/src/finiteArea/lnInclude/faCFD.H:7,
                 from pimpFoam.C:49:
/home/administrator/foam/foam-extend-3.1/src/foam/lnInclude/MeshObject.H:44:1: error: ‘namespace’ definition is not allowed here
 namespace Foam
 ^
In file included from /home/administrator/foam/foam-extend-3.1/src/foam/lnInclude/MeshObject.H:139:0,
                 from /home/administrator/foam/foam-extend-3.1/src/finiteArea/lnInclude/faMesh.H:40,
                 from /home/administrator/foam/foam-extend-3.1/src/finiteArea/lnInclude/faCFD.H:7,
                 from pimpFoam.C:49:
/home/administrator/foam/foam-extend-3.1/src/foam/lnInclude/MeshObject.C:31:1: error: a template declaration cannot appear at block scope
 template<class Mesh, class Type>
 ^
/home/administrator/foam/foam-extend-3.1/src/foam/lnInclude/MeshObject.C:55:1: error: expected ‘;’ before ‘template’
 template<class Mesh, class Type>
 ^
In file included from pimpFoam.C:48:0:
/home/administrator/foam/foam-extend-3.1/src/finiteVolume/lnInclude/initContinuityErrs.H:37:8: warning: unused variable ‘sumLocalContErr’ [-Wunused-variable]
 scalar sumLocalContErr = 0;
        ^
/home/administrator/foam/foam-extend-3.1/src/finiteVolume/lnInclude/initContinuityErrs.H:38:8: warning: unused variable ‘globalContErr’ [-Wunused-variable]
 scalar globalContErr = 0;
        ^
/home/administrator/foam/foam-extend-3.1/src/finiteVolume/lnInclude/initContinuityErrs.H:39:8: warning: unused variable ‘cumulativeContErr’ [-Wunused-variable]
 scalar cumulativeContErr = 0;
        ^
pimpFoam.C:292:1: error: expected ‘}’ at end of input
 }
 ^
make: *** [Make/linux64GccDPOpt/pimpFoam.o] 错误 1
could you give me some hints, what's wrong with it.
the options file is
Code:
 EXE_INC = \
    -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
    -I$(LIB_SRC)/transportModels \
    -I$(LIB_SRC)/turbulenceModels \
    -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \
    -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
    -I$(LIB_SRC)/finiteVolume/lnInclude\
    -I$(LIB_SRC)/finiteArea/lnInclude\
    -I$(LIB_SRC)/sampling/lnInclude

EXE_LIBS = \
    -lincompressibleTransportModels \
    -lincompressibleTurbulenceModel \
    -lincompressibleRASModels \
    -lincompressibleLESModels \
    -lfiniteVolume \
    -lfiniteArea \
    -lmeshTools \
    -llduSolvers
Best regards

Fan Fei

Last edited by wyldckat; October 18, 2014 at 17:13. Reason: Added [CODE][/CODE]
Fanfei is offline   Reply With Quote

Old   October 15, 2014, 10:57
Default
  #16
Member
 
Fei Fan
Join Date: Jun 2013
Location: NanJing, China
Posts: 44
Rep Power: 4
Fanfei is on a distinguished road
Hi everyone:
This problem have solved. The # include "faCFD.H" sholud be as a global variable, add it before the main program.

Best regards
Fan Fei
Fanfei is offline   Reply With Quote

Old   December 8, 2014, 05:36
Default
  #17
Member
 
Fei Fan
Join Date: Jun 2013
Location: NanJing, China
Posts: 44
Rep Power: 4
Fanfei is on a distinguished road
Quote:
Originally Posted by ngj View Post
Have you remembered to add the necessary lines in Make/options for you to work with FAM?
Hi ngi:
I have a question about the faMesh and dynamicMesh. in openfoam extend 3.1. there are two solvers use famesh and dynamicMesh. The location is tutorials/surfaceTracking/interTrackFoam and bubbleInlerTrackFoam. as below picture. however the code of interTrackFoam is:
-----------------------------------
Quote:
#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "freeSurface.H"


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
# include "setRootCase.H"

# include "createTime.H"

# include "createDynamicFvMesh.H"

# include "createFields.H"

# include "initContinuityErrs.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Info << "\nStarting time loop\n" << endl;
my question is why the code don't have "faCFD.H" and "createfaMesh.H" .

Best regards
Fan fei
Attached Images
File Type: jpg ???.jpg (44.0 KB, 12 views)
Fanfei is offline   Reply With Quote

Reply

Tags
finite area method

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can be calculate a surface integral in the finite element method? HectorRedal Main CFD Forum 3 March 13, 2015 09:25
Lattice Boltzmann method vs Finite Element Method and Finite Volume Method solemnpriest Main CFD Forum 3 August 12, 2013 11:00
floating point exception Finite area DiegoNaval OpenFOAM 1 November 10, 2011 14:45
formulation of finite element&finite volume method ravindra FLUENT 0 June 27, 2007 12:04
tidal flow simulation using finite volume method Jason Qiu Main CFD Forum 0 October 20, 2002 02:34


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