A Crash Introduction to the Finite Volume Method and Discretization Schemes in Openfoam®

A Crash Introduction to the Finite Volume Method and Discretization Schemes in Openfoam®

OpenFOAM® Beginner training session Presented at the 15th OpenFOAM workshop. June 22-26, 2020. Arlington, VA, USA. http://www.cpe.vt.edu/ofw15/ A Crash Introduction to the Finite Volume Method and Discretization Schemes in OpenFOAM® 1 Copyright and disclaimer This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM® and OpenCFD® trademarks. Wolf Dynamics makes no warranty, express or implied, about the completeness, accuracy, reliability, suitability, or usefulness of the information disclosed in this training material. This training material is intended to provide general information only. Any reliance the final user place on this training material is therefore strictly at his/her own risk. Under no circumstances and under no legal theory shall Wolf Dynamics be liable for any loss, damage or injury, arising directly or indirectly from the use or misuse of the information contained in this training material. All trademark are property of their owners. Revision 1-2020 Joel Guerrero 2 Conventions used • The following typographical conventions are used in this training material: • Text in Courier new font indicates Linux commands that should be typed literally by the user in the terminal. • Text in Courier new bold font indicates directories. • Text in Courier new italic font indicates human readable files or ascii files. • Text in Arial bold font indicates program elements such as variables, function names, classes, statements and so on. It also indicate environment variables, and keywords. They also highlight important information. • Text in Arial underline in blue font indicates URLs and email addresses. • This icon indicates a warning or a caution. • This icon indicates a tip, suggestion, or a general note. • This icon indicates a folder or directory. • This icon indicates a human readable file (ascii file). • This icon indicates that the figure is an animation (animated gif). • These characters $> indicate that a Linux command should be typed literally by the user in the terminal. 3 Conventions used • The following typographical conventions are used in this training material: • Large code listing, ascii files listing, and screen outputs can be written in a square box, as follows: 1 #include <iostream> 2 using namespace std; 3 4 // main() is where program execution begins. It is the main function. 5 // Every program in c++ must have this main function declared 6 7 int main () 8 { 9 cout << "Hello world"; //prints Hello world 10 return 0; //returns nothing 11 } • To improve readability, the text might be colored. • The font can be Courier new or Arial bold. • And when required, the line number will be shown. 4 Before we begin On the training material • This training is based on OpenFOAM® version 7. • You can extract the training material wherever you want. From now on, this directory will become: • $TM • To uncompress the training material go to the directory where you copied it and then type in the terminal, • $> tar –zxvf file_name.tar.gz • In every single tutorial, you will find the file README.FIRST. In this file you will find the general instructions of how to run the case. In this file, you might also find some additional comments. • You will also find a few additional files (or scripts) with the extension .sh, namely, run_all.sh, run_mesh.sh, run_sampling.sh, run_solver.sh, and so on. These files can be used to run the case automatically by typing in the terminal, for example, • $> sh run_solver. • If you are a beginner, we highly recommend to open the README.FIRST file and type the commands in the terminal, in this way, you will get used with the command line interface and OpenFOAM® commands. • If you are already comfortable with OpenFOAM®, use the automatic scripts to run the cases. 5 Before we begin • In this training, we will focus our eyes to train our brain. 6 Roadmap 1. Important concepts to remember 2. The Finite Volume Method: An overview 3. The FVM in OpenFOAM®: some implementation details and computational pointers 4. Some kind of conclusion 5. What else we did not cover? 6. Goodbye 7 Roadmap 1. Important concepts to remember 2. The Finite Volume Method: An overview 3. The FVM in OpenFOAM®: some implementation details and computational pointers 4. Some kind of conclusion 5. What else we did not cover? 6. Goodbye 8 Important concepts to remember • Let us recall linear interpolation. • In reference to the figure below, to find the value of the quantity in f, using the known values of in P and N, we can proceed as follows, 9 Important concepts to remember • Let us recall the Gauss theorem (also know as Divergence theorem or Ostrogradsky theorem), where is a closed surface bounding the control volume and represents an infinitesimal surface element with associated normal pointing outwards of the surface , and . • The Gauss or Divergence theorem simply states that the outward flux of a vector field through a closed surface is equal to the volume integral of the divergence over the region inside the surface. 10 Important concepts to remember • Let us recall Taylor series expansions (TSE), they are used to define our profile assumptions, to reconstruct cell centered variables to face center variables, to compute derivatives, to determine truncation errors and so on. • According to TSE, any continuous differentiable function can be expressed as an infinite sum of terms that are calculated from the values of the function derivatives at a single point. • For example, using TSE the node center E in the figure can be approximated as, • And the face center e can be approximated as, 11 Important concepts to remember • During this discussion, we will use the general transport equation to explain the fundamentals of the finite volume method. • But have in mind that starting from the general transport equation we can write down the Navier-Stokes equations (NSE). For example, by setting the variables to, • We can obtain the continuity equation, 12 Important concepts to remember • During this discussion, we will use the general transport equation to explain the fundamentals of the finite volume method. • But have in mind that starting from the general transport equation we can write down the Navier-Stokes equations (NSE). For example, by setting the variables to, • We can obtain the momentum equations, 13 Important concepts to remember • During this discussion, we will use the general transport equation to explain the fundamentals of the finite volume method. • But have in mind that starting from the general transport equation we can write down the Navier-Stokes equations (NSE). For example, by setting the variables to, • We can obtain the momentum equations, 14 Important concepts to remember • Contrary to commercial CFD solvers, in OpenFOAM® there are no default values. • It is up to the user to find those values. • However, following good standard practices and knowing a little bit the theory is a very good starting point. • Our goal is to give you the best standard practices and default values (ours) to be used with OpenFOAM®. 15 Roadmap 1. Important concepts to remember 2. The Finite Volume Method: An overview 3. The FVM in OpenFOAM®: some implementation details and computational pointers 4. Some kind of conclusion 5. What else did not cover? 6. Goodbye 16 The Finite Volume Method: An overview • Let us use the general transport equation as the starting point to explain the FVM, • We want to solve the general transport equation for the transported quantity in a given domain, with given boundary conditions BC and initial conditions IC. • This is a second order equation. For good accuracy, it is necessary that the order of the discretization is equal or higher than the order of the equation that is being discretized. • Remember, starting from this equation we can write down the Navier-Stokes equations (NSE). So everything we are going to address also applies to the NSE. 17 The Finite Volume Method: An overview • Let us use the general transport equation as the starting point to explain the FVM, • Hereafter we are going to assume that the discretization practice is at least second order accurate in space and time. • As consequence of the previous requirement, all dependent variables are assumed to vary linearly around a point P in space and instant t in time, Profile assumptions using Taylor expansions around point P (in space) and point t (in time) 18 The Finite Volume Method: An overview Mesh data, geometrical information, and variable arrangement 19 The Finite Volume Method: An overview • Let us divide the solution domain into a finite number of arbitrary control volumes or cells, such as the one illustrated below. • The control volumes can be of any shape (e.g., tetrahedrons, hexes, prisms, pyramids, dodecahedrons, and so on). • The only requirement is that the faces that made up the control volume need to be planar. • Inside each control volume the solution is sought. • We also know which control volumes are internal and which control volumes lie on the boundaries. • We know all the geometrical information of all cells. That is, cell centers, face centers, cells neighbors, face connectivity, cells volume, faces area, vectors connecting cells centers, and so on. 20 The Finite Volume Method: An overview • In the control volume illustrated, the centroid P and face center f are known, and computed as, • We also assume that the values of all variables are computed and stored in the centroid of the control volume Vp, this is known as the collocated arrangement. • We also assume that all variables are represented by a piecewise constant profile (the mean value), • All approximations and assumptions taken so far are at least second order accurate. 21 The Finite Volume Method: An overview • Putting all together, it is a lot geometrical information that we need to track.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    156 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us