41 clout <<
"----------------- UnitConverter information -----------------" << std::endl;
42 clout <<
"-- Parameters:" << std::endl;
43 clout <<
"Resolution: N= " << getResolution() << std::endl;
44 clout <<
"Lattice velocity: latticeU= " << getCharLatticeVelocity() << std::endl;
45 clout <<
"Lattice relaxation frequency: omega= " << getLatticeRelaxationFrequency( ) << std::endl;
46 clout <<
"Lattice relaxation time: tau= " << getLatticeRelaxationTime() << std::endl;
47 clout <<
"Characteristical length(m): charL= " << getCharPhysLength() << std::endl;
48 clout <<
"Characteristical speed(m/s): charU= " << getCharPhysVelocity() << std::endl;
49 clout <<
"Phys. kinematic viscosity(m^2/s): charNu= " << getPhysViscosity() << std::endl;
50 clout <<
"Phys. density(kg/m^d): charRho= " << getPhysDensity() << std::endl;
51 clout <<
"Characteristical pressure(N/m^2): charPressure= " << getCharPhysPressure() << std::endl;
52 clout <<
"Mach number: machNumber= " << getMachNumber() << std::endl;
53 clout <<
"Reynolds number: reynoldsNumber= " << getReynoldsNumber() << std::endl;
54 clout <<
"Knudsen number: knudsenNumber= " << getKnudsenNumber() << std::endl;
57 clout <<
"-- Conversion factors:" << std::endl;
58 clout <<
"Voxel length(m): physDeltaX= " << getConversionFactorLength() << std::endl;
59 clout <<
"Time step(s): physDeltaT= " << getConversionFactorTime() << std::endl;
60 clout <<
"Velocity factor(m/s): physVelocity= " << getConversionFactorVelocity() << std::endl;
61 clout <<
"Density factor(kg/m^3): physDensity= " << getConversionFactorDensity() << std::endl;
62 clout <<
"Mass factor(kg): physMass= " << getConversionFactorMass() << std::endl;
63 clout <<
"Viscosity factor(m^2/s): physViscosity= " << getConversionFactorViscosity() << std::endl;
64 clout <<
"Force factor(N): physForce= " << getConversionFactorForce() << std::endl;
65 clout <<
"Pressure factor(N/m^2): physPressure= " << getConversionFactorPressure() << std::endl;
67 clout <<
"-------------------------------------------------------------" << std::endl;
104 T charPhysVelocity{};
107 T charPhysPressure = 0;
110 T latticeRelaxationTime{};
111 T charLatticeVelocity{};
116 params[
"Application"][
"PhysParameters"][
"CharPhysLength"].
read(charPhysLength);
117 params[
"Application"][
"PhysParameters"][
"CharPhysVelocity"].
read(charPhysVelocity);
118 params[
"Application"][
"PhysParameters"][
"PhysViscosity"].
read(physViscosity);
119 params[
"Application"][
"PhysParameters"][
"PhysDensity"].
read(physDensity);
120 params[
"Application"][
"PhysParameters"][
"CharPhysPressure"].
read(charPhysPressure);
122 std::vector<std::string> discretizationParam = {
"PhysDeltaX",
"Resolution",
123 "CharLatticeVelocity",
"PhysDeltaT",
"LatticeRelaxationTime"};
125 for(
int i = 0; i<discretizationParam.size(); i++){
127 if(params[
"Application"][
"Discretization"][discretizationParam[i]].read(test,
false)){
132 clout <<
"WARNING: More than 2 discretization parameters provided" << std::endl;
135 if (!params[
"Application"][
"Discretization"][
"PhysDeltaX"].read(physDeltaX,
false)) {
136 if (!params[
"Application"][
"Discretization"][
"Resolution"].read<int>(resolution,
false)) {
137 if (!params[
"Application"][
"Discretization"][
"CharLatticeVelocity"].read(charLatticeVelocity,
false)) {
139 clout <<
"Error: Have not found PhysDeltaX, Resolution or CharLatticeVelocity in XML file."
145 if (params[
"Application"][
"Discretization"][
"PhysDeltaT"].read(physDeltaT,
false)) {
146 physDeltaX = charPhysVelocity / charLatticeVelocity * physDeltaT;
148 else if (params[
"Application"][
"Discretization"][
"LatticeRelaxationTime"].read(latticeRelaxationTime,
false)) {
149 physDeltaX = physViscosity * charLatticeVelocity / charPhysVelocity * descriptors::invCs2<T,DESCRIPTOR>() / (latticeRelaxationTime - 0.5);
152 clout <<
"Error: Only found CharLatticeVelocity, missing PhysDeltaT or LatticeRelaxationTime"
160 physDeltaX = charPhysLength / resolution;
162 if (params[
"Application"][
"Discretization"][
"CharLatticeVelocity"].read(charLatticeVelocity,
false)) {
163 latticeRelaxationTime = physViscosity * charLatticeVelocity * descriptors::invCs2<T,DESCRIPTOR>() * resolution + 0.5;
166 if (!params[
"Application"][
"Discretization"][
"LatticeRelaxationTime"].read(latticeRelaxationTime,
false)) {
167 clout <<
"Error: Have not found LatticeRelaxationTime and was not able to derive it using CharLatticeVelocity"
175 if (!params[
"Application"][
"Discretization"][
"PhysDeltaT"].read(physDeltaT,
false)) {
176 if (!params[
"Application"][
"Discretization"][
"LatticeRelaxationTime"].read(latticeRelaxationTime,
false)) {
177 if (!params[
"Application"][
"Discretization"][
"CharLatticeVelocity"].read(charLatticeVelocity,
false)) {
179 clout <<
"Error: Have not found PhysDeltaT, LatticeRelaxationTime or CharLatticeVelocity in XML file."
185 physDeltaT = charLatticeVelocity / charPhysVelocity * physDeltaX;
190 physDeltaT = (latticeRelaxationTime - 0.5) / descriptors::invCs2<T,DESCRIPTOR>() * physDeltaX * physDeltaX / physViscosity;
194 return new UnitConverter<T, DESCRIPTOR>(physDeltaX, physDeltaT, charPhysLength, charPhysVelocity, physViscosity, physDensity, charPhysPressure);
bool read(T &value, bool verboseOn=true, bool exitIfMissing=false) const
Prints out the XML structure read in, mostly for debugging purposes.