Skip to content

Commit

Permalink
merging in main
Browse files Browse the repository at this point in the history
  • Loading branch information
mbeidler3 committed Nov 14, 2024
2 parents 5ca20e5 + 93a8896 commit c422bc6
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 62 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/agate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@ jobs:
cd ./KORC
./build.sh
cd ./build && ctest -j ${{ steps.cpu-cores.outputs.count }} --output-on-failure
- name: test korc
run: |
. ./spack/share/spack/setup-env.sh
spack load hdf5+fortran+mpi %[email protected]
./KORC/ci_stub/agate_job_test.sh
- name: Show Cache
if: failure()
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cmake -DCMAKE_BUILD_TYPE:String=$BUILD_TYPE \
-DCMAKE_Fortran_FLAGS="-malign-double -fconvert='big-endian' -fallow-argument-mismatch" \
-DCMAKE_C_FLAGS="-malign-double" \
-DCMAKE_CXX_FLAGS="-malign-double" \
-DCMAKE_Fortran_FLAGS_DEBUG="-g3 -ffpe-trap=zero,overflow -fbacktrace" \
-DCMAKE_Fortran_FLAGS_DEBUG="-g3 -ffpe-trap='zero,overflow' -fbacktrace" \
-DCMAKE_C_FLAGS_DEBUG="-g3" \
-DCMAKE_CXX_FLAGS_DEBUG="-g3" ../

Expand Down
27 changes: 27 additions & 0 deletions ci_stub/agate_job_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

pushd ./KORC/build >/dev/null

ctest --output-on-failure
testexit=$?

pushd ./bin >/dev/null

for j in "mars_test" "egyro_test"; do
for i in $(ls -1 ./${j}/ | sort -k1.6n); do
for x in {1..20}; do echo "."; done
echo "agate_job_test >> [Info] << ${j}/${i}/output.korc"
for x in {1..5}; do echo "."; done
cat ./${j}/${i}/output.korc
done
done

popd >/dev/null
popd >/dev/null

if [ $testexit -eq 0 ]
then
exit 0
else
exit 1
fi
103 changes: 51 additions & 52 deletions src/korc_fields.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1341,16 +1341,9 @@ subroutine initialize_fields(params,F)
end if

! SELECT CASE (TRIM(params%field_model))
if (params%field_model(1:10).eq.'UNIFORM') then

F%Bo=Bo
F%Eo=Eo
else if (params%field_model(1:10).eq.'ANALYTICAL') then
! CASE('ANALYTICAL')
! Load the parameters of the analytical magnetic field
!open(unit=default_unit_open,file=TRIM(params%path_to_inputs), &
! status='OLD',form='formatted')
!read(default_unit_open,nml=analytical_fields_params)
!close(default_unit_open)

F%AB%Bo = Bo
F%AB%a = minor_radius
Expand Down Expand Up @@ -1388,10 +1381,58 @@ subroutine initialize_fields(params,F)
F%AB%l_mn = l_mn
F%AB%sigma_mn = sigma_mn

!write(output_unit_write,*) E_dyn,E_pulse,E_width

F%res_double=res_double

F%Bfield = Bfield
F%B1field = B1field
F%dBfield = dBfield
F%Bflux = Bflux
F%Bflux3D = Bflux3D
F%Efield = Efield
F%E1field = E1field
F%axisymmetric_fields = axisymmetric_fields
F%Dim2x1t = Dim2x1t
F%ReInterp_2x1t = ReInterp_2x1t
F%t0_2x1t = t0_2x1t
F%ind0_2x1t = ind0_2x1t
F%psip_conv = psip_conv
F%MARS_AMP_Scale = MARS_AMP_Scale
F%MARS_phase = MARS_phase
F%Analytic_D3D_IWL=Analytic_D3D_IWL
F%ntiles=ntiles
F%circumradius=circumradius
F%AORSA_AMP_Scale=AORSA_AMP_Scale
F%AORSA_freq=AORSA_freq
F%AORSA_nmode=AORSA_nmode
F%AORSA_mmode=AORSA_mmode
F%useLCFS = useLCFS
F%useDiMES = useDiMES
F%DiMESloc = DiMESloc
F%DiMESdims = DiMESdims


F%E_2x1t = E_2x1t

F%E_profile = E_profile
F%E_dyn = E_dyn
F%E_edge = E_edge
F%E_pulse = E_pulse
F%E_width = E_width
F%AB%a = minor_radius
F%AB%Ro = major_radius

F%PSIp_lim=PSIp_lim

if (params%field_model(1:10).eq.'ANALYTICAL') then
! CASE('ANALYTICAL')
! Load the parameters of the analytical magnetic field
!open(unit=default_unit_open,file=TRIM(params%path_to_inputs), &
! status='OLD',form='formatted')
!read(default_unit_open,nml=analytical_fields_params)
!close(default_unit_open)

!write(output_unit_write,*) E_dyn,E_pulse,E_width

if (params%mpi_params%rank .EQ. 0) then
write(output_unit_write,'("ANALYTIC")')
write(output_unit_write,'("Magnetic field: ",E17.10)') F%Bo
Expand Down Expand Up @@ -1527,55 +1568,13 @@ subroutine initialize_fields(params,F)
!read(default_unit_open,nml=externalPlasmaModel)
!close(default_unit_open)

F%Bfield = Bfield
F%B1field = B1field
F%dBfield = dBfield
F%Bflux = Bflux
F%Bflux3D = Bflux3D
F%Efield = Efield
F%E1field = E1field
F%axisymmetric_fields = axisymmetric_fields
F%Dim2x1t = Dim2x1t
F%ReInterp_2x1t = ReInterp_2x1t
F%t0_2x1t = t0_2x1t
F%ind0_2x1t = ind0_2x1t
F%psip_conv = psip_conv
F%MARS_AMP_Scale = MARS_AMP_Scale
F%MARS_phase = MARS_phase
F%Analytic_D3D_IWL=Analytic_D3D_IWL
F%ntiles=ntiles
F%circumradius=circumradius
F%AORSA_AMP_Scale=AORSA_AMP_Scale
F%AORSA_freq=AORSA_freq
F%AORSA_nmode=AORSA_nmode
F%AORSA_mmode=AORSA_mmode
F%useLCFS = useLCFS
F%useDiMES = useDiMES
F%DiMESloc = DiMESloc
F%DiMESdims = DiMESdims

if (params%proceed.and.F%ReInterp_2x1t) then
call load_prev_iter(params)
F%ind_2x1t=params%prev_iter_2x1t
else
F%ind_2x1t=F%ind0_2x1t
end if


F%E_2x1t = E_2x1t

F%E_profile = E_profile
F%E_dyn = E_dyn
F%E_edge = E_edge
F%E_pulse = E_pulse
F%E_width = E_width
F%AB%a = minor_radius
F%AB%Ro = major_radius

F%PSIp_lim=PSIp_lim

F%res_double=res_double

!write(output_unit_write,'("E_dyn: ",E17.10)') E_dyn
! write(output_unit_write,'("E_pulse: ",E17.10)') E_pulse
! write(output_unit_write,'("E_width: ",E17.10)') E_width
Expand Down
8 changes: 8 additions & 0 deletions src/korc_ppusher.f90
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ subroutine FO_init(params,F,spp,output,step)
!write(6,*) 'b_unit',b_unit_X,b_unit_Y,b_unit_Z

v(cc) = SQRT(V_X(cc)*V_X(cc)+V_Y(cc)*V_Y(cc)+V_Z(cc)*V_Z(cc))

g(cc) = 1._rp/SQRT(1._rp-v(cc)*v(cc))

if (v(cc).GT.korc_zero) then
! Parallel and perpendicular components of velocity
vpar(cc) = (V_X(cc)*b_unit_X(cc)+V_Y(cc)*b_unit_Y(cc)+ &
Expand Down Expand Up @@ -385,6 +388,11 @@ subroutine FO_init(params,F,spp,output,step)

spp(ii)%vars%eta(pp-1+cc) = eta_tmp

!write(6,*) Bmag(cc)

!write(output_unit_write,'("Bmag: ",E17.10)') Bmag(cc)
!write(output_unit_write,'("vperp: ",E17.10)') vperp(cc)
!write(output_unit_write,'("gam: ",E17.10)') g(cc)

! Magnetic moment
spp(ii)%vars%mu(pp-1+cc) = 0.5_rp*m_cache* &
Expand Down
9 changes: 1 addition & 8 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,11 @@ configure_file(${CMAKE_SOURCE_DIR}/test/egyro/korc_egyro.sh.in ${CMAKE_BINARY_DI
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)

#if(USE_PSPLINE)
# add_test (NAME mars_test_1
# COMMAND ${CMAKE_BINARY_DIR}/mars_test/korc_mars.sh 1
# WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# set_tests_properties (mars_test_1 PROPERTIES PROCESSORS 1 ENVIRONMENT OMP_NUM_THREADS=1)
#endif()

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)

foreach(RANK IN ITEMS 1 2 4 8) #16)
foreach(RANK IN ITEMS 1 2 4 8)
if(${RANK} LESS_EQUAL ${MPIEXEC_MAX_NUMPROCS})
add_test (NAME egyro_test_${RANK}
COMMAND ${CMAKE_BINARY_DIR}/egyro_test/korc_egyro.sh ${RANK}
Expand Down

0 comments on commit c422bc6

Please sign in to comment.