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

How to use result of one simulation as a Boundary Condition in another simulation?

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 7, 2016, 04:12
Default How to use result of one simulation as a Boundary Condition in another simulation?
  #1
Member
 
Saurav Kumar
Join Date: Jul 2016
Posts: 80
Rep Power: 10
srv537 is on a distinguished road
i want to simulation 3D Backward facing step for which i need fully developed profile in 3D channel, i have simulated 3D channel flow but how can i use velocity profile on outlet surface as a inlet condition for velocity in Backward facing step simulation.

i am using OF4, pisoFoam.

Thank you
lpz456 likes this.
srv537 is offline   Reply With Quote

Old   December 10, 2016, 04:44
Default
  #2
Senior Member
 
Join Date: Sep 2015
Location: Singapore
Posts: 102
Rep Power: 11
usv001 is on a distinguished road
Hi there,

You can use the sample utility to extract the necessary patch fields or simply copy the 'value' entry of each field from the outlet patch boundaryField sub-dictionary. Then, use a 'fixedValue' boundary condition with the value being whatever you extracted or copied. Note that you need to have the correct identifier preceding the value:

Code:
inlet
{
   type   fixedValue;
   value  nonuniform List<scalar>
100
(
value1
value2
...
value100
);
}
nonuniform List<scalar> 100(copied values);. For convenience, you may want to place this in a separate file and use the "#include" preprocessor to include this file in the 'value' entry:

Code:
inlet
{
   type   fixedValue;
   value  #include "dataFile";
}
where dataFile contains:

Code:
nonuniform List<scalar>
100
(
value1
value2
...
value100
);
lpz456 likes this.
usv001 is offline   Reply With Quote

Old   December 10, 2016, 06:19
Default
  #3
Member
 
Saurav Kumar
Join Date: Jul 2016
Posts: 80
Rep Power: 10
srv537 is on a distinguished road
Quote:
Originally Posted by usv001 View Post
Hi there,

You can use the sample utility to extract the necessary patch fields or simply copy the 'value' entry of each field from the outlet patch boundaryField sub-dictionary. Then, use a 'fixedValue' boundary condition with the value being whatever you extracted or copied. Note that you need to have the correct identifier preceding the value:

Code:
inlet
{
   type   fixedValue;
   value  nonuniform List<scalar>
100
(
value1
value2
...
value100
);
}
nonuniform List<scalar> 100(copied values);. For convenience, you may want to place this in a separate file and use the "#include" preprocessor to include this file in the 'value' entry:

Code:
inlet
{
   type   fixedValue;
   value  #include "dataFile";
}
where dataFile contains:

Code:
nonuniform List<scalar>
100
(
value1
value2
...
value100
);


Thank you usv001 for your valuable suggestion.
srv537 is offline   Reply With Quote

Old   December 11, 2016, 10:59
Default
  #4
Member
 
Saurav Kumar
Join Date: Jul 2016
Posts: 80
Rep Power: 10
srv537 is on a distinguished road
Quote:
Originally Posted by usv001 View Post
Hi there,

You can use the sample utility to extract the necessary patch fields or simply copy the 'value' entry of each field from the outlet patch boundaryField sub-dictionary. Then, use a 'fixedValue' boundary condition with the value being whatever you extracted or copied. Note that you need to have the correct identifier preceding the value:

Code:
inlet
{
   type   fixedValue;
   value  nonuniform List<scalar>
100
(
value1
value2
...
value100
);
}
nonuniform List<scalar> 100(copied values);. For convenience, you may want to place this in a separate file and use the "#include" preprocessor to include this file in the 'value' entry:

Code:
inlet
{
   type   fixedValue;
   value  #include "dataFile";
}
where dataFile contains:

Code:
nonuniform List<scalar>
100
(
value1
value2
...
value100
);


i tried both the method with dataFile and without dataFile (direct) but inboth cases i got the same Error

--> FOAM FATAL IO ERROR:
Expected a ')' or a '}' while reading List, found on line 12003 the punctuation token '('

file: /home/srv/OpenFOAM/srv-4.1/run/test/Re400inletchennelprofile/0/dataFile at line 12003.

From function char Foam::Istream::readEndList(const char*)
in file db/IOstreams/IOstreams/Istream.C at line 155.

FOAM exiting

dataFile is

nonuniform List<vector>
11999
(
(0.904204 0.0278718 0)
(0.315227 0.000666436 0)
.
.
.
(0.242041 -7.46415e-08 0)
(0.242014 -7.92015e-08 0)
(0.241989 -7.74893e-08 0)
(0.241962 -7.8455e-08 0)
(0.241932 -8.07493e-08 0)
(0.241902 -8.49888e-08 0)
(0.241872 -8.51805e-08 0)
(0.241843 -7.30263e-08 0)
(0.241818 -7.71504e-08 0)
(0.241776 -8.3912e-08 0)
(0.241802 1.30619e-07 0)
(0.241692 -6.58878e-07 0)
)
;


and U file is



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

dimensions [0 1 -1 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{
inlet
{
type fixedValue;
value #include "dataFile";
}

outlet
{
type zeroGradient;
}

upperWall
{
type fixedValue;
value uniform (0 0 0);
}

lowerWall
{
type fixedValue;
value uniform (0 0 0);
}

frontAndBack
{
type empty;
}
}

// ************************************************** *********************** //


please help me.

Thank you
srv537 is offline   Reply With Quote

Old   December 11, 2016, 11:08
Default
  #5
Senior Member
 
Join Date: Sep 2015
Location: Singapore
Posts: 102
Rep Power: 11
usv001 is on a distinguished road
Hi Saurav,

Most likely, you are using the wrong number of entries. I think you have 12000 entries; not 11999. So, when reaching the last entry (11999th entry), OF expects a ')' signifying the end of the list but you have one more entry (12000th entry) which starts with a '('. Hence, you get the error.

If that doesn't work either, upload the files.

USV
usv001 is offline   Reply With Quote

Old   December 11, 2016, 12:22
Default
  #6
Member
 
Saurav Kumar
Join Date: Jul 2016
Posts: 80
Rep Power: 10
srv537 is on a distinguished road
Hi USV

first i tried with 12000 then i got some error then i changed it to 11999.

if you do not mind, could you please give me you email id i will send you case file please check it. i will be very thankful to you.

Saurav
srv537 is offline   Reply With Quote

Old   December 11, 2016, 12:25
Default
  #7
Senior Member
 
Join Date: Sep 2015
Location: Singapore
Posts: 102
Rep Power: 11
usv001 is on a distinguished road
Hi Saurav,

Exactly what error do you get when you tried 12000? By the way, you can directly upload the '0' file and 'dataFile' using the 'Manage Attachment' button below when you reply.

USV
usv001 is offline   Reply With Quote

Old   December 11, 2016, 12:31
Post
  #8
Member
 
Saurav Kumar
Join Date: Jul 2016
Posts: 80
Rep Power: 10
srv537 is on a distinguished road
here is files
Attached Files
File Type: gz Re400inletchennelprofile.tar.gz (3.8 KB, 11 views)
srv537 is offline   Reply With Quote

Old   December 11, 2016, 12:34
Default
  #9
Member
 
Saurav Kumar
Join Date: Jul 2016
Posts: 80
Rep Power: 10
srv537 is on a distinguished road
I am sorry i uploaded the wrong files
here it is
Attached Files
File Type: gz Re400inletchennelprofile.tar.gz (93.0 KB, 19 views)
srv537 is offline   Reply With Quote

Old   December 11, 2016, 12:37
Default
  #10
Senior Member
 
Join Date: Sep 2015
Location: Singapore
Posts: 102
Rep Power: 11
usv001 is on a distinguished road
The attachment does not contain the 'constant/polyMesh' folder. Please include it with the 'blockMeshDict' as well.

USV
usv001 is offline   Reply With Quote

Old   December 11, 2016, 12:40
Default
  #11
Member
 
Saurav Kumar
Join Date: Jul 2016
Posts: 80
Rep Power: 10
srv537 is on a distinguished road
Quote:
Originally Posted by usv001 View Post
The attachment does not contain the 'constant/polyMesh' folder. Please include it with the 'blockMeshDict' as well.

USV
blockMeshDic is in system folder, i have deleted polyMesh file because of mesh files it exceed the uploading limit of 195.3Kb.
srv537 is offline   Reply With Quote

Old   December 11, 2016, 12:50
Default
  #12
Senior Member
 
Join Date: Sep 2015
Location: Singapore
Posts: 102
Rep Power: 11
usv001 is on a distinguished road
Your inlet patch has 20 faces. So, the dataFile should contain a list containing 20 entries as well. The dataFile in the first attachment had 100 entries and the second attachment did not contain any dataFile.

USV
usv001 is offline   Reply With Quote

Old   December 11, 2016, 12:54
Default
  #13
Member
 
Saurav Kumar
Join Date: Jul 2016
Posts: 80
Rep Power: 10
srv537 is on a distinguished road
i have just started using openFoam, i cant able to understand what does it mean and what should i do?
please give me your suggestion to solve this problem

Saurav
srv537 is offline   Reply With Quote

Old   December 11, 2016, 13:09
Default
  #14
Member
 
Saurav Kumar
Join Date: Jul 2016
Posts: 80
Rep Power: 10
srv537 is on a distinguished road
HI USV
i got your point i have modified channel geometry and now both simulation have same number of patch but still i am getting same error.

saurav
Attached Files
File Type: gz new.tar.gz (93.5 KB, 16 views)
srv537 is offline   Reply With Quote

Old   December 11, 2016, 13:11
Default
  #15
Senior Member
 
Join Date: Sep 2015
Location: Singapore
Posts: 102
Rep Power: 11
usv001 is on a distinguished road
You inlet boundary patch has 20 faces. So, you need to specify in the dataFile a list that has the same number of entries:

Code:
nonuniform List<vector>
20
(
vector1
vector2
...
vector20
)
So, in your previous simulation (3D channel), the outlet boundary patch must contain the same number of faces as the inlet boundary patch of your current simulation (3D backward facing step). You can check the number of faces in the patches by using the 'checkMesh' command. Confirm this first and if possible, upload the latest time step U file from the 3D channel simulation.

USV
lpz456 likes this.
usv001 is offline   Reply With Quote

Old   December 11, 2016, 13:28
Default
  #16
Member
 
Saurav Kumar
Join Date: Jul 2016
Posts: 80
Rep Power: 10
srv537 is on a distinguished road
USV
thank you so much, now it is working fine.

Sauarv
lpz456 likes this.
srv537 is offline   Reply With Quote

Old   December 14, 2016, 06:38
Default
  #17
New Member
 
Join Date: Oct 2016
Posts: 22
Rep Power: 10
Mahe88 is on a distinguished road
Hello,

I have a question regarding your topic.

Isn't the mapFields command doing just the same thing without copying files?!

regards!
Mahe88 is offline   Reply With Quote

Old   January 7, 2017, 10:34
Default
  #18
Member
 
Saurav Kumar
Join Date: Jul 2016
Posts: 80
Rep Power: 10
srv537 is on a distinguished road
Quote:
Originally Posted by Mahe88 View Post
Hello,

I have a question regarding your topic.

Isn't the mapFields command doing just the same thing without copying files?!

regards!
Hi Mahe88,
first of all i want to say sorry for late reply, could you please tell me how can we use mapFields to use one simulation result as a boundary condition for another simulation?
i dont know anything about mapFields so please describe in detail.

Thank you
srv537 is offline   Reply With Quote

Old   January 11, 2017, 07:12
Default
  #19
New Member
 
Join Date: Oct 2016
Posts: 22
Rep Power: 10
Mahe88 is on a distinguished road
Hey,
after rereading this post, I am not sure if mapFields is the right command for your task.

I use mapFields to initialize a simulation with results from a different one. Most of the time it is the same Mesh and Domain and I change the solver or turbulence model.

However I think it is maybe possible to just map a patch on another patch and then you'll have the new boundary conditions?

You can find the mapFields command in the Standard Utilities and here:

http://cfd.direct/openfoam/user-guide/mapfields/

hope this helps!

regards!
Mahe88 is offline   Reply With Quote

Old   May 20, 2020, 20:58
Default
  #20
Senior Member
 
Arijit Saha
Join Date: Feb 2019
Location: Singapore
Posts: 132
Rep Power: 7
ari003 is on a distinguished road
Quote:
Originally Posted by usv001 View Post
You inlet boundary patch has 20 faces. So, you need to specify in the dataFile a list that has the same number of entries:

Code:
nonuniform List<vector>
20
(
vector1
vector2
...
vector20
)
So, in your previous simulation (3D channel), the outlet boundary patch must contain the same number of faces as the inlet boundary patch of your current simulation (3D backward facing step). You can check the number of faces in the patches by using the 'checkMesh' command. Confirm this first and if possible, upload the latest time step U file from the 3D channel simulation.

USV
Your post was very helpful but I ve another issue. I ve seen that the number of velocity should match with the number of faces but I m getting the output velocity as equal to the number of points(which is not the face center value). I m using OF7 which doesnt have sampledict folder. Is there any way by which I can get the output velocity corresponding to the face center?
ari003 is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 08:38
Change a boundary condition based on simulation result and recompute the simulation Robin.Kamenicky CFX 1 March 7, 2017 19:35
Domain Imbalance HMR CFX 5 October 10, 2016 06:57
turbineSiting tutorial: slip condition at top boundary gives unexpected result letzel OpenFOAM 0 June 6, 2014 06:25
Convective Heat Transfer - Heat Exchanger Mark CFX 6 November 15, 2004 16:55


All times are GMT -4. The time now is 06:27.