8 implicit none ;
private
20 real,
allocatable,
dimension(:) :: coordinateresolution
23 public init_coord_sigma, set_sigma_params, build_sigma_column, end_coord_sigma
28 subroutine init_coord_sigma(CS, nk, coordinateResolution)
30 integer,
intent(in) :: nk
31 real,
dimension(:),
intent(in) :: coordinateresolution
33 if (
associated(cs))
call mom_error(fatal,
"init_coord_sigma: CS already associated!")
35 allocate(cs%coordinateResolution(nk))
38 cs%coordinateResolution = coordinateresolution
39 end subroutine init_coord_sigma
42 subroutine end_coord_sigma(CS)
46 if (.not.
associated(cs))
return
47 deallocate(cs%coordinateResolution)
49 end subroutine end_coord_sigma
52 subroutine set_sigma_params(CS, min_thickness)
54 real,
optional,
intent(in) :: min_thickness
56 if (.not.
associated(cs))
call mom_error(fatal,
"set_sigma_params: CS not associated")
58 if (
present(min_thickness)) cs%min_thickness = min_thickness
59 end subroutine set_sigma_params
63 subroutine build_sigma_column(CS, depth, totalThickness, zInterface)
65 real,
intent(in) :: depth
66 real,
intent(in) :: totalthickness
67 real,
dimension(CS%nk+1),
intent(inout) :: zinterface
72 zinterface(cs%nk+1) = -depth
74 zinterface(k) = zinterface(k+1) + (totalthickness * cs%coordinateResolution(k))
77 if (zinterface(k) < (zinterface(k+1) + cs%min_thickness))
then
78 zinterface(k) = zinterface(k+1) + cs%min_thickness
81 end subroutine build_sigma_column