CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

Using mapFields if the mesh has different regions

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

Like Tree2Likes
  • 1 Post By stevenvanharen
  • 1 Post By stevenvanharen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 3, 2011, 06:31
Default Using mapFields if the mesh has different regions
  #1
Senior Member
 
Steven van Haren
Join Date: Aug 2010
Location: The Netherlands
Posts: 149
Rep Power: 15
stevenvanharen is on a distinguished road
Dear all,

I would like to use mapFields to map the velocity field form a simulation containing only one region to a simulation containing multiple regions. Is this possible? Does somebody know how to do it?

On of the regions in the targer folder is the same size as the region in the source folder.

Any help will be appreciated.

Kind regards,

Steven
stevenvanharen is offline   Reply With Quote

Old   February 3, 2011, 13:12
Default
  #2
Senior Member
 
Steven van Haren
Join Date: Aug 2010
Location: The Netherlands
Posts: 149
Rep Power: 15
stevenvanharen is on a distinguished road
Fixed it myself, turned out it was not to hard

If anyone needs it let me know.
stevenvanharen is offline   Reply With Quote

Old   March 3, 2011, 01:16
Default
  #3
New Member
 
Lauri Rintala
Join Date: Aug 2010
Posts: 2
Rep Power: 0
laurint is on a distinguished road
I would like to hear your solution. I'm mapping from mesh with two region onto a mesh with similar regions, but nothing seems to work.

Lauri
laurint is offline   Reply With Quote

Old   March 3, 2011, 04:03
Default
  #4
Senior Member
 
Steven van Haren
Join Date: Aug 2010
Location: The Netherlands
Posts: 149
Rep Power: 15
stevenvanharen is on a distinguished road
Just take a look at this source code.

I added the -region option to the utility and changed:

Code:
  fvMesh meshTarget
        (
            IOobject
            (
                fvMesh::defaultRegion,
                runTimeTarget.timeName(),
                runTimeTarget
            )
        );
into:

Code:
  fvMesh meshTarget
        (
            IOobject
            (
                            regionName,
                            runTimeTarget.timeName(),
                            runTimeTarget,
                            Foam::IOobject::MUST_READ
                            /*   
                fvMesh::defaultRegion,
                runTimeSource.timeName(),
                runTimeSource*/
            )
        );
However, this will only work for consistent meshes and serial cases.
Attached Files
File Type: zip mapRegionFields.zip (26.4 KB, 101 views)
samiam1000 likes this.
stevenvanharen is offline   Reply With Quote

Old   March 3, 2011, 04:53
Default
  #5
New Member
 
Lauri Rintala
Join Date: Aug 2010
Posts: 2
Rep Power: 0
laurint is on a distinguished road
Thank you for the quick reply. Your solution works perfectly.

I added the region-thing also for the source, although now they have to have same names.
laurint is offline   Reply With Quote

Old   October 29, 2013, 02:37
Default
  #6
Senior Member
 
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 18
samiam1000 is on a distinguished road
I know it's an old post, but I am having the same problems. I would like to map fields from a multiregion problem to the same multiregion one (I mean, same mesh and same regions' name and so on).

I tried to compile the archive you shared, but I get this error:

Code:
zampini@pc-zampini:~/OpenFOAM/zampini-2.2.0/applications/utilities/preProcessing/mapRegionFields$ wmake
SOURCE=mapLagrangian.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/meshTools/lnInclude -I/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude -I/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/finiteVolume/lnInclude -I/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/sampling/lnInclude -IlnInclude -I. -I/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude -I/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/mapLagrangian.o
In file included from /home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/Field.H:360:0,
                 from /home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/scalarField.H:38,
                 from /home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/dimensionSet.H:46,
                 from /home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/dimensionedType.H:40,
                 from /home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/dimensionedScalar.H:38,
                 from /home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/dimensionedTypes.H:31,
                 from /home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.H:43,
                 from MapLagrangianFields.H:37,
                 from mapLagrangian.C:26:
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/Field.C: In member function ‘void Foam::Field<Type>::operator=(const Foam::VectorSpace<Form, Cmpt, nCmpt>&)’:
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/Field.C:680:42: warning: typedef ‘VSType’ locally defined but not used [-Wunused-local-typedefs]
     typedef VectorSpace<Form,Cmpt,nCmpt> VSType;
                                          ^
mapLagrangian.C: In function ‘void Foam::mapLagrangian(const Foam::meshToMesh&)’:
mapLagrangian.C:173:29: error: no matching function for call to ‘Foam::passiveParticle::passiveParticle(Foam::Cloud<Foam::passiveParticle>&, const Foam::Vector<double>&, const int&)’
                             )
                             ^
mapLagrangian.C:173:29: note: candidates are:
In file included from mapLagrangian.C:28:0:
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/passiveParticle.H:98:9: note: Foam::passiveParticle::passiveParticle(const Foam::passiveParticle&)
         passiveParticle(const passiveParticle& p)
         ^
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/passiveParticle.H:98:9: note:   candidate expects 1 argument, 3 provided
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/passiveParticle.H:87:9: note: Foam::passiveParticle::passiveParticle(const Foam::polyMesh&, Foam::Istream&, bool)
         passiveParticle
         ^
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/passiveParticle.H:87:9: note:   no known conversion for argument 1 from ‘Foam::Cloud<Foam::passiveParticle>’ to ‘const Foam::polyMesh&’
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/passiveParticle.H:75:9: note: Foam::passiveParticle::passiveParticle(const Foam::polyMesh&, const vector&, Foam::label, bool)
         passiveParticle
         ^
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/passiveParticle.H:75:9: note:   no known conversion for argument 1 from ‘Foam::Cloud<Foam::passiveParticle>’ to ‘const Foam::polyMesh&’
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/passiveParticle.H:61:9: note: Foam::passiveParticle::passiveParticle(const Foam::polyMesh&, const vector&, Foam::label, Foam::label, Foam::label)
         passiveParticle
         ^
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/passiveParticle.H:61:9: note:   candidate expects 5 arguments, 3 provided
mapLagrangian.C:210:60: error: no matching function for call to ‘Foam::meshSearch::meshSearch(const Foam::fvMesh&, bool)’
                 meshSearch targetSearcher(meshTarget, false);
                                                            ^
mapLagrangian.C:210:60: note: candidates are:
In file included from mapLagrangian.C:29:0:
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/meshTools/lnInclude/meshSearch.H:180:9: note: Foam::meshSearch::meshSearch(const Foam::polyMesh&, const Foam::treeBoundBox&, Foam::polyMesh::cellRepresentation)
         meshSearch
         ^
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/meshTools/lnInclude/meshSearch.H:180:9: note:   no known conversion for argument 2 from ‘bool’ to ‘const Foam::treeBoundBox&’
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/meshTools/lnInclude/meshSearch.H:171:9: note: Foam::meshSearch::meshSearch(const Foam::polyMesh&, Foam::polyMesh::cellRepresentation)
         meshSearch
         ^
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/meshTools/lnInclude/meshSearch.H:171:9: note:   no known conversion for argument 2 from ‘bool’ to ‘Foam::polyMesh::cellRepresentation’
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/meshTools/lnInclude/meshSearch.H:149:9: note: Foam::meshSearch::meshSearch(const Foam::meshSearch&)
         meshSearch(const meshSearch&);
         ^
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/meshTools/lnInclude/meshSearch.H:149:9: note:   candidate expects 1 argument, 2 provided
mapLagrangian.C:242:58: error: no matching function for call to ‘Foam::IOPosition<Foam::passiveParticle>::IOPosition(Foam::Cloud<Foam::passiveParticle>&)’
                 IOPosition<passiveParticle>(targetParcels).write();
                                                          ^
mapLagrangian.C:242:58: note: candidates are:
In file included from /home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/IOPosition.H:96:0,
                 from /home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/CloudIO.C:28,
                 from /home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/Cloud.C:467,
                 from /home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/Cloud.H:342,
                 from mapLagrangian.C:27:
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/IOPosition.C:31:1: note: Foam::IOPosition<ParticleType>::IOPosition(const CloudType&) [with CloudType = Foam::passiveParticle]
 Foam::IOPosition<CloudType>::IOPosition(const CloudType& c)
 ^
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/IOPosition.C:31:1: note:   no known conversion for argument 1 from ‘Foam::Cloud<Foam::passiveParticle>’ to ‘const Foam::passiveParticle&’
In file included from /home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/CloudIO.C:28:0,
                 from /home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/Cloud.C:467,
                 from /home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/Cloud.H:342,
                 from mapLagrangian.C:27:
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/IOPosition.H:50:7: note: Foam::IOPosition<Foam::passiveParticle>::IOPosition(const Foam::IOPosition<Foam::passiveParticle>&)
 class IOPosition
       ^
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/IOPosition.H:50:7: note:   no known conversion for argument 1 from ‘Foam::Cloud<Foam::passiveParticle>’ to ‘const Foam::IOPosition<Foam::passiveParticle>&’
In file included from /home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/particle.H:562:0,
                 from /home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/passiveParticle.H:38,
                 from mapLagrangian.C:28:
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/particleTemplates.C: In instantiation of ‘Foam::scalar Foam::particle::trackToFace(const vector&, TrackData&) [with TrackData = double; Foam::scalar = double; Foam::vector = Foam::Vector<double>]’:
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/particleTemplates.C:193:54:   required from ‘Foam::label Foam::particle::track(const vector&, TrackData&) [with TrackData = double; Foam::label = int; Foam::vector = Foam::Vector<double>]’
mapLagrangian.C:178:77:   required from here
/home/zampini/OpenFOAM/OpenFOAM-2.2.0/src/lagrangian/basic/lnInclude/particleTemplates.C:207:43: error: ‘double’ is not a class, struct, or union type
     typedef typename TrackData::cloudType cloudType;
                                           ^
make: *** [Make/linux64GccDPOpt/mapLagrangian.o] Error 1
I am using OpenFOAM 2.2.1.

Any idea?

Thanks a lot,
Samuele
samiam1000 is offline   Reply With Quote

Old   November 5, 2013, 17:31
Default
  #7
Senior Member
 
Ahmed Khattab's Avatar
 
ahmed
Join Date: Feb 2010
Posts: 182
Blog Entries: 1
Rep Power: 16
Ahmed Khattab is on a distinguished road
Did you compiled this utility after modification.
Ahmed Khattab is offline   Reply With Quote

Old   November 7, 2013, 18:39
Default
  #8
Senior Member
 
Steven van Haren
Join Date: Aug 2010
Location: The Netherlands
Posts: 149
Rep Power: 15
stevenvanharen is on a distinguished road
I think the 2.2.2 release has the options sourceRegion and targetRegion as standard in the utility mapFields, so no need to do anything yourself!
samiam1000 likes this.
stevenvanharen is offline   Reply With Quote

Old   November 8, 2013, 03:00
Default
  #9
Senior Member
 
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 18
samiam1000 is on a distinguished road
That is what I did, finally.

Thanks a lot,

Samuele
samiam1000 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Issues with mapFields BlackBoatNavArch OpenFOAM Pre-Processing 38 May 28, 2021 16:29
[ICEM] Hexa mesh, curve mesh setup, bunching law Anorky ANSYS Meshing & Geometry 4 November 12, 2014 00:27
Solution technique/ Mesh type/ Cell limit/ Multi-zone regions in FLUENT zandi FLUENT 0 April 6, 2009 04:04
2d irregular grid Remy Main CFD Forum 1 December 22, 2008 04:49
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 11:55


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