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/)
-   -   Map fields every time step (http://www.cfd-online.com/Forums/openfoam-programming-development/106359-map-fields-every-time-step.html)

sebas August 27, 2012 04:58

Map fields every time step
 
Dear all,

I would like to solve different equations on different domains. The equations couple through their RHSs wherever the domains overlap. I therefore need to interpolate/map fields from one domain to the other at every time step.

For a single CPU this is quite easy to implement:

Code:

#include meshToMesh.H
meshToMesh mapper(meshSource, meshTarget, patchMap, cuttingPatches);
mapper.interpolate(fieldTarget, fieldSource);

However, when this is to be run in parallel things start to get tricky. The way in which the mapFields utility does it is not really efficient as it creates copies of meshes and fields, and spends most of its time reading/writing IOobjects.

So I create a list of pointers to my meshes/fields:

Code:

List< fvMesh* > sourceMeshes(Pstream::nProcs());
sourceMeshes[Pstream::myProcNo()] = &meshSource;

I then try to gather data from all processors and perform the interpolation on the master processor:

Code:

Pstream::gatherList(sourceMeshes);
And this is where I get the following error message:

Code:

/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/gatherScatterList.C: In static member function ‘static void Foam::Pstream::gatherList(const Foam::List<Foam::UPstream::commsStruct>&, Foam::List<T>&, int) [with T = Foam::fvMesh*]’:
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/gatherScatterList.C:187:9:  instantiated from ‘static void Foam::Pstream::gatherList(Foam::List<T>&, int) [with T = Foam::fvMesh*]’
myLaplacianFoam.C:58:37:  instantiated from here
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/gatherScatterList.C:101:17: error: no match for ‘operator>>’ in ‘fromBelow >> ((Foam::List<Foam::fvMesh*>*)Values)->Foam::List<Foam::fvMesh*>::<anonymous>.Foam::UList<T>::operator[] [with T = Foam::fvMesh*, Foam::label = int](belowID)’
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/scalarRange.H:135:25: note: candidates are: Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::scalarRange&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/septernion.H:146:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::septernion&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/quaternion.H:174:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::quaternion&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/vectorTensorTransform.H:167:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::vectorTensorTransform&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/wordRe.H:231:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::wordRe&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/boundBox.H:230:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::boundBox&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/nil.H:77:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::nil&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/cellShape.H:162:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::cellShape&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/faceI.H:151:23: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::face&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/SHA1Digest.H:137:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::SHA1Digest&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/instant.H:145:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::instant&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/Switch.H:207:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::Switch&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/dimensionSet.H:302:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::dimensionSet&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/dictionary.H:507:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::dictionary&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/long.H:56:10: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, long int&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/Istream.H:170:17: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::IOstream& (*)(Foam::IOstream&))
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/Istream.H:164:17: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::Istream& (*)(Foam::Istream&))
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/token.H:421:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::token&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/fileName.H:188:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::fileName&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/Scalar.H:306:10: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::doubleScalar&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/Scalar.H:306:10: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::floatScalar&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/uint.H:56:10: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, unsigned int&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/bool.H:48:10: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, bool&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/int.H:57:10: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, int&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/word.H:133:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::word&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/string.H:219:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::string&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/char.H:49:10: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, char&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/gatherScatterList.C:114:21: error: no match for ‘operator>>’ in ‘fromBelow >> ((Foam::List<Foam::fvMesh*>*)Values)->Foam::List<Foam::fvMesh*>::<anonymous>.Foam::UList<T>::operator[] [with T = Foam::fvMesh*, Foam::label = int](leafID)’
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/scalarRange.H:135:25: note: candidates are: Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::scalarRange&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/septernion.H:146:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::septernion&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/quaternion.H:174:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::quaternion&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/vectorTensorTransform.H:167:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::vectorTensorTransform&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/wordRe.H:231:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::wordRe&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/boundBox.H:230:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::boundBox&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/nil.H:77:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::nil&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/cellShape.H:162:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::cellShape&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/faceI.H:151:23: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::face&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/SHA1Digest.H:137:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::SHA1Digest&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/instant.H:145:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::instant&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/Switch.H:207:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::Switch&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/dimensionSet.H:302:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::dimensionSet&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/dictionary.H:507:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::dictionary&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/long.H:56:10: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, long int&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/Istream.H:170:17: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::IOstream& (*)(Foam::IOstream&))
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/Istream.H:164:17: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::Istream& (*)(Foam::Istream&))
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/token.H:421:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::token&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/fileName.H:188:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::fileName&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/Scalar.H:306:10: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::doubleScalar&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/Scalar.H:306:10: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::floatScalar&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/uint.H:56:10: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, unsigned int&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/bool.H:48:10: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, bool&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/int.H:57:10: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, int&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/word.H:133:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::word&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/string.H:219:25: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::string&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/char.H:49:10: note:                Foam::Istream& Foam::operator>>(Foam::Istream&, char&)

Does anybody know how to fix this? I would really appreciate your help.

Sebastian

Arnoldinho August 27, 2012 05:36

Hi,

could you give the line(s) of code where the error occurs, i.e somewhere around myLaplacianFoam.C:58:37?

sebas August 27, 2012 05:43

Dear Arnoldinho,

it is exactly the call to
Code:

Pstream::gatherList(sourceMeshes);

Arnoldinho August 27, 2012 05:55

Hmm, then I have no clue. Have you tried it with a "standard" list first instead of pointers, like given in http://www.cfd-online.com/Forums/openfoam/77465-combining-lists-distributed-amongst-processors.html?

Arne

sebas August 27, 2012 06:19

If I use
Code:

List<fvMesh> sourceMeshes(Pstream::nProcs());
and
Code:

sourceMeshes[Pstream:myProcNo()] = sourceMesh;
instead of pointers, I get an error when trying to populate the list (not when gathering as before):
Code:

/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvMesh.H: In function ‘int main(int, char**)’:
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvMesh.H:160:14: error: ‘void Foam::fvMesh::operator=(const Foam::fvMesh&)’ is private
myLaplacianFoam.C:58:41: error: within this context
In file included from /nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/List.H:259:0,
                from /nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/labelList.H:48,
                from /nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/UPstream.H:43,
                from /nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/Pstream.H:42,
                from /nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/parRun.H:35,
                from /nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvCFD.H:4,
                from myLaplacianFoam.C:32:
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/List.C: In constructor ‘Foam::List<T>::List(Foam::label) [with T = Foam::fvMesh, Foam::label = int]’:
myLaplacianFoam.C:57:48:  instantiated from here
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/List.C:56:9: error: no matching function for call to ‘Foam::fvMesh::fvMesh()’
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvMesh.H:194:9: note: candidates are: Foam::fvMesh::fvMesh(const Foam::IOobject&, const Foam::Xfer<Foam::Field<Foam::Vector<double> > >&, const Foam::Xfer<Foam::List<Foam::face> >&, const Foam::Xfer<Foam::List<Foam::cell> >&, bool)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvMesh.H:182:9: note:                Foam::fvMesh::fvMesh(const Foam::IOobject&, const Foam::Xfer<Foam::Field<Foam::Vector<double> > >&, const Foam::Xfer<Foam::List<Foam::face> >&, const Foam::Xfer<Foam::List<int> >&, const Foam::Xfer<Foam::List<int> >&, bool)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvMesh.H:178:18: note:                Foam::fvMesh::fvMesh(const Foam::IOobject&)
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvMesh.H:157:9: note:                Foam::fvMesh::fvMesh(const Foam::fvMesh&)
In file included from /nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/Pstream.H:309:0,
                from /nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/parRun.H:35,
                from /nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvCFD.H:4,
                from myLaplacianFoam.C:32:
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvMesh.H: In static member function ‘static void Foam::Pstream::gatherList(const Foam::List<Foam::UPstream::commsStruct>&, Foam::List<T>&, int) [with T = Foam::fvMesh]’:
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/gatherScatterList.C:187:9:  instantiated from ‘static void Foam::Pstream::gatherList(Foam::List<T>&, int) [with T = Foam::fvMesh]’
myLaplacianFoam.C:59:37:  instantiated from here
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvMesh.H:160:14: error: ‘void Foam::fvMesh::operator=(const Foam::fvMesh&)’ is private
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/gatherScatterList.C:91:17: error: within this context
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvMesh.H:160:14: error: ‘void Foam::fvMesh::operator=(const Foam::fvMesh&)’ is private
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/gatherScatterList.C:95:21: error: within this context
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/gatherScatterList.C:101:17: error: ‘Foam::dictionary’ is an ambiguous base of ‘Foam::fvMesh’
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/gatherScatterList.C:105:21: error: ‘Foam::dictionary’ is an ambiguous base of ‘Foam::fvMesh’
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/gatherScatterList.C:114:21: error: ‘Foam::dictionary’ is an ambiguous base of ‘Foam::fvMesh’
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/gatherScatterList.C:118:25: error: ‘Foam::dictionary’ is an ambiguous base of ‘Foam::fvMesh’
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/gatherScatterList.C:135:17: error: ‘Foam::dictionary’ is an ambiguous base of ‘Foam::fvMesh’
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvMesh.H:160:14: error: ‘void Foam::fvMesh::operator=(const Foam::fvMesh&)’ is private
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/gatherScatterList.C:143:17: error: within this context
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvMesh.H:160:14: error: ‘void Foam::fvMesh::operator=(const Foam::fvMesh&)’ is private
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/gatherScatterList.C:147:21: error: within this context
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/gatherScatterList.C:162:17: error: ‘Foam::dictionary’ is an ambiguous base of ‘Foam::fvMesh’
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/gatherScatterList.C:170:25: error: ‘Foam::dictionary’ is an ambiguous base of ‘Foam::fvMesh’
/nfs/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/gatherScatterList.C:174:21: error: ‘Foam::dictionary’ is an ambiguous base of ‘Foam::fvMesh’


Arnoldinho August 27, 2012 06:47

Where and how did you define your "sourceMesh"?
Further, you have an error in "sourceMeshes[Pstream:myProcNo()] = sourceMesh;" as you are missing a ":" in Pstream::myProcNo().

But the problem is your "void Foam::fvMesh::operator=(const Foam::fvMesh&)’ is private" error.

With my hint of using a normal scalar list, I meant just a scalar list with fictitious values, in order to check whether you overall implementation is right or if there is a problem with sharing meshes. As a second step, I would try to populate your real mesh values.

Arne

sebas August 27, 2012 07:20

Sorry, sourceMeshes[Pstream:myProcNo()] is just a typo in the posting. It is correct in the code.

The meshes are different regions registered at the same runTime object. E.g.
Code:

FOAM::fvMesh meshSource
(
    Foam::IOobject
    (
        "regionSource",
        runTime.timeName(),
        runTime,
        Foam::IOobject::MUST_READ
    )
);

The fields are "living"on the respective meshes, e.g.
Code:

volScalarField TSource
(
    IOobject
    (
        "T",
        runTime.timeName(),
        meshSource,
        IOobject::MUST_READ,
        IOobject::AUTO_WRITE,
    ),
    meshSource
);

By the way, without the mapping the case runs perfectly also in parallel.

sebas August 27, 2012 09:02

It works with an integer list where I store e.g. the processor IDs.

Arnoldinho August 27, 2012 09:16

Hmm. Then I can only guess or presume that the gather function has been written for particular types only - and that your mesh structure there is not supported. But this is just a guess...

Arne

sebas September 3, 2012 04:34

Apparently fvMesh (and hence the fields that live on the mesh) lack the constructor from IStream and the OStream << operator.

Any idea how to sove this without reimplementing the fvMesh class?

sebas September 12, 2012 10:32

OK. I have an idea for a not-so-quick but dirty work-around.
If I use manual decomposition and make sure that the bits of the two meshes on each processor overlap, I side-step the whole problem of inter-processor communication.

However, this requires some compromise regarding mesh quality and decomposition optimality.

Let's see how this works...

sebas September 24, 2012 03:01

It works. And with the use of funkySetfields (and a small script) the pre-processing is not too tedious either.

However, I want to perform a volume averaging when mapping from the fine grid to the coarse one. Therefore, I need to write my on meshToMesh anyway. From what I've seen from the code it looks like it can be easiliy parallellized by means of reduce options. I have no idea how fast or slow this will be due to the additional inter-processor communication...

mm.abdollahzadeh October 26, 2012 18:31

Dear All

I want to use the command below

Code:

 
    meshToMesh  meshToMeshInterpb(newMesh, mesh);
  const fvMesh& meshSource = meshToMeshInterpb.fromMesh();
    const fvMesh& meshTarget = meshToMeshInterpb.toMesh();
  meshToMeshInterp.interpolate(p,pn,meshToMesh::INTERPOLATE);
  meshToMeshInterp.interpolate(U,Un,meshToMesh::INTERPOLATE);

I have to meshs , mesh and newMesh which are the same size at the beginning ....In each iteration solution is done by the fields defined on mesh. t then meshNew will be refined according to Errorfield. then I want to map the results of fields on mesh to corrosponding fields on newMesh. then mesh will be refined to be similar to meshnew and then I want to map the newMesh on mesh.
I have both volscalar and volvector and surfacescalar.

but when I am trying to run my case even on the first iteration.

Quote:

the argument field does not correspond to the right mesh. Field size: 400 mesh size: 1600

From function meshToMesh::interpolateInternalField(Field<Type>& toF, const GeometricField<Type, fvPatchField, volMesh>& fromVf, meshToMesh::order ord) const
in file /home/mahdi/OpenFOAM/OpenFOAM-1.7.1/src/sampling/lnInclude/meshToMeshInterpolate.C at line 147.
I will be thankful for help

best
mahdi

sebas October 27, 2012 09:48

Dear Mahdi,

is p defined on mesh and pn on newMesh, respectively?

The order of source and target field in the interpolate function is different from the order of source and target mesh in the constructor... which is somewhat counter intuitive.

mm.abdollahzadeh October 27, 2012 11:23

Dear sebas
Thanks for your reply.
Yes p and pn are defined on the mesh and meshnew receptively. and I have checked the order of source and target.
But its giving the same error.

Best
Mahdi

mm.abdollahzadeh November 2, 2012 08:08

Quote:

Originally Posted by sebas (Post 388826)
Dear Mahdi,

is p defined on mesh and pn on newMesh, respectively?

The order of source and target field in the interpolate function is different from the order of source and target mesh in the constructor... which is somewhat counter intuitive.

Dear Sebas

I have solved that problem ... but no data in maped FROM my first mesh to meshNew!!!!.

best
mahdi

ganeshv December 5, 2012 14:13

Hey Sebas,

Did you manage to figure this out? I need a similar capability now. Essentially it all seems to boil down to creating a parallel implementation of the mapFields utility.

ganesh

ganeshv December 5, 2012 14:13

Hey Sebas,

Did you manage to figure this out? I need a similar capability now. Essentially it all seems to boil down to creating a parallel implementation of the mapFields utility.

ganesh


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