A Modular Arbitrary-Order Ocean-Atmosphere Model -- Stochastic implementation
Functions/Subroutines | Variables
dec_tensor Module Reference

The resolved-unresolved components decomposition of the tensor. More...

Functions/Subroutines

subroutine suppress_and (t, cst, v1, v2)
 Subroutine to suppress from the tensor \(t_{ijk}\) components satisfying SF(j)=v1 and SF(k)=v2. More...
 
subroutine suppress_or (t, cst, v1, v2)
 Subroutine to suppress from the tensor \(t_{ijk}\) components satisfying SF(j)=v1 or SF(k)=v2. More...
 
subroutine reorder (t, cst, v)
 Subroutine to reorder the tensor \(t_{ijk}\) components : if SF(j)=v then it return \(t_{ikj}\). More...
 
subroutine init_sub_tensor (t, cst, v)
 Subroutine that suppress all the components of a tensor \(t_{ijk}\) where if SF(i)=v. More...
 
subroutine, public init_dec_tensor
 Subroutine that initialize and compute the decomposed tensors. More...
 

Variables

type(coolist), dimension(:), allocatable, public ff_tensor
 Tensor holding the part of the unresolved tensor involving only unresolved variables. More...
 
type(coolist), dimension(:), allocatable, public sf_tensor
 Tensor holding the part of the resolved tensor involving unresolved variables. More...
 
type(coolist), dimension(:), allocatable, public ss_tensor
 Tensor holding the part of the resolved tensor involving only resolved variables. More...
 
type(coolist), dimension(:), allocatable, public fs_tensor
 Tensor holding the part of the unresolved tensor involving resolved variables. More...
 
type(coolist), dimension(:), allocatable, public hx
 Tensor holding the constant part of the resolved tendencies. More...
 
type(coolist), dimension(:), allocatable, public lxx
 Tensor holding the linear part of the resolved tendencies involving the resolved variables. More...
 
type(coolist), dimension(:), allocatable, public lxy
 Tensor holding the linear part of the resolved tendencies involving the unresolved variables. More...
 
type(coolist), dimension(:), allocatable, public bxxx
 Tensor holding the quadratic part of the resolved tendencies involving resolved variables. More...
 
type(coolist), dimension(:), allocatable, public bxxy
 Tensor holding the quadratic part of the resolved tendencies involving both resolved and unresolved variables. More...
 
type(coolist), dimension(:), allocatable, public bxyy
 Tensor holding the quadratic part of the resolved tendencies involving unresolved variables. More...
 
type(coolist), dimension(:), allocatable, public hy
 Tensor holding the constant part of the unresolved tendencies. More...
 
type(coolist), dimension(:), allocatable, public lyx
 Tensor holding the linear part of the unresolved tendencies involving the resolved variables. More...
 
type(coolist), dimension(:), allocatable, public lyy
 Tensor holding the linear part of the unresolved tendencies involving the unresolved variables. More...
 
type(coolist), dimension(:), allocatable, public byxx
 Tensor holding the quadratic part of the unresolved tendencies involving resolved variables. More...
 
type(coolist), dimension(:), allocatable, public byxy
 Tensor holding the quadratic part of the unresolved tendencies involving both resolved and unresolved variables. More...
 
type(coolist), dimension(:), allocatable, public byyy
 Tensor holding the quadratic part of the unresolved tendencies involving unresolved variables. More...
 
type(coolist), dimension(:), allocatable, public ss_tl_tensor
 Tensor of the tangent linear model tendencies of the resolved component alone. More...
 
type(coolist), dimension(:), allocatable dumb
 Dumb coolist to make the computations. More...
 

Detailed Description

The resolved-unresolved components decomposition of the tensor.

Remarks

Function/Subroutine Documentation

subroutine, public dec_tensor::init_dec_tensor ( )

Subroutine that initialize and compute the decomposed tensors.

Definition at line 195 of file dec_tensor.f90.

195  USE params, only:ndim
196  USE aotensor_def, only:aotensor
197  USE sf_def, only: load_sf
201  INTEGER :: allocstat
202 
203  CALL init_stoch_params
204 
205  CALL init_tltensor ! and tl tensor
206 
207  CALL load_sf ! Load the resolved-unresolved decomposition
208 
209  ! Allocating the returned arrays
210 
211  ALLOCATE(ff_tensor(ndim),fs_tensor(ndim),sf_tensor(ndim),ss_tensor(ndim), stat=allocstat)
212  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
213 
214  ALLOCATE(ss_tl_tensor(ndim), stat=allocstat)
215  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
216 
217  ALLOCATE(hx(ndim),lxx(ndim),lxy(ndim),bxxx(ndim),bxxy(ndim),bxyy(ndim), stat=allocstat)
218  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
219 
220  ALLOCATE(hy(ndim),lyx(ndim),lyy(ndim),byxx(ndim),byxy(ndim),byyy(ndim), stat=allocstat)
221  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
222 
223  ! General decomposition
224  ! ff tensor
225  ALLOCATE(dumb(ndim), stat=allocstat)
226  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
227 
228  IF (mode.ne.'qfst') THEN
229  CALL copy_coo(aotensor,dumb) !Copy the tensors
230  CALL init_sub_tensor(dumb,0,0)
231  CALL suppress_or(dumb,1,0,0) ! Clear entries with resolved variables
232  CALL copy_coo(dumb,ff_tensor)
233  ELSE
234  CALL copy_coo(aotensor,dumb) !Copy the tensors
235  CALL init_sub_tensor(dumb,0,0)
236  CALL suppress_or(dumb,0,0,0) ! Clear entries with resolved variables and linear and constant terms
237  CALL copy_coo(dumb,ff_tensor)
238  ENDIF
239 
240  allocstat=0
241  DEALLOCATE(dumb, stat=allocstat)
242  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
243 
244  ! fs tensor
245  ALLOCATE(dumb(ndim), stat=allocstat)
246  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
247 
248  IF (mode.ne.'qfst') THEN
249  CALL copy_coo(aotensor,dumb) !Copy the tensors
250  CALL init_sub_tensor(dumb,0,0)
251  CALL suppress_and(dumb,1,1,1) ! Clear entries with only unresolved variables and constant
252  CALL copy_coo(dumb,fs_tensor)
253  ELSE
254  CALL copy_coo(aotensor,dumb) !Copy the tensors
255  CALL init_sub_tensor(dumb,0,0)
256  CALL suppress_and(dumb,0,1,1) ! Clear entries with only quadratic unresolved variables
257  CALL copy_coo(dumb,fs_tensor)
258  ENDIF
259 
260  allocstat=0
261  DEALLOCATE(dumb, stat=allocstat)
262  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
263 
264  ! sf tensor
265  ALLOCATE(dumb(ndim), stat=allocstat)
266  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
267 
268 
269  CALL copy_coo(aotensor,dumb) !Copy the tensors
270  CALL init_sub_tensor(dumb,1,1)
271  CALL suppress_and(dumb,0,0,0) ! Clear entries with only unresolved variables and constant
272  CALL copy_coo(dumb,sf_tensor)
273 
274  allocstat=0
275  DEALLOCATE(dumb, stat=allocstat)
276  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
277 
278  ! ss tensor
279  ALLOCATE(dumb(ndim), stat=allocstat)
280  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
281 
282 
283  CALL copy_coo(aotensor,dumb) !Copy the tensors
284  CALL init_sub_tensor(dumb,1,1)
285  CALL suppress_or(dumb,0,1,1) ! Clear entries with only unresolved variables and constant
286  CALL copy_coo(dumb,ss_tensor)
287 
288  allocstat=0
289  DEALLOCATE(dumb, stat=allocstat)
290  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
291 
292  ! ss tangent linear tensor
293 
294  ALLOCATE(dumb(ndim), stat=allocstat)
295  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
296 
297  CALL copy_coo(tltensor,dumb) !Copy the tensors
298  CALL init_sub_tensor(dumb,1,1)
299  CALL suppress_or(dumb,0,1,1) ! Clear entries with only unresolved variables and constant
300  CALL copy_coo(dumb,ss_tl_tensor)
301 
302  allocstat=0
303  DEALLOCATE(dumb, stat=allocstat)
304  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
305 
306  ! Multiply the aotensor part that need to be by the perturbation and time
307  ! separation parameter
308 
309  ALLOCATE(dumb(ndim), stat=allocstat)
310  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
311 
312  CALL copy_coo(ss_tensor,dumb)
313  CALL scal_mul_coo(1.d0/tdelta**2,ff_tensor)
314  CALL scal_mul_coo(eps_pert/tdelta,fs_tensor)
315  CALL add_to_tensor(ff_tensor,dumb)
316  CALL add_to_tensor(fs_tensor,dumb)
317  CALL scal_mul_coo(eps_pert/tdelta,sf_tensor)
318  CALL add_to_tensor(sf_tensor,dumb)
319 
320  allocstat=0
321  DEALLOCATE(aotensor, stat=allocstat)
322  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
323 
324  ALLOCATE(aotensor(ndim), stat=allocstat)
325  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
326 
327  CALL copy_coo(dumb,aotensor)
328 
329  allocstat=0
330  DEALLOCATE(dumb, stat=allocstat)
331  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
332 
333  ! MTV decomposition
334  ! Unresolved tensors
335 
336  ! Hy tensor
337  ALLOCATE(dumb(ndim), stat=allocstat)
338  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
339 
340  CALL copy_coo(aotensor,dumb) !Copy the tensors
341  CALL init_sub_tensor(dumb,0,0)
342  CALL suppress_or(dumb,0,1,1) ! Clear entries with unresolved variables
343  CALL suppress_or(dumb,1,0,0) ! Suppress linear and nonlinear resolved terms
344  CALL copy_coo(dumb,hy)
345 
346  allocstat=0
347  DEALLOCATE(dumb, stat=allocstat)
348  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
349 
350  ! Lyx tensor
351  ALLOCATE(dumb(ndim), stat=allocstat)
352  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
353 
354  CALL copy_coo(aotensor,dumb) !Copy the tensors
355  CALL init_sub_tensor(dumb,0,0)
356  CALL suppress_or(dumb,0,1,1) ! Clear entries with unresolved variables
357  CALL suppress_and(dumb,1,1,1) ! Clear constant entries
358  CALL suppress_and(dumb,1,0,0) ! Clear entries with nonlinear resolved terms
359  CALL reorder(dumb,1,0) ! Resolved variables must be the third (k) index
360  CALL copy_coo(dumb,lyx)
361 
362  allocstat=0
363  DEALLOCATE(dumb, stat=allocstat)
364  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
365 
366  ! Lyy tensor
367  ALLOCATE(dumb(ndim), stat=allocstat)
368  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
369 
370  CALL copy_coo(aotensor,dumb) !Copy the tensors
371  CALL init_sub_tensor(dumb,0,0)
372  CALL suppress_or(dumb,1,0,0) ! Clear entries with resolved variables
373  CALL suppress_and(dumb,0,1,1) ! Clear entries with nonlinear unresolved terms
374  CALL suppress_and(dumb,0,0,0) ! Clear constant entries
375  CALL reorder(dumb,0,1) ! Unresolved variables must be the third (k) index
376  CALL copy_coo(dumb,lyy)
377 
378  allocstat=0
379  DEALLOCATE(dumb, stat=allocstat)
380  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
381 
382  ! Byxy tensor
383  ALLOCATE(dumb(ndim), stat=allocstat)
384  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
385 
386  CALL copy_coo(aotensor,dumb) !Copy the tensors
387  CALL init_sub_tensor(dumb,0,0)
388  CALL suppress_and(dumb,1,1,1) ! Clear constant or linear terms and nonlinear unresolved only entries
389  CALL suppress_and(dumb,0,0,0) ! Clear entries with only resolved variables and constant
390  CALL reorder(dumb,0,1) ! Unresolved variables must be the third (k) index
391  CALL copy_coo(dumb,byxy)
392 
393  allocstat=0
394  DEALLOCATE(dumb, stat=allocstat)
395  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
396 
397  ! Byyy tensor
398  ALLOCATE(dumb(ndim), stat=allocstat)
399  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
400 
401  CALL copy_coo(aotensor,dumb) !Copy the tensors
402  CALL init_sub_tensor(dumb,0,0)
403  CALL suppress_or(dumb,0,0,0) ! Clear entries with resolved variables and linear and constant terms
404  CALL copy_coo(dumb,byyy)
405 
406  allocstat=0
407  DEALLOCATE(dumb, stat=allocstat)
408  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
409 
410  ! Byxx tensor
411  ALLOCATE(dumb(ndim), stat=allocstat)
412  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
413 
414  CALL copy_coo(aotensor,dumb) !Copy the tensors
415  CALL init_sub_tensor(dumb,0,0)
416  CALL suppress_or(dumb,1,1,1) ! Clear entries with unresolved variables and linear and constant terms
417  CALL copy_coo(dumb,byxx)
418 
419  allocstat=0
420  DEALLOCATE(dumb, stat=allocstat)
421  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
422 
423  ! Resolved tensors
424 
425  ! Hx tensor
426  ALLOCATE(dumb(ndim), stat=allocstat)
427  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
428 
429  CALL copy_coo(aotensor,dumb) !Copy the tensors
430  CALL init_sub_tensor(dumb,1,1)
431  CALL suppress_or(dumb,1,0,0) ! Clear entries with resolved variables
432  CALL suppress_or(dumb,0,1,1) ! Suppress linear and nonlinear unresolved terms
433  CALL copy_coo(dumb,hx)
434 
435  allocstat=0
436  DEALLOCATE(dumb, stat=allocstat)
437  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
438 
439  ! Lxy tensor
440  ALLOCATE(dumb(ndim), stat=allocstat)
441  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
442 
443  CALL copy_coo(aotensor,dumb) !Copy the tensors
444  CALL init_sub_tensor(dumb,1,1)
445  CALL suppress_or(dumb,1,0,0) ! Clear entries with resolved variables
446  CALL suppress_and(dumb,0,0,0) ! Clear constant entries
447  CALL suppress_and(dumb,0,1,1) ! Clear entries with nonlinear unresolved terms
448  CALL reorder(dumb,0,1) ! Resolved variables must be the third (k) index
449  CALL copy_coo(dumb,lxy)
450 
451  allocstat=0
452  DEALLOCATE(dumb, stat=allocstat)
453  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
454 
455  ! Lxx tensor
456  ALLOCATE(dumb(ndim), stat=allocstat)
457  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
458 
459  CALL copy_coo(aotensor,dumb) !Copy the tensors
460  CALL init_sub_tensor(dumb,1,1)
461  CALL suppress_or(dumb,0,1,1) ! Clear entries with unresolved variables
462  CALL suppress_and(dumb,1,0,0) ! Clear entries with nonlinear resolved terms
463  CALL suppress_and(dumb,1,1,1) ! Clear constant entries
464  CALL reorder(dumb,1,0) ! Resolved variables must be the third (k) index
465  CALL copy_coo(dumb,lxx)
466 
467  allocstat=0
468  DEALLOCATE(dumb, stat=allocstat)
469  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
470 
471  ! Bxxy tensor
472  ALLOCATE(dumb(ndim), stat=allocstat)
473  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
474 
475  CALL copy_coo(aotensor,dumb) !Copy the tensors
476  CALL init_sub_tensor(dumb,1,1)
477  CALL suppress_and(dumb,1,1,1) ! Clear constant or linear terms and nonlinear unresolved only entries
478  CALL suppress_and(dumb,0,0,0) ! Clear entries with only resolved variables and constant
479  CALL reorder(dumb,0,1) ! Unresolved variables must be the third (k) index
480  CALL copy_coo(dumb,bxxy)
481 
482  allocstat=0
483  DEALLOCATE(dumb, stat=allocstat)
484  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
485 
486  ! Bxxx tensor
487  ALLOCATE(dumb(ndim), stat=allocstat)
488  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
489 
490  CALL copy_coo(aotensor,dumb) !Copy the tensors
491  CALL init_sub_tensor(dumb,1,1)
492  CALL suppress_or(dumb,1,1,1) ! Clear entries with unresolved variables and linear and constant terms
493  CALL copy_coo(dumb,bxxx)
494 
495  allocstat=0
496  DEALLOCATE(dumb, stat=allocstat)
497  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
498 
499  ! Bxyy tensor
500  ALLOCATE(dumb(ndim), stat=allocstat)
501  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
502 
503  CALL copy_coo(aotensor,dumb) !Copy the tensors
504  CALL init_sub_tensor(dumb,1,1)
505  CALL suppress_or(dumb,0,0,0) ! Clear entries with resolved variables and linear and constant terms
506  CALL copy_coo(dumb,bxyy)
507 
508  allocstat=0
509  DEALLOCATE(dumb, stat=allocstat)
510  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
511 
512 
513 
The stochastic models parameters module.
integer ndim
Number of variables (dimension of the model)
Definition: params.f90:85
subroutine init_stoch_params
Stochastic parameters initialization routine.
subroutine, public load_sf
Subroutine to load the unresolved variable defintion vector SF from SF.nml if it exists. If it does not, then write SF.nml with no unresolved variables specified (null vector).
Definition: sf_def.f90:37
subroutine, public copy_coo(src, dst)
Routine to copy a coolist.
Definition: tensor.f90:72
Statistics accumulators.
Definition: stat.f90:14
subroutine, public init_tltensor
Routine to initialize the TL tensor.
subroutine, public scal_mul_coo(s, t)
Routine to multiply a rank-3 tensor by a scalar.
Definition: tensor.f90:1274
The equation tensor for the coupled ocean-atmosphere model with temperature which allows for an exten...
Tensor utility module.
Definition: tensor.f90:18
real(kind=8) tdelta
Time separation parameter.
subroutine, public add_to_tensor(src, dst)
Routine to add a rank-3 tensor to another one.
Definition: tensor.f90:350
type(coolist), dimension(:), allocatable, public tltensor
Tensor representation of the Tangent Linear tendencies.
The model parameters module.
Definition: params.f90:18
Tangent Linear (TL) and Adjoint (AD) model versions of MAOOAM. Tensors definition module...
real(kind=8) eps_pert
Perturbation parameter for the coupling.
type(coolist), dimension(:), allocatable, public aotensor
- Tensor representation of the tendencies.
Module to select the resolved-unresolved components.
Definition: sf_def.f90:12
character(len=4) mode
Stochastic mode parameter.
subroutine dec_tensor::init_sub_tensor ( type(coolist), dimension(ndim), intent(inout)  t,
integer, intent(in)  cst,
integer, intent(in)  v 
)

Subroutine that suppress all the components of a tensor \(t_{ijk}\) where if SF(i)=v.

Parameters
ttensor over which the routine acts
cstconstant which controls if the 0 index is taken as a unresolved or a resolved one
vconstant of the conditional (0 to suppress resolved, 1 for unresolved)

Definition at line 174 of file dec_tensor.f90.

174  USE params, only:ndim
175  USE sf_def, only: sf
176  TYPE(coolist), DIMENSION(ndim), INTENT(INOUT) :: t
177  INTEGER, INTENT(IN) :: cst,v
178  INTEGER :: i
179 
180  sf(0)=cst ! control wether 0 index is considered unresolved or not
181  DO i=1,ndim
182  IF (sf(i)==v) t(i)%nelems=0
183  ENDDO
184 
integer ndim
Number of variables (dimension of the model)
Definition: params.f90:85
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
integer, dimension(:), allocatable, public sf
Unresolved variable definition vector.
Definition: sf_def.f90:23
The model parameters module.
Definition: params.f90:18
Module to select the resolved-unresolved components.
Definition: sf_def.f90:12
subroutine dec_tensor::reorder ( type(coolist), dimension(ndim), intent(inout)  t,
integer, intent(in)  cst,
integer, intent(in)  v 
)

Subroutine to reorder the tensor \(t_{ijk}\) components : if SF(j)=v then it return \(t_{ikj}\).

Parameters
ttensor over which the routine acts
cstconstant which controls if the 0 index is taken as a unresolved or a resolved one
vconstant of the conditional (0 to invert resolved, 1 for unresolved)

Definition at line 148 of file dec_tensor.f90.

148  USE params, only:ndim
149  USE sf_def, only: sf
150  TYPE(coolist), DIMENSION(ndim), INTENT(INOUT) :: t
151  INTEGER, INTENT(IN) :: cst,v
152  INTEGER :: i,n,li,liii
153 
154  sf(0)=cst ! control wether 0 index is considered unresolved or not
155  DO i=1,ndim
156 
157  n=t(i)%nelems
158  DO li=1,n
159  IF (sf(t(i)%elems(li)%j)==v) THEN
160  liii=t(i)%elems(li)%j
161  t(i)%elems(li)%j=t(i)%elems(li)%k
162  t(i)%elems(li)%k=liii
163  ENDIF
164  ENDDO
165  ENDDO
166 
integer ndim
Number of variables (dimension of the model)
Definition: params.f90:85
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
integer, dimension(:), allocatable, public sf
Unresolved variable definition vector.
Definition: sf_def.f90:23
The model parameters module.
Definition: params.f90:18
Module to select the resolved-unresolved components.
Definition: sf_def.f90:12
subroutine dec_tensor::suppress_and ( type(coolist), dimension(ndim), intent(inout)  t,
integer, intent(in)  cst,
integer, intent(in)  v1,
integer, intent(in)  v2 
)
private

Subroutine to suppress from the tensor \(t_{ijk}\) components satisfying SF(j)=v1 and SF(k)=v2.

Parameters
ttensor over which the routine acts
cstconstant which controls if the 0 index is taken as a unresolved or a resolved one
v1first constant of the conditional (0 to suppress resolved, 1 for unresolved)
v2second constant of the conditional (0 to suppress resolved, 1 for unresolved)

Definition at line 77 of file dec_tensor.f90.

77  USE params, only:ndim
78  USE sf_def, only: sf
79  TYPE(coolist), DIMENSION(ndim), INTENT(INOUT) :: t
80  INTEGER, INTENT(IN) :: cst,v1,v2
81  INTEGER :: i,n,li,liii
82 
83  sf(0)=cst ! control wether 0 index is considered unresolved or not
84  DO i=1,ndim
85  n=t(i)%nelems
86  DO li=1,n
87  ! Clear entries with only resolved variables and shift rest of the items one place down.
88  ! Make sure not to skip any entries while shifting!
89 
90  DO WHILE ((sf(t(i)%elems(li)%j)==v1).and.(sf(t(i)%elems(li)%k)==v2))
91  !print*, i,li,t(i)%nelems,n
92  DO liii=li+1,n
93  t(i)%elems(liii-1)%j=t(i)%elems(liii)%j
94  t(i)%elems(liii-1)%k=t(i)%elems(liii)%k
95  t(i)%elems(liii-1)%v=t(i)%elems(liii)%v
96  ENDDO
97  t(i)%nelems=t(i)%nelems-1
98  IF (li>t(i)%nelems) exit
99  ENDDO
100  IF (li>t(i)%nelems) exit
101  ENDDO
102  ENDDO
103 
integer ndim
Number of variables (dimension of the model)
Definition: params.f90:85
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
integer, dimension(:), allocatable, public sf
Unresolved variable definition vector.
Definition: sf_def.f90:23
The model parameters module.
Definition: params.f90:18
Module to select the resolved-unresolved components.
Definition: sf_def.f90:12
subroutine dec_tensor::suppress_or ( type(coolist), dimension(ndim), intent(inout)  t,
integer, intent(in)  cst,
integer, intent(in)  v1,
integer, intent(in)  v2 
)

Subroutine to suppress from the tensor \(t_{ijk}\) components satisfying SF(j)=v1 or SF(k)=v2.

Parameters
ttensor over which the routine acts
cstconstant which controls if the 0 index is taken as a unresolved or a resolved one
v1first constant of the conditional (0 to suppress resolved, 1 for unresolved)
v2second constant of the conditional (0 to suppress resolved, 1 for unresolved)

Definition at line 113 of file dec_tensor.f90.

113  USE params, only:ndim
114  USE sf_def, only: sf
115  TYPE(coolist), DIMENSION(ndim), INTENT(INOUT) :: t
116  INTEGER, INTENT(IN) :: cst,v1,v2
117  INTEGER :: i,n,li,liii
118 
119  sf(0)=cst ! control wether 0 index is considered unresolved or not
120  DO i=1,ndim
121  n=t(i)%nelems
122  DO li=1,n
123  ! Clear entries with only resolved variables and shift rest of the items one place down.
124  ! Make sure not to skip any entries while shifting!
125 
126  DO WHILE ((sf(t(i)%elems(li)%j)==v1).or.(sf(t(i)%elems(li)%k)==v2))
127  !print*, i,li,t(i)%nelems,n
128  DO liii=li+1,n
129  t(i)%elems(liii-1)%j=t(i)%elems(liii)%j
130  t(i)%elems(liii-1)%k=t(i)%elems(liii)%k
131  t(i)%elems(liii-1)%v=t(i)%elems(liii)%v
132  ENDDO
133  t(i)%nelems=t(i)%nelems-1
134  IF (li>t(i)%nelems) exit
135  ENDDO
136  IF (li>t(i)%nelems) exit
137  ENDDO
138  ENDDO
139 
integer ndim
Number of variables (dimension of the model)
Definition: params.f90:85
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
integer, dimension(:), allocatable, public sf
Unresolved variable definition vector.
Definition: sf_def.f90:23
The model parameters module.
Definition: params.f90:18
Module to select the resolved-unresolved components.
Definition: sf_def.f90:12

Variable Documentation

type(coolist), dimension(:), allocatable, public dec_tensor::bxxx

Tensor holding the quadratic part of the resolved tendencies involving resolved variables.

Definition at line 39 of file dec_tensor.f90.

39  TYPE(coolist), DIMENSION(:), ALLOCATABLE, PUBLIC :: bxxx !< Tensor holding the quadratic part of the resolved tendencies involving resolved variables
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
type(coolist), dimension(:), allocatable, public dec_tensor::bxxy

Tensor holding the quadratic part of the resolved tendencies involving both resolved and unresolved variables.

Definition at line 40 of file dec_tensor.f90.

40  TYPE(coolist), DIMENSION(:), ALLOCATABLE, PUBLIC :: bxxy !< Tensor holding the quadratic part of the resolved tendencies involving both resolved and unresolved variables
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
type(coolist), dimension(:), allocatable, public dec_tensor::bxyy

Tensor holding the quadratic part of the resolved tendencies involving unresolved variables.

Definition at line 41 of file dec_tensor.f90.

41  TYPE(coolist), DIMENSION(:), ALLOCATABLE, PUBLIC :: bxyy !< Tensor holding the quadratic part of the resolved tendencies involving unresolved variables
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
type(coolist), dimension(:), allocatable, public dec_tensor::byxx

Tensor holding the quadratic part of the unresolved tendencies involving resolved variables.

Definition at line 46 of file dec_tensor.f90.

46  TYPE(coolist), DIMENSION(:), ALLOCATABLE, PUBLIC :: byxx !< Tensor holding the quadratic part of the unresolved tendencies involving resolved variables
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
type(coolist), dimension(:), allocatable, public dec_tensor::byxy

Tensor holding the quadratic part of the unresolved tendencies involving both resolved and unresolved variables.

Definition at line 47 of file dec_tensor.f90.

47  TYPE(coolist), DIMENSION(:), ALLOCATABLE, PUBLIC :: byxy !< Tensor holding the quadratic part of the unresolved tendencies involving both resolved and unresolved variables
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
type(coolist), dimension(:), allocatable, public dec_tensor::byyy

Tensor holding the quadratic part of the unresolved tendencies involving unresolved variables.

Definition at line 48 of file dec_tensor.f90.

48  TYPE(coolist), DIMENSION(:), ALLOCATABLE, PUBLIC :: byyy !< Tensor holding the quadratic part of the unresolved tendencies involving unresolved variables
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
type(coolist), dimension(:), allocatable dec_tensor::dumb
private

Dumb coolist to make the computations.

Definition at line 53 of file dec_tensor.f90.

53  TYPE(coolist), DIMENSION(:), ALLOCATABLE :: dumb !< Dumb coolist to make the computations
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
type(coolist), dimension(:), allocatable, public dec_tensor::ff_tensor

Tensor holding the part of the unresolved tensor involving only unresolved variables.

Definition at line 31 of file dec_tensor.f90.

31  TYPE(coolist), DIMENSION(:), ALLOCATABLE, PUBLIC :: ff_tensor !< Tensor holding the part of the unresolved tensor involving only unresolved variables
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
type(coolist), dimension(:), allocatable, public dec_tensor::fs_tensor

Tensor holding the part of the unresolved tensor involving resolved variables.

Definition at line 34 of file dec_tensor.f90.

34  TYPE(coolist), DIMENSION(:), ALLOCATABLE, PUBLIC :: fs_tensor !< Tensor holding the part of the unresolved tensor involving resolved variables
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
type(coolist), dimension(:), allocatable, public dec_tensor::hx

Tensor holding the constant part of the resolved tendencies.

Definition at line 36 of file dec_tensor.f90.

36  TYPE(coolist), DIMENSION(:), ALLOCATABLE, PUBLIC :: hx !< Tensor holding the constant part of the resolved tendencies
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
type(coolist), dimension(:), allocatable, public dec_tensor::hy

Tensor holding the constant part of the unresolved tendencies.

Definition at line 43 of file dec_tensor.f90.

43  TYPE(coolist), DIMENSION(:), ALLOCATABLE, PUBLIC :: hy !< Tensor holding the constant part of the unresolved tendencies
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
type(coolist), dimension(:), allocatable, public dec_tensor::lxx

Tensor holding the linear part of the resolved tendencies involving the resolved variables.

Definition at line 37 of file dec_tensor.f90.

37  TYPE(coolist), DIMENSION(:), ALLOCATABLE, PUBLIC :: lxx !< Tensor holding the linear part of the resolved tendencies involving the resolved variables
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
type(coolist), dimension(:), allocatable, public dec_tensor::lxy

Tensor holding the linear part of the resolved tendencies involving the unresolved variables.

Definition at line 38 of file dec_tensor.f90.

38  TYPE(coolist), DIMENSION(:), ALLOCATABLE, PUBLIC :: lxy !< Tensor holding the linear part of the resolved tendencies involving the unresolved variables
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
type(coolist), dimension(:), allocatable, public dec_tensor::lyx

Tensor holding the linear part of the unresolved tendencies involving the resolved variables.

Definition at line 44 of file dec_tensor.f90.

44  TYPE(coolist), DIMENSION(:), ALLOCATABLE, PUBLIC :: lyx !< Tensor holding the linear part of the unresolved tendencies involving the resolved variables
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
type(coolist), dimension(:), allocatable, public dec_tensor::lyy

Tensor holding the linear part of the unresolved tendencies involving the unresolved variables.

Definition at line 45 of file dec_tensor.f90.

45  TYPE(coolist), DIMENSION(:), ALLOCATABLE, PUBLIC :: lyy !< Tensor holding the linear part of the unresolved tendencies involving the unresolved variables
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
type(coolist), dimension(:), allocatable, public dec_tensor::sf_tensor

Tensor holding the part of the resolved tensor involving unresolved variables.

Definition at line 32 of file dec_tensor.f90.

32  TYPE(coolist), DIMENSION(:), ALLOCATABLE, PUBLIC :: sf_tensor !< Tensor holding the part of the resolved tensor involving unresolved variables
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
type(coolist), dimension(:), allocatable, public dec_tensor::ss_tensor

Tensor holding the part of the resolved tensor involving only resolved variables.

Definition at line 33 of file dec_tensor.f90.

33  TYPE(coolist), DIMENSION(:), ALLOCATABLE, PUBLIC :: ss_tensor !< Tensor holding the part of the resolved tensor involving only resolved variables
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38
type(coolist), dimension(:), allocatable, public dec_tensor::ss_tl_tensor

Tensor of the tangent linear model tendencies of the resolved component alone.

Definition at line 50 of file dec_tensor.f90.

50  TYPE(coolist), DIMENSION(:), ALLOCATABLE, PUBLIC :: ss_tl_tensor !< Tensor of the tangent linear model tendencies of the resolved component alone
Coordinate list. Type used to represent the sparse tensor.
Definition: tensor.f90:38