The TELEMAC-MASCARET system  trunk
sor3d.f
Go to the documentation of this file.
1 ! ****************
2  SUBROUTINE sor3d
3 ! ****************
4 !
5  &(f,ndire,nf,npoin2,vent,couran,maree,titre,tra01,mesh3d)
6 !
7 !***********************************************************************
8 ! TOMAWAC V6P3 28/06/2011
9 !***********************************************************************
10 !
11 !brief WRITES DATA NECESSARY TO RESUME COMPUTATION
12 !+ AT A LATER DATE.
13 !
14 !history F MARCOS (LNH)
15 !+ 01/02/95
16 !+ V1P0
17 !+
18 !
19 !history N.DURAND (HRW), S.E.BOURBAN (HRW)
20 !+ 13/07/2010
21 !+ V6P0
22 !+ Translation of French comments within the FORTRAN sources into
23 !+ English comments
24 !
25 !history N.DURAND (HRW), S.E.BOURBAN (HRW)
26 !+ 21/08/2010
27 !+ V6P0
28 !+ Creation of DOXYGEN tags for automated documentation and
29 !+ cross-referencing of the FORTRAN sources
30 !
31 !history G.MATTAROLO (EDF - LNHE)
32 !+ 28/06/2011
33 !+ V6P1
34 !+ Translation of French names of the variables in argument
35 !
36 !history J-M HERVOUET (EDF - LNHE)
37 !+ 26/11/2012
38 !+ V6P3
39 !+ Correction of bugs and double precision.
40 !
41 !history Y AUDOUIN (LNHE)
42 !+ 25/05/2015
43 !+ V7P0
44 !+ Modification to comply with the hermes module
45 !
46 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47 !| AT |-->| COMPUTATION TIME
48 !| FMTR3D |-->| GLOBAL RESULT FILE FORMAT
49 !| COURAN |-->| LOGICAL INDICATING IF THERE IS A CURRENT
50 !| F |-->| VARIANCE DENSITY DIRECTIONAL SPECTRUM
51 !| MAREE |-->| LOGICAL INDICATING CONSIDERATION OF TIDE
52 !| MESH3D |-->| MESH STRUCTURE IN 3D (I.E. INCLUDING DIRECTIONS)
53 !| NF |-->| NUMBER OF FREQUENCIES
54 !| NDIRE |-->| NUMBER OF DIRECTIONS
55 !| NPOIN2 |-->| NUMBER OF POINTS IN 2D MESH
56 !| NR3D |-->| LOGICAL UNIT NUMBER OF GLOBAL RESULT FILE
57 !| TITRE |-->| TITLE
58 !| TRA01 |-->| DOUBLE PRECISION WORK TABLE OF SIZE NPOIN2*NDIRE
59 !| VENT |-->| INDICATES IF WIND IS TAKEN INTO ACCOUNT
60 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61 !
62  USE bief
64 !
66  & fmtrbi,at, uc, vc, uv, vv, depth
68  IMPLICIT NONE
69 !
70 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
71 !
72  INTEGER, INTENT(IN) :: NF,NDIRE,NPOIN2
73  DOUBLE PRECISION, INTENT(IN) :: F(npoin2,ndire,nf)
74  DOUBLE PRECISION, INTENT(INOUT) :: TRA01(npoin2*ndire)
75  LOGICAL, INTENT(IN) :: COURAN,VENT,MAREE
76  CHARACTER(LEN=80), INTENT(IN) :: TITRE
77  TYPE(bief_mesh), INTENT(IN) :: MESH3D
78 !
79 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
80 !
81  INTEGER ISTAT,I,IIF
82 !
83  INTEGER, PARAMETER :: NFMAX = 999
84  LOGICAL, ALLOCATABLE :: SORLEO(:)
85  CHARACTER(LEN=32), ALLOCATABLE :: TEXTE(:)
86 !
87  INTEGER :: DATE(3),TIME(3)
88  parameter( date = (/ 0,0,0 /) )
89  parameter( time = (/ 0,0,0 /) )
90 !
91 !***********************************************************************
92 !
93  ALLOCATE(sorleo(nf+2))
94  ALLOCATE(texte(nf+2))
95  DO i=1,nf
96  sorleo(i)=.true.
97  texte(i)='FREQUENCY 000 '
98  IF(i.LT.10) THEN
99  WRITE(texte(i)(13:13),'(I1)') i
100  ELSEIF(i.LT.100) THEN
101  WRITE(texte(i)(12:13),'(I2)') i
102  ELSEIF(i.LT.nfmax+1) THEN
103  WRITE(texte(i)(11:13),'(I3)') i
104  ELSE
105  WRITE(lu,*) 'SOR3D: PARAMETER NFMAX MUST BE'
106  WRITE(lu,*) ' INCREASED TO AT LEAST ',nf
107  CALL plante(1)
108  stop
109  ENDIF
110  ENDDO
111 !
112  DO i=1,npoin2*ndire
113  mesh3d%Z%R(i)=0.d0
114  ENDDO
115  sorleo(nf+1)=.true.
116  texte(nf+1)='DEPTH '
117  texte(nf+2)='CURRENT-WIND '
118  IF(couran.OR.vent) THEN
119  sorleo(nf+2)=.true.
120  ELSE
121  sorleo(nf+2)=.false.
122  ENDIF
123 !
124 ! CREATES THE DATA FILE USING A GIVEN FILE FORMAT
125 ! THE DATA ARE CREATED IN THE FILE: NRES, AND IS
126 ! CHARACTERISED BY A TITLE AND NAME OF OUTPUT VARIABLES
127 ! CONTAINED IN THE FILE.
128 !
129  CALL write_header(fmtrbi, ! RESULTS FILE FORMAT
130  & lurbi, ! LU FOR RESULTS FILE
131  & titre, ! TITLE
132  & nf+2, ! MAX NUMBER OF OUTPUT VARIABLES
133  & texte, ! NAMES OF OUTPUT VARIABLES
134  & sorleo) ! PRINT TO FILE OR NOT
135 !
136 ! WRITES THE MESH IN THE OUTPUT FILE
137 !
138  CALL write_mesh(fmtrbi, ! RESULTS FILE FORMAT
139  & lurbi, ! LU FOR RESULTS FILE
140  & mesh3d,
141  & ndire, ! NUMBER OF PLANES
142  & date, ! START DATE
143  & time, ! START TIME
144  & stra31,stra32,
145  & ncsize.GT.1, nptir,
146  & ngeo=lugeo,
147  & geoformat=fmtgeo)
148 !
149 ! WRITES TIME
150 !
151 ! WRITES DATA INFORMATION
152 !
153 ! WRITES F
154 !
155  DO iif=1,nf
156  CALL add_data(fmtrbi,lurbi,texte(iif),at,0,iif.EQ.1,f(1,1,iif),
157  & npoin2*ndire,istat)
158  ENDDO
159 !
160 ! WRITES DEPTH
161 !
162  IF(maree) THEN
163  DO i=1,npoin2
164  tra01(i)=depth(i)
165  ENDDO
166  ENDIF
167 !
168 ! HERE TRA01 MAY BE WRITTEN FOR NOTHING (AND NOT INITIALISED)
169 ! THIS IS NECESSARY TO HAVE A REAL SERAFIN FORMAT
170 !
171  CALL add_data(fmtrbi,lurbi,texte(nf+1),at,0,.false.,tra01,
172  & npoin2*ndire,istat)
173 !
174 ! WRITES U,V,UV,VV (IF HAS TO)
175 !
176  IF(vent.AND.ndire.LT.4) THEN
177  WRITE(lu,*) 'SOR3D: NDIRE MUST BE GREATER THAN 3'
178  CALL plante(1)
179  stop
180  ENDIF
181  IF(couran.AND.ndire.LT.2) THEN
182  WRITE(lu,*) 'SOR3D: NDIRE MUST BE GREATER THAN 1'
183  CALL plante(1)
184  stop
185  ENDIF
186 !
187  IF(couran) THEN
188  DO i=1,npoin2
189  tra01(i)=uc(i)
190  tra01(i+npoin2)=vc(i)
191  ENDDO
192  ENDIF
193 !
194  IF(vent) THEN
195  DO i=1,npoin2
196  tra01(i+2*npoin2)=uv(i)
197  tra01(i+3*npoin2)=vv(i)
198  ENDDO
199  ENDIF
200 !
201  IF(couran.OR.vent) THEN
202  CALL add_data(fmtrbi,lurbi,texte(nf+2),at,0,.false.,tra01,
203  & npoin2*ndire,istat)
204  ENDIF
205 !
206 !-----------------------------------------------------------------------
207 !
208  RETURN
209  END
character(len=8), pointer fmtgeo
subroutine write_mesh(FFORMAT, NFILE, MESH, NPLAN, DATE, TIME, T1, T2, PARALL, NPTIR, NGEO, GEOFORMAT, LATLONG)
Definition: write_mesh.f:8
subroutine add_data(FFORMAT, FILE_ID, VAR_NAME, TIME, RECORD, FIRST_VAR, VAR_VALUE, N, IERR)
Definition: add_data.f:8
type(bief_obj), target stra31
type(bief_obj), target stra32
subroutine write_header(FFORMAT, NRES, TITLE, NVAR, NOMVAR, OUTVAR)
Definition: write_header.f:7
subroutine sor3d(F, NDIRE, NF, NPOIN2, VENT, COURAN, MAREE, TITRE, TRA01, MESH3D)
Definition: sor3d.f:7
Definition: bief.f:3