Microflow 3D  v1.0
ParametersConversion.cpp
Go to the documentation of this file.
1 // Microflow 3D, http://www.microflow.pwr.edu.pl/
3 // Created by Roman Szafran on 18.05.19.
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 "ParametersConversion.h"
11 
12 // static parameters initialisation
13 
14 double MF::LBPC::ParametersConversion::Re;
15 double MF::LBPC::ParametersConversion::Cu;
16 double MF::LBPC::ParametersConversion::u_ch_phys;
17 double MF::LBPC::ParametersConversion::l_ch_phys;
18 double MF::LBPC::ParametersConversion::nu_phys;
19 double MF::LBPC::ParametersConversion::dx_phys;
20 double MF::LBPC::ParametersConversion::l_ch_LB;
21 double MF::LBPC::ParametersConversion::u_ch_LB;
22 double MF::LBPC::ParametersConversion::dt_phys;
23 double MF::LBPC::ParametersConversion::nu_LB;
24 double MF::LBPC::ParametersConversion::TAU;
25 double MF::LBPC::ParametersConversion::csq;
26 double MF::LBPC::ParametersConversion::rho0_LB;
27 double MF::LBPC::ParametersConversion::rho0_phys;
28 int MF::LBPC::ParametersConversion::FluidFlowModel_MT;
29 
30 void MF::LBPC::ParametersConversion::ComputeBasicParameters(const std::shared_ptr<MF::Solver_CPU::CaseParameters>& CaseParameters_Ptr,const openvdb::Int64Grid::Ptr& VDBGrid_Ptr) {
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 }
58 
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.
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.