coord_transform/m_coord_transform_box.f90
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | !> @brief Module for the box coordinate transformation | ||
| 2 | module m_coord_transform_box | ||
| 3 | use m_common, only: wp | ||
| 4 | use m_coord_transform_abstract, only: CoordTransformAbstract | ||
| 5 | |||
| 6 | implicit none | ||
| 7 | |||
| 8 | private | ||
| 9 | public :: BoxTransform | ||
| 10 | public :: box_transform, box_inverse_transform, box_jacobian | ||
| 11 | public :: box_jacobian_matrix, box_jacobian_matrix_inv, box_G_matrix, box_G_matrix_inv | ||
| 12 | |||
| 13 | !> @brief Box coordinates given by | ||
| 14 | !> \f{eqnarray*}{ | ||
| 15 | !> x &= L_x xp\\ | ||
| 16 | !> y &= L_y yp\\ | ||
| 17 | !> z &= L_z zp | ||
| 18 | !> \f} | ||
| 19 | type, extends(CoordTransformAbstract) :: BoxTransform | ||
| 20 | !> @brief Physical box length in x direction | ||
| 21 | real(wp) :: length_x | ||
| 22 | |||
| 23 | !> @brief Physical box length in y direction | ||
| 24 | real(wp) :: length_y | ||
| 25 | |||
| 26 | !> @brief Physical box length in z direction | ||
| 27 | real(wp) :: length_z | ||
| 28 | end type BoxTransform | ||
| 29 | |||
| 30 | interface BoxTransform | ||
| 31 | module procedure init_BoxTransform | ||
| 32 | end interface BoxTransform | ||
| 33 | |||
| 34 | interface | ||
| 35 | !> @brief Create a new BoxTransform object | ||
| 36 | !> @param[in] length_x Physical box length in x direction | ||
| 37 | !> @param[in] length_y Physical box length in y direction | ||
| 38 | !> @param[in] length_z Physical box length in z direction | ||
| 39 | !> @return A new BoxTransform object | ||
| 40 | module function init_BoxTransform(length_x, length_y, length_z) result(this) | ||
| 41 | real(wp), intent(in) :: length_x, length_y, length_z | ||
| 42 | type(BoxTransform) :: this | ||
| 43 | end function init_BoxTransform | ||
| 44 | |||
| 45 | !> @brief The i-th component of the box transformation | ||
| 46 | !> @param[in] this The BoxTransform object | ||
| 47 | !> @param[in] i The index of the component | ||
| 48 | !> @param[in] xp The logical x coordinate | ||
| 49 | !> @param[in] yp The logical y coordinate | ||
| 50 | !> @param[in] zp The logical z coordinate | ||
| 51 | !> @return The i-th component of the transformation | ||
| 52 | module pure real(wp) function box_transform(this, i, xp, yp, zp) result(ans) | ||
| 53 | !$acc routine seq | ||
| 54 | type(BoxTransform), intent(in) :: this | ||
| 55 | integer, intent(in) :: i | ||
| 56 | real(wp), intent(in) :: xp, yp, zp | ||
| 57 | end function box_transform | ||
| 58 | |||
| 59 | !> @brief The i-th component of the inverse box transformation | ||
| 60 | !> @param[in] this The BoxTransform object | ||
| 61 | !> @param[in] i The index of the component | ||
| 62 | !> @param[in] x The x coordinate | ||
| 63 | !> @param[in] y The y coordinate | ||
| 64 | !> @param[in] z The z coordinate | ||
| 65 | !> @return The i-th logical coordinate | ||
| 66 | module pure real(wp) function box_inverse_transform(this, i, x, y, z) result(ans) | ||
| 67 | !$acc routine seq | ||
| 68 | type(BoxTransform), intent(in) :: this | ||
| 69 | integer, intent(in) :: i | ||
| 70 | real(wp), intent(in) :: x, y, z | ||
| 71 | end function box_inverse_transform | ||
| 72 | |||
| 73 | !> @brief The Jacobian determinant of the box transformation | ||
| 74 | !> @param[in] this The BoxTransform object | ||
| 75 | !> @param[in] xp The logical x coordinate | ||
| 76 | !> @param[in] yp The logical y coordinate | ||
| 77 | !> @param[in] zp The logical z coordinate | ||
| 78 | !> @return The Jacobian determinant | ||
| 79 | module pure real(wp) function box_jacobian(this, xp, yp, zp) result(ans) | ||
| 80 | !$acc routine seq | ||
| 81 | type(BoxTransform), intent(in) :: this | ||
| 82 | real(wp), intent(in) :: xp, yp, zp | ||
| 83 | end function box_jacobian | ||
| 84 | |||
| 85 | !> @brief The (i, j)-th component of the Jacobian matrix of the box transformation | ||
| 86 | !> @param[in] this The BoxTransform object | ||
| 87 | !> @param[in] i The row index | ||
| 88 | !> @param[in] j The column index | ||
| 89 | !> @param[in] xp The logical x coordinate | ||
| 90 | !> @param[in] yp The logical y coordinate | ||
| 91 | !> @param[in] zp The logical z coordinate | ||
| 92 | !> @return The (i, j)-th component of the Jacobian matrix | ||
| 93 | module pure real(wp) function box_jacobian_matrix(this, i, j, xp, yp, zp) result(ans) | ||
| 94 | !$acc routine seq | ||
| 95 | type(BoxTransform), intent(in) :: this | ||
| 96 | integer, intent(in) :: i, j | ||
| 97 | real(wp), intent(in) :: xp, yp, zp | ||
| 98 | end function box_jacobian_matrix | ||
| 99 | |||
| 100 | !> @brief The (i, j)-th component of the inverse Jacobian matrix of the box transformation | ||
| 101 | !> @param[in] this The BoxTransform object | ||
| 102 | !> @param[in] i The row index | ||
| 103 | !> @param[in] j The column index | ||
| 104 | !> @param[in] xp The logical x coordinate | ||
| 105 | !> @param[in] yp The logical y coordinate | ||
| 106 | !> @param[in] zp The logical z coordinate | ||
| 107 | !> @return The (i, j)-th component of the inverse Jacobian matrix | ||
| 108 | module pure real(wp) function box_jacobian_matrix_inv(this, i, j, xp, yp, zp) result(ans) | ||
| 109 | !$acc routine seq | ||
| 110 | type(BoxTransform), intent(in) :: this | ||
| 111 | integer, intent(in) :: i, j | ||
| 112 | real(wp), intent(in) :: xp, yp, zp | ||
| 113 | end function box_jacobian_matrix_inv | ||
| 114 | |||
| 115 | !> @brief The (i, j)-th component of the metric tensor of the box transformation | ||
| 116 | !> @param[in] this The BoxTransform object | ||
| 117 | !> @param[in] i The row index | ||
| 118 | !> @param[in] j The column index | ||
| 119 | !> @param[in] xp The logical x coordinate | ||
| 120 | !> @param[in] yp The logical y coordinate | ||
| 121 | !> @param[in] zp The logical z coordinate | ||
| 122 | !> @return The (i, j)-th component of the metric tensor | ||
| 123 | module pure real(wp) function box_G_matrix(this, i, j, xp, yp, zp) result(ans) | ||
| 124 | !$acc routine seq | ||
| 125 | type(BoxTransform), intent(in) :: this | ||
| 126 | integer, intent(in) :: i, j | ||
| 127 | real(wp), intent(in) :: xp, yp, zp | ||
| 128 | end function box_G_matrix | ||
| 129 | |||
| 130 | !> @brief The (i, j)-th component of the inverse metric tensor of the box transformation | ||
| 131 | !> @param[in] this The BoxTransform object | ||
| 132 | !> @param[in] i The row index | ||
| 133 | !> @param[in] j The column index | ||
| 134 | !> @param[in] xp The logical x coordinate | ||
| 135 | !> @param[in] yp The logical y coordinate | ||
| 136 | !> @param[in] zp The logical z coordinate | ||
| 137 | !> @return The (i, j)-th component of the inverse metric tensor | ||
| 138 | module pure real(wp) function box_G_matrix_inv(this, i, j, xp, yp, zp) result(ans) | ||
| 139 | !$acc routine seq | ||
| 140 | type(BoxTransform), intent(in) :: this | ||
| 141 | integer, intent(in) :: i, j | ||
| 142 | real(wp), intent(in) :: xp, yp, zp | ||
| 143 | end function box_G_matrix_inv | ||
| 144 | |||
| 145 | end interface | ||
| 146 | |||
| 147 | ✗ | end module m_coord_transform_box | |
| 148 |