|
[Sponsors] |
Weird interpolation using TimeVaryingMappedFixedValue |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 8, 2013, 10:45 |
Weird interpolation using TimeVaryingMappedFixedValue
|
#1 |
New Member
Join Date: Dec 2012
Posts: 7
Rep Power: 13 |
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 |
|
January 27, 2013, 10:31 |
|
#2 |
New Member
Join Date: Dec 2012
Posts: 7
Rep Power: 13 |
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) ) 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) ) In the 0 boundary directory in the main folder of the case, I call the TimeVaryingMappedFixedValue by: Code:
inlet { type timeVaryingMappedFixedValue; setAverage off; } 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) ); 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 |
|
May 3, 2013, 06:13 |
|
#3 |
Senior Member
Julien
Join Date: Jun 2012
Location: France
Posts: 152
Rep Power: 14 |
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:
Code:
% - turbInletFields % | - scalarField % | | k % | | p % | | nuSgs % | - Vectorfield % | | U % | faceCenters % | faces % | points 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 |
|
June 27, 2013, 12:39 |
|
#4 |
New Member
Join Date: Dec 2012
Posts: 7
Rep Power: 13 |
Hi everyone,
@Djub: sorry for replying so late and thanks for your answer. I tried to fix the problem by your suggestions but indeed I couldn't make it. Recently I manipulated the data of a cuttingPlane and created the corresponding files for timeVaryingMappedFixedValue for an other simulation. In this case I didn't run into trouble using timeVaryingMappedFixedValue, even if I change the grid steps. A close look to the data written by the cuttingPlane shows that the value is written at two points per cell. Maybe this helps for creating the input files "by hand". You can also try to run the case with any inlet BC and write any Field value with cuttingPlane just to get the points. Of course you have to manipulate your input data to match up with this points which is not very convenient. If anyone get any progress or insight, please let me know. Cheers |
|
May 21, 2014, 10:35 |
|
#5 |
Member
Niu
Join Date: Apr 2014
Posts: 55
Rep Power: 12 |
Dear Julien,
I'm also using TimeVaryingMappedFixedValue to supply velocity of inlet of a channel, but there are too much time steps need to be convert the format that TimeVaryingMappedFixedValue could use. Do you have a quick way to achieve it ? |
|
May 22, 2014, 09:41 |
|
#6 | |
Senior Member
Julien
Join Date: Jun 2012
Location: France
Posts: 152
Rep Power: 14 |
Dear Niu,
Quote:
In my process, I don't have to "convert" any data. I just change the name and position of the files, adding a header. But the data is still in ASCII format, same numbering as the Foam output. If you need further help, please be more precise in your question. |
||
May 22, 2014, 12:10 |
|
#7 |
Member
Niu
Join Date: Apr 2014
Posts: 55
Rep Power: 12 |
Dear Julien,
I'm so sorry for my bad explanation for my queation. In my works, I need to simulate transient procesure of channel1 and channel2 separately. the outlet velocity of channel1 at every time step is mapped to inlet of channel2 via TimeVaryingMappedFixedValue bc. the case of channel1 at least has thousands of timesteps, which means I must add foam header to thousands of U profiles. This is a huge work! How do you deal it? Would you mind sharing your case with me? Thank you very much! Best regards! Z.Q. Niu |
|
May 23, 2014, 10:36 |
|
#8 | |
Senior Member
Julien
Join Date: Jun 2012
Location: France
Posts: 152
Rep Power: 14 |
Eh eh... Yes you're right, this is a huge work done by hand. This is why I wrote:
Quote:
Code:
#!/bin/sh mkdir inlet_ready cd ouput_from_first_calculation first_dir=`ls | head -1` cd $first_dir/name_of_mapping cp faceCentres ../../../inlet_ready cd ../../../inlet_ready mv faceCentres points sed -i '1cFoamFile{version 2.0; format ascii; class vectorField; object points;}' points cd ../output_from_first_calculation all_dir=`ls | wc -l` for rep in * do mkdir ../inlet_ready/$rep cp $rep/name_of_mapping/vectorField/U ../inlet_ready/$rep sed -i '1cFoamFile{version 2.0; format ascii; class vectorAverageField; object values;} (0 0 0)' ../inlet_ready/$rep/U cp $rep/name_of_mapping/scalarField/p ../inlet_ready/$rep sed -i '1cFoamFile{version 2.0; format ascii; class scalarAverageField; object values;} 0' ../inlet_ready/$rep/p ... (etc... all the fields you need) ... done 'hope this can help |
||
May 28, 2014, 14:16 |
|
#9 |
Member
Niu
Join Date: Apr 2014
Posts: 55
Rep Power: 12 |
Dear Julien,
Thank your sharing your code very much! I has tried to use this bash, but I have some confusion about the path of dictionary in this code, would you mind attaching a completed bash ? Best regards! Z.Q. Niu |
|
May 30, 2014, 11:32 |
|
#10 |
Senior Member
Julien
Join Date: Jun 2012
Location: France
Posts: 152
Rep Power: 14 |
OK. Let's be a bit more precise. First, I ran a first computation (precursor), with an "auto export" of the field in my controlDict:
Code:
functions { output_from_first_calculation { type surfaces; enabled true; outputControl timeStep; outputInterval 1; interpolationScheme cell; surfaceFormat foamFile; fields ( p U ); //all your needed fields surfaces ( name_of_mapping { type patch; patches ( the_outlet ); interpolate false; triangulate false; } ); } } In your case, at the same place as your system and constant folders, FOAM will create a folder named ouput_from_first_calculation. This folder will contain a huge number of folders, each one with its timestamp as name. Each one of these folders will contain a unique folder named name_of_mapping. This folder will contain some geometry files (faceCenters, faces and points), and two folders or more (depending on what you asked for) (scalarField and vectorField). These two last folders will contain the fields themselves, named p, U, etc... My batch is supposed to be located at the top of your case, in the same place as system and constant. If this is not detailed enough, please ask specific questions. Regards |
|
July 21, 2016, 18:58 |
|
#11 | |
Senior Member
Ehsan Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18 |
Quote:
Have you tried to run your script while you are simulating precursor domain?! Is it possible to run it simultaneously? Thanks, Syavash |
||
Tags |
confusing, inlet, interplation, mappedfixedvalue, timevarying |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help on 2D interpolation in StarCCM+ | madhuri | Siemens | 1 | May 30, 2017 04:20 |
Interpolation Error on FAM Mesh with Cyclic BCs | ngj | OpenFOAM Bugs | 1 | August 9, 2011 07:12 |
urgent help needed (rhie-chow interpolation problem) | Ardalan | Main CFD Forum | 2 | March 18, 2011 16:22 |
Surface interpolation schemes and parallelization | jutta | OpenFOAM Running, Solving & CFD | 0 | February 25, 2010 15:32 |
momentum interpolation for collocated grid | Hadian | Main CFD Forum | 4 | December 25, 2009 08:25 |