Difference between revisions of "Sig Numerical Optimization / Scripting and automatic post-processing"

From OpenFOAMWiki
(Created page with "After running a bunch of simulations I got bored with stupid errors like forgetting to change patch type in boundery file, waiting decomposePar or reconstructPar, running few...")
 
(OpenFOAM's little helpers)
Line 9: Line 9:
  
 
This script reads patches names so their names should have specific string inside them.
 
This script reads patches names so their names should have specific string inside them.
You can easily change what will these strings be by adding/removing words from part ''# setting familiar words in arrays''.<br />
+
You can easily change what will these strings be by adding/removing words from part:<br />
 +
''# setting familiar words in arrays''.<br />
 
In these script those key words are:
 
In these script those key words are:
 
* For type wall
 
* For type wall
Line 25: Line 26:
 
* For type cyclic
 
* For type cyclic
 
:* ''cyclic'', ''Cyclic'' and ''CYCLIC''
 
:* ''cyclic'', ''Cyclic'' and ''CYCLIC''
 +
 +
Script needs two things to work:
 +
*Needs header in ''boundery'' file because it looks for word ''FoamFile'' to navigate trough it
 +
*Needs ONE LINE between patch name and type (in standard Foam files in that line bracket { is located):
 +
    patchName
 +
    {
 +
        type            patch;
 +
 +
Here goes the script:

Revision as of 02:09, 12 December 2014

After running a bunch of simulations I got bored with stupid errors like forgetting to change patch type in boundery file, waiting decomposePar or reconstructPar, running few hundred simulations and then changing fvSchemes to second order discretizations... In that manner I created few bash scripts to ease the pain and hopefully they will help someone else.

1 OpenFOAM's little helpers

1.1 prepBoundary

First helper is prepBoundary. This bash script checks your patches names and according to it changes their type. If your patches name has specific pattern, script will recognize and change its type.
Example: I have a wall patch whose type should be wall, so when I create mesh I will name that patch bottomWall or bottomWALL; or
if I have an inletOutlet patch that should be type patch, when I create mesh I will name that patch upperInletOutlet or upperINLETOutlet

This script reads patches names so their names should have specific string inside them. You can easily change what will these strings be by adding/removing words from part:
# setting familiar words in arrays.
In these script those key words are:

  • For type wall
  • wall, Wall and WALL
  • For type patch
  • inlet, Inlet, INLET, outlet, Outlet and OUTLET
  • For type slip
  • slip, Slip and SLIP
  • For type empty
  • empty, Empty, EMPTY and frontAndBackPlanes
  • For type symmetry
  • symmetry, Symmetry and SYMMETRY
  • For type wedge
  • wedge, Wedge and WEDGE
  • For type cyclic
  • cyclic, Cyclic and CYCLIC

Script needs two things to work:

  • Needs header in boundery file because it looks for word FoamFile to navigate trough it
  • Needs ONE LINE between patch name and type (in standard Foam files in that line bracket { is located):
   patchName
   {
       type            patch;

Here goes the script: