Skip to content

Commit

Permalink
adding test for collision operators using ionbalance data from Eric H…
Browse files Browse the repository at this point in the history
…ollmann
  • Loading branch information
mbeidler3 committed Nov 6, 2024
1 parent 73d385e commit 25e9048
Show file tree
Hide file tree
Showing 20 changed files with 203 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ set_property(TARGET xtest PROPERTY LINKER_LANGUAGE Fortran)
configure_file(${CMAKE_SOURCE_DIR}/test/egyro/korc_egyro.sh.in ${CMAKE_BINARY_DIR}/egyro_test/korc_egyro.sh)
configure_file(${CMAKE_SOURCE_DIR}/test/mars/korc_mars.sh.in ${CMAKE_BINARY_DIR}/mars_test/korc_mars.sh)
configure_file(${CMAKE_SOURCE_DIR}/test/aorsa/korc_aorsa.sh.in ${CMAKE_BINARY_DIR}/aorsa_test/korc_aorsa.sh)
configure_file(${CMAKE_SOURCE_DIR}/test/hollmann/korc_hollmann.sh.in ${CMAKE_BINARY_DIR}/hollmann_test/korc_hollmann.sh)

#if(USE_PSPLINE)
# add_test (NAME mars_test_1
Expand All @@ -34,6 +35,7 @@ configure_file(${CMAKE_SOURCE_DIR}/test/aorsa/korc_aorsa.sh.in ${CMAKE_BINARY_DI
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/egyro_test)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/mars_test)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/aorsa_test)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/hollmann_test)

foreach(RANK IN ITEMS 1 2 4 8) #16)
if(${RANK} LESS_EQUAL ${MPIEXEC_MAX_NUMPROCS})
Expand All @@ -52,6 +54,11 @@ foreach(RANK IN ITEMS 1 2 4 8) #16)
COMMAND ${CMAKE_BINARY_DIR}/aorsa_test/korc_aorsa.sh ${RANK}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set_tests_properties (aorsa_test_${RANK} PROPERTIES PROCESSORS ${RANK} ENVIRONMENT OMP_NUM_THREADS=1)

add_test (NAME hollmann_test_${RANK}
COMMAND ${CMAKE_BINARY_DIR}/hollmann_test/korc_hollmann.sh ${RANK}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set_tests_properties (hollmann_test_${RANK} PROPERTIES PROCESSORS ${RANK} ENVIRONMENT OMP_NUM_THREADS=1)
endif()

add_test (NAME unit_testing_${RANK}
Expand Down
Binary file added test/hollmann/EFIT_JET_95128_Hratio.h5
Binary file not shown.
Binary file added test/hollmann/Hollmann_PDF_JET_95128_3.h5
Binary file not shown.
170 changes: 170 additions & 0 deletions test/hollmann/input_file_JET_95128_TEST15b.korc
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
&input_parameters
restart = F
! Restart simulation that exited before simulation_time reached
proceed = F
! Append simulation results after previous simulation_time reached
reinit = F
! Begin a new simulation, reinitializing from restart file state
simulation_time = 1.E-8
! Total aimed simulation time in seconds
! Run 10 mu s If transients exist put 5 extra mu s.
snapshot_frequency = 1.E-9
! Time between snapshots in seconds
restart_overwrite_frequency = 1.E-1
! Time between overwritting of restart file in seconds
dt = 1.58E0
! Time step as fraction of relativistic gyro-period
num_species = 1
minimum_particle_energy = 1.0E2
! Minimum energy of simulated particles in eV
radiation = T
GC_rad_model='SDE'
collisions = T
LargeCollisions = F
collisions_model = 'SINGLE_SPECIES'
! Options are: 'NONE','SINGLE_SPECIES' and 'MULTIPLE_SPECIES'
bound_electron_model = 'HESSLOW'
! Options are: 'NO_BOUND', 'HESSLOW', and 'ROSENBLUTH'
field_model = 'EXTERNAL-PSI'
profile_model = 'EXTERNAL_Hdt'
! The two options for this parameter are 'ANALYTICAL' or 'EXTERNAL'.
! For 'ANALYTICAL', the magnetic field is calculated based on
! the parameters given in the "analytic_mag_field_params" section.
! For 'EXTERNAL', the magnetic field is loaded from the file
! specified in "filename".
! 'UNIFORM' A uniform magnetic field used to advance only electrons'
! velocity.
magnetic_field_filename = 'EFIT_JET_95128_Hratio.h5'
outputs_list = '{X,Y,V,B,E,g,eta,flagCon,flagCol,PSIp}'
! List of outputs
!'{X,Y,V,E,B,g,mu,eta,Prad,Pin,flagCon,flagCol,gradB,
! curlb,ne,Te,Zeff,PSIp,nimp}'
HDF5_error_handling = T
orbit_model = 'GC'
! 'FO' for full orbit, 'GCpre' for guiding center with pre-computed
! auxiliary fields, 'GCgrad' for guiding center with auxiliary
! fields computed with PSPLINE.
field_eval = 'interp'
! Set for plasma_model='ANALYTICAL'. Can be 'interp' or 'eqn',
! where 'eqn' evaluates particle fields at particle positions and
! 'interp' interpolates precomputed fields.
SameRandSeed = T
!pchunk = 1
/

&plasma_species
runaway = T
ppp = 100
! Number of particles per process (mpi)
q = -1.0
! Electric charge
m = 1.0
! In units of electron mass
spatial_distribution = 'HOLLMANN-1DTRANSPORT'
! Options are: 'UNIFORM', 'DISK', 'TORUS', 'EXPONENTIAL-TORUS',
! 'GAUSSIAN-TORUS', 'ELLIPTIC-TORUS', 'EXPONENTIAL-ELLIPTIC-TORUS',
! 'GAUSSIAN-ELLIPTICAL-TORUS', '2D-GAUSSIAN-ELLIPTIC-TORUS-MH',
! 'AVALANCHE-4D','TRACER','SPONG-3D','HOLLMANN-3D'
Ro = 2.6
PHIo = 0.0
! In degrees
Zo = 0.0
sigmaR = 1.e6
sigmaZ = 0.2
theta_gauss = 0.0
psi_max=1.
! goes as R^2 for HOLLMANN-3D, is psiN_max for HOLLMANN-3D-PSI
energy_distribution = 'HOLLMANN-1DTRANSPORT'
! Options are: 'MONOENERGETIC', 'THERMAL', 'AVALANCHE',
! 'EXPERIMENTAL', and 'UNIFORM'
pitch_distribution = 'HOLLMANN-1DTRANSPORT'
! Options are: 'MONOPITCH', 'AVALANCHE', 'EXPERIMENTAL', and 'UNIFORM'.
Eno = 10.0E6
! Initial energy in eV
etao = 170.0
! Initial pitch angle
Eo_lims = 1.0E6,50.0E6
! Lower and upper limit of simulated energy range, in eV.
etao_lims = 0.0,20.0
! Lower and upper limit of simulated pitch-angle range, in degrees.
Xtrace = 2.6,0.0,0.0
! Initial position of tracer particle for debugging with
! spatial_distribution='TRACER'
dth = 3.
! Variance of sampling normal variate for pitch angle
dgam = 3.
! Variance of sampling normal variate for pitch angle
dR = 0.1
! Variance of sampling normal variate for R location
dZ = 0.1
! Variance of sampling normal variate for Z location
/

&analytical_fields_params
/

&externalPlasmaModel
Bfield = F
B1field = F
E1field = F
dBfield = F
axisymmetric_fields = T
Bflux = F
Bflux3D = T
Efield = T
Dim2x1t =T
ReInterp_2x1t = T
PSIp_lim= 1.046608805604306e+00
PSIp_0= 8.838935617719927e-01
psip_conv=-1.
! sign appended to \nabla\phi\times\nabla\psi_p for definition of
! poloidal magnetic field. +1 for DIII-D, -1 for JET
/

&plasmaProfiles
axisymmetric = T
filename = 'EFIT_JET_95128_Hratio.h5'
/

&CollisionParamsSingleSpecies
Te_sing = 3.e0
! Background electron temperature in eV
Ti_sing = 3.e0
! Background ion temperature in eV
ne_sing = 9.63E19
! Background electron density in m^-3
Zeff_sing = 3.84
! Effective atomic number
dTau_sing = 5.e-2
! Subcycling time step in collisional time units (Tau)
!p_therm = 1.
!min_secRE = 'CRIT'
!ConserveLA = T
!Clog_model = 'MCDEVITT'
!sample_test = F
/

&CollisionParamsMultipleSpecies
num_impurity_species = 1
Te_mult = 3.e0
! Background electron temperature in eV
ne_mult = 9.36E19
! Background electron density in 1/m^3
/

&HollmannPDF
filename_Hollmann = 'Hollmann_PDF_JET_95128_3.h5'
rho_ind = 7
max_pitch_angle_Hollmann = 90.
! In degrees
min_pitch_angle_Hollmann = 0.
! In degrees
min_energy_Hollmann = 2.E3
! In eV
max_energy_Hollmann = 8.4E6
! For Hollmann_PDF_HR.h5, needs to be less than 80 MeV
! In eV
current_direction_Hollmann = 'PARALLEL'

/

26 changes: 26 additions & 0 deletions test/hollmann/korc_hollmann.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

set -ex

#define input file
INPUT_FILE="${CMAKE_SOURCE_DIR}/test/hollmann/input_file_JET_95128_TEST15b.korc"
#define output directory
OUT_DIR="hollmann_test/rank_$1"

#check that output directory doesn't exist so bash doesn't complain
if [ ! -d $OUT_DIR ]; then
mkdir -p $OUT_DIR
fi
if [ ! -f EFIT_JET_95128_Hratio.h5 ]; then
ln -s ${CMAKE_SOURCE_DIR}/test/hollmann/EFIT_JET_95128_Hratio.h5 EFIT_JET_95128_Hratio.h5
fi
if [ ! -f Hollmann_PDF_JET_95128_3.h5 ]; then
ln -s ${CMAKE_SOURCE_DIR}/test/hollmann/Hollmann_PDF_JET_95128_3.h5 Hollmann_PDF_JET_95128_3.h5
fi

${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} $1 ./xkorc $INPUT_FILE $OUT_DIR/

for i in $(seq 0 $(($1-1)));
do
h5diff -r -p 0.000008 $OUT_DIR/file_$i.h5 ${CMAKE_SOURCE_DIR}/test/hollmann/rank_$1/file_$i.h5
done
Binary file added test/hollmann/rank_1/file_0.h5
Binary file not shown.
Binary file added test/hollmann/rank_2/file_0.h5
Binary file not shown.
Binary file added test/hollmann/rank_2/file_1.h5
Binary file not shown.
Binary file added test/hollmann/rank_4/file_0.h5
Binary file not shown.
Binary file added test/hollmann/rank_4/file_1.h5
Binary file not shown.
Binary file added test/hollmann/rank_4/file_2.h5
Binary file not shown.
Binary file added test/hollmann/rank_4/file_3.h5
Binary file not shown.
Binary file added test/hollmann/rank_8/file_0.h5
Binary file not shown.
Binary file added test/hollmann/rank_8/file_1.h5
Binary file not shown.
Binary file added test/hollmann/rank_8/file_2.h5
Binary file not shown.
Binary file added test/hollmann/rank_8/file_3.h5
Binary file not shown.
Binary file added test/hollmann/rank_8/file_4.h5
Binary file not shown.
Binary file added test/hollmann/rank_8/file_5.h5
Binary file not shown.
Binary file added test/hollmann/rank_8/file_6.h5
Binary file not shown.
Binary file added test/hollmann/rank_8/file_7.h5
Binary file not shown.

0 comments on commit 25e9048

Please sign in to comment.