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

Initial Condition From Data File

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 20, 2017, 07:09
Exclamation Initial Condition From Data File
  #1
Member
 
FlyBob91's Avatar
 
Join Date: Mar 2016
Location: Bergamo
Posts: 72
Rep Power: 3
FlyBob91 is on a distinguished road
Hello to all,
I found this explanation to read data from file to set the initial condition

Code:
2.2.10 The #include and #inputMode directives
For example, let us say a user wishes to set an initial value of pressure once to be used as the internal field and initial value at a boundary. We could create a file, e.g. named initialConditions, which contains the following entries:

    pressure 1e+05; 
    #inputMode merge
In order to use this pressure for both the internal and initial boundary fields, the user would simply include the following macro substitutions in the pressure field file p:

    #include "initialConditions" 
    internalField uniform $pressure; 
    boundaryField 
    { 
        patch1 
        { 
            type fixedValue; 
            value $internalField; 
        } 
    }
This is a fairly trivial example that simply demonstrates how this functionality works. However, the functionality can be used in many, more powerful ways particularly as a means of generalising case data to suit the userís needs. For example, if a user has a set of cases that require the same RAS turbulence model settings, a single file can be created with those settings which is simply included in the turbulenceProperties file of each case. Macro substitutions can extend well beyond a single value so that, for example, sets of boundary conditions can be predefined and called by a single macro. The extent to which such functionality can be used is almost endless.
How can i modify these code to read a nonuniform vecotr field at my boundary? I want to set a non uniform field for the velocity boundary condition



Thanks for help
FlyBob91 is offline   Reply With Quote

Old   March 22, 2017, 06:43
Default
  #2
Member
 
FlyBob91's Avatar
 
Join Date: Mar 2016
Location: Bergamo
Posts: 72
Rep Power: 3
FlyBob91 is on a distinguished road
Ok, i found the solution to the problem.

First, create the file where you want to store your velocity field. The file must have this format

Code:
velocityProfile         // name of your velocity prfoile
List<vector>
300                         // number of vectors (points)
(
(Ux Uy Uz)
.....
(Ux Uy Uz)
);
Second, put this file in the 0 directory (suppose to name it "inletCondition").
Now open the U file


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

internalField   uniform (0 0 0);

#include "inletCondition"

boundaryField
{
    inlet
    {
        type            fixedValue;
        value          nonuniform $velocityProfile;
    }

// ...... other boundary conditions

}
FlyBob91 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
chtMultiRegionSimpleFoam: maximum number of iterations excedeed. Nkl OpenFOAM Running, Solving & CFD 18 February 16, 2016 12:42
Cannot run the code properly: very large time step continuity error crst15 OpenFOAM Running, Solving & CFD 9 December 14, 2014 19:17
centOS 5.6 : paraFoam not working yossi OpenFOAM Installation 2 October 9, 2013 01:41
calculation stops after few time steps sivakumar OpenFOAM Running, Solving & CFD 7 March 17, 2013 07:37
pisoFoam with k-epsilon turb blows up - Some questions Heroic OpenFOAM Running, Solving & CFD 26 December 17, 2012 04:34


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