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

how to use setFields in multiregionsolver

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

Like Tree1Likes
  • 1 Post By karlvirgil

Reply
 
LinkBack Thread Tools Display Modes
Old   August 1, 2012, 04:37
Default how to use setFields in multiregionsolver
  #1
Member
 
jack
Join Date: Jul 2011
Posts: 52
Rep Power: 6
lg88 is on a distinguished road
Hello everyone
I am simulating a FSI problem with multiregionsolver.In my case,there are only two regions, solid and fluid.Now I want to use the function setFields to set a quantity ,for example initial volume fraction, in fluid region.
I tried to put the setFieldsDict file in system/fluid floder,then run
Code:
setFields -region solid
or
Code:
setFields
And it failed.

The following is the details of the file setFieldsDict in my case:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

defaultFieldValues
(
volScalarFieldValue sigma 2
);

regions
(
boxToCell
{
box (-1.1 -1.1 0) (-1.0 1.1 5);
fieldValues
(
volScalarFieldValue sigma 0.01
);
}

boxToCell
{
box (1.0 -1.1 0) (1.1 1.1 5);
fieldValues
(
volScalarFieldValue sigma 0.01
);
}
);

// ************************************************** **** //

So where should I put the setFieldsDict and how to modified it?

regards!

lg88
lg88 is offline   Reply With Quote

Old   August 2, 2012, 07:42
Default
  #2
New Member
 
JOMAA Ghassan
Join Date: Jan 2012
Location: Paris
Posts: 5
Rep Power: 5
ghas is on a distinguished road
Hi Jack,

To do that, follow the following steps:

1- cd $WM_PROJECT_DIR/applications/utilities/preProcessing
2- cp -r setFields $WM_PROJECT_USER_DIR/applications/utilities/preProcessing
3- Rename the directory and the source file name, clean all the dependancies and
> mv setFields mysetFields
> cd mysetFields
> mv setFields.C mysetFields.C
> wclean

5- Add the region option to mysetFields.C file by

# include "addRegionOption.H"

6- Replace the line

# include "createMesh.H"

by:

# include "createNamedPolyMesh.H"

7- Open Make/files and modify it as follows:
mysetFields.C
EXE = $(FOAM_USER_APPBIN)/mysetFields

8- Compile the utility by wmake

9- Now your utility is ready to be ued:

> mysetFields -region solid



Best regards

Ghassan
ghas is offline   Reply With Quote

Old   August 2, 2012, 09:44
Default
  #3
Member
 
jack
Join Date: Jul 2011
Posts: 52
Rep Power: 6
lg88 is on a distinguished road
Hi Ghassan

I have done as you said and it works correctly.Thank you very much!
By the way,do you know how to convert the result data of different regions to tecplot360?
I use the following command,but the converted data can not work in tecplot.
Code:
foamToTecplot360 -region fluid
foamToTecplot360 -region solid
regards!

lg88

Last edited by lg88; August 2, 2012 at 10:08.
lg88 is offline   Reply With Quote

Old   August 2, 2012, 11:44
Default
  #4
New Member
 
JOMAA Ghassan
Join Date: Jan 2012
Location: Paris
Posts: 5
Rep Power: 5
ghas is on a distinguished road
Hi jack,

The foamTotecplot supports the multi-region option and I think that there is another proplem in your run. what's the error message ?

Best regards,

Ghassan

Last edited by ghas; August 2, 2012 at 12:00.
ghas is offline   Reply With Quote

Old   August 2, 2012, 19:39
Default
  #5
Member
 
jack
Join Date: Jul 2011
Posts: 52
Rep Power: 6
lg88 is on a distinguished road
Hi Ghassan
I have found my problem and it can run now.Thank you all the same!

regards!

jack
lg88 is offline   Reply With Quote

Old   November 26, 2012, 14:38
Default setFields multiregion fix for 2.1.x
  #6
New Member
 
karlvirgil's Avatar
 
Join Date: Jul 2009
Location: Wrentham, MA
Posts: 8
Rep Power: 8
karlvirgil is on a distinguished road
For OpenFOAM-2.1.x the setFields can be made multiregional if the following changes are made to setFields.C

Quote:
$ )git diff setFields.C

diff --git a/applications/utilities/preProcessing/setFields/setFields.C b/applications/utilities/preProcessing/setFields/setFields.C
index 0930468..d9a53ee 100644
--- a/applications/utilities/preProcessing/setFields/setFields.C
+++ b/applications/utilities/preProcessing/setFields/setFields.C
@@ -331,9 +331,10 @@ public:

int main(int argc, char *argv[])
{
+# include "addRegionOption.H"
# include "setRootCase.H"
# include "createTime.H"
-# include "createMesh.H"
+# include "createNamedMesh.H"

Ivooo likes this.
karlvirgil is offline   Reply With Quote

Old   January 14, 2013, 15:51
Default
  #7
Member
 
Jamal
Join Date: May 2012
Location: Freiburg
Posts: 54
Rep Power: 4
aujamal20 is an unknown quantity at this point
Dear
I am using OF 2.1.0 and I am trying to modify setFields utility to work on multiRegion and I have followed the same steps which are given but I am facing error

Quote:
SOURCE=mysetFields.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/OpenFOAM/OpenFOAM-2.1.0/src/finiteVolume/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.1.0/src/meshTools/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.1.0/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/mysetFields.o
In file included from mysetFields.C:37:0:
/opt/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/addRegionOption.H:6:5: error: expected constructor, destructor, or type conversion before '(' token
mysetFields.C: In function 'int main(int, char**)':
mysetFields.C:343:6: error: 'Get' was not declared in this scope
mysetFields.C:343:10: error: expected ';' before 'times'
mysetFields.C:369:62: error: no matching function for call to 'setCellField::iNew::iNew(Foam:olyMesh&, Foam::labelList)'
mysetFields.C:369:62: note: candidates are:
mysetFields.C:133:9: note: setCellField::iNew::iNew(const Foam::fvMesh&, const labelList&)
mysetFields.C:133:9: note: no known conversion for argument 1 from 'Foam:olyMesh' to 'const Foam::fvMesh&'
mysetFields.C:126:11: note: setCellField::iNew::iNew(const setCellField::iNew&)
mysetFields.C:126:11: note: candidate expects 1 argument, 2 provided
mysetFields.C:404:63: error: no matching function for call to 'setCellField::iNew::iNew(Foam:olyMesh&, Foam::List<int>)'
mysetFields.C:404:63: note: candidates are:
mysetFields.C:133:9: note: setCellField::iNew::iNew(const Foam::fvMesh&, const labelList&)
mysetFields.C:133:9: note: no known conversion for argument 1 from 'Foam:olyMesh' to 'const Foam::fvMesh&'
mysetFields.C:126:11: note: setCellField::iNew::iNew(const setCellField::iNew&)
mysetFields.C:126:11: note: candidate expects 1 argument, 2 provided
mysetFields.C:425:63: error: no matching function for call to 'setFaceField::iNew::iNew(Foam:olyMesh&, Foam::List<int>)'
mysetFields.C:425:63: note: candidates are:
mysetFields.C:295:9: note: setFaceField::iNew::iNew(const Foam::fvMesh&, const labelList&)
mysetFields.C:295:9: note: no known conversion for argument 1 from 'Foam:olyMesh' to 'const Foam::fvMesh&'
mysetFields.C:288:11: note: setFaceField::iNew::iNew(const setFaceField::iNew&)
mysetFields.C:288:11: note: candidate expects 1 argument, 2 provided
make: *** [Make/linux64GccDPOpt/mysetFields.o] Error 1
Help me out to fix this error.

Regards,
Jamal
aujamal20 is offline   Reply With Quote

Old   January 14, 2013, 16:21
Default
  #8
New Member
 
JOMAA Ghassan
Join Date: Jan 2012
Location: Paris
Posts: 5
Rep Power: 5
ghas is on a distinguished road
Quote:
Originally Posted by aujamal20 View Post
Dear
I am using OF 2.1.0 and I am trying to modify setFields utility to work on multiRegion and I have followed the same steps which are given but I am facing error



Help me out to fix this error.

Regards,
Jamal
Hi Jamal,

I think that you uncommented "// Get times list" by the ommision of "//" . You can find the modified code of setFields in the attached file.

Best Regards,
Ghassan
Attached Files
File Type: c mysetFields.C (11.3 KB, 55 views)
ghas is offline   Reply With Quote

Old   January 15, 2013, 06:01
Default
  #9
Member
 
Jamal
Join Date: May 2012
Location: Freiburg
Posts: 54
Rep Power: 4
aujamal20 is an unknown quantity at this point
Dear ghas

So nice of you, it helped me to solve the problem...

Thanks
aujamal20 is offline   Reply With Quote

Reply

Tags
setfields

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with the execution of the setFields utility. foamer OpenFOAM Pre-Processing 5 June 3, 2013 12:24
setFields tool does not assign water volume for given mesh. paka OpenFOAM 2 June 7, 2012 09:17
OF 1.6-ext setFields does not keep patch values Arnoldinho OpenFOAM Bugs 3 May 9, 2012 03:58
setFields not working dsanza OpenFOAM 2 September 14, 2011 09:00
question on setFields fijinx OpenFOAM Running, Solving & CFD 1 February 15, 2010 16:07


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