================================================================================= CBSFlow (2d/3d) Incompressible ------------------------------ Written by Rhodri Bevan Zeta Computational Resources Ltd www.zetacomp.com Uses Characteristic Based Split Scheme for Convection Stabilisation ================================================================================= Source codes - General information ------------------------------------ Please read this information before using the codes. No guarantee is given on any of the source codes provided. All the source codes are copyrighted and no part of the code should be reproduced without the written permission of the author. The code is for personal use only. Improved and updated versions of the codes will be available via our website in due course. If you wish to be kept up to date, then please use the contact form to provide an email address. Full 3d (serial and parallel) codes are also available via the website. User Guide: Fully-Explicit/Semi-Implicit (2d/3d) Incompressible code ====================================================================== The CBSFlow executable requires a CASENAME to be provided during runtime. This CASENAME defines the input files. CBSFlow requires 3 input files. A mesh file (.plt extension), a boundary definition file (.bco extension) and a parameters file (.par extension). Using the lid-driven cavity example files (re400), the CASENAME would be LT20x4x20 and the input files would be: 1. LT20x4x20.plt 2. LT20x4x20.bco 3. LT20x4x20.par Mesh File Layout (Serial) -------------------------- The 1st line defines the size of the mesh: Number of elements (NELEM), Number of Points (NPOIN), Number of Boundary Sides (NBOUN). Then follows the element connectivity table (INTMA) for each element. The element number is first, followed by the nodes within the element (e.g. tetrahedron). Afterwards comes the coordinates for each node (COORD), again with the node number first, followed by the x,y (and z if appropriate) coordinates. Finally, information on the boundary sides (ISIDE). The one from last number is the element number to which the side belongs. The final number is the boundary side number. This boundary side number is replaced during run-time with information from the boundary condition file. The remaining numbers are the nodes making up the face. Boundary Condition File ------------------------- The 1st line defines how many boundary side types are present in the mesh (NFLAG). Following this will then be NFLAG entries in the FLAG_LIST array. This array replaces boundary side numbers in the PLT file with boundary flag codes. This procedure is to avoid regenerating the mesh each time you change the boundary conditions. Currently, The available flag codes are: ! 500 - adiabatic with prescribed velocity ! 501 - constant temperature with no-slip (T = 1) ! 502 - constant temperature with no-slip(T = 0) ! 503 - constant temperature (T = 0) prescribed velocity (u=1,v=0) ! 504 - pressure boundary ! 505 - velocity symmetry, no-flux energy ! 506 - velocity symmetry, no-flux energy ! 507 - Backward Facing Step (Re=229) Parabolic Boundary (with v=0) Two velocity symmetry boundary conditions allow for 2 planes of symmetry to intersect. Point normals extracted from the face information are utilised to enforce symmetry. If 2 planes intersect then 2 point normal conditions are required to ensure both planes are accounted for. Parameters File ----------------- The parameters file is comprised of text outlining what parameters come next in the file, and the parameters themselves. The layout of the file cannot be changed, or CBSFlow will not function correctly, if at all. The 1st parameter (line 2) controls whether the energy equation is used. Line 4 proscribes the freestream conditions that are used as an initial solution (if a restart solution is not used). Five values are required (Ux, Uy, Uz, P and T). The 6th line contains information on number of iterations/ pseudo time-step parameters. The max number of pseudo time-steps per real time-step is controlled by NTIME. The local time-step can be fixed to a constant value (using DTFIXED fourth entry in line, ON = 1, 0 = local, -1 = Global minimum of local values). The next variable in the line is DTFIX, the variable defines the fixed value if appropriate. Even if not used, this entry (like others) must be present. The 4th entry in the line (IWRITE) denotes how often the convergence check/screen output is undertaken. The final entry is an upper scaling limit on the local timestep. This can improve solution times in some instances. The 8th line is transient related. The first entry controls the order of the backward difference formula (BDF). Currently, BDF options are 1st/2nd/3rd Order. Since BDFs are not self-starting, an adaptive BDF order can also be applied. A positive value (1 to 3), would give a fixed 1/2/3rd order BDF respectively. A negative value (-1 to -3) would provide an adaptive BDF up to the order of the absolute value specified. A -3 entry would result in the first real step using 1st Order BDF, then 2nd BDF for 2nd step and finally 3rd BDF for 3rd step and above. A zero value in this entry will denote steady state. The 2nd entry in the line controls whether a consistent (0) or lumped (1) mass matrix is used for the transient term. The 10th line denotes a safety factor (CSAFM), and THETA1. The safety factor is used during the local time-stepping calculation to reduce the used local time-step below the critical value. THETA1 is the value used in the continuity equation. Theta(2) is hard-coded as 0 or 1, depending on whether explicit/semi-implicit is used in Step 2. Line 12 contains the problem's Reynolds Number, Prandtl Number, Rayleigh Number and Richardson Number. Line 14 defines the CONVECTION_TYPE, whether Forced/Mixed (0) or Natural (1) Convection. Line 16 provides alternate pressure boundary conditions if none are specified. If no pressure boundary conditions are specified, then a single node must have a pressure condition imposed for semi-implicit. The node number is specified in line 16, but ignored if boundary conditions are present. The second entry is the pressure value. Line 18 contains the number of real time steps (if transient is on) and the size of the real time step. Line 20 controls the solver used in Step 2 (Pressure). If 1, then semi-implicit strategy is used, with Conjugate Gradient solver. If 0, then the solution approach is matrix-free and fully explicit with artificial compressibility. Line 22 controls the fully explicit options, namely the artificial wave speed (either local 0, or fixed 1) and a proscribed constant epsilon. Line 24 controls the semi-implicit solver - conjugate gradient tolerances for the residual (relative and absolute). Line 26 controls the steady state tolerances (L2 norm - velocity and pressure). First entry (0 - OFF, 1 - ON) for Velocity, followed by tolerance value itself. Third entry is ON (1)/ OFF (0) for Pressure, followed by tolerance. Line 28 controls the steady state tolerance for energy (L2 norm). First entry (0 - OFF, 1 - ON) and second entry is tolerance. If the energy equation is not solved, then the tolerance is ignored. Output type is controlled by line 30. A positive value in the appropriate entry will result in output of that file at the interval specified by the entry. E.g. a value of 10 means output every 10 real time steps. The first entry enables (+) or disables (0) Paraview Output, second entry enables (+ve) or disables (0) Tecplot output. The third and fourth entries control Variable output to file and Restart output options (0 is OFF, +ve is ON). The fifth entry controls local Nusselt profile output and the final entry is the boundary flag code for the Nusselt profile generator. If energy is off, then Nusselt is not calculated. Line 32 controls output of velocity and pressure variables (and temperature if on) at a specified point, if enabled. The first entry is ON (1) or OFF (0). The remaining values in the line are the coordinate of the point of interest. This can be useful for outputting information necessary for Strouhal number calculation without needing a more advanced post-processor. If a post-processor is required, then outputting of information to the Variable File (3rd entry on Line 30) is recommended. Line 34 contains a single option for Run Time Control. 1 is ON, 0 is OFF. If on, then CBSFlow will update the simulation with new values whenever the Parameters file is modified (and saved). Only certain values can be changed during run-time however, to avoid calculation issues. If the wrong value is changed, this will not have an effect on the simulation and the simulation will need to be stopped and restarted for it to be updated. Running CBSFlow ------------------ After compiling the program, for example using gfortran, then the program can be run from the command line with one text input file in the command. e.g. prompt:> cbsflow < program_run_options.dat This would require program_run_options.dat to be located in the current directory. Otherwise , if located in a subdirectory the command would be: prompt:> cbsflow2d < ./a_subdirectory/program_run_options.dat The program_run_options.dat file would consist of entries CASENAME INPUT_FOLDER OUTPUT_FOLDER ELEMENT_TYPE INPUT_FORMAT OUTPUT_FORMAT RESTART_OPT The CASENAME entry has already been explained. The INPUT_FOLDER and OUTPUT_FOLDER entries are self-explanatory. A folder location such as ./a_subdirectory/ should be provided in quotation './a_subdirectory/'. The ELEMENT_TYPE can be 1. Triangle (3 noded element, 2 noded side) 2. Quadrilateral (4 noded element, 2 noded side) 3. Tetrahedron (4 noded element, 3 noded face) 4. Hexahedron (8 noded element, 4 noded face) 5. Triangle (6 noded element, 3 noded side) 7. Tetrahedron (10 noded element, 6 noded face) The PARAVIEW NODAL ARRANGEMENT IS USED. The INPUT_FORMAT and OUTPUT_FORMAT values can be either (1) FORMATTED or (0) UNFORMATTED. Input unformatted is the mesh PLT file. Other input files would still be formatted. The output entry relates to the Variable File and the Restart File only. The Tecplot and Paraview outputs remain formatted whatever. The RESTART_OPT can be (1) USE if available or (0) DONT USE even if present in the INPUT_FOLDER. Screen Output ------------- During run-time, some output to screen occurs. This information is intended to inform the user as to the progress of the iterative scheme. Both L2 Norm information and residual information is presented. It is advised that the user consult the example benchmark files provided on www.zetacomp.com If any bugs are detected, then the authors would like to be informed (via email/the contact form located on the website). Feedback is also welcomed. However, only limited complementary support may be provided, and on a case-by-case basis. Additional software will be added to the website in due course.