CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

Defining elementwise boundary conditions

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By Daniel_Jung

Reply
 
LinkBack Thread Tools Display Modes
Old   September 27, 2010, 07:31
Default Defining elementwise boundary conditions
  #1
New Member
 
Daniel
Join Date: Sep 2010
Posts: 10
Rep Power: 6
Daniel_Jung is on a distinguished road
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!
Daniel_Jung is offline   Reply With Quote

Old   September 27, 2010, 11:58
Default
  #2
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 397
Rep Power: 12
marupio is on a distinguished road
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.
marupio is offline   Reply With Quote

Old   September 28, 2010, 02:57
Default
  #3
New Member
 
Daniel
Join Date: Sep 2010
Posts: 10
Rep Power: 6
Daniel_Jung is on a distinguished road
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?
Daniel_Jung is offline   Reply With Quote

Old   September 28, 2010, 07:56
Default
  #4
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 397
Rep Power: 12
marupio is on a distinguished road
Why can't you use a fixed value boundary condition?
marupio is offline   Reply With Quote

Old   September 28, 2010, 08:33
Default
  #5
New Member
 
Daniel
Join Date: Sep 2010
Posts: 10
Rep Power: 6
Daniel_Jung is on a distinguished road
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?
Daniel_Jung is offline   Reply With Quote

Old   September 28, 2010, 09:36
Default
  #6
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 397
Rep Power: 12
marupio is on a distinguished road
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?
marupio is offline   Reply With Quote

Old   September 28, 2010, 09:56
Default
  #7
New Member
 
Daniel
Join Date: Sep 2010
Posts: 10
Rep Power: 6
Daniel_Jung is on a distinguished road
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...
Daniel_Jung is offline   Reply With Quote

Old   September 28, 2010, 11:10
Default
  #8
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 397
Rep Power: 12
marupio is on a distinguished road
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
marupio is offline   Reply With Quote

Old   October 19, 2010, 04:28
Default
  #9
New Member
 
Daniel
Join Date: Sep 2010
Posts: 10
Rep Power: 6
Daniel_Jung is on a distinguished road
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...
Daniel_Jung is offline   Reply With Quote

Old   October 19, 2010, 04:39
Default
  #10
Senior Member
 
Join Date: Mar 2009
Posts: 225
Rep Power: 9
paka is on a distinguished road
I'm not sure, but shouldn't you use 'internalField' instead of 'value'?
paka is offline   Reply With Quote

Old   October 19, 2010, 05:23
Default
  #11
New Member
 
Daniel
Join Date: Sep 2010
Posts: 10
Rep Power: 6
Daniel_Jung is on a distinguished road
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 is offline   Reply With Quote

Old   October 19, 2010, 05:29
Default
  #12
New Member
 
Daniel
Join Date: Sep 2010
Posts: 10
Rep Power: 6
Daniel_Jung is on a distinguished road
Oh, I just found the solution:
after the elementwise-definitions and the closing bracket ")" I was missing an ";"
Tobias Adam likes this.
Daniel_Jung is offline   Reply With Quote

Old   November 24, 2010, 05:50
Default
  #13
New Member
 
Daniel
Join Date: Sep 2010
Posts: 10
Rep Power: 6
Daniel_Jung is on a distinguished road
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!
Daniel_Jung is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
non reflective boundary conditions for incompresible flow Pascal_doran OpenFOAM Programming & Development 15 August 7, 2014 05:55
Impinging Jet Boundary Conditions Anindya Main CFD Forum 24 January 11, 2012 14:40
boundary conditions and mesh exporting vaina74 Open Source Meshers: Gmsh, Netgen, CGNS, ... 2 May 27, 2010 09:38
Update boundary conditions calculated by an external program CedricVH OpenFOAM 2 January 15, 2010 12:55
A problem about setting boundary conditions lyang Main CFD Forum 0 September 19, 1999 18:29


All times are GMT -4. The time now is 14:17.