Microflow 3D  v1.0
CaseParameters.cpp
Go to the documentation of this file.
1 // ==============================================================================================
2 // Microflow 3D, http://www.microflow.pwr.edu.pl/
3 // Created by Roman Szafran on 28.04.19.
4 // Copyright (c) 2019 Wroclaw University of Science and Technology.
5 // Distributed under the Apache License, Version 2.0. You may obtain a copy of the License at
6 // http://www.apache.org/licenses/LICENSE-2.0 or see accompanying file license.txt.
7 // Redistributions of source code must retain the above copyright and license notice.
8 // ==============================================================================================
9 
10 #include "CaseParameters.h"
11 
12 MF::Solver_CPU::CaseParameters::CaseParameters(const std::shared_ptr<MF::Database::ConfigData>& ConfigData_Ptr) {
13  try {
14  //Geometry parameters
15  GeometryName = ConfigData_Ptr->getCaseStringParam("GeometryParams.GeometryName");
16  VoxelSize = ConfigData_Ptr->getCaseFloatParam("GeometryParams.VoxelSize");
17  PhysicalVoxelSize = ConfigData_Ptr->getCaseFloatParam("GeometryParams.PhysicalVoxelSize");
18  AddInnerWall = ConfigData_Ptr->getCaseFloatParam("GeometryParams.AddInnerWall");
19 
20  //Parameters of model
21  GeometryDefinition = (GeometryDefinitionClass) ConfigData_Ptr->getGeometryDefinition();
22  FluidFlowModel_MT = (FlowTypeClass) ConfigData_Ptr->getFlowType();
23  CollisionModel_KT = (ModelTypeClass) ConfigData_Ptr->getModelType();
24  LatticeType_La = (LatticeTypeClass) ConfigData_Ptr->getLatticeType();
25 
26  //Physical parameters of simulation
27  FluidPhysicalViscosity_Nu_Phys = ConfigData_Ptr->getCaseFloatParam("PhysicalParams.FluidPhysicalViscosity_Nu_Phys");
28  FluidPhysicalReferenceDensity_Rho0_Phys = ConfigData_Ptr->getCaseFloatParam("PhysicalParams.FluidPhysicalReferenceDensity_Rho0_Phys");
29  Tau = ConfigData_Ptr->getCaseFloatParam("PhysicalParams.Tau");
30  ForceX_fiz = ConfigData_Ptr->getCaseFloatVectorParam(0, "PhysicalParams.XYZForce_fiz");
31  ForceY_fiz = ConfigData_Ptr->getCaseFloatVectorParam(1, "PhysicalParams.XYZForce_fiz");
32  ForceZ_fiz = ConfigData_Ptr->getCaseFloatVectorParam(2, "PhysicalParams.XYZForce_fiz");
33 
34  //Case characteristic parameters
35  CharactLengthPhysical_L_CH_Phys = ConfigData_Ptr->getCaseFloatParam("CharactersticParams.CharactLengthPhysical_L_CH_Phys");
36  CharactVelocityPhysical_U_CH_Phys = ConfigData_Ptr->getCaseFloatParam("CharactersticParams.CharactVelocityPhysical_U_CH_Phys");
37 
38  //Termination conditions
39  Sc_VelocityResidueError_ErrV = ConfigData_Ptr->getCaseFloatParam("TerminationCondition.Sc_VelocityResidueError_ErrV");
40  MassFlowError_ErrM = ConfigData_Ptr->getCaseFloatParam("TerminationCondition.MassFlowError_ErrM");
41 
42  //Initial and reference conditions
43  ReferenceDensityLB_Rho0_LB = ConfigData_Ptr->getCaseFloatParam("InitialCondition.ReferenceDensityLB_Rho0_LB");
44 
45  XInitialVelocityUx0_Phys = ConfigData_Ptr->getCaseFloatVectorParam(0, "InitialCondition.XYZInitialVelocityPhysical_U0");
46  YInitialVelocityUy0_Phys = ConfigData_Ptr->getCaseFloatVectorParam(1, "InitialCondition.XYZInitialVelocityPhysical_U0");
47  ZInitialVelocityUz0_Phys = ConfigData_Ptr->getCaseFloatVectorParam(2, "InitialCondition.XYZInitialVelocityPhysical_U0");
48 
49  //Parameters of automatic detection and addition of boundary nodes
50  DefaultWallNode_BN = ConfigData_Ptr->getCaseIntParam("DefaultBoundaryCondition.DefaultWallNode_BN");
51  DefaultNode_NN = ConfigData_Ptr->getCaseIntParam("DefaultBoundaryCondition.DefaultNode_NN");
52 
53  // Global parameters calculated during initialization
54  XNodesNumber_Nx1 = (0);
55  YNodesNumber_Ny1 = (0);
56  ZNodesNumber_Nz1 = (0);
57  ReynoldsNumber_Re = (0.0);
59  DTPhysical_Dt_Phys = (0.0);
62  ForceX_LB = (0.0);
63  ForceY_LB = (0.0);
64  ForceZ_LB = (0.0);
68 
69  //MFThread parameters
70  ThreadMaxSize = ConfigData_Ptr->getCaseIntParam("ThreadParams.MFThreadMaxSize");
71 
72  //Calculation and display parameters
73  CheckPointNumberRead_CHP_R = ConfigData_Ptr->getCaseIntParam("RWParams.CheckPointNumberRead_CHP_R");
74  VTKWriteStep_VTK_W = ConfigData_Ptr->getCaseIntParam("RWParams.VTKWriteStep_VTK_W");
75  VTKFileMaxNumber_VTK_Max = ConfigData_Ptr->getCaseIntParam("RWParams.VTKFileMaxNumber_VTK_Max");
76  ConsoleWriteStep_K_W = ConfigData_Ptr->getCaseIntParam("RWParams.ConsoleWriteStep_K_W");
77 
78  //Mass balance surface choice params
79  AutomaticSurfaceChoice = ConfigData_Ptr->getCaseBooleanParam("BalanceParams.AutomaticSurfaceChoice");
80 
81  // CPU parameters
82  CPU_ThreadsNr = ConfigData_Ptr->getCaseIntParam("CPUParams.CPU_ThreadsNr");
83 
84  }
85  catch (const config4cpp::ConfigurationException &exception) {
86  std::cout << "[CaseParameters::Initialize] Error during initialization of case parameter from a file: ";
87  std::cout << exception.c_str() << std::endl;
88  exit(EXIT_FAILURE);
89  }
90 }
double PhysicalVoxelSize
Length in [m] that corresponds to 1 Lu (lattice unit length) or one voxel edge length. Physical length [m] corresponding to one unit length in LB (distance between two nodes).
double FluidLBuViscosity_Nu_LB
Kinematic viscosity LB.
double ForceY_LB
The Y component of the volumetric force, e.g. the force of gravity.
int DefaultWallNode_BN
The default type of node on the wall (40).
ModelTypeClass CollisionModel_KT
Collision models: 0 – BGK, 1 - MRT, 2 - FBGK (BGK with force), MRT2 - with optimized relaxation time...
double YInitialVelocityUy0_Phys
Initial value of velocity [m/s] in the Y direction.
double FluidPhysicalViscosity_Nu_Phys
The physical kinematic viscosity of the fluid [m^2/s].
unsigned int VTKFileMaxNumber_VTK_Max
The maximum number of VTK/VTI files stored on the disk, in addition to initial and final files...
unsigned int XNodesNumber_Nx1
Total number of nodes in X direction (geometry extent).
double AddInnerWall
Adds additional layer of points on inner wals when substracting small closed surfaces from the grid...
FlowTypeClass FluidFlowModel_MT
Flow models: 0 - quasi compressible (e.g air), 1 - incompressible (e.g water) - Zou et al...
double ReferenceDensityLB_Rho0_LB
Density LB at the reference point, ususally at the outflow.
unsigned int VTKWriteStep_VTK_W
Step for save check points and VTK/VTI data files, 0 - write data only at the begining and at the end...
double XInitialVelocityLBu_Ux0_LB
Initial value of LB velocity in the X direction.
LatticeTypeClass
Enumeration class of lattice configurations.
CaseParameters(const std::shared_ptr< MF::Database::ConfigData > &ConfigData_Ptr)
double CharactLengthPhysical_L_CH_Phys
Physical length [m] of characteristic dimension.
double ForceX_fiz
The X component of the volumetric force, e.g. the force of gravity [N/m3].
GeometryDefinitionClass GeometryDefinition
Geometry definition method: 0 - FromSTL.
LatticeTypeClass LatticeType_La
(D3Q19) Lattice type: 0 - D3Q19
double CharacteristicLength_L_CH_LB
Characteristic length [Lu].
GeometryDefinitionClass
Enumeration class of geometry definition method.
double ForceX_LB
The X component of the volumetric force, e.g. the force of gravity.
ModelTypeClass
Enumeration class of collision models.
double Tau
Tau > 0.5, minimal values (0.525 MRT, 0.58 BGK).
double ZInitialVelocityUz0_Phys
Initial value of velocity [m/s] in the Z direction.
int CPU_ThreadsNr
Number of CPU threads to allocate.
double YInitialVelocityLBu_Uy0_LB
Initial value of LB velocity in the Y direction.
double ZInitialVelocityLBu_Uz0_LB
Initial value of LB velocity in the Z direction.
double VoxelSize
Length of edge of square voxel (unite volume). E.g if the length of geometry edge equals 10 units and...
double XInitialVelocityUx0_Phys
Initial value of velocity [m/s] in the X direction.
double ForceY_fiz
The Y component of the volumetric force, e.g. the force of gravity [N/m3].
double MassFlowError_ErrM
Mass flow termination condition - the mass flow error for subsequent steps calculated for balance sur...
double ForceZ_fiz
The Z component of the volumetric force, e.g. the force of gravity [N/m3].
unsigned int ConsoleWriteStep_K_W
The step for displaying information on the console.
unsigned int YNodesNumber_Ny1
Total number of nodes in Y direction (geometry extent).
int DefaultNode_NN
The default type of node unrecognized (61).
double CharacteristicVelocityLBu_U_Ch_LB
Characteristic velocity LB.
double ForceZ_LB
The Z component of the volumetric force, e.g. the force of gravity.
double ReynoldsNumber_Re
Reynolds number.
double FluidPhysicalReferenceDensity_Rho0_Phys
The physical density of fluid [kg/m3].
FlowTypeClass
Enumeration class of flow models.
unsigned int CheckPointNumberRead_CHP_R
Check point number for resuming calculations, 0 - no check point resuming.
double Sc_VelocityResidueError_ErrV
Velocity termination condition - the mean scaled residue of average velocity for subsequent steps...
double CharactVelocityPhysical_U_CH_Phys
Physical characteristic mean velocity for characteristic dimension [m/s].
double DTPhysical_Dt_Phys
Physical time dt [s] corresponding to one time step LB.
unsigned int ZNodesNumber_Nz1
Total number of nodes in Z direction (geometry extent).
std::string GeometryName
Name of the geometry.