CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (http://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   FunkySetFields Boundary conditions (http://www.cfd-online.com/Forums/openfoam-pre-processing/62009-funkysetfields-boundary-conditions.html)

listmg January 7, 2009 11:56

BRIEF DESCRIPTION -----------
 
BRIEF DESCRIPTION
-----------------
I am currently trying to apply a function to a flowfield using funkySetFields. The application works as described, however, I would like to specify the same xyz-dependent function on the boundaries as in the interior, without copying the interior values to the boundaries. The current function uses "pos" which uses the cell center. I am aware of "fpos", but am not sure how to apply it. Any assistance would be greatly appreciated!

EXAMPLE
-------
Currently I am running a unit cube to learn how to use the utility. I am running the below command to set a linear gradient on the velocity components:

funkySetFields -time 0 -field U -keepPatches \
-valuePatches "inlet exit top bottom front back" \
-expression "vector(3*pos().x,4*pos().y,5*pos().z)"

Again, this gives the desired behavior in the cells but I am unsure how to set the boundary face values correctly without manually editing them.



Thank you very much,
Mike

gschaider January 12, 2009 18:28

Hi Mike! In fact what FSF d
 
Hi Mike!

In fact what FSF does for valuePatches is take the value of the cell that the patch-face borders to and uses it as the face value. In your case this might introduce a slight error.

The problem with fpos is that it produces a surfaceField and funkySetFields knows no way to map that directly to a boundary patch of a volField (which is what you want to do), it always has to be converted (by averaging etc) back to a volField (and then you'd get the same center-of-cell values).

The only solution for that (if you can'T live with the slight error), that I can think of right now would be to write a funkySetPatchField or write a separate boundary condition or write a separate utility that correctly sets the patch values (like the parabolic-inlet that floats around on the board). Wait .... that are three solutions. The only three solutions for that .......

Bernhard

listmg January 13, 2009 09:40

Bernhard, Thank you for the
 
Bernhard,

Thank you for the response! I think I will give a funkySetPatchField a shot as time goes by. For now I can do some hand/python corrections.

Thanks!
Mike

Djub March 29, 2013 07:08

Hi Foamers,
I am using this thread because its title is close to my problem.
When I use funkySetFields (so easy to use! Thanks Bernhard !) , it changes my field (as I want), but it also changes my boundary conditions! How can I prevent this behavior ?

More precisely, here is my command line:
Code:

funkySetFields -latestTime -field U -expression "vector(pos().z>1 ? 5*log(pos().z/.2) : 5*log(1/.2),0,0)"
This utility works fine and does what I want, but it also changes my boundrayField (which will be considered later as boundary conditions).

Did I misunderstood something? Is there any option to preserve my boundary fields?

gschaider March 29, 2013 10:36

Quote:

Originally Posted by Djub (Post 417161)
Hi Foamers,
I am using this thread because its title is close to my problem.
When I use funkySetFields (so easy to use! Thanks Bernhard !) , it changes my field (as I want), but it also changes my boundary conditions! How can I prevent this behavior ?

More precisely, here is my command line:
Code:

funkySetFields -latestTime -field U -expression "vector(pos().z>1 ? 5*log(pos().z/.2) : 5*log(1/.2),0,0)"
This utility works fine and does what I want, but it also changes my boundrayField (which will be considered later as boundary conditions).

Did I misunderstood something? Is there any option to preserve my boundary fields?

The is not too much documentation on FSF, but the little bit there is is quite useful I think: http://openfoamwiki.net/index.php/Co...and_line_usage (keepPatches is your friend)

Djub March 29, 2013 10:57

:) Thanks ! (I had read this page, but not these 3 lines... Shame on me!)

tayo November 18, 2013 18:49

Hello all,
I want to initialize the temperature field of a bubble in contact with a wall using funkySetFields. The wall has a fixedGradient BC acting as the heat flux, with wall temp higher than bubble temp. The issue is that temp of bubble cells at contact region overrides the wall patch temp. This makes temp at contact region higher than wall temp whereas, I expect this region to have less than or equal to the wall temp. Here's what my funkySetFieldDict looks like:

Code:

field T;
expression "xxx";
condition "yyy";
-keepPatches 1;

After initializing with funkySetField, I've tried to reinitialized the fixedGradient at the wall patch using funkySetBoundaryField but nothing seems to happen afterwards. Please provide suggestions on how to fix this. Thanks :D

gschaider November 18, 2013 19:34

Quote:

Originally Posted by tayo (Post 462456)
Hello all,
I want to initialize the temperature field of a bubble in contact with a wall using funkySetFields. The wall has a fixedGradient BC acting as the heat flux, with wall temp higher than bubble temp. The issue is that temp of bubble cells at contact region overrides the wall patch temp. This makes temp at contact region higher than wall temp whereas, I expect this region to have less than or equal to the wall temp. Here's what my funkySetFieldDict looks like:

Code:

field T;
expression "xxx";
condition "yyy";
-keepPatches 1;

After initializing with funkySetField, I've tried to reinitialized the fixedGradient at the wall patch using funkySetBoundaryField but nothing seems to happen afterwards. Please provide suggestions on how to fix this. Thanks :D

a) that can't be the whole dict
b) the minus in front of keepPatches is really there? Why? That way of course FSF assumes that keepPatches is false (because you're setting another value)

tayo November 18, 2013 20:37

1 Attachment(s)
Thanks for the quick response. Yep you're right, my typing was sloppy, indeed the minus sign is not included. Here is what my funkySetFiedDict look like:

Code:

expressions
(
  ____________
  other fields
  ____________

  temperature
  {
  field T;
  expression "T+10";
  condition "pow(pos().x-0.01,2)+pow(pos().y-0.02,2) <= pow(0.001,2)";
  keepPatches 1;
  }
);

Like I earlier said, I have fixedGradient wall BC as heat flux. Ofcourse, it displays "keeping patches unaltered" when I apply funkySetFields but the issue is the contact region has higher temps no matter high the value used in fixedGradient BC. This issue doesn't occur when I use a fixedValue wall BC instead, but only happens with fixedGradient. However, I need fixedGradient to represent the heat flux. Find the image attached for illustration.

gschaider November 19, 2013 12:20

Quote:

Originally Posted by tayo (Post 462465)
Thanks for the quick response. Yep you're right, my typing was sloppy, indeed the minus sign is not included. Here is what my funkySetFiedDict look like:

Code:

expressions
(
  ____________
  other fields
  ____________

  temperature
  {
  field T;
  expression "T+10";
  condition "pow(pos().x-0.01,2)+pow(pos().y-0.02,2) <= pow(0.001,2)";
  keepPatches 1;
  }
);

Like I earlier said, I have fixedGradient wall BC as heat flux. Ofcourse, it displays "keeping patches unaltered" when I apply funkySetFields but the issue is the contact region has higher temps no matter high the value used in fixedGradient BC. This issue doesn't occur when I use a fixedValue wall BC instead, but only happens with fixedGradient. However, I need fixedGradient to represent the heat flux. Find the image attached for illustration.

Sounds more like a general OF-problem you have. So I don't hijack a thread just because it has the name of one of the tools you used.

Paraview pictures don't prove that OF sees the value this way. They only show how PV interprets the OF-data. Especially if as in your case you're using point values.

tayo November 19, 2013 12:53

The temp data from the spreadsheet also shows this high temp. I've tried forcing this fixedGradient with a funkySetBoundaryDict file but I don't understand why it does not make any changes to the temp field when I then initialize with funkySetBoundary. Here's what the dict file looks like:

Code:

temp {
field T;
expressions ( {
target fixedGradient;
patchName wall;
expression "xxx"; } );
}


gschaider November 20, 2013 10:09

Quote:

Originally Posted by tayo (Post 462566)
The temp data from the spreadsheet also shows this high temp. I've tried forcing this fixedGradient with a funkySetBoundaryDict file but I don't understand why it does not make any changes to the temp field when I then initialize with funkySetBoundary. Here's what the dict file looks like:

Code:

temp {
field T;
expressions ( {
target fixedGradient;
patchName wall;
expression "xxx"; } );
}


Classic case of RTFM: have a look at http://www.openfoam.org/docs/user/boundaries.php Table 5.2: "Data to specify" is _gradient_ not _fixedGradient_

tayo November 20, 2013 12:05

Quote:

Originally Posted by gschaider (Post 462731)
Classic case of RTFM: have a look at http://www.openfoam.org/docs/user/boundaries.php Table 5.2: "Data to specify" is _gradient_ not _fixedGradient_

That's exactly what I'm doing. What I'm asking is how to use funkySetBoundary to force this gradient BC since funkySetFields overwrites it. Or if there's any other way to go about this.

gschaider November 22, 2013 14:00

Quote:

Originally Posted by tayo (Post 462753)
That's exactly what I'm doing. What I'm asking is how to use funkySetBoundary to force this gradient BC since funkySetFields overwrites it. Or if there's any other way to go about this.

If you use keepPatches then FSF does not consciously change gradientValue. The only thing can be a problem with the reading/writing of the BCs. But that is the problem/bug of the boundary-condition (not FSF).

But why don't you use FSBF after FSF with the correct target


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