First CFD Case

1. File structure

a. In CFD course

OpenFOAM suggests use of $FOAM_RUN directory which is ~/OpenFOAM/btu-10/run as default where btu is the user name and 10 is the version. However, I prefer to use the ~/OpenFOAM directory to locate our files in.

We are also going to share some files and folders from a GitLab repository with you during the course.

Therefore, to download that files which will be shared with you weekly, download downloadSharedFiles.sh and run the commands below.

chmod +x downloadSharedFiles.sh ; sudo ./downloadSharedFiles.sh

This script will create a directory on your ~ and put lecture01, lecture02... folders in it. We will study in those folders each week.

If this script does not update your ~/OpenFOAM directory as expected, first run

mkdir -p ~/OpenFOAM

on your terminal. Then repeat the ./downloadSharedFiles.sh command.

b. In OpenFOAM installation

/opt/openfoam10                                   # OpenFOAM installation directory
├── Allwmake                                      # Script for compiling OpenFOAM
├── applications                                  # Contains solvers, utilities, and source code of test cases
│   ├── Allwmake
│   ├── solvers                                   # Solvers for various physics and engineering problems
│   ├── test                                      # Test cases for validation
│   └── utilities                                 # Utility programs for pre/post-processing
├── bin                                           # Folder containing shell scripts for OpenFOAM utilities
│   ├── foamCleanCase                             # Script to clean simulation case directories
│   ├── foamCleanTutorials                        # Script to clean tutorial directories
│   ├── foamCloneCase                             # Script to clone cases
│   ├── foamInfo                                  # Script to display information about OpenFOAM
│   ├── foamJob                                   # Script to submit OpenFOAM jobs
│   ├── foamLog                                   # Script to manage log files
│   ├── foamMonitor                               # Script to monitor simulations
│   ├── foamNew                                   # Script to create new entities (e.g., applications, boundary conditions)
│   ├── foamNewApp                                # Script to create new applications
│   ├── foamNewBC                                 # Script to create new boundary conditions
│   ├── foamNewFunctionObject                     # Script to create new function objects
│   ├── paraFoam                                  # Script to start the ParaView with OpenFOAM reader
│   ├── ...                                       # Other utility scripts
│   └── tools                                     # Additional tools and scripts
├── COPYING                                       # License file
├── doc                                           # Contains the documentation and guides of OpenFOAM
│   ├── Allwmake
│   ├── codingStyleGuide.org                      # Coding style guide
│   ├── Doxygen                                   # Doxygen documentation
│   ├── Guides                                    # User and programmer guides
│   └── tools                                     # Tools related to documentation
├── etc                                           # Contains environment files, global instructions, templates
│   ├── bashrc                                    # Bash resource configuration for setting OpenFOAM environment
│   ├── caseDicts                                 # Templates for case dictionaries
│   ├── cellModels                                # Definitions of cell models
│   ├── codeTemplates                             # Templates for coding
│   ├── config.csh                                # C-shell configuration
│   ├── config.sh                                 # Bash configuration
│   ├── controlDict                               # Template for controlDict
│   ├── cshrc                                     # C-shell resource configuration
│   ├── paraFoam                                  # Configuration for paraFoam
│   ├── README.org                                # Readme file
│   ├── templates                                 # General templates
│   └── thermoData                                # Thermodynamic data files
├── platforms                                     # Contains the binaries after compilation
│   ├── linux64GccDPInt32Opt                      # Directory for specific platform binaries
│   │   ├── applications                          # Compiled applications
│   │   ├── bin                                   # Compiled binaries
│   │   ├── lib                                   # Libraries
│   │   └── src                                   # Source code
│   └── linux64GccDPInt32OptSYSTEMOPENMPI         # Directory for MPI-related binaries
│       └── src
├── README.org                                    # Main README file
├── src                                           # Contains the core source code for all foundation libraries
│   ├── Allwmake
│   ├── combustionModels                          # Models related to combustion
│   ├── finiteVolume                              # Finite volume method related code
│   ├── fvModels                                  # Finite volume models
│   ├── lagrangian                                # Lagrangian particle tracking models
│   ├── MomentumTransportModels                   # Models for momentum transport
│   ├── OpenFOAM                                  # Core OpenFOAM libraries
│   ├── parallel                                  # Parallel computing support
│   ├── sampling                                  # Sampling and probing utilities
│   ├── sixDoFRigidBodyMotion                     # Solver for six degrees of freedom rigid body motion
│   ├── thermophysicalModels                      # Thermophysical models
│   ├── transportModels                           # Transport models for different materials
│   └── waves                                     # Models for wave simulation
├── test                                          # Test directory
├── tutorials                                     # Contains tutorial files for learning and testing OpenFOAM
│   ├── Allclean                                  # Script to clean all tutorials
│   ├── Allrun                                    # Script to run all tutorials
│   ├── Alltest                                   # Script to test all tutorials
│   ├── basic                                     # Basic tutorials
│   ├── combustion                                # Tutorials for combustion simulations
│   ├── compressible                              # Tutorials for compressible flow simulations
│   ├── discreteMethods                           # Tutorials for discrete methods
│   ├── DNS                                       # Direct Numerical Simulation tutorials
│   ├── electromagnetics                          # Tutorials for electromagnetics simulations
│   ├── financial                                 # Tutorials for financial modeling
│   ├── heatTransfer                              # Tutorials for heat transfer simulations
│   ├── incompressible                            # Tutorials for incompressible flow simulations
│   ├── lagrangian                                # Tutorials for Lagrangian particle methods
│   ├── mesh                                      # Tutorials for mesh generation and manipulation
│   ├── multiphase                                # Tutorials for multiphase flow simulations
│   ├── resources                                 # Additional resources for tutorials
│   └── stressAnalysis                            # Tutorials for stress analysis
└── wmake                                         # Contains the files for compilation of OpenFOAM
    ├── makefiles
    ├── platforms
    ├── rules
    ├── scripts
    ├── src
    ├── wclean
    ├── wcleanLnIncludeAll
    ├── wcleanPlatform
    ├── wdep
    ├── wmake
    ├── wmakeFilesAndOptions
    ├── wmakeLnInclude
    ├── wmakeLnIncludeAll
    └── wrmo

Source (20.02.24): http://www.wolfdynamics.com/tutorials.html?layout=edit&id=181

Some alias words can be used in Ubuntu to go to the OpenFOAM, applications, src, and tutorials directories, for example;

alias foam=‘cd $WM_PROJECT_DIR’
alias app=‘cd $FOAM_APP’
alias src=‘cd $FOAM_SRC’
alias tut=‘cd $FOAM_TUTORIALS’

These aliases are defined in /opt/openfoam10/etc/config.sh/aliases file (60th line).

c. In a simulation

case_name                           # Root directory for the simulation case
├── 0                               # Initial conditions (ICs) and boundary conditions (BCs) directory
│ ├── p                             # Pressure field initial and boundary conditions
│ └── U                             # Velocity field initial and boundary conditions
├── constant                        # Directory for constant properties across the simulation
│ ├── polyMesh                      # Mesh information
│ │ ├── boundary                    # Boundary definitions for the mesh
│ │ ├── faces                       # List of faces making up the mesh
│ │ ├── neighbour                   # Index of neighboring cells for each face
│ │ ├── owner                       # Index of owning cells for each face
│ │ └── points                      # Coordinates of mesh points
│ └── transportProperties           # Physical and transport properties of the fluid
├── system                          # System configuration and numerical settings
│ ├── controlDict                   # Time control and application execution options
│ ├── fvSchemes                     # Discretization schemes for differential equations
│ └── fvSolution                    # Solver and algorithm settings for the linear solvers
└── time_directories                # Directories for storing results at subsequent times, not a literal directory name but a placeholder for directories like "100", "200" representing simulation time steps