FE-Project
Loading...
Searching...
No Matches
Functions/Subroutines
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
Coordinate conversion 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 !$omp do
55 do p=1, np
56 geo_p(p,3) = sqrt( orth_p(p,1)**2 + orth_p(p,2)**2 + orth_p(p,3)**2 )
57 geo_p(p,2) = asin( orth_p(p,3) / geo_p(p,3) )
58 geo_p(p,1) = atan( orth_p(p,2) / orth_p(p,1) )
59 end do
60 !$omp do
61 do p=1, np
62 if ( geo_p(p,1) <= 0.0_rp .and. orth_p(p,1) < 0.0_rp ) then
63 geo_p(p,1) = geo_p(p,1) + pi
64 else if ( geo_p(p,1) >= 0.0_rp .and. orth_p(p,1) < 0.0_rp ) then
65 geo_p(p,1) = geo_p(p,1) - pi
66 end if
67 if ( orth_p(p,1) == 0.0_rp .and. orth_p(p,2) == 0.0_rp ) then
68 geo_p(p,1) = 0.0_rp
69 else if ( orth_p(p,1) == 0.0_rp ) then
70 geo_p(p,1) = sign(1.0_rp, orth_p(p,2)) * 0.5_rp * pi
71 end if
72 end do
73 !$omp end parallel
74
75 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 79 of file scale_geographic_coord_cnv.F90.

81
82 implicit none
83 integer, intent(in) :: Np
84 real(RP), intent(in) :: geo_p(Np,3)
85 real(RP), intent(out) :: orth_p(Np,3)
86
87 integer :: p
88 !---------------------------------------------------------
89
90 !$omp parallel do private(p)
91 do p=1, np
92 orth_p(p,1) = geo_p(p,3) * cos(geo_p(p,2)) * cos(geo_p(p,1))
93 orth_p(p,2) = geo_p(p,3) * cos(geo_p(p,2)) * sin(geo_p(p,1))
94 orth_p(p,3) = geo_p(p,3) * sin(geo_p(p,2))
95 end do
96
97 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 101 of file scale_geographic_coord_cnv.F90.

103 implicit none
104
105 integer, intent(in) :: Np
106 real(RP), intent(in) :: orth_v(Np,3)
107 real(RP), intent(in) :: geo_p(Np,3)
108 real(RP), intent(out) :: geo_v(Np,3)
109
110 integer :: p
111 real(RP) :: sin_geo_p1
112 real(RP) :: cos_geo_p1
113 real(RP) :: sin_geo_p2
114 real(RP) :: cos_geo_p2
115 !---------------------------------------------------------
116
117 !$omp parallel do private(p, cos_geo_p2)
118 do p=1, np
119 sin_geo_p1 = sin(geo_p(p,1))
120 cos_geo_p1 = cos(geo_p(p,1))
121 sin_geo_p2 = sin(geo_p(p,2))
122 cos_geo_p2 = cos(geo_p(p,2))
123
124 geo_v(p,3) = orth_v(p,1) * cos_geo_p2 * cos_geo_p1 &
125 + orth_v(p,2) * cos_geo_p2 * sin_geo_p1 &
126 + orth_v(p,3) * sin_geo_p2
127
128 geo_v(p,2) = - orth_v(p,1) * sin_geo_p2 * cos_geo_p1 &
129 - orth_v(p,2) * sin_geo_p2 * sin_geo_p1 &
130 + orth_v(p,3) * cos_geo_p2
131
132 geo_v(p,1) = - orth_v(p,1) * sin_geo_p1 &
133 + orth_v(p,2) * cos_geo_p1
134 end do
135
136 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 140 of file scale_geographic_coord_cnv.F90.

142 implicit none
143
144 integer, intent(in) :: Np
145 real(RP), intent(in) :: geo_v(Np,3)
146 real(RP), intent(in) :: geo_p(Np,3)
147 real(RP), intent(out) :: orth_v(Np,3)
148
149 integer :: p
150 real(RP) :: sin_geo_p1
151 real(RP) :: cos_geo_p1
152 real(RP) :: sin_geo_p2
153 real(RP) :: cos_geo_p2
154 !---------------------------------------------------------
155
156 !$omp parallel do private(p, sin_geo_p1, cos_geo_p1, sin_geo_p2, cos_geo_p2)
157 do p=1, np
158 sin_geo_p1 = sin(geo_p(p,1))
159 cos_geo_p1 = cos(geo_p(p,1))
160 sin_geo_p2 = sin(geo_p(p,2))
161 cos_geo_p2 = cos(geo_p(p,2))
162
163 orth_v(p,1) = geo_v(p,3) * cos_geo_p1 * cos_geo_p2 &
164 - geo_v(p,2) * cos_geo_p1 * sin_geo_p2 &
165 - geo_v(p,1) * sin_geo_p1
166
167 orth_v(p,2) = geo_v(p,3) * sin_geo_p1 * cos_geo_p2 &
168 - geo_v(p,2) * sin_geo_p1 * sin_geo_p2 &
169 + geo_v(p,1) * cos_geo_p1
170
171 orth_v(p,3) = geo_v(p,3) * sin_geo_p2 + geo_v(p,2) * cos_geo_p2
172 end do
173
174 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 178 of file scale_geographic_coord_cnv.F90.

180
181 implicit none
182 real(RP), intent(in) :: pos_vec(3)
183 real(RP), intent(in) :: angle
184 real(RP), intent(out) :: rotated_pos_vec(3)
185
186 real(RP) :: sin_angle, cos_angle
187 !---------------------------------------------------------
188
189 sin_angle = sin(angle)
190 cos_angle = cos(angle)
191
192 rotated_pos_vec(1) = pos_vec(1)
193 rotated_pos_vec(2) = cos_angle * pos_vec(2) - sin_angle * pos_vec(3)
194 rotated_pos_vec(3) = sin_angle * pos_vec(2) + cos_angle * pos_vec(3)
195
196 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 200 of file scale_geographic_coord_cnv.F90.

202
203 implicit none
204 real(RP), intent(in) :: pos_vec(3)
205 real(RP), intent(in) :: angle
206 real(RP), intent(out) :: rotated_pos_vec(3)
207
208 real(RP) :: sin_angle, cos_angle
209 !---------------------------------------------------------
210
211 sin_angle = sin(angle)
212 cos_angle = cos(angle)
213
214 rotated_pos_vec(1) = cos_angle * pos_vec(1) + sin_angle * pos_vec(3)
215 rotated_pos_vec(2) = pos_vec(2)
216 rotated_pos_vec(3) = - sin_angle * pos_vec(1) + cos_angle * pos_vec(3)
217
218 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 222 of file scale_geographic_coord_cnv.F90.

224
225 implicit none
226 real(RP), intent(in) :: pos_vec(3)
227 real(RP), intent(in) :: angle
228 real(RP), intent(out) :: rotated_pos_vec(3)
229
230 real(RP) :: sin_angle, cos_angle
231 !---------------------------------------------------------
232
233 sin_angle = sin(angle)
234 cos_angle = cos(angle)
235
236 rotated_pos_vec(1) = cos_angle * pos_vec(1) - sin_angle * pos_vec(2)
237 rotated_pos_vec(2) = sin_angle * pos_vec(1) + cos_angle * pos_vec(2)
238 rotated_pos_vec(3) = pos_vec(3)
239
240 return