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 | 35 | module procedure init_ToroidalTransform | |
| 9 | 35 | this%major_radius = major_radius | |
| 10 | 35 | this%minor_radius = minor_radius | |
| 11 | this%is_orthogonal = .true. | ||
| 12 | this%has_polar_xy_singularity = .true. | ||
| 13 | 35 | 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 | 282393548 | module procedure toroidal_jacobian | |
| 40 | !$acc routine seq | ||
| 41 | 282393548 | ans = xp * (2 * pi * this%minor_radius)**2 * (this%major_radius + this%minor_radius * xp * sin(2 * pi * yp)) | |
| 42 | 282393548 | end procedure toroidal_jacobian | |
| 43 | |||
| 44 | 4480074 | module procedure toroidal_jacobian_matrix | |
| 45 | !$acc routine seq | ||
| 46 | 5973432 | select case (i) | |
| 47 | case (1) | ||
| 48 | 3484502 | select case (j) | |
| 49 | case (1) | ||
| 50 | 497786 | ans = this%minor_radius * sin(2 * pi * yp) * cos(2 * pi * zp) | |
| 51 | case (2) | ||
| 52 | 499322 | 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 497786 times.
✓ Branch 4 → 6 taken 499322 times.
✓ Branch 4 → 7 taken 496250 times.
|
1493358 | 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 | 3484502 | select case (j) | |
| 58 | case (1) | ||
| 59 | 497786 | ans = this%minor_radius * sin(2 * pi * yp) * sin(2 * pi * zp) | |
| 60 | case (2) | ||
| 61 | 499322 | 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 497786 times.
✓ Branch 8 → 10 taken 499322 times.
✓ Branch 8 → 11 taken 496250 times.
|
1493358 | 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 1493358 times.
✓ Branch 2 → 8 taken 1493358 times.
✓ Branch 2 → 12 taken 1493358 times.
|
4480074 | select case (j) |
| 67 | case (1) | ||
| 68 | 497786 | ans = this%minor_radius * cos(2 * pi * yp) | |
| 69 | case (2) | ||
| 70 | 499322 | 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 497786 times.
✓ Branch 12 → 14 taken 499322 times.
✓ Branch 12 → 15 taken 496250 times.
|
1493358 | ans = 0._wp |
| 73 | end select | ||
| 74 | end select | ||
| 75 | 4480074 | end procedure toroidal_jacobian_matrix | |
| 76 | |||
| 77 | 388636374 | module procedure toroidal_jacobian_matrix_inv | |
| 78 | !$acc routine seq | ||
| 79 | 519773032 | select case (i) | |
| 80 | case (1) | ||
| 81 | 314306730 | select case (j) | |
| 82 | case (1) | ||
| 83 | 52355206 | ans = sin(2 * pi * yp) * cos(2 * pi * zp) / this%minor_radius | |
| 84 | case (2) | ||
| 85 | 52355206 | 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 52355206 times.
✓ Branch 4 → 6 taken 52355206 times.
✓ Branch 4 → 7 taken 26426246 times.
|
131136658 | ans = cos(2 * pi * yp) / this%minor_radius |
| 88 | end select | ||
| 89 | case (2) | ||
| 90 | 309725898 | select case (j) | |
| 91 | case (1) | ||
| 92 | 52226182 | ans = cos(2 * pi * yp) * cos(2 * pi * zp) / (2 * pi * this%minor_radius * xp) | |
| 93 | case (2) | ||
| 94 | 52226182 | 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 52226182 times.
✓ Branch 8 → 10 taken 52226182 times.
✓ Branch 8 → 11 taken 26362502 times.
|
130814866 | 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 131136658 times.
✓ Branch 2 → 8 taken 130814866 times.
✓ Branch 2 → 12 taken 126684850 times.
|
388636374 | select case (j) |
| 100 | case (1) | ||
| 101 | 50574790 | ans = -sin(2 * pi * zp) / (2 * pi * (this%major_radius + this%minor_radius * xp * sin(2 * pi * yp))) | |
| 102 | case (2) | ||
| 103 | 50574790 | 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 50574790 times.
✓ Branch 12 → 14 taken 50574790 times.
✓ Branch 12 → 15 taken 25535270 times.
|
126684850 | ans = 0._wp |
| 106 | end select | ||
| 107 | end select | ||
| 108 | 388636374 | end procedure toroidal_jacobian_matrix_inv | |
| 109 | |||
| 110 | 227878360 | module procedure toroidal_G_matrix | |
| 111 | !$acc routine seq | ||
| 112 |
2/2✓ Branch 2 → 3 taken 227877160 times.
✓ Branch 2 → 7 taken 1200 times.
|
227878360 | if (i /= j) then |
| 113 | ans = 0._wp | ||
| 114 | return | ||
| 115 | end if | ||
| 116 | 76240174 | select case (i) | |
| 117 | case (1) | ||
| 118 | 76240174 | ans = this%minor_radius**2 | |
| 119 | case (2) | ||
| 120 | 76177574 | ans = (2 * pi * this%minor_radius * xp)**2 | |
| 121 | case (3) | ||
| 122 |
3/4✓ Branch 3 → 4 taken 76240174 times.
✓ Branch 3 → 5 taken 76177574 times.
✓ Branch 3 → 6 taken 75459412 times.
✗ Branch 3 → 7 not taken.
|
227877160 | 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 | 140414234 | module procedure toroidal_G_matrix_inv | |
| 127 | !$acc routine seq | ||
| 128 |
2/2✓ Branch 2 → 3 taken 140413634 times.
✓ Branch 2 → 4 taken 600 times.
|
140414234 | if (i /= j) then |
| 129 | ans = 0._wp | ||
| 130 | return | ||
| 131 | end if | ||
| 132 | 140413634 | ans = 1._wp / toroidal_G_matrix(this, i, i, xp, yp, zp) | |
| 133 | 140413634 | end procedure toroidal_G_matrix_inv | |
| 134 | |||
| 135 | end submodule s_coord_transform_toroidal | ||
| 136 |