| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | ✗ | program diag_albert_main | |
| 2 | !> Diagnostic application for Albert canonical coordinate analysis | ||
| 3 | !> | ||
| 4 | !> Reads configuration from simple.in (default) or specified file, | ||
| 5 | !> validates that coordinates are set to Albert, initializes the field, | ||
| 6 | !> and generates contour plots of Aph_of_xc and Bmod_of_xc | ||
| 7 | |||
| 8 | use params, only: read_config, netcdffile, ns_s, ns_tp, multharm, & | ||
| 9 | ✗ | integmode, params_init, isw_field_type | |
| 10 | use simple, only: tracer_t | ||
| 11 | use simple_main, only: init_field | ||
| 12 | use timing, only: init_timer, print_phase_time | ||
| 13 | use diag_albert, only: plot_albert_contours | ||
| 14 | |||
| 15 | implicit none | ||
| 16 | |||
| 17 | character(256) :: config_file | ||
| 18 | type(tracer_t) :: norb | ||
| 19 | integer, parameter :: ALBERT_FIELD_TYPE = 4 | ||
| 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 | ||
| 33 | ✗ | call read_config(config_file) | |
| 34 | ✗ | call print_phase_time('Configuration reading completed') | |
| 35 | |||
| 36 | ! Validate that coordinates are set to Albert | ||
| 37 | ✗ | if (isw_field_type /= ALBERT_FIELD_TYPE) then | |
| 38 | ✗ | write(*, '(A)') 'ERROR: Albert coordinate diagnostic requires Albert coordinates!' | |
| 39 | ✗ | write(*, '(A,I0)') 'Current isw_field_type = ', isw_field_type | |
| 40 | ✗ | write(*, '(A)') 'Please set isw_field_type = 4 in simple.in for Albert coordinates' | |
| 41 | ✗ | write(*, '(A)') 'Field type mapping:' | |
| 42 | ✗ | write(*, '(A)') ' -1: Testing' | |
| 43 | ✗ | write(*, '(A)') ' 0: Canonical (flux)' | |
| 44 | ✗ | write(*, '(A)') ' 1: VMEC' | |
| 45 | ✗ | write(*, '(A)') ' 2: Boozer' | |
| 46 | ✗ | write(*, '(A)') ' 3: Meiss' | |
| 47 | ✗ | write(*, '(A)') ' 4: Albert' | |
| 48 | ✗ | error stop 'Incorrect coordinate system for Albert diagnostic' | |
| 49 | end if | ||
| 50 | ✗ | call print_phase_time('Albert coordinate validation completed') | |
| 51 | |||
| 52 | ! Use the complete field initialization from simple_main | ||
| 53 | ! This properly handles both netcdffile and field_input parameters | ||
| 54 | ✗ | call init_field(norb, netcdffile, ns_s, ns_tp, multharm, integmode) | |
| 55 | ✗ | call print_phase_time('Complete field initialization completed') | |
| 56 | |||
| 57 | ✗ | call params_init | |
| 58 | ✗ | call print_phase_time('Parameter initialization completed') | |
| 59 | |||
| 60 | ✗ | print *, "Generating Albert coordinate diagnostic plots..." | |
| 61 | ✗ | print *, "This will create line plots of Aph_of_xc and Bmod_of_xc" | |
| 62 | ✗ | print *, "vs theta and phi at three radial slices (inner, middle, outer)..." | |
| 63 | |||
| 64 | ! Generate Albert coordinate diagnostic plots | ||
| 65 | ✗ | call plot_albert_contours() | |
| 66 | |||
| 67 | ✗ | call print_phase_time('Albert diagnostic analysis completed') | |
| 68 | |||
| 69 | ✗ | end program diag_albert_main | |
| 70 |