Skip to content

Commit

Permalink
Merge branch '166-reservoir-dsmc-method-and-nearest-neighbour' into '…
Browse files Browse the repository at this point in the history
…master.dev'

Resolve "Reservoir DSMC method and nearest neighbour"

Closes #166

See merge request piclas/piclas!868
  • Loading branch information
scopplestone committed Oct 30, 2023
2 parents 4052576 + 72e5363 commit fea602f
Show file tree
Hide file tree
Showing 57 changed files with 394 additions and 950 deletions.
8 changes: 4 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -463,10 +463,10 @@ CHE_FPFlow:
# Stage "reggie_DSMC_nightly": Build and run chemistry examples on nightly (check reaction rates in RESERVOIR simulation)
# ----------------------------------------------------------------------------------------------------------------------------------------------------
NIG_Reservoir:
<<: *defaults_nightly
<<: *defaults_DSMC_nightly
stage: reggie_DSMC_nightly
script:
- cd build/ ; python ../reggie/reggie.py ../regressioncheck/NIG_Reservoir
- cd build_DSMC_release/ ; python ../reggie/reggie.py ../regressioncheck/NIG_Reservoir -e bin/piclas

# ----------------------------------------------------------------------------------------------------------------------------------------------------
# Stage "reggie_DSMC_nightly": Build and run tracking examples on nightly
Expand Down Expand Up @@ -742,10 +742,10 @@ WEK_DSMC:
- cd build_DSMC_release ; python ../reggie/reggie.py ../regressioncheck/WEK_DSMC -e bin/piclas

WEK_Reservoir:
<<: *defaults_weekly
<<: *defaults_DSMC_weekly
stage: reggie_weekly
script:
- cd build ; python ../reggie/reggie.py ../regressioncheck/WEK_Reservoir
- cd build_DSMC_release ; python ../reggie/reggie.py ../regressioncheck/WEK_Reservoir -e bin/piclas

WEK_FPFlow:
<<: *defaults_weekly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Order of the corners to define the used mesh. The first node is placed at the or
Afterwards this element is scaled via

postScaleMesh = T
meshScale = 4.64E-6
meshScale = 4.64E-6

The number of mesh elements for the block in each direction can be adjusted by changing the line

Expand All @@ -58,13 +58,13 @@ For more information about hopr, visit [https://github.com/hopr-framework/hopr](

Install **piclas** by compiling the source code as described in Chapter {ref}`userguide/installation:Installation` and make sure to set the correct compile flags (ie. chose the correct simulation method)

PICLAS_TIMEDISCMETHOD = RESERVOIR
PICLAS_TIMEDISCMETHOD = DSMC

or simply run the following command from inside the *build* directory

cmake ../ -DPICLAS_TIMEDISCMETHOD=RESERVOIR
cmake ../ -DPICLAS_TIMEDISCMETHOD=DSMC

to configure the build process and run `make` afterwards to build the executable. For this setup, the reservoir method, which is based on the DSMC method, is needed to allow for reservoir specific settings. It is recommended to either utilize a separate build folder (e.g. build_DSMC/) or to delete the contents of the folder beforehand to avoid conflicts between different compiler options (e.g. the setting `PICLAS_EQNSYSNAME = poisson` from the plasma wave tutorial is in conflict with the DSMC method). An overview over the available solver and discretization options is given in Section {ref}`sec:solver-settings`. The physical parameters for this test case are summarized in {numref}`tab:dsmc_chem_off_phys`.
to configure the build process and run `make` afterwards to build the executable. It is recommended to either utilize a separate build folder (e.g. build_DSMC/) or to delete the contents of the folder beforehand to avoid conflicts between different compiler options (e.g. the setting `PICLAS_EQNSYSNAME = poisson` from the plasma wave tutorial is in conflict with the DSMC method). An overview over the available solver and discretization options is given in Section {ref}`sec:solver-settings`. The physical parameters for this test case are summarized in {numref}`tab:dsmc_chem_off_phys`.

```{table} Physical properties at the simulation start
---
Expand Down Expand Up @@ -109,14 +109,14 @@ where, the path to the mesh file `MeshFile`, project name and particle tracking
where the final simulation time `tend` [s], the time step for the field and particle solver is set via `ManualTimeStep` [s]. The time between restart/checkpoint file output is defined via `Analyze_dt` (which is also the output time for specific analysis functions in the field solver context). The number of time step iterations `IterDisplayStep` defines the interval between information output regarding the current status of the simulation, which is written to std.out. The `Particles-HaloEpsVelo` [m/s] determines the size of the halo region for MPI communication and should not be smaller than the fastest particles in the simulation.

(sec:tutorial-dsmc-analysis-setup)=
### Analysis setup
### Analysis setup

For this case our focus is on the run-time analysis to investigate the transient behavior of the reservoir. The first parameter `Part-AnalyzeStep` allows to perform the output every N$^\text{th}$ iteration to reduce the size of the output file and to increase the computational speed. Different parameters for run-time analysis can be enabled, in this case the number of particles per species (`CalcNumSpec`) and the temperature output (`CalcTemp`). It is also recommended to enable `Particles-DSMC-CalcQualityFactors`, which provides outputs to evaluate the quality of the simulation results such as the mean and maximum collision probabilities. The parameter `TimeStampLength = 13` reduces the output filename length. It can be needed for postprocessing, as e.g. ParaView sometimes does not sort the files correctly if the timestamps are too long. The displayed time solution would then be faulty.

! =============================================================================== !
! Particle Analysis
! =============================================================================== !

Part-AnalyzeStep = 1
CalcNumSpec = T
CalcTemp = T
Expand Down Expand Up @@ -188,8 +188,7 @@ $$ N_{\text{CO}_2,\text{sim}} = \frac{n_{\text{CO}_2} V}{w_{\text{CO}_2}} $$
(sec:tutorial-dsmc-dsmc-setup)=
### DSMC setup

Finally, DSMC has to be enabled (`UseDSMC = T`) and the particle movement is disabled via `Particles-DSMCReservoirSim = T` to reduce the computational effort. Keep in mind that the latter needs a compiled
version of piclas using `PICLAS_TIMEDISCMETHOD = RESERVOIR`. Besides these settings `Particles-DSMC-CollisMode` is an important parameter. If set to 1, only elastic collisions
Finally, DSMC has to be enabled (`UseDSMC = T`) and the particle movement is disabled via `Particles-DSMCReservoirSim = T` to reduce the computational effort. Besides these settings `Particles-DSMC-CollisMode` is an important parameter. If set to 1, only elastic collisions
are performed, if set to 2 relaxation processes are allowed and if set to 3 chemistry is enabled. Additionally, constant values for the rotational (`Particles-DSMC-RotRelaxProb`) and vibrational (`Particles-DSMC-VibRelaxProb`) relaxation probabilities are defined.

! =============================================================================== !
Expand All @@ -199,7 +198,7 @@ are performed, if set to 2 relaxation processes are allowed and if set to 3 chem
Particles-DSMCReservoirSim = T
Particles-DSMC-CollisMode = 2
Particles-DSMC-RotRelaxProb = 0.2
Particles-DSMC-VibRelaxProb = 0.02
Particles-DSMC-VibRelaxProb = 0.02

Besides the data given in the **parameter.ini**, a proper DSMC simulation needs additional species information, which is defined in the **DSMC.ini**. The species numeration needs to be the same in both files.

Expand Down Expand Up @@ -342,7 +341,7 @@ Therefore, in this example with one reaction and each of the three species as po
In order to investigate the transient behavior, a longer simulation time was chosen. This results in comparatively long computing times, which is why the use of several computing cores is recommended. The number of cores may not exceed the number of cells. This results in a maximum of 4 cores for the described simulation. Another important note is that bash does not understand aliases which are not at the start of a line. Thus a copy of the **piclas** binary must be located in the current folder

cp $PICLAS_PATH/build/bin/piclas .

or the whole path to the binary must be used instead. Assuming a run with 4 cores is desired and the **piclas** binary is located at the current directory, the command

mpirun -np 4 piclas parameter.ini DSMC.ini | tee std.out
Expand Down
3 changes: 1 addition & 2 deletions docs/documentation/userguide/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ Before setting up a simulation, the code must be compiled with the desired param
* RK4: Runge-Kutta 4th order in time
* RK14: Low storage Runge-Kutta 4, 14 stages version - Niegemann et al 2012
* DSMC: Direct Simulation Monte Carlo, Section {ref}`sec:DSMC`
* RESERVOIR: Simplified DSMC module for single cell reservoir simulations
* FP-Flow: Fokker-Planck-based collision operator, Section {ref}`sec:FP-Flow`
* BGK-Flow: Bhatnagar-Gross-Krook collision operator, Section {ref}`sec:BGK-Flow`
* ``PICLAS_EQNSYSNAME``: Equation system to be solved
Expand Down Expand Up @@ -152,7 +151,7 @@ The concept of the parameter file is described as followed:
* The order of defined variables is irrelevant, except for the special case when redefining boundaries.
However, it is preferable to group similar variables together.

The options and underlying models are discussed in Chapter {ref}`userguide/features-and-models/index:Features & Models`, while the available
The options and underlying models are discussed in Chapter {ref}`userguide/features-and-models/index:Features & Models`, while the available
output options are given in Chapter {ref}`userguide/visu_output:Visualization & Output`.
Due to the sheer number of parameters available, it is advisable to build upon an existing parameter file from one of the tutorials
in Chapter {ref}`userguide/tutorials/index:Tutorials`.
Expand Down
1 change: 0 additions & 1 deletion regressioncheck/CHE_BGK/RELAX_CH4/parameter.ini
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ Particles-DSMC-VibRelaxProb=0.05
! DSMC
! =============================================================================== !
UseDSMC=T
Particles-DSMCReservoirSim=T
Particles-DSMC-CalcQualityFactors=F
Particles-DSMC-CollisMode=2 !(1:elast coll, 2: elast + rela, 3:chem)
Part-NumberOfRandomSeeds =2
Expand Down
3 changes: 0 additions & 3 deletions regressioncheck/CHE_DSMC/cube/parameter.ini
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,6 @@ Part-Species14-MacroParticleFactor=1E7
! DSMC
! =============================================================================== !
UseDSMC=true
Particles-DSMCReservoirSim=false
!Particles-DSMCReservoirSimRate=true
!Particles-DSMCReservoirStatistic=true
Particles-DSMC-CollisMode=2,3 !(1:elast coll, 2: elast + rela, 3:chem)
Part-NumberOfRandomSeeds=2
Particles-RandomSeed1=1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ Part-FIBGMdeltas=(/4.64E-6,4.64E-6,4.64E-6/)
! =============================================================================== !
UseDSMC = T
Particles-DSMC-CollisMode = 2
Particles-DSMCReservoirSim = T
Particles-DSMCReservoirSimRate = T
Particles-DSMCReservoirStatistic = T
Part-NumberOfRandomSeeds=2
Particles-RandomSeed1=1
Particles-RandomSeed2=2
Expand Down
1 change: 0 additions & 1 deletion regressioncheck/CHE_FPFlow/RELAX_CH4/parameter.ini
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ Particles-DSMC-VibRelaxProb=0.05
! DSMC
! =============================================================================== !
UseDSMC=T
Particles-DSMCReservoirSim=T
Particles-DSMC-CalcQualityFactors=F
Particles-DSMC-CollisMode=2 !(1:elast coll, 2: elast + rela, 3:chem)
Part-NumberOfRandomSeeds =2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ Part-Species5-IsIMDSpecies = T
! DSMC
! =============================================================================== !
UseDSMC=false
Particles-DSMCReservoirSim=false
Particles-NumberForDSMCOutputs=0
Part-TimeFracForSampling=0.0
Particles-DSMC-CollisMode=3 !(1:elast coll, 2: elast + rela, 3:chem)
Expand Down
1 change: 0 additions & 1 deletion regressioncheck/NIG_DSMC/Macroscopic_Restart/parameter.ini
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ Particles-NumberForDSMCOutputs = 1
Part-TimeFracForSampling = 0.5
Particles-DSMC-CalcSurfaceVal = T
Particles-DSMC-CalcQualityFactors = F
Particles-DSMCReservoirSim = F
Particles-DSMC-CollisMode = 2 !(1:elast coll, 2: elast + rela, 3:chem)
Part-NumberOfRandomSeeds = 2
Particles-RandomSeed1 = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ TrackingMethod = refmapping
! DSMC
! =============================================================================== !
UseDSMC = true
Particles-DSMCReservoirSim = false
Particles-DSMC-CollisMode = 0 ! Collisionless flow
Part-NumberOfRandomSeeds = 2
Particles-RandomSeed1 = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ TrackingMethod = refmapping
! DSMC
! =============================================================================== !
UseDSMC=true
Particles-DSMCReservoirSim=false
Particles-DSMC-CollisMode=0 ! Collisionless flow
Part-NumberOfRandomSeeds =2
Particles-RandomSeed1= 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ integrate_line_file = SurfaceAnalyze.csv ! Data file name
integrate_line_columns = 0:1 ! Columns x:y for integration y over x
integrate_line_integral_value = 1.142E8 ! Number of removed electrons through the anode BC per second (=5.71e-4/5e-12)
! ! integrated value from one exemplary simulation
integrate_line_tolerance_value = 4e-2 ! Tolerance
integrate_line_tolerance_value = 5e-2 ! Tolerance
integrate_line_tolerance_type = relative ! Relative or absolute tolerance
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ Part-NumberOfRandomSeeds = 2
Particles-RandomSeed1 = 1
Particles-RandomSeed2 = 2
Particles-DSMC-UseOctree = F
Particles-DSMC-UseNearestNeighbour = T
Particles-DSMC-UseNearestNeighbour = F
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ Part-NumberOfRandomSeeds=2
Particles-RandomSeed1=1
Particles-RandomSeed2=2
Particles-DSMC-UseOctree=F
Particles-DSMC-UseNearestNeighbour = T
Particles-DSMC-UseNearestNeighbour = F

Particles-DSMCReservoirSim = T
2 changes: 1 addition & 1 deletion regressioncheck/NIG_Reservoir/builds.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CMAKE_BUILD_TYPE=RELEASE
LIBS_BUILD_HDF5 =OFF
PICLAS_POLYNOMIAL_DEGREE=N
PICLAS_EQNSYSNAME=maxwell
PICLAS_TIMEDISCMETHOD=RESERVOIR
PICLAS_TIMEDISCMETHOD=DSMC
LIBS_USE_MPI =ON
PICLAS_NODETYPE=GAUSS

Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ Particles-DSMCElectronicDatabase = Electronic-State-Database.h5
EpsMergeElectronicState = 1E-3
Part-Species$-ElecRelaxProb = 1.

Particles-DSMCReservoirSim = T
Particles-DSMCReservoirSimRate = F
Particles-DSMCReservoirStatistic = F

Particles-DSMC-VibRelaxProb = 0.
! =============================================================================== !
! PARTICLES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ Particles-DSMC-CollisMode = 0 !(0: No Collisions (0:free molecular flow w
Particles-DSMC-ElectronicModel = 1
Particles-DSMCElectronicDatabase = DSMCSpecies_electronic_state_full_Data.h5 ! when supplied: doQK = true
EpsMergeElectronicState = 1.e-2 ! merge QK levels when difference falls below eps
Particles-DSMCReservoirSim = F
Particles-NumberForDSMCOutputs = 0
Part-TimeFracForSampling = 0.0
Part-NumberOfRandomSeeds = 2
Expand Down
1 change: 0 additions & 1 deletion regressioncheck/NIG_code_analyze/Semicircle/parameter.ini
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ printDiffVec =(/0.21145302115002,0.18723754743135,0.,-0.26787840265560,-
! DSMC
! =============================================================================== !
UseDSMC=true
Particles-DSMCReservoirSim=false
Particles-DSMC-CollisMode=0 !(1:elast coll, 2: elast + rela, 3:chem)
Part-NumberOfRandomSeeds =2
Particles-RandomSeed1= 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ Part-Boundary1-Condition = open
! =============================================================================== !
UseDSMC=F
Particles-DSMCElectronicDatabase=DSMCSpecies_electronic_state_full_Data.h5 ! when supplied: doQK=true
Particles-DSMCReservoirSim=false
Particles-NumberForDSMCOutputs=0
Part-TimeFracForSampling=0.0
Particles-DSMC-CollisMode=3 !(1:elast coll, 2: elast + rela, 3:chem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ Part-Boundary6-SourceName = BC_z+
! =============================================================================== !
UseDSMC=F
Particles-DSMCElectronicDatabase=DSMCSpecies_electronic_state_full_Data.h5 ! when supplied: doQK=true
Particles-DSMCReservoirSim=false
Particles-NumberForDSMCOutputs=0
Part-TimeFracForSampling=0.0
Particles-DSMC-CollisMode=3 !(1:elast coll, 2: elast + rela, 3:chem)
Expand Down
1 change: 0 additions & 1 deletion regressioncheck/NIG_dielectric/HDG_cylinder/parameter.ini
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ Part-nPeriodicVectors=2
! =============================================================================== !
UseDSMC=F
Particles-DSMCElectronicDatabase=DSMCSpecies_electronic_state_full_Data.h5 ! when supplied: doQK=true
Particles-DSMCReservoirSim=false
Particles-NumberForDSMCOutputs=0
Part-TimeFracForSampling=0.0
Particles-DSMC-CollisMode=3 !(1:elast coll, 2: elast + rela, 3:chem)
Expand Down
1 change: 0 additions & 1 deletion regressioncheck/NIG_dielectric/HDG_slab/parameter.ini
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ Part-nPeriodicVectors=2
! =============================================================================== !
UseDSMC=F
Particles-DSMCElectronicDatabase=DSMCSpecies_electronic_state_full_Data.h5 ! when supplied: doQK=true
Particles-DSMCReservoirSim=false
Particles-NumberForDSMCOutputs=0
Part-TimeFracForSampling=0.0
Particles-DSMC-CollisMode=3 !(1:elast coll, 2: elast + rela, 3:chem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ Part-Boundary6-Condition = open
! =============================================================================== !
UseDSMC=F
Particles-DSMCElectronicDatabase=DSMCSpecies_electronic_state_full_Data.h5 ! when supplied: doQK=true
Particles-DSMCReservoirSim=false
Particles-NumberForDSMCOutputs=0
Part-TimeFracForSampling=0.0
Particles-DSMC-CollisMode=3 !(1:elast coll, 2: elast + rela, 3:chem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ Part-nPeriodicVectors=2
! =============================================================================== !
UseDSMC=F
Particles-DSMCElectronicDatabase=DSMCSpecies_electronic_state_full_Data.h5 ! when supplied: doQK=true
Particles-DSMCReservoirSim=false
Particles-NumberForDSMCOutputs=0
Part-TimeFracForSampling=0.0
Particles-DSMC-CollisMode=3 !(1:elast coll, 2: elast + rela, 3:chem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ Part-Boundary1-Condition = open
! =============================================================================== !
UseDSMC=F
Particles-DSMCElectronicDatabase=DSMCSpecies_electronic_state_full_Data.h5 ! when supplied: doQK=true
Particles-DSMCReservoirSim=false
Particles-NumberForDSMCOutputs=0
Part-TimeFracForSampling=0.0
Particles-DSMC-CollisMode=3 !(1:elast coll, 2: elast + rela, 3:chem)
Expand Down
20 changes: 0 additions & 20 deletions regressioncheck/NIG_sanitize/poisson/parameter.ini
Original file line number Diff line number Diff line change
Expand Up @@ -121,29 +121,9 @@ Part-PartLorentzType = 3 ! old
! =============================================================================== !
! DSMC
! =============================================================================== !
! UseDSMC=false
! Particles-DSMCReservoirSim=false
! Particles-NumberForDSMCOutputs=0
! Part-TimeFracForSampling=0.0
! Particles-DSMC-CollisMode=3 !(1:elast coll, 2: elast + rela, 3:chem)
! Part-NumberOfRandomSeeds =2
! Particles-RandomSeed1= 1
! Particles-RandomSeed2= 2
! !ManualTimeStep=3.3E-13
!
! Particles-HaloEpsVelo=300E6
! epsCG=1e-6 ! 1.0E-6
! maxIterCG=2000 !'500'
! ! MISC
!
! xyzPhysicalMinMax = (/-5.00E-01,5.00E-01,-5.00E-01,5.00E-01,-5.00E-01,5.00E-01,/) !



UseDSMC=T ! yolo
Particles-DSMC-ElectronicModel= 1
Particles-DSMCElectronicDatabase=DSMCSpecies_electronic_state_full_Data.h5 ! when supplied: doQK=true
Particles-DSMCReservoirSim=false
Particles-NumberForDSMCOutputs=0
Part-TimeFracForSampling=0.0
Particles-DSMC-CollisMode=3 !(1:elast coll, 2: elast + rela, 3:chem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ Particles-NumberForDSMCOutputs = 1
Part-TimeFracForSampling = 0.5
Particles-DSMC-CalcSurfaceVal = T
Particles-DSMC-CalcQualityFactors = T
Particles-DSMCReservoirSim = F
Particles-DSMC-CollisMode = 2 !(1:elast coll, 2: elast + rela, 3:chem)
Part-NumberOfRandomSeeds = 2
Particles-RandomSeed1 = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ Particles-NumberForDSMCOutputs=100
Particles-DSMC-CalcSurfaceVal=true
Particles-DSMC-CalcQualityFactors=true
UseDSMC=true
Particles-DSMCReservoirSim=false
Particles-DSMC-CollisMode=1 !(1:elast coll, 2: elast + rela, 3:chem)
Part-NumberOfRandomSeeds=2
Particles-RandomSeed1=1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ Part-TimeFracForSampling=0.75
Particles-DSMC-CalcSurfaceVal=T
Particles-DSMC-CalcQualityFactors=T
UseDSMC=true
Particles-DSMCReservoirSim=false
Particles-DSMC-CollisMode=1 !(1:elast coll, 2: elast + rela, 3:chem)
Part-NumberOfRandomSeeds=2
Particles-RandomSeed1=1
Expand Down
Loading

0 comments on commit fea602f

Please sign in to comment.