CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Initial conditions and boundary conditions

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

Like Tree1Likes
  • 1 Post By Yann

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 14, 2019, 10:30
Default Initial conditions and boundary conditions
  #1
Senior Member
 
Raza Javed
Join Date: Apr 2019
Posts: 112
Rep Power: 2
Raza Javed is on a distinguished road
Hello Everyone,


I have one question relating to initial conditions and boundary conditions.


I am using chtMultiRegionSimpleFoam and my openfoam version is 4.1.


I am putting my boundary conditions for pressure, velocity and temperature in system/region_name/changeDictionaryDict.


And I also have p, T and U in '0' directory. what are these files? Are they initial conditions? because in openfoam tutorials, some cases don't have this system/region_name/changeDictionaryDict, and they are putting boundary conditions in 0 directory.



I am little bit confused here that where to assign boundary conditions and where initial conditions?


And is it necessary that the format of entries in changeDictionaryDict be same as entries in 0 directory?


for example, if I talk about temperature,
The temperature boundary condition entry in my changeDictionaryDict is below:


changeDictionaryDict


Code:
T
{
    internalField   uniform 300;

    boundaryField
    {
        inlet
        {
            type            fixedValue;
            value           $internalField;
            
        }

        outlet
        {
            type            zeroGradient;
            value           $internalField;
        }
        "fluid_to_box"
        {
            type            compressible::turbulentTemperatureCoupledBaffleMixed;
            Tnbr            T;
            kappaMethod     fluidThermo;
            value           uniform 300;
        }
    }
}

And in the zero directory, it is as follows:


0/T:

Code:
dimensions      [0 0 0 1 0 0 0];

internalField   uniform 300;

boundaryField
{
    ".*"
    {
        type            calculated;
        value           uniform 300;
    }

    frontAndBack
    {
        type            empty;
    }

}

I shall be very thankful if someone can help me in understanding this.


Thank you
Raza Javed is offline   Reply With Quote

Old   June 20, 2019, 02:40
Default
  #2
New Member
 
ingraban's Avatar
 
Ingo Riess
Join Date: Jun 2019
Location: Switzerland
Posts: 12
Rep Power: 2
ingraban is on a distinguished road
For an explanation of the content of the "0"-folder (initial conditions), there is a youtube tutorial here:
https://www.youtube.com/watch?v=qfX_bJUjdOk&t=98s

Actually, I did not come across the changeDictionaryDict in my endeavours to learn OpenFoam.
ingraban is offline   Reply With Quote

Old   June 20, 2019, 03:42
Default
  #3
Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 57
Rep Power: 9
Yann is on a distinguished road
This is something specific to the chtMultiRegion tutorials. In several of these tutorials, it starts with a series of default variable files (p, U, T, etc) in the 0 folder and the changeDictionary function is used to edit these files to set the appropriate boundary conditions for each region.



The changeDictionaryDict snippet you have posted basically says that when you execute the changeDictionary command, it will modify the 0/region_name/T file with the values from the changeDictionaryDict.
The other (simpler) way to do it is to directly write the values in the 0/region_name/T.



For most of the solvers, boundary conditions / initialisation values are in the 0 folder, each variable having its own file.

chtMultiRegion is different because well... there are several regions, each one having its own set of boundary conditions. This is why there are 0/region_name folders.


I suggest you to read the Allrun scripts to see what is the workflow to run the case in order to understand which operations are performed.
ingraban likes this.
Yann is offline   Reply With Quote

Old   June 20, 2019, 05:01
Default
  #4
Senior Member
 
Raza Javed
Join Date: Apr 2019
Posts: 112
Rep Power: 2
Raza Javed is on a distinguished road
Quote:
Originally Posted by Yann View Post
This is something specific to the chtMultiRegion tutorials. In several of these tutorials, it starts with a series of default variable files (p, U, T, etc) in the 0 folder and the changeDictionary function is used to edit these files to set the appropriate boundary conditions for each region.



The changeDictionaryDict snippet you have posted basically says that when you execute the changeDictionary command, it will modify the 0/region_name/T file with the values from the changeDictionaryDict.
The other (simpler) way to do it is to directly write the values in the 0/region_name/T.



For most of the solvers, boundary conditions / initialisation values are in the 0 folder, each variable having its own file.

chtMultiRegion is different because well... there are several regions, each one having its own set of boundary conditions. This is why there are 0/region_name folders.


I suggest you to read the Allrun scripts to see what is the workflow to run the case in order to understand which operations are performed.

Hi,


Thank you so much for your reply.


Yes you are right about the functionality of changeDictionaryDict.



what actually happens is that, when I RUN the Allclean , then in 0 folder only the files U,T,p,epsilon,k,aphat etc left. No region folders inside because I cleaned everything.



for example, I am putting the U file from 0 directory, all others are also same.



0/U:


Code:
dimensions      [0 1 -1 0 0 0 0];

internalField   uniform (0 0 0);


boundaryField
{

    ".*"
    {
        type            calculated;
        value           uniform (0 0 0);
    }
}
After cleaning, when I RUN the Allrun, then the region folders get generated into the 0 directory, each region folder having all parameters(U,T,p,epsilon etc) in this. And each file has the boundary conditions that I have put in system/region_folder/changeDictionaryDict.



This is understandable.


Now, the confusion is, where are we putting the initial values for our simulation?
Raza Javed is offline   Reply With Quote

Old   June 20, 2019, 05:20
Default
  #5
New Member
 
ingraban's Avatar
 
Ingo Riess
Join Date: Jun 2019
Location: Switzerland
Posts: 12
Rep Power: 2
ingraban is on a distinguished road
Do you have one folder "region_name" or do you use the region_name as a wildcard for the various regions in your model?

If you look in the tutorials of chtMultiRegionFoam/multiRegionHeater, you'll find multiple files changeDicionaryDict in the various folders per region. Each changeDicionaryDict contains the initial conditions for one region. The Allrun.pre script creates the BC for the "0"-Folder.
ingraban is offline   Reply With Quote

Old   June 20, 2019, 05:23
Default
  #6
Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 57
Rep Power: 9
Yann is on a distinguished road
The initial values for each variable are located in the 0/region_name folder.
From your previous example of the T file:

Code:
internalField   uniform 300;

This means the internalField, aka the volume mesh, has an initial temperature set to 300K

Then, you have the same thing on walls/patches :

Code:
        outlet
        {
            type            zeroGradient;
            value           $internalField;
        }

The boundary condition on the outlet patch is a type zeroGradient and the initial value in the same as the one set for the internalField : 300K.

Depending on the nature of the boundary condition, the "value" entry can ether be an initial value which will be overwritten at the first time step, or a value which will remain during the simulation, for instance with the fixedValue boundary condition:

Code:
        inlet
        {
            type            fixedValue;
            value           $internalField;
            
        }

Here the inlet patch is set to a fixedValue of 300K and it won't change during simulation.
Yann is offline   Reply With Quote

Old   June 20, 2019, 05:26
Default
  #7
Senior Member
 
Raza Javed
Join Date: Apr 2019
Posts: 112
Rep Power: 2
Raza Javed is on a distinguished road
Quote:
Originally Posted by ingraban View Post
Do you have one folder "region_name" or do you use the region_name as a wildcard for the various regions in your model?

I am using region_name as a wildcard for various regions(box, fluid etc.)


Quote:
If you look in the tutorials of chtMultiRegionFoam/multiRegionHeater, you'll find multiple files changeDicionaryDict in the various folders per region. Each changeDicionaryDict contains the initial conditions for one region. The Allrun.pre script creates the BC for the "0"-Folder.

Yes I checked now, and in each region, it has changeDictionaryDict, in that file is it defining boundary conditions OR initial conditions?
Raza Javed is offline   Reply With Quote

Old   June 20, 2019, 05:33
Default
  #8
New Member
 
ingraban's Avatar
 
Ingo Riess
Join Date: Jun 2019
Location: Switzerland
Posts: 12
Rep Power: 2
ingraban is on a distinguished road
both

internalField = initial condition
boundaryField = boundary condition

link

I know, I am looking at and quoting different versions of OpenFoam, but that shouldn't matter here.
ingraban is offline   Reply With Quote

Old   June 20, 2019, 05:45
Default
  #9
Senior Member
 
Raza Javed
Join Date: Apr 2019
Posts: 112
Rep Power: 2
Raza Javed is on a distinguished road
Quote:
Originally Posted by ingraban View Post
both

internalField = initial condition
boundaryField = boundary condition

Yes. That is exactly I wanted to know. It's clear now.


Thank you so much.
Raza Javed is offline   Reply With Quote

Old   June 20, 2019, 05:46
Default
  #10
Senior Member
 
Raza Javed
Join Date: Apr 2019
Posts: 112
Rep Power: 2
Raza Javed is on a distinguished road
Quote:
Originally Posted by Yann View Post
The initial values for each variable are located in the 0/region_name folder.
From your previous example of the T file:

Code:
internalField   uniform 300;
This means the internalField, aka the volume mesh, has an initial temperature set to 300K

Then, you have the same thing on walls/patches :

Code:
        outlet
        {
            type            zeroGradient;
            value           $internalField;
        }
The boundary condition on the outlet patch is a type zeroGradient and the initial value in the same as the one set for the internalField : 300K.

Depending on the nature of the boundary condition, the "value" entry can ether be an initial value which will be overwritten at the first time step, or a value which will remain during the simulation, for instance with the fixedValue boundary condition:

Code:
        inlet
        {
            type            fixedValue;
            value           $internalField;
            
        }
Here the inlet patch is set to a fixedValue of 300K and it won't change during simulation.



Yes. Now, I got it. Thank you so much.
Raza Javed is offline   Reply With Quote

Reply

Tags
boundary conditions, initial conditions, openfoam

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Wrong multiphase flow at rotating interface Sanyo CFX 14 February 7, 2017 17:19
simpleFoam error - "Floating point exception" mbcx4jc2 OpenFOAM Running, Solving & CFD 12 August 4, 2015 02:20
transsonic nozzle with rhoSimpleFoam Unseen OpenFOAM Running, Solving & CFD 7 April 16, 2014 03:38
Low Mixing time Problem Mavier CFX 5 April 29, 2013 00:00
mesh file for flow over a circular cylinder Ardalan Main CFD Forum 6 April 17, 2010 23:40


All times are GMT -4. The time now is 16:45.