FE-Project
Loading...
Searching...
No Matches
scale_geographic_coord_cnv Module Reference

Module common / Coordinate conversion with a geographic coordinate. More...

Functions/Subroutines

subroutine, public geographiccoordcnv_orth_to_geo_pos (orth_p, np, geo_p)
subroutine, public geographiccoordcnv_geo_to_orth_pos (geo_p, np, orth_p)
subroutine, public geographiccoordcnv_orth_to_geo_vec (orth_v, geo_p, np, geo_v)
subroutine, public geographiccoordcnv_geo_to_orth_vec (geo_v, geo_p, np, orth_v)
subroutine, public geographiccoordcnv_rotatex (pos_vec, angle, rotated_pos_vec)
subroutine, public geographiccoordcnv_rotatey (pos_vec, angle, rotated_pos_vec)
subroutine, public geographiccoordcnv_rotatez (pos_vec, angle, rotated_pos_vec)

Detailed Description

Module common / Coordinate conversion with a geographic coordinate.

Description
A module to provide coordinate conversions with a geographic coordinate
Author
Yuta Kawai, Team SCALE

Function/Subroutine Documentation

◆ geographiccoordcnv_orth_to_geo_pos()

subroutine, public scale_geographic_coord_cnv::geographiccoordcnv_orth_to_geo_pos ( real(rp), dimension(np,3), intent(in) orth_p,
integer, intent(in) np,
real(rp), dimension(np,3), intent(out) geo_p )

Definition at line 42 of file scale_geographic_coord_cnv.F90.

44
45 implicit none
46 integer, intent(in) :: Np
47 real(RP), intent(in) :: orth_p(Np,3)
48 real(RP), intent(out) :: geo_p(Np,3)
49
50 integer :: p
51 !---------------------------------------------------------
52
53 !$omp parallel private(p)
54 !$acc parallel present(orth_p, geo_p)
55
56 !$omp do
57 !$acc loop
58 do p=1, np
59 geo_p(p,3) = sqrt( orth_p(p,1)**2 + orth_p(p,2)**2 + orth_p(p,3)**2 )
60 geo_p(p,2) = asin( orth_p(p,3) / geo_p(p,3) )
61 geo_p(p,1) = atan( orth_p(p,2) / orth_p(p,1) )
62 end do
63
64 !$omp do
65 !$acc loop
66 do p=1, np
67 if ( geo_p(p,1) <= 0.0_rp .and. orth_p(p,1) < 0.0_rp ) then
68 geo_p(p,1) = geo_p(p,1) + pi
69 else if ( geo_p(p,1) >= 0.0_rp .and. orth_p(p,1) < 0.0_rp ) then
70 geo_p(p,1) = geo_p(p,1) - pi
71 end if
72 if ( orth_p(p,1) == 0.0_rp .and. orth_p(p,2) == 0.0_rp ) then
73 geo_p(p,1) = 0.0_rp
74 else if ( orth_p(p,1) == 0.0_rp ) then
75 geo_p(p,1) = sign(1.0_rp, orth_p(p,2)) * 0.5_rp * pi
76 end if
77 end do
78
79 !$acc end parallel
80 !$omp end parallel
81
82
83 return

Referenced by scale_cubedsphere_coord_cnv::cubedspherecoordcnv_cs2lonlatpos().

◆ geographiccoordcnv_geo_to_orth_pos()

subroutine, public scale_geographic_coord_cnv::geographiccoordcnv_geo_to_orth_pos ( real(rp), dimension(np,3), intent(in) geo_p,
integer, intent(in) np,
real(rp), dimension(np,3), intent(out) orth_p )

Definition at line 87 of file scale_geographic_coord_cnv.F90.

89
90 implicit none
91 integer, intent(in) :: Np
92 real(RP), intent(in) :: geo_p(Np,3)
93 real(RP), intent(out) :: orth_p(Np,3)
94
95 integer :: p
96 !---------------------------------------------------------
97
98 !$omp parallel do private(p)
99 do p=1, np
100 orth_p(p,1) = geo_p(p,3) * cos(geo_p(p,2)) * cos(geo_p(p,1))
101 orth_p(p,2) = geo_p(p,3) * cos(geo_p(p,2)) * sin(geo_p(p,1))
102 orth_p(p,3) = geo_p(p,3) * sin(geo_p(p,2))
103 end do
104
105 return

◆ geographiccoordcnv_orth_to_geo_vec()

subroutine, public scale_geographic_coord_cnv::geographiccoordcnv_orth_to_geo_vec ( real(rp), dimension(np,3), intent(in) orth_v,
real(rp), dimension(np,3), intent(in) geo_p,
integer, intent(in) np,
real(rp), dimension(np,3), intent(out) geo_v )

Definition at line 109 of file scale_geographic_coord_cnv.F90.

111 implicit none
112
113 integer, intent(in) :: Np
114 real(RP), intent(in) :: orth_v(Np,3)
115 real(RP), intent(in) :: geo_p(Np,3)
116 real(RP), intent(out) :: geo_v(Np,3)
117
118 integer :: p
119 real(RP) :: sin_geo_p1
120 real(RP) :: cos_geo_p1
121 real(RP) :: sin_geo_p2
122 real(RP) :: cos_geo_p2
123 !---------------------------------------------------------
124
125 !$omp parallel do private(p, cos_geo_p2)
126 do p=1, np
127 sin_geo_p1 = sin(geo_p(p,1))
128 cos_geo_p1 = cos(geo_p(p,1))
129 sin_geo_p2 = sin(geo_p(p,2))
130 cos_geo_p2 = cos(geo_p(p,2))
131
132 geo_v(p,3) = orth_v(p,1) * cos_geo_p2 * cos_geo_p1 &
133 + orth_v(p,2) * cos_geo_p2 * sin_geo_p1 &
134 + orth_v(p,3) * sin_geo_p2
135
136 geo_v(p,2) = - orth_v(p,1) * sin_geo_p2 * cos_geo_p1 &
137 - orth_v(p,2) * sin_geo_p2 * sin_geo_p1 &
138 + orth_v(p,3) * cos_geo_p2
139
140 geo_v(p,1) = - orth_v(p,1) * sin_geo_p1 &
141 + orth_v(p,2) * cos_geo_p1
142 end do
143
144 return

◆ geographiccoordcnv_geo_to_orth_vec()

subroutine, public scale_geographic_coord_cnv::geographiccoordcnv_geo_to_orth_vec ( real(rp), dimension(np,3), intent(in) geo_v,
real(rp), dimension(np,3), intent(in) geo_p,
integer, intent(in) np,
real(rp), dimension(np,3), intent(out) orth_v )

Definition at line 148 of file scale_geographic_coord_cnv.F90.

150 implicit none
151
152 integer, intent(in) :: Np
153 real(RP), intent(in) :: geo_v(Np,3)
154 real(RP), intent(in) :: geo_p(Np,3)
155 real(RP), intent(out) :: orth_v(Np,3)
156
157 integer :: p
158 real(RP) :: sin_geo_p1
159 real(RP) :: cos_geo_p1
160 real(RP) :: sin_geo_p2
161 real(RP) :: cos_geo_p2
162 !---------------------------------------------------------
163
164 !$omp parallel do private(p, sin_geo_p1, cos_geo_p1, sin_geo_p2, cos_geo_p2)
165 do p=1, np
166 sin_geo_p1 = sin(geo_p(p,1))
167 cos_geo_p1 = cos(geo_p(p,1))
168 sin_geo_p2 = sin(geo_p(p,2))
169 cos_geo_p2 = cos(geo_p(p,2))
170
171 orth_v(p,1) = geo_v(p,3) * cos_geo_p1 * cos_geo_p2 &
172 - geo_v(p,2) * cos_geo_p1 * sin_geo_p2 &
173 - geo_v(p,1) * sin_geo_p1
174
175 orth_v(p,2) = geo_v(p,3) * sin_geo_p1 * cos_geo_p2 &
176 - geo_v(p,2) * sin_geo_p1 * sin_geo_p2 &
177 + geo_v(p,1) * cos_geo_p1
178
179 orth_v(p,3) = geo_v(p,3) * sin_geo_p2 + geo_v(p,2) * cos_geo_p2
180 end do
181
182 return

◆ geographiccoordcnv_rotatex()

subroutine, public scale_geographic_coord_cnv::geographiccoordcnv_rotatex ( real(rp), dimension(3), intent(in) pos_vec,
real(rp), intent(in) angle,
real(rp), dimension(3), intent(out) rotated_pos_vec )

Definition at line 186 of file scale_geographic_coord_cnv.F90.

188
189 implicit none
190 real(RP), intent(in) :: pos_vec(3)
191 real(RP), intent(in) :: angle
192 real(RP), intent(out) :: rotated_pos_vec(3)
193
194 real(RP) :: sin_angle, cos_angle
195 !---------------------------------------------------------
196
197 sin_angle = sin(angle)
198 cos_angle = cos(angle)
199
200 rotated_pos_vec(1) = pos_vec(1)
201 rotated_pos_vec(2) = cos_angle * pos_vec(2) - sin_angle * pos_vec(3)
202 rotated_pos_vec(3) = sin_angle * pos_vec(2) + cos_angle * pos_vec(3)
203
204 return

◆ geographiccoordcnv_rotatey()

subroutine, public scale_geographic_coord_cnv::geographiccoordcnv_rotatey ( real(rp), dimension(3), intent(in) pos_vec,
real(rp), intent(in) angle,
real(rp), dimension(3), intent(out) rotated_pos_vec )

Definition at line 208 of file scale_geographic_coord_cnv.F90.

210
211 implicit none
212 real(RP), intent(in) :: pos_vec(3)
213 real(RP), intent(in) :: angle
214 real(RP), intent(out) :: rotated_pos_vec(3)
215
216 real(RP) :: sin_angle, cos_angle
217 !---------------------------------------------------------
218
219 sin_angle = sin(angle)
220 cos_angle = cos(angle)
221
222 rotated_pos_vec(1) = cos_angle * pos_vec(1) + sin_angle * pos_vec(3)
223 rotated_pos_vec(2) = pos_vec(2)
224 rotated_pos_vec(3) = - sin_angle * pos_vec(1) + cos_angle * pos_vec(3)
225
226 return

◆ geographiccoordcnv_rotatez()

subroutine, public scale_geographic_coord_cnv::geographiccoordcnv_rotatez ( real(rp), dimension(3), intent(in) pos_vec,
real(rp), intent(in) angle,
real(rp), dimension(3), intent(out) rotated_pos_vec )

Definition at line 230 of file scale_geographic_coord_cnv.F90.

232
233 implicit none
234 real(RP), intent(in) :: pos_vec(3)
235 real(RP), intent(in) :: angle
236 real(RP), intent(out) :: rotated_pos_vec(3)
237
238 real(RP) :: sin_angle, cos_angle
239 !---------------------------------------------------------
240
241 sin_angle = sin(angle)
242 cos_angle = cos(angle)
243
244 rotated_pos_vec(1) = cos_angle * pos_vec(1) - sin_angle * pos_vec(2)
245 rotated_pos_vec(2) = sin_angle * pos_vec(1) + cos_angle * pos_vec(2)
246 rotated_pos_vec(3) = pos_vec(3)
247
248 return