CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swak4Foam] Read boundary data from files with swak4Foam (groovyBC) (https://www.cfd-online.com/Forums/openfoam-community-contributions/131172-read-boundary-data-files-swak4foam-groovybc.html)

Hugoles March 10, 2014 17:13

Read boundary data from files with swak4Foam (groovyBC)
 
Hello,

I'm using timeVaryingMappedFixedValue to import some pre-generated velocity field into my domain. As required by this BC, these data are stored as planes (with a geometry equal to the inlet surface) inside folders named according to the time step. Thus, the simulation looks for the velocity values at a given time step (and interpolates in between) under the corresponding folder under boundaryData.

What I need is to do something similar to the above but for the side boundaries, This is, to make the boundaries to look for the velocity data in stored files, assuming that the flow is advected at a certain mean velocity. My computational domain is a simple rectangular box, so the flow moves tangentially to the side boundaries.

Does someone knows if this can be done using swak4Foam (i.e. groovyBC) or any other utility? From what I have seen in the examples, groovyBC can search for field values within lookuptables but unlike what I need, they would be fixed in time or change according to an expression

Thanks !

gschaider March 11, 2014 15:24

Quote:

Originally Posted by Hugoles (Post 479223)
Hello,

I'm using timeVaryingMappedFixedValue to import some pre-generated velocity field into my domain. As required by this BC, these data are stored as planes (with a geometry equal to the inlet surface) inside folders named according to the time step. Thus, the simulation looks for the velocity values at a given time step (and interpolates in between) under the corresponding folder under boundaryData.

What I need is to do something similar to the above but for the side boundaries, This is, to make the boundaries to look for the velocity data in stored files, assuming that the flow is advected at a certain mean velocity. My computational domain is a simple rectangular box, so the flow moves tangentially to the side boundaries.

Does someone knows if this can be done using swak4Foam (i.e. groovyBC) or any other utility? From what I have seen in the examples, groovyBC can search for field values within lookuptables but unlike what I need, they would be fixed in time or change according to an expression

Thanks !

No. This kind of multidimensional lookup is not implemented in swak. I understand that it would be nice for some people but I haven't needed it yet.

I don't quite understand what are the lookup-variables in your case (or why timeVaryingMapped should not work for "side boundaries")

Hugoles March 11, 2014 19:42

The variables to be read are only velocity values of the pre-generated field at its boundaries (as they coincide to the side boundaries of the computational domain).

TimeVaryingM should also work for the sides, although I haven't tried it there yet. It just requires some more pre-processing to create the planes for each time step. I was curious about how groovyBC could handle this, for example, if it could read the pre-generated field (something like a 0/U file) at the desired regions and from there, set the boundary values at any given time. That would save some pre-processing (or programming an ad hoc BC).

Thanks,

gschaider March 12, 2014 17:29

Quote:

Originally Posted by Hugoles (Post 479448)
The variables to be read are only velocity values of the pre-generated field at its boundaries (as they coincide to the side boundaries of the computational domain).

TimeVaryingM should also work for the sides, although I haven't tried it there yet. It just requires some more pre-processing to create the planes for each time step. I was curious about how groovyBC could handle this, for example, if it could read the pre-generated field (something like a 0/U file) at the desired regions and from there, set the boundary values at any given time. That would save some pre-processing (or programming an ad hoc BC).

I'm sorry. Your question is very vague. So I'm going to answer alike: maybe

(maybe I'm to stupid to understand what you want, but it is my impression that there is some information missing that is obvious to you because it is your problem but for someone not sitting at your desk is unclear. Usually it is a good idea to reread the question before sending it and think "Would somebody who never worked on this problem understand the question?")

If the question was asked like this "I have precomputed velocity values v(x,y,t) for two boundaries at z=1 and z=0. I can't use timeMapped because these values are only the absolute value of the velocity in tangential direction and I want groovyBC to calculate the vector using the patch orientation" (that is one possible interpretation of what you asked) THEN I could give a yes or no answer

Hugoles March 17, 2014 09:34

Hello Bernhard,

What I said in my previous post was intended to be just a comment, rephrasing a bit what I originally asked. You had already replied to my question.

Thanks again for your help,

jherb March 19, 2014 05:11

Hello Bernhard,

how hard would it be to add the ability to use Python code in groovyBC (e.g. like in function objects)? Then the lookup (in this example) could be handled by Python.

Joachim

gschaider March 19, 2014 18:16

Quote:

Originally Posted by jherb (Post 480828)
Hello Bernhard,

how hard would it be to add the ability to use Python code in groovyBC (e.g. like in function objects)? Then the lookup (in this example) could be handled by Python.

Joachim

Not terribly hard. Basically create a boundary condition that double inherits from a regular fvpatchField and the PythonInterpreterWrapper. I even thought about it but the problems I saw are
- exposing the relevant information (face centers etc) to the Python-code
- parallelism
(didn't need it yet and didn't want to start something were testing might be more work than coding it)

Don't see myself doing that in the near future, but of course I accept contributions


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