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

Weird interpolation using TimeVaryingMappedFixedValue

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

Reply
 
LinkBack Thread Tools Display Modes
Old   January 8, 2013, 09:45
Default Weird interpolation using TimeVaryingMappedFixedValue
  #1
New Member
 
Join Date: Dec 2012
Posts: 3
Rep Power: 2
CFD_Monkey is on a distinguished road
Hello everybody,

to get time and space dependent inlet boundary conditions I'm using TimeVaryingMappedFixedValue. Unfortunately I get kind of weird distribution of the velocity at the inlet patch.

I create point map and velocity map via octave.
To show you the problem I've made two examples. In both cases I prospect a cube with a equidistant mesh of 35x35x35. For the inlet patch I create 35 x 35 equidistant velocity values such that in each cell center the velocity is given. (And actually no interpolation is needed)

1. The velocity is a step function: 2 m/s within 7 cells next to the wall; 10 m/s in the middle.

octave output:
https://dl.dropbox.com/u/48415338/pr...tep_octave.png

velocity distribution after solving at the inlet patch:
https://dl.dropbox.com/u/48415338/pr...p_paraView.png


2. In this example there is no problem (velocity = x + y)

octave output:
https://dl.dropbox.com/u/48415338/no_problem_octave.png

velocity distribution after solving at the inlet patch:
https://dl.dropbox.com/u/48415338/no...m_paraView.png

So in cases of huge velocity gradient such as in ex. 1 I always get this kind of stripes. (I also have done some additional examples)


Maybe I have to change some settings in the U file where I call TimeVaryingMappedFixedValue?!

type timeVaryingMappedFixedValue;
setAverage off;



I would be grateful for any idea what's going on here.

Thank you very much!


Best regards

Heiko
CFD_Monkey is offline   Reply With Quote

Old   January 27, 2013, 09:31
Default
  #2
New Member
 
Join Date: Dec 2012
Posts: 3
Rep Power: 2
CFD_Monkey is on a distinguished road
In order to make my problem more obvious I have created a short example:

I treat a cube with 4x4x4 meter and uniform cell dimensions 1x1 meter. Now I want to show you the relevant files for the TimeVaryingMappedFixedValue. If there are more files which are addressed by TimeVaryingMappedFixedValue please let me know.

The inlet patch is placed at x=0 such that the inlet is y=0 to y=4 and z=0 und z=4 with stream direction in +x.

points file in boundaryData/inlet:
(the points are placed at the center of the inlet patch cells)

Code:
FoamFile
{
    version    2.0;
    format    ascii;
    class    vectorField;
    object    points;
}

(
//z = 0.500000:

(0 0.500000 0.500000)
(0 1.500000 0.500000)
(0 2.500000 0.500000)
(0 3.500000 0.500000)

//z = 1.500000:

(0 0.500000 1.500000)
(0 1.500000 1.500000)
(0 2.500000 1.500000)
(0 3.500000 1.500000)

//z = 2.500000:

(0 0.500000 2.500000)
(0 1.500000 2.500000)
(0 2.500000 2.500000)
(0 3.500000 2.500000)

//z = 3.500000:

(0 0.500000 3.500000)
(0 1.500000 3.500000)
(0 2.500000 3.500000)
(0 3.500000 3.500000)
)
The associated velocity values in boundaryData/inlet/0 are shown below. There are now further time directories.

Code:
FoamFile
{
    version    2.0;
    format    ascii;
    class    vectorAverageField;
    object    values;
}

(0 0 0)

16
(
//z = 0.500000:

(2.000000 0 0)
(2.000000 0 0)
(2.000000 0 0)
(2.000000 0 0)

//z = 1.500000:

(4.000000 0 0)
(4.000000 0 0)
(4.000000 0 0)
(4.000000 0 0)

//z = 2.500000:

(4.000000 0 0)
(4.000000 0 0)
(4.000000 0 0)
(4.000000 0 0)

//z = 3.500000:

(2.000000 0 0)
(2.000000 0 0)
(2.000000 0 0)
(2.000000 0 0)
)
The values for k and epsilon are constant with k=3 and epsilon = 300. I think they are not relevant for the velocity boundary inlet condition.

In the 0 boundary directory in the main folder of the case, I call the TimeVaryingMappedFixedValue by:

Code:
inlet
    {
        type            timeVaryingMappedFixedValue;
        setAverage      off;
    }
So if there are some additional commands needed please let me know.

Finally the results for the inlet at time 1 after solving the case with simpleFoam:

Code:
boundaryField
{
    inlet
    {
        type            timeVaryingMappedFixedValue;
        setAverage      0;
        peturb          1e-05;
        value           nonuniform List<vector>
16
(
(2 0 0)               
(2 0 0)
(2.00005 0 0)
(2 0 0)
(3.99998 0 0)
(4 0 0)
(4 0 0)
(4 0 0)
(3.00001 0 0)
(4 0 0)
(3.99997 0 0)
(3.73515 0 0)
(2 0 0)
(2 0 0)
(2.00001 0 0)
(2 0 0)
);
As you can see the values for cell 8 (value about 3) and cell 11 (value about 3.7) don't fit to my values in boundaryData/inlet/0/U apart from the perturbation.

I'm still hoping that I made a stupid mistake. So if you have any idea what's wrong please let me know.


The hole test case is also attached to this post.




BIG THX
Attached Files
File Type: zip test.zip (37.5 KB, 5 views)
CFD_Monkey is offline   Reply With Quote

Old   May 3, 2013, 05:13
Default
  #3
Senior Member
 
Julien
Join Date: Jun 2012
Location: France
Posts: 139
Rep Power: 2
Djub is on a distinguished road
Hi Heiko,

Did you solve out your problem?
I am not an expert, but I successfully used timeVaryingMappedFixedValue , so maybe I can bring some help...

First of all, it seems that this boundary condition is very powerful since it can interpolate in time and space: thus, you do not need to take care about the space grid and time steps. Foam will interpolate (I suppose by linear interpolation ?) from the given data to the needed points and time steps. You just need to check that your data "cover" the needed points : the first boundary data must be before (or equal) first calculation time step, and the boundary data map larger (or equal) to the patch with boundary condition 'timeVaryingMappedFixedValue '.

I don't see any "mistake" in your files, but I have some suggestions:
  • I had once a problem of "ugly" inlet, a bit like your second picture (in second post): the reason was an incorrect numbering order between my inlet file (boundaryData/inlet/0...) and my geometry file (boundaryData/inlet/points). The "diagonals" in your picture look a bit like this (4 points in one line, interpreted as 5 points, so a shift of 1 point by line)
  • A second idea is about time steps (in your first post): you gave us the boundary map at time 0, saying you have other time folders, and you show us the result at time step 1s: maybe the interpolation of maps between time 0 and time XXX (the next after 1s) makes this field?
  • In your second post, first example (the one which doesn't work): Your inlet with sharp steps (discontinuities) seems to be physically impossible. You solve Navier-Stokes between two physically impossible forced states; I don't know the behavior between these two steps ! Maybe you should define a smoother inlet condition, more realistic, to avoid this numerical problems.
In my case, I used a first Foam calculation in order to construct my time varying inlet. In my controlDict, I exported the (future) inlet using a function, type surfaces, surfaceFormat foamFile, with interpolate false. The output is not convenient, because in each output time step there is a large structure:
Code:
% - turbInletFields
% | - scalarField
% | | k
% | | p
% | | nuSgs
% | - Vectorfield
% | | U
% | faceCenters
% | faces
% | points
But a simple program (in Octave for instance) can deal with this and rearrange it in order to fit with timeVaryingMappedFixedValue . (Be careful! With this interpolation, the geometry needed by timeVaryingMappedFixedValue is "faceCenters" . And you have also to insert the Foam header in each file).

I think all these advices won't help you, Heiko, sorry. But maybe somebody else (Timo from Stuttgart ?) will find here some interesting information...

Sincerely,
Djub
Djub is offline   Reply With Quote

Reply

Tags
confusing, inlet, interplation, mappedfixedvalue, timevarying

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
Interpolation Error on FAM Mesh with Cyclic BCs ngj OpenFOAM Bugs 1 August 9, 2011 06:12
urgent help needed (rhie-chow interpolation problem) Ardalan Main CFD Forum 2 March 18, 2011 16:22
Help on 2D interpolation in StarCCM+ madhuri CD-adapco 0 November 3, 2010 15:21
Surface interpolation schemes and parallelization jutta OpenFOAM Running, Solving & CFD 0 February 25, 2010 14:32
momentum interpolation for collocated grid Hadian Main CFD Forum 4 December 25, 2009 07:25


All times are GMT -4. The time now is 21:42.