Study for the Validation of Code Saturne for Turbulent Flow Simulations Appendices

Study for the Validation of Code Saturne for Turbulent Flow Simulations Appendices

Study for the Validation of Code Saturne for Turbulent Flow Simulations Appendices Jordi Amat Foraster June 2017 Study for the Validation of Code Saturne for Turbulent Flow Simulations Appendices by Jordi Amat Foraster to obtain the degree of Bachelor of Science in Aerospace Technology Engineering, Escola Superior d’Enginyeries Industrial, Aeronàutica i Audiovisual de Terrassa (ESEIAAT) Universitat Politècnica de Catalunya Student name: Jordi Amat Foraster Project duration: February 15, 2017 – June 10, 2017 Thesis supervisor/s: Prof. Arnau Miró Jané, ESEIAAT (DFIS), director Prof. Dr. Manel Soria Guerrero, ESEIAAT (DFIS), director An electronic version of this thesis is available at http://upcommons.upc.edu. Contents Contents i List of Figures ii A An introduction to Code_Saturne 1 A.1 Workflow ................................... 1 A.1.1 Meshes ................................ 2 A.1.2 Preprocessor ............................. 2 A.1.3 Graphical User Interface ....................... 3 A.1.4 User Subrutines ........................... 3 A.1.5 Kernel ................................. 4 A.1.6 Postprocessing ............................ 4 A.2 Directory Hierarchy .............................. 5 A.3 Setting Up and Running a Calculation ................... 6 A.4 Spatial Discretization ............................. 7 A.4.1 Gradient Calculation ......................... 8 A.4.2 Convective Scheme ......................... 8 A.5 Time Discretization .............................. 9 A.5.1 Pressure-based velocity-pressure solver .............. 9 A.6 Turbulence Models .............................. 10 A.7 Linear System Resolution .......................... 11 B Rates of Strain 12 C Mathematical Proofs 14 C.1 Global Kinetic Energy Equation ....................... 14 C.2 Velocity-Pressure Coupling of the Taylor-Green Vortex Flow ....... 16 References 18 i List of Figures A.1 Code_Saturne workflow diagram (inspired by Code_Saturne user’s man- ual[1]). ..................................... 1 A.2 Code_Saturne structure diagram. ...................... 5 A.3 Collocated arrangement of discrete variables. ............... 7 ii A An introduction to Code_Saturne The purpose of this appendix is to review the main features of Code_Saturne CFD software, as well as to serve as a simple and summarized guide to start using Code_Saturne. A.1 Workflow Code_Saturne workflow is represented in Fig. A.1. Figure A.1: Code_Saturne workflow diagram (inspired by Code_Saturne user’s man- ual[1]). 1 Appendix A. An introduction to Code_Saturne 2 A.1.1 Meshes Code_Saturne does not include a mesh generator, however, it supports multiple mesh formats. All of these formats have advantages and disadvantages (in terms of simplicity, functionality, longevity and popularity) when compared to each other. The following formats are currently supported by Code_Saturne : − .des from SIMAIL package. − .unv from I-deas universal tool. − .med from Salomé platform. − .cgns is a generic format. − .msh from the Gmsh tool. − .case from Ensight 6 or Ensight Gold tools. − .neu from Ansys FLUENT’s GAMBIT meshing tool. − .ccm from STAR-CCm+ tool. All these formats are described in greater detail in Code_Saturne user’s manual[1]. A.1.2 Preprocessor Mesh operations are handled by the Preprocessor, which works independently from the Kernel. The main interesting operations are: − Mesh import and read. − Mesh modification operations such as joining, periodicity and smoothing. − Mesh quality criteria computation to check the mesh consistency. The resulting data is transferred to the Kernel through specific files, named mesh_input, or placed in a directory of that name when multiple meshes are imported. In Code_Saturne user’s manual[1] it is encouraged to separate the preprocessing and cal- culation runs, as this not only speeds up calculations, but also ensures that the mesh is identical, regardless of the architecture or number of processors it is run on. Appendix A. An introduction to Code_Saturne 3 A.1.3 Graphical User Interface An optional Graphical User Interface (GUI) is available with Code_Saturne for config- uring the main parameters of the simulation (in .xml file). The GUI manages calcu- lation parameters, standard initialization values and boundary conditions for standard physics, pulverized fuel combustion, gas combustion, atmospheric flows, Lagrangian module, electrical model, compressible model and radiative transfers. If needed, the reader is encouraged to follow the Code_Saturne tutorial[2] to get used to the GUI. A.1.4 User Subrutines Code_Saturne provides great capabilities and user customization via C and Fortran subroutines. The running script runcase will compile all files in the SRC directory and link them with the existing libraries. Subroutines will have precedence to any settings on the .xml files from the GUI. The user’s subroutines are in the REFERENCE directory inside SRC and among others, some of the most important are: − cs_user_parameters.f90. Set physical and numerical calculation parameters. − cs_user_boundary_conditions.f90. Boundary conditions definitions (e.g., slid- ing or non-slip walls). − cs_user_physical_properties.f90. Definition of physical properties (e.g., vari- able viscosity or density). − cs_user_initialization.f90. Initialization of variables (e.g., velocity field). − cs_user_extra_operations.f90. Extra operations, i.e., computation of forces, profiles or probes. − cs_user_postprocess.f90. Post-processing of extra variables (e.g., vorticity). − cs_user_periodicity.c. Definition of periodicity conditions. If the reader wants to program his own subroutines is a must to refer to the Code_Saturne user’s manual[1]. Appendix A. An introduction to Code_Saturne 4 A.1.5 Kernel The Kernel module is the main program that recompiles the subroutines, reads the .xml and launches the case. A.1.6 Postprocessing Code_Saturne generally saves two output meshes: − Volume: for fluid variables such as pressure, velocity, etc. − Boundary: for wall defined variables such as efforts, fluxes, etc. They can all be set through the GUI. Additional output can be achieved through subrou- tines. All the this post-processing output in the .case format (both volume and boundary) is saved on the postprocessing directory and can be opened using Paraview open- source for its visualization. For visualizing the part, the Extract Block filter must be applied and the Fluid domain part must be selected. As Code_Saturne is a finite vol- ume collocated code, the information is on the cell centers. To interpolate the data to the nodes (for a smoother visualization), the celldata2pointdata filter must be used. Monitoring points can be defined whether in the GUI or in cs_user_parameters.f90. The monitoring points saved in the monitoring directory can be visualized via Matlab or Paraview. Appendix A. An introduction to Code_Saturne 5 A.2 Directory Hierarchy Code_Saturne is structured into studies that compress several cases as shown in Fig. A.2: Figure A.2: Code_Saturne structure diagram. The STUDY directory contains: − A directory MESH containing the mesh(es) necessary for the study. − A directory POST for the potential post-processing scripts (not used directly by the code). − One or several CASE directories for the calculations. Every CASE directory contains: − A directory DATA for the calculation data, the user script and the .xml file. − A directory SRC for the potential user subroutines necessary for the calculation. − A directory SCRIPTS for the runcase script to launch the calculation. − A directory RESU for saving the results after the simulation has finished. The case preparer command code_saturne create automatically creates a study di- rectory according to the typical architecture when typing: code_saturne create -s STUDY -c CASE_NAME1 CASE_NAME2 Appendix A. An introduction to Code_Saturne 6 This syntax creates a study directory STUDY with case subdirectories CASE_NAME1 and CASE_NAME2. If no case name is given, a default case directory called CASE1 is created. To improve the calculation traceability, the files and directories sent to RESU after a calculation are placed in a subdirectory named after that run’s ”id”, which is by default based on the run date and time, using the format: STUDY/CASE/RESU/YYYYMMDD- hhmm. See Code_Saturne user’s manual[1] for specific information about all the files sent to RESU. A.3 Setting Up and Running a Calculation This paragraph summarises the basic steps which are necessary to prepare and run a standard case: − Open a new terminal and prepare the directories using the code_saturne create command (see Section A.2). − Place the mesh(es) in the directory MESH. Make sure they are in a format com- pliant with Code_Saturne (see section A.1). − Go to the directory DATA and launch the GUI using the command ./SaturneGUI. − If not using the GUI, copy the DATA/REFERENCE/cs_user_scripts.py file to DATA and edit it, so that the correct run options and mesh paths may be set. Just as with user subroutines, settings defined in this file have priority over those defined in the GUI. − Place the necessary user subroutines in the directory SRC. When not using the Interface, some subroutines are compulsory (see the list in Code_Saturne user’s manual[1]). − Run the code_saturne run --initialize command to generate a folder in the RESU directory with the solver and the mesh files (it is highly recommended to rename this folder as a mesh folder). − Go into the directory src_saturne and edit the user subroutines to prepare the calculation. Then, compile them through code_saturne compile and substitute the

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    23 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