coord_transform/s_coord_transform_toroidal.F90
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | !> @file s_coord_transform_toroidal.F90 | ||
| 2 | !> @brief Submodule implementing ToroidalTransform methods | ||
| 3 | submodule(m_coord_transform_toroidal) s_coord_transform_toroidal | ||
| 4 | implicit none | ||
| 5 | |||
| 6 | contains | ||
| 7 | |||
| 8 | 36 | module procedure init_ToroidalTransform | |
| 9 | 36 | this%major_radius = major_radius | |
| 10 | 36 | this%minor_radius = minor_radius | |
| 11 | this%is_orthogonal = .true. | ||
| 12 | this%has_polar_xy_singularity = .true. | ||
| 13 | 36 | end procedure init_ToroidalTransform | |
| 14 | |||
| 15 | 11902407 | module procedure toroidal_transform | |
| 16 | !$acc routine seq | ||
| 17 | 15869876 | select case (i) | |
| 18 | case (1) | ||
| 19 | 3967469 | ans = (this%major_radius + this%minor_radius * xp * sin(2 * pi * yp)) * cos(2 * pi * zp) | |
| 20 | case (2) | ||
| 21 | 3967469 | ans = (this%major_radius + this%minor_radius * xp * sin(2 * pi * yp)) * sin(2 * pi * zp) | |
| 22 | case (3) | ||
| 23 |
3/4✓ Branch 2 → 3 taken 3967469 times.
✓ Branch 2 → 4 taken 3967469 times.
✓ Branch 2 → 5 taken 3967469 times.
✗ Branch 2 → 6 not taken.
|
11902407 | ans = this%minor_radius * xp * cos(2 * pi * yp) |
| 24 | end select | ||
| 25 | 11902407 | end procedure toroidal_transform | |
| 26 | |||
| 27 | 300 | module procedure toroidal_inverse_transform | |
| 28 | !$acc routine seq | ||
| 29 | 400 | select case (i) | |
| 30 | case (1) | ||
| 31 | 100 | ans = sqrt((sqrt(x**2 + y**2) - this%major_radius)**2 + z**2) / this%minor_radius | |
| 32 | case (2) | ||
| 33 |
3/4✓ Branch 4 → 5 taken 100 times.
✗ Branch 4 → 10 not taken.
✓ Branch 5 → 6 taken 54 times.
✓ Branch 5 → 10 taken 46 times.
|
100 | ans = modulo(atan2(sqrt(x**2 + y**2) - this%major_radius, z) / (2 * pi), 1._wp) |
| 34 | case (3) | ||
| 35 |
6/8✓ Branch 2 → 3 taken 100 times.
✓ Branch 2 → 4 taken 100 times.
✓ Branch 2 → 7 taken 100 times.
✗ Branch 2 → 10 not taken.
✓ Branch 7 → 8 taken 100 times.
✗ Branch 7 → 10 not taken.
✓ Branch 8 → 9 taken 56 times.
✓ Branch 8 → 10 taken 44 times.
|
300 | ans = modulo(atan2(y, x) / (2 * pi), 1._wp) |
| 36 | end select | ||
| 37 | 300 | end procedure toroidal_inverse_transform | |
| 38 | |||
| 39 | 273038600 | module procedure toroidal_jacobian | |
| 40 | !$acc routine seq | ||
| 41 | 273038600 | ans = xp * (2 * pi * this%minor_radius)**2 * (this%major_radius + this%minor_radius * xp * sin(2 * pi * yp)) | |
| 42 | 273038600 | end procedure toroidal_jacobian | |
| 43 | |||
| 44 | 4498074 | module procedure toroidal_jacobian_matrix | |
| 45 | !$acc routine seq | ||
| 46 | 5997432 | select case (i) | |
| 47 | case (1) | ||
| 48 | 3498502 | select case (j) | |
| 49 | case (1) | ||
| 50 | 499786 | ans = this%minor_radius * sin(2 * pi * yp) * cos(2 * pi * zp) | |
| 51 | case (2) | ||
| 52 | 501322 | ans = 2 * pi * this%minor_radius * xp * cos(2 * pi * yp) * cos(2 * pi * zp) | |
| 53 | case (3) | ||
| 54 |
3/4✗ Branch 4 → 3 not taken.
✓ Branch 4 → 5 taken 499786 times.
✓ Branch 4 → 6 taken 501322 times.
✓ Branch 4 → 7 taken 498250 times.
|
1499358 | ans = -2 * pi * (this%major_radius + this%minor_radius * xp * sin(2 * pi * yp)) * sin(2 * pi * zp) |
| 55 | end select | ||
| 56 | case (2) | ||
| 57 | 3498502 | select case (j) | |
| 58 | case (1) | ||
| 59 | 499786 | ans = this%minor_radius * sin(2 * pi * yp) * sin(2 * pi * zp) | |
| 60 | case (2) | ||
| 61 | 501322 | ans = 2 * pi * this%minor_radius * xp * cos(2 * pi * yp) * sin(2 * pi * zp) | |
| 62 | case (3) | ||
| 63 |
3/4✗ Branch 8 → 3 not taken.
✓ Branch 8 → 9 taken 499786 times.
✓ Branch 8 → 10 taken 501322 times.
✓ Branch 8 → 11 taken 498250 times.
|
1499358 | ans = 2 * pi * (this%major_radius + this%minor_radius * xp * sin(2 * pi * yp)) * cos(2 * pi * zp) |
| 64 | end select | ||
| 65 | case (3) | ||
| 66 |
3/4✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 1499358 times.
✓ Branch 2 → 8 taken 1499358 times.
✓ Branch 2 → 12 taken 1499358 times.
|
4498074 | select case (j) |
| 67 | case (1) | ||
| 68 | 499786 | ans = this%minor_radius * cos(2 * pi * yp) | |
| 69 | case (2) | ||
| 70 | 501322 | ans = -2 * pi * this%minor_radius * xp * sin(2 * pi * yp) | |
| 71 | case (3) | ||
| 72 |
3/4✗ Branch 12 → 3 not taken.
✓ Branch 12 → 13 taken 499786 times.
✓ Branch 12 → 14 taken 501322 times.
✓ Branch 12 → 15 taken 498250 times.
|
1499358 | ans = 0._wp |
| 73 | end select | ||
| 74 | end select | ||
| 75 | 4498074 | end procedure toroidal_jacobian_matrix | |
| 76 | |||
| 77 | 388663374 | module procedure toroidal_jacobian_matrix_inv | |
| 78 | !$acc routine seq | ||
| 79 | 519809032 | select case (i) | |
| 80 | case (1) | ||
| 81 | 314327730 | select case (j) | |
| 82 | case (1) | ||
| 83 | 52358206 | ans = sin(2 * pi * yp) * cos(2 * pi * zp) / this%minor_radius | |
| 84 | case (2) | ||
| 85 | 52358206 | ans = sin(2 * pi * yp) * sin(2 * pi * zp) / this%minor_radius | |
| 86 | case (3) | ||
| 87 |
3/4✗ Branch 4 → 3 not taken.
✓ Branch 4 → 5 taken 52358206 times.
✓ Branch 4 → 6 taken 52358206 times.
✓ Branch 4 → 7 taken 26429246 times.
|
131145658 | ans = cos(2 * pi * yp) / this%minor_radius |
| 88 | end select | ||
| 89 | case (2) | ||
| 90 | 309746898 | select case (j) | |
| 91 | case (1) | ||
| 92 | 52229182 | ans = cos(2 * pi * yp) * cos(2 * pi * zp) / (2 * pi * this%minor_radius * xp) | |
| 93 | case (2) | ||
| 94 | 52229182 | ans = cos(2 * pi * yp) * sin(2 * pi * zp) / (2 * pi * this%minor_radius * xp) | |
| 95 | case (3) | ||
| 96 |
3/4✗ Branch 8 → 3 not taken.
✓ Branch 8 → 9 taken 52229182 times.
✓ Branch 8 → 10 taken 52229182 times.
✓ Branch 8 → 11 taken 26365502 times.
|
130823866 | ans = -sin(2 * pi * yp) / (2 * pi * this%minor_radius * xp) |
| 97 | end select | ||
| 98 | case (3) | ||
| 99 |
3/4✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 131145658 times.
✓ Branch 2 → 8 taken 130823866 times.
✓ Branch 2 → 12 taken 126693850 times.
|
388663374 | select case (j) |
| 100 | case (1) | ||
| 101 | 50577790 | ans = -sin(2 * pi * zp) / (2 * pi * (this%major_radius + this%minor_radius * xp * sin(2 * pi * yp))) | |
| 102 | case (2) | ||
| 103 | 50577790 | ans = cos(2 * pi * zp) / (2 * pi * (this%major_radius + this%minor_radius * xp * sin(2 * pi * yp))) | |
| 104 | case (3) | ||
| 105 |
3/4✗ Branch 12 → 3 not taken.
✓ Branch 12 → 13 taken 50577790 times.
✓ Branch 12 → 14 taken 50577790 times.
✓ Branch 12 → 15 taken 25538270 times.
|
126693850 | ans = 0._wp |
| 106 | end select | ||
| 107 | end select | ||
| 108 | 388663374 | end procedure toroidal_jacobian_matrix_inv | |
| 109 | |||
| 110 | 220065520 | module procedure toroidal_G_matrix | |
| 111 | !$acc routine seq | ||
| 112 |
2/2✓ Branch 2 → 3 taken 220064320 times.
✓ Branch 2 → 7 taken 1200 times.
|
220065520 | if (i /= j) then |
| 113 | ans = 0._wp | ||
| 114 | return | ||
| 115 | end if | ||
| 116 | 73606774 | select case (i) | |
| 117 | case (1) | ||
| 118 | 73606774 | ans = this%minor_radius**2 | |
| 119 | case (2) | ||
| 120 | 73517574 | ans = (2 * pi * this%minor_radius * xp)**2 | |
| 121 | case (3) | ||
| 122 |
3/4✓ Branch 3 → 4 taken 73606774 times.
✓ Branch 3 → 5 taken 73517574 times.
✓ Branch 3 → 6 taken 72939972 times.
✗ Branch 3 → 7 not taken.
|
220064320 | ans = (2 * pi * (this%major_radius + this%minor_radius * xp * sin(2 * pi * yp)))**2 |
| 123 | end select | ||
| 124 | end procedure toroidal_G_matrix | ||
| 125 | |||
| 126 | 132601394 | module procedure toroidal_G_matrix_inv | |
| 127 | !$acc routine seq | ||
| 128 |
2/2✓ Branch 2 → 3 taken 132600794 times.
✓ Branch 2 → 4 taken 600 times.
|
132601394 | if (i /= j) then |
| 129 | ans = 0._wp | ||
| 130 | return | ||
| 131 | end if | ||
| 132 | 132600794 | ans = 1._wp / toroidal_G_matrix(this, i, i, xp, yp, zp) | |
| 133 | 132600794 | end procedure toroidal_G_matrix_inv | |
| 134 | |||
| 135 | end submodule s_coord_transform_toroidal | ||
| 136 |