02 Propeller With OpenFOAM
02 Propeller With OpenFOAM
Tutorial
Propeller Model: Brief Overview
The
first
step
of
modeling
This
is
done
in
the
scope
03_prepareForOpenFoamTutorial.
The first step is to rotate the created blade by using the feature PeriodicBRep. Afterwards the
all the BRep parts are combined and scaled to the dimensions of the OpenFOAM tutorial. In
order to give the exported STL patches names, we use custom colors with the desired names, in
this case ascii. This is done with a feature called ExportSTLPatchNamesByColor. The BReps
will finally be exported as Multi Body STL.
Tutorial
Software Connector Start with Input Geometry
Lets get started: The software connector is the widget where external
tools can be plugged-in. We will set up the connection step by step:
Open the file 81_OpenFOAM_Propeller.fdb from the tutorials section (samples > tutorials)
in the documentation browser and safe it somewhere on your harddisc.
Go to the Connections tab in the pull down menu and create a software connector.
Drag and drop the 7 BReps from 03_prepareForOpenFoamTutorial into the Input Geometry
Window of the software connector.
Click on each of the 7 parts in the connector, and specify the export name and the type,
respectively. Set the export type for each geometry part to MultiBodySTL. Since the STL
location is in a subfolder of the OpenFOAM project directory, we have to specify the file
names as follows:
o
constant/triSurface/innerCylinderSmall.stl
constant/triSurface/innerCylinder.stl
constant/triSurface/outerCylinder.stl
constant/triSurface/propellerStem1.stl
constant/triSurface/propellerStem2.stl
constant/triSurface/propellerStem3.stl
constant/triSurface/propellerTip.stl
Tutorial
Input Files
Click on the plus button in the Input Files window. Select the files from the OpenFOAM
propeller tutorial. You can find it in
/OpenFOAM2.x.x/tutorials/incompressible/pimpleDyMFoam/propeller.
You can delete all geometry files which end by .obj and the Allclean file.
Now, for each file the absolute path is shown. This means that the software connector
references to the absolute patch on the disc. But as we want to modify the files, we want the
copy and load the files into the CAESES project.
This is simply done by double-clicking on each file: With a double click, you will be directed
into the file window.
Tutorial
Allrun File
We modify the Allrun file in this step, note again that we work on a copy
of the original file.
Double-click on Allrun.
OpenFOAM
environment
/opt/OpenFOAM/OpenFOAM-2.2.0/etc/bashrc
For postprocessing reasons, we need to create the case.foam file by adding the following
command into the Allrun script:
touch case.foam
Tutorial
Introduce Parameters in Dict Files
First, it is useful to add a parameter which scales the mesh uniformly in all directions.
Switch to plain mode by clicking on the little pen on the top left of the file.
Then select the value 0.5 in the editor, choose right click > create
design variable, which could be renamed as meshScaling.
You can find the design variable in the CAD tab below the three scopes.
Do the same for the other directions, while using the meshScaling
design variable for all three directions.
We can also create a parameter which controls the end time of the
solution.
Put the parameter endTime and the design variable meshScaling into a scope called
04_OpenFOAM_settings.
Tutorial
Consider STL in Dicts
We
have
to
adjust
snappyHexMeshDict
as
well
as
Select snappyHexMeshDict and replace the endings of the imported geometry from .obj
and .obj.gz to .stl.
Select surfaceFeatureExtractDict and replace the endings of the imported geometry from
.obj to .stl.
In order to get the moments and forces of the calculation, we have to include following code into
the end of controlDict:
Functions
(
forces
{
type
forces;
functionObjectLibs
(libforces.so);
patches
(propellerTip);
CofR
(0 0 0);
rhoName
rhoInf;
rhoInf
998;
outputControl
timeStep;
outputInterval 1;
}
);
Tutorial
Software Connector: Computation
For postprocessing we need to have results files and values, which will
be inserted in the Results Files and Results Values window of the software
connector. In order to get these, we have to trigger a first run either with CAESES, or without
CAESES. Since we already changed parts of the input files in the previous steps, it makes sense
to trigger the computation from within CAESES. For this, we have to set up the computation:
Tutorial
Result Values
and forces. These values can be extracted from any text files, but usually from *.csv or *.dat file
formats. Since CAESES needs to know where the desired values are located in each design
directory, we have to provide an example file.
Set line to -1 (this means always the last row of the file).
Set column to 2.
Add a value by clicking on the plus button again, and name it moment_pressure.
Set column to 8 if you are using OpenFOAM 2.2.0 or less otherwise set the column to 11.
Set column to 11 if you are using OpenFOAM 2.2.0 or less otherwise set the column to 14.
Now create a parameter of each value by clicking on the blue parameter symbol in the table
preview. These parameters will be the objectives of the simulation at a later stage.
Select the three evaluation parameters, and create a scope. Set the name of this scope
05_OpenFOAM_evaluation (note, names can be user-defined i.e. arbitrary).
Remember that these parameters are the result values of the last iteration or time step. If you
have a strong oscillating result, you might average the values over a specific time. This will be
explained in more detail later on.
Tutorial
Result Files
In the Result Files window of the connector, output files from the CFD
calculation are referenced. Typical output files are pictures, tables, text
10
Tutorial
Running the Case
10
Now the software connection is completed, and a first test case can be
started.
Increase the parameter endTime to 0.1, which is the original value from the OpenFOAM
tutorial.
You can also increase the meshScaling factor, but this will increase the computation time.
Go back to the software connector and run the simulation (again by using the button).
11
Tutorial
Postprocessing
11
new
window
appears.
Select
FGridPlaneCut.
Select FContourPlot.
12
Tutorial
Averaging Result Values
12
Select Average and set the value to 10. This means that
results of the last 10 rows is averaged.
Another step that would follow up in an optimization process is to calculate the efficiency.
Therefor you will need the averaged values of the thrust and the moments over a specific
number of revolutions (for example the average value of the last revolution). To calculate this
you need the transient time step, the total number of revolutions and the time steps per
revolution.
13