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

Compilation problems adapting setFields for multiregionsolver

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

Like Tree3Likes
  • 2 Post By olesen
  • 1 Post By olesen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 13, 2022, 02:12
Default Compilation problems adapting setFields for multiregionsolver
  #1
Member
 
Michael Jensen
Join Date: May 2022
Posts: 34
Rep Power: 4
mikethe1wheelnut is on a distinguished road
Following forum rules, new thread for slightly different problem.


I've been trying to implement the solution proposed here: how to use setFields in multiregionsolver. As can be seen from my post here: how to use setFields in multiregionsolver, it didn't work. I've finally did what I said I would do, reversed what I did (the instructions) and did it instead for the other directory. It seems like this was the correct thing to do, because wmake worked this time. yay! ..however, it found a whole bunch of problems:


Code:
eriadar@eriadar-Latitude-E7440:~/OpenFOAM/eriadar-9/applications/utilities/preProcessing/mysetFields$ wmake
Making dependency list for source file mysetFields.C
g++ -std=c++14 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam9/src/finiteVolume/lnInclude -I/opt/openfoam9/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam9/src/OpenFOAM/lnInclude -I/opt/openfoam9/src/OSspecific/POSIX/lnInclude   -fPIC -c mysetFields.C -o Make/linux64GccDPInt32Opt/mysetFields.o
In file included from mysetFields.C:37:
/opt/openfoam9/src/OpenFOAM/lnInclude/addRegionOption.H:2:1: error: expected constructor, destructor, or type conversion before ‘(’ token
    2 | (
      | ^
mysetFields.C: In function ‘int main(int, char**)’:
mysetFields.C:399:62: error: no matching function for call to ‘setCellField::iNew::iNew(Foam::polyMesh&, Foam::labelList)’
  399 |             setCellField::iNew(mesh, labelList(mesh.nCells()))
      |                                                              ^
mysetFields.C:152:9: note: candidate: ‘setCellField::iNew::iNew(const Foam::fvMesh&, const labelList&)’
  152 |         iNew(const fvMesh& mesh, const labelList& selectedCells)
      |         ^~~~
mysetFields.C:152:28: note:   no known conversion for argument 1 from ‘Foam::polyMesh’ to ‘const Foam::fvMesh&’
  152 |         iNew(const fvMesh& mesh, const labelList& selectedCells)
      |              ~~~~~~~~~~~~~~^~~~
mysetFields.C:145:11: note: candidate: ‘constexpr setCellField::iNew::iNew(const setCellField::iNew&)’
  145 |     class iNew
      |           ^~~~
mysetFields.C:145:11: note:   candidate expects 1 argument, 2 provided
mysetFields.C:145:11: note: candidate: ‘constexpr setCellField::iNew::iNew(setCellField::iNew&&)’
mysetFields.C:145:11: note:   candidate expects 1 argument, 2 provided
mysetFields.C:433:63: error: no matching function for call to ‘setCellField::iNew::iNew(Foam::polyMesh&, Foam::List<int>)’
  433 |                 setCellField::iNew(mesh, selectedCellSet.toc())
      |                                                               ^
mysetFields.C:152:9: note: candidate: ‘setCellField::iNew::iNew(const Foam::fvMesh&, const labelList&)’
  152 |         iNew(const fvMesh& mesh, const labelList& selectedCells)
      |         ^~~~
mysetFields.C:152:28: note:   no known conversion for argument 1 from ‘Foam::polyMesh’ to ‘const Foam::fvMesh&’
  152 |         iNew(const fvMesh& mesh, const labelList& selectedCells)
      |              ~~~~~~~~~~~~~~^~~~
mysetFields.C:145:11: note: candidate: ‘constexpr setCellField::iNew::iNew(const setCellField::iNew&)’
  145 |     class iNew
      |           ^~~~
mysetFields.C:145:11: note:   candidate expects 1 argument, 2 provided
mysetFields.C:145:11: note: candidate: ‘constexpr setCellField::iNew::iNew(setCellField::iNew&&)’
mysetFields.C:145:11: note:   candidate expects 1 argument, 2 provided
mysetFields.C:454:63: error: no matching function for call to ‘setFaceField::iNew::iNew(Foam::polyMesh&, Foam::List<int>)’
  454 |                 setFaceField::iNew(mesh, selectedFaceSet.toc())
      |                                                               ^
mysetFields.C:343:9: note: candidate: ‘setFaceField::iNew::iNew(const Foam::fvMesh&, const labelList&)’
  343 |         iNew(const fvMesh& mesh, const labelList& selectedFaces)
      |         ^~~~
mysetFields.C:343:28: note:   no known conversion for argument 1 from ‘Foam::polyMesh’ to ‘const Foam::fvMesh&’
  343 |         iNew(const fvMesh& mesh, const labelList& selectedFaces)
      |              ~~~~~~~~~~~~~~^~~~
mysetFields.C:336:11: note: candidate: ‘constexpr setFaceField::iNew::iNew(const setFaceField::iNew&)’
  336 |     class iNew
      |           ^~~~
mysetFields.C:336:11: note:   candidate expects 1 argument, 2 provided
mysetFields.C:336:11: note: candidate: ‘constexpr setFaceField::iNew::iNew(setFaceField::iNew&&)’
mysetFields.C:336:11: note:   candidate expects 1 argument, 2 provided
make: *** [/opt/openfoam9/wmake/rules/General/transform:26: Make/linux64GccDPInt32Opt/mysetFields.o] Error 1
eriadar@eriadar-Latitude-E7440:~/OpenFOAM/eriadar-9/applications/utilities/preProcessing/mysetFields$
I consider this evidence that I'm actively trying to figure out how to get this to work. I'm in way over my head, unlikely to solve this on my own any time soon. Perhaps this code is simply out-of-date/obsolete? ...org vrs. .com problem (..not supposed to be..) ..perhaps wrong compiler? ...


Edit: ..Realizing that it might be something stupid like where it says to include "# include "addRegionOption.H"", maybe instead of "Region", I should put the name of the actual region.. like "Fluid".. I'll check where these included files are supposed to come from, see what -can- be included..

Last edited by mikethe1wheelnut; June 13, 2022 at 02:19. Reason: added solution possibilities
mikethe1wheelnut is offline   Reply With Quote

Old   June 14, 2022, 04:49
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Not really sure what you are trying to do. If I check out the help, it should probably just work as-is:
Code:
$ setFields -help

Usage: setFields [OPTIONS]
Options:
  -case <dir>       Specify case directory to use (instead of cwd)
  -decomposeParDict <file>
                    Use specified file for decomposePar dictionary
  -dict <file>      Alternative setFieldsDict
  -parallel         Run in parallel
  -region <name>    Specify alternative mesh region
  -doc              Display documentation in browser
  -help             Display short help and exit
  -help-full        Display full help and exit

Set values on a selected set of cells/patch-faces via a dictionary

Using: OpenFOAM-v2112 (2112) - visit www.openfoam.com 
Build: 7b5cfbd1b0-20220609 (patch=220310) 
Arch:  LSB;label=32;scalar=64

Or are you trying to implement an '-allRegions' option (wasn't really sure).
olesen is offline   Reply With Quote

Old   June 14, 2022, 14:25
Default
  #3
Member
 
Michael Jensen
Join Date: May 2022
Posts: 34
Rep Power: 4
mikethe1wheelnut is on a distinguished road
Quote:
Originally Posted by olesen View Post
Not really sure what you are trying to do. If I check out the help, it should probably just work as-is:
Code:
$ setFields -help

Usage: setFields [OPTIONS]
Options:
  -case <dir>       Specify case directory to use (instead of cwd)
  -decomposeParDict <file>
                    Use specified file for decomposePar dictionary
  -dict <file>      Alternative setFieldsDict
  -parallel         Run in parallel
  -region <name>    Specify alternative mesh region
  -doc              Display documentation in browser
  -help             Display short help and exit
  -help-full        Display full help and exit

Set values on a selected set of cells/patch-faces via a dictionary

Using: OpenFOAM-v2112 (2112) - visit www.openfoam.com 
Build: 7b5cfbd1b0-20220609 (patch=220310) 
Arch:  LSB;label=32;scalar=64
Or are you trying to implement an '-allRegions' option (wasn't really sure).

Excellent question. Maybe I can provide enough information for the answer to become clear. I'm working off of the following tutorial: https://www.youtube.com/channel/UCux...RihBaHRWzgjuJA, where the lady splits her simulation between two regions, fluid, and solid. The solid is immersed in a flow of air. I want to set a section of the wall containing the flow to a higher temperature. So presumably that means I want to apply setFields to the fluid. I just tried

Code:
setFields -fluid
and got
Code:
--> FOAM FATAL ERROR: 
Invalid option: -fluid
so that's not right. Continuing to explore what the alternative correct solution would be. Will edit this as I get more info.


Edit: Compiling explanation of what I was doing, and whole vistas of understanding are opening themselves. The Allrun file provided is:


Code:
#!/bin/sh
cd ${0%/*} || exit 1    # Run from this directory

# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

runApplication blockMesh

runApplication topoSet

runApplication splitMeshRegions -cellZones -defaultRegionName fluid -overwrite

paraFoam -region fluid -touch
paraFoam -region solid -touch

runApplication $(getApplication)

#------------------------------------------------------------------------------
I had got to the point of running:


Code:
topoSet
And no further. I was just confused. And.. sigh.. same error..


..Edit 2: My setFieldsDict is in the "system" folder. That folder contains two other folders, 'fluid', and 'solid'. I don't know if that's relevant to the question.


I run the following commands successfully:


Code:
blockMesh
topoSet
splitMeshRegions -cellZones -defaultRegionName fluid -overwrite
paraFoam -region fluid -touch
 paraFoam -region solid -touch
..what is the defaultRegionName..?


Edit 3: Ok, maybe getting closer.. Ignored different regions, just called the file directly:


Code:
eriadar@eriadar-Latitude-E7440:~/OpenFOAM/eriadar-9/run/tutorials/heatTransfer/chtMultiRegionFoam/heatFunnel2D$ setFields
/*---------------------------------------------------------------------------*\


...


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading "setFieldsDict"

Setting field default values
--> FOAM Warning : 
    From function bool setCellFieldType(const Foam::word&, const Foam::fvMesh&, const labelList&, Foam::Istream&) [with Type = double; Foam::labelList = Foam::List<int>]
    in file setFields.C at line 120
    Field T not found

Setting field region values
    Adding faces with centre within boxes 1((0 -10 -10) (10 -0.03 10))
--> FOAM Warning : 
    From function bool setFaceFieldType(const Foam::word&, const Foam::fvMesh&, const labelList&, Foam::Istream&) [with Type = double; Foam::labelList = Foam::List<int>]
    in file setFields.C at line 311
    Field T not found

End

..so T is a problem.. [..continuing research..]

Last edited by mikethe1wheelnut; June 14, 2022 at 16:51. Reason: ..more information..
mikethe1wheelnut is offline   Reply With Quote

Old   June 17, 2022, 14:35
Default
  #4
Member
 
Michael Jensen
Join Date: May 2022
Posts: 34
Rep Power: 4
mikethe1wheelnut is on a distinguished road
Quote:
Originally Posted by mikethe1wheelnut View Post
Excellent question. Maybe I can provide enough information for the answer to become clear. I'm working off of the following tutorial: https://www.youtube.com/channel/UCux...RihBaHRWzgjuJA, where the lady splits her simulation between two regions, fluid, and solid. The solid is immersed in a flow of air. I want to set a section of the wall containing the flow to a higher temperature. So presumably that means I want to apply setFields to the fluid. I just tried

Code:
setFields -fluid
and got
Code:
--> FOAM FATAL ERROR: 
Invalid option: -fluid
so that's not right. Continuing to explore what the alternative correct solution would be. Will edit this as I get more info.


Edit: Compiling explanation of what I was doing, and whole vistas of understanding are opening themselves. The Allrun file provided is:


Code:
#!/bin/sh
cd ${0%/*} || exit 1    # Run from this directory

# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

runApplication blockMesh

runApplication topoSet

runApplication splitMeshRegions -cellZones -defaultRegionName fluid -overwrite

paraFoam -region fluid -touch
paraFoam -region solid -touch

runApplication $(getApplication)

#------------------------------------------------------------------------------
I had got to the point of running:


Code:
topoSet
And no further. I was just confused. And.. sigh.. same error..


..Edit 2: My setFieldsDict is in the "system" folder. That folder contains two other folders, 'fluid', and 'solid'. I don't know if that's relevant to the question.


I run the following commands successfully:


Code:
blockMesh
topoSet
splitMeshRegions -cellZones -defaultRegionName fluid -overwrite
paraFoam -region fluid -touch
 paraFoam -region solid -touch
..what is the defaultRegionName..?


Edit 3: Ok, maybe getting closer.. Ignored different regions, just called the file directly:


Code:
eriadar@eriadar-Latitude-E7440:~/OpenFOAM/eriadar-9/run/tutorials/heatTransfer/chtMultiRegionFoam/heatFunnel2D$ setFields
/*---------------------------------------------------------------------------*\


...


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading "setFieldsDict"

Setting field default values
--> FOAM Warning : 
    From function bool setCellFieldType(const Foam::word&, const Foam::fvMesh&, const labelList&, Foam::Istream&) [with Type = double; Foam::labelList = Foam::List<int>]
    in file setFields.C at line 120
    Field T not found

Setting field region values
    Adding faces with centre within boxes 1((0 -10 -10) (10 -0.03 10))
--> FOAM Warning : 
    From function bool setFaceFieldType(const Foam::word&, const Foam::fvMesh&, const labelList&, Foam::Istream&) [with Type = double; Foam::labelList = Foam::List<int>]
    in file setFields.C at line 311
    Field T not found

End
..so T is a problem.. [..continuing research..]

Just in case somebody happens along and happens to spot the problem, this thread is not dead. In the sense that I haven't yet solved the problem, and still do want to solve it. I've merely shifted back to another part of the project, waiting to see what will happen here. When that part is significantly advanced, I'll come back to this issue and see if I can figure it out. If I can't, I'll either hand the problem over to somebody else, or use another software. (that I'll have to learn)
mikethe1wheelnut is offline   Reply With Quote

Old   June 20, 2022, 04:04
Default
  #5
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
If you take a quick look at heatTransfer/chtMultiRegionTwoPhaseEulerFoam/solidQuenching2D you will see the following:
  • setFields -region water
  • system/water/setFieldsDict


This might give you something to work with.
olesen is offline   Reply With Quote

Old   June 20, 2022, 05:00
Default
  #6
Member
 
Michael Jensen
Join Date: May 2022
Posts: 34
Rep Power: 4
mikethe1wheelnut is on a distinguished road
Quote:
Originally Posted by olesen View Post
If you take a quick look at heatTransfer/chtMultiRegionTwoPhaseEulerFoam/solidQuenching2D you will see the following:
  • setFields -region water
  • system/water/setFieldsDict


This might give you something to work with.

..dude, thanks so much. The time I expected to spend on this just went from months to days. (..I was bracing myself for a deep dive into openFoam source-code.. ..still might happen, I suppose.. )
mikethe1wheelnut is offline   Reply With Quote

Old   June 20, 2022, 14:58
Default
  #7
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by mikethe1wheelnut View Post
..dude, thanks so much.
Must be a confusion here. The only dude I know of is "The Big Lebowski".
Wowbagger likes this.
olesen is offline   Reply With Quote

Reply

Tags
multiregionsolver, setfields, wmake error

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
Problems in personal library compilation shrina OpenFOAM 3 February 23, 2009 11:12
UDF compilation problems MateuszZb FLUENT 4 October 20, 2008 02:46
PROBLEMS WITH THE COMPILATION oscar_j OpenFOAM Running, Solving & CFD 6 July 18, 2007 21:41
Changes in OF 14 and compilation issues alberto OpenFOAM Running, Solving & CFD 13 May 13, 2007 15:21
Compilation problems and file locations Joel Siemens 3 February 11, 2003 12:42


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