Skip to content

Commit

Permalink
Merge branch 'improvement.MaxMCSoverMFP' into 'master.dev'
Browse files Browse the repository at this point in the history
[improvement.MaxMCSoverMFP] Output MaxMCSoverMFP and resolved cells

See merge request piclas/piclas!879
  • Loading branch information
pnizenkov committed Feb 13, 2024
2 parents 09da506 + ceac36c commit 581e3e4
Show file tree
Hide file tree
Showing 78 changed files with 637 additions and 279 deletions.
59 changes: 30 additions & 29 deletions REGGIE.md

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion docs/documentation/userguide/features-and-models/DSMC.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,11 @@ the mean collision separation distance to the mean free path is written out (`DS
$$\frac{l_{\mathrm{mcs}}}{\lambda} < 1$$

The mean collision separation distance is determined during every collision and compared to the mean free path, where its ratio
should be less than unity. Values above unity indicate an insufficient particle discretization. In order to estimate the required
should be less than unity. Values above unity indicate an insufficient particle discretization.

Additionaly, the above flag writes out the percentage of cells with a resolved timestep (`ResolvedTimestep`), the maximum collision probability of the entire computational domain (`Pmax`), the maximum of the `MCSoverMFP` of the entire domain (`MaxMCSoverMFP`), and the percentage of cells with a resolved time step and resolved weighting factor $w$ (`ResolvedCellPercentage`) to the file `PartAnalyze.csv`. In case of a reservoir simulation, the mean collision probability (`Pmean`) is the output instead of the `ResolvedTimestep`.

In order to estimate the required
weighting factor $w$, the following equation can be utilized for a 3D simulation

$$w < \frac{1}{\left(\sqrt{2}\pi d_{\mathrm{ref}}^2 n^{2/3}\right)^3},$$
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
001-TIME,002-NumDens-Spec-001,003-TempTra-001,004-TempVib001,005-XiVibMean001,006-TempRot001,007-TempTotal001,008-Pmean,009-Pmax,010-MeanFreePath
0.0000000000000000E+000,0.1000000000000000E+023,0.5000769421287198E+004,0.4948975354726982E+004,0.1575887951139208E+001,0.4996259759961257E+004,0.4986985584220915E+004,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000
0.1000000000000000E-007,0.1000000000000000E+023,0.5003185373708683E+004,0.4949437828908193E+004,0.1575924331939683E+001,0.4992329660714551E+004,0.4987003087500717E+004,0.6100164229169058E-001,0.1040428012026279E+000,0.2977138906706071E-003
001-TIME,002-NumDens-Spec-001,003-TempTra-001,004-TempVib001,005-XiVibMean001,006-TempRot001,007-TempTotal001,008-Pmean,009-Pmax,010-MeanFreePath,011-MaxMCSoverMFP,012-ResolvedCellPercentage
0,1E+022,5000.7694212872,4948.97535472698,1.57588795113921,4996.25975996126,4986.98558422092,0,0,0,0,0
0.00000001,1E+022,5003.18537370868,4949.43782890819,1.57592433193968,4992.32966071455,4987.00308750072,0.6100164229169058E-001,0.9655792264656192E-001,0.000297713890670607,0.0001198721096,0.1000000000000000E+003
8 changes: 0 additions & 8 deletions regressioncheck/CHE_DSMC/DSMC_QualityFactors/analyze.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,3 @@ compare_data_file_name = PartAnalyze.csv
compare_data_file_reference = PartAnalyze_ref.csv
compare_data_file_tolerance = 5E-2
compare_data_file_tolerance_type = relative

! Compare cell-local values (ignore differences in the velocity vector)
h5diff_file = DSMC_QualityFactors_DSMCState_000.00000001000000000.h5
h5diff_reference_file = DSMC_QualityFactors_DSMCState_000.00000001000000000_ref.h5
h5diff_data_set = ElemData
h5diff_tolerance_value = 5E-2
h5diff_tolerance_type = relative
h5diff_max_differences = 3
Binary file not shown.
6 changes: 6 additions & 0 deletions regressioncheck/CHE_DSMC/DSMC_QualityFactors/externals.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
! --- Externals Tool Reggie
MPI = 1
externalbinary = ./hopr/build/bin/hopr
externaldirectory = hopr.ini
externalruntime = pre
cmd_suffix =
5 changes: 3 additions & 2 deletions regressioncheck/CHE_DSMC/DSMC_QualityFactors/parameter.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ TrackingMethod = triatracking
! OUTPUT / VISUALIZATION
! =============================================================================== !
ProjectName = DSMC_QualityFactors
IterDisplayStep = 100
Part-AnalyzeStep = 100
IterDisplayStep = 1
Part-AnalyzeStep = 1
CalcNumDens = T
CalcTemp = T
! =============================================================================== !
Expand Down Expand Up @@ -71,6 +71,7 @@ Particles-NumberForDSMCOutputs=1
Part-TimeFracForSampling=1
Particles-DSMC-CalcSurfaceVal=F
UseDSMC=true
Particles-DSMCReservoirSim=true
Particles-DSMC-CollisMode=2 !(1:elast coll, 2: elast + rela, 3:chem)
Part-NumberOfRandomSeeds=2
Particles-RandomSeed1=1
Expand Down
2 changes: 1 addition & 1 deletion regressioncheck/CHE_DSMC/DSMC_QualityFactors/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
* Comparing with the theoretical values from gas kinetic theory
* Mean collision probability is expected to be 0.06105 (chosen time step divided by the mean collision time, which is mean free path over average thermal velocity)
* Mean free path is expected to be 2.98E-04 meters (Variable hard sphere model)
* Mean collision separation distance over mean free path (only in DSMCState) is 0.0001199, compared to the approximated value of 0.0001558, which assumes that the particles are distributed equidistantly in the cell. The difference is due to a 20% lower mean collision separation distance compared to the equidistant distribution (most likely due to nearest neighbour routine)
* Mean collision separation distance over mean free path (MCSoverMFP=MaxMCSoverMFP, because it is only one cell) is 0.0001199, compared to the approximated value of 0.0001558, which assumes that the particles are distributed equidistantly in the cell. The difference is due to a 20% lower mean collision separation distance compared to the equidistant distribution (most likely due to nearest neighbour routine)

19 changes: 19 additions & 0 deletions regressioncheck/CHE_DSMC/DSMC_QualityFactors_MPI/DSMC.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
! =============================================================================== !
! aus piclas/regressioncheck/NIG_Reservoir/CHEM_EQUI_TCE_AIR_5Spec
! =======================================================================
! Data for air taken from
! Species: Boyd und Schwartzentruber: Nonequilibrium gas dynamics and molecular simulation page 294 und Bird: Molecular Gas Dynamics and the direct simulation of gas flows appendix A
! Reactions: MONACO-Manual (Dietrich, Boyd) = Parks model (1985)
! =======================================================================

! =============================================================================== !
! Species1, O
! =============================================================================== !
Part-Species1-SpeciesName = O ! Species name [$]
Part-Species1-InteractionID = 1 ! ID for identification of particles (1: Atom, 2: Molecule, ...)
Part-Species1-Tref = 273 ! Collision parameter: species-specific reference temperature [K] for VHS/VSS model
Part-Species1-dref = 3.0E-10 ! Collision parameter: species-specific reference diameter [m] for VHS/VSS model
Part-Species1-omega = 0.3 ! Collision parameter: species-specific temperature exponent for VHS/VSS model !CAUTION: omega = omega_bird1994 - 0.5!
Part-Species1-HeatOfFormation_K = 29969.88 ! Heat of formation of the respective species [K]


Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
001-TIME,002-nPart-Spec-001,003-ResolvedTimestep,004-Pmax,005-MeanFreePath,006-MaxMCSoverMFP,007-ResolvedCellPercentage
0.0000000000000000E+000,0.6560000000000000E+003,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000
0.4000000000000000E-005,0.6560000000000000E+003,0.7500000000000000E+002,0.1459098048714706E+001,0.3977357765940307E-002,0.2823015493546503E+001,0.1250000000000000E+002
4 changes: 4 additions & 0 deletions regressioncheck/CHE_DSMC/DSMC_QualityFactors_MPI/analyze.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
compare_data_file_name = PartAnalyze.csv
compare_data_file_reference = PartAnalyze_ref.csv
compare_data_file_tolerance = 5E-2
compare_data_file_tolerance_type = relative
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MPI=4
cmd_suffix=DSMC.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
! Skip N=1 hard coded
PICLAS_POLYNOMIAL_DEGREE=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
! --- Externals Tool Reggie
MPI = 1
externalbinary = ./hopr/build/bin/hopr
externaldirectory = hopr.ini
externalruntime = pre
cmd_suffix =
44 changes: 44 additions & 0 deletions regressioncheck/CHE_DSMC/DSMC_QualityFactors_MPI/hopr.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

!================================================================================================================================= !
! OUTPUT
!================================================================================================================================= !
ProjectName = cube_8_cells
Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii)
Logging = F ! Write log files

!================================================================================================================================= !
! MESH
!================================================================================================================================= !
Mode = 1 ! Mode for Cartesian boxes
nZones = 1 ! number of boxes

! ---------------------------------------------------------------
! Box 1
! ---------------------------------------------------------------

Corner =(/-0.5 , 0.0 , -0.5 ,, 0.5 , 0.0 , -0.5 ,, 0.5 , 1 , -0.5 ,, -0.5 , 1 , -0.5 ,, -0.5 , 0.0 , 0.5 ,, 0.5 , 0.0 , 0.5 ,, 0.5 , 1 , 0.5 ,, -0.5 , 1 , 0.5 /)
! Corner node positions: (/ x_1,y_1,z_1, x_2,y_2,z_2,..... , x_8,y_8,z_8/)
nElems =(/2,2,2/) ! number of elements in each direction (/nElemX,nElemY,nElemZ/)
BCIndex =(/1 , 1 , 1 , 1 , 1 , 1/)
! =(/z- , y- , x+ , y+ , x- , z+/) ! Indices of Boundary Conditions for six Boundary Faces
elemtype =108 ! element type (108: Hexahedral)


useCurveds =F ! T if curved boundaries defined
SpaceQuandt =1. ! characteristic length of the mesh
ConformConnect=T

!=============================================================================== !
! BOUNDARY CONDITIONS
!=============================================================================== !
nUserDefinedBoundaries=1
BoundaryName=WALL ! Outflow: open (absorbing) [for MAXWELL]
BoundaryType=(/4,0,0,0/) ! (/ Type, curveIndex, State, alpha /)

!=============================================================================== !
! BASIS
!=============================================================================== !
NVisu = 7
meshscale = 0.1
jacobianTolerance=1E-25

156 changes: 156 additions & 0 deletions regressioncheck/CHE_DSMC/DSMC_QualityFactors_MPI/parameter.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
! =============================================================================== !
! EQUATION (linearscalaradvection)
! =============================================================================== !
IniExactFunc = 0

! =============================================================================== !
! DISCRETIZATION
! =============================================================================== !
N = 1
NAnalyze = 1

! =============================================================================== !
! MESH
! =============================================================================== !
MeshFile = cube_8_cells_mesh.h5
TrackingMethod = triatracking

! =============================================================================== !
! OUTPUT / VISUALIZATION
! =============================================================================== !
ProjectName = DSMC_QualityFactors_MPI
IterDisplayStep = 1
CalcNumSpec = T

! =============================================================================== !
! CALCULATION
! =============================================================================== !
TEnd = 4.0E-6
Analyze_dt = 1E-4
CFLscale = 0.2

! =============================================================================== !
! DSMC
! =============================================================================== !
ManualTimeStep = 4.0E-6
Particles-HaloEpsVelo = 8.0E+4
Particles-NumberForDSMCOutputs = 1
Part-TimeFracForSampling = 1
Particles-DSMC-CalcSurfaceVal = F
UseDSMC = T
Particles-DSMC-CollisMode = 2
Part-NumberOfRandomSeeds = 2
Particles-RandomSeed1 = 1
Particles-RandomSeed2 = 2
Particles-DSMC-UseOctree = F
Particles-DSMC-UseNearestNeighbour = T
Particles-DSMC-CalcQualityFactors = T

! =============================================================================== !
! Boundaries
! =============================================================================== !
Part-nBounds = 1
Part-Boundary1-SourceName = WALL
Part-Boundary1-Condition = reflective
Part-Boundary1-WallTemp = 300
Part-Boundary1-TransACC = 1
Part-Boundary1-MomentumACC = 1
Part-Boundary1-VibACC = 1
Part-Boundary1-RotACC = 1

! =============================================================================== !
! PARTICLES
! =============================================================================== !
Part-maxParticleNumber = 500000
Part-nSpecies = 1
Part-FIBGMdeltas = (/1.0,1.0,1.0/)

! =============================================================================== !
! Species1 - O
! =============================================================================== !
Part-Species1-MassIC = 2.657E-26
Part-Species1-MacroParticleFactor = 1E15
Part-Species1-ChargeIC = 0

! Initialization:
Part-Species1-nInits = 8

Part-Species1-Init1-SpaceIC = sphere
Part-Species1-Init1-RadiusIC = 0.025
Part-Species1-Init1-BasePointIC = (/ 0.025, 0.025, 0.025 /)
Part-Species1-Init1-NormalIC = (/ 0.0, 0.0, 1.0 /)
Part-Species1-Init1-velocityDistribution = maxwell_lpn
Part-Species1-Init1-MWTemperatureIC = 300
Part-Species1-Init1-PartDensity = 1E+21
Part-Species1-Init1-VeloIC = 0
Part-Species1-Init1-VeloVecIC = (/1.,0.,0./)

Part-Species1-Init2-SpaceIC = sphere
Part-Species1-Init2-RadiusIC = 0.025
Part-Species1-Init2-BasePointIC = (/ -0.025, 0.075, 0.025 /)
Part-Species1-Init2-NormalIC = (/ 0.0, 0.0, 1.0 /)
Part-Species1-Init2-velocityDistribution = maxwell_lpn
Part-Species1-Init2-MWTemperatureIC = 300
Part-Species1-Init2-PartDensity = 1E+21
Part-Species1-Init2-VeloIC = 0
Part-Species1-Init2-VeloVecIC = (/1.,0.,0./)

Part-Species1-Init3-SpaceIC = sphere
Part-Species1-Init3-RadiusIC = 0.025
Part-Species1-Init3-BasePointIC = (/ -0.025, 0.025, -0.025 /)
Part-Species1-Init3-NormalIC = (/ 0.0, 0.0, 1.0 /)
Part-Species1-Init3-velocityDistribution = maxwell_lpn
Part-Species1-Init3-MWTemperatureIC = 300
Part-Species1-Init3-PartDensity = 1E+21
Part-Species1-Init3-VeloIC = 0
Part-Species1-Init3-VeloVecIC = (/1.,0.,0./)

Part-Species1-Init4-SpaceIC = sphere
Part-Species1-Init4-RadiusIC = 0.025
Part-Species1-Init4-BasePointIC = (/ 0.025, 0.075, -0.025 /)
Part-Species1-Init4-NormalIC = (/ 0.0, 0.0, 1.0 /)
Part-Species1-Init4-velocityDistribution = maxwell_lpn
Part-Species1-Init4-MWTemperatureIC = 300
Part-Species1-Init4-PartDensity = 1E+21
Part-Species1-Init4-VeloIC = 0
Part-Species1-Init4-VeloVecIC = (/1.,0.,0./)

Part-Species1-Init5-SpaceIC = sphere
Part-Species1-Init5-RadiusIC = 0.025
Part-Species1-Init5-BasePointIC = (/ 0.025, 0.025, -0.025 /)
Part-Species1-Init5-NormalIC = (/ 0.0, 0.0, 1.0 /)
Part-Species1-Init5-velocityDistribution = maxwell_lpn
Part-Species1-Init5-MWTemperatureIC = 300
Part-Species1-Init5-PartDensity = 2E+21
Part-Species1-Init5-VeloIC = 0
Part-Species1-Init5-VeloVecIC = (/1.,0.,0./)

Part-Species1-Init6-SpaceIC = sphere
Part-Species1-Init6-RadiusIC = 0.025
Part-Species1-Init6-BasePointIC = (/ 0.025, 0.075, 0.025 /)
Part-Species1-Init6-NormalIC = (/ 0.0, 0.0, 1.0 /)
Part-Species1-Init6-velocityDistribution = maxwell_lpn
Part-Species1-Init6-MWTemperatureIC = 300
Part-Species1-Init6-PartDensity = 2E+21
Part-Species1-Init6-VeloIC = 0
Part-Species1-Init6-VeloVecIC = (/1.,0.,0./)

Part-Species1-Init7-SpaceIC = sphere
Part-Species1-Init7-RadiusIC = 0.025
Part-Species1-Init7-BasePointIC = (/ -0.025, 0.025, 0.025 /)
Part-Species1-Init7-NormalIC = (/ 0.0, 0.0, 1.0 /)
Part-Species1-Init7-velocityDistribution = maxwell_lpn
Part-Species1-Init7-MWTemperatureIC = 300
Part-Species1-Init7-PartDensity = 1E+20
Part-Species1-Init7-VeloIC = 0
Part-Species1-Init7-VeloVecIC = (/1.,0.,0./)

Part-Species1-Init8-SpaceIC = sphere
Part-Species1-Init8-RadiusIC = 0.025
Part-Species1-Init8-BasePointIC = (/ -0.025, 0.075, -0.025 /)
Part-Species1-Init8-NormalIC = (/ 0.0, 0.0, 1.0 /)
Part-Species1-Init8-velocityDistribution = maxwell_lpn
Part-Species1-Init8-MWTemperatureIC = 300
Part-Species1-Init8-PartDensity = 2E+21
Part-Species1-Init8-VeloIC = 0
Part-Species1-Init8-VeloVecIC = (/1.,0.,0./)
4 changes: 4 additions & 0 deletions regressioncheck/CHE_DSMC/DSMC_QualityFactors_MPI/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# DSMC: Quality Factors
* Testing the calculation and MPI communication of the QualityFactors ResolvedTimestep, Pmax, MaxMCSoverMFP and ResolvedCellPercentage
* The values are not compared to the theoretical values from gas kinetic theory. This is done in the Reggie DSMC_QualityFactors

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
001-TIME,002-Pmean,003-Pmax,004-MeanFreePath,005-Reaction001,006-Reaction002,007-Reaction003,008-Reaction004,009-Reaction005
0.00000000000000E+000,0.00000000000000E+000,0.00000000000000E+000,0.00000000000000E+000,0.00000000000000E+000,0.00000000000000E+000,0.00000000000000E+000,0.00000000000000E+000,0.00000000000000E+000
1.00000000000000E-007,3.73688135572668E-001,7.27526232996863E-001,1.32474544582370E-005,2.48777888932569E-019,4.40906095483012E-017,2.28631616080479E-018,2.42390240084106E-019,4.42149510308084E-017
001-TIME,002-Pmean,003-Pmax,004-MeanFreePath,005-MaxMCSoverMFP,006-ResolvedCellPercentage,007-Reaction001,008-Reaction002,009-Reaction003,010-Reaction004,011-Reaction005
0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000
1.00000000000000E-007,3.73688135572668E-001,7.27526232996863E-001,1.32474544582370E-005,0.0000000000000000E+000,0.1000000000000000E+003,2.48777888932569E-019,4.40906095483012E-017,2.28631616080479E-018,2.42390240084106E-019,4.42149510308084E-017
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
001-TIME,002-Pmean,003-Pmax,004-MeanFreePath,005-Reaction001,006-Reaction002,007-Reaction003,008-Reaction004,009-Reaction005
0.00000000000000E+000,0.00000000000000E+000,0.00000000000000E+000,0.00000000000000E+000,0.00000000000000E+000,0.00000000000000E+000,0.00000000000000E+000,0.00000000000000E+000,0.00000000000000E+000
1.00000000000000E-007,4.15119539713157E-001,7.81552614396978E-001,1.46013945833773E-005,5.65915325730076E-018,1.71194379397845E-016,5.46193901126186E-018,5.64365826162393E-018,1.71913416028807E-016
001-TIME,002-Pmean,003-Pmax,004-MeanFreePath,005-MaxMCSoverMFP,006-ResolvedCellPercentage,007-Reaction001,008-Reaction002,009-Reaction003,010-Reaction004,011-Reaction005
0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000,0.0000000000000000E+000
1.00000000000000E-007,4.15119539713157E-001,7.81552614396978E-001,1.46013945833773E-005,0.0000000000000000E+000,0.1000000000000000E+003,5.65915325730076E-018,1.71194379397845E-016,5.46193901126186E-018,5.64365826162393E-018,1.71913416028807E-016
Loading

0 comments on commit 581e3e4

Please sign in to comment.