Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/config.f90
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ module neort_config
real(dp) :: ms = 0.0_dp ! particle mass / u !*!
real(dp) :: vth = 0.0_dp ! thermal velocity / cm/s !*!
real(dp) :: epsmn = 0.0_dp ! perturbation amplitude B1/B0 (if pertfile==F)
real(dp) :: mph = 0.0_dp ! toroidal perturbation mode (if pertfile==F, n>0!)
integer :: m0 = 0 ! poloidal perturbation mode (if pertfile==F)
real(dp) :: mph = 0.0_dp ! toroidal perturbation mode (if pertfile==F, n>0!)
logical :: comptorque = .false. ! compute torque
logical :: magdrift = .false. ! consider magnetic drift
logical :: nopassing = .false. ! neglect passing particles
Expand Down Expand Up @@ -64,9 +64,8 @@ subroutine set_config(config)
call set_log_level(config%log_level)
end subroutine set_config

subroutine read_and_set_config(base_path)
! Set global control parameters directly from file
! The file name is only the base without the extension '.in'
subroutine read_and_set_config(config_file)
! Set global control parameters directly from a file
use do_magfie_mod, only: s, bfac, inp_swi
use do_magfie_pert_mod, only: mph, set_mph
use driftorbit, only: epsmn, m0, comptorque, magdrift, nopassing, pertfile, nonlin, efac
Expand All @@ -76,14 +75,14 @@ subroutine read_and_set_config(base_path)
use neort_profiles, only: M_t, vth
use util, only: qe, mu, qi, mi

character(len=*), intent(in) :: base_path
character(len=*), intent(in) :: config_file
real(dp) :: qs, ms
integer :: log_level

namelist /params/ s, M_t, qs, ms, vth, epsmn, m0, mph, comptorque, magdrift, &
nopassing, noshear, pertfile, nonlin, bfac, efac, inp_swi, vsteps, log_level

open (unit=9, file=trim(adjustl(base_path))//".in", status="old", form="formatted")
open (unit=9, file=config_file, status="old", form="formatted")
read (9, nml=params)
close (unit=9)

Expand Down
2 changes: 1 addition & 1 deletion src/diag/diag_atten_map.f90
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ subroutine run_atten_map_diag(arg_runname)

! Initialize like main
runname = trim(arg_runname)
call read_and_set_config(runname)
call read_and_set_config(runname//".in")
call do_magfie_init("in_file")
if (pertfile) call do_magfie_pert_init("in_file_pert")
call init_profiles(R0)
Expand Down
2 changes: 1 addition & 1 deletion src/diag/diag_bounce_debug.f90
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ subroutine run_bounce_debug(arg_runname)

! Initialize environment just like main
runname = trim(arg_runname)
call read_and_set_config(runname)
call read_and_set_config(runname//".in")
call do_magfie_init("in_file")
if (pertfile) call do_magfie_pert_init("in_file_pert")
call init_profiles(R0)
Expand Down
2 changes: 1 addition & 1 deletion src/diag/diag_bounce_nonlin.f90
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ subroutine run_bounce_nonlin_diag(arg_runname)

! Initialize NEO-RT environment similar to neort:main
runname = trim(arg_runname)
call read_and_set_config(runname)
call read_and_set_config(runname//".in")
call do_magfie_init("in_file")
if (pertfile) call do_magfie_pert_init("in_file_pert")
call init_profiles(R0)
Expand Down
2 changes: 1 addition & 1 deletion src/diag/diag_contrib_map.f90
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ subroutine run_contrib_diag(arg_runname)

! Initialize environment
runname = trim(arg_runname)
call read_and_set_config(runname)
call read_and_set_config(runname//".in")
call do_magfie_init("in_file")
if (pertfile) call do_magfie_pert_init("in_file_pert")
call init_profiles(R0)
Expand Down
1 change: 0 additions & 1 deletion src/do_magfie_standalone.f90
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,6 @@ subroutine init_mph_from_shared()
end subroutine init_mph_from_shared

subroutine do_magfie_pert_init(path)
! else epsmn*exp(imun*(m0*th + mph*ph))
! Backward compatibility wrapper: calls read_boozer_pert_file + init_magfie_pert_at_s
character(len=*), intent(in) :: path

Expand Down
10 changes: 5 additions & 5 deletions src/lib.f90
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ module neort_lib

contains

subroutine init_from_config_file(config_file_base, boozer_file, boozer_pert_file)
subroutine init_from_config_file(config_file, boozer_file, boozer_pert_file)
use do_magfie_mod, only: read_boozer_file
use do_magfie_pert_mod, only: read_boozer_pert_file
use driftorbit, only: pertfile, nonlin
use neort_config, only: read_and_set_config
use thetadata_mod, only: init_attenuation_data
use util, only: check_file

character(len=*), intent(in) :: config_file_base
character(len=*), intent(in) :: config_file
character(len=*), intent(in) :: boozer_file
character(len=*), intent(in), optional :: boozer_pert_file

call check_file(trim(config_file_base) // ".in", .true., ".in could not be found")
call check_file(config_file, .true., " could not be found")
call check_file(boozer_file, .true., " could not be found")

call read_and_set_config(config_file_base)
call read_and_set_config(config_file)
call read_boozer_file(boozer_file)

if (present(boozer_pert_file) .and. pertfile) then
Expand Down Expand Up @@ -130,7 +130,7 @@ subroutine neort_compute_at_s(s_val, transport_data_out)
call set_s(s_val)

call init_magfie_at_s()
if (pertfile) call init_magfie_pert_at_s()
if (pertfile) call init_magfie_pert_at_s() ! else epsmn*exp(imun*(m0*th + mph*ph))
call init_mph_from_shared()

call init_plasma_at_s() ! overwrites qi, mi and vth from config
Expand Down
2 changes: 1 addition & 1 deletion src/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ subroutine main

call get_command_argument(1, runname)

call neort_init(trim(runname), boozer_file, boozer_pert_file)
call neort_init(trim(runname)//".in", boozer_file, boozer_pert_file)

if (files_exist(plasma_file, profile_file)) then
call neort_prepare_splines(plasma_file, profile_file)
Expand Down
2 changes: 1 addition & 1 deletion test/test_multi_init.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ program test_multi_init
print *, ""

! Initialize once to load data
call read_and_set_config("driftorbit")
call read_and_set_config("driftorbit.in")
call do_magfie_init("in_file")

nmode_prev = nmode
Expand Down
6 changes: 3 additions & 3 deletions test/test_neort_lib.f90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ subroutine test_single_s()

print *, "Test: single s computation..."

call neort_init("driftorbit", "in_file")
call neort_init("driftorbit.in", "in_file")
call neort_prepare_splines("plasma.in", "profile.in")
call neort_compute_at_s(TEST_S, result)

Expand Down Expand Up @@ -61,7 +61,7 @@ subroutine test_parallel_loop()
s_array(i) = 0.2_dp + 0.1_dp * real(i, dp)
end do

call neort_init("driftorbit", "in_file")
call neort_init("driftorbit.in", "in_file")
call neort_prepare_splines("plasma.in", "profile.in")

!$omp parallel do schedule(dynamic)
Expand Down Expand Up @@ -100,7 +100,7 @@ subroutine test_spline_update()

print *, "Test: spline update (KAMEL use case)..."

call neort_init("driftorbit", "in_file")
call neort_init("driftorbit.in", "in_file")

call read_plasma_input("plasma.in", nplasma, am1, am2, Z1, Z2, plasma_data)
call readdata("profile.in", 2, profile_data)
Expand Down
2 changes: 1 addition & 1 deletion test/test_omega_prime.f90
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ subroutine main
type(freq_data_t) :: freq_data(NUM_SAMPLES)

call get_command_argument(1, runname)
call read_and_set_config(runname)
call read_and_set_config(trim(runname)//".in")
call setup
s0 = s
v0 = 0.9_dp * vth
Expand Down
2 changes: 1 addition & 1 deletion test/test_parallel.f90
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ subroutine run_test()
call set_log_level(-1)

print *, "Reading input files..."
call read_and_set_config("driftorbit")
call read_and_set_config("driftorbit.in")
call read_boozer_file("in_file")
call read_plasma_input("plasma.in", nplasma, am1, am2, Z1, Z2, plasma)
call prepare_plasma_splines(nplasma, am1, am2, Z1, Z2, plasma)
Expand Down
2 changes: 1 addition & 1 deletion test/test_torque.f90
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ program test_torque_prog

subroutine setup
runname = TEST_RUN
call read_and_set_config(runname)
call read_and_set_config(trim(runname)//".in")
call do_magfie_init("in_file")
call init_profiles(R0)
call read_and_init_plasma_input("plasma.in", s)
Expand Down