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

Module to select the resolved-unresolved components. More...

Functions/Subroutines

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). More...
 

Variables

logical exists
 Boolean to test for file existence. More...
 
integer, dimension(:), allocatable, public sf
 Unresolved variable definition vector. More...
 
integer, dimension(:), allocatable, public ind
 
integer, dimension(:), allocatable, public rind
 Unresolved reduction indices. More...
 
integer, dimension(:), allocatable, public sl_ind
 
integer, dimension(:), allocatable, public sl_rind
 Resolved reduction indices. More...
 
integer, public n_unres
 Number of unresolved variables. More...
 
integer, public n_res
 Number of resolved variables. More...
 
integer, dimension(:,:), allocatable, public bar
 
integer, dimension(:,:), allocatable, public bau
 
integer, dimension(:,:), allocatable, public bor
 
integer, dimension(:,:), allocatable, public bou
 Filter matrices. More...
 

Detailed Description

Module to select the resolved-unresolved components.

Function/Subroutine Documentation

subroutine, public sf_def::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 at line 37 of file sf_def.f90.

37  INTEGER :: i,allocstat,n,ns
38  CHARACTER(len=20) :: fm
39 
40  namelist /sflist/ sf
41 
42  fm(1:6)='(F3.1)'
43 
44  IF (ndim == 0) stop "*** Number of dimensions is 0! ***"
45  ALLOCATE(sf(0:ndim), stat=allocstat)
46  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
47 
48  INQUIRE(file='./SF.nml',exist=exists)
49 
50  IF (exists) THEN
51  OPEN(8, file="SF.nml", status='OLD', recl=80, delim='APOSTROPHE')
52  READ(8,nml=sflist)
53  CLOSE(8)
54  n_unres=0
55  DO i=1,ndim ! Computing the number of unresolved variables
56  IF (sf(i)==1) n_unres=n_unres+1
57  ENDDO
58  IF (n_unres==0) stop "*** No unresolved variable specified! ***"
59  n_res=ndim-n_unres
60  ALLOCATE(ind(n_unres), rind(0:ndim), sl_ind(n_res), sl_rind(0:ndim), stat=allocstat)
61  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
62  ALLOCATE(bar(0:ndim,0:ndim), bau(0:ndim,0:ndim), bor(0:ndim,0:ndim), bou(0:ndim,0:ndim), stat=allocstat)
63  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
64  rind=0
65  n=1
66  ns=1
67  DO i=1,ndim
68  IF (sf(i)==1) THEN
69  ind(n)=i
70  rind(i)=n
71  n=n+1
72  ELSE
73  sl_ind(ns)=i
74  sl_rind(i)=ns
75  ns=ns+1
76  ENDIF
77  ENDDO
78  bar=0
79  bau=0
80  bor=0
81  bou=0
82  DO i=1,2*natm
83  IF (sf(i)==1) THEN
84  bau(i,i)=1
85  ELSE
86  bar(i,i)=1
87  ENDIF
88  ENDDO
89  DO i=2*natm+1,ndim
90  IF (sf(i)==1) THEN
91  bou(i,i)=1
92  ELSE
93  bor(i,i)=1
94  ENDIF
95  ENDDO
96  ELSE
97  OPEN(8, file="SF.nml", status='NEW')
98  WRITE(8,'(a)') "!------------------------------------------------------------------------------!"
99  WRITE(8,'(a)') "! Namelist file : !"
100  WRITE(8,'(a)') "! Unresolved variables specification (1 -> unresolved, 0 -> resolved) !"
101  WRITE(8,'(a)') "!------------------------------------------------------------------------------!"
102  WRITE(8,*) ""
103  WRITE(8,'(a)') "&SFLIST"
104  WRITE(8,*) " ! psi variables"
105  DO i=1,natm
106  WRITE(8,*) " SF("//trim(str(i))//") = 0"//" ! typ= "&
107  &//awavenum(i)%typ//", Nx= "//trim(rstr(awavenum(i)&
108  &%Nx,fm))//", Ny= "//trim(rstr(awavenum(i)%Ny,fm))
109  END DO
110  WRITE(8,*) " ! theta variables"
111  DO i=1,natm
112  WRITE(8,*) " SF("//trim(str(i+natm))//") = 0"//" ! typ= "&
113  &//awavenum(i)%typ//", Nx= "//trim(rstr(awavenum(i)&
114  &%Nx,fm))//", Ny= "//trim(rstr(awavenum(i)%Ny,fm))
115  END DO
116 
117  WRITE(8,*) " ! A variables"
118  DO i=1,noc
119  WRITE(8,*) " SF("//trim(str(i+2*natm))//") = 0"//" ! Nx&
120  &= "//trim(rstr(owavenum(i)%Nx,fm))//", Ny= "&
121  &//trim(rstr(owavenum(i)%Ny,fm))
122  END DO
123  WRITE(8,*) " ! T variables"
124  DO i=1,noc
125  WRITE(8,*) " SF("//trim(str(i+noc+2*natm))//") = 0"//" &
126  &! Nx= "//trim(rstr(owavenum(i)%Nx,fm))//", Ny= "&
127  &//trim(rstr(owavenum(i)%Ny,fm))
128  END DO
129 
130  WRITE(8,'(a)') "&END"
131  WRITE(8,*) ""
132  CLOSE(8)
133  stop "*** SF.nml namelist written. Fill in the file and rerun !***"
134  ENDIF
integer ndim
Number of variables (dimension of the model)
Definition: params.f90:85
Statistics accumulators.
Definition: stat.f90:14
integer, dimension(:), allocatable, public sf
Unresolved variable definition vector.
Definition: sf_def.f90:23

Variable Documentation

integer, dimension(:,:), allocatable, public sf_def::bar

Definition at line 28 of file sf_def.f90.

28  INTEGER, DIMENSION(:,:), ALLOCATABLE, PUBLIC :: bar,bau,bor,bou !< Filter matrices
integer, dimension(:,:), allocatable, public sf_def::bau

Definition at line 28 of file sf_def.f90.

integer, dimension(:,:), allocatable, public sf_def::bor

Definition at line 28 of file sf_def.f90.

integer, dimension(:,:), allocatable, public sf_def::bou

Filter matrices.

Definition at line 28 of file sf_def.f90.

logical sf_def::exists
private

Boolean to test for file existence.

Definition at line 21 of file sf_def.f90.

21  LOGICAL :: exists !< Boolean to test for file existence.
integer, dimension(:), allocatable, public sf_def::ind

Definition at line 24 of file sf_def.f90.

24  INTEGER, DIMENSION(:), ALLOCATABLE, PUBLIC :: ind,rind !< Unresolved reduction indices
integer, public sf_def::n_res

Number of resolved variables.

Definition at line 27 of file sf_def.f90.

27  INTEGER, PUBLIC :: n_res !< Number of resolved variables
integer, public sf_def::n_unres

Number of unresolved variables.

Definition at line 26 of file sf_def.f90.

26  INTEGER, PUBLIC :: n_unres !< Number of unresolved variables
integer, dimension(:), allocatable, public sf_def::rind

Unresolved reduction indices.

Definition at line 24 of file sf_def.f90.

integer, dimension(:), allocatable, public sf_def::sf

Unresolved variable definition vector.

Definition at line 23 of file sf_def.f90.

23  INTEGER, DIMENSION(:), ALLOCATABLE, PUBLIC :: sf !< Unresolved variable definition vector
integer, dimension(:), allocatable, public sf
Unresolved variable definition vector.
Definition: sf_def.f90:23
integer, dimension(:), allocatable, public sf_def::sl_ind

Definition at line 25 of file sf_def.f90.

25  INTEGER, DIMENSION(:), ALLOCATABLE, PUBLIC :: sl_ind,sl_rind !< Resolved reduction indices
integer, dimension(:), allocatable, public sf_def::sl_rind

Resolved reduction indices.

Definition at line 25 of file sf_def.f90.