4
5
6
7
8
9
10
11
12
13
14
15
18# ifdef ICE_MODEL
20# endif
23# if defined SEDIMENT || defined BBL_MODEL
25# endif
27
29
30 implicit none
31
32
33
34 logical, intent(in) :: Lwrite
35 integer, intent(in) :: model, inp, out
36
37
38
39 integer :: Mstation, Npts, Nval
40 integer :: flag, i, igrid, ista, itrc, ng, status
41
42 real(r8) :: Xpos, Ypos
43
44 logical, dimension(Ngrids) :: Lswitch
45 logical, dimension(MT,Ngrids) :: Ltracer
46
47 integer, dimension(Ngrids) :: is
48
49 real(dp), dimension(nRval) :: Rval
50
51 character (len=40 ) :: KeyWord
52 character (len=256) :: line
53 character (len=256), dimension(nCval) :: Cval
54
55
56
57
58
59 DO WHILE (.true.)
60 READ (inp,
'(a)',
err=20,
END=30) line
62 IF (status.gt.0) THEN
63 SELECT CASE (trim(keyword))
64 CASE ('Lstations')
66 CASE ('Sout(idUvel)')
69 CASE ('Sout(idVvel)')
72 CASE ('Sout(idu3dE)')
75 CASE ('Sout(idv3dN)')
78 CASE ('Sout(idWvel)')
81 CASE ('Sout(idOvel)')
84 CASE ('Sout(idUbar)')
87 CASE ('Sout(idVbar)')
90 CASE ('Sout(idu2dE)')
93 CASE ('Sout(idv2dN)')
96 CASE ('Sout(idFsur)')
99# if defined SEDIMENT && defined SED_MORPH
100 CASE ('Sout(idBath)')
103# endif
104 CASE ('Sout(idTvar)')
109 END DO
110 END DO
111 CASE ('Sout(idUsms)')
114 CASE ('Sout(idVsms)')
117 CASE ('Sout(idUbms)')
120 CASE ('Sout(idVbms)')
123# ifdef BBL_MODEL
124 CASE ('Sout(idUbrs)')
127 CASE ('Sout(idVbrs)')
130 CASE ('Sout(idUbws)')
133 CASE ('Sout(idVbws)')
136 CASE ('Sout(idUbcs)')
139 CASE ('Sout(idVbcs)')
142 CASE ('Sout(idUbot)')
145 CASE ('Sout(idVbot)')
148 CASE ('Sout(idUbur)')
151 CASE ('Sout(idVbvr)')
154# endif
155# ifdef ICE_MODEL
156 CASE ('Sout(idUice)')
159 CASE ('Sout(idVice)')
162 CASE ('Sout(idUiER)')
165 CASE ('Sout(idViNR)')
168 CASE ('Sout(idAice)')
171 CASE ('Sout(idIage)')
174 CASE ('Sout(idHice)')
177 CASE ('Sout(idHmel)')
180 CASE ('Sout(idHsno)')
183 CASE ('Sout(idTice)')
186 CASE ('Sout(idISxx)')
189 CASE ('Sout(idISxy)')
192 CASE ('Sout(idISyy)')
195 CASE ('Sout(idIsst)')
198 CASE ('Sout(idIOmf)')
201 CASE ('Sout(idIOfv)')
204 CASE ('Sout(idIOmt)')
207 CASE ('Sout(idS0mk)')
210 CASE ('Sout(idT0mk)')
213 CASE ('Sout(idWdiv)')
216 CASE ('Sout(idW_fr)')
219 CASE ('Sout(idW_ai)')
222 CASE ('Sout(idW_ao)')
225 CASE ('Sout(idW_io)')
228 CASE ('Sout(idW_ro)')
231# endif
232# ifdef WEC_VF
233 CASE ('Sout(idWztw)')
236 CASE ('Sout(idWqsp)')
239 CASE ('Sout(idWbeh)')
242# endif
243# ifdef WEC
244 CASE ('Sout(idU2rs)')
247 CASE ('Sout(idV2rs)')
250 CASE ('Sout(idU3rs)')
253 CASE ('Sout(idV3rs)')
256 CASE ('Sout(idU2Sd)')
259 CASE ('Sout(idV2Sd)')
262 CASE ('Sout(idU3Sd)')
265 CASE ('Sout(idV3Sd)')
268 CASE ('Sout(idW3Sd)')
271 CASE ('Sout(idW3St)')
274# endif
275# ifdef WAVES_HEIGHT
276 CASE ('Sout(idWamp)')
279# endif
280# ifdef WAVES_LENGTH
281 CASE ('Sout(idWlen)')
284# endif
285# ifdef WAVES_LENGTHP
286 CASE ('Sout(idWlep)')
289# endif
290# ifdef WAVES_DIR
291 CASE ('Sout(idWdir)')
294# endif
295# ifdef WAVES_TOP_PERIOD
296 CASE ('Sout(idWptp)')
299# endif
300# ifdef WAVES_DIRP
301 CASE ('Sout(idWdip)')
304# endif
305# ifdef WAVES_BOT_PERIOD
306 CASE ('Sout(idWpbt)')
309# endif
310# if defined BBL_MODEL || defined BEDLOAD_SOULSBY || \
311 defined bedload_vandera || defined wav_coupling
312 CASE ('Sout(idWorb)')
315# endif
316# if defined WAV_COUPLING || (defined WEC_VF && defined BOTTOM_STREAMING)
317 CASE ('Sout(idWdif)')
320
321# endif
322# if defined TKE_WAVEDISS || defined WAV_COUPLING || \
323 defined wdiss_thorguza || defined wdiss_churthor || \
324 defined waves_diss || defined wdiss_inwave
325 CASE ('Sout(idWdib)')
328 CASE ('Sout(idWdiw)')
331# endif
332# if defined ROLLER_SVENDSEN
333 CASE ('Sout(idWbrk)')
336# endif
337# if defined WEC_ROLLER
338 CASE ('Sout(idWdis)')
341# endif
342# if defined ROLLER_RENIERS
343 CASE ('Sout(idWrol)')
346# endif
347# if defined WAVES_DSPR
348 CASE ('Sout(idWvds)')
351 CASE ('Sout(idWvqp)')
354# endif
355# ifdef SOLVE3D
356# if defined BULK_FLUXES || defined ECOSIM || defined ATM_PRESS
357 CASE ('Sout(idPair)')
360# endif
361# if defined BULK_FLUXES || defined ECOSIM
362 CASE ('Sout(idUair)')
365 CASE ('Sout(idVair)')
368# endif
369 CASE ('Sout(idTsur)')
374 END DO
375 END DO
376 CASE ('Sout(idLhea)')
379 CASE ('Sout(idShea)')
382 CASE ('Sout(idLrad)')
385 CASE ('Sout(idSrad)')
388 CASE ('Sout(idEmPf)')
391 CASE ('Sout(idevap)')
394 CASE ('Sout(idrain)')
397 CASE ('Sout(idDano)')
400 CASE ('Sout(idVvis)')
403 CASE ('Sout(idTdif)')
406 CASE ('Sout(idSdif)')
409 CASE ('Sout(idHsbl)')
412 CASE ('Sout(idHbbl)')
415 CASE ('Sout(idMtke)')
418 CASE ('Sout(idMtls)')
421# if defined BBL_MODEL || defined SEDIMENT
422 CASE ('Sout(isd50)')
426 sout(i,ng)=lswitch(ng)
427 END DO
428 CASE ('Sout(idens)')
432 sout(i,ng)=lswitch(ng)
433 END DO
434 CASE ('Sout(iwsed)')
438 sout(i,ng)=lswitch(ng)
439 END DO
440 CASE ('Sout(itauc)')
444 sout(i,ng)=lswitch(ng)
445 END DO
446 CASE ('Sout(irlen)')
450 sout(i,ng)=lswitch(ng)
451 END DO
452 CASE ('Sout(irhgt)')
456 sout(i,ng)=lswitch(ng)
457 END DO
458 CASE ('Sout(ibwav)')
462 sout(i,ng)=lswitch(ng)
463 END DO
464 CASE ('Sout(izdef)')
468 sout(i,ng)=lswitch(ng)
469 END DO
470 CASE ('Sout(izapp)')
474 sout(i,ng)=lswitch(ng)
475 END DO
476 CASE ('Sout(izNik)')
480 sout(i,ng)=lswitch(ng)
481 END DO
482 CASE ('Sout(izbio)')
486 sout(i,ng)=lswitch(ng)
487 END DO
488 CASE ('Sout(izbfm)')
492 sout(i,ng)=lswitch(ng)
493 END DO
494 CASE ('Sout(izbld)')
498 sout(i,ng)=lswitch(ng)
499 END DO
500 CASE ('Sout(izwbl)')
504 sout(i,ng)=lswitch(ng)
505 END DO
506 CASE ('Sout(iactv)')
510 sout(i,ng)=lswitch(ng)
511 END DO
512 CASE ('Sout(ishgt)')
516 sout(i,ng)=lswitch(ng)
517 END DO
518# endif
519# endif
520 CASE ('NSTATION')
525 ELSE
527 IF (
master)
WRITE (out,40) ng,
'Nstation', &
529 & 'Must be positive and greater than zero.'
531 RETURN
532 END IF
533 END IF
534 END DO
535 CASE ('POS')
542 END IF
543 END DO
545 DO WHILE (.true.)
546 READ (inp,*,
err=10,
END=10) igrid, flag, Xpos, ypos
547 ng=max(1,min(abs(igrid),
ngrids))
549 is(ng)=is(ng)+1
553 END IF
554 END DO
559 RETURN
560 END IF
561 END DO
562 END SELECT
563 END IF
564 END DO
565 20
IF (
master)
WRITE (out,60) line
567 RETURN
568 30 CONTINUE
569
570
571
572
573
574
575
576
577
581 END IF
582 END DO
583
584
585
586
590 END IF
593 END IF
594# ifdef SOLVE3D
597 END IF
600 END IF
601# endif
602 END DO
603
604
605
606
607
608 IF (
master.and.lwrite)
THEN
611 WRITE (out,70) ng
612 WRITE (out,80)
nstation(ng),
'Nstation', &
613 & 'Number of stations to write out into stations file.'
614#if defined SEDIMENT && defined SED_MORPH
616 & 'Sout(idbath)', &
617 & 'Write out free-surface.'
618#endif
620 & 'Sout(idFsur)', &
621 & 'Write out free-surface.'
623 & 'Sout(idUbar)', &
624 & 'Write out 2D U-momentum component.'
626 & 'Sout(idVbar)', &
627 & 'Write out 2D V-momentum component.'
629 & 'Sout(idu2dE)', &
630 & 'Write out 2D U-eastward at RHO-points.'
632 & 'Sout(idv2dN)', &
633 & 'Write out 2D V-northward at RHO-points.'
634# ifdef SOLVE3D
636 & 'Sout(idUvel)', &
637 & 'Write out 3D U-momentum component.'
639 & 'Sout(idVvel)', &
640 & 'Write out 3D V-momentum component.'
642 & 'Sout(idu3dE)', &
643 & 'Write out 3D U-eastward at RHO-points.'
645 & 'Sout(idv3dN)', &
646 & 'Write out 3D V-northward at RHO-points.'
648 & 'Sout(idWvel)', &
649 & 'Write out W-momentum component.'
651 & 'Sout(idOvel)', &
652 & 'Write out omega vertical velocity.'
656 &
'Write out tracer ', itrc, trim(
vname(1,
idtvar(itrc)))
657 END DO
658# endif
660 & 'Sout(idUsms)', &
661 & 'Write out surface U-momentum stress.'
663 & 'Sout(idVsms)', &
664 & 'Write out surface V-momentum stress.'
666 & 'Sout(idUbms)', &
667 & 'Write out bottom U-momentum stress.'
669 & 'Sout(idVbms)', &
670 & 'Write out bottom V-momentum stress.'
671# ifdef BBL_MODEL
673 & 'Sout(idUbrs)', &
674 & 'Write out bottom U-current stress.'
676 & 'Sout(idVbrs)', &
677 & 'Write out bottom V-current stress.'
679 & 'Sout(idUbws)', &
680 & 'Write out wind-induced, bottom U-wave stress.'
682 & 'Sout(idVbws)', &
683 & 'Write out wind-induced, bottom V-wave stress.'
685 & 'Sout(idUbcs)', &
686 & 'Write out max wind + current, bottom U-wave stress.'
688 & 'Sout(idVbcs)', &
689 & 'Write out max wind + current, bottom V-wave stress.'
691 & 'Sout(idUbot)', &
692 & 'Write out bed wave orbital U-velocity.'
694 & 'Sout(idVbot)', &
695 & 'Write out bed wave orbital V-velocity.'
697 & 'Sout(idUbur)', &
698 & 'Write out bottom U-velocity above bed.'
700 & 'Sout(idVbvr)', &
701 & 'Write out bottom V-velocity above bed.'
702# endif
703# ifdef ICE_MODEL
705 & 'Sout(idUice)', &
706 & 'Write out ice U-velocity component.'
708 & 'Sout(idVice)', &
709 & 'Write out ice V-velocity component.'
711 & 'Sout(idUiER)', &
712 & 'Write out ice Eastward velocity component at RHO-points.'
714 & 'Sout(idViNR)', &
715 & 'Write out ice Northward velocity component at RHO-points.'
717 & 'Sout(idAice)', &
718 & 'Write out ice concentration (fractional area coverage).'
720 & 'Sout(idIage)', &
721 & 'Write out age of ice.'
723 & 'Sout(idHice)', &
724 & 'Write out average ice thickness (ice mass per area).'
726 & 'Sout(idHmel)', &
727 & 'Write out surface melt water thickness on ice.'
729 & 'Sout(idHsno)', &
730 & 'Write out average snow coverage thickness.'
732 & 'Sout(idTice)', &
733 & 'Write out interior ice temperature.'
735 & 'Sout(idISxx)', &
736 & 'Write out internal ice stress tensor, xx-component.'
738 & 'Sout(idISxy)', &
739 & 'Write out internal ice stress tensor, xy-component.'
741 & 'Sout(idISyy)', &
742 & 'Write out internal ice stress tensor, yy-component.'
744 & 'Sout(idIsst)', &
745 & 'Write out ice/snow surface temperature.'
747 & 'Sout(idIOmf)', &
748 & 'Write out ice-ocean mass flux.'
750 & 'Sout(idIOfv)', &
751 & 'Write out ice-ocean friction velocity.'
753 & 'Sout(idIOmt)', &
754 & 'Write out ice-ocean momentum transfer coefficient.'
756 & 'Sout(idS0mk)', &
757 & 'Write out salinity of molecular sublayer under ice.'
759 & 'Sout(idT0mk)', &
760 & 'Write out temperature of molecular sublayer under ice.'
762 & 'Sout(idWdiv)', &
763 & 'Write out rate of ice divergence.'
765 & 'Sout(idW_fr)', &
766 & 'Write out rate of ice accretion by frazil ice growth.'
768 & 'Sout(idW_ai)', &
769 & 'Write out rate of melt/freeze at air/ice interface.'
771 & 'Sout(idW_ao)', &
772 & 'Write out rate of melt/freeze at air/ocean interface.'
774 & 'Sout(idW_io)', &
775 & 'Write out rate of melt/freeze at ice/ocean interface.'
777 & 'Sout(idW_ro)', &
778 & 'Write out rate of melt/freeze runoff into ocean.'
779# endif
780# ifdef WEC
782 & 'Sout(idU2rs)', &
783 & 'Write out 2D barotropic wec u-stress.'
785 & 'Sout(idV2rs)', &
786 & 'Write out 2D barotropic wec v-stress.'
788 & 'Sout(idU2Sd)', &
789 & 'Write out 2D barotropic Stokes u-velocity.'
791 & 'Sout(idV2Sd)', &
792 & 'Write out 2D barotropic Stokes v-velocity.'
793# endif
794# ifdef SOLVE3D
795# ifdef WEC
797 & 'Sout(idU3rs)', &
798 & 'Write out 3D total wec u-stress.'
800 & 'Sout(idV3rs)', &
801 & 'Write out 3D total wec v-stress.'
803 & 'Sout(idU3Sd)', &
804 & 'Write out 3D total wec Stokes u-velocity.'
806 & 'Sout(idV3Sd)', &
807 & 'Write out 3D total wec Stokes v-velocity.'
809 & 'Sout(idW3Sd)', &
810 & 'Write out 3D wec omega Stokes vertical velocity.'
812 & 'Sout(idW3St)', &
813 & 'Write out 3D wec Stokes vertical velocity.'
814# endif
815# ifdef WEC_VF
817 & 'Sout(idWztw)', &
818 & 'Write out wec quasi-static sea level adjustment.'
820 & 'Sout(idWqsp)', &
821 & 'Write out wec quasi-static sea pressure adjustment.'
823 & 'Sout(idWbeh)', &
824 & 'Write out wec Bernoulli head sea level adjustment.'
825# endif
826# endif
827# ifdef WAVES_HEIGHT
829 & 'Sout(idWamp)', &
830 & 'Write out wave height.'
831# endif
832# ifdef WAVES_LENGTH
834 & 'Sout(idWlen)', &
835 & 'Write out waves mean wavelength.'
836# endif
837# ifdef WAVES_LENGTHP
839 & 'Sout(idWlep)', &
840 & 'Write out waves peak wavelength.'
841# endif
842# ifdef WAVES_DIR
844 & 'Sout(idWdir)', &
845 & 'Write out waves mean direction.'
846# endif
847# ifdef WAVES_DIRP
849 & 'Sout(idWdip)', &
850 & 'Write out peak waves direction.'
851# endif
852# ifdef WAVES_TOP_PERIOD
854 & 'Sout(idWptp)', &
855 & 'Write out wave surface period.'
856# endif
857# ifdef WAVES_BOT_PERIOD
859 & 'Sout(idWpbt)', &
860 & 'Write out wave bottom period.'
861# endif
862# if defined BBL_MODEL || defined BEDLOAD_SOULSBY || \
863 defined bedload_vandera || defined wav_coupling
865 & 'Sout(idWorb)', &
866 & 'Write out wave bottom orbital velocity.'
867# endif
868# if defined WAV_COUPLING || (defined WEC_VF && defined BOTTOM_STREAMING)
870 & 'Sout(idWdif)', &
871 & 'Write out wave dissipation due to bottom friction.'
872# endif
873# if defined WAV_COUPLING || defined TKE_WAVEDISS || \
874 defined wdiss_thorguza || defined wdiss_churthor
876 & 'Sout(idWdib)', &
877 & 'Write out wave dissipation due to breaking.'
879 & 'Sout(idWdiw)', &
880 & 'Write out wave dissipation due to whitecapping.'
881# endif
882# ifdef ROLLER_SVENDSEN
884 & 'Sout(idWbrk)', &
885 & 'Write out percent wave breaking.'
886# endif
887# ifdef WEC_ROLLER
889 & 'Sout(idWdis)', &
890 & 'Write out wave roller dissipation.'
891# endif
892# ifdef ROLLER_RENIERS
894 & 'Sout(idWrol)', &
895 & 'Write out wave roller action density.'
896# endif
897# ifdef WAVES_DSPR
899 & 'Sout(idWvds)', &
900 & 'Write out wave directional spread.'
902 & 'Sout(idWvqp)', &
903 & 'Write out wave spectrum peakedness.'
904# endif
905# if defined SOLVE3D && (defined BBL_MODEL || defined SEDIMENT)
909 & 'Write out bottom property ', itrc, &
911 END DO
912# endif
913# ifdef SOLVE3D
914# if defined BULK_FLUXES || defined ECOSIM || defined ATM_PRESS
916 & 'Sout(idPair)', &
917 & 'Write out surface air pressure.'
918# endif
919# if defined BULK_FLUXES || defined ECOSIM
921 & 'Sout(idUair)', &
922 & 'Write out surface U-wind component.'
924 & 'Sout(idVair)', &
925 & 'Write out surface V-wind component.'
926# endif
929 & 'Write out surface net heat flux.'
930# ifdef SALINITY
933 & 'Write out surface net salt flux.'
934# endif
935# ifdef SHORTWAVE
937 & 'Sout(idSrad)', &
938 & 'Write out shortwave radiation flux.'
939# endif
940# ifdef BULK_FLUXES
942 & 'Sout(idLrad)', &
943 & 'Write out longwave radiation flux.'
945 & 'Sout(idLhea)', &
946 & 'Write out latent heat flux.'
948 & 'Sout(idShea)', &
949 & 'Write out sensible heat flux.'
950# ifdef EMINUSP
952 & 'Sout(idEmPf)', &
953 & 'Write out E-P flux.'
955 & 'Sout(idevap)', &
956 & 'Write out evaporation rate.'
958 & 'Sout(idrain)', &
959 & 'Write out rain rate.'
960# endif
961# endif
963 & 'Sout(idDano)', &
964 & 'Write out density anomaly.'
966 & 'Sout(idVvis)', &
967 & 'Write out vertical viscosity coefficient.'
969 & 'Sout(idTdif)', &
970 & 'Write out vertical T-diffusion coefficient.'
972 & 'Sout(idSdif)', &
973 & 'Write out vertical S-diffusion coefficient.'
974# ifdef LMD_SKPP
976 & 'Sout(idHsbl)', &
977 & 'Write out depth of surface boundary layer.'
978# endif
979# ifdef LMD_BKPP
981 & 'Sout(idHbbl)', &
982 & 'Write out depth of bottom boundary layer.'
983# endif
984# if defined GLS_MIXING || defined MY25_MIXING
986 & 'Sout(idMtke)', &
987 & 'Write out turbulent kinetic energy.'
989 & 'Sout(idMtls)', &
990 & 'Write out turbulent generic length-scale.'
991# endif
992# endif
993 WRITE (out,*)
995 WRITE (out,110) i,
scalars(ng)%Sflag(i), &
998 END DO
999 END IF
1000 END DO
1001 END IF
1002
1003 40 FORMAT (/,' READ_StaPar - Grid = ',i2.2,',',3x, &
1004 & 'Illegal value for ',a,' = ', i8,/,15x,a)
1005 50 FORMAT (/,' READ_StaPar - Inconsistent number of stations, ', &
1006 & 'Nstation = ',2i8,/,15x, &
1007 & 'change stations input script values.')
1008 60 FORMAT (/,' READ_StaPar - Error while processing line: ',/,a)
1009
1010 70 FORMAT (/,/,' Stations Parameters, Grid: ',i2.2, &
1011 & /, ' =============================',/)
1012 80 FORMAT (1x,i10,2x,a,t30,a)
1013 90 FORMAT (10x,l1,2x,a,t30,a)
1014 100 FORMAT (10x,l1,2x,a,t30,a,i2.2,':',1x,a)
1015 110 FORMAT (13x,'Flag and positions for station ',i4.4,':', &
1016 & i3,1x,2f10.4)
1017
1018 RETURN
integer function decode_line(line_text, keyword, nval, cval, rval)
type(t_io), dimension(:), allocatable err
logical, dimension(:,:), allocatable hout
integer, dimension(:), allocatable idtsur
integer, dimension(:), allocatable idtvar
character(len=maxlen), dimension(6, 0:nv) vname
logical, dimension(:,:), allocatable sout
real(r8), dimension(:), allocatable dmem
integer, dimension(:), allocatable nstation
integer, dimension(:), allocatable nt
type(t_scalars), dimension(:), allocatable scalars
logical, dimension(:), allocatable ldefsta
logical, dimension(:), allocatable lstations
integer, dimension(mbotp) idbott