25 real(kind_real),
allocatable :: fld(:,:,:,:,:)
26 real(kind_real),
allocatable :: mean(:,:,:,:,:)
46 subroutine ens_alloc(ens,nam,geom,ne,nsub)
51 class(ens_type),
intent(inout) :: ens
52 type(nam_type),
intent(in) :: nam
53 type(geom_type),
intent(in) :: geom
54 integer,
intent(in) :: ne
55 integer,
intent(in) :: nsub
59 allocate(ens%fld(geom%nc0a,geom%nl0,nam%nv,nam%nts,ne))
60 allocate(ens%mean(geom%nc0a,geom%nl0,nam%nv,nam%nts,nsub))
82 class(ens_type),
intent(inout) :: ens
85 if (
allocated(ens%fld))
deallocate(ens%fld)
86 if (
allocated(ens%mean))
deallocate(ens%mean)
99 class(ens_type),
intent(inout) :: ens_out
100 type(ens_type),
intent(in) :: ens_in
103 if (ens_in%ne>0)
then 104 allocate(ens_out%fld(
size(ens_in%fld,1),
size(ens_in%fld,2),
size(ens_in%fld,3),
size(ens_in%fld,4),
size(ens_in%fld,5)))
105 allocate(ens_out%mean(
size(ens_in%mean,1),
size(ens_in%mean,2),
size(ens_in%mean,3),
size(ens_in%mean,4),
size(ens_in%mean,5)))
109 ens_out%ne = ens_in%ne
110 ens_out%nsub = ens_in%nsub
111 if (ens_in%ne>0)
then 112 ens_out%fld = ens_in%fld
113 ens_out%mean = ens_in%mean
127 class(ens_type),
intent(inout) :: ens
130 integer :: isub,ie_sub,ie
136 ens%mean(:,:,:,:,isub) = 0.0
137 do ie_sub=1,ens%ne/ens%nsub
138 ie = ie_sub+(isub-1)*ens%ne/ens%nsub
139 ens%mean(:,:,:,:,isub) = ens%mean(:,:,:,:,isub)+ens%fld(:,:,:,:,ie)
141 ens%mean(:,:,:,:,isub) = ens%mean(:,:,:,:,isub)/(ens%ne/ens%nsub)
144 do ie_sub=1,ens%ne/ens%nsub
145 ie = ie_sub+(isub-1)*ens%ne/ens%nsub
146 ens%fld(:,:,:,:,ie) = ens%fld(:,:,:,:,ie)-ens%mean(:,:,:,:,isub)
157 subroutine ens_from(ens,nam,geom,ne,ens_mga)
162 class(ens_type),
intent(inout) :: ens
163 type(nam_type),
intent(in) :: nam
164 type(geom_type),
intent(in) :: geom
165 integer,
intent(in) :: ne
166 real(kind_real),
intent(in) :: ens_mga(geom%nmga,geom%nl0,nam%nv,nam%nts,ne)
169 integer :: ie,its,iv,il0
172 call ens%alloc(nam,geom,ne,1)
180 ens%fld(:,il0,iv,its,ie) = ens_mga(geom%c0a_to_mga,il0,iv,its,ie)
201 class(ens_type),
intent(inout) :: ens
202 type(mpl_type),
intent(in) :: mpl
203 type(nam_type),
intent(in) :: nam
204 type(geom_type),
intent(in) :: geom
205 integer,
intent(in) :: nx
206 integer,
intent(in) :: ny
207 integer,
intent(in) :: nens
208 integer,
intent(in) :: ncyc
209 real(kind_real),
intent(in),
optional :: ens_2d(nx,ny,nens,ncyc)
210 real(kind_real),
intent(in),
optional :: ens_3d(nx,ny,geom%nl0,nens,ncyc)
213 integer :: ie,iens,icyc,its,iv,il0
214 real(kind_real) :: tmp(geom%nmga)
217 call ens%alloc(nam,geom,nens*ncyc,ncyc)
226 if (
present(ens_2d))
then 228 tmp = pack(ens_2d(:,:,iens,icyc),.true.)
229 ens%fld(:,il0,iv,its,ie) = tmp(geom%c0a_to_mga)
230 elseif (
present(ens_3d))
then 233 tmp = pack(ens_3d(:,:,il0,iens,icyc),.true.)
234 ens%fld(:,il0,iv,its,ie) = tmp(geom%c0a_to_mga)
237 call mpl%abort(
'ens_2d or ens_3d should be provided in ens_from_nemovar')
subroutine ens_copy(ens_out, ens_in)
subroutine ens_remove_mean(ens)
subroutine, public copy(self, rhs)
subroutine ens_alloc(ens, nam, geom, ne, nsub)
subroutine ens_from(ens, nam, geom, ne, ens_mga)
subroutine ens_dealloc(ens)
subroutine ens_from_nemovar(ens, mpl, nam, geom, nx, ny, nens, ncyc, ens_2d, ens_3d)
integer, parameter, public kind_real