Microflow 3D  v1.0
MF::LBPC::ParametersConversion Class Reference

The class of methods converting between LB and physical values and vice versa. More...

#include <ParametersConversion.h>

Public Member Functions

 ParametersConversion ()=default
 
 ~ParametersConversion ()=default
 

Static Public Member Functions

static void Initialize (const std::shared_ptr< MF::Database::ConfigData > &ConfigData_Ptr, const std::shared_ptr< MF::GU::LatticeParametersD3Q19 > &LatticeParameters_Ptr)
 
static void ComputeBasicParameters (const std::shared_ptr< MF::Solver_CPU::CaseParameters > &CaseParameters_Ptr, const openvdb::Int64Grid::Ptr &VDBGrid_Ptr)
 Compute: Re, l_ch_LB, Cu, u_ch_LB, dt_phys, nu_LB. More...
 
static double ULB_toPhys (double u_LB)
 Converts LB velocity to physical velocity. More...
 
static MF::Database::Vec3< double > ULB_toPhys (MF::Database::Vec3< double > u_LB)
 Converts vector data: LB velocity to physical velocity. More...
 
static double UPhys_toLB (double u_phys)
 Converts physical velocity to LB velocity. More...
 
static MF::Database::Vec3< double > UPhys_toLB (MF::Database::Vec3< double > u_phys)
 Converts vector data: physical velocity to LB velocity. More...
 
static double RhoLB_toPressurePhys (double rho_LB)
 Converts rho LB to physical pressure. More...
 
static double PressurePhys_toRhoLB (double p_phys)
 Converts physical pressure to rho LB. More...
 
static double RhoLB_toRhoPhys (double rho_LB)
 Converts rho LB to physical density. More...
 
static double RhoPhys_toRhoLB (double rho_phys)
 Converts physical density to rho LB. More...
 
static double FPhys_toFLB (double F_phys)
 Physical force to LB force. More...
 
static MF::Database::Vec3< double > FPhys_toFLB (MF::Database::Vec3< double > F_phys)
 Physical force to LB force. More...
 
static double FLB_toFPhys (double F_LB)
 LB force to physical force. More...
 

Detailed Description

The class of methods converting between LB and physical values and vice versa.

Definition at line 23 of file ParametersConversion.h.

Constructor & Destructor Documentation

◆ ParametersConversion()

MF::LBPC::ParametersConversion::ParametersConversion ( )
default

◆ ~ParametersConversion()

MF::LBPC::ParametersConversion::~ParametersConversion ( )
default

Member Function Documentation

◆ ComputeBasicParameters()

void MF::LBPC::ParametersConversion::ComputeBasicParameters ( const std::shared_ptr< MF::Solver_CPU::CaseParameters > &  CaseParameters_Ptr,
const openvdb::Int64Grid::Ptr &  VDBGrid_Ptr 
)
static

Compute: Re, l_ch_LB, Cu, u_ch_LB, dt_phys, nu_LB.

Definition at line 30 of file ParametersConversion.cpp.

References FPhys_toFLB(), and UPhys_toLB().

Referenced by Initialize(), and main().

30  {
31 
32  openvdb::CoordBBox bbox;
33 
34  Re = u_ch_phys * l_ch_phys / nu_phys;
35  l_ch_LB = l_ch_phys/dx_phys;
36  Cu = 1.0 / ((TAU - 0.5) * csq) * (nu_phys / dx_phys);
37  u_ch_LB = u_ch_phys / Cu;
38  dt_phys = l_ch_phys / u_ch_phys * u_ch_LB / l_ch_LB;
39  nu_LB = u_ch_LB * l_ch_LB / Re;
40 
41  CaseParameters_Ptr->ReynoldsNumber_Re = Re;
42  CaseParameters_Ptr->CharacteristicVelocityLBu_U_Ch_LB = u_ch_LB;
43  CaseParameters_Ptr->CharacteristicLength_L_CH_LB = l_ch_LB;
44  CaseParameters_Ptr->DTPhysical_Dt_Phys = dt_phys;
45  CaseParameters_Ptr->FluidLBuViscosity_Nu_LB = nu_LB;
46  CaseParameters_Ptr->ForceX_LB = MF::LBPC::ParametersConversion::FPhys_toFLB(CaseParameters_Ptr->ForceX_fiz);
47  CaseParameters_Ptr->ForceY_LB = MF::LBPC::ParametersConversion::FPhys_toFLB(CaseParameters_Ptr->ForceY_fiz);
48  CaseParameters_Ptr->ForceZ_LB = MF::LBPC::ParametersConversion::FPhys_toFLB(CaseParameters_Ptr->ForceZ_fiz);
49  CaseParameters_Ptr->XInitialVelocityLBu_Ux0_LB = MF::LBPC::ParametersConversion::UPhys_toLB(CaseParameters_Ptr->XInitialVelocityUx0_Phys);
50  CaseParameters_Ptr->YInitialVelocityLBu_Uy0_LB = MF::LBPC::ParametersConversion::UPhys_toLB(CaseParameters_Ptr->YInitialVelocityUy0_Phys);
51  CaseParameters_Ptr->ZInitialVelocityLBu_Uz0_LB = MF::LBPC::ParametersConversion::UPhys_toLB(CaseParameters_Ptr->ZInitialVelocityUz0_Phys);
52 
53  VDBGrid_Ptr->treePtr()->evalActiveVoxelBoundingBox(bbox);
54  CaseParameters_Ptr->XNodesNumber_Nx1 = bbox.dim().x();
55  CaseParameters_Ptr->YNodesNumber_Ny1 = bbox.dim().y();
56  CaseParameters_Ptr->ZNodesNumber_Nz1 = bbox.dim().z();
57 }
static double FPhys_toFLB(double F_phys)
Physical force to LB force.
static double UPhys_toLB(double u_phys)
Converts physical velocity to LB velocity.

◆ FLB_toFPhys()

static double MF::LBPC::ParametersConversion::FLB_toFPhys ( double  F_LB)
inlinestatic

LB force to physical force.

Definition at line 133 of file ParametersConversion.h.

134  {
135  return (F_LB * rho0_phys / rho0_LB * dx_phys / (dt_phys * dt_phys));
136  };

◆ FPhys_toFLB() [1/2]

static double MF::LBPC::ParametersConversion::FPhys_toFLB ( double  F_phys)
inlinestatic

Physical force to LB force.

Definition at line 117 of file ParametersConversion.h.

Referenced by ComputeBasicParameters(), and MF::Solver_CPU::Initialization::ThreadDataInitialize().

118  {
119  return (F_phys / (rho0_phys / rho0_LB * dx_phys / (dt_phys * dt_phys)));
120  }

◆ FPhys_toFLB() [2/2]

static MF::Database::Vec3<double> MF::LBPC::ParametersConversion::FPhys_toFLB ( MF::Database::Vec3< double >  F_phys)
inlinestatic

Physical force to LB force.

Definition at line 123 of file ParametersConversion.h.

References MF::Database::Vec3< T >::x, MF::Database::Vec3< T >::y, and MF::Database::Vec3< T >::z.

124  {
126  FLB.x = F_phys.x / (rho0_phys / rho0_LB * dx_phys / (dt_phys * dt_phys));
127  FLB.y = F_phys.y / (rho0_phys / rho0_LB * dx_phys / (dt_phys * dt_phys));
128  FLB.z = F_phys.z / (rho0_phys / rho0_LB * dx_phys / (dt_phys * dt_phys));
129  return (FLB);
130  }
T y
Y direction value.
Definition: Vec3.h:20
T z
Z direction value.
Definition: Vec3.h:21
T x
X direction value.
Definition: Vec3.h:19

◆ Initialize()

static void MF::LBPC::ParametersConversion::Initialize ( const std::shared_ptr< MF::Database::ConfigData > &  ConfigData_Ptr,
const std::shared_ptr< MF::GU::LatticeParametersD3Q19 > &  LatticeParameters_Ptr 
)
inlinestatic

Definition at line 30 of file ParametersConversion.h.

References ComputeBasicParameters().

Referenced by main().

30  {
31 
32  u_ch_phys = ConfigData_Ptr->getCaseFloatParam("CharactersticParams.CharactVelocityPhysical_U_CH_Phys");
33  l_ch_phys = ConfigData_Ptr->getCaseFloatParam("CharactersticParams.CharactLengthPhysical_L_CH_Phys");
34  nu_phys = ConfigData_Ptr->getCaseFloatParam("PhysicalParams.FluidPhysicalViscosity_Nu_Phys");
35  dx_phys = ConfigData_Ptr->getCaseFloatParam("GeometryParams.PhysicalVoxelSize");
36  TAU = ConfigData_Ptr->getCaseFloatParam("PhysicalParams.Tau");
37  csq = LatticeParameters_Ptr->LatticeConstant_CSQ;
38  rho0_LB = ConfigData_Ptr->getCaseFloatParam("InitialCondition.ReferenceDensityLB_Rho0_LB");
39  rho0_phys = ConfigData_Ptr->getCaseFloatParam("PhysicalParams.FluidPhysicalReferenceDensity_Rho0_Phys");
40  FluidFlowModel_MT = ConfigData_Ptr->getFlowType();
41  };

◆ PressurePhys_toRhoLB()

static double MF::LBPC::ParametersConversion::PressurePhys_toRhoLB ( double  p_phys)
inlinestatic

Converts physical pressure to rho LB.

Definition at line 94 of file ParametersConversion.h.

Referenced by MF::Solver_CPU::Initialization::ThreadDataInitialize().

95  {
96  return (rho0_LB + ((p_phys * rho0_LB) / (rho0_phys * csq)) * ((dt_phys * dt_phys) / (dx_phys * dx_phys)));
97  };

◆ RhoLB_toPressurePhys()

static double MF::LBPC::ParametersConversion::RhoLB_toPressurePhys ( double  rho_LB)
inlinestatic

Converts rho LB to physical pressure.

Definition at line 88 of file ParametersConversion.h.

Referenced by MF::RW::VTIWriter< T_VDBGridType >::addPressPhysFromThread().

89  {
90  return (csq * (rho_LB - rho0_LB) * rho0_phys / rho0_LB * ((dx_phys * dx_phys) / (dt_phys * dt_phys)));
91  };

◆ RhoLB_toRhoPhys()

static double MF::LBPC::ParametersConversion::RhoLB_toRhoPhys ( double  rho_LB)
inlinestatic

Converts rho LB to physical density.

Definition at line 100 of file ParametersConversion.h.

Referenced by MF::RW::VTIWriter< T_VDBGridType >::addRhoPhysFromThread(), MF::Solver_CPU::Calculations::DeltaMassFlow_fiz(), and MF::Solver_CPU::Calculations::DeltaMassFlowThread_fiz().

101  {
102  double RhoPhys = 0;
103  if(FluidFlowModel_MT == 1) // Incompressible
104  RhoPhys = rho0_phys;
105  else
106  RhoPhys = rho0_phys / rho0_LB * rho_LB;
107  return (RhoPhys);
108  };

◆ RhoPhys_toRhoLB()

static double MF::LBPC::ParametersConversion::RhoPhys_toRhoLB ( double  rho_phys)
inlinestatic

Converts physical density to rho LB.

Definition at line 111 of file ParametersConversion.h.

112  {
113  return (rho_phys * rho0_LB / rho0_phys);
114  };

◆ ULB_toPhys() [1/2]

◆ ULB_toPhys() [2/2]

static MF::Database::Vec3<double> MF::LBPC::ParametersConversion::ULB_toPhys ( MF::Database::Vec3< double >  u_LB)
inlinestatic

Converts vector data: LB velocity to physical velocity.

Definition at line 64 of file ParametersConversion.h.

References MF::Database::Vec3< T >::x, MF::Database::Vec3< T >::y, and MF::Database::Vec3< T >::z.

64  {
66  u_phys.x = (u_LB.x * l_ch_LB * nu_phys) / (nu_LB * l_ch_phys);
67  u_phys.y = (u_LB.y * l_ch_LB * nu_phys) / (nu_LB * l_ch_phys);
68  u_phys.z = (u_LB.z * l_ch_LB * nu_phys) / (nu_LB * l_ch_phys);
69  return u_phys;
70  };
T y
Y direction value.
Definition: Vec3.h:20
T z
Z direction value.
Definition: Vec3.h:21
T x
X direction value.
Definition: Vec3.h:19

◆ UPhys_toLB() [1/2]

static double MF::LBPC::ParametersConversion::UPhys_toLB ( double  u_phys)
inlinestatic

Converts physical velocity to LB velocity.

Definition at line 73 of file ParametersConversion.h.

Referenced by ComputeBasicParameters(), and MF::Solver_CPU::Initialization::ThreadDataInitialize().

74  {
75  return ((u_phys * l_ch_phys * nu_LB) / (nu_phys * l_ch_LB));
76  };

◆ UPhys_toLB() [2/2]

static MF::Database::Vec3<double> MF::LBPC::ParametersConversion::UPhys_toLB ( MF::Database::Vec3< double >  u_phys)
inlinestatic

Converts vector data: physical velocity to LB velocity.

Definition at line 79 of file ParametersConversion.h.

References MF::Database::Vec3< T >::x, MF::Database::Vec3< T >::y, and MF::Database::Vec3< T >::z.

79  {
81  u_LB.x = (u_phys.x * l_ch_phys * nu_LB) / (nu_phys * l_ch_LB);
82  u_LB.y = (u_phys.y * l_ch_phys * nu_LB) / (nu_phys * l_ch_LB);
83  u_LB.z = (u_phys.z * l_ch_phys * nu_LB) / (nu_phys * l_ch_LB);
84  return u_LB;
85  }
T y
Y direction value.
Definition: Vec3.h:20
T z
Z direction value.
Definition: Vec3.h:21
T x
X direction value.
Definition: Vec3.h:19

The documentation for this class was generated from the following files: