| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | ✗ | program diag_meiss_main | |
| 2 | !> Diagnostic application for field_can_meiss analysis | ||
| 3 | !> | ||
| 4 | !> Reads configuration from simple.in (default) or specified file, | ||
| 5 | !> initializes the field, and generates diagnostic plots for canonical coordinates | ||
| 6 | |||
| 7 | ✗ | use params, only: read_config, netcdffile, ns_s, ns_tp, multharm, integmode, params_init, isw_field_type | |
| 8 | use simple, only: tracer_t, init_vmec | ||
| 9 | use timing, only: init_timer, print_phase_time | ||
| 10 | use diag_meiss, only: plot_rh_can_vs_rc | ||
| 11 | use field_can_mod, only: field_can_from_id | ||
| 12 | use field, only: vmec_field_t, create_vmec_field | ||
| 13 | use field_can_meiss, only: init_transformation_arrays | ||
| 14 | |||
| 15 | implicit none | ||
| 16 | |||
| 17 | character(256) :: config_file | ||
| 18 | type(tracer_t) :: norb | ||
| 19 | ✗ | type(vmec_field_t) :: vmec_field | |
| 20 | |||
| 21 | ! Initialize timing | ||
| 22 | ✗ | call init_timer() | |
| 23 | |||
| 24 | ! Read configuration file name from command line arguments | ||
| 25 | ✗ | if (command_argument_count() == 0) then | |
| 26 | ✗ | config_file = 'simple.in' | |
| 27 | else | ||
| 28 | ✗ | call get_command_argument(1, config_file) | |
| 29 | end if | ||
| 30 | ✗ | call print_phase_time('Command line parsing completed') | |
| 31 | |||
| 32 | ! Initialize the system following simple.x pattern BUT stop before init_field_can | ||
| 33 | ✗ | call read_config(config_file) | |
| 34 | ✗ | call print_phase_time('Configuration reading completed') | |
| 35 | |||
| 36 | ! Call init_vmec directly (like init_field does) but skip init_field_can | ||
| 37 | ✗ | call init_vmec(netcdffile, ns_s, ns_tp, multharm, norb%fper) | |
| 38 | ✗ | call print_phase_time('VMEC initialization completed') | |
| 39 | |||
| 40 | ✗ | norb%integmode = integmode | |
| 41 | ✗ | call print_phase_time('Integration mode set') | |
| 42 | |||
| 43 | ! Initialize field_can system up to the point before expensive computation | ||
| 44 | ✗ | if (norb%integmode >= 0) then | |
| 45 | ✗ | call create_vmec_field(vmec_field) | |
| 46 | ✗ | call field_can_from_id(isw_field_type, vmec_field) | |
| 47 | ✗ | call print_phase_time('Field canonical setup completed') | |
| 48 | |||
| 49 | ! Initialize only the transformation arrays (without expensive computation) | ||
| 50 | ✗ | call init_transformation_arrays() | |
| 51 | ✗ | call print_phase_time('Transformation arrays initialized') | |
| 52 | end if | ||
| 53 | |||
| 54 | ✗ | call params_init | |
| 55 | ✗ | call print_phase_time('Parameter initialization completed') | |
| 56 | |||
| 57 | ✗ | print *, "Generating diagnostic plots..." | |
| 58 | |||
| 59 | ! Generate plots for different grid indices | ||
| 60 | ✗ | print *, "Creating plot for i_th=1, i_phi=1..." | |
| 61 | ✗ | call plot_rh_can_vs_rc(1, 1, "diag_meiss_1_1.pdf") | |
| 62 | |||
| 63 | ✗ | print *, "Creating plot for i_th=2, i_phi=2..." | |
| 64 | ✗ | call plot_rh_can_vs_rc(1, 2, "diag_meiss_1_2.pdf") | |
| 65 | |||
| 66 | ✗ | print *, "Creating plot for i_th=2, i_phi=2..." | |
| 67 | ✗ | call plot_rh_can_vs_rc(2, 1, "diag_meiss_2_1.pdf") | |
| 68 | |||
| 69 | ✗ | print *, "Creating plot for i_th=2, i_phi=2..." | |
| 70 | ✗ | call plot_rh_can_vs_rc(2, 2, "diag_meiss_2_2.pdf") | |
| 71 | |||
| 72 | ✗ | print *, "Diagnostic plots completed successfully!" | |
| 73 | ✗ | print *, "Generated files: diag_meiss.pdf, diag_meiss_1_1.pdf, diag_meiss_2_2.pdf" | |
| 74 | |||
| 75 | ✗ | call print_phase_time('Diagnostic analysis completed') | |
| 76 | |||
| 77 | ✗ | end program diag_meiss_main | |
| 78 |