CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Calculation on two meshes (http://www.cfd-online.com/Forums/openfoam-programming-development/107153-calculation-two-meshes.html)

dl6tud September 19, 2012 02:47

Calculation on two meshes
 
In my solver I have to do Biot-Savart, which are NumberOfCells² operations. That takes time. On the other hand, the mesh has to be fine enough for the simulation to be correct.

That is why I am thinking of calculating with two seperate meshes:

(1) fine mesh for Navier-Stokes Eqn

(2) a coarse mesh for Biot-Savart

Are there any examples / predefined functions for working with two meshes and for interpolation between them? Thanks a lot!!!

dl6tud September 19, 2012 06:53

I already solved the problem, following this explanation:
http://www.cfd-online.com/Forums/ope...time-step.html

Just in case someone has the same problem:
(1) you have to make 2 separate meshes
Quote:

Originally Posted by meshIT
# generiert 2 Netze
# die blockMeshDics als fineMesh und bMesh an gewohntem Ort

# zuerst das bMesh produzieren
./Allclean
cp -r org 0
cp constant/polyMesh/bMesh constant/polyMesh/blockMeshDict
blockMesh

mkdir constant/bMesh
mkdir constant/bMesh/polyMesh # jetzt in den Ordner 'bMesh' kopieren
cp constant/polyMesh/* constant/bMesh/polyMesh

# es folgt das fineMesh
cp constant/polyMesh/fineMesh constant/polyMesh/blockMeshDict
blockMesh

mkdir system/bMesh # fvSolution und fvSchemes braucht man für jedes Netz!!!
cp system/fvSolution system/bMesh/fvSolution
cp system/fvSchemes system/bMesh/fvSchemes

(2) load your new mesh
Quote:

Foam::fvMesh bMesh
(
Foam::IOobject
(
"bMesh",
runTime.timeName(),
runTime,
Foam::IOobject::MUST_READ
)
);
(3) define fields for both meshes, if necessary
Quote:

volVectorField j
(
IOobject
(
"j",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedVector("zero", dimensionSet(0,-2,0,0,0,1,0), vector::zero) //
);

volVectorField jGrob
(
IOobject
(
"jGrob",
runTime.timeName(),
bMesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
bMesh,
dimensionedVector("zero", dimensionSet(0,-2,0,0,0,1,0), vector::zero) //
);
(4) create an instance of meshToMesh
Quote:

meshToMesh fine2coarse(mesh, bMesh); // source, target
(5) map it
Quote:

fine2coarse.interpolate(jGrob, j); // target, source
(6) don't forget:

Quote:

#include "meshToMesh.H"
-I$(LIB_SRC)/sampling/meshToMeshInterpolation/meshToMesh (options/EXE_INC)
-lsampling (options/EXE_LIBS)

sebas September 24, 2012 02:56

Actually the blockMesh utility understands the "-region" option, so that you do not need to copy meshes from one directory to the other. Also decomposePar and e.g. funkySetfields know about the "-region" option.


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