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

How to create a new mapFields functionObjects?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 17, 2023, 06:57
Default How to create a new mapFields functionObjects?
  #1
Senior Member
 
TWB
Join Date: Mar 2009
Posts: 401
Rep Power: 19
quarkz is on a distinguished road
Hi,

I need to modify mapFields to create a custom mapper as mentioned here:
Why are pointVectorFields not mapped using mapFields?

I start off by just making a clone of mapFields, called mapFields_dynamicMesh to make sure that's it's working.

I tried to follow the tutorial by Prof Nilsson, just changing the names to work on mapFields:
https://www.tfd.chalmers.se/~hani/ku...tionObject.pdf

The steps are:

cp -r --parents src/functionObjects/field/mapFields $WM_PROJECT_USER_DIR
cd $WM_PROJECT_USER_DIR/src/functionObjects/field
mv mapFields mapFields_dynamicMesh
cd mapFields_dynamicMesh
sed -i 's/mapFields/mapFields_dynamicMesh/g' *
rename 's/mapFields/mapFields_dynamicMesh/' *

Make/files:

Code:
mapFields_dynamicMesh/mapFields_dynamicMesh.C

LIB = $(FOAM_USER_LIBBIN)/libmyFieldFunctionObjects
Make/options:

Code:
EXE_INC = \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/finiteArea/lnInclude \
    -I$(LIB_SRC)/fileFormats/lnInclude \
    -I$(LIB_SRC)/surfMesh/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude \
    -I$(LIB_SRC)/dynamicMesh/lnInclude \
    -I$(LIB_SRC)/sampling/lnInclude \
    -I$(LIB_SRC)/lagrangian/basic/lnInclude \
    -I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
    -I$(LIB_SRC)/transportModels \
    -I$(LIB_SRC)/transportModels/compressible/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/schemes/lnInclude \
    -I$(LIB_SRC)/transportModels/compressible/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
    -I$(LIB_SRC)/fvAgglomerationMethods/pairPatchAgglomeration/lnInclude \
    -I$(LIB_SRC)/phaseSystemModels/multiphaseInter/phasesSystem/lnInclude \
    -I$(LIB_SRC)/phaseSystemModels/reactingEuler/multiphaseSystem/lnInclude \
    -I$(LIB_SRC)/functionObjects/field/lnInclude

LIB_LIBS = \
    -lfiniteVolume \
    -lfiniteArea \
    -lfileFormats \
    -lsurfMesh \
    -lmeshTools \
    -ldynamicMesh \
    -lsampling \
    -llagrangian \
    -ldistributionModels \
    -lfluidThermophysicalModels \
    -lsolidThermo \
    -lincompressibleTransportModels \
    -lturbulenceModels \
    -lcompressibleTransportModels \
    -lincompressibleTurbulenceModels \
    -lcompressibleTurbulenceModels \
    -lturbulenceModelSchemes \
    -lchemistryModel \
    -lreactionThermophysicalModels \
    -lpairPatchAgglomeration \
    -lincompressibleMultiphaseSystems \
    -lreactingMultiphaseSystem \
    -lfieldFunctionObjects
It compiled w/o error but it seems to compile to a libmyFieldFunctionObjects library instead of an application like mapFields

So what should I change to make it work?

I think I have to do something like:

EXE = $(FOAM_USER_APPBIN)/mapFields_dynamicMesh

but I'm not sure how.

Can someone help?

Thanks!
quarkz is offline   Reply With Quote

Old   June 17, 2023, 15:20
Default
  #2
Member
 
Hosein
Join Date: Nov 2011
Location: Germany
Posts: 93
Rep Power: 14
einstein_zee is on a distinguished road
Hi there,

I didn't get completely what you want to achieve. And it seems the things you discussed are different from each other. mapFields function object refers to "Maps input fields from local mesh to secondary mesh at runtime." (@https://develop.openfoam.com/Development/openfoam/-/blob/OpenFOAM-v2212/src/functionObjects/field/mapFields/mapFields.H) and mapFields as a standalone application is a preProcessing tool which is described as "Maps volume fields from one mesh to another, reading and interpolating all fields present in the time directory of both cases" (@https://develop.openfoam.com/Development/openfoam/-/blob/OpenFOAM-v2212/applications/utilities/preProcessing/mapFields/mapFields.C). So depending on which one you need for your case you need to modify the corresponding one. If you need the function object one, you should use it like every other function object. Just as an example refer to OpenFOAM-v2212/tutorials/incompressible/pimpleFoam/laminar/cylinder2D.
einstein_zee is offline   Reply With Quote

Reply


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
mapFields major bug alchem OpenFOAM Bugs 14 September 15, 2023 12:48
Foam::error::PrintStack almir OpenFOAM Running, Solving & CFD 91 December 21, 2022 04:50
running mapFields in parallel mkhm OpenFOAM Pre-Processing 10 September 16, 2021 13:12
mapFields & mapFieldsPar decompose cases otaolafr OpenFOAM Pre-Processing 2 August 26, 2021 13:13
create the file *.foam phongstar OpenFOAM 12 October 14, 2018 18:06


All times are GMT -4. The time now is 23:43.