2 MODULE Auxiliar_Procedures
4 INTEGER, SAVE :: AISO
!AISO=0, Anisotropic EZZ and ESUM
5 INTEGER, SAVE :: MTYPE
!MTYPE: 1-> ZBI, 2-> WZI, 3-> WZA
9 SUBROUTINE Param_Var(Ind_Par
,Dep_Par
,Step
,Relation
)
12 REAL, INTENT(INOUT
) :: Ind_Par
13 REAL, OPTIONAL
, INTENT(INOUT
) :: Dep_Par
14 REAL, INTENT(IN
) :: Step
15 CHARACTER (LEN
= * ), INTENT(IN
) :: Relation
18 SELECT
CASE (TRIM(Relation
))
22 Ind_Par
= Ind_Par
+ Step
25 IF(.NOT
. PRESENT(Dep_Par
) ) THEN
26 write(6,*)"Box_Size error. Optional argument Dep_Par Needed!"
29 Dep_Par
= Dep_Par
/Ind_Par
* (Ind_Par
+Step
)
30 Ind_Par
= Ind_Par
+ Step
34 IF(.NOT
. PRESENT(Dep_Par
) ) THEN
35 write(6,*)"Box_Size error. Optional argument Dep_Par Needed!"
38 Dep_Par
= Dep_Par
+ Step
39 Ind_Par
= Ind_Par
+ Step
45 END SUBROUTINE Param_Var
48 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
49 ! Integration: Simpson's method (version REAL) !
51 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
53 REAL FUNCTION RSIMPSON(F
,XINC
,NX
)
56 !!!!! variables 'dummy' y variables internas !!!!!!!!!!!!!!!!!!!!!!!!!!!
63 RSIMPSON
= RSIMPSON
+F(I
)
66 RSIMPSON
= 2.E0
*RSIMPSON
69 RSIMPSON
= RSIMPSON
+F(I
)
72 RSIMPSON
= 2.E0
*RSIMPSON
+F(0)+F(NX
)
73 RSIMPSON
= XINC
*RSIMPSON
/3.E0
79 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
81 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
83 INTEGER FUNCTION IDELTA(I
,J
)
86 !!!!! 'dummy' and local variables !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
97 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
99 ! Internal subroutine - checks error status after each netcdf, prints out text message each time
100 ! an error code is returned.
101 SUBROUTINE check(status
)
102 USE NETCDF
, ONLY
: nf90_noerr
, nf90_strerror
103 integer, intent ( in
) :: status
105 if(status
/= nf90_noerr
) then
106 print *, trim(nf90_strerror(status
))
110 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
112 !! Subrutina para cambiar el nombre de un archivo existente y asi evitar !!
113 !! sobrescribirlo. !!
115 !! ARCH: cadena con el nombre de archivo original. !!
116 !! Mira la longitud de la variable por si admite un contador de cuatro !!
117 !! digitos "_XXX". Si lo admite le añade al nombre de archivo ese contador. !!
118 !! Si no lo admite sustrae un caracter y le añade un contador simple "X". !!
120 !! Ver: 1.0 Date: 17/04/03 !!
122 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
124 SUBROUTINE OPEN_OVER(ARCH
)
127 CHARACTER (LEN
=*) :: ARCH
128 CHARACTER (LEN
=120) :: ARCH_TMP
132 INQUIRE(FILE
=TRIM(ARCH
),EXIST
=EX_FILE
)
133 IF (.NOT
.EX_FILE
) RETURN
135 IF(LEN(ARCH
).LT
.(LEN_TRIM(ARCH
)+4)) THEN
139 WRITE(ARCH_TMP
,'(A,I1)')ARCH(1:LEN(ARCH
)-1),I
140 INQUIRE(FILE
=TRIM(ARCH_TMP
),EXIST
=EX_FILE
)
141 IF (.NOT
.EX_FILE
) THEN
143 WRITE(0,*)"Error. Trying to overwrite a file"
144 WRITE(0,'(T5,A,A)')"FILE NAME CHANGED TO: ",TRIM(ARCH
)
156 WRITE(ARCH_TMP
,'(A,"_",I3.3)')TRIM(ARCH
),I
157 INQUIRE(FILE
=TRIM(ARCH_TMP
),EXIST
=EX_FILE
)
158 IF (.NOT
.EX_FILE
) THEN
160 WRITE(0,*)"Error. Trying to overwrite a file"
161 WRITE(0,'(T5,A,A)')"FILE NAME CHANGED TO: ",TRIM(ARCH
)
171 END SUBROUTINE OPEN_OVER
173 END MODULE Auxiliar_Procedures