subroutine dyn_mpas_compute_cell_relative_vorticity(self, cell_relative_vorticity)
class(mpas_dynamical_core_type), intent(in) :: self
real(rkind), allocatable, intent(out) :: cell_relative_vorticity(:, :)
character(*), parameter :: subname = 'dyn_mpas_subdriver::dyn_mpas_compute_cell_relative_vorticity'
integer :: i, k
integer :: ierr
integer, pointer :: ncellssolve, nvertlevels
integer, pointer :: kiteforcell(:, :), nedgesoncell(:), verticesoncell(:, :)
real(rkind), pointer :: areacell(:), kiteareasonvertex(:, :), vorticity(:, :)
nullify(ncellssolve, nvertlevels)
nullify(kiteforcell, nedgesoncell, verticesoncell)
nullify(areacell, kiteareasonvertex, vorticity)
! Input.
call self % get_variable_pointer(ncellssolve, 'dim', 'nCellsSolve')
call self % get_variable_pointer(nvertlevels, 'dim', 'nVertLevels')
call self % get_variable_pointer(kiteforcell, 'mesh', 'kiteForCell')
call self % get_variable_pointer(nedgesoncell, 'mesh', 'nEdgesOnCell')
call self % get_variable_pointer(verticesoncell, 'mesh', 'verticesOnCell')
call self % get_variable_pointer(areacell, 'mesh', 'areaCell')
call self % get_variable_pointer(kiteareasonvertex, 'mesh', 'kiteAreasOnVertex')
call self % get_variable_pointer(vorticity, 'diag', 'vorticity')
! Output.
allocate(cell_relative_vorticity(nvertlevels, ncellssolve), stat=ierr)
if (ierr /= 0) then
call self % model_error('Failed to allocate cell_relative_vorticity', subname, __LINE__)
end if
do i = 1, ncellssolve
do k = 1, nvertlevels
cell_relative_vorticity(k, i) = regrid_from_vertex_to_cell(i, k, &
nedgesoncell, verticesoncell, kiteforcell, kiteareasonvertex, areacell, &
vorticity)
end do
end do
nullify(ncellssolve, nvertlevels)
nullify(kiteforcell, nedgesoncell, verticesoncell)
nullify(areacell, kiteareasonvertex, vorticity)
end subroutine dyn_mpas_compute_cell_relative_vorticity