46 #include<file_version.h> 66 subroutine gradient_cubic(pin, dx, dy, area, edge_w, edge_e, edge_s, edge_n, &
67 en_n, en_e, vlon, vlat, grad_x, grad_y, on_west_edge, &
68 on_east_edge, on_south_edge, on_north_edge)
70 real,
dimension(:,: ),
intent(in ) :: pin, dx, dy, area
71 real,
dimension(: ),
intent(in ) :: edge_w, edge_e, edge_s, edge_n
72 real,
dimension(:,:,:),
intent(in ) :: en_n, en_e
73 real,
dimension(:,:,:),
intent(in ) :: vlon, vlat
74 real,
dimension(:,: ),
intent(out) :: grad_x, grad_y
75 logical,
intent(in ) :: on_west_edge, on_east_edge, on_south_edge, on_north_edge
82 if(
size(pin,1) .NE. nx+2 .OR.
size(pin,2) .NE. ny+2)
call mpp_error(fatal,
"gradient_mod:size of pin should be (nx+2, ny+2)")
83 if(
size(dx,1) .NE. nx .OR.
size(dx,2) .NE. ny+1 )
call mpp_error(fatal,
"gradient_mod: size of dx should be (nx,ny+1)")
84 if(
size(dy,1) .NE. nx+1 .OR.
size(dy,2) .NE. ny )
call mpp_error(fatal,
"gradient_mod: size of dy should be (nx+1,ny)")
85 if(
size(area,1) .NE. nx .OR.
size(area,2) .NE. ny )
call mpp_error(fatal,
"gradient_mod: size of area should be (nx,ny)")
86 if(
size(vlon,1) .NE. 3 .OR.
size(vlon,2) .NE. nx .OR.
size(vlon,3) .NE. ny) &
87 call mpp_error(fatal,
"gradient_mod: size of vlon should be (3,nx,ny)")
88 if(
size(vlat,1) .NE. 3 .OR.
size(vlat,2) .NE. nx .OR.
size(vlat,3) .NE. ny) &
89 call mpp_error(fatal,
"gradient_mod: size of vlat should be (3,nx,ny)")
90 if(
size(edge_w) .NE. ny+1)
call mpp_error(fatal,
"gradient_mod: size of edge_w should be (ny+1)")
91 if(
size(edge_e) .NE. ny+1)
call mpp_error(fatal,
"gradient_mod: size of edge_e should be (ny+1)")
92 if(
size(edge_s) .NE. nx+1)
call mpp_error(fatal,
"gradient_mod: size of edge_s should be (nx+1)")
93 if(
size(edge_n) .NE. nx+1)
call mpp_error(fatal,
"gradient_mod: size of edge_n should be (nx+1)")
94 if(
size(en_n,1) .NE. 3 .OR.
size(en_n,2) .NE. nx .OR.
size(en_n,3) .NE. ny+1 ) &
95 call mpp_error(fatal,
"gradient_mod:size of en_n should be (3, nx, ny+1)")
96 if(
size(en_e,1) .NE. 3 .OR.
size(en_e,2) .NE. nx+1 .OR.
size(en_e,3) .NE. ny ) &
97 call mpp_error(fatal,
"gradient_mod:size of en_e should be (3, nx+1, ny)")
99 call grad_c2l(nx, ny, pin, dx, dy, area, edge_w, edge_e, edge_s, edge_n, en_n, en_e, vlon, vlat, &
100 grad_x, grad_y, on_west_edge, on_east_edge, on_south_edge, on_north_edge)
107 subroutine calc_cubic_grid_info(xt, yt, xc, yc, dx, dy, area, edge_w, edge_e, edge_s, edge_n, &
108 en_n, en_e, vlon, vlat, on_west_edge, on_east_edge, on_south_edge, on_north_edge )
109 real,
dimension(:,: ),
intent(in ) :: xt, yt, xc, yc
110 real,
dimension(:,: ),
intent(out) :: dx, dy, area
111 real,
dimension(: ),
intent(out) :: edge_w, edge_e, edge_s, edge_n
112 real,
dimension(:,:,:),
intent(out) :: en_n, en_e
113 real,
dimension(:,:,:),
intent(out) :: vlon, vlat
114 logical,
intent(in ) :: on_west_edge, on_east_edge, on_south_edge, on_north_edge
115 integer :: nx, ny, nxp, nyp
123 if(
size(xt,1) .NE. nx+2 .OR.
size(xt,2) .NE. ny+2 )
call mpp_error(fatal,
"gradient_mod: size of xt should be (nx+2,ny+2)")
124 if(
size(yt,1) .NE. nx+2 .OR.
size(yt,2) .NE. ny+2 )
call mpp_error(fatal,
"gradient_mod: size of yt should be (nx+2,ny+2)")
125 if(
size(xc,1) .NE. nxp .OR.
size(xc,2) .NE. nyp )
call mpp_error(fatal,
"gradient_mod: size of xc should be (nx+1,ny+1)")
126 if(
size(yc,1) .NE. nxp .OR.
size(yc,2) .NE. nyp )
call mpp_error(fatal,
"gradient_mod: size of yc should be (nx+1,ny+1)")
127 if(
size(dx,1) .NE. nx .OR.
size(dx,2) .NE. nyp )
call mpp_error(fatal,
"gradient_mod: size of dx should be (nx,ny+1)")
128 if(
size(dy,1) .NE. nxp .OR.
size(dy,2) .NE. ny )
call mpp_error(fatal,
"gradient_mod: size of dy should be (nx+1,ny)")
129 if(
size(area,1) .NE. nx .OR.
size(area,2) .NE. ny )
call mpp_error(fatal,
"gradient_mod: size of area should be (nx,ny)")
130 if(
size(vlon,1) .NE. 3 .OR.
size(vlon,2) .NE. nx .OR.
size(vlon,3) .NE. ny) &
131 call mpp_error(fatal,
"gradient_mod: size of vlon should be (3,nx,ny)")
132 if(
size(vlat,1) .NE. 3 .OR.
size(vlat,2) .NE. nx .OR.
size(vlat,3) .NE. ny) &
133 call mpp_error(fatal,
"gradient_mod: size of vlat should be (3,nx,ny)")
134 if(
size(edge_w) .NE. ny+1)
call mpp_error(fatal,
"gradient_mod: size of edge_w should be (ny-1)")
135 if(
size(edge_e) .NE. ny+1)
call mpp_error(fatal,
"gradient_mod: size of edge_e should be (ny-1)")
136 if(
size(edge_s) .NE. nx+1)
call mpp_error(fatal,
"gradient_mod: size of edge_s should be (nx-1)")
137 if(
size(edge_n) .NE. nx+1)
call mpp_error(fatal,
"gradient_mod: size of edge_n should be (nx-1)")
138 if(
size(en_n,1) .NE. 3 .OR.
size(en_n,2) .NE. nx .OR.
size(en_n,3) .NE. nyp ) &
139 call mpp_error(fatal,
"gradient_mod:size of en_n should be (3, nx, ny+1)")
140 if(
size(en_e,1) .NE. 3 .OR.
size(en_e,2) .NE. nxp .OR.
size(en_e,3) .NE. ny ) &
141 call mpp_error(fatal,
"gradient_mod:size of en_e should be (3, nx+1, ny)")
144 call calc_c2l_grid_info(nx, ny, xt, yt, xc, yc, dx, dy, area, edge_w, edge_e, edge_s, edge_n, &
145 en_n, en_e, vlon, vlat, on_west_edge, on_east_edge, on_south_edge, on_north_edge )
real, parameter, public radius
Radius of the Earth [m].
void grad_c2l(const int *nlon, const int *nlat, const double *pin, const double *dx, const double *dy, const double *area, const double *edge_w, const double *edge_e, const double *edge_s, const double *edge_n, const double *en_n, const double *en_e, const double *vlon, const double *vlat, double *grad_x, double *grad_y, const int *on_west_edge, const int *on_east_edge, const int *on_south_edge, const int *on_north_edge)
subroutine, public calc_cubic_grid_info(xt, yt, xc, yc, dx, dy, area, edge_w, edge_e, edge_s, edge_n, en_n, en_e, vlon, vlat, on_west_edge, on_east_edge, on_south_edge, on_north_edge)
subroutine, public gradient_cubic(pin, dx, dy, area, edge_w, edge_e, edge_s, edge_n, en_n, en_e, vlon, vlat, grad_x, grad_y, on_west_edge, on_east_edge, on_south_edge, on_north_edge)
void calc_c2l_grid_info(int *nx_pt, int *ny_pt, const double *xt, const double *yt, const double *xc, const double *yc, double *dx, double *dy, double *area, double *edge_w, double *edge_e, double *edge_s, double *edge_n, double *en_n, double *en_e, double *vlon, double *vlat, int *on_west_edge, int *on_east_edge, int *on_south_edge, int *on_north_edge)