Skip to content

Commit

Permalink
Removing latlon_to_xyz_on_plane() from mpas_atm model_mod - see issue #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Marlena Smith committed Jun 22, 2023
1 parent 502af78 commit 1324c3d
Showing 1 changed file with 0 additions and 49 deletions.
49 changes: 0 additions & 49 deletions models/mpas_atm/model_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7165,55 +7165,6 @@ end subroutine inside_triangle

!------------------------------------------------------------

subroutine latlon_to_xyz_on_plane(lat, lon, cellid, x, y, z)

! FIXME: currently unused. unless needed, could be removed.

! Given a lat, lon in degrees, and the id of a cell in the
! MPAS grid, return the cartesian x,y,z coordinate of that
! location ON THE PLANE defined by the vertices of that cell.
! This will be different from the x,y,z of the surface of the
! sphere. Uses the parametric form description from
! http://en.wikipedia.org/wiki/Line-plane_intersection

real(r8), intent(in) :: lat, lon
integer, intent(in) :: cellid
real(r8), intent(out) :: x, y, z

integer :: nverts, i, vertexid
real(r8) :: s(3) ! location of point on surface
real(r8) :: p(3,3) ! first 3 vertices of cell, xyz
real(r8) :: intp(3) ! intersection point with plane

call latlon_to_xyz(lat, lon, s(1), s(2), s(3))

! get the first 3 vertices to define plane
! intersect with sx,sy,sz to get answer

! nedges and nverts is same
nverts = nEdgesOnCell(cellid)
if (nverts < 3) then
print *, 'nverts is < 3', nverts
stop
endif

! use first 3 verts to define plane
do i=1, 3
vertexid = verticesOnCell(i, cellid)

p(1,i) = xVertex(vertexid)
p(2,i) = yVertex(vertexid)
p(3,i) = zVertex(vertexid)
enddo

x = intp(1)
y = intp(2)
z = intp(3)

end subroutine latlon_to_xyz_on_plane

!------------------------------------------------------------

function vector_magnitude(a)

! Given a cartesian vector, compute the magnitude
Expand Down

0 comments on commit 1324c3d

Please sign in to comment.