CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   how to use setFields in multiregionsolver (http://www.cfd-online.com/Forums/openfoam/105491-how-use-setfields-multiregionsolver.html)

lg88 August 1, 2012 04:37

how to use setFields in multiregionsolver
 
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

ghas August 2, 2012 07:42

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

lg88 August 2, 2012 09:44

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

ghas August 2, 2012 11:44

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

lg88 August 2, 2012 19:39

Hi Ghassan
I have found my problem and it can run now.Thank you all the same!

regards!

jack

karlvirgil November 26, 2012 14:38

setFields multiregion fix for 2.1.x
 
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"



aujamal20 January 14, 2013 15:51

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::polyMesh&, 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::polyMesh' 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::polyMesh&, 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::polyMesh' 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::polyMesh&, 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::polyMesh' 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

ghas January 14, 2013 16:21

1 Attachment(s)
Quote:

Originally Posted by aujamal20 (Post 401817)
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

aujamal20 January 15, 2013 06:01

Dear ghas

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

Thanks


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