0% found this document useful (0 votes)
4 views

Catalyst

Uploaded by

JMATALLANAARENAS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Catalyst

Uploaded by

JMATALLANAARENAS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Tutorial

CATALYST
CASE SETUP AND
MORPHING FOR OPENFOAM
Table of Contents
1. Introduction ............................................................................................................................. 2
1.1. Prerequisites ................................................................................................................... 2
1.2. Case description .............................................................................................................. 2
1.3. Data files and preparation ................................................................................................ 2
2. Setup the solver controls and boundary conditions ................................................................... 3
3. Output OpenFOAM case ....................................................................................................... 18
4. Run the OpenFOAM case...................................................................................................... 20
4.1 Run the case in serial mode ............................................................................................ 20
4.2 Run the case in parallel mode ......................................................................................... 20
5. Morph the model ................................................................................................................... 21
6. Output the points of the morphed model ................................................................................. 26
7. Conclusion ............................................................................................................................ 27

BETA CAE Systems


CATALYST – Case setup and morphing for OpenFOAM
1. Introduction
This tutorial presents in detail all the required steps to setup a case of CFD applications in
OpenFOAM. Morphing will be used afterwards to modify the geometry and run a second case.
The steps described in this tutorial are:
• Read the ANSA file containing the geometry and the mesh.
• Setup the boundary conditions and solver controls for an OpenFOAM simulation.
• Merge an ANSA file with predefined morphing boxes.
• Morph the model and output a new mesh.
1.1. Prerequisites
Reading the first chapter of the “ANSA for CFD Brief User’s Guide” document is recommended in
order to obtain a familiarization with the ANSA interface, terminology and CFD layout. It is also
recommended that you have already performed one of the CFD Morphing tutorials, so that you
have some understanding on the morphing techniques followed. Finally, some experience in
OpenFOAM usage would assist in the boundary conditions definition and case setup.
1.2. Case description
The catalyst geometry is shown below:

1.3. Data files and preparation


The files required for this tutorial are the following:
- catalyst.ansa
- morphing_boxes.ansa
- fvSchemes
- fvSolution
- transportProperties

It is recommended that you copy these files in your working directory, so that you do not change the
original files.
For reference, in the same directory, there are two files “catalyst_OF_v40_setup.ansa” and
“catalyst_morphed.ansa” which contain the results of this tutorial.

The case setup is demonstrated for the porousSimpleFoam solver and for OpenFOAM v4.0.

BETA CAE Systems 2 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
2. Setup the solver controls and boundary conditions
Start ANSA and from the pop-up launcher
select the CFD option, so that ANSA starts
with the CFD layout.

Please, refer to the


“ANSA for CFD Brief User’s Guide” document
for a description of the CFD layout.

Select File>Open to read the ANSA file. The


File Manager window appears. Navigate and
select the file catalyst.ansa.
Press Open.

By default, you should be in TOPO


menu.

The geometry of the model is displayed


as shown with the SHADOW mode
active.

The catalyst is meshed with the help of


HexaBlocks.

Press the F11 key and go to the


Presentation Parameters tab.
At the bottom, scroll the slide bar to the left
end in order to deactivate the Detail on
Demand effect.
Press OK.

BETA CAE Systems 3 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
This is an OpenFOAM case, so switch to
the OpenFOAM Deck.

SOLVER INF. Activate the AUXILIARIES>


SOLVER INF. function.

In the Flow options group from the “general”


tab, you should select “steady state” problem
and “incompressible” flow.

At the Viscous model options, click on RAS


and select kEpsilon turbulence model.

Select as OpenFOAM version 4.0 and set the


porousSimpleFoam solver.

Move on to the controlDict tab.


Here, you define options for the solution
process, like the number of iterations, the type
of output, etc.

In this card, set:


startFrom: startTime 0
stopAt: endTime 1000
deltaT: 1
writeControl: timeStep
writeInterval: 100
purgeWrite 1

Leave the rest as they are.

Now, move on to the decomposeParDict tab,


where you will specify the number of
subdomains in which the case will be split
when running the simulation in parallel on
multiple processors.

Type 4 in the numberOfSubdomains field and


press Enter.

The processorWeights rows will be updated


accordingly.

BETA CAE Systems 4 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
Move to the fvSchemes tab. In this tab, you
define the discretization schemes.

You can see that this tab is empty. Here, the


fields are not supported explicitly.

You can however press the Read button.


The File Manager opens where you can
specify a file for reading the discretization
schemes. Open the file fvSchemes located in
the tutorial folder.

After reading the file, ANSA displays its


contents which can be edited, if required.

Perform the same for fvSolution tab, in which


the solvers type is defined.

Press the Read button.


After the File Manager opens, read the values
from the file fvSolution located in the
tutorial folder.

BETA CAE Systems 5 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
Perform the same for the transport tab,
where the fluid properties are defined and pick
the transportProperties file.

Finally, in the Turbulence tab, activate the


Turbulence and printCoeffs flags.

If you already have a file where you have


turbulent coefficients defined, you can press
the Read button to read it, otherwise you can
occupy the space provided to write them.

In the end, press OK to close the window, as


the Solver Info definition is complete.

BETA CAE Systems 6 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
Now, continue with setting the boundary
conditions.
Note: It is necessary to set the Solver Info
settings at first and then define the boundary
conditions, since a lot of information appearing
in the PIDs property cards depends on these
settings.

Open the Properties list.

You will setup a case in which air enters the


domain with a velocity of 50 m/s.

Free stream turbulence kinetic energy is 39.44


m2/s2 and the dissipation rate is 14538 m2/s3.
Double-click on the “inlet” PID to define its
boundary conditions.

You should set the type of the boundary as


“patch”.

As Numerical Type p set “zeroGradient”.


As Numerical Type U set “surfaceNormalFV”
and give a velocity of -50 m/s. The (-) symbol
indicates that the air is flowing towards the
interior of the domain.

For Numerical Type k set “fixedValue”.


Click on the numerical field, delete the existing
value and press F3 to open the ANSA
Parameters window. You will assign the value
of k to a parameter, so that you can use it in
other fields as well.
At the ANSA Parameters window, press the
New button to define a new parameter.

BETA CAE Systems 7 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
Name the new parameter related to the inlet
turbulence kinetic energy as “k_inlet” and set
a value of 39.44. Press OK.

You will now define some more parameters,


one for each variable.

Click again on the New button and create a


new parameter called “epsilon_inlet”,
referring to the inlet turbulence dissipation
rate.

Set the value to 14538.07. Press OK.

Tip!: Alternatively, you could firstly create the


parameters and afterwards open the
Properties List. In order to create a parameter
go to any CFD Deck (here OpenFOAM) and
activate the function
AUXILIARIES>PARAMETER. This will open
the Parameters window where you can define
parameters as described earlier.

BETA CAE Systems 8 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
Finally, double-click on the “k_inlet”
parameter to set it as the fixed value for k.

Proceed with the definition of epsilon.

Set it as “fixedValue” and delete its numerical


field.

At the epsilon value field type


“=epsilon_inlet”.

Tip!: Alternatively, you can also press F3 and


select the “epsilon_inlet” parameter from the
ANSA Parameters window.

BETA CAE Systems 9 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
Finally, set Numerical Type nut to
“calculated”.

Leave the nut value to 0, as it is used only for


initialization.

Finally, press OK to accept the changes.

Go on with the definition of


“interior_upstream_cat” and
“interior_downstream_cat” PIDs.

“interior_upstream_cat” and
“interior_downstream_cat” should be set to
type “internal”.

BETA CAE Systems 10 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
Next, open the property card of PID “outlet”.
Change the type to “patch”.

At the outlet, a specific pressure value should


be defined.

For Numerical Type p set “fixedValue” and at


the p value field, keep the default “0” value.

As Numerical Type U set “inletOutlet” and


leave the rest fields with their default values.

Do the same for k and epsilon which should


be set to “inletOutlet” as well.

Additionally, for k set the parameter “k_inlet”,


in both entry fields and for epsilon the
parameter “epsilon_inlet”.

Numerical Type nut should be set to


“calculated”.

In the end, press “OK”.

BETA CAE Systems 11 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
Move to “wall_1”.

For Numerical Type p set “zeroGradient” and


for U set “fixedValue”. All the velocity
components should be zero.

Numerical Type k should be set to


“kqRWallFunction” and the value to the
parameter “k_inlet”.

Accordingly, Numerical Type epsilon should


be set to “epsilonWallFunction” and its value
should point to the parameter “epsilon_inlet”.

Numerical Type nut should be set to


“nutkWallFunction”.

The nut value field can be left to its default


value.

Press “OK”.

The same options will be used for the PIDs


“wall_2” and “wall_catalyst” as well.

There is an easy and efficient way to copy the


options set for the “wall_1” PID and assign
them to the two target PIDs, by using the User
Defined Function “CopyPIDCard”, thus
avoiding the manual setting of the boundary
condition

BETA CAE Systems 12 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM

Click on User Script Buttons at the top


of the ANSA interface to access the User
Defined Functions.

Select the CopyPIDCard function.

The Copy PIDs window opens.


The list on the left consists of the PIDs of the
model. The user is able to select the source
PID, the property card settings of which will be
copied.

Select the “wall_1” PID.

The list on the right side of the window is filled


with the rest PIDs which can be used as
targets.

Select both the “wall_2” and “wall_catalyst”


PIDs, by holding the Ctrl button.

Click Apply.

In the confirmation window that opens click


OK.

The settings of the source PID are copied to


the target PIDs.
BETA CAE Systems 13 ANSA v.20.x Tutorials
CATALYST – Case setup and morphing for OpenFOAM

Next, open the “fluid” PID.

For k and epsilon, set an ANSA Parameter.

For k value set “k_inlet”


and for epsilon value set “epsilon_inlet”.

Leave p, U, and nut to their default values.

Click OK.

Finally, open the “porous” PID card.

Switch the “Porous Zone” field to “Yes”, since


it is a porous material.

Leave the porosity model to “Darcy” and at


the CoordSys field, type a question mark
(?), so as to open the COORD HELP window.

BETA CAE Systems 14 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
At the COORD HELP window, click on New
and select the CORD_R option, so that you
create a new local rectangular coordinate
system.

Tip!: If the pop-up windows make your


selections difficult, minimize them by middle-
clicking on their title bar.

Press ALL.

Select an element edge along a Hexa Block


edge of the “porous” PID.

Note: Keep in mind to put the x-axis of the


local coordinate system along the axis of the
porous medium.
If not, deselect the coordinate system with
right-click and select another edge, aligned
with the axis of the porous PID.
In the end, confirm with middle mouse-button.
Tip!: Alternatively, you can make a Coordinate
system directly from the OpenFOAM DECK by
selecting the COORD.SYSTEMS>NODE
[CORD1R] function.

Select three points, the first for the Center of


the System, the second for defining the Z-Axis
orientation and a third point which will define
the X-Axis.

BETA CAE Systems 15 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
A coordinate system information card opens.

Name the new coordinate system as


“Porous_coordinates” and click OK.

Back to the COORD HELP window, double-


click on “Porous_coordinates” to set it as the
coordinate system of the “porous” PID.

Tip!: If you want to copy-paste the name


instead of writing it, after you copy it, right-click
in the name-field, select “Clear” in the pull
down menu and then paste.

The local coordinate system is placed.


Continue with the definition of d values.
Set 1.e9, 1.e12 and 1.e12 for x, y and z
directions, respectively.

For the rest of the fields set the following:


for k value set the parameter “k_inlet”
for epsilon value set the parameter
“epsilon_inlet”.

Leave the rest fields at their default values.

In the end, confirm with OK.

The solver info and boundary conditions have been defined. Next, you will output the OpenFOAM
case. Save the file.

Note: At this point it is important to mention that the whole OpenFOAM case setup can be perfomed
fully automatically through the use of the User Defined Function SetUpOFCase. It is accessible by
clicking on User Script Buttons and selecting the function found in the TOOLS_DECKS section.

BETA CAE Systems 16 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
This function will setup the Solver
Info window settings, including the
“fvSchemes”, “fvSolution” and
“transport” tabs as well as the
Boundary Conditions.
The user can also check whether
force coefficients or residuals
monitors will be generated.
Additionally, shell scripts can be
exported for initializing and
running the simulation or for
monitoring forces and residuals,
etc.
This case setup is suitable for
most incompressible steady state
cases, such us external
aerodynamics of vehicles.
It will not auto-setup any porous media related settings.
The user needs to specify the PIDs that define an inlet – outlet domain or a domain with farfield
boundary conditions. Then, velocity, total number of iterations, number of processors, etc.
information needs to be defined. There is also the option to select the Turbulence Model.
The default fluid properties correspond to the properties of air.
As a prerequisite the user must specify the type of each PID (wall, internal, etc.) through the PID list
window, before activating the function.
Clicking on Setup Case all settings will be made and the case will be ready to be exported.

BETA CAE Systems 17 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
3. Output OpenFOAM case

Before outputting the OpenFOAM case,


you should disable the visibility of
Geometry, as it contains additional nodes that
are not required in the simulation.

Additionally, activate Compress from the


Utilities toolbar.

This function will remove from the database all


information concerning deleted entities,
reducing its size.

In the window that opens press OK.

Next, click on User Script Buttons and


activate the RenumberModel function.

It will renumber all Properties, Elements and


Nodes, so that they all start from 1, in a
sequential order.

BETA CAE Systems 18 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
Activate the Properties and Materials options
as shown on the left and click OK.

Finally, activate the


UTIL function
OpenFOAM DECK
Renumber Mesh
>ELEMENTs>
Mesh UTIL [Renumber
Mesh] [Model].

It will renumber the elements of the model in


order to reduce the bandwidth and improve the
solution in terms of computational time.
Now, go to File>Output>OPENFOAM.

The OpenFOAM output parameters window


opens.
Specify the full path of the folder in which
ANSA should write all the files.
Alternatively, you can click on the File Manager
button to select or create a new one.
For Output select Visible.

Activate the flags to output Initial Conditions


folder (./0/ folder) with all the specified
boundary conditions, the Solver Info
(controlDict, fvSchemes, etc.) and the Scale
Mesh, so that during output ANSA scales the
mesh by 0.001 (mm→m).

As OpenFOAM version keep the default


SolverInfo option, meaning that the version
that is specified in the SOLVER INFO window
will be used.

Press OK to proceed with the output.

Here are the resulting output files from ANSA


for the current case.

BETA CAE Systems 19 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
4. Run the OpenFOAM case

4.1 Run the case in serial mode


In order to run the simulation, open a terminal window and follow these steps:

1) Navigate to the folder where you have output the case and initialize the flowfield with
potentialFoam in order to help solution convergence, by typing:

potentialFoam -writep | tee -a potentialFoam.log

The -writep argument, will initialize also pressure (p) along with velocity (U) and flux (phi), while
the tee -a command will store the solution output in a text file (potentialFoam.log).
2) Then, start the solver, again storing the solution output in a log file by typing the following
command:

porousSimpleFoam | tee -a porousSimpleFoam.log

The simulation will start, reporting the current iteration and residuals along with other information.

4.2 Run the case in parallel mode


If you wish to run the case in parallel using multiple processors, follow these steps:

1) Type the following command in the case folder:

decomposePar

This will split the case in so many subdomains as defined in the decomposeParDict file which is
created by ANSA and can be found in the “system” subfolder of the case.
2) Initialize the flowfield by running potentialFoam in parallel:

mpirun -np 4 potentialFoam -parallel -writep | tee -a potentialFoam.log

In our case we are using four processors as specified in the decomposeParDict file.
3) Start the solver in parallel by typing:

mpirun -np 4 porousSimpleFoam -parallel | tee -a porousSimpleFoam.log

BETA CAE Systems 20 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
5. Morph the model
After completing the case setup and the output
in OpenFOAM you will morph the model so
that you get a modified geometry.

Switch to MORPH menu.

From File>Open load the


morphing_boxes.ansa file.

Morphing in ANSA is performed with green


Morph Boxes.
Tip!: Hexablock boxes can also be used to
morph the mesh they have generated.

Select File>Merge and select the file you


saved before the output.

Tip!: Alternatively, you can merge it with the


catalyst_OF_v40_setup.ansa file from
the installation directory of ANSA.

Press OK in the default values of the Merge


Parameters window.

The morphing boxes file is merged with the


catalyst file. Note that the construction of the
boxes follows and encloses the model
geometry.

You can disable the Geometry visibility


because it is not necessary for morphing.

BETA CAE Systems 21 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
Additionally, you can disable the visibility of
Hexa Blocks to ease manipulation of the
model.

Press F12 to open the Database Browser.

Expand the HEXABLOCK tree, right-click on


the HEXA_BOX entry and select hide.

You can enable LOCK from the focus


toolbar in order to have only the visible
entities on the screen when pressing the All
button.

Since the morph boxes come from another file,


they do not contain any information about any
loaded entities in them.

Load Activate the


Boxes>Load>[Visible]
Visible function.

In the Options List window


select only the flags
“Include FE Entities”,
“Include nodes” and
“Include Light Solids” to
load.

Select all the boxes and confirm with the


middle mouse-button (ensure that the entire
mesh was visible).
Activate the
Parameters Controls>Parameters
function.

The list of defined morphing parameters


opens.
There are six defined parameters, each of
them controlling a different dimension of the
catalyst. Select one of them with the left
mouse-button (e.g. “Inlet_pipe_position).

BETA CAE Systems 22 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
ANSA displays on the model an arrow
indicating the morphing direction and highlights
with red color the Control Points that will be
moved.

Before performing any morphing, it is


advisable that a Deformation type parameter is
created. This will ensure that one can always
return to the original state or to any
intermediate interpolated one.
Press the New button in the Parameters list
window.

A new Parameter card opens.

Set the Type as DEFORMATION and name it


“Deformation_param”.

Press OK.

Back in the Parameters window the new


Parameter is listed.

Now you will morph the model.

Select parameter 5 and press the Morph


button.

From the Options List


window in the lower right
corner of the screen,
activate the Morphing
flag, so that the
movement of the Control
Points results to the
morphing of the model.

BETA CAE Systems 23 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
In the Parametric Movement window type the
value 25 and press Enter.

Observe how the angle of the inlet diffuser has


changed.

Press OK in the next


confirmation window.

Back in the Parameters window select


parameter 6 and click on the Morph button.

In the Parametric Movement window type the


value 25 and press Enter.

The outlet cone


angle has changed.

Press OK again in
the confirmation
window.

In the Parameters window select the


“Deformation_param” (Deformation
parameter).

BETA CAE Systems 24 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
ANSA displays a contour plot of the
deformation value of each node from its
original position.

You may have to temporarily deactivate


the visibility flag for Volume, so that you
can see the contours on the surface mesh.

If you press the Morph button in the


Parameters window, then a window opens
allowing to change deformation parameter
value. A deformation parameter can be
interpolated linearly between the original (0)
and current (1) states. Set a value of 0.5 and
by clicking Refresh, ANSA previews another
state of the model.

You can set a value outside the limits 0 and 1


to extrapolate a state. Press ESC to exit
without changing anything, or left mouse-
button to accept the current previewed state.

Activate again the visibility of Volumes.

Use Focus commands to see inside the


Volume mesh.

BETA CAE Systems 25 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
6. Output the points of the morphed model
Finally, press ALL from the Focus group
and ensure that all visibility flags for
Volume and FE-Mode mesh are active.

Instead of outputting the whole case (nodes,


elements, solver info, etc.), output only the
nodes in the “points” file (./polyMesh/ folder)
with the help of a User Defined Function.

Activate the User Script Buttons button.

The User Script Buttons window opens.

Activate the OutputOpenFOAMPoints


function.
In the next window that opens press OK.

The File Manager opens. Select the folder


(catalyst) where you initially output the original
mesh.

ANSA will output only the visible model and


overwrite the current “points” file with the new
coordinates (scaled again by 0.001; both this
factor and the output mode are hardcoded in
the script). So, you will now have a morphed
model to continue the CFD run.

BETA CAE Systems 26 ANSA v.20.x Tutorials


CATALYST – Case setup and morphing for OpenFOAM
7. Conclusion
In this tutorial you followed all the necessary steps to setup an OpenFOAM case for solution.
Additionally, you used the morphing tools to change the input and output diffuser angles of the
catalyst and afterwards you output the new geometry by exporting only the “points” file of the mesh.

BETA CAE Systems 27 ANSA v.20.x Tutorials

You might also like