Skip to content

Latest commit

 

History

History
75 lines (54 loc) · 4.39 KB

updating.md

File metadata and controls

75 lines (54 loc) · 4.39 KB

Instructions to update code

Changing simulation parameters

var.h

  • To change precision (single or double) and velocity set used, alter the field PRECISION AND VEL. SET DEFINES.
  • To change output options, as intervals between saving macroscopics, the ID (identification), output folder path, etc. alter the field OUTPUT DEFINES.
  • To change the data treatment, its frequency, use it as stop condition, save it, etc. alter the field DATA TREATMENT DEFINES.
  • To change the initialization mode, alter the field INITIALIZATION LOADING DEFINES.
  • To change LBM parameters, as tau, lattice size, pressure and velocity values for boundary conditions, etc. alter the field SIMULATION DEFINES.

Changing boundary conditions

  1. Select a template in CUDA/boundaryConditionsBuilder/ and copy it to the same folder. Rename it with the name of the boundary conditions that will be implemented.
  2. Alter the functions gpuBuildBoundaryConditions() in the file copied to change the boundary conditions to the desired ones, following the template examples.
  3. If any boundary condition not implemented is required, the nodes using it must be classified as BC_SCHEME_SPECIAL and the function gpuSchSpecial() must be updated to treat the special case.
  4. Copy the file to the folder with the main.cu. Remove any other boundary condition implementation from the folder CUDA/.

images.png Figure 1 - Directions (north, south, east, west, front, back) and axis (x, y, z).

Observations:

  • The file nodeTypemap.h contains the boundary conditions schemes (Zou-He, bounce back, free slip, etc.). The folder CUDA/boundaryConditionsSchemes/ contains its implementation. It should be noticed that not all schemes are available for D3Q27 nor all the combinations of schemes and directions (e.g. Zou-He is not available for edges or corners).
  • Check compatibility between the boundary conditions scheme used and the collision operator (e.g. Zou-He implemented is not suitable for collision with force term).
  • Do not forget to change the author name in the file before upload or share it.
  • No case validation is guaranteed. Check it with the author if required.

Changing collision

lbm.cu

  • The folder CUDA/collisionSchemes/ has the implementation for collision schemes. Copy and paste the content of the file with the desired collision to the function gpuMacrCollisionStream(), between the macroscopics saving (after if(save){...}) and the streaming.
  • Compatibility between the boundary conditions and the collision must be checked (e.g. Zou-He not compatible with force).

Changing initialization

lbmInitialization.cu

  • Update gpuMacrInitValue() to change initial macroscopics.
  • Update gpuInitialization() to change initialization (default is equillibrium populations).

var.h

  • Change initialization mode to load macroscopics or populations from file.

Changing data treatment

macrProc.h

  • Update macrProc struct, adding or deleting required treated variables.
  • Update macrProc constructor and destructor (macrProc() and ~macrProc()).

treatData.cpp

  • Update treatData() to alter treatment of macroscopics data.
  • Update printTreatData() to alter the print of treated date.
  • Update stopSim() to alter the conditions to stop simulation by treated data.
  • Update saveTreatData() to alter the data to be saved.

Adding macroscopic

macroscopics.h

  • Update constructor and desctructor (macroscopics(), ~macroscopics()).
  • Update memory allocation and deallocation, if the macroscopic is an array (macrAllocation(), macrFree()).
  • Update copyMacr().

lbm.cu

  • Update LBM bulk (gpuMacrCollisionStream() and gpuUpdateMacr()).

lbmInitialization.cu

  • Update LBM initalization (gpuMacrInitValue() and gpuInitialization()).

lbmReport.cpp

  • Update saving functions (saveMacrBin()).

main.cu

  • If loading macroscopics from file is required, update where LOAD_MACR is.

var.h

  • If loading macroscopics from file is required, update macroscopics file names to be loaded.