What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Crash Course Introduction to OpenFOAM
Artur LidtkeUniversity of Southampton [email protected]
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Content
What is OpenFOAM?
The Idea
Overview of the libraries
Using OpenFOAM
Cavity tutorial overview Creating own simulations
Practice - cylinder in uniform flow
A look at the test case Running the simulation
Summary
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
The Idea
In a nutshell
I Free, open source set of libraries used to solve differential equations
I Primarily focused on Computational Fluid Dynamics (CFD), but may also be applied to other problems
I Uses finite volume approach to discretise and solve the governing equations
I Distributed by the OpenFOAM Foundation and developed by
OpenCFD Ltd.
I Diclaimer: This series of presentations and tutorials is unofficial and is not supported or endorsed by the owners of OpenFOAM
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
The Idea
Open source
I Significant amount of development done by the users. See for instance:
I swak4foam
I pyFoam
I OpenFOAM Extend (e.g. OF-1.7.x)
I Individual contributions (solvers, utilities) uploaded by single users
I Written in C++ - efficient, versatile and well structured code
I Difficult to get started with development unless a proficient C++ user with experience
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
The Idea
Perfect?
I Little official support - training sessions organised but not free
I Not much coherent training materials - typically need to go through many presentations, reports and forum posts to find the answer to a particular problem
I User has full control over most of the parameters of any operation - overwhelming at the beginning
I BUT: Many tutorial cases prepared by the developers and users - demonstrate how different features of the code work (although without too much narration)
I Intensive unofficial support through the on-line user forum:
http://www.cfd-online.com/Forums/openfoam/
I Wiki pages dedicated to OpenFOAM:
http://openfoamwiki.net/index.php/Main_Page
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
The Idea
Perfect?
I Little official support - training sessions organised but not free
I Not much coherent training materials - typically need to go through many presentations, reports and forum posts to find the answer to a particular problem
I User has full control over most of the parameters of any operation - overwhelming at the beginning
I BUT: Many tutorial cases prepared by the developers and users - demonstrate how different features of the code work (although without too much narration)
I Intensive unofficial support through the on-line user forum:
http://www.cfd-online.com/Forums/openfoam/
I Wiki pages dedicated to OpenFOAM:
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Overview of the libraries
OpenFOAM capabilities
I See the official page for full info:
http://www.openfoam.org/features/
I What we are interested in:
I Incompressible, compressible and multiphase flows
I Reynold’s Averaged Navier Stokes (RANS), Unsteady-RANS, and Large Eddy Simulation turbulence modelling
I Built-in meshing tools
I Easy to use (and modify) tools for extraction of data for post-processing
I Readilly available plugins to ParaView for flow visualisation
I Fully paralellised solvers (and some utilities)
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Connecting to the cluster
I We will work solely on Iridis to ensure everybody has access to what they need
I Connect to the cluster using ssh
I Now your terminal is able to do things in Southampton
I All the files you will need are already here
I As a reminder, in order to copy some directories to the supercomputer
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Connecting to the cluster
I We will work solely on Iridis to ensure everybody has access to what they need
I Connect to the cluster using ssh
I Now your terminal is able to do things in Southampton
I All the files you will need are already here
I As a reminder, in order to copy some directories to the supercomputer
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Connecting to the cluster
I We will work solely on Iridis to ensure everybody has access to what they need
I Connect to the cluster using ssh
Use
ssh -X $YOUR USERNAME@iridis4 a.soton.ac.uk
I Now your terminal is able to do things in Southampton
I All the files you will need are already here
I As a reminder, in order to copy some directories to the supercomputer
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Connecting to the cluster
I We will work solely on Iridis to ensure everybody has access to what they need
I Connect to the cluster using ssh
I Now your terminal is able to do things in Southampton
I All the files you will need are already here
I As a reminder, in order to copy some directories to the supercomputer
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Connecting to the cluster
I We will work solely on Iridis to ensure everybody has access to what they need
I Connect to the cluster using ssh
I Now your terminal is able to do things in Southampton
I All the files you will need are already here
I As a reminder, in order to copy some directories to the supercomputer
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Connecting to the cluster
I We will work solely on Iridis to ensure everybody has access to what they need
I Connect to the cluster using ssh
I Now your terminal is able to do things in Southampton
I All the files you will need are already here
I As a reminder, in order to copy some directories to the supercomputer
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Connecting to the cluster
I We will work solely on Iridis to ensure everybody has access to what they need
I Connect to the cluster using ssh
I Now your terminal is able to do things in Southampton
I All the files you will need are already here
I As a reminder, in order to copy some directories to the supercomputer
Use
scp -r $SOURCE FOLDER \
$YOUR USERNAME@iridis4 a.soton.ac.uk:/home/\ $TARGET PATH
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Let’s have a look at how to make OpenFOAM work
I Cavity tutorial - covered as one of the three cases in the official user guide:
http://openfoam.org/docs/user/cavity.php
I Very simple, lid-driven cavity flow - basic CFD validation test case, much like the Hello World! code for programming
I Worth going through the official tutorial as well as these slides not to miss anything
I Each OpenFOAM case is defined by a particular file structure in a separate folder
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Let’s have a look at how to make OpenFOAM work
I Cavity tutorial - covered as one of the three cases in the official user guide:
http://openfoam.org/docs/user/cavity.php
I Very simple, lid-driven cavity flow - basic CFD validation test case, much like the Hello World! code for programming
I Worth going through the official tutorial as well as these slides not to miss anything
Go to
cd $FOAM RUN/tutorials/incompressible/icoFoam/cavity
I Each OpenFOAM case is defined by a particular file structure in a separate folder
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Let’s have a look at how to make OpenFOAM work
I Cavity tutorial - covered as one of the three cases in the official user guide:
http://openfoam.org/docs/user/cavity.php
I Very simple, lid-driven cavity flow - basic CFD validation test case, much like the Hello World! code for programming
I Worth going through the official tutorial as well as these slides not to miss anything
I Each OpenFOAM case is defined by a particular file structure in a separate folder
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
What defines a case
I The very basic elments of an OpenFOAM simulation are:
I System directory - used for controlling the utilities and solvers
I Constant directory - holds the information about the case which (usually) doesn’t change over time
I 0 folder - contains the boundary conditions (separate file for each field, or flow variable)
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
What defines a case
I The very basic elments of an OpenFOAM simulation are:
I System directory - used for controlling the utilities and solvers
I controlDict - main solution control: time step, start/end
times, data extraction, additional library linking, etc.
I fvSchemes - describes the discretisation adopted for all quantities solved
I fvSolution - provides information as to how each of the equations is solved, given its discretisation
I Constant directory - holds the information about the case which (usually) doesn’t change over time
I 0 folder - contains the boundary conditions (separate file for each field, or flow variable)
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
What defines a case
I The very basic elments of an OpenFOAM simulation are:
I System directory - used for controlling the utilities and solvers
I Constant directory - holds the information about the case which (usually) doesn’t change over time
I polyMesh - contains the files describing the mesh
I transportProperties - description of the fluid and other associated parameters (viscosity, density, phase change parameters, etc.)
I turbulenceProperties - how the turbulence is modelled (no surprise there!)
I 0 folder - contains the boundary conditions (separate file for each field, or flow variable)
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
What defines a case
I The very basic elments of an OpenFOAM simulation are:
I System directory - used for controlling the utilities and solvers
I Constant directory - holds the information about the case which (usually) doesn’t change over time
I 0 folder - contains the boundary conditions (separate file for each field, or flow variable)
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Running the case
I First, we need to create the structure mesh using a ready dictionary file
I Let us see what we have achieved
I The boundary conditions are already set, so are the solver parameters. Just run the relevant application:
I Now it’s time to check the solution
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Running the case
I First, we need to create the structure mesh using a ready dictionary file
Use
blockMesh
I Let us see what we have achieved
I The boundary conditions are already set, so are the solver parameters. Just run the relevant application:
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Running the case
I First, we need to create the structure mesh using a ready dictionary file
I Let us see what we have achieved
I The boundary conditions are already set, so are the solver parameters. Just run the relevant application:
I Now it’s time to check the solution
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Running the case
I First, we need to create the structure mesh using a ready dictionary file
I Let us see what we have achieved
Use
I Typical command is: paraFoam
I But we haven’t compiled the reuired ParaView libraries
I Convert solution to ParaView format foamToVTK -useTimeName
I Start ParaView and open the VTK file paraview
I Select ”Surface with edges” appearance
I The boundary conditions are already set, so are the solver parameters. Just run the relevant application:
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Running the case
I First, we need to create the structure mesh using a ready dictionary file
I Let us see what we have achieved
I The boundary conditions are already set, so are the solver parameters. Just run the relevant application:
I Now it’s time to check the solution
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Running the case
I First, we need to create the structure mesh using a ready dictionary file
I Let us see what we have achieved
I The boundary conditions are already set, so are the solver parameters. Just run the relevant application:
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Running the case
I First, we need to create the structure mesh using a ready dictionary file
I Let us see what we have achieved
I The boundary conditions are already set, so are the solver parameters. Just run the relevant application:
I Now it’s time to check the solution
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Running the case
I First, we need to create the structure mesh using a ready dictionary file
I Let us see what we have achieved
I The boundary conditions are already set, so are the solver parameters. Just run the relevant application:
Use
icoFoam
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Running the case
I First, we need to create the structure mesh using a ready dictionary file
I Let us see what we have achieved
I The boundary conditions are already set, so are the solver parameters. Just run the relevant application:
I Now it’s time to check the solution
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Running the case
I First, we need to create the structure mesh using a ready dictionary file
I Let us see what we have achieved
I The boundary conditions are already set, so are the solver parameters. Just run the relevant application:
I Now it’s time to check the solution
Use
I foamToVTK -latestTime -useTimeName
I paraview
I Load the data
I Select ”Surface” appearance
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
Running the case
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Cavity tutorial overview
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Creating own simulations
How to create a bespoke case
I Tutorial cases cover many different flows, configurations and variants - something for everyone!
I To make life easier:
I Copy and existing tutorial case similar to what you want to
simulate
I Change the mesh
I Alter the flow parameters
I Add any post-processing
I Done!
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
A look at the test case
Oveview
I Cylinder in uniform flow - relevant to most engineering problems
I Very well covered in the literature, countless sets of validation data
I Very complex flow despite simple geometry
I Several regimes of the flow depending on the Reynolds number: laminar, sub-critical, transitional and fully turbulent
I For the purpose of this workshop, let’s look at sub-ciritical regime - low-Re but not low enough to be boring
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
A look at the test case
Oveview
I Reynolds number is the ratio of inertial to viscous forces
I Given by
Re =
UDνI Tells us how turbulent the flow is likely to be (the higher the more turbulence)
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
A look at the test case
Oveview
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
A look at the test case
Conditions
I Chosen to repeat the experiments by Parnaudeau et al. (2008)
http://www.irisa.fr/fluminance/team/Carlier/ publications/ParnaudeauCarlierHeitzLamballais_ 2008_POF.pdf
I Rich source of information, detailed and well presented data
I Re = 3900
I Expect a largely laminar boundary layer separating approximately half-way around the cylinder
I This gives rise to vortices being shed and turbulent wake appearing
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
A look at the test case
What we want to capture
|ω| = |∇ × U| = 10 s−1What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Getting the initial state - mesh
I It is a good idea to get an approximate steady-state solution of the flow beforehand
I This tries to capture the mean flow without resolving the turbulence explicitly
I Let us do just that:
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Getting the initial state - mesh
I It is a good idea to get an approximate steady-state solution of the flow beforehand
I This tries to capture the mean flow without resolving the turbulence explicitly
I Let us do just that:
I Let us create and view the mesh
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Getting the initial state - mesh
I It is a good idea to get an approximate steady-state solution of the flow beforehand
I This tries to capture the mean flow without resolving the turbulence explicitly
I Let us do just that:
Go to
cd $FOAM RUN/cylinder2D
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Getting the initial state - mesh
I It is a good idea to get an approximate steady-state solution of the flow beforehand
I This tries to capture the mean flow without resolving the turbulence explicitly
I Let us do just that:
I Let us create and view the mesh
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Getting the initial state - mesh
I It is a good idea to get an approximate steady-state solution of the flow beforehand
I This tries to capture the mean flow without resolving the turbulence explicitly
I Let us do just that:
I Let us create and view the mesh
Use
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Getting the initial state - mesh
I It is a good idea to get an approximate steady-state solution of the flow beforehand
I This tries to capture the mean flow without resolving the turbulence explicitly
I Let us do just that:
I Let us create and view the mesh
Do
Visualise the mesh as for the cavity
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Getting the initial state - solution
I To run a steady case RANS it’s also good to run potential flow first
I The boundary conditions are set but are protected from overwriting
I Now, run the potential flow solver
I In system/controlDict uncomment functions part to
enable run-time postprocessing
I Decompose the case to run in parallel
I Run the steady-state solver in parallel
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Getting the initial state - solution
I To run a steady case RANS it’s also good to run potential flow first
I For F. Herbert fans:
Solutions, within solutions, within solutions...
I The boundary conditions are set but are protected from overwriting
I Now, run the potential flow solver
I In system/controlDict uncomment functions part to
enable run-time postprocessing
I Decompose the case to run in parallel
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Getting the initial state - solution
I To run a steady case RANS it’s also good to run potential flow first
I The boundary conditions are set but are protected from overwriting
I Now, run the potential flow solver
I In system/controlDict uncomment functions part to
enable run-time postprocessing
I Decompose the case to run in parallel
I Run the steady-state solver in parallel
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Getting the initial state - solution
I To run a steady case RANS it’s also good to run potential flow first
I The boundary conditions are set but are protected from overwriting
Use
cp -r 0.org 0
I Now, run the potential flow solver
I In system/controlDict uncomment functions part to
enable run-time postprocessing
I Decompose the case to run in parallel
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Getting the initial state - solution
I To run a steady case RANS it’s also good to run potential flow first
I The boundary conditions are set but are protected from overwriting
I Now, run the potential flow solver
I In system/controlDict uncomment functions part to
enable run-time postprocessing
I Decompose the case to run in parallel
I Run the steady-state solver in parallel
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Getting the initial state - solution
I To run a steady case RANS it’s also good to run potential flow first
I The boundary conditions are set but are protected from overwriting
I Now, run the potential flow solver
Use
potentialFoam
I In system/controlDict uncomment functions part to
enable run-time postprocessing
I Decompose the case to run in parallel
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Getting the initial state - solution
I To run a steady case RANS it’s also good to run potential flow first
I The boundary conditions are set but are protected from overwriting
I Now, run the potential flow solver
I In system/controlDict uncomment functions part to
enable run-time postprocessing
I Decompose the case to run in parallel
I Run the steady-state solver in parallel
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Getting the initial state - solution
I To run a steady case RANS it’s also good to run potential flow first
I The boundary conditions are set but are protected from overwriting
I Now, run the potential flow solver
I In system/controlDict uncomment functions part to
enable run-time postprocessing
I Decompose the case to run in parallel
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Getting the initial state - solution
I To run a steady case RANS it’s also good to run potential flow first
I The boundary conditions are set but are protected from overwriting
I Now, run the potential flow solver
I In system/controlDict uncomment functions part to
enable run-time postprocessing
I Decompose the case to run in parallel
Use
decomposePar
I Run the steady-state solver in parallel
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Getting the initial state - solution
I To run a steady case RANS it’s also good to run potential flow first
I The boundary conditions are set but are protected from overwriting
I Now, run the potential flow solver
I In system/controlDict uncomment functions part to
enable run-time postprocessing
I Decompose the case to run in parallel
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Getting the initial state - solution
I To run a steady case RANS it’s also good to run potential flow first
I The boundary conditions are set but are protected from overwriting
I Now, run the potential flow solver
I In system/controlDict uncomment functions part to
enable run-time postprocessing
I Decompose the case to run in parallel
I Run the steady-state solver in parallel
Use
foamJob -s -p simpleFoam
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Post-processing
I Reconstruct the parallel solution
I Clean-up the decomposed directories
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Post-processing
I Reconstruct the parallel solution
Use
reconstructPar -latestTime
I Clean-up the decomposed directories
I View the solution
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Post-processing
I Reconstruct the parallel solution
I Clean-up the decomposed directories
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Post-processing
I Reconstruct the parallel solution
I Clean-up the decomposed directories
Use
rm -r processor*
I View the solution
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Post-processing
I Reconstruct the parallel solution
I Clean-up the decomposed directories
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Post-processing
I Reconstruct the parallel solution
I Clean-up the decomposed directories
I View the solution
Do
I Load the case to ParaView
I Visualise the x-component of the velocity field
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Steady state solution - really?
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Steady state solution - really?
I This is NOT a steady state solution!
I We ran it for long enough to expect at least partial convergence
I So, what could be the problem?
I We applied a steady-state solver to an inherently unsteady problem - cannot get real convergence
I Still OK for a rough guess of initial condition but meaningless physically
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Steady state solution - really?
I This is NOT a steady state solution!
I We ran it for long enough to expect at least partial convergence
I So, what could be the problem?
I We applied a steady-state solver to an inherently unsteady problem - cannot get real convergence
I Still OK for a rough guess of initial condition but meaningless physically
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Steady state solution - really?
I This is NOT a steady state solution!
I We ran it for long enough to expect at least partial convergence
I So, what could be the problem?
I We applied a steady-state solver to an inherently unsteady problem - cannot get real convergence
I Still OK for a rough guess of initial condition but meaningless physically
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Preparing to run the LES case
I Navigate to the case
I Create the mesh
I Copy the initial conditions
I Map the steady-state solution onto the 3D grid
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Preparing to run the LES case
I Navigate to the case
Go to
cd $FOAM RUN/cylinder3D pimple LES
I Create the mesh
I Copy the initial conditions
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Preparing to run the LES case
I Navigate to the case
I Create the mesh
I Copy the initial conditions
I Map the steady-state solution onto the 3D grid
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Preparing to run the LES case
I Navigate to the case
I Create the mesh
Use
blockMesh
I Copy the initial conditions
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Preparing to run the LES case
I Navigate to the case
I Create the mesh
I Copy the initial conditions
I Map the steady-state solution onto the 3D grid
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Preparing to run the LES case
I Navigate to the case
I Create the mesh
I Copy the initial conditions
Use
cp -r 0.org 0
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Preparing to run the LES case
I Navigate to the case
I Create the mesh
I Copy the initial conditions
I Map the steady-state solution onto the 3D grid
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Preparing to run the LES case
I Navigate to the case
I Create the mesh
I Copy the initial conditions
I Map the steady-state solution onto the 3D grid
Use
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Basics of using a supercomputer
I In order to use the full potential of the cluster we need to submit a job
I Now we are using the login node, not the nodes that are acutally use computation
I What happens during the job execution is defined in a control script
I Let us see what that looks like
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Basics of using a supercomputer
I In order to use the full potential of the cluster we need to submit a job
I Now we are using the login node, not the nodes that are acutally use computation
I What happens during the job execution is defined in a control script
I Let us see what that looks like
Edit
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Job control script - controlling the cluster
# !/ bin / b a s h # PBS - S / bin / b a s h # M e m o r y n e e d e d by the job # PBS - l mem =25 GB # T i m e a l l o c a t e d # PBS - l w a l l t i m e = 6 0 : 0 0 : 0 0 # N u m b e r of n o d e s and p r o c e s s o r s per n o d e # PBS - l n o d e s =8: ppn =16 # G i v e the job a n a m e # PBS - N C y l _ L E S _ s m a g # M P I _ B U F F E R _ S I Z E = 1 2 0 0 0 0 0 0 0
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Job control script - executing commands
# C h a n g e to o r i g i n a l w o r k i n g d i r e c t o r y cd $ P B S _ O _ W O R K D I R # p r e p a r e to run in p a r a l l e l d e c o m p o s e P a r > log . d e c o m p o s e P a r 2 >&1 # run the s o l v e r m p i r u n - np 128 p i m p l e F o a m - p a r a l l e l > log . i r i d i s _ r u n 2 >&1
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Submitting and viewing the job
I Submit the job to the queue
I To view the jobs currently queuing, running and recently cancelled
I Now, all we need to do is wait and hope the simulation doesn’t crash!
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Submitting and viewing the job
I Submit the job to the queue
Use
qsub Allrun
I To view the jobs currently queuing, running and recently cancelled
I Now, all we need to do is wait and hope the simulation doesn’t crash!
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Submitting and viewing the job
I Submit the job to the queue
I To view the jobs currently queuing, running and recently cancelled
I Now, all we need to do is wait and hope the simulation doesn’t crash!
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Submitting and viewing the job
I Submit the job to the queue
I To view the jobs currently queuing, running and recently cancelled
Use
qstat -u $YOUR USERNAME
I Now, all we need to do is wait and hope the simulation doesn’t crash!
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Submitting and viewing the job
I Submit the job to the queue
I To view the jobs currently queuing, running and recently cancelled
I Now, all we need to do is wait and hope the simulation doesn’t crash!
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Running the simulation
Some useful commands
I qsub - submit a job to the queue (the script is stored in memory so any changes made to it after submission won’t be applied)
I qstat - view your jobs, option -u is particularly useful
I showstart $JOB ID - get an estimated time required for a job to start
I showq - view the status of the queue, useful to redirect the output to a text file: showq > log.queue
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Summary
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Conclusions
I We’ve learned how OpenFOAM case is structured, how to
mesh and run a simple case
I The idea of introducing an initial solution for a Large Eddy Simulation case has been discussed
I Brief introduction to using a supercomputer to do CFD has been delivered
I A potential pitfal of using an incorrect solver type for a particular problem has been indicated
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary
Further reading
I OpenFOAM User Guide:
http://www.openfoam.org/docs/user/
I Chalmers’ OpenFOAM course materials:
http:
//www.tfd.chalmers.se/~hani/kurser/OS_CFD_2008/
I OpenFOAM Wiki FAQ page:
http://openfoamwiki.net/index.php/FAQLong
What is OpenFOAM? Using OpenFOAM Practice - Cylinder in uniform flow Summary