CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Defining elementwise boundary conditions (http://www.cfd-online.com/Forums/openfoam/80461-defining-elementwise-boundary-conditions.html)

Daniel_Jung September 27, 2010 07:31

Defining elementwise boundary conditions
 
Hi everybody,
I've got a complete mesh from a postprocessor and want to define boundary-conditions elementwise in my OpenFoam-case.
How defining boundary-conditions works on boundarys like walls is clear to me, but what if I want to assign a special temperature on every surface-node of my model?
I now the node numbers (let's say from 1 to 200) and values for every node.
How would that look like or would I need to define a seperate boundary for every element and then define the values for every "boundary"?

Thank you very much for every kind of help!

marupio September 27, 2010 11:58

By "surface" you mean all the interior faces? So you basically want a constant surfaceScalarField? You can define one in your createFields.H... but I'm not sure what you plan to do with it.

Daniel_Jung September 28, 2010 02:57

Hi marupio,
thats not directly what i'd want to do.
I've got, just for the example, some sort of box with hexa's in the volume surrounded by shell elements that form the surface of the box. Now i would like to give every shell-element a specified temperature which I get really exact from measurements.

So I'd like to tell OpenFoam that shell #1 --> 387.98 K
shell #2 --> 388.23K
shell ...

Any Idea?

marupio September 28, 2010 07:56

Why can't you use a fixed value boundary condition?

Daniel_Jung September 28, 2010 08:33

Hi Marupio,

I could for sure take a fixed value boundyry condition, but I think I'd need a new Boundary for each single shell element?

At the moment my boundary-conditions look like
Code:

boundaryField
{
    Bottom
    {
    type        timeVaryingUniformFixedValue;
    fileName    "temperature_floor.dat";
  outOfBounds  clamp;
    }
    Side1
    {
    type        timeVaryingUniformFixedValue;
    fileName    "temperature_walls.dat";
  outOfBounds  clamp;
    }
    side2
    {
    type        timeVaryingUniformFixedValue;
    fileName    "temperature_walls.dat";
  outOfBounds  clamp;
    }
....

and in each boundary there are at the moment about 100 shells. Can I define boundary-conditions directly for the single shells somehow?

marupio September 28, 2010 09:36

Maybe I don't understand what you want to do... but fixed value boundary conditions don't have to be uniform. You can define the distribution of values across each surface. You are using a time varying boundary condition - but the values don't change over time? Are you using this because it assigns a different value to each face element by reading from the dat file?

Daniel_Jung September 28, 2010 09:56

Oh, ok, now were getting closer I think.
I think I don't know to much about this so my question may be somehow unclear.
Lets take a surface from my model, for example the Bottom.
At the moment I'm assigning a time-varying temperature to the whole bottom, what looks like this inside the "temperature_floor.dat" file:
Code:

(
 (0.0 900.000)
 (200.0 900.000)
 (230 300.000)
)

Now let's say the Floor consists of the Elements 1000 - 1003 (4 Elements)

Now I'd like to define
Element 1000 to go from
901.5 over 902.3 to 302.58 K
Element 1001 to go from
902.5 to 903.1 to 301.1 K
Element 1002 to go from
900.00 to 908.456 to 320 K

I could for sure also manage to get coordinates where I'd like to define the Temperature (the coordinates from the single Elements).

How would you do this? I've never seen how I can define a Temperature distribution across a surface... :( And I can't find anything about that...

marupio September 28, 2010 11:10

I don't have my OpenFOAM pc with me today, so I'm going mostly from memory...

I don't know much about the timeVaryingBoundaryCondition - if it can handle a non-uniform surface, and how to format the data file for that. I know it uses interpolationTable: http://openfoamwiki.net/index.php/Op...rpolationTable

Look at the 0/T file, you'll notice the internalField is (probably) defined as a uniform value:
Code:

    value  uniform 273.12;
But if you look at results mid-run, you'll notice it is a list of values. These values correspond to the mesh cell number.

The same goes for boundary conditions. Either you can give it a uniform value, or you can give it a list. "uniform" is just a shorthand. Each value in the list corresponds to the face number on that boundary patch. The tricky part is associating the face number with physical coordinates. If you really only have 4 face elements, then you can probably get away with figuring it out by hand. Otherwise, I strongly recommend funkySetFields: http://openfoamwiki.net/index.php/Co...funkySetFields

Returning to the timeVarying boundary condition - try to find an existing example that uses a timeVarying boundary condition... that's all I can suggest for that.

-dave

Daniel_Jung October 19, 2010 04:28

Hi,
I've made a short script that generates my Boundary-Condition elementwise.
The resulting File for "T" looks like:
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  1.6                                  |
|  \\  /    A nd          | Web:      http://www.OpenFOAM.org              |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      volScalarField;
    object      T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 0 0 1 0 0 0];

internalField  uniform 700;

boundaryField
{
    Inlet
    {
    type            fixedValue;
    value uniform 350;
    }
    outlet
    {
    type zeroGradient;
    }
Interface
{
type fixedValue;
value  nonuniform List<scalar>
22810
(
280
280
280
280
280
280
280
280
280
280
280
280
280
280
280
280
280
...
)
}
}

The Number of entries in the list is correct. But OpenFoam gives me an error message back:
Code:

--> FOAM FATAL IO ERROR:
ill defined primitiveEntry starting at keyword 'value' on line 35 and ending at line 22854

file: .../Dice/0/T at line 22854.

    From function primitiveEntry::readEntry(const dictionary&, Istream&)
    in file db/dictionary/primitiveEntry/primitiveEntryIO.C at line 214.

FOAM exiting

The Value keyword is the one before the list. But I simply can't figure out what is ill defined about that keyword...

paka October 19, 2010 04:39

I'm not sure, but shouldn't you use 'internalField' instead of 'value'?

Daniel_Jung October 19, 2010 05:23

Hi,
well, I think this should be right, as this isn't the definition for the internal field but for the boundary field.
For mut (for example) this looks like:
Code:


  InnerBoxSurface
    {
        type            mutkWallFunction;
        Cmu            0.09;
        kappa          0.41;
        E              9.8;
        value          nonuniform List<scalar>
4154
(
6.5313e-06
0
0
0
0
0
0
...

So i think " value nonuniform List<scalar>" should be right somehow, following the assumption, that elementwise boundary-conditions look like the same for mut, alphat and for T (which I want to use)...
I thought I could simply define this like this as for alphat OpenFoam itself defines alphat and mut this way...

Daniel_Jung October 19, 2010 05:29

Oh, I just found the solution:
after the elementwise-definitions and the closing bracket ")" I was missing an ";"
:D

Daniel_Jung November 24, 2010 05:50

Hi there again,
with all that above working, I got quite far, but now I'd really need some sort of element-wise boundary condition that is time-varying.
What I know is how I can do Elementwise-Boundary-Conditions.
Also I know how to define time-varying boundary conditions for complete patches.

Now the question is how it would have to look like If I wanted to combine these two.
Would I need to generate a patch for every single element and than define time varying boundary conditions in a way like

boundaryField
{
FirstFace
{
type timeVaryingUniformFixedValue;
fileName "FirstFace.dat";
outOfBounds clamp;
}
SecondFace
{
type timeVaryingUniformFixedValue;
fileName "SecondFace.dat";
outOfBounds clamp;
}
...
But this looks quite not-staight forward... Is there any possibility of doing this somehow more easily? Something like defining two values in the nonundiform list for each Boundary-Surface-Element? My hope would be that the first value would be interpreted as value for start time of the calculation and the second one as end time-value or something like this. Between the two there should be something like linear interpolation of the values. Also defining values for defined times of the simulation would be fine.

Whatever, you see I'm really lost in this thing.

Thanks for any kind of help!


All times are GMT -4. The time now is 01:32.