Changeset 2436 for trunk/LMDZ.GENERIC/libf
- Timestamp:
- Nov 25, 2020, 7:24:05 PM (4 years ago)
- Location:
- trunk/LMDZ.GENERIC/libf/phystd
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.GENERIC/libf/phystd/dyn1d/kcm1d.F90
r1714 r2436 90 90 real :: latitude(1), longitude(1), cell_area(1), phisfi(1) 91 91 92 ! added by JVO and YJ to read modern traceur.def 93 character(len=500) :: line ! to store a line of text 94 LOGICAL :: moderntracdef=.false. ! JVO, YJ : modern traceur.def 95 92 96 ! -------------- 93 97 ! Initialisation … … 162 166 write(*,*) "kcm1d: Reading file traceur.def" 163 167 ! read number of tracers: 164 read(90,*,iostat=ierr) nq 168 !! - Modif. by JVO and YJ for modern planetary traceur.def --------------- 169 READ(90,'(A)') line 170 IF (trim(line).ne.'#ModernTrac-v1') THEN ! Test modern traceur.def 171 READ(line,*,iostat=ierr) nq ! Try standard traceur.def 172 ELSE 173 moderntracdef = .true. 174 DO 175 READ(90,'(A)',iostat=ierr) line 176 IF (ierr.eq.0) THEN 177 IF (index(line,'#').ne.1) THEN ! Allows arbitary number of comments lines in the header 178 READ(line,*,iostat=ierr) nq 179 EXIT 180 ENDIF 181 ELSE ! If pb, or if reached EOF without having found nbtr 182 write(*,*) "rcm1d: error reading number of tracers" 183 write(*,*) " (first line of traceur.def) " 184 stop 185 ENDIF 186 ENDDO 187 ENDIF ! if modern or standard traceur.def 165 188 if (ierr.ne.0) then 166 189 write(*,*) "kcm1d: error reading number of tracers" … … 184 207 endif 185 208 enddo !of do iq=1,nq 209 close(90) 186 210 endif 187 211 -
trunk/LMDZ.GENERIC/libf/phystd/dyn1d/rcm1d.F
r2354 r2436 144 144 real :: latitude(1), longitude(1), cell_area(1) 145 145 146 ! added by JVO and YJ to read modern traceur.def 147 character(len=500) :: line ! to store a line of text 148 LOGICAL :: moderntracdef=.false. ! JVO, YJ : modern traceur.def 149 146 150 c======================================================================= 147 151 c INITIALISATION … … 152 156 & iostat=ierr) 153 157 if (ierr.eq.0) then 154 read(90,*,iostat=ierr) nq 158 ! read number of tracers: 159 !! - Modif. by JVO and YJ for modern planetary traceur.def --------------- 160 READ(90,'(A)') line 161 IF (trim(line).ne.'#ModernTrac-v1') THEN ! Test modern traceur.def 162 READ(line,*,iostat=ierr) nq ! Try standard traceur.def 163 ELSE 164 moderntracdef = .true. 165 DO 166 READ(90,'(A)',iostat=ierr) line 167 IF (ierr.eq.0) THEN 168 IF (index(line,'#').ne.1) THEN ! Allows arbitary number of comments lines in the header 169 READ(line,*,iostat=ierr) nq 170 EXIT 171 ENDIF 172 ELSE ! If pb, or if reached EOF without having found nbtr 173 write(*,*) "rcm1d: error reading number of tracers" 174 write(*,*) " (first line of traceur.def) " 175 stop 176 ENDIF 177 ENDDO 178 ENDIF ! if modern or standard traceur.def 155 179 else 156 180 nq=0 … … 243 267 write(*,*) "rcm1d: Reading file traceur.def" 244 268 ! read number of tracers: 245 read(90,*,iostat=ierr) nq 269 !! - Modif. by JVO and YJ for modern planetary traceur.def --------------- 270 READ(90,'(A)') line 271 IF (trim(line).ne.'#ModernTrac-v1') THEN ! Test modern traceur.def 272 READ(line,*,iostat=ierr) nq ! Try standard traceur.def 273 ELSE 274 moderntracdef = .true. 275 DO 276 READ(90,'(A)',iostat=ierr) line 277 IF (ierr.eq.0) THEN 278 IF (index(line,'#').ne.1) THEN ! Allows arbitary number of comments lines in the header 279 READ(line,*,iostat=ierr) nq 280 EXIT 281 ENDIF 282 ELSE ! If pb, or if reached EOF without having found nbtr 283 write(*,*) "rcm1d: error reading number of tracers" 284 write(*,*) " (first line of traceur.def) " 285 stop 286 ENDIF 287 ENDDO 288 ENDIF ! if modern or standard traceur.def 246 289 nqtot=nq ! set value of nqtot (in infotrac module) as nq 247 290 if (ierr.ne.0) then -
trunk/LMDZ.GENERIC/libf/phystd/initracer.F
r2278 r2436 20 20 c ------ 21 21 c Ehouarn Millour (oct. 2008) identify tracers by their names 22 c Y Jaziri & J. Vatant d'Ollone (2020) : Modern traceur.def 22 23 c======================================================================= 23 24 … … 25 26 character(len=30),intent(in) :: nametrac(nq) ! name of the tracer from dynamics 26 27 27 character(len= 30) :: txt ! to store some text28 integer iq,ig,count29 real r0_lift , reff_lift28 character(len=500) :: tracline ! to read traceur.def lines 29 character(len=30) :: txt ! to store some text 30 integer iq,ig,count,ierr 30 31 31 32 … … 43 44 c----------------------------------------------------------------------- 44 45 46 moderntracdef=.false. ! For modern traceur.def (default false, old type) 47 48 open(407, form = 'formatted', status = 'old', 49 $ file = 'traceur.def', iostat=ierr) 50 if (ierr /=0) then 51 call abort_physic('initracer', 52 $ 'Problem in opening traceur.def',1) 53 end if 54 !! - Modif. by JVO and YJ for modern planetary traceur.def --------------- 55 READ(407,'(A)') tracline 56 IF (trim(tracline).ne.'#ModernTrac-v1') THEN ! Test modern traceur.def 57 READ(tracline,*) nqtot ! Try standard traceur.def 58 ELSE 59 moderntracdef = .true. 60 DO 61 READ(407,'(A)',iostat=ierr) tracline 62 IF (ierr==0) THEN 63 IF (index(tracline,'#').ne.1) THEN ! Allows arbitary number of comments lines in the header 64 READ(tracline,*) nqtot 65 ! Temporary not implemented solution 66 if (nqtot/=nq) then 67 call abort_physic('initracer','Different number of& 68 & tracers in dynamics and physics not managed yet',1) 69 endif 70 EXIT 71 ENDIF 72 ELSE ! If pb, or if reached EOF without having found nqtot 73 call abort_physic('initracer','Unable to read numbers& 74 & of tracers in traceur.def',1) 75 ENDIF 76 ENDDO 77 ENDIF ! if modern or standard traceur.def 78 !! ----------------------------------------------------------------------- 79 !! For the moment number of tracers in dynamics and physics are equal 45 80 nqtot=nq 46 81 !! we allocate once for all arrays in common in tracer_h.F90 … … 339 374 endif 340 375 376 ! Get data of tracers 377 do iq=1,nqtot 378 read(407,'(A)') tracline 379 call get_tracdat(iq, tracline) 380 enddo 381 382 close(407) 341 383 342 384 c------------------------------------------------------------ … … 410 452 write(*,*) 411 453 454 contains 455 456 subroutine get_tracdat(iq,tracline) 457 !-------------------ADDING NEW OPTIONS------------------- 458 ! Duplicate if sentence for adding new options 459 ! Do not forget to add the new variables in tracer_h.F90 460 ! Do not forget to allocate and initialize the new variables above 461 ! Please update list of options in "LMDZ.GENERIC/deftank/traceur.def.modern" 462 !------------------------------------------------------- 463 use tracer_h 464 implicit none 465 integer, intent(in) :: iq ! tracer index 466 character(len=500),intent(in) :: tracline ! traceur.def lines with parameters 467 468 read(tracline,*) noms(iq) 469 ! JVO 20 : We should add a sanity check aborting when duplicates in names ! 470 write(*,*)"initracer: iq=",iq,"noms(iq)=",trim(noms(iq)) 471 if (index(tracline,'mmol=' ) /= 0) then 472 read(tracline(index(tracline,'mmol=')+len('mmol='):),*) 473 $ mmol(iq) 474 write(*,*) ' Parameter value (traceur.def) : mmol=', 475 $ mmol(iq) 476 else 477 write(*,*) ' Parameter value (default) : mmol=', 478 $ mmol(iq) 479 end if 480 end subroutine get_tracdat 481 412 482 end 483 -
trunk/LMDZ.GENERIC/libf/phystd/tracer_h.F90
r1980 r2436 6 6 integer, save :: nqtot ! total number of tracers 7 7 !$OMP THREADPRIVATE(nqtot) 8 9 logical :: moderntracdef=.false. ! Standard or modern traceur.def 10 !$OMP THREADPRIVATE(moderntracdef) 8 11 9 12 character*30, save, allocatable :: noms(:) ! name of the tracer
Note: See TracChangeset
for help on using the changeset viewer.