From b08b24c0d49a8895875f6f097e1ff6311ec3f3df Mon Sep 17 00:00:00 2001 From: Steven Hahn Date: Tue, 20 Feb 2024 17:14:10 -0500 Subject: [PATCH] Fruit builds with CMake Signed-off-by: Steven Hahn --- CMakeLists.txt | 13 - src/CMakeLists.txt | 12 +- test/CMakeLists.txt | 6 +- test/reg_tests/input_file_regtest1.korc | 334 ------------------------ test/reg_tests/korc_regtest1.sh | 26 -- 5 files changed, 11 insertions(+), 380 deletions(-) delete mode 100755 test/reg_tests/input_file_regtest1.korc delete mode 100755 test/reg_tests/korc_regtest1.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 2caa19ee..abc0cbda 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,14 +63,6 @@ add_subdirectory (src) add_definitions (-DMAC) if(1) -# Configure FRUIT - include_directories (${FRUIT_INCLUDE_PATH}) - set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FRUIT_LINK_FLAGS}") - - # Configure KORCSRC - include_directories (${KORCSRC_INCLUDE_PATH}) - set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${KORCSRC_LINK_FLAGS}") - add_subdirectory (test) enable_testing() @@ -80,11 +72,6 @@ if(1) WORKING_DIRECTORY build/bin ) - add_test (NAME regression_test_1 - COMMAND korc_regtest1.sh - WORKING_DIRECTORY test/reg_tests - ) - endif () diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f9a5e264..20e1018c 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -28,10 +28,16 @@ list (APPEND korc_sources korc_pspline.f90 ) -korc_sources -main.f90 +set(korc_main "") +list(APPEND korc_main + main.f90 +) + +add_library(korc_lib ${korc_sources}) +set_property(TARGET korc_lib PROPERTY LINKER_LANGUAGE Fortran) -add_executable (xkorc ${korc_sources}) +add_executable (xkorc ${korc_main}) +target_link_libraries(xkorc korc_lib) set_property(TARGET xkorc PROPERTY LINKER_LANGUAGE Fortran) option (CORI_DIR "Use Cori directories" OFF) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3ba16ffc..63d5c693 100755 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,9 +3,6 @@ add_library (fruit fruit/fruit.f90) -#add_library (fruit_mpi fruit/fruit_mpi.f90) -#target_link_libraries(fruit_mpi PUBLIC fruit ) - set (korc_tests "") list (APPEND korc_tests korc_test.f90 @@ -16,6 +13,7 @@ list (APPEND korc_tests add_executable (xtest ${korc_tests}) set_property(TARGET xtest PROPERTY LINKER_LANGUAGE Fortran) -target_link_libraries (xtest fruit xkorc ${MPI_Fortran_LIBRARIES}) +target_link_libraries (xtest fruit korc_lib ${MPI_Fortran_LIBRARIES}) target_link_libraries (xtest ${HDF5_LIBRARIES}) target_link_libraries (xtest ${KORCSRC_LIBRARIES}) + diff --git a/test/reg_tests/input_file_regtest1.korc b/test/reg_tests/input_file_regtest1.korc deleted file mode 100755 index 45c84cb4..00000000 --- a/test/reg_tests/input_file_regtest1.korc +++ /dev/null @@ -1,334 +0,0 @@ -&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-7 - ! 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.E0 - ! Time step as fraction of relativistic gyro-period - num_species = 1 - minimum_particle_energy = 1.0E5 - ! Minimum energy of simulated particles in eV - radiation = F - GC_rad_model='SDE' - collisions = 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 = 'ANALYTICAL-PSI' - profile_model = 'ANALYTICAL' - ! 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 = 'C1.h5' -! magnetic_field_filename = 'JFIT_D3D_164409_1405ms.h5' - time_slice = 000 - rmax = 1.60 - rmin = 0.15 - zmax = 1.65 - zmin = -1.65 - 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}' - HDF5_error_handling = T - FO_GC_compare = F - orbit_model = 'FO' - ! '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 = 'eqn' - ! Set for plasma_model='ANALYTICAL'. Can be 'interp' or 'eqn', - ! where 'eqn' evaluates particle fields at particle positions and - ! 'interp' interpolates precomputed fields. - FokPlan = F - SameRandSeed = F - SC_E = F - SC_E_add = F - pchunk = 1 -/ - -&plasma_species - runaway = F - ppp =1 - ! Number of particles per process (mpi) - q = -1.0 - ! Electric charge - m = 1.0 - ! In units of electron mass - spatial_distribution = 'TRACER' - ! 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 = 1.1 - PHIo = 0.0 - ! In degrees - Zo = -0.05 - r_inner = 0.0 - r_outter = 0.6 - shear_factor = 0.35 - sigmaR = 1.e6 - sigmaZ = 0.2 - theta_gauss = 0.0 - psi_max=.8446 - ! goes as R^2 for HOLLMANN-3D, is psiN_max for HOLLMANN-3D-PSI - falloff_rate = 0.0 - energy_distribution = 'MONOENERGETIC' - ! Options are: 'MONOENERGETIC', 'THERMAL', 'AVALANCHE', - ! 'EXPERIMENTAL', and 'UNIFORM' - pitch_distribution = 'MONOPITCH' - ! Options are: 'MONOPITCH', 'AVALANCHE', 'EXPERIMENTAL', and 'UNIFORM'. - Eno = 10.0E6 - ! Initial energy in eV - etao = 1.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 = 1.1,0.0,0.0 - ! Initial position of tracer particle for debugging with - ! spatial_distribution='TRACER' - Spong_b = 0.2 - Spong_w = 0.1 - Spong_dlam = 0.1 - 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 - Eo = 0. - ! In V/m - current_direction = 'ANTI-PARALLEL' - ! 'PARALLEL' or 'ANTI-PARALLEL' - Bo = 2.2 - ! In Teslas. ITER: 5.42 DIII-D: 2.19 - minor_radius = 0.7 - ! Minor radius in meters. ITER: 1.5 DIII-D: 0.5 - major_radius = 1.7 - ! Major radius in meters. ITER: 6.5 DIII-D: 1.6 - qa = 5 - ! Safety factor at the separatrix (r=a) - qo = 1.5 - ! Safety factor at the separatrix (r=a) - nR= 50 - ! Mesh points in R for analytical interpolation mesh - nZ= 50 - ! Mesh points in Z for analytical interpolation mesh - nPHI= 50 - ! Mesh points in Z for analytical interpolation mesh - E_dyn = 0. -! E_dyn = 1.5926 - E_pulse = 5.E-2 - E_width = 2.5E-2 -/ - -&externalPlasmaModel - Bfield = F - dBfield = F - axisymmetric_fields = F - Bflux = F - Bflux3D = F - Efield = F - Dim2x1t =F - E_2x1t = F - t0_2x1t = 1.405 - ind0_2x1t = 11 - ReInterp_2x1t = F - res_double=0 - dim_1D=50 - dt_E_SC=1.E-7 - Ip_exp=2E5 - PSIp_lim=0.8446 - PSIp_0= 0.6 -/ - -&plasmaProfiles - axisymmetric = T - filename = 'JFIT_D3D_157576_t1580_1.h5' - radius_profile = 0.6 - ne_profile = 'RE-EVO-PSIP-G' - ! Options are 'FLAT','POLYNOMIAL','RE-EVO','RE-EVO1','RE-EVO-PSI' - neo = 4.E20 - ! In m^-3 - n_ne = 2.5E19 - n_shelf = 2.5E19 - ! - a_ne = 0.99713,0.047037,0.40023,-1.0466 - n_REr0 = 0.4 - n_tauion = 1.5e-2 - n_tauin = 7.5e-3 - n_tauout = 1.25e-2 - n_shelfdelay = 4.e-2 - n_lamfront = 0.005 - n_lamback = 0.005 - n_lamshelf = 0.225 - psiN_0 = 0.8 - - - Te_profile = 'FLAT' - ! Options are 'FLAT' and 'POLYNOMIAL' - Teo = 1.5 - ! In eV - n_Te = 0.1 - a_Te = 1.0046,-0.076652,-2.6429,1.7415 - - Zeff_profile = 'FLAT' - ! Options are 'FLAT' and 'POLYNOMIAL' - Zeffo = 1. - ! In m^-3 - n_Zeff = 3.0 - a_Zeff = 1.0065,-0.12081,0.02834,-0.11796 -/ - -&CollisionParamsSingleSpecies - Te_sing = 2.0 - ! Background electron temperature in eV - Ti_sing = 2.0 - ! Background ion temperature in eV - ne_sing = 4.E20 - ! Background electron density in m^-3 - Zeff_sing = 1. - ! Effective atomic number - dTau_sing = 5.E-2 - ! Subcycling time step in collisional time units (Tau) -/ - -&CollisionParamsMultipleSpecies - num_impurity_species = 1 - Te_mult = 2.0 - ! Background electron temperature in eV - ne_mult = 4.E20 - ! Background electron density in 1/m^3 - Zo_mult = 10.0 - ! Full nuclear charge of each impurity: Z=1 for D, Z=10 for Ne, Z=18 for Ar - Zj_mult = 1.0, - ! Average charge state of each impurity - nz_mult = 4.E20 - ! Impurity densities - IZj_mult = 15.7596 - ! Ionization energy of impurity in eV -/ - -&AvalancheGenerationPDF - max_pitch_angle_aval = 10.0 - ! Maximum pitch angle of sampled PDF in degrees - min_pitch_angle_aval = 0.0 - dth_aval = 1.0 - ! Variance of sampling normal variate for pitch angle - dp_aval = 10.0 - ! Variance of sampling normal variate for momentum - dR_aval = 0.05 - ! Variance of sampling normal variate for R location - dZ_aval = 0.05 - ! Variance of sampling normal variate for Z location - max_energy_aval = 60E6 - ! Maximum energy of sampled PDF in MeV - min_energy_aval = 7.0E6 - ne_aval = 8.5E18 - ! Background electron density in m^-3 - Zeff_aval = 1.0 - ! Effective atomic number of ions - Epar_aval = 0.7427 - ! Parallel electric field in V/m - Te_aval = 1.0 - ! Background electron temperature in eV -/ - -&ExperimentalPDF - E_expt = 7.67042 - ! Parallel electric field in units of Ec - Zeff_expt = 1.36632 - ! Effective atomic number - max_pitch_angle_expt = 176.257 - ! In degrees - min_pitch_angle_expt = 158.25 - ! In degrees - min_energy_expt = 9.54997E6 - ! In eV - max_energy_expt = 44.3241E6 - ! In eV - k_expt = 11.89 - ! Shape factor of Gamma distribution for energy - t_expt = 0.65 - ! Scale factor of Gamma distribution for energy - Bo_expt = 2.0 - ! Characteristic magnetic field - lambda_expt = 890.0E-9 - ! Characteristic wavelength - A_fact_expt=1. -/ - -&HollmannPDF - filename_Hollmann = 'Hollmann_PDF_HR.h5' - Eo_Hollmann = 24.56 - ! Toroidal electric field from experimental diagnostics before SPI in - ! physical units - E_Hollmann = 11. - ! Parallel electric field in units of Ec - sigma_E_Hollmann=.2 - Zeff_Hollmann = 5. - ! Effective atomic number - sigma_Z_Hollmann=10. - max_pitch_angle_Hollmann = 40. - ! In degrees - min_pitch_angle_Hollmann = 0. - ! In degrees - min_energy_Hollmann = 1.E6 - ! In eV - max_energy_Hollmann = 60.E6 - ! For Hollmann_PDF_HR.h5, needs to be less than 80 MeV - ! In eV - current_direction_Hollmann = 'ANTICLOCKWISE' - Bo_Hollmann = 2.2 - ! Characteristic magnetic field - lambda_Hollmann = 4.0E-6 - ! Characteristic wavelength - A_fact_Hollmann=1. -/ - -&EnergyGammaPDF - min_energy_gamma = 1.0E6 - ! In eV - max_energy_gamma = 30.0E6 - ! In eV - k_gamma = 11.89 - ! Shape factor of Gamma distribution for energy - t_gamma = 0.65 - ! Scale factor of Gamma distribution for energy -/ - -&SimpleEquilibriumPDF - E_simple = 4.5 - ! Parallel electric field in units of Ec - Zeff_simple = 4.0 - ! Effective atomic number - max_pitch_angle_simple = 60.0 - ! In degrees - min_pitch_angle_simple = 0.0 - ! In degrees - Bo_simple = 2.0 - ! Characteristic magnetic field - lambda_simple = 890.0E-9 - ! Characteristic wavelength -/ - diff --git a/test/reg_tests/korc_regtest1.sh b/test/reg_tests/korc_regtest1.sh deleted file mode 100755 index ac80911d..00000000 --- a/test/reg_tests/korc_regtest1.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -#define input file -INPUT_FILE="input_file_regtest1.korc" -#define output directory -OUT_DIR="OUT_TEST" -CMDLINE_OUT="cmdline_out.txt" - -#check that output directory doesn't exist so bash doesn't complain -if [ ! -d "$OUT_DIR" ]; then - mkdir $OUT_DIR -fi - -#run KORC with input file outputting in desired directory -echo Running KORC with input file $INPUT_FILE and outputting to $OUT_DIR. - -#assumes binary directory ../KORC/build/bin was added to path -xkorc $INPUT_FILE $OUT_DIR/ &> $CMDLINE_OUT - -# pause before reading output file -#sleep .5 - -#print last line, which should say "KORC ran successfully!" -test=$( tail -1 $OUT_DIR/output.korc ) -echo $test -