Skip to content

Commit c5edaee

Browse files
authored
Merge pull request #38 from cianciosa/island_phase
Add helphase test and fix bug that happened when running more than on…
2 parents 107b4d3 + 1766628 commit c5edaee

10 files changed

Lines changed: 567 additions & 2 deletions

File tree

.github/workflows/ci_test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
if: ${{matrix.os == 'macos-latest'}}
4848
shell: bash
4949
working-directory: ${{runner.workspace}}/Stellarator-Tools/build
50-
run: cmake -DCMAKE_BUILD_TYPE=${{matrix.mode}} -DCMAKE_Fortran_COMPILER=gfortran-14 -DBUILD_BOOZ_XFORM=ON -DBUILD_V3FIT=ON -DBUILD_V3RFUN=ON -DBUILD_SIESTA=ON -DBUILD_LGRID=ON -DBUILD_SURFACE=ON -DBUILD_BMW=ON -DBUILD_PARVMEC=ON -DBUILD_DESCUR=ON -DBUILD_TAG_BOOZ_XFORM=master_dev -DBUILD_TAG_V3FIT=${{github.ref_name}} -DBUILD_TAG_V3RFUN=master_dev -DBUILD_TAG_SIESTA=master_dev -DBUILD_TAG_LGRID=master_dev -DBUILD_TAG_SURFACE=master_dev -DBUILD_TAG_BMW=master_dev -DBUILD_TAG_LIBSTELL=master_dev -DBUILD_TAG_MAKEGRID=master_dev -DBUILD_TAG_PARVMEC=master_dev -DBUILD_TAG_DESCUR=master_dev -DUSE_FAST_COPY=ON -DUSE_PROFILER=ON ${{runner.workspace}}/Stellarator-Tools/
50+
run: cmake -DCMAKE_BUILD_TYPE=${{matrix.mode}} -DCMAKE_Fortran_COMPILER=gfortran-15 -DBUILD_BOOZ_XFORM=ON -DBUILD_V3FIT=ON -DBUILD_V3RFUN=ON -DBUILD_SIESTA=ON -DBUILD_LGRID=ON -DBUILD_SURFACE=ON -DBUILD_BMW=ON -DBUILD_PARVMEC=ON -DBUILD_DESCUR=ON -DBUILD_TAG_BOOZ_XFORM=master_dev -DBUILD_TAG_V3FIT=${{github.ref_name}} -DBUILD_TAG_V3RFUN=master_dev -DBUILD_TAG_SIESTA=master_dev -DBUILD_TAG_LGRID=master_dev -DBUILD_TAG_SURFACE=master_dev -DBUILD_TAG_BMW=master_dev -DBUILD_TAG_LIBSTELL=master_dev -DBUILD_TAG_MAKEGRID=master_dev -DBUILD_TAG_PARVMEC=master_dev -DBUILD_TAG_DESCUR=master_dev -DUSE_FAST_COPY=ON -DUSE_PROFILER=ON ${{runner.workspace}}/Stellarator-Tools/
5151
- name: Configure CMake Linux
5252
if: ${{matrix.os == 'ubuntu-latest'}}
5353
shell: bash

.github/workflows/ci_test_master.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
if: ${{matrix.os == 'macos-latest'}}
4848
shell: bash
4949
working-directory: ${{runner.workspace}}/Stellarator-Tools/build
50-
run: cmake -DCMAKE_BUILD_TYPE=${{matrix.mode}} -DCMAKE_Fortran_COMPILER=gfortran-14 -DBUILD_BOOZ_XFORM=ON -DBUILD_V3FIT=ON -DBUILD_V3RFUN=ON -DBUILD_SIESTA=ON -DBUILD_LGRID=ON -DBUILD_SURFACE=ON -DBUILD_BMW=ON -DBUILD_PARVMEC=ON -DBUILD_DESCUR=ON -DBUILD_TAG_V3FIT=${{github.ref_name}} -DUSE_FAST_COPY=ON -DUSE_PROFILER=ON ${{runner.workspace}}/Stellarator-Tools/
50+
run: cmake -DCMAKE_BUILD_TYPE=${{matrix.mode}} -DCMAKE_Fortran_COMPILER=gfortran-15 -DBUILD_BOOZ_XFORM=ON -DBUILD_V3FIT=ON -DBUILD_V3RFUN=ON -DBUILD_SIESTA=ON -DBUILD_LGRID=ON -DBUILD_SURFACE=ON -DBUILD_BMW=ON -DBUILD_PARVMEC=ON -DBUILD_DESCUR=ON -DBUILD_TAG_V3FIT=${{github.ref_name}} -DUSE_FAST_COPY=ON -DUSE_PROFILER=ON ${{runner.workspace}}/Stellarator-Tools/
5151
- name: Configure CMake Linux
5252
if: ${{matrix.os == 'ubuntu-latest'}}
5353
shell: bash

Sources/siesta_equilibrium.f

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,11 @@ FUNCTION siesta_construct(file_name, restart_file_name, &
318318
state_flags = IBSET(state_flags, model_state_siesta_flag)
319319
END IF
320320
321+
IF (recon_rank .gt. 0) THEN
322+
CALL siesta_construct%run_context%clear_state( &
323+
& siesta_run_write_profiles)
324+
END IF
325+
321326
CALL profiler_set_stop_time('siesta_construct', start_time)
322327
323328
1000 FORMAT('siesta_',a,'.nc')

Testing/tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ add_subdirectory (lasym_boundary)
1818
add_subdirectory (preconditioner_test)
1919
add_subdirectory (limiter_test)
2020
add_subdirectory (siesta_recon_test)
21+
add_subdirectory (siesta_recon_asym_test)
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Run the reconstruction task. This just tests if the reconstruction executes correctly.
2+
# Subsequent tests will examine the results of the reconstruction for correct
3+
# results.
4+
5+
# Copy input file from source to the build directory.
6+
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/thomson.dot
7+
${CMAKE_CURRENT_BINARY_DIR}/thomson.dot
8+
COPYONLY)
9+
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/input.test.vmec
10+
${CMAKE_CURRENT_BINARY_DIR}/input.test.vmec
11+
COPYONLY)
12+
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/siesta.jcf
13+
${CMAKE_CURRENT_BINARY_DIR}/siesta.jcf
14+
COPYONLY)
15+
SET (VMEC_FILE_NAME input.test.vmec)
16+
SET (SIESTA_FILE_NAME siesta.jcf)
17+
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/input.test.v3fit
18+
${CMAKE_CURRENT_BINARY_DIR}/input.test.v3fit)
19+
20+
add_test (NAME siesta_recon_asym_task_test
21+
COMMAND $<TARGET_PROPERTY:stell,MPIEXEC_EXECUTABLE> $<TARGET_PROPERTY:stell,MPIEXEC_NUMPROC_FLAG> $<TARGET_PROPERTY:stell,MPIEXEC_MAX_NUMPROCS> $<TARGET_PROPERTY:xv3fit,BINARY_DIR>/xv3fit input.test.v3fit -para=-1)
22+
set_tests_properties (siesta_recon_asym_task_test
23+
PROPERTIES
24+
PROCESSORS $<TARGET_PROPERTY:stell,MPIEXEC_MAX_NUMPROCS>)
25+
26+
# Since the reconstruction task test was run, Check the output files for correct values.
27+
28+
# Check that the reconstruction parameter reconstructed to the correct values.
29+
add_test (NAME siesta_recon_asym_task_test_helpert
30+
COMMAND ${Python3_EXECUTABLE} ${TEST_SCRIPT_DIR}/check_param_value.py --file=recout.input.test.v3fit --p_type=helpert --value=5.0E-4 --range=1.0E-4 --index1=1)
31+
set_tests_properties (siesta_recon_asym_task_test_helpert
32+
PROPERTIES
33+
DEPENDS siesta_recon_asym_task_test)
34+
35+
# Check that the reconstruction parameter reconstructed to the correct values.
36+
add_test (NAME siesta_recon_asym_task_test_helphase
37+
COMMAND ${Python3_EXECUTABLE} ${TEST_SCRIPT_DIR}/check_param_value.py --file=recout.input.test.v3fit --p_type=helphase --value=25.0 --range=2.0 --index1=1)
38+
set_tests_properties (siesta_recon_asym_task_test_helphase
39+
PROPERTIES
40+
DEPENDS siesta_recon_asym_task_test)
41+
42+
# Check that the signal effectiveness total.
43+
add_test (NAME siesta_recon_asym_task_test_sem_totals
44+
COMMAND ${Python3_EXECUTABLE} ${TEST_SCRIPT_DIR}/check_sem_total.py --file=recout.input.test.v3fit)
45+
set_tests_properties (siesta_recon_asym_task_test_sem_totals
46+
PROPERTIES
47+
DEPENDS siesta_recon_asym_task_test)
48+
49+
# Check correlation matrix values.
50+
add_test (NAME siesta_recon_asym_task_test_check_reconstruction_correlation_matrix
51+
COMMAND ${Python3_EXECUTABLE} ${TEST_SCRIPT_DIR}/check_correlation_matrix.py --file=recout.input.test.v3fit --param=Reconstruction)
52+
set_tests_properties (siesta_recon_asym_task_test_check_reconstruction_correlation_matrix
53+
PROPERTIES
54+
DEPENDS siesta_recon_asym_task_test)
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
&v3fit_main_nli
2+
my_task = 'reconstruct',
3+
vmec_nli_filename = '${VMEC_FILE_NAME}'
4+
siesta_nli_filename = '${SIESTA_FILE_NAME}'
5+
6+
model_eq_type = 'siesta'
7+
8+
thscte_dot_filename = 'thomson.dot',
9+
10+
model_te_type = 'pp_te'
11+
pp_te_ptype = 'two_power_r'
12+
pp_te_b = 0.0, 5.0, 1.0, 0.5,
13+
14+
nrstep = 20,
15+
dg2_stop = 0.1,
16+
cut_svd = 2.0E-5,
17+
cut_eff = 1.0E-8,
18+
cut_marg_eff = 0.0,
19+
cut_delta_a = 0.0,
20+
cut_dg2 = 0.0,
21+
astep_max = 100.0,
22+
step_type = 'lm',
23+
24+
n_rp = 2,
25+
26+
rp_type(1) = 'helpert',
27+
rp_vrnc(1) = 1.0E-5,
28+
rp_index(1) = 1,
29+
rp_range_type(1,1) = 'value',
30+
rp_range_value(1,1) = 0,
31+
32+
rp_type(2) = 'helphase',
33+
rp_vrnc(2) = 1.0,
34+
rp_index(2) = 1,
35+
rp_range_type(2,1) = 'value',
36+
rp_range_value(2,1) = 0,
37+
rp_range_type(2,2) = 'value',
38+
rp_range_value(2,2) = 360.0,
39+
40+
sdo_data_a(1) = 0.00000E+00
41+
sdo_data_a(2) = 1.18088E+00
42+
sdo_data_a(3) = 2.55109E+00
43+
sdo_data_a(4) = 3.55848E+00
44+
sdo_data_a(5) = 4.00024E+00
45+
sdo_data_a(6) = 4.25356E+00
46+
sdo_data_a(7) = 4.45003E+00
47+
sdo_data_a(8) = 4.60264E+00
48+
sdo_data_a(9) = 4.71822E+00
49+
sdo_data_a(10) = 4.80434E+00
50+
sdo_data_a(11) = 4.86823E+00
51+
sdo_data_a(12) = 0.00000E+00
52+
sdo_data_a(13) = 1.17942E+00
53+
sdo_data_a(14) = 2.56126E+00
54+
sdo_data_a(15) = 3.62447E+00
55+
sdo_data_a(16) = 4.06574E+00
56+
sdo_data_a(17) = 4.30416E+00
57+
sdo_data_a(18) = 4.48670E+00
58+
sdo_data_a(19) = 4.62837E+00
59+
sdo_data_a(20) = 4.73565E+00
60+
sdo_data_a(21) = 4.81571E+00
61+
sdo_data_a(22) = 4.87539E+00
62+
sdo_data_a(23) = 0.00000E+00
63+
sdo_data_a(24) = 1.18253E+00
64+
sdo_data_a(25) = 2.53952E+00
65+
sdo_data_a(26) = 3.48220E+00
66+
sdo_data_a(27) = 3.92470E+00
67+
sdo_data_a(28) = 4.19548E+00
68+
sdo_data_a(29) = 4.40811E+00
69+
sdo_data_a(30) = 4.57332E+00
70+
sdo_data_a(31) = 4.69840E+00
71+
sdo_data_a(32) = 4.79142E+00
72+
sdo_data_a(33) = 4.86010E+00
73+
sdo_data_a(34) = 0.00000E+00
74+
sdo_data_a(35) = 1.18935E+00
75+
sdo_data_a(36) = 2.49102E+00
76+
sdo_data_a(37) = 3.14651E+00
77+
sdo_data_a(38) = 3.59486E+00
78+
sdo_data_a(39) = 3.94576E+00
79+
sdo_data_a(40) = 4.23001E+00
80+
sdo_data_a(41) = 4.44977E+00
81+
sdo_data_a(42) = 4.61535E+00
82+
sdo_data_a(43) = 4.73752E+00
83+
sdo_data_a(44) = 4.82630E+00
84+
sdo_data_a(45) = 0.00000E+00
85+
sdo_data_a(46) = 1.19800E+00
86+
sdo_data_a(47) = 2.42763E+00
87+
sdo_data_a(48) = 2.65658E+00
88+
sdo_data_a(49) = 3.12315E+00
89+
sdo_data_a(50) = 3.60158E+00
90+
sdo_data_a(51) = 3.99090E+00
91+
sdo_data_a(52) = 4.28673E+00
92+
sdo_data_a(53) = 4.50702E+00
93+
sdo_data_a(54) = 4.66775E+00
94+
sdo_data_a(55) = 4.78276E+00
95+
sdo_data_a(56) = 0.00000E+00
96+
sdo_data_a(57) = 1.20615E+00
97+
sdo_data_a(58) = 2.36588E+00
98+
sdo_data_a(59) = 2.08763E+00
99+
sdo_data_a(60) = 2.59720E+00
100+
sdo_data_a(61) = 3.24119E+00
101+
sdo_data_a(62) = 3.74981E+00
102+
sdo_data_a(63) = 4.12599E+00
103+
sdo_data_a(64) = 4.40170E+00
104+
sdo_data_a(65) = 4.60053E+00
105+
sdo_data_a(66) = 4.74105E+00
106+
sdo_data_a(67) = 0.00000E+00
107+
sdo_data_a(68) = 1.21165E+00
108+
sdo_data_a(69) = 2.32303E+00
109+
sdo_data_a(70) = 1.58940E+00
110+
sdo_data_a(71) = 2.16874E+00
111+
sdo_data_a(72) = 2.97178E+00
112+
sdo_data_a(73) = 3.57694E+00
113+
sdo_data_a(74) = 4.01323E+00
114+
sdo_data_a(75) = 4.32876E+00
115+
sdo_data_a(76) = 4.55434E+00
116+
sdo_data_a(77) = 4.71254E+00
117+
118+
sdo_s_spec_imin(1) = 1,
119+
sdo_s_spec_imax(1) = 77,
120+
sdo_s_spec_floor(1) = 0.001,
121+
sdo_s_spec_fraction(1) = 0.01,
122+
123+
n_sdata_o = 77,
124+
125+
&END
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
&INDATA
2+
3+
! VMEC execution parameters.
4+
LFORBAL = F,
5+
LFREEB = F,
6+
DELT = 1.0,
7+
TCON0 = 2.0,
8+
NFP = 2,
9+
NS_ARRAY = 100,
10+
FTOL_ARRAY = 1.0E-20,
11+
NITER = 25000,
12+
NSTEP = 200,
13+
NTOR = 0,
14+
MPOL = 2,
15+
NVACSKIP = 9,
16+
LASYM = F,
17+
LNYQUIST = T,
18+
19+
! Fitting parameters.
20+
GAMMA = 0.0,
21+
PHIEDGE = -0.05,
22+
BLOAT = 1.0,
23+
24+
! Initial Position.
25+
RAXIS(0) = 0.75,
26+
ZAXIS(0) = 0.0,
27+
RBC(0,0) = 0.70,
28+
RBC(0,1) = 0.2,
29+
ZBS(0,0) = 0.0,
30+
ZBS(0,1) = 0.2,
31+
32+
! Plasma current parameters.
33+
NCURR = 1,
34+
CURTOR = 40000.0,
35+
AC = 1.0, 5.0, 10.0
36+
PCURR_TYPE = 'two_power',
37+
38+
! Plasma pressure parameters.
39+
SPRES_PED = 1.0,
40+
PRES_SCALE = 400.0,
41+
am = 1.0, 2.0, 2.0
42+
pmass_type = 'two_power',
43+
/
44+
&END
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
&SIESTA_INFO
2+
LADD_PERT=T,
3+
LRESISTIVE=F,
4+
LRESTART=F,
5+
LCOLSCALE=T,
6+
LASYM=T,
7+
LRECON=T,
8+
NITER=1000
9+
FTOL= 1.0E-20
10+
LEVMARQ_PARAM= 0.1
11+
MRES = 2
12+
HELPERT = 1.0E-4
13+
HELPHASE = 0.0
14+
NSIN = 100
15+
NTOR_TYPE = "sparse"
16+
MPOLIN = 2
17+
NTORIN = 1
18+
NFPIN = 1
19+
NTOR_MODES(0) = 0,
20+
NTOR_MODES(-1) = -1
21+
NTOR_MODES(1) = 1
22+
WOUT_FILE="wout_test.vmec.nc"
23+
RESTART_EXT="restart_w7x"
24+
/

0 commit comments

Comments
 (0)