CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Problem with Setfields (http://www.cfd-online.com/Forums/openfoam/106563-problem-setfields.html)

erncyc September 1, 2012 09:35

Problem with Setfields
 
Hello friends,

Currently the setfields utility in OpenFOAM allows for the input of constant data in the setfieldDict dictionary. For instance when using cylinderToCell, it is required that one provides the values p1 and p2 which are the coordinates of the cylinder centre. In this case the coordinates are real values. I would like a situation where i can define a varying coordinate system ie p1 (x1, y1, z1) and p2 (x2, y2, z2). Anybody with an idea of how I might be able to do this. I checked the cylinderToCell.H class file and noticed that p1 and p2 are declared as "const vector". I appreciate any suggestion. Thanks.

gschaider September 2, 2012 17:00

Quote:

Originally Posted by erncyc (Post 379826)
Hello friends,

Currently the setfields utility in OpenFOAM allows for the input of constant data in the setfieldDict dictionary. For instance when using cylinderToCell, it is required that one provides the values p1 and p2 which are the coordinates of the cylinder centre. In this case the coordinates are real values. I would like a situation where i can define a varying coordinate system ie p1 (x1, y1, z1) and p2 (x2, y2, z2). Anybody with an idea of how I might be able to do this. I checked the cylinderToCell.H class file and noticed that p1 and p2 are declared as "const vector". I appreciate any suggestion. Thanks.

I'm not quite sure what you mean with "a varying coordinate system". I'd like to understand the problem before I make my usual suggestion: use funkySetFields

erncyc September 5, 2012 05:40

Quote:

Originally Posted by gschaider (Post 379915)
I'm not quite sure what you mean with "a varying coordinate system". I'd like to understand the problem before I make my usual suggestion: use funkySetFields

Hello Bernhard, firstly I really want you to know I appreciate your responding to my query, thanks a bunch. My problem involves the use of setFields (or a similar utility) that can set a 2D cylindrical region with centres that change with time. I wish to be able to provide new cylinder centres at every time step. Currently the cylinderToCell option allows for provision of a static coordinate (defined in setFields as p1 and p2). If I don't use funkysetfields, is there a way I might be able to do this by modifying the "cylinderToCell.H" class. Thank you again for your help.

Bernhard September 5, 2012 06:58

Do I understand correctly, that you want to set this during runtime? setFields and funkySetFields are designed for setting initial conditions. If you want to have a moving cylinder, you should put it in the solver itself, and not with a utility. You have much more freedom if you set the value each timestep in a loop over all cells.

erncyc September 5, 2012 07:19

Quote:

Originally Posted by Bernhard (Post 380323)
Do I understand correctly, that you want to set this during runtime? setFields and funkySetFields are designed for setting initial conditions. If you want to have a moving cylinder, you should put it in the solver itself, and not with a utility. You have much more freedom if you set the value each timestep in a loop over all cells.

Thanks again Bernhard. Yes you are right, I wish to set the region during runtime. My problem is (since I am using an immersed boundary method), I need to use a static mesh and find a way of connecting the displacement of the cylinder axis with the mesh coordinate system. I believe yes you are right i should use the solver (currently i am on interFoam), but this is where my problems begin...can't figure out how. Thanks

gschaider September 5, 2012 08:39

Quote:

Originally Posted by erncyc (Post 380329)
Thanks again Bernhard. Yes you are right, I wish to set the region during runtime. My problem is (since I am using an immersed boundary method), I need to use a static mesh and find a way of connecting the displacement of the cylinder axis with the mesh coordinate system. I believe yes you are right i should use the solver (currently i am on interFoam), but this is where my problems begin...can't figure out how. Thanks

And you need a source term in that cylinder or what? swak4Foam gives you a number of options (built on the machinery that drives funkySetFields):

- the manipulateField functionObject allows you to set an existing field according to an expression (which may depend on the time)
- there is a class expressionSource which you can incorporate into your solver to add a source term according to your needs (there is also a class for fixing the values in selected cells)
- in the development version for 2.x (mercurial repository) there is also a class based on basicSource which allows you to have expression-dependent sources in solvers that use the sourcesProperties-dictionary (no need to modify the solver)

erncyc September 5, 2012 08:43

Quote:

Originally Posted by gschaider (Post 380348)
And you need a source term in that cylinder or what? swak4Foam gives you a number of options (built on the machinery that drives funkySetFields):

- the manipulateField functionObject allows you to set an existing field according to an expression (which may depend on the time)
- there is a class expressionSource which you can incorporate into your solver to add a source term according to your needs (there is also a class for fixing the values in selected cells)
- in the development version for 2.x (mercurial repository) there is also a class based on basicSource which allows you to have expression-dependent sources in solvers that use the sourcesProperties-dictionary (no need to modify the solver)

Yes I need a source term. I have never used swakFoam...how could I get and install it? I currently have OF 2.01...thanks

gschaider September 5, 2012 11:01

Quote:

Originally Posted by erncyc (Post 380351)
Yes I need a source term. I have never used swakFoam...how could I get and install it? I currently have OF 2.01...thanks

You find it under http://openfoamwiki.net/index.php/Contrib/swak4Foam.

The basicSource-source-term currently is only in the development version. expressionSource in the release. Search the forum there is an explanation for it.

There may be an issue with compilation on 2.0.1 (the 2.x-branch is currently only tested on 2.1.x)

erncyc September 5, 2012 12:47

Quote:

Originally Posted by gschaider (Post 380386)
You find it under http://openfoamwiki.net/index.php/Contrib/swak4Foam.

The basicSource-source-term currently is only in the development version. expressionSource in the release. Search the forum there is an explanation for it.

There may be an issue with compilation on 2.0.1 (the 2.x-branch is currently only tested on 2.1.x)

Thank you again. I tried to install but I got the error message below:

ernest@cfdlab-desktop:~/OpenFOAM/swak4Foam$ nice ./Allwmake
No 'swakConfiguration'. Python etc won't work
Checking swak4Foam-version and generating file
No 'bison' found. This is absolutely essential for swak4Foam. Can't go on
Requirements for Library not satisfied. I see no sense in going on

Bernhard September 5, 2012 13:27

Quote:

Originally Posted by erncyc (Post 380407)
Thank you again. I tried to install but I got the error message below:

ernest@cfdlab-desktop:~/OpenFOAM/swak4Foam$ nice ./Allwmake
No 'swakConfiguration'. Python etc won't work
Checking swak4Foam-version and generating file
No 'bison' found. This is absolutely essential for swak4Foam. Can't go on
Requirements for Library not satisfied. I see no sense in going on

Did you read the prequisites in the README? You need bison to install it, and according to the error message, you should install that one first.

erncyc September 5, 2012 13:48

Quote:

Originally Posted by Bernhard (Post 380414)
Did you read the prequisites in the README? You need bison to install it, and according to the error message, you should install that one first.

oh ok...I will read README and try again thanks.

gschaider September 5, 2012 16:17

Quote:

Originally Posted by Bernhard (Post 380414)
Did you read the prequisites in the README? You need bison to install it, and according to the error message, you should install that one first.

Got nothing to add.

And while you're at it install flex ....


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