├── ALT_CODE ├── README.src.OpenMP ├── README.src.dimensions ├── dimensions_mpi.h ├── dimensions_omp.h ├── dimensions_ompi.h └── dimensions_one.h ├── CESMBETA ├── Makefile.NUOPC_CESMB ├── mod_cb_arrays_nuopc_glue.F90 ├── mod_hycom_nuopc_glue.F90 ├── ocn_comp_mct.F90 └── ocn_comp_nuopc_mod.F90 ├── CPP.csh ├── CPP.make ├── LICENSE ├── Make.csh ├── Make_cice.csh ├── Make_global.csh ├── Makefile ├── Makefile.NUOPC ├── NAVYESPC ├── HYCOM_OceanComp.F90 ├── Makefile.NUOPC ├── ReadHycomLatLon.f ├── export_from_hycom_tiled.F ├── hycom_couple.F └── readme.sw_radflx ├── README.md ├── README.src ├── README.src.OpenMP ├── README.src.changes.3p00 ├── README.src.changes.3p01 ├── README.src.config ├── README.src.config.macros ├── README.src.dimensions ├── README.src.make ├── README.src.mod_xc ├── README.src.mod_za ├── README.src.newmachine └── README.src.newregion ├── bigrid.F90 ├── blkdat.F90 ├── cnuity.F90 ├── config ├── README.src.config ├── README.src.config.macros ├── generic-gnu-relo_mpi ├── generic-gnu-relo_one ├── generic-intel-relo_one ├── hpe-gnu-relo_mpi ├── hpe-impi-relo_mpi ├── hpe-impi-relo_ompi ├── hpe-intel-relo_mpi ├── hpe-intel-relo_ompi ├── hpe-intel-relo_one ├── intelGF-impi-sm-relo_mpi ├── intelsse-impi-sm-relo_mpi ├── intelsse-impi-sm-relo_omp ├── intelsse-impi-sm-relo_one ├── intelsse-pe-sm-relo_mpi ├── power9-xl-smpi-relo_mpi ├── shasta-cce-relo_mpi ├── shasta-intel-relo_mpi ├── shasta-intel-relo_ompi ├── xc40-gnu-relo_mpi ├── xc40-gnu-relo_omp ├── xc40-gnu-relo_one ├── xc40-intel-relo_cesmb ├── xc40-intel-relo_cice ├── xc40-intel-relo_mpi ├── xc40-intel-relo_ompi ├── xc40-intel-relo_one └── xc40-pgi-relo_mpi ├── convec.F90 ├── diapfl.F90 ├── dimensions.h ├── dpthuv.F90 ├── dpudpv.F90 ├── forfun.F90 ├── geopar.F90 ├── hybgen.F90 ├── hycom.F90 ├── hycom_cice.F90 ├── icloan.F90 ├── inicon.F90 ├── inigiss.F90 ├── inikpp.F90 ├── inimy.F90 ├── internal_kappaf.h ├── isnan.F90 ├── latbdy.F90 ├── machi_c.c ├── machine.F90 ├── matinv.F90 ├── mod_OICPL.F90 ├── mod_archiv.F90 ├── mod_asselin.F90 ├── mod_barotp.F90 ├── mod_cb_arrays.F90 ├── mod_dimensions.F90 ├── mod_floats.F90 ├── mod_hycom.F90 ├── mod_incupd.F90 ├── mod_mean.F90 ├── mod_momtum.F90 ├── mod_pipe.F90 ├── mod_restart.F90 ├── mod_stokes.F90 ├── mod_tides.F90 ├── mod_tsadvc.F90 ├── mod_xc.F90 ├── mod_xc_mp.h ├── mod_xc_sm.h ├── mod_za.F90 ├── mod_za_mp.h ├── mod_za_mp1.h ├── mod_za_sm.h ├── mod_za_zt.h ├── mxkprf.F90 ├── mxkrt.F90 ├── mxkrtm.F90 ├── mxpwp.F90 ├── overtn.F90 ├── poflat.F90 ├── prtmsk.F90 ├── psmoo.F90 ├── s8gefs.F90 ├── stmt_fns.h ├── thermf.F90 ├── trcupd.F90 ├── unit_offset.h └── wtime.F90 /ALT_CODE/README.src.OpenMP: -------------------------------------------------------------------------------- 1 | ../README.src/README.src.OpenMP -------------------------------------------------------------------------------- /ALT_CODE/README.src.dimensions: -------------------------------------------------------------------------------- 1 | ../../README.src/README.src.dimensions -------------------------------------------------------------------------------- /ALT_CODE/dimensions_mpi.h: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------- 2 | ! --- START OF REGION AND TILING SPECIFIC PARAMETERS 3 | ! --- Static memory version, not used when macro /* RELO */ is set (dynamic memory) 4 | ! --- See: README.dimensions and README.OpenMP for more details. 5 | ! 6 | ! --- itdm = total grid dimension in i direction 7 | ! --- jtdm = total grid dimension in j direction 8 | ! --- kdm = grid dimension in k direction 9 | integer itdm,jtdm,kdm 10 | parameter (itdm=500,jtdm=382,kdm=41) ! GLBT0.72 11 | ! 12 | ! --- iqr = maximum number of tiles in i direction 13 | ! --- jqr = maximum number of tiles in j direction 14 | integer iqr,jqr 15 | parameter (iqr=10,jqr=10) ! multiple tiles (TYPE=ompi or mpi or shmem) 16 | ! 17 | ! --- idm = maximum single tile grid dimension in i direction 18 | ! --- jdm = maximum single tile grid dimension in j direction 19 | integer idm,jdm 20 | !!!!!!parameter (idm=itdm,jdm=jtdm) ! always works if enough memory 21 | parameter (idm= 250,jdm= 191) ! NMPI=4,8,16,24,32,40,47,64 22 | ! 23 | ! --- mxthrd= maximum number of OpenMP threads 24 | integer mxthrd 25 | parameter (mxthrd=1) ! NOMP=0,1 26 | ! 27 | ! --- kkwall= grid dimension in k direction for wall relax arrays 28 | ! --- kknest= grid dimension in k direction for nest relax arrays 29 | integer kkwall,kknest 30 | parameter (kkwall= 1) ! must be 1 or kdm 31 | parameter (kknest= 1) ! must be 1 or kdm 32 | ! 33 | ! --- kkmy25= grid dimension in k direction for M-Y 2.5 arrays 34 | integer kkmy25 35 | parameter (kkmy25= -1) ! must be -1 or kdm 36 | ! 37 | ! --- nlgiss= size of lookup table for GISS 38 | integer nlgiss 39 | parameter (nlgiss= 1) ! must be 1 (no GISS) or 762 40 | ! 41 | ! --- mxtrcr= maximum number of tracers 42 | integer mxtrcr 43 | parameter (mxtrcr=1) 44 | ! 45 | ! --- natm = number of saved atmospheric fields 46 | integer natm 47 | parameter (natm=2) ! must be 2 (high freq.) or 4 (monthly) 48 | ! 49 | ! --- max_nsteps_batrop = maximum barotropic steps per baroclinic time step 50 | integer max_nsteps_batrop 51 | parameter (max_nsteps_batrop = 128) 52 | ! 53 | ! --- END OF REGION AND TILING SPECIFIC PARAMETERS 54 | !----------------------------------------------------------------------------- 55 | -------------------------------------------------------------------------------- /ALT_CODE/dimensions_omp.h: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------- 2 | ! --- START OF REGION AND TILING SPECIFIC PARAMETERS 3 | ! --- Static memory version, not used when macro /* RELO */ is set (dynamic memory) 4 | ! --- See: README.dimensions and README.OpenMP for more details. 5 | ! 6 | ! --- itdm = total grid dimension in i direction 7 | ! --- jtdm = total grid dimension in j direction 8 | ! --- kdm = grid dimension in k direction 9 | integer itdm,jtdm,kdm 10 | parameter (itdm=500,jtdm=382,kdm=41) ! GLBT0.72 11 | ! 12 | ! --- iqr = maximum number of tiles in i direction 13 | ! --- jqr = maximum number of tiles in j direction 14 | integer iqr,jqr 15 | parameter (iqr= 1,jqr= 1) ! single tile (TYPE=one or omp) 16 | ! 17 | ! --- idm = maximum single tile grid dimension in i direction 18 | ! --- jdm = maximum single tile grid dimension in j direction 19 | integer idm,jdm 20 | parameter (idm=itdm,jdm=jtdm) ! single tile (TYPE=one or omp) 21 | ! 22 | ! --- mxthrd= maximum number of OpenMP threads 23 | integer mxthrd 24 | parameter (mxthrd=16) ! NOMP=0,1,2,4,8,16 25 | ! 26 | ! --- kkwall= grid dimension in k direction for wall relax arrays 27 | ! --- kknest= grid dimension in k direction for nest relax arrays 28 | integer kkwall,kknest 29 | parameter (kkwall= 1) ! must be 1 or kdm 30 | parameter (kknest= 1) ! must be 1 or kdm 31 | ! 32 | ! --- kkmy25= grid dimension in k direction for M-Y 2.5 arrays 33 | integer kkmy25 34 | parameter (kkmy25= -1) ! must be -1 or kdm 35 | ! 36 | ! --- nlgiss= size of lookup table for GISS 37 | integer nlgiss 38 | parameter (nlgiss= 1) ! must be 1 (no GISS) or 762 39 | ! 40 | ! --- mxtrcr= maximum number of tracers 41 | integer mxtrcr 42 | parameter (mxtrcr=1) 43 | ! 44 | ! --- natm = number of saved atmospheric fields 45 | integer natm 46 | parameter (natm=2) ! must be 2 (high freq.) or 4 (monthly) 47 | ! 48 | ! --- max_nsteps_batrop = maximum barotropic steps per baroclinic time step 49 | integer max_nsteps_batrop 50 | parameter (max_nsteps_batrop = 128) 51 | ! 52 | ! --- END OF REGION AND TILING SPECIFIC PARAMETERS 53 | !----------------------------------------------------------------------------- 54 | -------------------------------------------------------------------------------- /ALT_CODE/dimensions_ompi.h: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------- 2 | ! --- START OF REGION AND TILING SPECIFIC PARAMETERS 3 | ! --- Static memory version, not used when macro /* RELO */ is set (dynamic memory) 4 | ! --- See: README.dimensions and README.OpenMP for more details. 5 | ! 6 | ! --- itdm = total grid dimension in i direction 7 | ! --- jtdm = total grid dimension in j direction 8 | ! --- kdm = grid dimension in k direction 9 | integer itdm,jtdm,kdm 10 | parameter (itdm=500,jtdm=382,kdm=41) ! GLBT0.72 11 | ! 12 | ! --- iqr = maximum number of tiles in i direction 13 | ! --- jqr = maximum number of tiles in j direction 14 | integer iqr,jqr 15 | parameter (iqr=10,jqr=10) ! multiple tiles (TYPE=ompi or mpi or shmem) 16 | ! 17 | ! --- idm = maximum single tile grid dimension in i direction 18 | ! --- jdm = maximum single tile grid dimension in j direction 19 | integer idm,jdm 20 | !!!!!!parameter (idm=itdm,jdm=jtdm) ! always works if enough memory 21 | parameter (idm= 250,jdm= 191) ! NMPI=4,8,16,24,32,40,47,64 22 | ! 23 | ! --- mxthrd= maximum number of OpenMP threads 24 | integer mxthrd 25 | parameter (mxthrd=8) ! NOMP=0,1,2,4,8 26 | ! 27 | ! --- kkwall= grid dimension in k direction for wall relax arrays 28 | ! --- kknest= grid dimension in k direction for nest relax arrays 29 | integer kkwall,kknest 30 | parameter (kkwall= 1) ! must be 1 or kdm 31 | parameter (kknest= 1) ! must be 1 or kdm 32 | ! 33 | ! --- kkmy25= grid dimension in k direction for M-Y 2.5 arrays 34 | integer kkmy25 35 | parameter (kkmy25= -1) ! must be -1 or kdm 36 | ! 37 | ! --- nlgiss= size of lookup table for GISS 38 | integer nlgiss 39 | parameter (nlgiss= 1) ! must be 1 (no GISS) or 762 40 | ! 41 | ! --- mxtrcr= maximum number of tracers 42 | integer mxtrcr 43 | parameter (mxtrcr=1) 44 | ! 45 | ! --- natm = number of saved atmospheric fields 46 | integer natm 47 | parameter (natm=2) ! must be 2 (high freq.) or 4 (monthly) 48 | ! 49 | ! --- max_nsteps_batrop = maximum barotropic steps per baroclinic time step 50 | integer max_nsteps_batrop 51 | parameter (max_nsteps_batrop = 128) 52 | ! 53 | ! --- END OF REGION AND TILING SPECIFIC PARAMETERS 54 | !----------------------------------------------------------------------------- 55 | -------------------------------------------------------------------------------- /ALT_CODE/dimensions_one.h: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------- 2 | ! --- START OF REGION AND TILING SPECIFIC PARAMETERS 3 | ! --- Static memory version, not used when macro /* RELO */ is set (dynamic memory) 4 | ! --- See: README.dimensions and README.OpenMP for more details. 5 | ! 6 | ! --- itdm = total grid dimension in i direction 7 | ! --- jtdm = total grid dimension in j direction 8 | ! --- kdm = grid dimension in k direction 9 | integer itdm,jtdm,kdm 10 | parameter (itdm=500,jtdm=382,kdm=41) ! GLBT0.72 11 | ! 12 | ! --- iqr = maximum number of tiles in i direction 13 | ! --- jqr = maximum number of tiles in j direction 14 | integer iqr,jqr 15 | parameter (iqr= 1,jqr= 1) ! single tile (TYPE=one or omp) 16 | ! 17 | ! --- idm = maximum single tile grid dimension in i direction 18 | ! --- jdm = maximum single tile grid dimension in j direction 19 | integer idm,jdm 20 | parameter (idm=itdm,jdm=jtdm) ! single tile (TYPE=one or omp) 21 | ! 22 | ! --- mxthrd= maximum number of OpenMP threads 23 | integer mxthrd 24 | parameter (mxthrd=1) ! NOMP=0,1 25 | ! 26 | ! --- kkwall= grid dimension in k direction for wall relax arrays 27 | ! --- kknest= grid dimension in k direction for nest relax arrays 28 | integer kkwall,kknest 29 | parameter (kkwall= 1) ! must be 1 or kdm 30 | parameter (kknest= 1) ! must be 1 or kdm 31 | ! 32 | ! --- kkmy25= grid dimension in k direction for M-Y 2.5 arrays 33 | integer kkmy25 34 | parameter (kkmy25= -1) ! must be -1 or kdm 35 | ! 36 | ! --- nlgiss= size of lookup table for GISS 37 | integer nlgiss 38 | parameter (nlgiss= 1) ! must be 1 (no GISS) or 762 39 | ! 40 | ! --- mxtrcr= maximum number of tracers 41 | integer mxtrcr 42 | parameter (mxtrcr=1) 43 | ! 44 | ! --- natm = number of saved atmospheric fields 45 | integer natm 46 | parameter (natm=2) ! must be 2 (high freq.) or 4 (monthly) 47 | ! 48 | ! --- max_nsteps_batrop = maximum barotropic steps per baroclinic time step 49 | integer max_nsteps_batrop 50 | parameter (max_nsteps_batrop = 128) 51 | ! 52 | ! --- END OF REGION AND TILING SPECIFIC PARAMETERS 53 | !----------------------------------------------------------------------------- 54 | -------------------------------------------------------------------------------- /CESMBETA/Makefile.NUOPC_CESMB: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # --- Standard rules ---------------------------------------------------------- 3 | # ------------------------------------------------------------------------------ 4 | include Makefile 5 | 6 | # ------------------------------------------------------------------------------ 7 | # --- NUOPC additions ---------------------------------------------------------- 8 | # ------------------------------------------------------------------------------ 9 | ocn_comp_mct.o : ocn_comp_mct.F90 10 | $(ESMF_F90COMPILER) -c $(DEP_FRONTS) $(DEP_INCS) -I$(OBJROOT)/lib/include -I$(OBJROOT)/csm_share -I$(OBJROOT)/pio $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(USER_DEFS) $< 11 | 12 | ocn_comp_nuopc_mod.o : ocn_comp_nuopc_mod.F90 13 | $(ESMF_F90COMPILER) -c $(DEP_FRONTS) $(DEP_INCS) -I$(OBJROOT)/lib/include -I$(OBJROOT)/csm_share -I$(OBJROOT)/pio $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(USER_DEFS) $< 14 | 15 | mod_hycom_nuopc_glue.o : mod_hycom_nuopc_glue.F90 16 | $(ESMF_F90COMPILER) -c $(DEP_FRONTS) $(DEP_INCS) -I$(OBJROOT)/lib/include -I$(OBJROOT)/csm_share -I$(OBJROOT)/pio $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(USER_DEFS) $< 17 | 18 | mod_cb_arrays_nuopc_glue.o : mod_cb_arrays_nuopc_glue.F90 19 | $(ESMF_F90COMPILER) -c $(DEP_FRONTS) $(DEP_INCS) -I$(OBJROOT)/lib/include -I$(OBJROOT)/csm_share -I$(OBJROOT)/pio $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(USER_DEFS) $< 20 | 21 | 22 | .PRECIOUS: %.o 23 | 24 | %.mk : %.o 25 | @echo "# ESMF self-describing build dependency makefile fragment" > $@ 26 | @echo >> $@ 27 | @echo "ESMF_DEP_FRONT = hycom" >> $@ 28 | @echo "ESMF_DEP_INCPATH = `pwd`" >> $@ 29 | @echo "ESMF_DEP_CMPL_OBJS = `pwd`/"$< >> $@ 30 | @echo "ESMF_DEP_LINK_OBJS = `pwd`/libhycom_nuopc.a" >> $@ 31 | @echo "ESMF_DEP_SHRD_PATH = " >> $@ 32 | @echo "ESMF_DEP_SHRD_LIBS = " >> $@ 33 | @echo 34 | @echo "Finished generating ESMF self-describing build dependency makefile fragment:" $@ 35 | @echo 36 | 37 | nuopc: ocn_comp_mct.o ocn_comp_nuopc_mod.mk libhycom_nuopc.a 38 | 39 | ocn_comp_mct.o: $(MODS) $(OBJS) 40 | 41 | ocn_comp_nuopc_mod.o: mod_hycom_nuopc_glue.o $(MODS) $(OBJS) 42 | 43 | mod_hycom_nuopc_glue.o: mod_cb_arrays_nuopc_glue.o $(MODS) $(OBJS) 44 | 45 | mod_cb_arrays_nuopc_glue.o: $(MODS) $(OBJS) 46 | 47 | libhycom_nuopc.a: ocn_comp_mct.o ocn_comp_nuopc_mod.o mod_hycom_nuopc_glue.o mod_cb_arrays_nuopc_glue.o $(MODS) $(OBJS) 48 | ar cr $@ $^ 49 | 50 | .PHONY: clean nuopcinstall 51 | clean: 52 | rm -f hycom *.o *.mod *.a *.mk 53 | 54 | PWDIR := `pwd` 55 | 56 | ifndef DESTDIR 57 | DESTDIR := $(PWDIR) 58 | endif 59 | 60 | INSTDATE := $(shell date '+%Y-%m-%d-%H-%M-%S') 61 | ifndef INSTDIR 62 | INSTDIR := HYCOM_$(INSTDATE) 63 | endif 64 | 65 | nuopcinstall: 66 | @gmake nuopc 67 | @mkdir -p $(DESTDIR)/$(INSTDIR) 68 | @cp libhycom_nuopc.a hycom.mod $(DESTDIR)/$(INSTDIR) 69 | @sed -e 's;'$(PWDIR)';'$(DESTDIR)/$(INSTDIR)';g' ocn_comp_nuopc_mod.mk > $(DESTDIR)/$(INSTDIR)/ocn_comp_nuopc_mod.mk 70 | @touch VERSION 71 | @if [ -d .svn ]; then \ 72 | echo "SVN Repository" > VERSION; \ 73 | svn info . | grep URL >> VERSION; \ 74 | svn info . | grep "Last Changed Rev" >> VERSION; \ 75 | fi 76 | @cp VERSION $(DESTDIR)/$(INSTDIR)/ 77 | @echo Installation into \"$(DESTDIR)/$(INSTDIR)\" complete! 78 | @echo 79 | # ------------------------------------------------------------------------------ 80 | -------------------------------------------------------------------------------- /CESMBETA/mod_cb_arrays_nuopc_glue.F90: -------------------------------------------------------------------------------- 1 | module mod_cb_arrays_nuopc_glue 2 | 3 | ! The purpose of this module is to make select common block entities 4 | ! available as public module variables. Doing this through an extra 5 | ! Fortran module is cleaner than simply including the entyre common 6 | ! blocks header in the actual glue module. Further, the common blocks 7 | ! header is in fixed format, and that means that which ever unit pulls 8 | ! it in via include also needs to be in fixed format... not something 9 | ! that would be nice for the actual hycom_nuopc_glue module. 10 | 11 | use mod_xc 12 | use mod_cb_arrays ! HYCOM saved arrays 13 | 14 | implicit none 15 | 16 | private 17 | 18 | ! grid c-grid staggering 19 | public plon ! lon at the p pts 20 | public plat ! lat at the p pts 21 | public qlon ! lon at the p pts 22 | public qlat ! lat at the p pts 23 | public scp2 ! grid cell area at the p pts 24 | public scux ! grid cell area at the p pts 25 | public scvy ! grid cell area at the p pts 26 | 27 | ! import from ATM 28 | public cpl_taux, imp_taux, imp_taue ! xstress [Pa], eastward stress [Pa] 29 | public cpl_tauy, imp_tauy, imp_taun ! ystress [Pa], northward stress [Pa] 30 | public cpl_wndspd, imp_wndspd ! wind speed [m s-1] 31 | public cpl_ustara, imp_ustara ! friction speed [m s-1] 32 | public cpl_airtmp, imp_airtmp ! air temperature [K] 33 | public cpl_vapmix, imp_vapmix ! specific humidity [kg kg-1] 34 | public cpl_swflx, imp_swflx ! shortwave net flux [W m-2] 35 | public cpl_lwmdnflx,imp_lwdflx ! longwave down flux [W m-2] 36 | public cpl_lwmupflx,imp_lwuflx ! longwave up flux [W m-2] 37 | public cpl_precip, imp_precip ! precipitation [m s-1] 38 | public cpl_surtmp, imp_surtmp ! air surface temperature [C] 39 | public cpl_seatmp, imp_seatmp ! sea surface temperature [C] 40 | public cpl_latflx, imp_latflx ! latent heat flux [W m-2] 41 | public cpl_sensflx, imp_sensflx ! sensible heat flux [W m-2] 42 | public cpl_orivers, imp_orivers ! ocean runoffs [kg m-2 s-1] 43 | public cpl_irivers, imp_irivers ! ice runoffs [kg m-2 s-1] 44 | 45 | 46 | ! import from SEA-ICE 47 | public cpl_sic, sic_import ! Sea Ice Concentration 48 | public cpl_sitx, sitx_import ! Sea Ice X-Stress 49 | public cpl_sity, sity_import ! Sea Ice Y-Stress 50 | public cpl_siqs, siqs_import ! Solar Heat Flux thru Ice to Ocean 51 | public cpl_sifh, sifh_import ! Ice Freezing/Melting Heat Flux 52 | public cpl_sifs, sifs_import ! Ice Freezing/Melting Salt Flux 53 | public cpl_sifw, sifw_import ! Ice Net Water Flux 54 | public cpl_sit, sit_import ! Sea Ice Temperature 55 | public cpl_sih, sih_import ! Sea Ice Thickness 56 | public cpl_siu, siu_import ! Sea Ice X-Velocity 57 | public cpl_siv, siv_import ! Sea Ice Y-Velocity 58 | 59 | ! native exports 60 | public temp ! temp at the p pts 61 | public u, v ! velocity components 62 | public ubavg, vbavg ! barotropic velocities 63 | public srfhgt ! sea surface height, g*ssh(m) 64 | public dpbl ! turbulent boundary layer depth 65 | public saln ! salinity 66 | public pang ! ANGLET 67 | public dhde ! eastward ssh slope 68 | public dhdn ! northward ssh slope 69 | public uml ! eastward u velocity 70 | public vml ! northward v velocity 71 | public tml ! export T average over one coupling sequence 72 | public sml ! export S average over one coupling sequence 73 | public sshm ! export SSH average over one coupling sequence 74 | public frzh ! export of freezing and melting potential 75 | 76 | ! native imports 77 | public covice ! ice coverage (rel.units) 78 | public thkice ! grid-cell avg. ice thknss (m) 79 | public temice ! ice surface temperature 80 | public fswice ! swv flux under ice 81 | public flxice ! heat flux under ice 82 | public sflice ! salt flux under ice 83 | public wflice ! water flux under ice 84 | public si_c ! ice concentration on p-grid from coupler 85 | public si_h ! ice thickness on p-grid from coupler 86 | public si_t ! ice temperature on p-grid from coupler 87 | public si_u ! ice u-velocity on p-grid from coupler 88 | public si_v ! ice v-velocity on p-grid from coupler 89 | public si_tx ! x-stress under ice on p-grid from coupler 90 | public si_ty ! y-stress under ice on p-grid from coupler 91 | 92 | ! ocn coupling frequency 93 | public ocn_cpl_frq ! in days in CESM 94 | public icefrq ! in time step in HYCOM 95 | 96 | ! scalars and flags 97 | public g, onem, qonem, thkfrz, baclin, spcifh, pcp_fact 98 | public tfrz_0, tfrz_s 99 | public iceflg, icmflg, sstflg,itest,jtest,ltripolar 100 | 101 | end module 102 | -------------------------------------------------------------------------------- /CESMBETA/ocn_comp_mct.F90: -------------------------------------------------------------------------------- 1 | module ocn_comp_mct 2 | 3 | ! !USES: 4 | 5 | use shr_sys_mod 6 | use shr_kind_mod , only: IN=>SHR_KIND_IN, R8=>SHR_KIND_R8, CS=>SHR_KIND_CS 7 | use shr_file_mod , only: shr_file_getunit, shr_file_getlogunit, shr_file_getloglevel, & 8 | shr_file_setlogunit, shr_file_setloglevel, shr_file_setio, & 9 | shr_file_freeunit 10 | use shr_mpi_mod , only: shr_mpi_bcast 11 | use mct_mod 12 | use esmf 13 | 14 | use dead_data_mod 15 | use dead_mct_mod 16 | use dead_mod 17 | 18 | use seq_cdata_mod 19 | use seq_infodata_mod 20 | use seq_timemgr_mod 21 | use seq_comm_mct , only: seq_comm_inst, seq_comm_name, seq_comm_suffix 22 | use seq_flds_mod , only: flds_d2x => seq_flds_o2x_fields, & 23 | flds_x2d => seq_flds_x2o_fields 24 | 25 | ! 26 | ! !PUBLIC TYPES: 27 | implicit none 28 | save 29 | private ! except 30 | 31 | !-------------------------------------------------------------------------- 32 | ! Public interfaces 33 | !-------------------------------------------------------------------------- 34 | 35 | public :: ocn_init_mct 36 | public :: ocn_run_mct 37 | public :: ocn_final_mct 38 | 39 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 40 | CONTAINS 41 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | 43 | !=============================================================================== 44 | !BOP =========================================================================== 45 | ! 46 | ! !IROUTINE: ocn_init_mct 47 | ! 48 | ! !DESCRIPTION: 49 | ! initialize dead ocn model 50 | ! 51 | ! !REVISION HISTORY: 52 | ! 53 | ! !INTERFACE: ------------------------------------------------------------------ 54 | 55 | subroutine ocn_init_mct( EClock, cdata, x2d, d2x, NLFilename ) 56 | 57 | ! !INPUT/OUTPUT PARAMETERS: 58 | 59 | type(ESMF_Clock) , intent(inout) :: EClock 60 | type(seq_cdata) , intent(inout) :: cdata 61 | type(mct_aVect) , intent(inout) :: x2d, d2x 62 | character(len=*), optional , intent(in) :: NLFilename ! Namelist filename 63 | 64 | !EOP 65 | 66 | print *, "ALERT: OCN_INIT_MCT should not be called" 67 | 68 | 69 | end subroutine ocn_init_mct 70 | 71 | !=============================================================================== 72 | !BOP =========================================================================== 73 | ! 74 | ! !IROUTINE: ocn_run_mct 75 | ! 76 | ! !DESCRIPTION: 77 | ! run method for dead ocn model 78 | ! 79 | ! !REVISION HISTORY: 80 | ! 81 | ! !INTERFACE: ------------------------------------------------------------------ 82 | 83 | subroutine ocn_run_mct( EClock, cdata, x2d, d2x) 84 | 85 | implicit none 86 | 87 | ! !INPUT/OUTPUT PARAMETERS: 88 | 89 | type(ESMF_Clock) ,intent(inout) :: EClock 90 | type(seq_cdata) ,intent(inout) :: cdata 91 | type(mct_aVect) ,intent(inout) :: x2d ! driver-> dead 92 | type(mct_aVect) ,intent(inout) :: d2x ! dead -> driver 93 | 94 | !EOP 95 | 96 | 97 | end subroutine ocn_run_mct 98 | 99 | !=============================================================================== 100 | !BOP =========================================================================== 101 | ! 102 | ! !IROUTINE: ocn_final_mct 103 | ! 104 | ! !DESCRIPTION: 105 | ! finalize method for dead ocn model 106 | ! 107 | ! !REVISION HISTORY: 108 | ! 109 | ! !INTERFACE: ------------------------------------------------------------------ 110 | ! 111 | subroutine ocn_final_mct(EClock, cdata, x2d, d2x) 112 | 113 | implicit none 114 | 115 | !----- arguments ----- 116 | 117 | type(ESMF_Clock) ,intent(inout) :: EClock ! clock 118 | type(seq_cdata) ,intent(inout) :: cdata 119 | type(mct_aVect) ,intent(inout) :: x2d ! driver -> dead 120 | type(mct_aVect) ,intent(inout) :: d2x ! dead -> driver 121 | 122 | !EOP 123 | 124 | 125 | end subroutine ocn_final_mct 126 | !=============================================================================== 127 | 128 | end module ocn_comp_mct 129 | -------------------------------------------------------------------------------- /CPP.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh 2 | # 3 | set echo 4 | # 5 | # --- run HYCOM through CPP. 6 | # 7 | #!/bin/csh 8 | # 9 | set echo 10 | cd $cwd 11 | # 12 | # --- Usage: ./CPP.com >& CPP.log 13 | # 14 | # --- Build a source code set for this ARCH and TYPE only. 15 | # --- assumes dimensions.h is correct for $TYPE. 16 | # 17 | #setenv ARCH intel-pgi-relo 18 | setenv ARCH intelsse-impi-sm-relo 19 | # 20 | setenv TYPE `echo $cwd | awk -F"_" '{print $NF}'` 21 | # 22 | if (! -e ../config/${ARCH}_${TYPE}) then 23 | echo "ARCH = " $ARCH " TYPE = " $TYPE " is not supported" 24 | exit 1 25 | else 26 | # foreach f ( *.F ) 27 | # foreach f ( barotp.F blkdat.F cnuity.F mod_archiv.F mod_floats.F mod_hycom.F mod_mean.F mod_momtum.F mod_pipe.F mxkprf.F thermf.F ) 28 | foreach f ( barotp.F mod_momtum.F mxkprf.F ) 29 | make -f CPP.make $f:r.f ARCH=$ARCH TYPE=$TYPE 30 | end 31 | endif 32 | -------------------------------------------------------------------------------- /CPP.make: -------------------------------------------------------------------------------- 1 | # 2 | # --- HYCOM 2.0 surce code makefile 3 | # 4 | # --- Tunable parameters in ../config/$(ARCH)_$(TYPE) 5 | # 6 | 7 | .SUFFIXES: 8 | .SUFFIXES: .c .F .f .o 9 | 10 | .F: 11 | @echo "Must have an explicit rule for" $* 12 | .f: 13 | @echo "Must have an explicit rule for" $* 14 | .c: 15 | @echo "Must have an explicit rule for" $* 16 | 17 | include ../config/$(ARCH)_$(TYPE) 18 | 19 | .F.f: 20 | $(RM) $<.f $<.C 21 | sed -e 's? */// *?/ / /?g' -e 's? *// *?/ /?g' $< > $<.C 22 | $(CPP) $(CPPFLAGS) $<.C | sed -e '/^ *$$/d' > $<.f 23 | # -\mv $<.f $*.f 24 | $(RM) $<.C 25 | 26 | default: hycom.f 27 | 28 | hycom.f: hycom.F 29 | hycom_cice.f: hycom_cice.F 30 | dummy_cice.f: dummy_cice.F 31 | 32 | barotp.f: barotp.F 33 | blkdat.f: blkdat.F 34 | cnuity.f: cnuity.F 35 | convec.f: convec.F 36 | diapfl.f: diapfl.F 37 | dpthuv.f: dpthuv.F 38 | dpudpv.f: dpudpv.F 39 | geopar.f: geopar.F 40 | hybgen.f: hybgen.F 41 | icloan.f: icloan.F 42 | inicon.f: inicon.F 43 | isnan.f: isnan.F 44 | latbdy.f: latbdy.F 45 | machine.f: machine.F 46 | mxkprf.f: mxkprf.F 47 | mxkrt.f: mxkrt.F 48 | mxkrtm.f: mxkrtm.F 49 | mxpwp.f: mxpwp.F 50 | overtn.f: overtn.F 51 | thermf.f: thermf.F 52 | trcupd.f: trcupd.F 53 | wtime.f: wtime.F 54 | mod_hycom.f: mod_hycom.F 55 | mod_hycom_dummy.f: mod_hycom_dummy.F 56 | mod_cb_arrays.f: mod_cb_arrays.F 57 | mod_dimensions.f: mod_dimensions.F 58 | mod_momtum.f: mod_momtum.F 59 | mod_tsadvc.f: mod_tsadvc.F 60 | mod_incupd.f: mod_incupd.F 61 | mod_floats.f: mod_floats.F 62 | mod_pipe.f: mod_pipe.F 63 | mod_stokes.f: mod_stokes.F 64 | mod_tides.f: mod_tides.F 65 | mod_mean.f: mod_mean.F 66 | mod_archiv.f: mod_archiv.F 67 | mod_xc.f: mod_xc.F 68 | mod_za.f: mod_za.F 69 | mod_OICPL.f: mod_OICPL.F 70 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 1999-present HYCOM Consortium and contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Make.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh 2 | # 3 | set echo 4 | cd $cwd 5 | # 6 | # --- Usage: ./Make.csh >& Make.log 7 | # 8 | # --- make hycom with TYPE from this directory's name (src_*_$TYPE). 9 | # --- assumes dimensions.h is correct for $TYPE. 10 | # 11 | # --- set ARCH to the correct value for this machine. 12 | # 13 | # --- Generic, GNU Fortran 14 | #setenv ARCH generic-gnu-relo 15 | # 16 | # --- IBM iDataPlex, IBM MPI (very old example) 17 | #unset echo 18 | #module swap compiler compiler/intel/12.1.3 19 | #module swap mpi mpi/intel/ibmpe 20 | #module list 21 | #set echo 22 | #setenv ARCH Aintelsse-pe-sm-relo 23 | # 24 | # --- IBM iDataPlex, Intel MPI (very old example) 25 | #unset echo 26 | #module swap compiler compiler/intel/12.1.3 27 | #module swap mpi mpi/intel/impi/4.1.3 28 | #module list 29 | #set echo 30 | #setenv ARCH Aintelsse-impi-sm-relo 31 | # 32 | # --- Cray XC30/40, Intel Fortran 33 | #unset echo 34 | ##module switch PrgEnv-cray PrgEnv-intel 35 | #module unload cray-libsci 36 | #module switch intel intel/15.0.0.090 37 | #module switch cray-mpich cray-mpich/7.0.3 38 | #module load craype-hugepages2M 39 | #module list 40 | #set echo 41 | #setenv ARCH xc40-intel-relo 42 | # 43 | # --- Cray SHASTA, Intel Fortran (cray-mpich/8.1.[12] do not work) 44 | unset echo 45 | module restore PrgEnv-intel 46 | module use --append /p/app/modulefiles 47 | module load bct-env 48 | module load cray-pals 49 | module swap cray-mpich/8.1.4 50 | module list 51 | set echo 52 | setenv ARCH shasta-intel-relo 53 | # 54 | # --- HPE SGI, MPI (mpt), Intel Fortran (mpt/2.17 does not work) 55 | #unset echo 56 | #module purge 57 | #module load compiler/intel/2017.4.196 58 | #module load mpt/2.16 59 | #module list 60 | #set echo 61 | #setenv ARCH hpe-intel-relo 62 | # 63 | setenv TYPE `echo $cwd | awk -F"_" '{print $NF}'` 64 | echo "ARCH = " $ARCH " TYPE = " $TYPE 65 | # 66 | if (! -e ./config/${ARCH}_${TYPE}) then 67 | echo "ARCH = " $ARCH " TYPE = " $TYPE " is not supported" 68 | exit 1 69 | endif 70 | 71 | # CPP flags for compilations 72 | # Equation Of State 73 | setenv OCN_SIG -DEOS_SIG2 ## Sigma-2 74 | #setenv OCN_SIG -DEOS_SIG0 ## Sigma-0 75 | 76 | #setenv OCN_EOS -DEOS_7T ## EOS 7-term 77 | #setenv OCN_EOS -DEOS_9T ## EOS 9-term 78 | #setenv OCN_EOS -DEOS_12T ## EOS 12-term 79 | setenv OCN_EOS -DEOS_17T ## EOS 17-term 80 | 81 | # Optional CPP flags 82 | # Global or regional 83 | #setenv OCN_GLB -DARCTIC ## global tripolar simulation 84 | setenv OCN_GLB "" 85 | 86 | # Thermobaricity correction centered 87 | #setenv OCN_KAPP -DKAPPAF_CENTERED 88 | setenv OCN_KAPP "" 89 | 90 | # Miscellaneous CPP flags (-DSTOKES -DOCEANS2 etc...) 91 | # -DSTOKES : Stokes drift 92 | # -DOCEANS2 : master and slave HYCOM in same executable 93 | # -DMOMTUM_CFL : include an explicit CFL limiter 94 | # -DMOMTUM4_CFL : include an explicit CFL limiter 95 | # -DRDNEST_MASK : mask velocity outliers 96 | # -DLATBDT_NPLINE3 : update pline every 3 time steps 97 | # -DMASSLESS_1MM : lowest substantial mass-containing layer > 1mm thick 98 | #setenv OCN_MISC "" 99 | #setenv OCN_MISC "-DMASSLESS_1MM -DRDNEST_MASK -DLATBDT_NPLINE3" 100 | setenv OCN_MISC "-DMASSLESS_1MM" 101 | 102 | # CPP_EXTRAS 103 | setenv CPP_EXTRAS "${OCN_SIG} ${OCN_EOS} ${OCN_GLB} ${OCN_KAPP} ${OCN_MISC}" 104 | 105 | # 106 | # --- some machines require gmake 107 | # 108 | #gmake ARCH=$ARCH TYPE=$TYPE hycom 109 | make hycom ARCH=$ARCH TYPE=$TYPE 110 | # 111 | if ( $ARCH == "Asp5" || $ARCH == "sp5") then 112 | ldedit -bdatapsize=64K -bstackpsize=64K hycom 113 | endif 114 | if ( $ARCH == "Asp6" || $ARCH == "sp6") then 115 | ldedit -bdatapsize=64K -bstackpsize=64K hycom 116 | endif 117 | if ( $ARCH == "Asp6-nofl" || $ARCH == "sp6-nofl") then 118 | ldedit -bdatapsize=64K -bstackpsize=64K hycom 119 | endif 120 | -------------------------------------------------------------------------------- /Make_cice.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh 2 | # 3 | set echo 4 | setenv HYCOM_DIR $cwd 5 | cd ${HYCOM_DIR} 6 | # 7 | # --- Usage: ./Make_cice.com >& Make_cice.log 8 | # 9 | # --- make cice (ESMF HYCOM component) with TYPE=cice. 10 | # --- this directory's name must be src_*_cice. 11 | # --- assumes dimensions.h is correct for TYPE=cice (i.e. for mpi). 12 | # 13 | # --- set ARCH to the correct value for this machine. 14 | # --- ARCH that start with A are for ARCTIC patch regions 15 | # 16 | #setenv ARCH alphaL 17 | #setenv ARCH alpha 18 | #setenv ARCH amd64 19 | #setenv ARCH intel 20 | #setenv ARCH o2k 21 | #setenv ARCH sp3 22 | #setenv ARCH sp4 23 | #setenv ARCH sun64 24 | #setenv ARCH sun 25 | #setenv ARCH t3e 26 | #setenv ARCH xt3 27 | # 28 | setenv ARCH sp6_nofl 29 | # 30 | setenv TYPE `echo $cwd | awk -F"_" '{print $NF}'` 31 | # 32 | if ($TYPE != "cice") then 33 | echo "TYPE must be cice to invoke cice make target" 34 | exit 1 35 | endif 36 | # 37 | if (! -e ../config/${ARCH}_${TYPE}) then 38 | echo "ARCH = " $ARCH " TYPE = " $TYPE " is not supported" 39 | exit 1 40 | endif 41 | # 42 | # --- cice needs additional environment variables. 43 | # 44 | if ($TYPE == "cice") then 45 | switch ($ARCH) 46 | case 'sp5': 47 | setenv BEI_HOME /site/BEI 48 | setenv ESMF_DIR ${BEI_HOME}/esmf/4.0.0rp2 49 | breaksw 50 | case 'o2k': 51 | setenv BEI_HOME /usr/local/usp/BEI 52 | setenv ESMF_DIR ${BEI_HOME}/esmf/4.0.0rp2 53 | breaksw 54 | case 'xt3': 55 | setenv BEI_HOME /usr/local/usp/BEI 56 | setenv ESMF_DIR ${BEI_HOME}/esmf/4.0.0rp2 57 | breaksw 58 | default: 59 | echo "TYPE = cice needs BEI_HOME and ESMF_DIR" 60 | exit (1) 61 | endsw 62 | endif 63 | # 64 | # --- make CICE component 65 | # 66 | setenv CICE_DIR ./CICE 67 | cd ${CICE_DIR} 68 | /bin/rm -f comp_ice.log 69 | ./comp_ice | tee comp_ice.log 70 | # 71 | # --- make HYCOM component, and update hycom_cice 72 | # 73 | cd ${HYCOM_DIR} 74 | # --- force a relink, because CICE is not in the dependencies 75 | /bin/rm hycom_cice 76 | make ARCH=$ARCH TYPE=$TYPE hycom_cice 77 | # --- some machines require gmake 78 | #gmake ARCH=$ARCH TYPE=$TYPE hycom_cice 79 | -------------------------------------------------------------------------------- /Make_global.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh 2 | # 3 | set echo 4 | cd $cwd 5 | # 6 | # --- Usage: ./Make.csh >& Make.log 7 | # 8 | # --- make hycom with TYPE from this directory's name (src_*_$TYPE). 9 | # --- assumes dimensions.h is correct for $TYPE. 10 | # 11 | # --- set ARCH to the correct value for this machine. 12 | # 13 | # --- Generic, GNU Fortran 14 | #setenv ARCH generic-gnu-relo 15 | # 16 | # --- IBM iDataPlex, IBM MPI (very old example) 17 | #unset echo 18 | #module swap compiler compiler/intel/12.1.3 19 | #module swap mpi mpi/intel/ibmpe 20 | #module list 21 | #set echo 22 | #setenv ARCH Aintelsse-pe-sm-relo 23 | # 24 | # --- IBM iDataPlex, Intel MPI (very old example) 25 | #unset echo 26 | #module swap compiler compiler/intel/12.1.3 27 | #module swap mpi mpi/intel/impi/4.1.3 28 | #module list 29 | #set echo 30 | #setenv ARCH Aintelsse-impi-sm-relo 31 | # 32 | # --- Cray XC30/40, Intel Fortran 33 | #unset echo 34 | ##module switch PrgEnv-cray PrgEnv-intel 35 | #module unload cray-libsci 36 | #module switch intel intel/15.0.0.090 37 | #module switch cray-mpich cray-mpich/7.0.3 38 | #module load craype-hugepages2M 39 | #module list 40 | #set echo 41 | #setenv ARCH xc40-intel-relo 42 | # 43 | # --- Cray SHASTA, Intel Fortran (cray-mpich/8.1.[12] do not work) 44 | unset echo 45 | module restore PrgEnv-intel 46 | module use --append /p/app/modulefiles 47 | module load bct-env 48 | module load cray-pals 49 | module swap cray-mpich/8.1.4 50 | module list 51 | set echo 52 | setenv ARCH shasta-intel-relo 53 | # 54 | # --- HPE SGI, MPI (mpt), Intel Fortran (mpt/2.17 does not work) 55 | #unset echo 56 | #module purge 57 | #module load compiler/intel/2017.4.196 58 | #module load mpt/2.16 59 | #module list 60 | #set echo 61 | #setenv ARCH hpe-intel-relo 62 | # 63 | setenv TYPE `echo $cwd | awk -F"_" '{print $NF}'` 64 | echo "ARCH = " $ARCH " TYPE = " $TYPE 65 | # 66 | if (! -e ./config/${ARCH}_${TYPE}) then 67 | echo "ARCH = " $ARCH " TYPE = " $TYPE " is not supported" 68 | exit 1 69 | endif 70 | 71 | # CPP flags for compilations 72 | # Equation Of State 73 | setenv OCN_SIG -DEOS_SIG2 ## Sigma-2 74 | #setenv OCN_SIG -DEOS_SIG0 ## Sigma-0 75 | 76 | #setenv OCN_EOS -DEOS_7T ## EOS 7-term 77 | #setenv OCN_EOS -DEOS_9T ## EOS 9-term 78 | #setenv OCN_EOS -DEOS_12T ## EOS 12-term 79 | setenv OCN_EOS -DEOS_17T ## EOS 17-term 80 | 81 | # Optional CPP flags 82 | # Global or regional 83 | setenv OCN_GLB -DARCTIC ## global tripolar simulation 84 | #setenv OCN_GLB "" 85 | 86 | # Thermobaricity correction centered 87 | #setenv OCN_KAPP -DKAPPAF_CENTERED 88 | setenv OCN_KAPP "" 89 | 90 | # Miscellaneous CPP flags (-DSTOKES -DOCEANS2 etc...) 91 | # -DSTOKES : Stokes drift 92 | # -DOCEANS2 : master and slave HYCOM in same executable 93 | # -DMOMTUM_CFL : include an explicit CFL limiter 94 | # -DMOMTUM4_CFL : include an explicit CFL limiter 95 | # -DRDNEST_MASK : mask velocity outliers 96 | # -DLATBDT_NPLINE3 : update pline every 3 time steps 97 | # -DMASSLESS_1MM : lowest substantial mass-containing layer > 1mm thick 98 | #setenv OCN_MISC "" 99 | #setenv OCN_MISC "-DMASSLESS_1MM -DRDNEST_MASK -DLATBDT_NPLINE3" 100 | setenv OCN_MISC "-DMASSLESS_1MM -DMOMTUM_CFL" 101 | 102 | # CPP_EXTRAS 103 | setenv CPP_EXTRAS "${OCN_SIG} ${OCN_EOS} ${OCN_GLB} ${OCN_KAPP} ${OCN_MISC}" 104 | 105 | # 106 | # --- some machines require gmake 107 | # 108 | #gmake ARCH=$ARCH TYPE=$TYPE hycom 109 | make hycom ARCH=$ARCH TYPE=$TYPE 110 | # 111 | if ( $ARCH == "Asp5" || $ARCH == "sp5") then 112 | ldedit -bdatapsize=64K -bstackpsize=64K hycom 113 | endif 114 | if ( $ARCH == "Asp6" || $ARCH == "sp6") then 115 | ldedit -bdatapsize=64K -bstackpsize=64K hycom 116 | endif 117 | if ( $ARCH == "Asp6-nofl" || $ARCH == "sp6-nofl") then 118 | ldedit -bdatapsize=64K -bstackpsize=64K hycom 119 | endif 120 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # --- HYCOM 3.1 makefile 3 | # 4 | # --- Stand-alone HYCOM, or HYCOM ESMF component, or HYCOM+CICE. 5 | # 6 | # --- Tunable parameters in config/$(ARCH)_$(TYPE) 7 | # 8 | 9 | .SUFFIXES: 10 | .SUFFIXES: .c .F90 .o 11 | 12 | .F90: 13 | @echo "Must have an explicit rule for" $* 14 | .c: 15 | @echo "Must have an explicit rule for" $* 16 | 17 | include config/$(ARCH)_$(TYPE) 18 | 19 | MODS = mod_dimensions.o mod_xc.o mod_za.o mod_cb_arrays.o mod_tides.o mod_pipe.o \ 20 | mod_incupd.o mod_floats.o mod_stokes.o mod_mean.o mod_archiv.o \ 21 | mod_tsadvc.o mod_momtum.o mod_barotp.o mod_asselin.o mod_restart.o \ 22 | mod_hycom.o 23 | 24 | MODD = mod_dimensions.o mod_xc.o mod_za.o mod_cb_arrays.o mod_tides.o mod_pipe.o \ 25 | mod_incupd.o mod_floats.o mod_stokes.o mod_mean.o mod_archiv.o \ 26 | mod_tsadvc.o mod_momtum.o mod_barotp.o mod_asselin.o mod_restart.o \ 27 | mod_hycom_dummy.o 28 | 29 | OBJS = bigrid.o blkdat.o cnuity.o convec.o \ 30 | diapfl.o dpthuv.o dpudpv.o forfun.o geopar.o hybgen.o \ 31 | icloan.o inicon.o inigiss.o inikpp.o inimy.o latbdy.o \ 32 | matinv.o mxkprf.o mxkrt.o mxkrtm.o mxpwp.o \ 33 | overtn.o poflat.o prtmsk.o psmoo.o \ 34 | thermf.o trcupd.o \ 35 | machine.o wtime.o machi_c.o isnan.o s8gefs.o 36 | 37 | hycom: $(MODS) $(OBJS) hycom.o 38 | $(LD) $(LDFLAGS) -o hycom hycom.o $(MODS) $(OBJS) $(EXTRALIBS) 39 | 40 | esmf: $(MODS) $(OBJS) 41 | @echo "--- ESMF hycom component has been built ---" 42 | 43 | hycom_cice: $(MODS) $(OBJS) mod_OICPL.o hycom_cice.o 44 | $(LD) $(LDFLAGS) -o hycom_cice \ 45 | hycom_cice.o mod_OICPL.o \ 46 | $(MODS) $(OBJS) \ 47 | ${CICE_DIR}/esmf/compile/*.o \ 48 | $(EXTRALIBS) 49 | 50 | dummy_cice: $(MODS) $(OBJS) mod_OICPL.o dummy_cice.o 51 | $(LD) $(LDFLAGS) -o dummy_cice \ 52 | dummy_cice.o mod_OICPL.o \ 53 | $(MODD) $(OBJS) \ 54 | ${CICE_DIR}/esmf/compile/*.o \ 55 | $(EXTRALIBS) 56 | 57 | hycom.o: hycom.F90 mod_hycom.o 58 | hycom_cice.o: hycom_cice.F90 mod_hycom.o mod_OICPL.o 59 | dummy_cice.o: dummy_cice.F90 mod_hycom_dummy.o mod_OICPL.o 60 | 61 | bigrid.o: bigrid.F90 mod_xc.o 62 | blkdat.o: blkdat.F90 mod_xc.o mod_cb_arrays.o stmt_fns.h mod_incupd.o \ 63 | mod_floats.o \ 64 | mod_tides.o \ 65 | mod_stokes.o 66 | cnuity.o: cnuity.F90 mod_xc.o mod_cb_arrays.o mod_pipe.o \ 67 | mod_stokes.o 68 | convec.o: convec.F90 mod_xc.o mod_cb_arrays.o stmt_fns.h 69 | diapfl.o: diapfl.F90 mod_xc.o mod_cb_arrays.o stmt_fns.h mod_stokes.o 70 | dpthuv.o: dpthuv.F90 mod_xc.o mod_cb_arrays.o 71 | dpudpv.o: dpudpv.F90 mod_xc.o 72 | forfun.o: forfun.F90 mod_xc.o mod_cb_arrays.o mod_za.o 73 | geopar.o: geopar.F90 mod_xc.o mod_cb_arrays.o stmt_fns.h mod_za.o 74 | hybgen.o: hybgen.F90 mod_xc.o mod_cb_arrays.o stmt_fns.h mod_pipe.o 75 | icloan.o: icloan.F90 mod_xc.o mod_cb_arrays.o stmt_fns.h 76 | inicon.o: inicon.F90 mod_xc.o mod_cb_arrays.o stmt_fns.h mod_pipe.o \ 77 | mod_restart.o 78 | inigiss.o: inigiss.F90 mod_xc.o mod_cb_arrays.o stmt_fns.h 79 | inikpp.o: inikpp.F90 mod_xc.o mod_cb_arrays.o stmt_fns.h 80 | inimy.o: inimy.F90 mod_xc.o mod_cb_arrays.o stmt_fns.h 81 | isnan.o: isnan.F90 82 | latbdy.o: latbdy.F90 mod_xc.o mod_cb_arrays.o mod_tides.o 83 | machine.o: machine.F90 84 | machi_c.o: machi_c.c 85 | matinv.o: matinv.F90 mod_xc.o mod_cb_arrays.o 86 | mxkprf.o: mxkprf.F90 mod_xc.o mod_cb_arrays.o stmt_fns.h mod_pipe.o \ 87 | mod_stokes.o 88 | mxkrt.o: mxkrt.F90 mod_xc.o mod_cb_arrays.o stmt_fns.h 89 | mxkrtm.o: mxkrtm.F90 mod_xc.o mod_cb_arrays.o stmt_fns.h 90 | mxpwp.o: mxpwp.F90 mod_xc.o mod_cb_arrays.o stmt_fns.h 91 | overtn.o: overtn.F90 mod_xc.o mod_cb_arrays.o 92 | poflat.o: poflat.F90 93 | prtmsk.o: prtmsk.F90 94 | psmoo.o: psmoo.F90 mod_xc.o 95 | s8gefs.o: s8gefs.F90 96 | thermf.o: thermf.F90 mod_xc.o mod_cb_arrays.o stmt_fns.h 97 | trcupd.o: trcupd.F90 mod_xc.o mod_cb_arrays.o mod_pipe.o 98 | wtime.o: wtime.F90 99 | mod_hycom.o: \ 100 | mod_hycom.F90 mod_xc.o mod_cb_arrays.o mod_za.o mod_pipe.o \ 101 | mod_incupd.o \ 102 | mod_mean.o \ 103 | mod_floats.o \ 104 | mod_momtum.o \ 105 | mod_tsadvc.o \ 106 | mod_barotp.o \ 107 | mod_asselin.o \ 108 | mod_restart.o \ 109 | mod_stokes.o 110 | mod_hycom_dummy.o: \ 111 | mod_hycom_dummy.F90 mod_xc.o mod_cb_arrays.o mod_za.o mod_pipe.o \ 112 | mod_incupd.o \ 113 | mod_mean.o \ 114 | mod_floats.o \ 115 | mod_momtum.o \ 116 | mod_tsadvc.o \ 117 | mod_barotp.o \ 118 | mod_asselin.o \ 119 | mod_restart.o \ 120 | mod_stokes.o 121 | mod_asselin.o: \ 122 | mod_asselin.F90 mod_xc.o mod_cb_arrays.o stmt_fns.h mod_pipe.o 123 | mod_barotp.o: \ 124 | mod_barotp.F90 mod_xc.o mod_cb_arrays.o stmt_fns.h mod_pipe.o \ 125 | mod_tides.o \ 126 | mod_stokes.o 127 | mod_cb_arrays.o: \ 128 | mod_cb_arrays.F90 mod_dimensions.o 129 | mod_momtum.o: \ 130 | mod_momtum.F90 mod_xc.o mod_cb_arrays.o stmt_fns.h mod_pipe.o \ 131 | mod_tides.o \ 132 | mod_stokes.o 133 | mod_restart.o: \ 134 | mod_restart.F90 mod_xc.o mod_cb_arrays.o mod_za.o mod_tides.o 135 | mod_tsadvc.o: \ 136 | mod_tsadvc.F90 mod_xc.o mod_cb_arrays.o stmt_fns.h mod_pipe.o 137 | mod_incupd.o: \ 138 | mod_incupd.F90 mod_xc.o mod_cb_arrays.o mod_za.o 139 | mod_floats.o: \ 140 | mod_floats.F90 mod_xc.o mod_cb_arrays.o mod_za.o mod_pipe.o \ 141 | mod_stokes.o 142 | mod_pipe.o: \ 143 | mod_pipe.F90 mod_xc.o mod_cb_arrays.o mod_tides.o \ 144 | mod_stokes.o 145 | mod_stokes.o: \ 146 | mod_stokes.F90 mod_xc.o mod_cb_arrays.o mod_za.o 147 | mod_tides.o: \ 148 | mod_tides.F90 mod_xc.o mod_cb_arrays.o mod_za.o 149 | mod_mean.o: \ 150 | mod_mean.F90 mod_xc.o mod_cb_arrays.o mod_za.o mod_stokes.o 151 | mod_archiv.o: \ 152 | mod_archiv.F90 mod_xc.o mod_cb_arrays.o mod_za.o mod_stokes.o 153 | 154 | mod_dimensions.o: mod_dimensions.F90 dimensions.h 155 | mod_xc.o: mod_xc.F90 mod_dimensions.o mod_xc_sm.h mod_xc_mp.h 156 | mod_za.o: mod_za.F90 mod_xc.o mod_za_sm.h mod_za_mp.h mod_za_mp1.h mod_za_zt.h 157 | 158 | mod_OICPL.o: mod_OICPL.F90 159 | -------------------------------------------------------------------------------- /Makefile.NUOPC: -------------------------------------------------------------------------------- 1 | # 2 | # SCCS IDENTIFICATION: $HeadURL$ 3 | # SCCS IDENTIFICATION: @(#)$Id$ 4 | 5 | #include ../../config/use_couple 6 | 7 | #TOPDIR := $(shell cd ../../../ 1>/dev/null 2>&1 && pwd) 8 | OCNDIR := $(shell cd ../ 1>/dev/null 2>&1 && pwd) 9 | #OCNDIR := $(shell cd ../../ 1>/dev/null 2>&1 && pwd) 10 | 11 | OBJDIR = $(OCNDIR)/obj/src 12 | FCSDIR = $(OCNDIR)/src 13 | 14 | ifdef USE_OCN 15 | LIB = $(OCNDIR)/lib/ocn.a 16 | else 17 | LIB = $(OCNDIR)/lib/hycom.a 18 | endif 19 | 20 | INCFLAG = $(addprefix -I,$(FCSDIR)) $(INCLDIR) 21 | MODFLAG = $(addprefix -I,$(OBJDIR)) 22 | .SUFFIXES : .c .F90 23 | 24 | MAKEFILE = Makefile.NUOPC 25 | include $(OCNDIR)/config/CONFIG_NUOPC 26 | 27 | machine=$(shell hostname) 28 | NOFMA= 29 | ifeq ($(findstring conrad,$(machine)),conrad) 30 | NOFMA= -no-fma 31 | endif 32 | 33 | ifeq ($(findstring gordon,$(machine)),gordon) 34 | NOFMA= -no-fma 35 | endif 36 | 37 | OBJS = \ 38 | mod_dimensions.o mod_xc.o mod_za.o mod_cb_arrays.o mod_pipe.o \ 39 | mod_incupd.o \ 40 | mod_floats.o mod_stokes.o mod_tides.o mod_mean.o mod_archiv.o \ 41 | mod_tsadvc.o mod_momtum.o mod_barotp.o mod_asselin.o mod_restart.o\ 42 | bigrid.o blkdat.o cnuity.o convec.o \ 43 | diapfl.o dpthuv.o dpudpv.o forfun.o geopar.o hybgen.o \ 44 | icloan.o inicon.o inigiss.o inikpp.o inimy.o latbdy.o \ 45 | matinv.o mxkprf.o mxkrt.o mxkrtm.o mxpwp.o \ 46 | overtn.o poflat.o prtmsk.o psmoo.o \ 47 | thermf.o trcupd.o \ 48 | machine.o wtime.o machi_c.o isnan.o s8gefs.o 49 | 50 | OBJS := $(addprefix $(OBJDIR)/,$(OBJS)) 51 | 52 | 53 | TARGET: $(OBJS) modmv 54 | 55 | 56 | %.o $(OBJDIR)/%.o : %.F90 57 | $(FCMPI) -c $(FFLAGS) $(NOFMA) $(CPPFLAGS) $(CPLFLAG) $(MODFLAG) $(INCFLAG) $< -o $@ 58 | $(AR) $(LIB) $@ 59 | 60 | %.o $(OBJDIR)/%.o : %.c 61 | $(CC) -c $(CPPFLAGS) $(CCFLAGS) $< -o $@ 62 | $(AR) $(LIB) $@ 63 | 64 | 65 | archive : $(OBJS) 66 | rm -f $(LIB) 67 | $(AR) -r $(LIB) $(OBJS) 68 | 69 | 70 | modmv: 71 | mods=`ls *.mod 2>/dev/null`; \ 72 | if [ "$${mods}" != "" ]; then mv $${mods} $(OBJDIR)/.; fi 73 | 74 | info: 75 | -@echo "OCNDIR: $(OCNDIR) " 76 | # -@echo "OBJDIR: $(OBJDIR) " 77 | # -@echo "OBJS: $(OBJS) " 78 | 79 | # ----------------------------------------------------------------------------- 80 | # ----------------------------------------------------------------------------- 81 | .PHONY: clean 82 | 83 | clean: 84 | rm -f $(OBJDIR)/*.o $(OBJDIR)/*.mod 85 | rm -f $(LIB) 86 | 87 | -------------------------------------------------------------------------------- /NAVYESPC/Makefile.NUOPC: -------------------------------------------------------------------------------- 1 | # SCCS IDENTIFICATION: $HeadURL$ 2 | # SCCS IDENTIFICATION: @(#)$Id$ 3 | 4 | #define CHKFILE 5 | #$(shell if [ -e $(1) ]; then echo TRUE; fi;) 6 | #endef 7 | 8 | 9 | #ifeq ($(call CHKFILE,$(ESPC_SYSTEM_TOPDIR)/config/esmfmkfile),TRUE) 10 | # TOPDIR = $(ESPC_SYSTEM_TOPDIR) 11 | #else 12 | # TOPDIR := $(shell cd ../ 1>/dev/null 2>&1 && pwd) 13 | #endif 14 | ##Alex OCNDIR := $(shell cd ../ 1>/dev/null 2>&1 && pwd) 15 | OCNDIR := $(shell cd ../../ 1>/dev/null 2>&1 && pwd) 16 | 17 | include $(OCNDIR)/config/esmfmkfile 18 | include $(ESMFMKFILE) 19 | 20 | 21 | OBJDIR = $(OCNDIR)/obj/esmf 22 | FCSDIR = $(OCNDIR)/src 23 | MODDIR = $(OCNDIR)/obj/src 24 | 25 | #ifeq ($(call CHKFILE,$(TOPDIR)/src/share/obj),TRUE) 26 | # MODDIR2 = $(TOPDIR)/src/share/obj 27 | #else 28 | # MODDIR2 = 29 | #endif 30 | MODDIR += $(OCNDIR)/share/obj 31 | MODDIR += $(OCNDIR)/obj/service 32 | 33 | ifdef USE_OCN 34 | LIB = $(OCNDIR)/lib/ocn_esmf.a 35 | else 36 | LIB = $(OCNDIR)/lib/hycom_esmf.a 37 | endif 38 | 39 | INCFLAG = $(addprefix -I,$(FCSDIR)) $(INCLDIR) 40 | MODFLAG = $(addprefix -I,$(OBJDIR)) $(addprefix -I,$(MODDIR)) 41 | .SUFFIXES : .F90 .f .F 42 | 43 | MAKEFILE = Makefile.NUOPC 44 | include $(OCNDIR)/config/CONFIG_NUOPC 45 | 46 | machine=$(shell hostname) 47 | NOFMA= 48 | ifeq ($(findstring conrad,$(machine)),conrad) 49 | NOFMA= -no-fma 50 | endif 51 | 52 | ifeq ($(findstring gordon,$(machine)),gordon) 53 | NOFMA= -no-fma 54 | endif 55 | 56 | #ifdef USE_COUPLE 57 | OBJS = \ 58 | export_from_hycom_tiled.o hycom_couple.o ReadHycomLatLon.o HYCOM_OceanComp.o 59 | ## HYCOM_Field.o HYCOM_OceanComp.o HYCOM_OceanOnlyComp.o hycom_couple.o 60 | #else 61 | #OBJS = \ 62 | # HYCOM_OceanComp.o 63 | #endif 64 | 65 | OBJS := $(addprefix $(OBJDIR)/,$(OBJS)) 66 | 67 | 68 | TARGET: build_dirs $(OBJS) modmv 69 | 70 | %.o $(OBJDIR)/%.o : %.f 71 | $(FCMPI) -c $(FFLAGS_mis) $(NOFMA) $(MODFLAG) $(INCFLAG) $< -o $@ 72 | $(AR) $(LIB) $@ 73 | 74 | %.o $(OBJDIR)/%.o : %.F 75 | $(FCMPI) -c $(FFLAGS) $(NOFMA) $(CPPFLAGS) $(CPLFLAG) $(MODFLAG) $(INCFLAG) $< -o $@ 76 | $(AR) $(LIB) $@ 77 | 78 | #%.o $(OBJDIR)/%.o : %.F90 79 | # $(FCMPI) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(FFLAGS_esmf) $(CPPFLAGS) $(CPLFLAG) $(MODFLAG) $(INCFLAG) $< -o $@ 80 | # $(AR) $(LIB) $@ 81 | 82 | %.o $(OBJDIR)/%.o : %.F90 83 | $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(CPPFLAGS) $(CPLFLAG) $(MODFLAG) $(INCFLAG) $< -o $@ 84 | $(AR) $(LIB) $@ 85 | 86 | modmv: 87 | mods=`ls *.mod 2>/dev/null`; \ 88 | if [ "$${mods}" != "" ]; then mv $${mods} $(OBJDIR)/.; fi 89 | 90 | info: 91 | -@echo "CPLFLAG: $(CPLFLAG) " 92 | -@echo "OBJDIR: $(OBJDIR) " 93 | -@echo "OBJS: $(OBJS) " 94 | 95 | build_dirs: 96 | -@if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi 97 | 98 | # ----------------------------------------------------------------------------- 99 | # ----------------------------------------------------------------------------- 100 | .PHONY: clean 101 | clean: info 102 | rm -f $(OBJDIR)/*.o $(OBJDIR)/*.mod 103 | rm -f $(LIB) 104 | -------------------------------------------------------------------------------- /NAVYESPC/ReadHycomLatLon.f: -------------------------------------------------------------------------------- 1 | c=================================================== 2 | c subroutine readHycomLatLon(plat,plon,itdm,jtdm) 3 | subroutine readHycomLatLon(plat,plon,qlat,qlon,itdm,jtdm) 4 | 5 | implicit none 6 | 7 | REAL*4 plat(itdm,jtdm),plon(itdm,jtdm) 8 | REAL*4 qlat(itdm,jtdm),qlon(itdm,jtdm) 9 | REAL*4, allocatable :: pad(:) 10 | 11 | integer npad 12 | integer ios,nrecl 13 | integer i,j 14 | CHARACTER*240 cfilea 15 | integer itdm,jtdm 16 | 17 | cfilea = 'regional.grid.a' 18 | 19 | npad = 4096 - MOD(itdm*jtdm,4096) 20 | if(npad.eq.4096) npad=0 21 | 22 | allocate(pad(npad)) 23 | 24 | INQUIRE( IOLENGTH=nrecl) plon,pad 25 | c print *,"itdm,jtdm=",itdm,jtdm 26 | c print *,"npad=",npad 27 | c print *,"nrecl=",nrecl 28 | 29 | 30 | open(unit=11,file=cfilea, form='unformatted', status='old', 31 | * access='direct', recl=nrecl, iostat=ios) 32 | 33 | 34 | IF (ios.ne.0) THEN 35 | print *,"error in reading regional.grid.a" 36 | call exit(1) 37 | endif 38 | 39 | read(11,rec=1,iostat=ios) plon 40 | if (ios.ne.0) then 41 | print *,"error in reading regional.grid.a, plon" 42 | call exit(2) 43 | endif 44 | 45 | read(11,rec=2,iostat=ios) plat 46 | if (ios.ne.0) then 47 | print *,"error in reading regional.grid.a, plat" 48 | call exit(3) 49 | endif 50 | 51 | read(11,rec=3,iostat=ios) qlon 52 | if (ios.ne.0) then 53 | print *,"error in reading regional.grid.a, qlon" 54 | call exit(2) 55 | endif 56 | 57 | read(11,rec=4,iostat=ios) qlat 58 | if (ios.ne.0) then 59 | print *,"error in reading regional.grid.a, qlat" 60 | call exit(3) 61 | endif 62 | 63 | do j=1,jtdm 64 | do i=1,itdm 65 | if(plon(i,j).ge.360) plon(i,j)=plon(i,j)-360. 66 | if(qlon(i,j).ge.360) qlon(i,j)=qlon(i,j)-360. 67 | enddo 68 | enddo 69 | 70 | print *,'readHycomLatLon,plat, min,max=', 71 | & minval(plat),maxval(plat) 72 | print *,'readHycomLatLon,plon, min,max=', 73 | & minval(plon),maxval(plon) 74 | 75 | 76 | c print *,"**** readHycomLatLon, lat_hycom ***" 77 | c do j=1,jtdm 78 | c print *, "j=", j 79 | c write(*,12)(plat(i,j),i=1,itdm) 80 | c enddo 81 | 82 | c print *,"**** readHycomLatLon, lon_hycom ***" 83 | c do j=1,jtdm 84 | c print *, "j=", j 85 | c write(*,12)(plon(i,j),i=1,itdm) 86 | c enddo 87 | c 12 format(10F12.5/(10F12.5)) 88 | 89 | 90 | if(allocated(pad)) deallocate(pad) 91 | 92 | return 93 | end subroutine readHycomLatLon 94 | 95 | 96 | -------------------------------------------------------------------------------- /NAVYESPC/export_from_hycom_tiled.F: -------------------------------------------------------------------------------- 1 | c================================================== 2 | subroutine export_from_hycom_tiled(tmx, fieldName) 3 | use mod_xc ! HYCOM communication interface 4 | use mod_cb_arrays 5 | 6 | implicit none 7 | c include 'common_blocks.h' 8 | c 9 | real tmx(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) 10 | character(len=30) fieldName 11 | c 12 | integer i,j,k 13 | real hfrz,tfrz,t2f,ssfi,tmxl,smxl,umxl,vmxl 14 | real dp1,usur1,vsur1,psur1,dp2,usur2,vsur2,psur2,thksur 15 | c 16 | integer jja 17 | c 18 | 19 | #if defined(ARCTIC) 20 | c --- Arctic (tripole) domain, top row is replicated (ignore it) 21 | jja = min( jj, jtdm-1-j0 ) 22 | #else 23 | jja = jj 24 | #endif 25 | 26 | tmx(:,:)=0. 27 | 28 | c==> export to atm,ice 29 | if(fieldName .eq. 'sst' ) then 30 | do j=1,jj 31 | do i= 1,ii 32 | tmx(i,j) = 0.5*(temp(i,j,1,1)+temp(i,j,1,2)) 33 | enddo 34 | enddo 35 | c==> export to ice 36 | else if(fieldName .eq. 'ssu' .or. 37 | & fieldName .eq. 'ssv' ) then 38 | call xctilr(u( 1-nbdy,1-nbdy,1,1),1,2*kk, 1,1, halo_uv) 39 | call xctilr(ubavg(1-nbdy,1-nbdy, 1),1, 2, 1,1, halo_uv) 40 | call xctilr(v( 1-nbdy,1-nbdy,1,1),1,2*kk, 1,1, halo_vv) 41 | call xctilr(vbavg(1-nbdy,1-nbdy, 1),1, 2, 1,1, halo_vv) 42 | 43 | 44 | do j=1,jja 45 | do i= 1,ii 46 | if (ishlf(i,j).eq.1) then 47 | c --- average currents over top thkcdw meters 48 | thksur = onem*min( thkcdw, depths(i,j) ) 49 | usur1 = 0.0 50 | vsur1 = 0.0 51 | psur1 = 0.0 52 | usur2 = 0.0 53 | vsur2 = 0.0 54 | psur2 = 0.0 55 | do k= 1,kk 56 | dp1 = min( dp(i,j,k,1), max( 0.0, thksur-psur1 ) ) 57 | usur1 = usur1 + dp1*(u(i,j,k,1)+u(i+1,j,k,1)) 58 | vsur1 = vsur1 + dp1*(v(i,j,k,1)+v(i,j+1,k,1)) 59 | #if defined(STOKES) 60 | usur1 = usur1 + dp1*(usd(i,j,k)+usd(i+1,j,k)) 61 | vsur1 = vsur1 + dp1*(vsd(i,j,k)+vsd(i,j+1,k)) 62 | #endif 63 | psur1 = psur1 + dp1 64 | dp2 = min( dp(i,j,k,2), max( 0.0, thksur-psur2 ) ) 65 | usur2 = usur2 + dp2*(u(i,j,k,2)+u(i+1,j,k,2)) 66 | vsur2 = vsur2 + dp2*(v(i,j,k,2)+v(i,j+1,k,2)) 67 | #if defined(STOKES) 68 | usur2 = usur2 + dp2*(usd(i,j,k)+usd(i+1,j,k)) 69 | vsur2 = vsur2 + dp2*(vsd(i,j,k)+vsd(i,j+1,k)) 70 | #endif 71 | psur2 = psur2 + dp2 72 | if (min(psur1,psur2).ge.thksur) then 73 | exit 74 | endif 75 | enddo !k 76 | umxl = 0.25*( usur1/psur1 + ubavg(i, j,1) + 77 | & ubavg(i+1,j,1) + 78 | & usur2/psur2 + ubavg(i, j,2) + 79 | & ubavg(i+1,j,2) ) 80 | vmxl = 0.25*( vsur1/psur1 + vbavg(i,j, 1) + 81 | & vbavg(i,j+1,1) + 82 | & vsur2/psur2 + vbavg(i,j, 2) + 83 | & vbavg(i,j+1,2) ) 84 | if (fieldName .eq. 'ssu') then 85 | #ifndef ESPC_NOCANONICAL_CONVERT 86 | c rotate to e-ward 87 | tmx(i,j)=cos(pang(i,j))*umxl - sin(pang(i,j))*vmxl 88 | #else 89 | tmx(i,j)=umxl 90 | #endif 91 | else !'ssv' 92 | #ifndef ESPC_NOCANONICAL_CONVERT 93 | c rotate to n-ward 94 | tmx(i,j)=cos(pang(i,j))*vmxl + sin(pang(i,j))*umxl 95 | #else 96 | tmx(i,j)=vmxl 97 | #endif 98 | endif 99 | endif !ishlf:else 100 | enddo !i 101 | enddo !j 102 | c --- Smooth surface ocean velocity fields 103 | #if defined(ARCTIC) 104 | call xctila( tmx,1,1,halo_pv) 105 | #endif 106 | call psmooth(tmx,0,0,ishlf,util1) 107 | 108 | else if(fieldName .eq. 'sss' ) then 109 | c sea surface salinity (ppt) 110 | do j=1,jj 111 | do i= 1,ii 112 | tmx(i,j) = 0.5*(saln(i,j,1,1)+saln(i,j,1,2)) 113 | enddo 114 | enddo 115 | else if(fieldName .eq. 'ssh' ) then 116 | c sea surface height in m 117 | do j=1,jj 118 | do i= 1,ii 119 | tmx(i,j) = 1./g*srfhgt(i,j) 120 | enddo 121 | enddo 122 | else if(fieldName .eq. 'ssfi' ) then 123 | c Oceanic Heat Flux Available to Sea Ice 124 | do j=1,jj 125 | do i= 1,ii 126 | c --- quantities for available freeze/melt heat flux 127 | c --- relax to tfrz with e-folding time of icefrq time steps 128 | c --- assuming the effective surface layer thickness is hfrz 129 | c --- multiply by dpbl(i,j)/hfrz to get the actual e-folding time 130 | hfrz = min( thkfrz*onem, dpbl(i,j) ) 131 | t2f = (spcifh*hfrz)/(baclin*icefrq*g) 132 | c --- average both available time steps, to avoid time splitting. 133 | smxl = 0.5*(saln(i,j,1,1)+saln(i,j,1,2)) 134 | tmxl = 0.5*(temp(i,j,1,1)+temp(i,j,1,2)) 135 | tfrz = tfrz_0 + smxl*tfrz_s !salinity dependent freezing point 136 | ssfi = (tfrz-tmxl)*t2f !W/m^2 into ocean 137 | c 138 | tmx(i,j) = max(-1000.0,min(1000.0,ssfi)) 139 | enddo 140 | enddo 141 | else if(fieldName .eq. 'mlt' ) then 142 | c Ocean Mixed Layer Thickness 143 | do j=1,jj 144 | do i= 1,ii 145 | tmx(i,j) = dpbl(i,j)*qonem 146 | enddo 147 | enddo 148 | else if(fieldName .eq. 'sbhflx' ) then 149 | c sensible heat flux 150 | do j=1,jj 151 | do i= 1,ii 152 | tmx(i,j) = exp_sbhflx(i,j) 153 | enddo 154 | enddo 155 | else if(fieldName .eq. 'lthflx' ) then 156 | c latent heat flux 157 | do j=1,jj 158 | do i= 1,ii 159 | tmx(i,j) = exp_lthflx(i,j) 160 | enddo 161 | enddo 162 | 163 | else if(fieldName .eq. 'dummy_ocn' ) then 164 | c dummy_ocn 165 | do j=1,jj 166 | do i= 1,ii 167 | c tmx(i,j)=plat(i,j) 168 | tmx(i,j) = 1. 169 | enddo 170 | enddo 171 | 172 | else 173 | c unknown export fieldName 174 | do j=1,jj 175 | do i= 1,ii 176 | tmx(i,j) = 0. 177 | enddo 178 | enddo 179 | endif 180 | 181 | return 182 | end subroutine export_from_hycom_tiled 183 | 184 | -------------------------------------------------------------------------------- /NAVYESPC/readme.sw_radflx: -------------------------------------------------------------------------------- 1 | ========================================================== 2 | When the following variables are specified in blkdat.input 3 | 0 'albflg' = ocean albedo flag (0=none,1=const,2=L&Y) 4 | 2 'lwflag' = longwave (SST) flag (0=none,1=clim,2=nwp,-1=lwdn) 5 | 6 | HYCOM variables swflx, radflx used in thermf.F are defined as 7 | swflx (Qsw): net sw flux, +ve into ocean/ice 8 | radflx (Qlw+Qs): net sw+lw flux, +ve into ocean/ice 9 | 10 | Note: swflx, and radflx are not the net ocean-only fluxes. Sea ice effect is not accounted. 11 | 12 | ====================================================== 13 | 14 | When the following variables are specified in blkdat.input 15 | 2 'albflg' = ocean albedo flag (0=none,1=const,2=L&Y) 16 | -1 'lwflag' = longwave (SST) flag (0=none,1=clim,2=nwp,-1=lwdn) 17 | 18 | 19 | HYCOM variable swflx is converted in forfun.f from downward to net shorwave to account the sea ice effect. 20 | HYCOM variable radflx is converted in thermf.f from downward to net longwave to account the sea ice effect. 21 | 22 | Eventally HYCOM variables swflx, radflx used in thermf.F are defined as 23 | swflx (Qsw): net sw flux, +ve into ocean 24 | radflx (Qlw+Qs): net lw flux, +ve into ocean 25 | 26 | Note: 27 | swflx: Qswdn -> Qsw 28 | radflx: Qlwdn -> Qlw + Qsw 29 | 30 | swflx, and radflx are the net ocean-only fluxes. Sea ice effect is accounted. 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HYCOM-src 2 | 3 | This is the HYCOM-src repository for the HYbrid Coordinate Ocean Model (HYCOM) source code. 4 | 5 | HYCOM uses conventional Primitive Equation 2nd order finite volume dynamics in the horizontal and solves the layered continuity equation. However, in the vertical it uses the Arbitrary Lagrangian Eulerian (ALE) approach to extend its range of applicability beyond that of a standard layered Ocean General Circulation Model (OGCM). 6 | 7 | # Where to find the information 8 | 9 | All information about the HYCOM-src (installation, compilation) are described in the [HYCOM-src Wiki](https://github.com/HYCOM/HYCOM-src/wiki) page. 10 | -------------------------------------------------------------------------------- /README.src/README.src.OpenMP: -------------------------------------------------------------------------------- 1 | README.src/README.src.OpenMP: 2 | 3 | The OpenMP directives allow HYCOM to run on multiple processors of 4 | shared memory machines. They can also be used in conjuction with 5 | MPI domain decomposition (MPI between multi-processor nodes, OpenMP on 6 | each node). This mode of parallelization is typically best for a 7 | relatively modest number of processors (2,3,4,6,8), although more can 8 | profitably be used on large grids. 9 | 10 | The PARAMETER mxthrd has been added to mod_dimensions.F90 and dimensions.h. 11 | Each outer (i or j) loop is diviuded into mxthrd pieces by OpenMP. So 12 | edit mxthrd to be a multiple of NOMP (i.e. OMP_NUM_THREADS). It is often 13 | best to set mxthrd larger than NOMP, because that tends to give better 14 | land/sea load balance between threads. For example, mxthrd=16 could 15 | be used with 2, 4, 8 or 16 threads. Other good choices are 12, 24, 32 16 | etcetera. Large values of mxthrd are only likely to be optimal for 17 | 18 | Parallel sums are not performed via an OpenMP REDUCTION clause, because 19 | it is not bit for bit reproducable when run twice on the same data sets. 20 | Instead, row sums are done explicitly in parellel, followed by a serial 21 | sum of the row sums. This is probably slower than REDUCTION, but it is 22 | bit for bit reproducable on any number of processors. Please report 23 | any cases where HYCOM gives different answers for different values of 24 | OMP_NUM_THREADS (this is not supposed to happen). 25 | -------------------------------------------------------------------------------- /README.src/README.src.changes.3p00: -------------------------------------------------------------------------------- 1 | README.src/README.src.changes.3p00 2 | 3 | Significant changes since 2.2.98: 4 | 5 | a) Freeform Fortran 90. 6 | 7 | b) Move the config directory (Make fragments) inside the HYCOM-src directory. 8 | 9 | c) CESM-BETA and NAVYESPC NUOPC cap examples. These are provided as examples 10 | of how to add a "cap" for coupling. Neither one is suitable for general use. 11 | 12 | d) Equation of state is chosen at compile time through new Macros: EOS_SIG0 / 13 | EOS_SIG2 and EOS_7T / EOS_9T / EOS_12T / EOS_17T. See README.src.make. 14 | 15 | e) New macro for thermobaricity correction: set KAPPAF_CENTERED to use layer centered 16 | pressure in converting sigma to sigma-star instead of upper interface pressure. 17 | 18 | f) E-P-R is now always treated as a water flux (previously a salt flux), and wtrflx 19 | is in the archive files. SSS relaxation is always a salt flux, and E-P-R is still 20 | applied as a virtual salt flux if epmass is not set true. Four new blkdat variables: 21 | empbal: E-P balance flag (0=none,1=offset,2=scale) 22 | emptgt: E-P balance target (mm/week, into ocean) 23 | sefold: e-folding time for SSS relaxation (days, -ve to input) 24 | sssbal: SSS rlx balance flag (0=none,1=offset,2=scale) 25 | Use sefold=30.0 and sssbal=0 to recover the previous SSS relaxation bahaviour. 26 | 27 | g) epmass now applies E-P-R freshwater flux to the top layer, so epmass=true gives 28 | a natural (mass flux) surface freshwater flux. 29 | 30 | h) btrmas=true makes HYCOM exactly mass conserving, but this makes the model more 31 | costly to run. Normally (btrmas=false) it is approximately mass conserving. When 32 | mass conserving, epmass=true will exactly conserve salt although there is salt 33 | exchange with sea ice to account for. The archive field thknss is always dp', where 34 | sum(dp') = bathymetry, but now new archives contain oneta where dp = dp' * oneta so 35 | that dp can be calculated if needed. HYCOM now always uses dp (not dp') for 36 | layer-based region-wide sums and time means. To confuse matters, dp in the 37 | HYCOM source code is actualy dp' (and so should have been called dpp). 38 | 39 | i) New Steric SSH option (sshflg=2) to make montg1 steric SSH. This is probably 40 | a better approach than sshflg=1, since then pbavg (bottom pressure anomaly) is 41 | non-steric SSH. As with sshflg=1, the split between steric and non-steric SSH 42 | *assumes* that the long term mean SSH is entitrely steric. So you need to read 43 | in the long term mean in relax.montg1.[ab]. 44 | 45 | j) Addition of a 365 days no leap calendar (yrflag=4). 46 | 47 | k) Energy loan model has bug corrections and the lwflg.eq.-1 logic. 48 | 49 | l) The Asselin filter is now applied near the end of the time step. 50 | -------------------------------------------------------------------------------- /README.src/README.src.changes.3p01: -------------------------------------------------------------------------------- 1 | README.src/README.src.changes.3p01 2 | 3 | Significant changes since 2.3.01: 4 | 5 | a) Added blkdat variable oneta0. 1+eta is the scale factor from depth 6 | to depth + non-steric_SSH. So 1+eta=0.0 is dry land, which isn't allowed. 7 | oneta0 sets a minimum on 1+eta. A typical value is 0.1, and there 8 | will be entries in the model .log file if oneta is clipped to oneta0. 9 | 10 | b) Added blkdat variable lbmont. When HYCOM is run with sshflg=2 the 11 | Montgomery potential is offset so that montg1 in an archive file 12 | represents steric SSH. This makes tidal analysis easier since non-steric 13 | SSH (including tides) is srfhgt-montg1. The Browning & Kreiss barotropic 14 | open boundary reads montg1, and it needs to know if this is the original 15 | field or the field corrected via sshflg=2. Hence the new blkdat variable 16 | lbmont. This only has an effect when lbflag=2, and in all legacy cases 17 | lbmont will be 0 (false). 18 | 19 | c) Added lmask_rdnest. Mean archives can contain large layer velocities 20 | near the bottom because of a mismatch between the p-grid layer thickness 21 | mean projected onto cell faces and u-grid and v-grid layer thickness means. 22 | These no longer occur for means calculated by the running model, but old 23 | in-line means and off-line means (e.g. monthly or annual) still have this 24 | issue. To prevent these large velocities effecting the baroclinic nesting, 25 | rdnest_in has a compile time parameter, lmask_rdnest, that, when .true., 26 | masks nest velocities (sets rmunv to zero) when they are outside the 27 | near-surface range. It is .false. unless CPP macro RDNEST_MASK is set. 28 | 29 | d) The Browning&Kreiss (latbdt) and Flather (latbdtf) barotropic nesting 30 | routines have been overhauled. Flather now uses p-grid nested velocities, 31 | [uv]pnst, as in Browning&Kreiss. The Browning&Kreiss normal transport now 32 | always has an along port 1-2-1 smoother applied to it. Added a compile 33 | time parameter, npline, to control how often pline is updated in latbdt. 34 | It is set to 1 unless the CPP macro LATBDT_NPLINE3 sets it to 3. 35 | 36 | e) A new variable, sports, has been optionally added to ports.input. It is 37 | a scale factor that is applied to all the nested barotropic velocities. Use 38 | 1.0 (the default if it is absent) to get the orignal velocities. If present, 39 | it is the 1st line of ports.input: 40 | 1.2 'sports' = scale factor for nested velocity (typically 1.0) 41 | 6 'nports' = number of boundary port sections 42 | 43 | f) Added wndflg=-4,-5. When wndflg is set to 4 or 5 U10 winds are read in 44 | and wind stress is calculated inside HYCOM using a bulk parameterization. 45 | This can be based either on absolute winds (U10) or relative winds (U10-Uocn). 46 | Previously, wndflg=4 always used relative winds and wndflg=5 recently used 47 | absolute winds (although the original Large&Yeager parameterizion used 48 | relative winds, and code for relative winds was included but commented out). 49 | Now, wndflg=4,5 uses relative winds and the new options wndflg=-4,-5 use 50 | absolute winds. Note that 2.3.00's wndflg=5 becomes 2.3.01's wndflg=-5. 51 | -------------------------------------------------------------------------------- /README.src/README.src.config: -------------------------------------------------------------------------------- 1 | All Makefiles source config/$(ARCH)_$(TYPE), where ARCH defines exactly what 2 | machine architecture to target and TYPE is the parallelization strategy 3 | (one, omp, mpi, ompi, mpisr, shmem). 4 | 5 | The specified config/$(ARCH)_$(TYPE) file must already exist. So far 6 | the following are available: 7 | 8 | hpe-impi-relo_mpi - HPE SGI, Intel MPI, Intel Compiler 9 | hpe-impi-relo_ompi - HPE SGI, Intel MPI+OpenMP, Intel Compiler 10 | hpe-intel-relo_mpi - HPE SGI, MPI (mpt), Intel Compiler 11 | hpe-intel-relo_ompi - HPE SGI, MPI+OpenMP (mpt), Intel Compiler 12 | hpe-intel-relo_one - HPE SGI, single processor, Intel Compiler 13 | intelGF-impi-sm-relo_mpi - IBM iDATAPlex, GNU Fortran and Intel MPI 14 | intelsse-impi-sm-relo_mpi - IBM iDATAPlex, Intel Fortran and Intel MPI 15 | intelsse-impi-sm-relo_omp - IBM iDATAPlex, Intel Fortran, OpenMP 16 | intelsse-impi-sm-relo_one - IBM iDATAPlex, Intel Fortran, single processor 17 | intelsse-pe-sm-relo_mpi - IBM iDATAPlex, Intel Fortran and IBM MPI 18 | power9-xl-smpi-relo_mpi - IBM Power9 Linux, Spectrum MPI, XL Fortran 19 | shasta-cce-relo_mpi - Cray Shasta, MPI, Cray Fortran 20 | shasta-intel-relo_mpi - Cray Shasta, MPI, Intel Fortran 21 | shasta-intel-relo_ompi - Cray Shasta, MPI+OpenMP, Intel Fortran 22 | xc40-gnu-relo_mpi - Cray XC40, MPI, GNU Fortran 23 | xc40-gnu-relo_omp - Cray XC40, OpenMP, GNU Fortran 24 | xc40-gnu-relo_one - Cray XC40, single processor, GNU Fortran 25 | xc40-intel-relo_cesmb - Cray XC40, CESMBETA, Intel Compiler 26 | xc40-intel-relo_cice - Cray XC40, HYCOM+CICE using ESMF4, Intel Compiler 27 | xc40-intel-relo_mpi - Cray XC40, MPI, Intel Compiler 28 | xc40-intel-relo_ompi - Cray XC40, MPI+OpenMP, Intel Compiler 29 | xc40-intel-relo_one - Cray XC40, single processor, Intel Compiler 30 | xc40-pgi-relo_mpi - Cray XC40, MPI, Portland Group Compiler 31 | 32 | The following environment variables must be defined in each config file: 33 | 34 | # FC: Fortran 90 compiler. 35 | # FCFFLAGS: Fortran 90 compilation flags. 36 | # CC: C compiler. 37 | # CCFLAGS: C compilation flags. 38 | # CPP: cpp preprocessor (may be implied by FC). 39 | # CPPFLAGS: cpp -D macro flags (see README.src.config.macros). 40 | # LD: Loader. 41 | # LDFLAGS: Loader flags. 42 | # EXTRALIBS: Extra local libraries (if any). 43 | 44 | In addition, make suffix rules are required for .c.o, and .F90.o 45 | (i.e. how to create .o files from .c, and .F90 files). In the 46 | simplest case these are: 47 | 48 | # 49 | # rules. 50 | # 51 | 52 | .c.o: 53 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 54 | 55 | .F90.o: 56 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 57 | 58 | Note that the rule command lines start with a tab character. 59 | -------------------------------------------------------------------------------- /README.src/README.src.config.macros: -------------------------------------------------------------------------------- 1 | Macros that may be used in config/$(ARCH)_$(TYPE) 2 | 3 | AIX IBM AIX 4 | ALPHA Compaq Alpha (Linux or OSF) 5 | HPEI HPE with Intel Fortran 6 | IA32 IA32 Linux (x86 or x86_64, Intel or AMD) 7 | SGI SGI IRIX64 8 | SUN SUN Solaris 9 | T3E Cray T3E 10 | YMP Cray YMP/C90/T90/SV1 11 | X1 Cray X1 12 | 13 | NAGFOR NAG Fortran compiler 14 | IFC Intel Fortran compiler 15 | 16 | STOP2003 Replace STOP with exit(0) 17 | NAN2003 Use ieee_arithmetic intrinsic module, and intitalize arrays to NaN 18 | 19 | RELO Allocate most arrays at run-time 20 | 21 | SERIAL_IO Serialize array I/O (MPI, SHMEM) 22 | ENDIAN_IO Swap endian-ness as part of array I/O 23 | 24 | TIMER Turn on the subroutine-level wall clock timer 25 | TIMER_ALLOUT Print timers for all MPI tasks 26 | 27 | DEBUG_ALL Sets all DEBUG_* (mod_xc) macros 28 | DEBUG_TIMER_ALL Printout every time the timer is called 29 | DEBUG_TIMER Printout every time the timer is called for a user routine 30 | 31 | MPI MPI message passing (see MPISR, NOMPIR8, SERIAL_IO, SSEND) 32 | SSEND Use MPI_SSEND and MPI_ISSEND (vs MPI_SEND and MPI_ISEND) 33 | MPISR Use MPI_SENDRECV (vs non-blocking pt2pt calls) 34 | NOMPIR8 This MPI does not implement mpi_real8 35 | REAL4 REAL is REAL*4 (never used in practice) 36 | REAL8 REAL is REAL*8 (always used in practice) 37 | SHMEM SHMEM put/get version (see RINGB, SERIAL_IO) 38 | RINGB Use local syncronization for SHMEM 39 | 40 | ------------------------------------------------------------------------------ 41 | 42 | Macros that may be included in CPP_EXTRAS by the Make script: 43 | 44 | EOS_SIG2 ## Sigma-2 45 | EOS_SIG0 ## Sigma-0 46 | 47 | EOS_7T ## EOS 7-term 48 | EOS_9T ## EOS 9-term 49 | EOS_12T ## EOS 12-term 50 | EOS_17T ## EOS 17-term 51 | 52 | ARCTIC ## global tripole region 53 | 54 | KAPPAF_CENTERED ## Thermobaricity correction centered 55 | 56 | STOKES ## Stokes drift 57 | 58 | OCEANS2 ## master and slave HYCOM in same executable 59 | 60 | MOMTUM_CFL ## include an explicit CFL limiter in momtum 61 | MOMTUM4_CFL ## include an explicit CFL limiter in momtum4 62 | 63 | RDNEST_MASK ## mask velocity outliers 64 | LATBDT_NPLINE3 ## update pline every 3 time steps 65 | 66 | MASSLESS_1MM ## lowest substantial mass-containing layer > 1mm thick 67 | -------------------------------------------------------------------------------- /README.src/README.src.dimensions: -------------------------------------------------------------------------------- 1 | If the RELO macro is set, arrays are allocated at run time and the defaults 2 | for the small number of user changeable parameters in mod_dimensions.F90 are 3 | usually appropriate. The most commonly edited parameter in mod_dimensions.F90 4 | is mxthrd which might need changing when parallelizing with OpenMP (TYPE=omp 5 | or TYPE=ompi), see README.src.OpenMP. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | If the RELO macro is not set, arrays are allocated at compile time and 10 | dimensions.h will need customizing for a new region or a different number 11 | of layers or a different TYPE. The user-tunable parameters are: 12 | 13 | itdm = total grid dimension in i direction 14 | jtdm = total grid dimension in j direction 15 | kdm = grid dimension in k direction 16 | iqr = maximum number of tiles in i direction 17 | jqr = maximum number of tiles in j direction 18 | idm = maximum single tile grid dimension in i direction 19 | jdm = maximum single tile grid dimension in j direction 20 | mxthrd = maximum number of OpenMP threads 21 | kkwall = grid dimension in k direction for wall relax arrays 22 | kknest = grid dimension in k direction for nest relax arrays 23 | kkmy25 = grid dimension in k direction for M-Y 2.5 arrays 24 | 25 | If memory is plentifull, then kkwall,kknest,kkmy25 can all be set to 26 | kdm. However, if memory is in short supply then kwall and/or kknest 27 | can be set to 1 (if wall or nest relaxation is not being used) and 28 | if the Mellor-Yamada mixed layer isn't being used kkmy25 can be set 29 | to -1. 30 | 31 | A new source code directory and executable is always required whenever 32 | itdm, or jtdm, or kdm change (i.e. whenever the region size or the 33 | number of layers change). Note that ../topo/regional.grid.b is used 34 | to define the region to setup programs, and needs to be consistent with 35 | dimensions.h. 36 | 37 | A separate source code directory and executable is always required for 38 | each parallelization strategy, or TYPE, chosen (TYPE=one, or omp, or ompi, 39 | or mpi, or shmem). The TYPE also effects how dimensions.h is configured. 40 | There are examples of dimensions.h for each TYPE in ALT_CODE. 41 | 42 | When running on a shared memory machine (TYPE=one or omp) set: 43 | iqr=jqr=1, idm=itdm, and jdm=jtdm. Note that the same OpenMP executable 44 | (TYPE=omp) can be used for a range of processor counts, provided mxthrd 45 | is chosen appropriately, see README.src.OpenMP. 46 | 47 | When running on a distributed memory machine (TYPE=mpi or ompi or shmem) 48 | set: iqr and jqr to the maximum number of processors used in each 49 | dimension, and idm and jdm to the maximum (worse case) dimensions for 50 | any single tile on any targeted number of processors. Note that the 51 | same executable can be used for a range of processor counts, provided 52 | iqr,jqr,idm,jdm are all large enough for each case. The mxthrd parameter 53 | is only important when using OpenMP, see README.src.OpenMP. 54 | -------------------------------------------------------------------------------- /README.src/README.src.make: -------------------------------------------------------------------------------- 1 | README.src.newmachine -------------------------------------------------------------------------------- /README.src/README.src.mod_xc: -------------------------------------------------------------------------------- 1 | The following are one line descriptions of all public HYCOM communication routines: 2 | 3 | xcaget - convert an entire 2-D array from tiled to non-tiled layout. 4 | xcaput - convert an entire 2-D array from non-tiled to tiled layout. 5 | xcastr - broadcast a 1-D array to all tiles. 6 | xceget - find the value of a(ia,ja) on the non-tiled 2-D grid. 7 | xceput - fill a single element in the non-tiled 2-D grid. 8 | xciget - find the value of a(ia(:),ja(:)) on the non-tiled 2-D grid. 9 | xciput - fill a list of elements in the non-tiled 2-D grid. 10 | xchalt - emergency stop all processes, called by one process. 11 | xclget - extract a line of elements from the non-tiled 2-D grid. 12 | xclput - fill a line of elements in the non-tiled 2-D grid. 13 | xcmaxr - replace array a with its element-wise maximum over all tiles. 14 | xcminr - replace array a with its element-wise minimum over all tiles. 15 | xcpipe - copy aa_slave to aa_master (pipe_compare with OCEANS2 only). 16 | xcspmd - initialize processor data structures, called once. 17 | xcstop - stop all processes, called by all processes. 18 | xcsum - sum of a 2-D array. 19 | xcsumj - row-sum of a 2-D array. 20 | xcsync - barrier, no processor exits until all arrive (flush stdout). 21 | xctbar - sync with processors ipe1 and ipe2 (internal use only). 22 | xctilr - update the tile overlap halo of a 3-D real array. 23 | 24 | xctmri - initialize timers (called in xcspmd). 25 | xctmr0 - start timer. 26 | xctmr1 - add time since call to xctim0 to timer. 27 | xctmrn - register name of timer. 28 | xctmrp - print all active timers. 29 | xctmrs - set which events to time (default 1st 5000 then every 50th). 30 | 31 | With the exception of xchalt, All these routines are assumed to be called 32 | with identical argument lists by all processors when using SPMD message 33 | passing. This is not difficult to arrange, since by default all routines 34 | are called in this manner in a SPMD run. Most communication routines 35 | act as implicit barriers that syncronize processor state, i.e. when a 36 | processor exits a communication routine at the very least all processors 37 | that must communicate with it have entered the same subroutine. In 38 | addition the subroutine xcsync provided for cases where all processors 39 | must enter a critical section of code before the first processor exits. 40 | 41 | Two versions of each subroutine are provided, mod_xc_mp.h for message 42 | passing, and mod_xc_sm.h for a single processor. The appropriate version 43 | is included in mod_xc.F90 under control of cpp macros. The routines are 44 | configured as a module, and all HYCOM routines should start with 45 | use mod_xc to allow HYCOM communication routines to be invoked when 46 | required. 47 | -------------------------------------------------------------------------------- /README.src/README.src.mod_za: -------------------------------------------------------------------------------- 1 | The following are one line descriptions of all public HYCOM I/O routines: 2 | 3 | zagetc - get (read) one line from a text file 4 | 5 | zaiost - initialize all array i/o. 6 | zaiopn - open a file for array i/o, filename from array i/o unit. 7 | zaiope - open a file for array i/o, filename from environment variable. 8 | zaiopf - open a file for array i/o, filename provided. 9 | zaiopi - is an array i/o unit open? 10 | zaiocl - close an array i/o unit. 11 | zaiofl - flush an array i/o unit. 12 | zaioiq - query an array i/o unit. 13 | zaiorw - rewind an array i/o unit. 14 | zaiord3 - read an array (3-D). 15 | zaiord - read an array. 16 | zaiordg - read an array, return non-tiled (global) real*4 array. 17 | zaiosk - skip an array read. 18 | zaiowr3 - write an array (3-D). 19 | zaiowr - write an array. 20 | 21 | All these routines are assumed to be called with identical argument lists 22 | by all processors when using SPMD message passing. This is not difficult 23 | to arrange, since by default all routines are called in this manner in a 24 | SPMD run. The zaio routines are used to process HYCOM ".a" files, which 25 | contain array data only (see below). The zagetc routine is used to 26 | process HYCOM ".b" plain text files. These are only opened on the 27 | first processor, so under MPI zagetc reads a line on the first MPI task 28 | and then broadcasts it to all other tasks. 29 | 30 | Three versions of each subroutine are provided, mod_za_mp.h for message 31 | passing with I/O from the first MPI task in each row, mod_za_mp1.h for 32 | message passing with I/O from the first MPI task, and mod_za_sm.h for a 33 | single processor (and OpenMP). The appropriate version is included in 34 | mod_za.F90 under control of cpp macros. For MPI the default is "mp", 35 | set the SERIAL_IO macro for "mp1". The routines are configured as a 36 | module, and all HYCOM routines should start with use mod_za to allow 37 | HYCOM communication routines to be invoked when required. 38 | 39 | A special version of mod_za.F is also used in HYCOM-tools (single 40 | processor) and HYCOM-tools/MPI (one MPI task per row). 41 | 42 | A related API with "za" replaced by "zb" is in HYCOM-tools/*/src/mod_zb.F. 43 | It is only used when reading in the full domain (via zaiord), but 44 | writing out a sub-domain (via zbiowr). 45 | 46 | HYCOM ".a" files contain idm*jdm 32-bit IEEE real values for each array, 47 | in standard fortran element order, followed by padding to a multiple of 48 | 4096 32-bit words (16K bytes), but otherwise with no control bytes/words, 49 | and input values of 2.0**100 indicating a data void. Each record is 50 | padded to 16K bytes to potentially improve I/O performance on some machines 51 | by aligning record boundaries on disk block boundaries. 52 | 53 | The associated HYCOM ".b" files are plain text and typically contain a 54 | 5-line header followed by one line for each 2-D array in the ".a" file. 55 | The format of the per-array line varies, but it typically use "=" to 56 | separate an array description from trailing numeric values. The latter 57 | always include the minimum and maximum value of the array as returned 58 | by zaiowr or zaiowr3 (which should be checked against the min/max of 59 | the actual array on input, returned by zaiord or zaiord3, to confirm 60 | that the .a and .b files are in fact associated with each other). 61 | -------------------------------------------------------------------------------- /README.src/README.src.newmachine: -------------------------------------------------------------------------------- 1 | README.src/README.src.newmachine: 2 | 3 | The Makefile sources ./config/$(ARCH)_$(TYPE) where ARCH defines exactly 4 | what machine architecture to target and TYPE is the parallelization 5 | strategy and precision (one, omp, mpi, ompi). 6 | 7 | The make process is automated by the script Make.csh, which should be used instead 8 | of directly invoking the make command. It keys on the source code directory name 9 | which should end with _${TYPE}, where ${TYPE} is the parallelization type (one, omp, 10 | mpi, ompi). The script Make.csh should be edited to define ${ARCH} appropriately 11 | for the machine, several options are provided as examples. In order for this to work, 12 | the file ./config/${ARCH}_${TYPE} must exist and must contain the machine-specific 13 | parts of Makefile (see README.src.config). 14 | 15 | In addition the Make.csh script selects some CPP flags for compilations: 16 | OCN_SIG -- Sigma-0 or Sigma-2 17 | OCN_EOS -- Equation Of State (7,9,12,17 term) 18 | OCN_GLB -- for global tripolar cases 19 | OCN_KAPP -- for centered thermobaricity correction 20 | OCN_MISC -- other CPP flags (-DSTOKES -DOCEANS2 etc...) 21 | 22 | The executable is then created by the command: 23 | 24 | ./Make.csh >& Make.log 25 | 26 | The script Make_global.csh is just Make.csh configured for the typical global tripole 27 | case. The script Make_cice.csh is for HYCOM+CICEv4 using the very old ESMFv4 coupler. 28 | -------------------------------------------------------------------------------- /README.src/README.src.newregion: -------------------------------------------------------------------------------- 1 | README.src/README.src.newregion: 2 | 3 | HYCOM can be handwired at compile time for a particular region, but it is now 4 | more usual to configure it to allocate memory and run time. i.e. as a relo executable. 5 | In fact, all the config examples are for relo setups. When the RELO macro is set, 6 | arrays are allocated at run time and the defaults for the small number of user 7 | changeable parameters in mod_dimensions.F90 are usually appropriate. The most 8 | commonly edited parameter in mod_dimensions.F90 is mxthrd which might need changing 9 | when parallelizing with OpenMP (TYPE=omp or TYPE=ompi), see README.src.OpenMP. 10 | If you want to use static compile-time arrays, dimensions.h will need customizing - 11 | see README.src.dimensions for more details. 12 | 13 | There is still a compile time distinction between global tripole grids (with a special 14 | halo exchange on the "north" domain edge), and the equation of state is chosen at 15 | compile time to improve performance. If you only have one domain and one equation 16 | of state you can call your directory anything you like (e.g. src_2.3.00_mpi). If 17 | you have multiple domains, one approach is to compile in the generic RELO and/or 18 | RELO_GLB "region" directory and then softlink from the actual region directories: 19 | 20 | hycom/RELO/src_2.3.00-7tsig0_mpi 21 | hycom/RELO/src_2.3.00-17tsig2_mpi 22 | hycom/GOMb0.08/src_2.3.00-17tsig2_mpi -> ../RELO/src_2.3.00-17tsig2_mpi 23 | 24 | hycom/RELO_GLB/src_2.3.00-17tsig2_mpi 25 | hycom/GLBt0.72/src_2.3.00-17tsig2_mpi -> ../RELO_GLB/src_2.3.00-17tsig2_mpi 26 | 27 | The actual region source code directores can skip the "-XtsigY" part of the name if 28 | this never changes for that domain. 29 | 30 | Then edit and run Make.csh for your setup, see README.src.newmachine for more details. 31 | -------------------------------------------------------------------------------- /config/README.src.config: -------------------------------------------------------------------------------- 1 | ../README.src/README.src.config -------------------------------------------------------------------------------- /config/README.src.config.macros: -------------------------------------------------------------------------------- 1 | ../README.src/README.src.config.macros -------------------------------------------------------------------------------- /config/generic-gnu-relo_mpi: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for Generic Intel/AMD, MPI, small memory, real*8 4 | # GNU Fortran: Assumes mpif90 is a wrapper to gfortran for MPI 5 | # -O2 to maintain bit for bit equality for all NMPI values 6 | # since gcc v10, must add -fallow-argument-mismatch - ignore mismatch warnings 7 | # version that uses MPI-2 I/O for HYCOM 8 | # relocatable version 9 | # --------------------------------------------------------------------------- 10 | # 11 | # MACROS DESCRIPTIONS: 12 | # 13 | # FC: Fortran 90 compiler. 14 | # FCFFLAGS: Fortran 90 compilation flags. 15 | # CC: C compiler. 16 | # CCFLAGS: C compilation flags. 17 | # CPP: cpp preprocessor (may be implied by FC). 18 | # CPPFLAGS: cpp -D macro flags. 19 | # LD: Loader. 20 | # LDFLAGS: Loader flags. 21 | # EXTRALIBS: Extra local libraries (if any). 22 | # 23 | FC = mpif90 24 | FCFFLAGS = -fPIC -fno-second-underscore -O2 -march=native -mavx -m64 -fdefault-real-8 -fdefault-double-8 -fallow-argument-mismatch 25 | CC = gcc 26 | CCFLAGS = -O -m64 27 | CPP = cpp -P 28 | CPPFLAGS = -DREAL8 -DMPI -DENDIAN_IO -DTIMER -DRELO $(CPP_EXTRAS) 29 | LD = $(FC) 30 | LDFLAGS = $(FCFFLAGS) 31 | EXTRALIBS = 32 | 33 | # 34 | # --- generic make definitions 35 | # 36 | SHELL = /bin/sh 37 | RM = \rm -f 38 | 39 | # 40 | # rules. 41 | # 42 | 43 | .c.o: 44 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 45 | 46 | .F90.o: 47 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 48 | -------------------------------------------------------------------------------- /config/generic-gnu-relo_one: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for Generic Intel/AMD, single processor, real*8 4 | # GNU Fortran 5 | # -O2 to maintain bit for bit equality with MPI cases 6 | # relocatable version 7 | # --------------------------------------------------------------------------- 8 | # 9 | # MACROS DESCRIPTIONS: 10 | # 11 | # FC: Fortran 90 compiler. 12 | # FCFFLAGS: Fortran 90 compilation flags. 13 | # CC: C compiler. 14 | # CCFLAGS: C compilation flags. 15 | # CPP: cpp preprocessor (may be implied by FC). 16 | # CPPFLAGS: cpp -D macro flags. 17 | # LD: Loader. 18 | # LDFLAGS: Loader flags. 19 | # EXTRALIBS: Extra local libraries (if any). 20 | # 21 | FC = gfortran 22 | FCFFLAGS = -fPIC -fno-second-underscore -O2 -march=native -mavx -m64 -fdefault-real-8 -fdefault-double-8 23 | CC = gcc 24 | CCFLAGS = -O -m64 25 | CPP = cpp -P 26 | CPPFLAGS = -DREAL8 -DENDIAN_IO -DTIMER -DRELO $(CPP_EXTRAS) 27 | LD = $(FC) 28 | LDFLAGS = $(FCFFLAGS) 29 | EXTRALIBS = 30 | 31 | # 32 | # --- generic make definitions 33 | # 34 | SHELL = /bin/sh 35 | RM = \rm -f 36 | 37 | # 38 | # rules. 39 | # 40 | 41 | .c.o: 42 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 43 | 44 | .F90.o: 45 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 46 | -------------------------------------------------------------------------------- /config/generic-intel-relo_one: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for Generic Intel/AMD, single processor, real*8 4 | # Intel Compiler 5 | # -fp-model precise -no-fma maintains bit for bit equality with MPI cases 6 | # relocatable version 7 | # --------------------------------------------------------------------------- 8 | # 9 | # MACROS DESCRIPTIONS: 10 | # 11 | # FC: Fortran 90 compiler. 12 | # FCFFLAGS: Fortran 90 compilation flags. 13 | # CC: C compiler. 14 | # CCFLAGS: C compilation flags. 15 | # CPP: cpp preprocessor (may be implied by FC). 16 | # CPPFLAGS: cpp -D macro flags. 17 | # LD: Loader. 18 | # LDFLAGS: Loader flags. 19 | # EXTRALIBS: Extra local libraries (if any). 20 | # 21 | FC = ifort 22 | FCFFLAGS = -traceback -xHost -O3 -fp-model precise -no-fma -ftz -align array64byte -r8 -warn nogeneral -diag-disable 10212 -mcmodel=medium 23 | CC = icc 24 | CCFLAGS = -traceback -xHost -O -mcmodel=medium 25 | CPP = cpp -P 26 | CPPFLAGS = -DREAL8 -DENDIAN_IO -DNAN2003 -DTIMER -DRELO $(CPP_EXTRAS) 27 | LD = $(FC) 28 | LDFLAGS = -V $(FCFFLAGS) 29 | EXTRALIBS = 30 | 31 | # 32 | # --- generic make definitions 33 | # 34 | SHELL = /bin/sh 35 | RM = \rm -f 36 | 37 | # 38 | # rules. 39 | # 40 | 41 | .c.o: 42 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 43 | 44 | .F90.o: 45 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 46 | -------------------------------------------------------------------------------- /config/hpe-gnu-relo_mpi: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for HPE SGI, MPI (mpt), small memory, real*8 4 | # GNU compiler 5 | # -O2 to maintain bit for bit equality for all NMPI values 6 | # since gcc v10, must add -fallow-argument-mismatch - ignore mismatch warnings 7 | # version that uses MPI-2 I/O for HYCOM 8 | # relocatable version 9 | # --------------------------------------------------------------------------- 10 | # 11 | # MACROS DESCRIPTIONS: 12 | # 13 | # FC: Fortran 90 compiler. 14 | # FCFFLAGS: Fortran 90 compilation flags. 15 | # CC: C compiler. 16 | # CCFLAGS: C compilation flags. 17 | # CPP: cpp preprocessor (may be implied by FC). 18 | # CPPFLAGS: cpp -D macro flags. 19 | # LD: Loader. 20 | # LDFLAGS: Loader flags. 21 | # EXTRALIBS: Extra local libraries (if any). 22 | # 23 | FC = gfortran 24 | FCFFLAGS = -fPIC -fno-second-underscore -O2 -march=native -mavx -m64 -fdefault-real-8 -fdefault-double-8 -fallow-argument-mismatch -I ${FPATH} 25 | CC = gcc 26 | CCFLAGS = -O -m64 27 | CPP = $(FC) -E 28 | CPPFLAGS = -DREAL8 -DMPI -DENDIAN_IO -DTIMER -DRELO $(CPP_EXTRAS) 29 | LD = $(FC) 30 | LDFLAGS = $(FCFFLAGS) 31 | EXTRALIBS = -lmpi 32 | 33 | # 34 | # --- generic make definitions 35 | # 36 | SHELL = /bin/sh 37 | RM = \rm -f 38 | 39 | # 40 | # rules. 41 | # 42 | 43 | .c.o: 44 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 45 | 46 | .F90.o: 47 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 48 | -------------------------------------------------------------------------------- /config/hpe-impi-relo_mpi: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for HPE SGI, Intel MPI (impi), small memory, real*8 4 | # Intel Compiler: 5 | # -fp-model precise -no-fma maintains bit for bit equality for all NMPI values 6 | # version that uses MPI-2 I/O for HYCOM 7 | # relocatable version 8 | # --------------------------------------------------------------------------- 9 | # 10 | # MACROS DESCRIPTIONS: 11 | # 12 | # FC: Fortran 90 compiler. 13 | # FCFFLAGS: Fortran 90 compilation flags. 14 | # CC: C compiler. 15 | # CCFLAGS: C compilation flags. 16 | # CPP: cpp preprocessor (may be implied by FC). 17 | # CPPFLAGS: cpp -D macro flags. 18 | # LD: Loader. 19 | # LDFLAGS: Loader flags. 20 | # EXTRALIBS: Extra local libraries (if any). 21 | # 22 | FC = mpiifort 23 | FCFFLAGS = -traceback -xHost -O3 -fp-model precise -no-fma -ftz -align array64byte -r8 -warn nogeneral -diag-disable 10212 -mcmodel=small 24 | CC = mpiicc 25 | CCFLAGS = -traceback -xHost -O -mcmodel=small 26 | CPP = cpp -P 27 | CPPFLAGS = -DREAL8 -DMPI -DENDIAN_IO -DNAN2003 -DTIMER -DRELO $(CPP_EXTRAS) 28 | LD = $(FC) 29 | LDFLAGS = -V $(FCFFLAGS) 30 | EXTRALIBS = 31 | 32 | # 33 | # --- generic make definitions 34 | # 35 | SHELL = /bin/sh 36 | RM = \rm -f 37 | 38 | # 39 | # rules. 40 | # 41 | 42 | .c.o: 43 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 44 | 45 | .F90.o: 46 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 47 | -------------------------------------------------------------------------------- /config/hpe-impi-relo_ompi: -------------------------------------------------------------------------------- 1 | # 2 | # ------------------------------------------------------------------------------- 3 | # common definitions for HPE SGI, OpenMP + Intel MPI (impi), small memory, real*8 4 | # 5 | # Intel Compiler: 6 | # -fp-model precise -no-fma maintains bit for bit equality for all NMPI values 7 | # version that uses MPI-2 I/O for HYCOM 8 | # relocatable version 9 | # ------------------------------------------------------------------------------- 10 | # 11 | # MACROS DESCRIPTIONS: 12 | # 13 | # FC: Fortran 90 compiler. 14 | # FCFFLAGS: Fortran 90 compilation flags. 15 | # CC: C compiler. 16 | # CCFLAGS: C compilation flags. 17 | # CPP: cpp preprocessor (may be implied by FC). 18 | # CPPFLAGS: cpp -D macro flags. 19 | # LD: Loader. 20 | # LDFLAGS: Loader flags. 21 | # EXTRALIBS: Extra local libraries (if any). 22 | # 23 | FC = mpiifort 24 | FCFFLAGS = -traceback -xHost -O3 -fp-model precise -no-fma -ftz -align array64byte -qopenmp -r8 -warn nogeneral -diag-disable 10212 -mcmodel=small 25 | CC = mpiicc 26 | CCFLAGS = -traceback -xHost -O -mcmodel=small 27 | CPP = cpp -P 28 | CPPFLAGS = -DREAL8 -DMPI -DENDIAN_IO -DNAN2003 -DTIMER -DRELO $(CPP_EXTRAS) 29 | LD = $(FC) 30 | LDFLAGS = -V $(FCFFLAGS) 31 | EXTRALIBS = 32 | 33 | # 34 | # --- generic make definitions 35 | # 36 | SHELL = /bin/sh 37 | RM = \rm -f 38 | 39 | # 40 | # rules. 41 | # 42 | 43 | .c.o: 44 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 45 | 46 | .F90.o: 47 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 48 | -------------------------------------------------------------------------------- /config/hpe-intel-relo_mpi: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for HPE SGI, MPI (mpt), small memory, real*8 4 | # Intel Compiler: 5 | # -fp-model precise -no-fma maintains bit for bit equality for all NMPI values 6 | # version that uses MPI-2 I/O for HYCOM 7 | # relocatable version 8 | # --------------------------------------------------------------------------- 9 | # 10 | # MACROS DESCRIPTIONS: 11 | # 12 | # FC: Fortran 90 compiler. 13 | # FCFFLAGS: Fortran 90 compilation flags. 14 | # CC: C compiler. 15 | # CCFLAGS: C compilation flags. 16 | # CPP: cpp preprocessor (may be implied by FC). 17 | # CPPFLAGS: cpp -D macro flags. 18 | # LD: Loader. 19 | # LDFLAGS: Loader flags. 20 | # EXTRALIBS: Extra local libraries (if any). 21 | # 22 | FC = ifort 23 | FCFFLAGS = -traceback -xHost -O3 -fp-model precise -no-fma -ftz -align array64byte -r8 -warn nogeneral -diag-disable 10212 -mcmodel=small 24 | CC = icc 25 | CCFLAGS = -traceback -xHost -O -mcmodel=small 26 | CPP = cpp -P 27 | CPPFLAGS = -DREAL8 -DMPI -DENDIAN_IO -DNAN2003 -DTIMER -DRELO $(CPP_EXTRAS) 28 | LD = $(FC) 29 | LDFLAGS = -V $(FCFFLAGS) 30 | EXTRALIBS = -lmpi 31 | 32 | # 33 | # --- generic make definitions 34 | # 35 | SHELL = /bin/sh 36 | RM = \rm -f 37 | 38 | # 39 | # rules. 40 | # 41 | 42 | .c.o: 43 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 44 | 45 | .F90.o: 46 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 47 | -------------------------------------------------------------------------------- /config/hpe-intel-relo_ompi: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for HPE SGI, MPI+OpenMP (mpt), small memory, real*8 4 | # Intel Compiler: 5 | # -fp-model precise -no-fma maintains bit for bit equality for all NMPI values 6 | # version that uses MPI-2 I/O for HYCOM 7 | # relocatable version 8 | # --------------------------------------------------------------------------- 9 | # 10 | # MACROS DESCRIPTIONS: 11 | # 12 | # FC: Fortran 90 compiler. 13 | # FCFFLAGS: Fortran 90 compilation flags. 14 | # CC: C compiler. 15 | # CCFLAGS: C compilation flags. 16 | # CPP: cpp preprocessor (may be implied by FC). 17 | # CPPFLAGS: cpp -D macro flags. 18 | # LD: Loader. 19 | # LDFLAGS: Loader flags. 20 | # EXTRALIBS: Extra local libraries (if any). 21 | # 22 | FC = ifort 23 | FCFFLAGS = -traceback -xHost -O3 -fp-model precise -no-fma -ftz -align array64byte -qopenmp -r8 -warn nogeneral -diag-disable 10212 -mcmodel=small 24 | CC = icc 25 | CCFLAGS = -traceback -xHost -O -mcmodel=small 26 | CPP = cpp -P 27 | CPPFLAGS = -DREAL8 -DMPI -DENDIAN_IO -DNAN2003 -DTIMER -DRELO $(CPP_EXTRAS) 28 | LD = $(FC) 29 | LDFLAGS = -V $(FCFFLAGS) 30 | EXTRALIBS = -lmpi 31 | 32 | # 33 | # --- generic make definitions 34 | # 35 | SHELL = /bin/sh 36 | RM = \rm -f 37 | 38 | # 39 | # rules. 40 | # 41 | 42 | .c.o: 43 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 44 | 45 | .F90.o: 46 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 47 | -------------------------------------------------------------------------------- /config/hpe-intel-relo_one: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for HPE SGI, single processor, real*8 4 | # Intel Compiler: 5 | # -fp-model precise -no-fma maintains bit for bit equality with MPI cases 6 | # relocatable version 7 | # --------------------------------------------------------------------------- 8 | # 9 | # MACROS DESCRIPTIONS: 10 | # 11 | # FC: Fortran 90 compiler. 12 | # FCFFLAGS: Fortran 90 compilation flags. 13 | # CC: C compiler. 14 | # CCFLAGS: C compilation flags. 15 | # CPP: cpp preprocessor (may be implied by FC). 16 | # CPPFLAGS: cpp -D macro flags. 17 | # LD: Loader. 18 | # LDFLAGS: Loader flags. 19 | # EXTRALIBS: Extra local libraries (if any). 20 | # 21 | FC = ifort 22 | FCFFLAGS = -traceback -xHost -O3 -fp-model precise -no-fma -ftz -align array64byte -r8 -warn nogeneral -diag-disable 10212 -mcmodel=medium 23 | CC = icc 24 | CCFLAGS = -traceback -xHost -O -mcmodel=medium 25 | CPP = cpp -P 26 | CPPFLAGS = -DREAL8 -DENDIAN_IO -DNAN2003 -DTIMER -DRELO $(CPP_EXTRAS) 27 | LD = $(FC) 28 | LDFLAGS = -V $(FCFFLAGS) 29 | EXTRALIBS = 30 | 31 | # 32 | # --- generic make definitions 33 | # 34 | SHELL = /bin/sh 35 | RM = \rm -f 36 | 37 | # 38 | # rules. 39 | # 40 | 41 | .c.o: 42 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 43 | 44 | .F90.o: 45 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 46 | -------------------------------------------------------------------------------- /config/intelGF-impi-sm-relo_mpi: -------------------------------------------------------------------------------- 1 | # 2 | # ------------------------------------------------------------------------------ 3 | # common definitions for GNU Fortran and Intel MPI, small memory, real*8 4 | # For IBM iDATAPlex, so use the mpi/gnu/impi module and mpif90 5 | # version that uses Serial I/O for HYCOM 6 | # relocatable version 7 | # ------------------------------------------------------------------------------ 8 | # 9 | # MACROS DESCRIPTIONS: 10 | # 11 | # FC: Fortran 90 compiler. 12 | # FCFFLAGS: Fortran 90 compilation flags. 13 | # CC: C compiler. 14 | # CCFLAGS: C compilation flags. 15 | # CPP: cpp preprocessor (may be implied by FC). 16 | # CPPFLAGS: cpp -D macro flags. 17 | # LD: Loader. 18 | # LDFLAGS: Loader flags. 19 | # EXTRALIBS: Extra local libraries (if any). 20 | # 21 | FC = mpif90 22 | FCFFLAGS = -fPIC -fno-second-underscore -O2 -march=native -m64 -fdefault-real-8 -fdefault-double-8 23 | CC = gcc 24 | CCFLAGS = -O -m64 25 | CPP = cpp -P 26 | CPPFLAGS = -DREAL8 -DMPI -DSERIAL_IO -DENDIAN_IO -DTIMER -DRELO $(CPP_EXTRAS) 27 | LD = $(FC) 28 | LDFLAGS = -v $(FCFFLAGS) 29 | EXTRALIBS = 30 | 31 | # 32 | # --- generic make definitions 33 | # 34 | SHELL = /bin/sh 35 | RM = \rm -f 36 | 37 | # 38 | # rules. 39 | # 40 | 41 | .c.o: 42 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 43 | 44 | .F90.o: 45 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 46 | -------------------------------------------------------------------------------- /config/intelsse-impi-sm-relo_mpi: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for Intel Fortran and MPI, small memory, real*8 4 | # -fp-model source to maintain bit for bit equality for all NMPI values 5 | # On IBM iDATAPlex, use the mpi/intel/impi module 6 | # Emulate SGI Altix ICE on IBM iDataPlex using -xSSE4.2 7 | # version that uses Serial I/O for HYCOM 8 | # relocatable version 9 | # --------------------------------------------------------------------------- 10 | # 11 | # MACROS DESCRIPTIONS: 12 | # 13 | # FC: Fortran 90 compiler. 14 | # FCFFLAGS: Fortran 90 compilation flags. 15 | # CC: C compiler. 16 | # CCFLAGS: C compilation flags. 17 | # CPP: cpp preprocessor (may be implied by FC). 18 | # CPPFLAGS: cpp -D macro flags. 19 | # LD: Loader. 20 | # LDFLAGS: Loader flags. 21 | # EXTRALIBS: Extra local libraries (if any). 22 | # 23 | FC = mpiifort 24 | FCFFLAGS = -traceback -xSSE4.2 -O3 -fp-model source -r8 -warn nogeneral -mcmodel=small 25 | CC = icc 26 | CCFLAGS = -traceback -xSSE4.2 -O -mcmodel=small 27 | CPP = cpp -P 28 | CPPFLAGS = -DREAL8 -DMPI -DSERIAL_IO -DENDIAN_IO -DNAN2003 -DTIMER -DRELO $(CPP_EXTRAS) 29 | LD = $(FC) 30 | LDFLAGS = -V $(FCFFLAGS) -static-intel 31 | EXTRALIBS = 32 | 33 | # 34 | # --- generic make definitions 35 | # 36 | SHELL = /bin/sh 37 | RM = \rm -f 38 | 39 | # 40 | # rules. 41 | # 42 | 43 | .c.o: 44 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 45 | 46 | .F90.o: 47 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 48 | -------------------------------------------------------------------------------- /config/intelsse-impi-sm-relo_omp: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for Intel Fortran, OpenMP, real*8 4 | # -fp-model source to maintain bit for bit equality for all NMPI values 5 | # Emulate SGI Altix ICE on IBM iDataPlex using -xSSE4.2 6 | # version that includes Stokes Drift 7 | # relocatable version 8 | # --------------------------------------------------------------------------- 9 | # 10 | # MACROS DESCRIPTIONS: 11 | # 12 | # FC: Fortran 90 compiler. 13 | # FCFFLAGS: Fortran 90 compilation flags. 14 | # CC: C compiler. 15 | # CCFLAGS: C compilation flags. 16 | # CPP: cpp preprocessor (may be implied by FC). 17 | # CPPFLAGS: cpp -D macro flags. 18 | # LD: Loader. 19 | # LDFLAGS: Loader flags. 20 | # EXTRALIBS: Extra local libraries (if any). 21 | # 22 | FC = ifort 23 | FCFFLAGS = -traceback -xSSE4.2 -O3 -fp-model source -openmp -r8 -warn nogeneral -mcmodel=medium 24 | CC = icc 25 | CCFLAGS = -traceback -xSSE4.2 -O -mcmodel=medium 26 | CPP = cpp -P 27 | CPPFLAGS = -DREAL8 -DENDIAN_IO -DNAN2003 -DTIMER -DRELO $(CPP_EXTRAS) 28 | LD = $(FC) 29 | LDFLAGS = -V $(FCFFLAGS) 30 | EXTRALIBS = 31 | 32 | # 33 | # --- generic make definitions 34 | # 35 | SHELL = /bin/sh 36 | RM = \rm -f 37 | 38 | # 39 | # rules. 40 | # 41 | 42 | .c.o: 43 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 44 | 45 | .F90.o: 46 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 47 | -------------------------------------------------------------------------------- /config/intelsse-impi-sm-relo_one: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for Intel Fortran, single processor, real*8 4 | # -fp-model source to maintain bit for bit equality for all NMPI values 5 | # Emulate SGI Altix ICE on IBM iDataPlex using -xSSE4.2 6 | # relocatable version 7 | # --------------------------------------------------------------------------- 8 | # 9 | # MACROS DESCRIPTIONS: 10 | # 11 | # FC: Fortran 90 compiler. 12 | # FCFFLAGS: Fortran 90 compilation flags. 13 | # CC: C compiler. 14 | # CCFLAGS: C compilation flags. 15 | # CPP: cpp preprocessor (may be implied by FC). 16 | # CPPFLAGS: cpp -D macro flags. 17 | # LD: Loader. 18 | # LDFLAGS: Loader flags. 19 | # EXTRALIBS: Extra local libraries (if any). 20 | # 21 | FC = ifort 22 | FCFFLAGS = -traceback -xSSE4.2 -O3 -fp-model source -r8 -warn nogeneral -mcmodel=medium 23 | CC = icc 24 | CCFLAGS = -traceback -xSSE4.2 -O -mcmodel=medium 25 | CPP = cpp -P 26 | CPPFLAGS = -DREAL8 -DENDIAN_IO -DNAN2003 -DTIMER -DRELO $(CPP_EXTRAS) 27 | LD = $(FC) 28 | LDFLAGS = -V $(FCFFLAGS) 29 | EXTRALIBS = 30 | 31 | # 32 | # --- generic make definitions 33 | # 34 | SHELL = /bin/sh 35 | RM = \rm -f 36 | 37 | # 38 | # rules. 39 | # 40 | 41 | .c.o: 42 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 43 | 44 | .F90.o: 45 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 46 | -------------------------------------------------------------------------------- /config/intelsse-pe-sm-relo_mpi: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for IBM iDataPlex, IBM MPI, small memory, real*8 4 | # -fp-model source to maintain bit for bit equality for all NMPI values 5 | # On IBM iDATAPlex, use the mpi/intel/ibmpe module 6 | # Emulate SGI Altix ICE on IBM iDataPlex using -xSSE4.2 7 | # version that uses Serial I/O for HYCOM 8 | # relocatable version 9 | # --------------------------------------------------------------------------- 10 | # 11 | # MACROS DESCRIPTIONS: 12 | # 13 | # FC: Fortran 90 compiler. 14 | # FCFFLAGS: Fortran 90 compilation flags. 15 | # CC: C compiler. 16 | # CCFLAGS: C compilation flags. 17 | # CPP: cpp preprocessor (may be implied by FC). 18 | # CPPFLAGS: cpp -D macro flags. 19 | # LD: Loader. 20 | # LDFLAGS: Loader flags. 21 | # EXTRALIBS: Extra local libraries (if any). 22 | # 23 | FC = mpiifort 24 | FCFFLAGS = -traceback -xSSE4.2 -O3 -fp-model source -r8 -warn nogeneral -mcmodel=small 25 | CC = mpiicc 26 | CCFLAGS = -traceback -xSSE4.2 -O -mcmodel=small 27 | CPP = cpp -P 28 | CPPFLAGS = -DREAL8 -DMPI -DSERIAL_IO -DENDIAN_IO -DNAN2003 -DTIMER -DRELO $(CPP_EXTRAS) 29 | LD = $(FC) 30 | LDFLAGS = -V $(FCFFLAGS) -shared-intel 31 | EXTRALIBS = 32 | 33 | # 34 | # --- generic make definitions 35 | # 36 | SHELL = /bin/sh 37 | RM = \rm -f 38 | 39 | # 40 | # rules. 41 | # 42 | 43 | .c.o: 44 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 45 | 46 | .F90.o: 47 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 48 | -------------------------------------------------------------------------------- /config/power9-xl-smpi-relo_mpi: -------------------------------------------------------------------------------- 1 | # 2 | # ------------------------------------------------------------------------------ 3 | # common definitions for XL Fortran and Spectrum MPI on IBM Power9 Linux. 4 | # version that uses Serial I/O for HYCOM 5 | # relocatable version 6 | # ------------------------------------------------------------------------------ 7 | # 8 | # MACROS DESCRIPTIONS: 9 | # 10 | # FC: Fortran 90 compiler. 11 | # FCFFLAGS: Fortran 90 compilation flags. 12 | # CC: C compiler. 13 | # CCFLAGS: C compilation flags. 14 | # CPP: cpp preprocessor (may be implied by FC). 15 | # CPPFLAGS: cpp -D macro flags. 16 | # LD: Loader. 17 | # LDFLAGS: Loader flags. 18 | # EXTRALIBS: Extra local libraries (if any). 19 | # 20 | FC = mpif90 21 | FCFFLAGS = -O3 -qstrict -qrealsize=8 -qufmt=be -WF,-C! 22 | CC = xlc 23 | CCFLAGS = -O 24 | CPP = cpp -P 25 | CPPFLAGS = -DREAL8 -DMPI -DSERIAL_IO -DTIMER -DRELO -DPOWER9 $(CPP_EXTRAS) 26 | LD = $(FC) 27 | LDFLAGS = -v $(FCFFLAGS) 28 | EXTRALIBS = 29 | 30 | # 31 | # --- generic make definitions 32 | # 33 | SHELL = /bin/sh 34 | RM = \rm -f 35 | 36 | # 37 | # rules. 38 | # 39 | 40 | .c.o: 41 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 42 | 43 | .F90.o: 44 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 45 | -------------------------------------------------------------------------------- /config/shasta-cce-relo_mpi: -------------------------------------------------------------------------------- 1 | # 2 | # ------------------------------------------------------------------------------ 3 | # common definitions for 128-core HPE Cray Shasta, MPI, small memory, real*8 4 | # CCE Compiler: 5 | # -h fp1=approx,nofma,vector1 maintains bit for bit equality for all NMPI values 6 | # version that uses MPI-2 I/O for HYCOM 7 | # relocatable version 8 | # ------------------------------------------------------------------------------ 9 | # 10 | # MACROS DESCRIPTIONS: 11 | # 12 | # FC: Fortran 90 compiler. 13 | # FCFFLAGS: Fortran 90 compilation flags. 14 | # CC: C compiler. 15 | # CCFLAGS: C compilation flags. 16 | # CPP: cpp preprocessor (may be implied by FC). 17 | # CPPFLAGS: cpp -D macro flags. 18 | # LD: Loader. 19 | # LDFLAGS: Loader flags. 20 | # EXTRALIBS: Extra local libraries (if any). 21 | # 22 | FC = ftn 23 | FCFFLAGS = -O2 -h fp1=approx,nofma,vector1 -s real64 -M 1077 24 | CC = cc 25 | CCFLAGS = -O2 26 | CPP = cpp -P 27 | CPPFLAGS = -DREAL8 -DMPI -DENDIAN_IO -DNAN2003 -DTIMER -DRELO $(CPP_EXTRAS) 28 | LD = $(FC) 29 | LDFLAGS = -V 30 | EXTRALIBS = 31 | 32 | # 33 | # --- generic make definitions 34 | # 35 | SHELL = /bin/sh 36 | RM = \rm -f 37 | 38 | # 39 | # rules. 40 | # 41 | 42 | .c.o: 43 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 44 | 45 | .F90.o: 46 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 47 | -------------------------------------------------------------------------------- /config/shasta-intel-relo_mpi: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for 128-core HPE Cray Shasta, MPI, small memory, real*8 4 | # Intel Compiler: 5 | # -fp-model precise -no-fma maintains bit for bit equality for all NMPI values 6 | # version that uses MPI-2 I/O for HYCOM 7 | # relocatable version 8 | # --------------------------------------------------------------------------- 9 | # 10 | # MACROS DESCRIPTIONS: 11 | # 12 | # FC: Fortran 90 compiler. 13 | # FCFFLAGS: Fortran 90 compilation flags. 14 | # CC: C compiler. 15 | # CCFLAGS: C compilation flags. 16 | # CPP: cpp preprocessor (may be implied by FC). 17 | # CPPFLAGS: cpp -D macro flags. 18 | # LD: Loader. 19 | # LDFLAGS: Loader flags. 20 | # EXTRALIBS: Extra local libraries (if any). 21 | # 22 | FC = ftn 23 | FCFFLAGS = -traceback -march=core-avx2 -O3 -fp-model precise -no-fma -ftz -align array64byte -r8 -warn nogeneral -diag-disable 10121 -mcmodel=small 24 | CC = cc 25 | CCFLAGS = -traceback -O -mcmodel=small 26 | CPP = cpp -P 27 | CPPFLAGS = -DREAL8 -DMPI -DENDIAN_IO -DNAN2003 -DTIMER -DRELO $(CPP_EXTRAS) 28 | LD = $(FC) 29 | LDFLAGS = -V $(FCFFLAGS) 30 | EXTRALIBS = 31 | 32 | # 33 | # --- generic make definitions 34 | # 35 | SHELL = /bin/sh 36 | RM = \rm -f 37 | 38 | # 39 | # rules. 40 | # 41 | 42 | .c.o: 43 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 44 | 45 | .F90.o: 46 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 47 | -------------------------------------------------------------------------------- /config/shasta-intel-relo_ompi: -------------------------------------------------------------------------------- 1 | # 2 | # ---------------------------------------------------------------------------------- 3 | # common definitions for 128-core HPE Cray Shasta, MPI+OpenMP, small memory, real*8 4 | # Intel Compiler: 5 | # -fp-model precise -no-fma maintains bit for bit equality for all NMPI values 6 | # version that uses MPI-2 I/O for HYCOM 7 | # relocatable version 8 | # ---------------------------------------------------------------------------------- 9 | # 10 | # MACROS DESCRIPTIONS: 11 | # 12 | # FC: Fortran 90 compiler. 13 | # FCFFLAGS: Fortran 90 compilation flags. 14 | # CC: C compiler. 15 | # CCFLAGS: C compilation flags. 16 | # CPP: cpp preprocessor (may be implied by FC). 17 | # CPPFLAGS: cpp -D macro flags. 18 | # LD: Loader. 19 | # LDFLAGS: Loader flags. 20 | # EXTRALIBS: Extra local libraries (if any). 21 | # 22 | FC = ftn 23 | FCFFLAGS = -traceback -march=core-avx2 -O3 -fp-model precise -no-fma -ftz -align array64byte -qopenmp -r8 -warn nogeneral -diag-disable 10121 -mcmodel=small 24 | CC = cc 25 | CCFLAGS = -traceback -O -mcmodel=small 26 | CPP = cpp -P 27 | CPPFLAGS = -DREAL8 -DMPI -DENDIAN_IO -DNAN2003 -DTIMER -DRELO $(CPP_EXTRAS) 28 | LD = $(FC) 29 | LDFLAGS = -V $(FCFFLAGS) 30 | EXTRALIBS = 31 | 32 | # 33 | # --- generic make definitions 34 | # 35 | SHELL = /bin/sh 36 | RM = \rm -f 37 | 38 | # 39 | # rules. 40 | # 41 | 42 | .c.o: 43 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 44 | 45 | .F90.o: 46 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 47 | -------------------------------------------------------------------------------- /config/xc40-gnu-relo_mpi: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for 32-core Cray XC40, MPI, small memory, real*8 4 | # GNU Fortran: module switch PrgEnv-cray PrgEnv-GNU 5 | # -O2 to maintain bit for bit equality for all NMPI values 6 | # version that uses MPI-2 I/O for HYCOM 7 | # relocatable version 8 | # --------------------------------------------------------------------------- 9 | # 10 | # MACROS DESCRIPTIONS: 11 | # 12 | # FC: Fortran 90 compiler. 13 | # FCFFLAGS: Fortran 90 compilation flags. 14 | # CC: C compiler. 15 | # CCFLAGS: C compilation flags. 16 | # CPP: cpp preprocessor (may be implied by FC). 17 | # CPPFLAGS: cpp -D macro flags. 18 | # LD: Loader. 19 | # LDFLAGS: Loader flags. 20 | # EXTRALIBS: Extra local libraries (if any). 21 | # 22 | FC = ftn 23 | FCFFLAGS = -fPIC -fno-second-underscore -O2 -march=native -mavx -m64 -fdefault-real-8 -fdefault-double-8 24 | CC = cc 25 | CCFLAGS = -O -m64 26 | CPP = cpp -P 27 | CPPFLAGS = -DREAL8 -DMPI -DENDIAN_IO -DTIMER -DRELO $(CPP_EXTRAS) 28 | LD = $(FC) 29 | LDFLAGS = $(FCFFLAGS) 30 | EXTRALIBS = 31 | 32 | # 33 | # --- generic make definitions 34 | # 35 | SHELL = /bin/sh 36 | RM = \rm -f 37 | 38 | # 39 | # rules. 40 | # 41 | 42 | .c.o: 43 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 44 | 45 | .F90.o: 46 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 47 | -------------------------------------------------------------------------------- /config/xc40-gnu-relo_omp: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for Cray XC40, OpenMP, real*8 4 | # GNU Fortran: module switch PrgEnv-cray PrgEnv-GNU 5 | # -O2 to maintain bit for bit equality with MPI cases 6 | # relocatable version 7 | # --------------------------------------------------------------------------- 8 | # 9 | # MACROS DESCRIPTIONS: 10 | # 11 | # FC: Fortran 90 compiler. 12 | # FCFFLAGS: Fortran 90 compilation flags. 13 | # CC: C compiler. 14 | # CCFLAGS: C compilation flags. 15 | # CPP: cpp preprocessor (may be implied by FC). 16 | # CPPFLAGS: cpp -D macro flags. 17 | # LD: Loader. 18 | # LDFLAGS: Loader flags. 19 | # EXTRALIBS: Extra local libraries (if any). 20 | # 21 | FC = gfortran 22 | FCFFLAGS = -fPIC -fno-second-underscore -O2 -march=native -mavx -m64 -fopenmp -fdefault-real-8 -fdefault-double-8 23 | CC = gcc 24 | CCFLAGS = -O -m64 25 | CPP = cpp -P 26 | CPPFLAGS = -DREAL8 -DENDIAN_IO -DTIMER -DRELO $(CPP_EXTRAS) 27 | LD = $(FC) 28 | LDFLAGS = $(FCFFLAGS) 29 | EXTRALIBS = 30 | 31 | # 32 | # --- generic make definitions 33 | # 34 | SHELL = /bin/sh 35 | RM = \rm -f 36 | 37 | # 38 | # rules. 39 | # 40 | 41 | .c.o: 42 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 43 | 44 | .F90.o: 45 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 46 | -------------------------------------------------------------------------------- /config/xc40-gnu-relo_one: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for Cray XC40, single processor, real*8 4 | # GNU Fortran: module switch PrgEnv-cray PrgEnv-GNU 5 | # -O2 to maintain bit for bit equality with MPI cases 6 | # relocatable version 7 | # --------------------------------------------------------------------------- 8 | # 9 | # MACROS DESCRIPTIONS: 10 | # 11 | # FC: Fortran 90 compiler. 12 | # FCFFLAGS: Fortran 90 compilation flags. 13 | # CC: C compiler. 14 | # CCFLAGS: C compilation flags. 15 | # CPP: cpp preprocessor (may be implied by FC). 16 | # CPPFLAGS: cpp -D macro flags. 17 | # LD: Loader. 18 | # LDFLAGS: Loader flags. 19 | # EXTRALIBS: Extra local libraries (if any). 20 | # 21 | FC = gfortran 22 | FCFFLAGS = -fPIC -fno-second-underscore -O2 -march=native -mavx -m64 -fdefault-real-8 -fdefault-double-8 23 | CC = gcc 24 | CCFLAGS = -O -m64 25 | CPP = cpp -P 26 | CPPFLAGS = -DREAL8 -DENDIAN_IO -DTIMER -DRELO $(CPP_EXTRAS) 27 | LD = $(FC) 28 | LDFLAGS = $(FCFFLAGS) 29 | EXTRALIBS = 30 | 31 | # 32 | # --- generic make definitions 33 | # 34 | SHELL = /bin/sh 35 | RM = \rm -f 36 | 37 | # 38 | # rules. 39 | # 40 | 41 | .c.o: 42 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 43 | 44 | .F90.o: 45 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 46 | -------------------------------------------------------------------------------- /config/xc40-intel-relo_cesmb: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------- 3 | # common definitions for Intel Linux/IFC, MPI, real*8 4 | # on Zeus 5 | # --------------------------------------------------------------------- 6 | 7 | # --------------------------------------------------------------------- 8 | # # Find the ESMF makefile fragment 9 | ifneq ($(origin ESMFMKFILE), environment) 10 | $(error Environment variable ESMFMKFILE was not set.) 11 | endif 12 | include $(ESMFMKFILE) 13 | # --------------------------------------------------------------------- 14 | 15 | # MACROS DESCRIPTIONS: 16 | # 17 | # FC: Fortran 90 compiler. 18 | # FCFFLAGS: Fortran 90 compilation flags. 19 | # CC: C compiler. 20 | # CCFLAGS: C compilation flags. 21 | # CPP: cpp preprocessor (may be implied by FC). 22 | # CPPFLAGS: cpp -D macro flags. 23 | # LD: Loader. 24 | # LDFLAGS: Loader flags. 25 | # EXTRALIBS: Extra local libraries (if any). 26 | # 27 | FC = $(ESMF_F90COMPILER) 28 | #FCFFLAGS = -g -convert big_endian -assume byterecl -cm -vec_report0 -w -O3 -tpp7 -xW -r8 -mt_mpi 29 | #FCFFLAGS = -g -cm -vec_report0 -w -O3 -tpp7 -xW -r8 -mt_mpi 30 | #FCFFLAGS = -assume byterecl -cm -vec_report0 -w -O0 -g -xSSE4.2 -ip -tpp7 -xW -r8 -lmpi 31 | FCFFLAGS = -traceback -xHost -O3 -fp-model precise -no-fma -ftz -align array64byte -r8 -warn nogeneral -diag-disable 10212 -mcmodel=small 32 | CC = gcc 33 | CCFLAGS = -O -g 34 | CPP = cpp -P 35 | CPPFLAGS = -DUSE_NUOPC_CESMBETA -DREAL8 -DENDIAN_IO -DMPI -DSERIAL_IO -DTIMER -DRELO $(CPP_EXTRAS) 36 | LD = $(FC) 37 | #LDFLAGS = $(FCFFLAGS) -Vaxlib -Bstatic 38 | LDFLAGS = $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) $(FCFFLAGS) 39 | EXTRALIBS = $(ESMF_F90ESMFLINKLIBS) 40 | 41 | # 42 | # --- generic make definitions 43 | # 44 | SHELL = /bin/sh 45 | RM = \rm -f 46 | 47 | # 48 | # rules. 49 | # 50 | 51 | .c.o: 52 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 53 | 54 | .F90.o: 55 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 56 | -------------------------------------------------------------------------------- /config/xc40-intel-relo_cice: -------------------------------------------------------------------------------- 1 | # 2 | # ---------------------------------------------------------------------------- 3 | # common definitions for 32-core Cray XC40, MPI, small memory, real*8, ARCTIC 4 | # HYCOM+CICE using ESMF4; see http://www.esmf.ucar.edu/ for ESMF 5 | # Intel Compiler: module switch PrgEnv-cray PrgEnv-intel 6 | # -fp-model precise -no-fma maintains bit for bit equality for all NMPI values 7 | # version that uses MPI-2 I/O for HYCOM 8 | # relocatable version 9 | # ---------------------------------------------------------------------------- 10 | # 11 | # MACROS DESCRIPTIONS: 12 | # 13 | # FC: Fortran 90 compiler. 14 | # FCFFLAGS: Fortran 90 compilation flags. 15 | # CC: C compiler. 16 | # CCFLAGS: C compilation flags. 17 | # CPP: cpp preprocessor (may be implied by FC). 18 | # CPPFLAGS: cpp -D macro flags. 19 | # LD: Loader. 20 | # LDFLAGS: Loader flags. 21 | # EXTRALIBS: Extra local libraries (if any). 22 | # 23 | 24 | FC = ftn 25 | INCLUDES = -I${ESMF_DIR}/mod/modO -I${ESMF_DIR}/include -I${CICE_DIR}/esmf/compile 26 | FCFFLAGS = -traceback -xHost -O3 -fp-model precise -no-fma -ftz -align array64byte -r8 -warn nogeneral -diag-disable 10212 -mcmodel=small $(INCLUDES) 27 | CC = cc 28 | CCFLAGS = -traceback -xHost -O -mcmodel=small 29 | CPP = cpp -P 30 | CPPFLAGS = -DUSE_ESMF4 -DREAL8 -DMPI -DENDIAN_IO -DTIMER -DRELO $(CPP_EXTRAS) 31 | LD = $(FC) 32 | LDFLAGS = -V $(FCFFLAGS) 33 | EXTRALIBS = 34 | EXTRALIBS = -L/p/home/wallcraf/pkgs/netcdf/intel/4.0.1/lib -lnetcdf -L${ESMF_DIR}/lib/libO -lesmf -lAtpSigHandler -lAtpSigHCommData -lpthread -liomp5 -limf -lm -lpthread -ldl -lsci_intel_mp -liomp5 -limf -lm -lpthread -ldl -lrt -lugni -lpthread -lpmi -limf -lm -ldl -lrt -lugni -lpthread -lpmi -limf -lm -ldl -ldmapp -lmpl -lpmi -lpthread -lalpslli -lpthread -lwlm_detect -lugni -lpthread -lalpsutil -lpthread -lrca -lxpmem -ludreg -limf -lm -lifcore -lifport -lpthread -limf -lsvml -lirng -lm -lipgo -ldecimal -lstdc++ -lgcc -lgcc_eh -lirc -lsvml -lgcc -lgcc_eh -lirc_s -ldl -lrt -ldl 35 | 36 | 37 | # --- generic make definitions 38 | # 39 | SHELL = /bin/sh 40 | RM = \rm -f 41 | 42 | # 43 | # rules. 44 | # 45 | 46 | .c.o: 47 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 48 | 49 | .F90.o: 50 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 51 | -------------------------------------------------------------------------------- /config/xc40-intel-relo_mpi: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for 32-core Cray XC40, MPI, small memory, real*8 4 | # Intel Compiler: module switch PrgEnv-cray PrgEnv-intel 5 | # -fp-model precise -no-fma maintains bit for bit equality for all NMPI values 6 | # version that uses MPI-2 I/O for HYCOM 7 | # relocatable version 8 | # --------------------------------------------------------------------------- 9 | # 10 | # MACROS DESCRIPTIONS: 11 | # 12 | # FC: Fortran 90 compiler. 13 | # FCFFLAGS: Fortran 90 compilation flags. 14 | # CC: C compiler. 15 | # CCFLAGS: C compilation flags. 16 | # CPP: cpp preprocessor (may be implied by FC). 17 | # CPPFLAGS: cpp -D macro flags. 18 | # LD: Loader. 19 | # LDFLAGS: Loader flags. 20 | # EXTRALIBS: Extra local libraries (if any). 21 | # 22 | FC = ftn 23 | FCFFLAGS = -traceback -xHost -O3 -fp-model precise -no-fma -ftz -align array64byte -r8 -warn nogeneral -diag-disable 10212 -mcmodel=small 24 | CC = cc 25 | CCFLAGS = -traceback -xHost -O -mcmodel=small 26 | CPP = cpp -P 27 | CPPFLAGS = -DREAL8 -DMPI -DENDIAN_IO -DNAN2003 -DTIMER -DRELO $(CPP_EXTRAS) 28 | LD = $(FC) 29 | LDFLAGS = -V $(FCFFLAGS) 30 | EXTRALIBS = 31 | 32 | # 33 | # --- generic make definitions 34 | # 35 | SHELL = /bin/sh 36 | RM = \rm -f 37 | 38 | # 39 | # rules. 40 | # 41 | 42 | .c.o: 43 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 44 | 45 | .F90.o: 46 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 47 | -------------------------------------------------------------------------------- /config/xc40-intel-relo_ompi: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for 32-core Cray XC40, MPI+OpenMP, small memory, real*8 4 | # Intel Compiler: module switch PrgEnv-cray PrgEnv-intel 5 | # -fp-model precise -no-fma maintains bit for bit equality for all NMPI values 6 | # version that uses MPI-2 I/O for HYCOM 7 | # relocatable version 8 | # --------------------------------------------------------------------------- 9 | # 10 | # MACROS DESCRIPTIONS: 11 | # 12 | # FC: Fortran 90 compiler. 13 | # FCFFLAGS: Fortran 90 compilation flags. 14 | # CC: C compiler. 15 | # CCFLAGS: C compilation flags. 16 | # CPP: cpp preprocessor (may be implied by FC). 17 | # CPPFLAGS: cpp -D macro flags. 18 | # LD: Loader. 19 | # LDFLAGS: Loader flags. 20 | # EXTRALIBS: Extra local libraries (if any). 21 | # 22 | FC = ftn 23 | FCFFLAGS = -traceback -xHost -O3 -fp-model precise -no-fma -ftz -align array64byte -qopenmp -r8 -warn nogeneral -diag-disable 10212 -mcmodel=small 24 | CC = cc 25 | CCFLAGS = -traceback -xHost -O -mcmodel=small 26 | CPP = cpp -P 27 | CPPFLAGS = -DREAL8 -DMPI -DENDIAN_IO -DNAN2003 -DTIMER -DRELO $(CPP_EXTRAS) 28 | LD = $(FC) 29 | LDFLAGS = -V $(FCFFLAGS) 30 | EXTRALIBS = 31 | 32 | # 33 | # --- generic make definitions 34 | # 35 | SHELL = /bin/sh 36 | RM = \rm -f 37 | 38 | # 39 | # rules. 40 | # 41 | 42 | .c.o: 43 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 44 | 45 | .F90.o: 46 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 47 | -------------------------------------------------------------------------------- /config/xc40-intel-relo_one: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for Cray XC40, single processor, real*8 4 | # Intel Compiler: module switch PrgEnv-cray PrgEnv-intel 5 | # -fp-model precise -no-fma maintains bit for bit equality with MPI cases 6 | # relocatable version 7 | # --------------------------------------------------------------------------- 8 | # 9 | # MACROS DESCRIPTIONS: 10 | # 11 | # FC: Fortran 90 compiler. 12 | # FCFFLAGS: Fortran 90 compilation flags. 13 | # CC: C compiler. 14 | # CCFLAGS: C compilation flags. 15 | # CPP: cpp preprocessor (may be implied by FC). 16 | # CPPFLAGS: cpp -D macro flags. 17 | # LD: Loader. 18 | # LDFLAGS: Loader flags. 19 | # EXTRALIBS: Extra local libraries (if any). 20 | # 21 | FC = ifort 22 | FCFFLAGS = -traceback -xHost -O3 -fp-model precise -no-fma -ftz -align array64byte -r8 -warn nogeneral -diag-disable 10212 -mcmodel=medium 23 | CC = icc 24 | CCFLAGS = -traceback -xHost -O -mcmodel=medium 25 | CPP = cpp -P 26 | CPPFLAGS = -DREAL8 -DENDIAN_IO -DNAN2003 -DTIMER -DRELO $(CPP_EXTRAS) 27 | LD = $(FC) 28 | LDFLAGS = -V $(FCFFLAGS) 29 | EXTRALIBS = 30 | 31 | # 32 | # --- generic make definitions 33 | # 34 | SHELL = /bin/sh 35 | RM = \rm -f 36 | 37 | # 38 | # rules. 39 | # 40 | 41 | .c.o: 42 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 43 | 44 | .F90.o: 45 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 46 | -------------------------------------------------------------------------------- /config/xc40-pgi-relo_mpi: -------------------------------------------------------------------------------- 1 | # 2 | # --------------------------------------------------------------------------- 3 | # common definitions for 32-core Cray XC40, MPI, small memory, real*8 4 | # Portland Group Compiler: module switch PrgEnv-cray PrgEnv-pgi 5 | # -Mvect=simd,uniform -Kieee maintains bit for bit equality for all NMPI values 6 | # version that uses MPI-2 I/O for HYCOM 7 | # relocatable version 8 | # --------------------------------------------------------------------------- 9 | # 10 | # MACROS DESCRIPTIONS: 11 | # 12 | # FC: Fortran 90 compiler. 13 | # FCFFLAGS: Fortran 90 compilation flags. 14 | # CC: C compiler. 15 | # CCFLAGS: C compilation flags. 16 | # CPP: cpp preprocessor (may be implied by FC). 17 | # CPPFLAGS: cpp -D macro flags. 18 | # LD: Loader. 19 | # LDFLAGS: Loader flags. 20 | # EXTRALIBS: Extra local libraries (if any). 21 | # 22 | FC = ftn 23 | FCFFLAGS = -gopt -fastsse -tp ivybridge -Mdaz -Mvect=simd,uniform -Kieee -r8 -mcmodel=small 24 | CC = cc 25 | CCFLAGS = -O -mcmodel=small 26 | CPP = cpp -P 27 | CPPFLAGS = -DREAL8 -DMPI -DENDIAN_IO -DNAN2003 -DTIMER -DRELO $(CPP_EXTRAS) 28 | LD = $(FC) 29 | LDFLAGS = $(FCFFLAGS) 30 | EXTRALIBS = 31 | 32 | # 33 | # --- generic make definitions 34 | # 35 | SHELL = /bin/sh 36 | RM = \rm -f 37 | 38 | # 39 | # rules. 40 | # 41 | 42 | .c.o: 43 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c 44 | 45 | .F90.o: 46 | $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F90 47 | -------------------------------------------------------------------------------- /dimensions.h: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------- 2 | ! --- START OF REGION AND TILING SPECIFIC PARAMETERS 3 | ! --- Static memory version, not used when macro /* RELO */ is set (dynamic memory) 4 | ! --- See: README.dimensions and README.OpenMP for more details. 5 | ! 6 | ! --- itdm = total grid dimension in i direction 7 | ! --- jtdm = total grid dimension in j direction 8 | ! --- kdm = grid dimension in k direction 9 | integer itdm,jtdm,kdm 10 | parameter (itdm=500,jtdm=382,kdm=41) ! GLBT0.72 11 | ! 12 | ! --- iqr = maximum number of tiles in i direction 13 | ! --- jqr = maximum number of tiles in j direction 14 | integer iqr,jqr 15 | parameter (iqr=10,jqr=10) ! multiple tiles (TYPE=ompi or mpi or shmem) 16 | ! 17 | ! --- idm = maximum single tile grid dimension in i direction 18 | ! --- jdm = maximum single tile grid dimension in j direction 19 | integer idm,jdm 20 | !!!!!!parameter (idm=itdm,jdm=jtdm) ! always works if enough memory 21 | parameter (idm= 250,jdm= 191) ! NMPI=4,8,16,24,32,40,47,64 22 | ! 23 | ! --- mxthrd= maximum number of OpenMP threads 24 | integer mxthrd 25 | parameter (mxthrd=1) ! NOMP=0,1 26 | ! 27 | ! --- kkwall= grid dimension in k direction for wall relax arrays 28 | ! --- kknest= grid dimension in k direction for nest relax arrays 29 | integer kkwall,kknest 30 | parameter (kkwall= 1) ! must be 1 or kdm 31 | parameter (kknest= 1) ! must be 1 or kdm 32 | ! 33 | ! --- kkmy25= grid dimension in k direction for M-Y 2.5 arrays 34 | integer kkmy25 35 | parameter (kkmy25= -1) ! must be -1 or kdm 36 | ! 37 | ! --- nlgiss= size of lookup table for GISS 38 | integer nlgiss 39 | parameter (nlgiss= 1) ! must be 1 (no GISS) or 762 40 | ! 41 | ! --- mxtrcr= maximum number of tracers 42 | integer mxtrcr 43 | parameter (mxtrcr=1) 44 | ! 45 | ! --- natm = number of saved atmospheric fields 46 | integer natm 47 | parameter (natm=2) ! must be 2 (high freq.) or 4 (monthly) 48 | ! 49 | ! --- max_nsteps_batrop = maximum barotropic steps per baroclinic time step 50 | integer max_nsteps_batrop 51 | parameter (max_nsteps_batrop = 128) 52 | ! 53 | ! --- END OF REGION AND TILING SPECIFIC PARAMETERS 54 | !----------------------------------------------------------------------------- 55 | -------------------------------------------------------------------------------- /dpthuv.F90: -------------------------------------------------------------------------------- 1 | #if defined(ROW_LAND) 2 | #define SEA_Q .true. 3 | #elif defined(ROW_ALLSEA) 4 | #define SEA_Q alliq(j).or.iq(i,j).ne.0 5 | #else 6 | #define SEA_Q iq(i,j).ne.0 7 | #endif 8 | subroutine dpthuv 9 | use mod_xc ! HYCOM communication interface 10 | use mod_cb_arrays ! HYCOM saved arrays 11 | implicit none 12 | ! 13 | ! --- define water depth (bottom pressure) at u,v points and barotp.pot.vort. 14 | ! --- also calculate pbotmin = pbot * (oneta0-1.0) 15 | ! 16 | integer i,j,l,margin 17 | ! 18 | ! --- depth at u,v points 19 | real uvdep,a,b 20 | uvdep(a,b)=min(a,b) 21 | ! 22 | ! --- initialize ports. 23 | ! 24 | #if ! defined(RELO) 25 | if (lbflag.eq.1) then 26 | call latbdp( 0) 27 | elseif (lbflag.eq.3) then 28 | call latbdf( 0,0) 29 | endif 30 | #endif 31 | if (lbflag.eq.2) then 32 | call latbdt( 0,0) 33 | elseif (lbflag.eq.4) then 34 | call latbdtf(0,0) 35 | else 36 | !$OMP PARALLEL DO PRIVATE(j,i) & 37 | !$OMP SCHEDULE(STATIC,jblk) 38 | do j= 1-nbdy,jj+nbdy 39 | do i= 1-nbdy,ii+nbdy 40 | iuopn(i,j) = 0 41 | ivopn(i,j) = 0 42 | enddo 43 | enddo 44 | endif 45 | ! 46 | call xctilr(pbot, 1,1, nbdy,nbdy, halo_ps) 47 | call xctilr(corio,1,1, nbdy,nbdy, halo_qs) 48 | ! 49 | !$OMP PARALLEL DO PRIVATE(j,i) & 50 | !$OMP SCHEDULE(STATIC,jblk) 51 | do j= 1-nbdy,jj+nbdy 52 | do i= 1-nbdy,ii+nbdy 53 | pbotmin(i,j) = pbot(i,j) * (oneta0 - 1.0) 54 | enddo !i 55 | enddo !j 56 | ! 57 | ! 58 | ! --- rhs: pbot+,corio+ 59 | ! --- lhs: depthu, depthv, pvtrop+ 60 | ! 61 | margin = 1 62 | ! 63 | do j=1-margin,jj+margin 64 | do l=1,isu(j) !ok 65 | i=ifu(j,l)-1 66 | if (i.ge.1-margin) then 67 | if (iuopn(i,j).ne.0) then 68 | depthu(i,j)=pbot(i ,j) 69 | ! write(lp,*) 'depthu - i,j,d = ', 70 | ! & i+i0,j+j0,depthu(i,j)*qonem 71 | endif 72 | endif 73 | i=ilu(j,l)+1 74 | if (i.le.ii+margin) then 75 | if (iuopn(i,j).ne.0) then 76 | depthu(i,j)=pbot(i-1,j) 77 | ! write(lp,*) 'depthu - i,j,d = ', 78 | ! & i+i0,j+j0,depthu(i,j)*qonem 79 | endif 80 | endif 81 | do i=max(1-margin,ifu(j,l)),min(ii+margin,ilu(j,l)) 82 | depthu(i,j)=uvdep(pbot(i,j),pbot(i-1,j)) 83 | pvtrop(i,j )=corio(i,j )*2./(pbot(i,j)+pbot(i-1,j)) 84 | pvtrop(i,j+1)=corio(i,j+1)*2./(pbot(i,j)+pbot(i-1,j)) 85 | enddo 86 | enddo 87 | enddo 88 | call xcsync(flush_lp) 89 | ! 90 | do i=1-margin,ii+margin 91 | do l=1,jsv(i) !ok 92 | j=jfv(i,l)-1 93 | if (j.ge.1-margin) then 94 | if (ivopn(i,j).ne.0) then 95 | depthv(i,j)=pbot(i,j ) 96 | ! write(lp,*) 'depthv - i,j,d = ', 97 | ! & i+i0,j+j0,depthv(i,j)*qonem 98 | endif 99 | endif 100 | j=jlv(i,l)+1 101 | if (j.le.jj+margin) then 102 | if (ivopn(i,j).ne.0) then 103 | depthv(i,j)=pbot(i,j-1) 104 | ! write(lp,*) 'depthv - i,j,d = ', 105 | ! & i+i0,j+j0,depthv(i,j)*qonem 106 | endif 107 | endif 108 | do j=max(1-margin,jfv(i,l)),min(jj+margin,jlv(i,l)) 109 | depthv(i,j)=uvdep(pbot(i,j),pbot(i,j-1)) 110 | pvtrop(i ,j)=corio(i ,j)*2./(pbot(i,j)+pbot(i,j-1)) 111 | pvtrop(i+1,j)=corio(i+1,j)*2./(pbot(i,j)+pbot(i,j-1)) 112 | enddo 113 | enddo 114 | enddo 115 | call xcsync(flush_lp) 116 | ! 117 | !$OMP PARALLEL DO PRIVATE(j,l,i) & 118 | !$OMP SCHEDULE(STATIC,jblk) 119 | do j=1,jj 120 | do i=1,ii 121 | if (SEA_Q) then 122 | pvtrop(i,j)=corio(i,j)*4./(pbot(i,j )+pbot(i-1,j ) & 123 | +pbot(i,j-1)+pbot(i-1,j-1)) 124 | endif !iq 125 | enddo !i 126 | enddo !j 127 | ! 128 | call xctilr(depthu,1,1, nbdy,nbdy, halo_us) 129 | call xctilr(depthv,1,1, nbdy,nbdy, halo_vs) 130 | call xctilr(pvtrop,1,1, nbdy,nbdy, halo_qs) 131 | return 132 | end subroutine dpthuv 133 | !> May 2014 -- use land/sea masks (e.g. iq) to skip land 134 | !> May 2014 -- removed lbflag==6 for latbdtc 135 | -------------------------------------------------------------------------------- /dpudpv.F90: -------------------------------------------------------------------------------- 1 | #if defined(ROW_LAND) 2 | #define SEA_P .true. 3 | #define SEA_U .true. 4 | #define SEA_V .true. 5 | #elif defined(ROW_ALLSEA) 6 | #define SEA_P allip(j).or.ip(i,j).ne.0 7 | #define SEA_U alliu(j).or.iu(i,j).ne.0 8 | #define SEA_V alliv(j).or.iv(i,j).ne.0 9 | #else 10 | #define SEA_P ip(i,j).ne.0 11 | #define SEA_U iu(i,j).ne.0 12 | #define SEA_V iv(i,j).ne.0 13 | #endif 14 | subroutine dpudpv(dpu,dpv, p,depthu,depthv, & 15 | margin_p,margin_dpudpv) 16 | use mod_xc ! HYCOM communication interface 17 | implicit none 18 | ! 19 | integer, intent(in) :: margin_p,margin_dpudpv 20 | real, dimension (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm), & 21 | intent(out) :: dpu,dpv 22 | real, dimension (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm+1), & 23 | intent(inout) :: p 24 | real, dimension (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 25 | intent(in) :: depthu,depthv 26 | ! 27 | ! --- ----------------------------------------------------------------- 28 | ! --- define layer depth at u,v points with halo out to margin_dpudpv 29 | ! --- ----------------------------------------------------------------- 30 | ! 31 | interface 32 | subroutine dpudpvj(dpu,dpv, p,depthu,depthv, & 33 | margin_p,margin_dpudpv, j) 34 | use mod_xc 35 | integer, intent(in) :: margin_p,margin_dpudpv,j 36 | real, dimension (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm), & 37 | intent(out) :: dpu,dpv 38 | real, dimension (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm+1), & 39 | intent(in) :: p 40 | real, dimension (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 41 | intent(in) :: depthu,depthv 42 | end subroutine dpudpvj 43 | end interface 44 | ! 45 | integer j 46 | ! 47 | if (margin_dpudpv.lt.0 .or. & 48 | margin_dpudpv.ge.nbdy ) then 49 | if (mnproc.eq.1) then 50 | write(lp,'(/ a,i2 /)') & 51 | 'error: dpudpv called with margin_dpudpv = ',margin_dpudpv 52 | endif 53 | call xcstop('dpudpv') 54 | stop 'dpudpv' 55 | endif 56 | ! 57 | ! --- p's halo is valid out to margin_p, is this far enough? 58 | ! 59 | if (margin_p.lt.margin_dpudpv+1) then 60 | call xctilr(p(1-nbdy,1-nbdy,2),1,kk, & 61 | margin_dpudpv+1,margin_dpudpv+1, halo_ps) 62 | endif 63 | ! 64 | ! --- using single row routine fixes SGI OpenMP bug. 65 | !$OMP PARALLEL DO PRIVATE(j) & 66 | !$OMP SCHEDULE(STATIC,jblk) 67 | do j=1-margin_dpudpv,jj+margin_dpudpv 68 | call dpudpvj(dpu,dpv, p,depthu,depthv, & 69 | margin_p,margin_dpudpv, j) 70 | enddo 71 | return 72 | end 73 | subroutine dpudpvj(dpu,dpv, p,depthu,depthv, & 74 | margin_p,margin_dpudpv, j) 75 | use mod_xc ! HYCOM communication interface 76 | implicit none 77 | ! 78 | integer, intent(in) :: margin_p,margin_dpudpv,j 79 | real, dimension (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm), & 80 | intent(out) :: dpu,dpv 81 | real, dimension (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm+1), & 82 | intent(in) :: p 83 | real, dimension (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 84 | intent(in) :: depthu,depthv 85 | ! 86 | ! --- ----------------------------------------------- 87 | ! --- define layer depth at u,v points, single row 88 | ! --- ----------------------------------------------- 89 | ! 90 | integer i,k 91 | ! 92 | do k=1,kk 93 | do i=1-margin_dpudpv,ii+margin_dpudpv 94 | if (SEA_U) then 95 | dpu(i,j,k)=max(0., & 96 | min(depthu(i,j),.5*(p(i,j,k+1)+p(i-1,j,k+1)))- & 97 | min(depthu(i,j),.5*(p(i,j,k )+p(i-1,j,k )))) 98 | endif !iu 99 | if (SEA_V) then 100 | dpv(i,j,k)=max(0., & 101 | min(depthv(i,j),.5*(p(i,j,k+1)+p(i,j-1,k+1)))- & 102 | min(depthv(i,j),.5*(p(i,j,k )+p(i,j-1,k )))) 103 | endif !iv 104 | enddo !i 105 | enddo !j 106 | return 107 | end subroutine dpudpvj 108 | !> May 2014 - use land/sea masks (e.g. ip) to skip land 109 | -------------------------------------------------------------------------------- /hycom.F90: -------------------------------------------------------------------------------- 1 | #if defined(USE_ESMF4) 2 | program hycom 3 | ! 4 | ! --- ESMF driver for stand-alone HYCOM ocean model 5 | ! 6 | use ESMF_Mod 7 | ! use mod_hycom, only : OCEAN_SetServices => HYCOM_SetServices 8 | use mod_hycom, only : end_of_run, & 9 | OCEAN_SetServices => HYCOM_SetServices 10 | ! 11 | implicit none 12 | ! 13 | ! --- Local variables 14 | ! 15 | ! --- Gridded Components 16 | type(ESMF_GridComp) :: oceanGridComp 17 | ! 18 | ! --- States, Virtual Machines, and Layouts 19 | type(ESMF_VM) :: worldVM 20 | type(ESMF_State) :: oceanImpState, oceanExpState 21 | integer :: petCount, localPet, split 22 | ! 23 | ! --- Calendars and clocks 24 | type(ESMF_Clock) :: worldClock 25 | type(ESMF_Clock) :: oceanClock 26 | ! 27 | ! --- Return codes for error checks 28 | integer :: rc 29 | ! 30 | ! --- Miscellaneous 31 | integer :: i 32 | ! 33 | !------------------------------------------------------------------------------- 34 | ! Initialize the ESMF Framework 35 | !------------------------------------------------------------------------------- 36 | ! 37 | ! --- Set default calendar and log type; get world VM 38 | call ESMF_Initialize(defaultCalendar=ESMF_CAL_GREGORIAN, & 39 | defaultLogType=ESMF_LOG_SINGLE, & 40 | vm=worldVM, rc=rc) 41 | if (rc .ne. ESMF_SUCCESS) stop 99 42 | ! 43 | ! --- Get VM info 44 | call ESMF_VMGet(worldVM, petCount=petCount, localPET=localPet, & 45 | rc=rc) 46 | if (ESMF_LogMsgFoundError(rc, "ESMF_VMGet failed", rc)) & 47 | goto 10 48 | ! 49 | !------------------------------------------------------------------------------- 50 | ! --- Create section 51 | !------------------------------------------------------------------------------- 52 | ! 53 | ! --- Create the OCEAN gridded component 54 | oceanGridComp = ESMF_GridCompCreate(vm=worldVM, & 55 | name="OCEAN Gridded Component", & 56 | gridCompType=ESMF_OCEAN, & 57 | rc=rc) 58 | if (ESMF_LogMsgFoundError(rc, "OCEAN GridCompCreate failed", rc)) & 59 | goto 10 60 | ! 61 | ! --- Create empty OCEAN import/export states 62 | oceanImpState = ESMF_StateCreate(stateName="OCEAN Import State", & 63 | stateType=ESMF_STATE_IMPORT, & 64 | rc=rc) 65 | if (ESMF_LogMsgFoundError(rc, "OCEAN ImpState Create failed", rc)) & 66 | goto 10 67 | oceanExpState = ESMF_StateCreate(stateName="OCEAN Export State", & 68 | stateType=ESMF_STATE_EXPORT, & 69 | rc=rc) 70 | if (ESMF_LogMsgFoundError(rc, "OCEAN ExpState Create failed", rc)) & 71 | goto 10 72 | ! 73 | !------------------------------------------------------------------------------- 74 | ! --- Register section 75 | !------------------------------------------------------------------------------- 76 | ! 77 | ! --- Register the OCEAN gridded component 78 | call ESMF_GridCompSetServices(oceanGridComp, & 79 | OCEAN_SetServices, rc) 80 | if (ESMF_LogMsgFoundError(rc, "OCEAN Registration failed", rc)) & 81 | goto 10 82 | ! 83 | !------------------------------------------------------------------------------- 84 | ! --- Initalize Section 85 | !------------------------------------------------------------------------------- 86 | ! 87 | ! --- Initialize OCEAN gridded component 88 | call ESMF_GridCompInitialize(gridComp=oceanGridComp, & 89 | importState=oceanImpState, & 90 | exportState=oceanExpState, & 91 | clock=worldClock, & 92 | phase=ESMF_SINGLEPHASE, & 93 | blockingflag=ESMF_NONBLOCKING, & 94 | rc=rc) 95 | if (ESMF_LogMsgFoundError(rc, "OCEAN Initialize failed", rc)) & 96 | goto 10 97 | !c 98 | !c --- Get copy of OCEAN clock 99 | ! call ESMF_GridCompGet(oceanGridComp, clock=oceanClock, rc=rc) 100 | !c 101 | !c --- Initialize WORLD clock using OCEAN clock 102 | ! worldClock = ESMF_ClockCreate(clock=oceanClock, rc=rc) 103 | ! 104 | !------------------------------------------------------------------------------- 105 | ! --- Run Section 106 | !------------------------------------------------------------------------------- 107 | ! 108 | do !until end of run 109 | call ESMF_GridCompRun(gridComp=oceanGridComp, & 110 | importState=oceanImpState, & 111 | exportState=oceanExpState, & 112 | clock=worldClock, & 113 | phase=ESMF_SINGLEPHASE, & 114 | blockingflag=ESMF_NONBLOCKING, & 115 | rc=rc) 116 | ! 117 | ! --- use end_of_run, rather than a ESMF Clock 118 | if (end_of_run) then 119 | exit 120 | endif 121 | enddo 122 | ! 123 | !------------------------------------------------------------------------------- 124 | ! Finalize Section 125 | !------------------------------------------------------------------------------- 126 | ! 127 | ! --- Finalize OCEAN gridded component 128 | call ESMF_GridCompFinalize(gridComp=oceanGridComp, & 129 | importState=oceanImpState, & 130 | exportState=oceanExpState, & 131 | clock=worldClock, & 132 | phase=ESMF_SINGLEPHASE, & 133 | blockingflag=ESMF_NONBLOCKING, & 134 | rc=rc) 135 | if (ESMF_LogMsgFoundError(rc, "OCEAN Finalize failed", rc)) & 136 | goto 10 137 | ! 138 | 10 continue 139 | call ESMF_VMBarrier(worldVM) 140 | call ESMF_Finalize(rc=rc) 141 | ! 142 | stop 143 | end program hycom 144 | #else 145 | program hycom 146 | ! 147 | ! --- Non-ESMF driver for stand-alone HYCOM ocean model 148 | ! 149 | use mod_hycom, only : end_of_run, & 150 | HYCOM_Init, & 151 | HYCOM_Run, & 152 | HYCOM_Final 153 | ! 154 | implicit none 155 | ! 156 | ! --- Initialize HYCOM. 157 | call HYCOM_Init 158 | 159 | ! --- Run HYCOM. 160 | do !until end of run 161 | call HYCOM_Run 162 | if (end_of_run) then 163 | exit 164 | endif 165 | enddo 166 | ! 167 | ! --- Finalize HYCOM. 168 | call HYCOM_Final 169 | ! 170 | stop 171 | end program hycom 172 | #endif 173 | -------------------------------------------------------------------------------- /inikpp.F90: -------------------------------------------------------------------------------- 1 | subroutine inikpp 2 | use mod_xc ! HYCOM communication interface 3 | use mod_cb_arrays ! HYCOM saved arrays 4 | ! 5 | ! --- hycom version 1.0 6 | implicit none 7 | ! 8 | integer nzehat,nustar 9 | parameter (nzehat=890,nustar=192) 10 | ! 11 | real, dimension (0:nzehat+1,0:nustar+1) :: & 12 | wmt & ! momentum velocity scale table 13 | ,wst ! scalar velocity scale table 14 | common/kppltr/ wmt,wst 15 | save /kppltr/ 16 | ! 17 | ! ------------------------------------------------------------------- 18 | ! --- initialize large, mc williams, doney kpp vertical mixing scheme 19 | ! ------------------------------------------------------------------- 20 | ! 21 | integer i,j 22 | real zehat,zeta,am,cm,c22,zetam,as,c33,zetas,usta 23 | ! 24 | data am,cm,c22,zetam/1.257,8.380,16.0,-0.2/ 25 | data as,c33,zetas/-28.86,16.0,-1.0/ 26 | ! 27 | # include "stmt_fns.h" 28 | ! 29 | ! --- 'vonk' = von karman constant 30 | ! --- 'zmin,zmax' = zehat limits for velocity scale lookup table, m**3/s**3 31 | ! --- 'umin,umax' = ustar limits for velocity scale lookup table 32 | ! --- 'epsilon' = vertical coordinate scale factor 33 | ! 34 | vonk = 0.4 35 | zmin = -0.4e-6 36 | zmax = 0.0 37 | umin = 0.0 38 | umax = 0.16 39 | epsilon= 0.1 40 | ! 41 | ! --- construct the velocity-scale lookup tables 42 | ! 43 | deltaz = (zmax-zmin)/(nzehat+1) 44 | deltau = (umax-umin)/(nustar+1) 45 | ! 46 | do i=0,nzehat+1 47 | zehat=deltaz*i+zmin 48 | do j=0,nustar+1 49 | usta=deltau*j+umin 50 | zeta=zehat/(usta**3+epsil) 51 | if (zehat.ge.0.) then 52 | wmt(i,j)=vonk*usta/(1.+c11*zeta) 53 | wst(i,j)=wmt(i,j) 54 | else 55 | if (zeta.gt.zetam) then 56 | wmt(i,j)=vonk*usta*(1.-c22*zeta)**afourth 57 | else 58 | wmt(i,j)=vonk*(am*usta**3-cm*zehat)**athird 59 | endif 60 | if (zeta.gt.zetas) then 61 | wst(i,j)=vonk*usta*(1.-c33*zeta)**ahalf 62 | else 63 | wst(i,j)=vonk*(as*usta**3-cs*zehat)**athird 64 | endif 65 | endif 66 | enddo 67 | enddo 68 | ! 69 | ! --- set derived constants 70 | vtc=sqrt(.2/cs/epsilon)/vonk**2/ricr 71 | cg=cstar*vonk*(cs*vonk*epsilon)**athird 72 | dp0enh=2.0*dp00 73 | ! 74 | return 75 | end 76 | ! 77 | ! 78 | !> Revision history: 79 | !> 80 | !> May 2001 - increased nustar and umax by a factor of 4 81 | -------------------------------------------------------------------------------- /inimy.F90: -------------------------------------------------------------------------------- 1 | subroutine inimy 2 | use mod_xc ! HYCOM communication interface 3 | use mod_cb_arrays ! HYCOM saved arrays 4 | ! 5 | ! --- hycom version 2.1 6 | implicit none 7 | ! 8 | ! ------------------------------------------------------------- 9 | ! --- initialize mellor-yamada level 2.5 vertical mixing scheme 10 | ! ------------------------------------------------------------- 11 | ! 12 | integer i,j,k 13 | ! 14 | # include "stmt_fns.h" 15 | ! 16 | a1my = 0.92 17 | b1my = 16.6 18 | a2my = 0.74 19 | b2my = 10.1 20 | c1my = 0.08 21 | ! 22 | e1my = 1.8 23 | e2my = 1.33 24 | e3my = 1.0 25 | sef = 1.0 26 | smll = 1.e-8 27 | ! 28 | ! --- 'vonk' = von karman constant 29 | ! --- 'ghc' = constant for calculating tke production 30 | ! --- 'coef4','coef5' = coefficients for estimating viscosity/diffusivity 31 | ! --- 'const1' = constant for estimating surface and bottom bc's 32 | ! 33 | vonk = 0.4 34 | ghc = -6.0 35 | coef4 = 18.*a1my*a1my+9.*a1my*a2my 36 | coef5 = 9.*a1my*a2my 37 | const1 = 16.6**.6666667*sef 38 | ! 39 | do j=1,jdm 40 | do i=1,idm 41 | do k=0,kdm+1 42 | q2(i,j,k,1)=smll 43 | q2(i,j,k,2)=smll 44 | q2l(i,j,k,1)=smll 45 | q2l(i,j,k,2)=smll 46 | vctymy(i,j,k)=diwm(i,j) 47 | diftmy(i,j,k)=diws(i,j) 48 | difqmy(i,j,k)=diws(i,j) 49 | enddo 50 | do k=1,kdm+1 51 | vcty(i,j,k)=diwm(i,j) 52 | dift(i,j,k)=diws(i,j) 53 | difs(i,j,k)=diws(i,j) 54 | ! --- no nonlocal forcing 55 | ghats(i,j,k)=0.0 56 | enddo 57 | enddo 58 | enddo 59 | return 60 | end 61 | ! 62 | ! 63 | !> Revision history: 64 | !> 65 | -------------------------------------------------------------------------------- /internal_kappaf.h: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------- 2 | real function kappaf1(t,s,r,prs,kkf) 3 | implicit none 4 | ! 5 | real t,s,r,prs 6 | integer kkf 7 | ! 8 | ! --- kappaf1 used to simplify offsetting T and S, 9 | ! --- always invoke via kappaf. 10 | ! 11 | ! --- coefficients for kappa^(theta) 12 | ! --- 1=Arctic/Antarctic; 2=Atlantic; 3=Mediterranean 13 | ! 14 | real, parameter :: & 15 | sclkap=1.e-11 16 | real, parameter, dimension(3) :: & 17 | qttt = (/ -3.03869354E-05, -3.03869352E-05, -3.03869353E-05 /) & 18 | ,qtt = (/ 4.56625601E-03, 4.29277358E-03, 3.38116552E-03 /) & 19 | ,qt = (/ -2.88801209E-01, -2.61828868E-01, -1.81335007E-01 /) & 20 | ,qs = (/ -1.08670290E-01, -1.05131061E-01, -9.33336309E-02 /) & 21 | ,qst = (/ 7.90503772E-04, 7.71096940E-04, 1.07270585E-03 /) & 22 | ,qpt = (/ 1.07813750E-09, 1.00638435E-09, 7.57239852E-10 /) & 23 | ,qpst = (/ 1.41541548E-11, 1.48598578E-11, 3.89226107E-12 /) & 24 | ,qptt = (/ -1.31383708E-11, -1.31383707E-11, -1.31383708E-11 /) 25 | ! 26 | kappaf1=(r+1000.0)* & 27 | (exp(sclkap*(prs-pref)* & 28 | ( s*( qs(kkf)+t* qst(kkf) ) + & 29 | t*( qt(kkf)+t*(qtt(kkf)+t*qttt(kkf))+ & 30 | 0.5*(prs+pref)* & 31 | (qpt(kkf)+s*qpst(kkf)+t*qptt(kkf)) ) ) ) & 32 | -1.0) 33 | end function kappaf1 34 | ! 35 | real function kappaf(t,s,r,prs,kkf) 36 | implicit none 37 | ! 38 | real t,s,r,prs 39 | integer kkf 40 | ! 41 | ! --- thermobaric compressibility coefficient (integral from prs to pref) 42 | ! --- Sun et.al. (1999) JPO 29 pp 2719-2729. 43 | ! 44 | ! --- offset limits based on stability estimates from: 45 | ! --- Hallberg (2005) Ocean Modelling 8 pp 279-300. 46 | ! --- t: potential temperature (degC); s: salinity (psu); 47 | ! --- r: potential density (sigma); prs: pressure; kkf: ref.state 48 | ! --- example: kappaf(4.5,34.5,36.406,1.e7,1) = -0.12301201 49 | ! --- example: kappaf(4.5,34.5,36.406,1.e7,2) = -0.03356404 50 | ! --- example: kappaf(4.5,34.5,36.406,1.e7,3) = 0.05201003 51 | ! 52 | real, parameter, dimension(3) :: & 53 | toff = (/ 0.0, 3.0, 13.0 /) & 54 | ,soff = (/ 34.5, 35.0, 38.5 /) 55 | ! 56 | kappaf= & 57 | kappaf1(max(-1.2, t-toff(kkf) ), & !Hallberg,T-only: -1.8,0.9 58 | max(-3.0,min(1.5, s-soff(kkf))), & !Hallberg,S-only: -4.2,2.1 59 | r,prs,kkf) 60 | end function kappaf 61 | ! 62 | !> Revision history 63 | !> 64 | !> Sep 2004 - added kkf to kappaf, select one of three reference states 65 | !> Aug 2006 - more restrictive kappaf1 offset limits 66 | !> Mar 2009 - modified limits in kappaf 67 | !> Mar 2009 - more accurate kappaf, with potential density 68 | !> Aug 2017 - kappaf and kappaf1 in separate file as internal functions 69 | !----------------------------------------------------------------------------- 70 | -------------------------------------------------------------------------------- /isnan.F90: -------------------------------------------------------------------------------- 1 | #if defined(NAN2003) 2 | logical function hycom_isnaninf(a) 3 | use ieee_arithmetic, only : ieee_is_finite 4 | implicit none 5 | ! 6 | real a 7 | ! 8 | !********** 9 | !* 10 | ! 1) return .true. if a is NaN or +Inf or -Inf. 11 | ! 12 | ! 2) version with ieee_arithmetic intrinsic module 13 | !* 14 | !********** 15 | ! 16 | hycom_isnaninf = .not. ieee_is_finite(a) 17 | end function hycom_isnaninf 18 | #else 19 | logical function hycom_isnaninf(a) 20 | implicit none 21 | ! 22 | real a 23 | ! 24 | !********** 25 | !* 26 | ! 1) return .true. if a is NaN or +Inf or -Inf. 27 | !* 28 | !********** 29 | ! 30 | hycom_isnaninf = .not. (a.ge.-huge(a) .and. a.le.huge(a)) 31 | end 32 | #endif 33 | ! 34 | !> Revision history: 35 | !> 36 | !> Jan. 2014 - ieee_arithmetic intrinsic module version via /* NAN2003 */ macro 37 | -------------------------------------------------------------------------------- /machi_c.c: -------------------------------------------------------------------------------- 1 | #if defined(SGI) 2 | /* 3 | --- Fortran-callable routine ZUNDER that sets the bit to specify 4 | --- that underflows are flushed to zero in hardware on SGI R10000. 5 | --- See man handle_sigfpes 6 | --- Alan J. Wallcraft, NRL, October 1997. 7 | */ 8 | #include 9 | void zunder_() 10 | { 11 | union fpc_csr n; 12 | n.fc_word = get_fpc_csr(); 13 | n.fc_struct.flush = 1; 14 | set_fpc_csr(n.fc_word); 15 | } 16 | #endif /* SGI */ 17 | 18 | #if defined(AIX) 19 | /* 20 | --- Fortran-callable function WTIME that returns the wall time in seconds. 21 | --- Probably not thread-safe, only for Power-PC systems. 22 | --- Alan J. Wallcraft, NRL, May 2001. 23 | --- Based on notes by Bob Walkup (10x faster than MPI_WTIME). 24 | */ 25 | #include 26 | #include 27 | double wtime(void) 28 | { 29 | struct timebasestruct TB; 30 | static int first_call; 31 | static double tb_factor; 32 | double tb_top,tb_bot; 33 | if (first_call == 0) { 34 | first_call = 1; 35 | tb_top = (double) _system_configuration.Xint; 36 | tb_bot = (double) _system_configuration.Xfrac; 37 | tb_factor = tb_top/tb_bot; 38 | } 39 | read_real_time(&TB, TIMEBASE_SZ); 40 | return ( tb_factor * ( 4.294967296*((double) TB.tb_high) + 1.0e-9*((double) TB.tb_low) ) ); 41 | } 42 | #endif /* AIX */ 43 | 44 | #if defined(ENDIAN_IO) 45 | /* 46 | --- Fortran-callable routine ZAIO_ENDIAN to swap the endian-ness of an array 47 | --- Brent Anderson, ASC MSRC, July 2007. 48 | */ 49 | #include 50 | void zaio_endian_(uint32_t *, uint32_t *); 51 | 52 | #define swap4bytes(data) \ 53 | ( (((data) >> 24) & 0x000000FF) | \ 54 | (((data) >> 8) & 0x0000FF00) | \ 55 | (((data) << 8) & 0x00FF0000) | \ 56 | (((data) << 24) & 0xFF000000) ) 57 | 58 | /** Swaps the byte-order in a 32-bit word from 59 | big- to little-endianness or vice-versa. */ 60 | 61 | void zaio_endian_(uint32_t aa[], uint32_t *nn) { 62 | uint32_t ii; 63 | for( ii=0; ii<*nn; ii++ ) { 64 | aa[ii] = swap4bytes ( aa[ii] ); 65 | } 66 | return; 67 | } 68 | #endif /* ENDIAN_IO */ 69 | 70 | void machine_c() 71 | { 72 | } 73 | -------------------------------------------------------------------------------- /machine.F90: -------------------------------------------------------------------------------- 1 | ! 2 | ! --- machine-specific Fortran routines 3 | ! 4 | subroutine machine() 5 | ! 6 | ! --- always called once at the start of the program. 7 | ! 8 | #if defined(SGI) 9 | call zunder() ! C-wrapper to flush underflow to zero on R10000 10 | #endif 11 | end 12 | #if defined(AIX) 13 | subroutine flush(iunit) 14 | implicit none 15 | integer iunit 16 | ! 17 | ! --- wrapper for flush system call under AIX. 18 | ! 19 | integer*4 iunit4 20 | ! 21 | iunit4=iunit 22 | call flush_(iunit4) 23 | return 24 | end 25 | #endif /* AIX */ 26 | #if defined(POWER9) 27 | subroutine flush(iunit) 28 | implicit none 29 | integer iunit 30 | ! 31 | ! --- wrapper for flush system call under Power9. 32 | ! 33 | integer*4 iunit4 34 | ! 35 | iunit4=iunit 36 | flush(iunit4) 37 | end 38 | #endif /* POWER9 */ 39 | #if defined(X1) 40 | subroutine x1flush(iunit) 41 | implicit none 42 | integer iunit 43 | ! 44 | ! --- wrapper for flush system call on the Cray X1. 45 | ! 46 | integer ierr 47 | ! 48 | call FLUSH(iunit,ierr) 49 | return 50 | end 51 | #endif /* X1 */ 52 | #if defined(IFC) 53 | subroutine flush(iunit) 54 | implicit none 55 | integer iunit 56 | ! 57 | ! --- disable the flush system call under Intel's IFC compiler. 58 | ! 59 | return 60 | end 61 | #endif /* IFC */ 62 | #if defined(SUN) 63 | subroutine ieee_retrospective() 64 | ! 65 | ! dummy routine to turn off ieee warning messages on a Sun. 66 | ! 67 | end 68 | #endif /* SUN */ 69 | #if defined(T3E) || defined(YMP) || defined(X1) 70 | subroutine getenv(cname, cvalue) 71 | implicit none 72 | ! 73 | character*(*) cname,cvalue 74 | ! 75 | ! this subroutine provides getenv functionality 76 | ! on the t3e, using pxfgetenv. 77 | ! 78 | integer iname,ivalue,ierr 79 | ! 80 | iname = 0 81 | ierr = 0 82 | call pxfgetenv(cname,iname, cvalue,ivalue, ierr) 83 | if (ierr.ne.0) then 84 | cvalue = ' ' 85 | endif 86 | return 87 | ! end of getenv. 88 | end 89 | #endif /* T3E || YMP || X1 */ 90 | #if defined(NAGFOR) 91 | subroutine flush(iunit) 92 | implicit none 93 | integer iunit 94 | ! 95 | ! --- a wrapper for Fortran 2003's FLUSH statement 96 | ! 97 | flush(iunit) 98 | return 99 | end 100 | subroutine getenv(cname, cvalue) 101 | implicit none 102 | ! 103 | character*(*) cname,cvalue 104 | ! 105 | ! --- a wrapper for Fortran 2003's GET_ENVIRONMENT_VARIABLE 106 | ! 107 | call get_environment_variable(cname,cvalue) 108 | return 109 | end 110 | #endif /* NAGFOR */ 111 | -------------------------------------------------------------------------------- /matinv.F90: -------------------------------------------------------------------------------- 1 | ! ------------------------------------------------------------------ 2 | ! --- matrix inversion subroutines for implicit solution of vertical 3 | ! --- diffusion equation - tri-diagonal matrix 4 | ! ------------------------------------------------------------------ 5 | ! 6 | subroutine tridcof(diff,tri,nlayer,tcu,tcc,tcl) 7 | use mod_xc ! HYCOM communication interface 8 | use mod_cb_arrays ! HYCOM saved arrays 9 | implicit none 10 | ! 11 | ! --- compute coefficients for tridiagonal matrix (dimension=kdm). 12 | ! --- Note: tcu(1) = 0. and tcl(kdm+1) = 0. are necessary conditions. 13 | ! 14 | ! --- input 15 | real diff(kdm+1) ! diffusivity profile on interfaces 16 | integer nlayer 17 | ! 18 | ! --- output 19 | real tcu(kdm), & ! upper coeff. for (k-1) on k line of trid.matrix 20 | tcc(kdm), & ! central ... (k ) .. 21 | tcl(kdm) ! lower ..... (k-1) .. 22 | ! --- common tridiagonal factors 23 | real tri(kdm,0:1) ! dt/dz/dz factors in trid. matrix 24 | ! 25 | ! --- local 26 | integer k 27 | ! 28 | ! --- in the surface layer 29 | tcu(1)=0. 30 | tcc(1)=1.+tri(1,1)*diff(2) ! 1.+ delt1/h(1)/dzb(1)*diff(2) 31 | tcl(1)= -tri(1,1)*diff(2) ! - delt1/h(1)/dzb(1)*diff(2) 32 | ! 33 | ! --- inside the domain 34 | do 10 k=2,nlayer 35 | tcu(k)= -tri(k,0)*diff(k ) 36 | tcc(k)=1.+tri(k,1)*diff(k+1)+tri(k,0)*diff(k) 37 | tcl(k)= -tri(k,1)*diff(k+1) 38 | 10 continue 39 | ! 40 | ! --- in the bottom layer 41 | tcl(nlayer)= 0. 42 | return 43 | end 44 | 45 | !********************************************************************** 46 | 47 | subroutine tridrhs(h,yo,diff,ghat,ghatflux,tri,nlayer,rhs) 48 | use mod_xc ! HYCOM communication interface 49 | use mod_cb_arrays ! HYCOM saved arrays 50 | implicit none 51 | ! 52 | ! --- compute right hand side of tridiagonal matrix for scalar fields: 53 | ! --- = yo (old field) 54 | ! --- + flux-divergence of ghat 55 | ! --- + flux-divergence of non-turbulant fluxes 56 | ! 57 | ! --- note: if surface and bottom fluxes are nonzero, the following must apply 58 | ! --- sfc. lyr. needs +delt1/h(1)*surfaceflux 59 | ! --- bot. lyr. needs +delt1/h(nlayer)*diff(nlayer+1)/ 60 | ! --- dzb(nlayer)*yo(nlayer+1) 61 | ! 62 | ! --- input 63 | real h(kdm), & ! layer thickness 64 | yo(kdm+1), & ! old profile 65 | diff(kdm+1), & ! diffusivity profile on interfaces 66 | ghat(kdm+1), & ! ghat turbulent flux 67 | ghatflux ! surface flux for ghat: includes solar flux 68 | integer nlayer 69 | ! 70 | ! --- output 71 | real rhs(kdm) ! right hand side 72 | ! 73 | real tri(kdm,0:1) ! dt/dz/dz factors in trid. matrix 74 | ! 75 | ! --- local 76 | integer k 77 | ! 78 | ! --- in the top layer 79 | rhs(1)=yo(1)+delt1/h(1)*(ghatflux*diff(2)*ghat(2)) 80 | ! 81 | ! --- inside the domain 82 | do 10 k=2,nlayer-1 83 | rhs(k)=yo(k)+delt1/h(k)* & 84 | (ghatflux*(diff(k+1)*ghat(k+1)-diff(k)*ghat(k))) 85 | 10 continue 86 | ! 87 | ! --- in the bottom layer 88 | k=nlayer 89 | rhs(k)=yo(k)+delt1/h(k)* & 90 | (ghatflux*(diff(k+1)*ghat(k+1)-diff(k)*ghat(k))) 91 | ! 92 | return 93 | end 94 | 95 | !********************************************************************** 96 | 97 | subroutine tridmat(tcu,tcc,tcl,nlayer,h,rhs,yo,yn,diff, i,j) 98 | use mod_xc ! HYCOM communication interface 99 | use mod_cb_arrays ! HYCOM saved arrays 100 | implicit none 101 | ! 102 | ! --- solve tridiagonal matrix for new vector yn, given right hand side 103 | ! --- vector rhs. 104 | ! 105 | ! --- note: if surface and bottom fluxes are nonzero, the following must apply 106 | ! --- surface layer needs +delt1*surfaceflux/(h(1)*bet) 107 | ! --- bottom layer needs +tri(nlayer,1)*diff(nlayer+1)*yo(nlayer+1))/bet 108 | ! 109 | ! --- input 110 | real tcu (kdm), & ! upper coeff. for (k-1) on k line of tridmatrix 111 | tcc (kdm), & ! central ... (k ) .. 112 | tcl (kdm), & ! lower ..... (k-1) .. 113 | h (kdm), & ! layer thickness 114 | rhs(kdm), & ! right hand side 115 | yo(kdm+1), & ! old field 116 | diff(kdm+1), & ! diffusivity profile 117 | gam(kdm) ! temporary array for tridiagonal solver 118 | real bet ! ... 119 | integer nlayer, & ! number of active layers <=kdm 120 | i,j ! local grid point 121 | ! 122 | ! --- output 123 | real yn(kdm+1) ! new field 124 | ! 125 | ! --- local 126 | integer k 127 | ! 128 | ! --- solve tridiagonal matrix. 129 | bet=tcc(1) 130 | yn(1)=rhs(1)/bet ! surface 131 | do 21 k=2,nlayer 132 | gam(k)=tcl(k-1)/bet 133 | bet=tcc(k)-tcu(k)*gam(k) 134 | if(bet.eq.0.) then 135 | write(lp,*) 136 | write(lp,*) '** algorithm for solving tridiagonal matrix fails' 137 | write(lp,*) '** i,j=',i0+i,j0+j !global grid point 138 | write(lp,*) '** bet=',bet 139 | write(lp,*) '** k=',k,' tcc=',tcc(k),' tcu=',tcu(k), & 140 | ' gam=',gam(k) 141 | call flush(lp) 142 | call xchalt('(tridmat)') 143 | stop '(tridmat)' 144 | ! bet=1.E-12 145 | endif 146 | yn(k) = (rhs(k) - tcu(k) *yn(k-1) )/bet 147 | ! to avoid "Underflow" at single precision on the sun 148 | ! yni = (rhs(k) - tcu(k) *yn(k-1) )/bet 149 | ! if(yni.lt.0.) then 150 | ! yn(k) =min( (rhs(k) - tcu(k) *yn(k-1) )/bet ,-1.E-12 ) 151 | ! else 152 | ! yn(k) = max( (rhs(k) - tcu(k) *yn(k-1) )/bet , 1.E-12 ) 153 | ! endif 154 | 21 continue 155 | ! 156 | do 22 k=nlayer-1,1,-1 157 | yn(k)=yn(k)-gam(k+1)*yn(k+1) 158 | 22 continue 159 | ! 160 | yn(nlayer+1)=yo(nlayer+1) 161 | ! 162 | return 163 | end 164 | -------------------------------------------------------------------------------- /mod_OICPL.F90: -------------------------------------------------------------------------------- 1 | module mod_OICPL !ocean-ice coupler 2 | ! 3 | ! --- ESMF Framework module 4 | use ESMF_Mod 5 | ! 6 | implicit none 7 | private 8 | ! 9 | public OICPL_SetServices 10 | ! 11 | ! --- phase info 12 | integer, parameter, public :: ice2ocn_phase = 1 13 | integer, parameter, public :: ocn2ice_phase = 2 14 | ! 15 | ! --- VM and PET info 16 | type(ESMF_VM), save :: vm 17 | integer, save :: petCount,localPet 18 | ! 19 | ! --- Route handles for regridding and/or redistribution 20 | type(ESMF_RouteHandle), save :: & 21 | i2oRouteHandle, o2iRouteHandle 22 | 23 | contains 24 | 25 | subroutine OICPL_SetServices(cplComp, rc) 26 | ! 27 | type(ESMF_CplComp) :: cplComp 28 | integer, intent(out) :: rc 29 | ! 30 | call ESMF_CplCompSetEntryPoint( & 31 | cplComp, & 32 | ESMF_SETINIT, & 33 | OICPL_Init, & 34 | ESMF_SINGLEPHASE, & 35 | rc=rc) 36 | call ESMF_CplCompSetEntryPoint( & 37 | cplComp, & 38 | ESMF_SETRUN, & 39 | OICPL_Run_I2O, & 40 | ice2ocn_phase, & 41 | rc=rc) 42 | call ESMF_CplCompSetEntryPoint( & 43 | cplComp, & 44 | ESMF_SETRUN, & 45 | OICPL_Run_O2I, & 46 | ocn2ice_phase, & 47 | rc=rc) 48 | call ESMF_CplCompSetEntryPoint( & 49 | cplComp, & 50 | ESMF_SETFINAL, & 51 | OICPL_Final, & 52 | ESMF_SINGLEPHASE, & 53 | rc=rc) 54 | ! 55 | end subroutine OICPL_SetServices 56 | 57 | 58 | subroutine OICPL_Init(cplComp, impState, expState, extClock, rc) 59 | ! 60 | ! --- Calling parameters 61 | type(ESMF_CplComp) :: cplComp 62 | type(ESMF_State) :: impState 63 | type(ESMF_State) :: expState 64 | type(ESMF_Clock) :: extClock 65 | integer, intent(out) :: rc 66 | ! 67 | ! --- Locals 68 | integer :: rc2 69 | type(ESMF_State) :: oiState, oeState, iiState, ieState 70 | type(ESMF_FieldBundle) :: ocnBundle, iceBundle 71 | ! 72 | ! --- Report 73 | call ESMF_LogWrite("OICPL initialize routine called", & 74 | ESMF_LOG_INFO, rc=rc) 75 | call ESMF_LogFlush(rc=rc) 76 | ! 77 | ! --- Get VM 78 | call ESMF_CplCompGet(cplComp, vm=vm, rc=rc) 79 | if (ESMF_LogMsgFoundError(rc, "Get VM failed", & 80 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 81 | ! 82 | ! --- Get PET info 83 | call ESMF_VMGet(vm, petCount=petCount, localPET=localPet, rc=rc) 84 | if (ESMF_LogMsgFoundError(rc, "Get VM info failed", & 85 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 86 | ! 87 | ! --- Get OCEAN and SEAICE import states 88 | call ESMF_StateGet(impState, "OCEAN Import", oiState, rc=rc) 89 | if (ESMF_LogMsgFoundError(rc, "Get OCEAN impState failed", & 90 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 91 | call ESMF_StateGet(impState, "SEAICE Import", iiState, rc=rc) 92 | if (ESMF_LogMsgFoundError(rc, "Get SEAICE impState failed", & 93 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 94 | ! 95 | ! --- Get OCEAN and SEAICE export states 96 | call ESMF_StateGet(expState, "OCEAN Export", oeState, rc=rc) 97 | if (ESMF_LogMsgFoundError(rc, "Get OCEAN expState failed", & 98 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 99 | call ESMF_StateGet(expState, "SEAICE Export", ieState, rc=rc) 100 | if (ESMF_LogMsgFoundError(rc, "Get SEAICE expState failed", & 101 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 102 | ! 103 | ! --- Initialize I2O 104 | ! 105 | ! --- Get bundle for ocn 106 | call ESMF_StateGet(oiState, "HYCOM Import", ocnBundle, rc=rc) 107 | if (ESMF_LogMsgFoundError(rc, "Get HYCOM Import failed", & 108 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 109 | ! 110 | ! --- Get bundle for ice 111 | call ESMF_StateGet(ieState, "CICE Export", iceBundle, rc=rc) 112 | if (ESMF_LogMsgFoundError(rc, "Get CICE Export failed", & 113 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 114 | ! 115 | ! --- Transfer fields from ice state to ocn state 116 | call ESMF_FieldBundleRedistStore(iceBundle, ocnBundle, & 117 | i2oRouteHandle, rc=rc) 118 | if (ESMF_LogMsgFoundError(rc, & 119 | "FieldBundleRedistStore i2o failed", & 120 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 121 | ! 122 | ! Initialize O2I 123 | ! 124 | ! --- Get bundle for ice 125 | call ESMF_StateGet(iiState, "CICE Import", iceBundle, rc=rc) 126 | if (ESMF_LogMsgFoundError(rc, "Get CICE Import failed", & 127 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 128 | ! 129 | ! --- Get bundle for ocn 130 | call ESMF_StateGet(oeState, "HYCOM Export", ocnBundle, rc=rc) 131 | if (ESMF_LogMsgFoundError(rc, "Get HYCOM Export failed", & 132 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 133 | ! 134 | ! --- Setup O2I route handle 135 | call ESMF_FieldBundleRedistStore(ocnBundle, iceBundle, & 136 | o2iRouteHandle, rc=rc) 137 | if (ESMF_LogMsgFoundError(rc, & 138 | "FieldBundleRedistStore o2i failed", & 139 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 140 | ! 141 | return 142 | end subroutine OICPL_Init 143 | 144 | subroutine OICPL_Run_I2O(cplComp, impState, expState, extClock, & 145 | rc) 146 | ! 147 | ! --- Calling parameters 148 | type(ESMF_CplComp) :: cplComp 149 | type(ESMF_State) :: impState 150 | type(ESMF_State) :: expState 151 | type(ESMF_Clock) :: extClock 152 | integer, intent(out) :: rc 153 | ! 154 | ! --- Locals 155 | integer :: rc2 156 | type(ESMF_State) :: oiState, ieState 157 | type(ESMF_FieldBundle) :: ocnBundle, iceBundle 158 | ! 159 | ! --- Report 160 | call ESMF_LogWrite("OICPL I2O run routine called", & 161 | ESMF_LOG_INFO, rc=rc) 162 | call ESMF_LogFlush(rc=rc) 163 | ! 164 | ! --- Get OCEAN import state 165 | call ESMF_StateGet(impState, "OCEAN Import", oiState, rc=rc) 166 | if (ESMF_LogMsgFoundError(rc, "Get OCEAN impState failed", & 167 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 168 | ! 169 | ! --- Get SEAICE export state 170 | call ESMF_StateGet(expState, "SEAICE Export", ieState, rc=rc) 171 | if (ESMF_LogMsgFoundError(rc, "Get SEAICE expState failed", & 172 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 173 | ! 174 | ! --- Get bundle for ocn 175 | call ESMF_StateGet(oiState, "HYCOM Import", ocnBundle, rc=rc) 176 | if (ESMF_LogMsgFoundError(rc, "Get HYCOM Import failed", & 177 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 178 | ! 179 | ! --- Get bundle for ice 180 | call ESMF_StateGet(ieState, "CICE Export", iceBundle, rc=rc) 181 | if (ESMF_LogMsgFoundError(rc, "Get CICE Export failed", & 182 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 183 | ! 184 | ! --- Transfer fields from ice state to ocn state 185 | call ESMF_FieldBundleRedist(iceBundle, ocnBundle, & 186 | i2oRouteHandle, rc=rc) 187 | if (ESMF_LogMsgFoundError(rc, "FieldBundleRedist i2o failed", & 188 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 189 | ! 190 | return 191 | end subroutine OICPL_Run_I2O 192 | 193 | subroutine OICPL_Run_O2I(cplComp, impState, expState, extClock, & 194 | rc) 195 | ! 196 | ! --- Calling parameters 197 | type(ESMF_CplComp) :: cplComp 198 | type(ESMF_State) :: impState 199 | type(ESMF_State) :: expState 200 | type(ESMF_Clock) :: extClock 201 | integer, intent(out) :: rc 202 | ! 203 | ! --- Locals 204 | integer :: rc2 205 | type(ESMF_State) :: oeState, iiState 206 | type(ESMF_FieldBundle) :: ocnBundle, iceBundle 207 | ! 208 | ! --- Report 209 | call ESMF_LogWrite( "OICPL O2I run routine called", & 210 | ESMF_LOG_INFO, rc=rc) 211 | call ESMF_LogFlush(rc=rc) 212 | ! 213 | ! --- Get SEAICE import state 214 | call ESMF_StateGet(impState, "SEAICE Import", iiState, rc=rc) 215 | if (ESMF_LogMsgFoundError(rc, "Get SEAICE impState failed", & 216 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 217 | ! 218 | ! --- Get OCEAN export state 219 | call ESMF_StateGet(expState, "OCEAN Export", oeState, rc=rc) 220 | if (ESMF_LogMsgFoundError(rc, "Get OCEAN expState failed", & 221 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 222 | ! 223 | ! --- Get bundle for ice 224 | call ESMF_StateGet(iiState, "CICE Import", iceBundle, rc=rc) 225 | if (ESMF_LogMsgFoundError(rc, "Get CICE Import failed", & 226 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 227 | ! 228 | ! --- Get bundle for ocn 229 | call ESMF_StateGet(oeState, "HYCOM Export", ocnBundle, rc=rc) 230 | if (ESMF_LogMsgFoundError(rc, "Get HYCOM Export failed", & 231 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 232 | ! 233 | ! --- Transfer fields from ocn state to ice state 234 | call ESMF_FieldBundleRedist(ocnBundle, iceBundle, & 235 | o2iRouteHandle, rc=rc) 236 | if (ESMF_LogMsgFoundError(rc, "FieldBundleRedist o2i failed", & 237 | rcToReturn=rc2)) call ESMF_Finalize(rc=rc) 238 | ! 239 | return 240 | end subroutine OICPL_Run_O2I 241 | 242 | subroutine OICPL_Final(cplComp, impState, expState, extClock, rc) 243 | ! 244 | ! --- Calling parameters 245 | type(ESMF_CplComp) :: cplComp 246 | type(ESMF_State) :: impState 247 | type(ESMF_State) :: expState 248 | type(ESMF_Clock) :: extClock 249 | integer, intent(out) :: rc 250 | ! 251 | ! --- Locals 252 | ! 253 | ! --- Report 254 | call ESMF_LogWrite("OICPL finalize routine called", & 255 | ESMF_LOG_INFO, rc=rc) 256 | call ESMF_LogFlush(rc=rc) 257 | ! 258 | ! --- Release i2o regrid/redist route handle 259 | call ESMF_FieldBundleRedistRelease(i2oRouteHandle, rc=rc) 260 | ! 261 | ! --- Release o2i regrid/redist route handle 262 | call ESMF_FieldBundleRedistRelease(o2iRouteHandle, rc=rc) 263 | ! 264 | return 265 | end subroutine OICPL_Final 266 | 267 | end module mod_OICPL 268 | -------------------------------------------------------------------------------- /mod_dimensions.F90: -------------------------------------------------------------------------------- 1 | module mod_dimensions 2 | implicit none 3 | public ! everything is public 4 | #if defined(RELO) 5 | !----------------------------------------------------------------------------- 6 | ! --- START OF USER SETABLE, BUT REGION INDEPEDENT, PARAMETERS 7 | ! 8 | ! --- iqr = maximum number of tiles in i direction 9 | ! --- jqr = maximum number of tiles in j direction 10 | integer iqr,jqr 11 | #if defined(MPI) || defined(SHMEM) 12 | parameter (iqr=299,jqr=299) ! multiple tiles (TYPE=ompi or mpi or shmem) 13 | #else 14 | parameter (iqr=1, jqr=1) ! single tile (TYPE=one or omp) 15 | #endif 16 | ! 17 | ! --- mxthrd= maximum number of OpenMP threads 18 | integer mxthrd 19 | #if defined(_OPENMP) 20 | parameter (mxthrd=8) ! NOMP=0,1,2,4,8 21 | #else 22 | parameter (mxthrd=1) ! NOMP=0,1 23 | #endif 24 | ! 25 | ! --- mxtrcr= maximum number of tracers 26 | integer mxtrcr 27 | parameter (mxtrcr=99) !not used to allocate large arrays 28 | ! 29 | ! --- END OF USER SETABLE, BUT REGION INDEPEDENT, PARAMETERS 30 | !----------------------------------------------------------------------------- 31 | ! 32 | ! --- halo size 33 | integer, parameter :: nbdy=6 34 | ! 35 | ! --- ms-1 = max. number of interruptions of any tile row or column by land 36 | integer, parameter :: ms=99 ! should be enough for any region 37 | ! 38 | ! --- ijqr = maximum total number of active tiles (= ipr*jpr) 39 | integer, parameter :: ijqr=iqr*jqr 40 | ! 41 | ! --- itdm = total grid dimension in i direction 42 | ! --- jtdm = total grid dimension in j direction 43 | ! --- kdm = grid dimension in k direction 44 | ! --- kk = grid dimension in k direction 45 | integer, save :: itdm,jtdm,kdm,kk 46 | ! 47 | ! --- idm = maximum single tile grid dimension in i direction 48 | ! --- jdm = maximum single tile grid dimension in j direction 49 | integer, save :: idm,jdm 50 | ! 51 | ! --- kkwall= grid dimension in k direction for wall relax arrays 52 | ! --- kknest= grid dimension in k direction for nest relax arrays 53 | integer, save :: kkwall,kknest 54 | ! 55 | ! --- kkmy25= grid dimension in k direction for M-Y 2.5 arrays 56 | integer, save :: kkmy25 57 | ! 58 | ! --- natm = number of saved atmospheric fields 59 | integer, save :: natm 60 | ! 61 | ! --- OpenMP will allocate jblk rows to each thread in turn 62 | integer, save :: jblk 63 | ! 64 | ! --- for CCSM array dimensions 65 | integer, save :: imt1,imt2,jmt1,jmt2 66 | ! 67 | ! --- actual extent of this tile is (i0+1:i0+ii,j0+1:j0+jj,1:kk) 68 | integer, save :: i0,j0,ii,jj 69 | ! 70 | ! --- information (gindex) that keeps do loops from running into land 71 | integer, save, allocatable, dimension (:,:) :: & 72 | ip,iu,iv,iq, iuopn,ivopn, ipa, ishlf, & 73 | ipim1, ipip1, ipjm1, ipjp1, & 74 | ipim1x,ipip1x,ipjm1x,ipjp1x 75 | integer, save, allocatable, dimension (:,:) :: & 76 | ifp,ilp,ifq,ilq,ifu,ilu,ifv,ilv 77 | integer, save, allocatable, dimension (:,:) :: & 78 | jfp,jlp,jfq,jlq,jfu,jlu,jfv,jlv 79 | integer, save, allocatable, dimension (:) :: & 80 | isp,isq,isu,isv 81 | integer, save, allocatable, dimension (:) :: & 82 | jsp,jsq,jsu,jsv 83 | logical, save, allocatable, dimension (:) :: & 84 | allip,alliq,alliu,alliv 85 | #else 86 | include 'dimensions.h' 87 | ! 88 | ! --- halo size 89 | integer, parameter :: nbdy=6 90 | ! 91 | ! --- OpenMP will allocate jblk rows to each thread in turn 92 | integer, parameter :: jblk=(jdm+2*nbdy+mxthrd-1)/mxthrd 93 | ! 94 | ! --- ms-1 = max. number of interruptions of any tile row or column by land 95 | integer, parameter :: ms=99 ! should be enough for any region 96 | ! 97 | ! --- ijqr = maximum total number of active tiles (= ipr*jpr) 98 | integer, parameter :: ijqr=iqr*jqr 99 | ! 100 | ! --- for CCSM array dimensions 101 | integer, parameter :: imt1=1-nbdy,imt2=idm+nbdy, & 102 | jmt1=1-nbdy,jmt2=jdm+nbdy 103 | ! 104 | ! --- actual extent of this tile is (i0+1:i0+ii,j0+1:j0+jj,1:kk) 105 | integer, parameter :: kk=kdm 106 | integer, save :: i0,j0,ii,jj 107 | ! 108 | ! --- information to keep do loops from running into land 109 | integer, save, dimension (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) :: & 110 | ip,iu,iv,iq, iuopn,ivopn, ipa, ishlf, & 111 | ipim1, ipip1, ipjm1, ipjp1, & 112 | ipim1x,ipip1x,ipjm1x,ipjp1x 113 | integer, save, dimension (1-nbdy:jdm+nbdy,ms) :: & 114 | ifp,ilp,ifq,ilq,ifu,ilu,ifv,ilv 115 | integer, save, dimension (1-nbdy:idm+nbdy,ms) :: & 116 | jfp,jlp,jfq,jlq,jfu,jlu,jfv,jlv 117 | integer, save, dimension (1-nbdy:jdm+nbdy) :: & 118 | isp,isq,isu,isv 119 | integer, save, dimension (1-nbdy:idm+nbdy) :: & 120 | jsp,jsq,jsu,jsv 121 | logical, save, dimension (1-nbdy:jdm+nbdy) :: & 122 | allip,alliq,alliu,alliv 123 | #endif 124 | ! 125 | ! --- line printer unit (stdout) 126 | integer, save :: lp 127 | ! 128 | real, save :: r_init !value that allocated arrays should be set to 129 | !initialize with set_r_init (to NaN or huge) 130 | ! 131 | integer*8, save, private :: & 132 | mem_alloc_now = 0 & !memory in words explicitly allocated by HYCOM 133 | , mem_alloc_high = 0 !high water mark of memory allocated by HYCOM 134 | 135 | contains 136 | 137 | #if defined(RELO) 138 | subroutine gindex_allocate 139 | implicit none 140 | ! 141 | ! --- allocate information (gindex) that keeps do loops from running into land 142 | ! 143 | jblk = (jdm+2*nbdy+mxthrd-1)/mxthrd 144 | ! 145 | imt1 = 1-nbdy 146 | imt2 = idm+nbdy 147 | jmt1 = 1-nbdy 148 | jmt2 = jdm+nbdy 149 | ! 150 | allocate( & 151 | ip(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 152 | iu(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 153 | iv(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 154 | iq(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 155 | iuopn(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 156 | ivopn(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 157 | ishlf(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 158 | ipa(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 159 | ipim1x(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 160 | ipip1x(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 161 | ipjm1x(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 162 | ipjp1x(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 163 | ipim1(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 164 | ipip1(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 165 | ipjm1(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 166 | ipjp1(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) ) 167 | call mem_stat_add( 8*(idm+2*nbdy)*(jdm+2*nbdy) ) !real=2*int 168 | ! 169 | allocate( & 170 | ifp(1-nbdy:jdm+nbdy,ms), & 171 | ilp(1-nbdy:jdm+nbdy,ms), & 172 | ifq(1-nbdy:jdm+nbdy,ms), & 173 | ilq(1-nbdy:jdm+nbdy,ms), & 174 | ifu(1-nbdy:jdm+nbdy,ms), & 175 | ilu(1-nbdy:jdm+nbdy,ms), & 176 | ifv(1-nbdy:jdm+nbdy,ms), & 177 | ilv(1-nbdy:jdm+nbdy,ms) ) 178 | call mem_stat_add( 4*(jdm+2*nbdy)*ms ) !real=2*int 179 | ! 180 | allocate( & 181 | jfp(1-nbdy:idm+nbdy,ms), & 182 | jlp(1-nbdy:idm+nbdy,ms), & 183 | jfq(1-nbdy:idm+nbdy,ms), & 184 | jlq(1-nbdy:idm+nbdy,ms), & 185 | jfu(1-nbdy:idm+nbdy,ms), & 186 | jlu(1-nbdy:idm+nbdy,ms), & 187 | jfv(1-nbdy:idm+nbdy,ms), & 188 | jlv(1-nbdy:idm+nbdy,ms) ) 189 | call mem_stat_add( 4*(idm+2*nbdy)*ms ) !real=2*int 190 | ! 191 | allocate( & 192 | isp(1-nbdy:jdm+nbdy), & 193 | isq(1-nbdy:jdm+nbdy), & 194 | isu(1-nbdy:jdm+nbdy), & 195 | isv(1-nbdy:jdm+nbdy) ) 196 | call mem_stat_add( 2*(jdm+2*nbdy) ) !real=2*int 197 | ! 198 | allocate( & 199 | jsp(1-nbdy:idm+nbdy), & 200 | jsq(1-nbdy:idm+nbdy), & 201 | jsu(1-nbdy:idm+nbdy), & 202 | jsv(1-nbdy:idm+nbdy) ) 203 | call mem_stat_add( 2*(idm+2*nbdy) ) !real=2*int 204 | ! 205 | allocate( & 206 | allip(1-nbdy:jdm+nbdy), & 207 | alliq(1-nbdy:jdm+nbdy), & 208 | alliu(1-nbdy:jdm+nbdy), & 209 | alliv(1-nbdy:jdm+nbdy) ) 210 | call mem_stat_add( 2*(jdm+2*nbdy) ) !real=2*logical 211 | ! 212 | end subroutine gindex_allocate 213 | #endif /* RELO */ 214 | 215 | subroutine mem_stat_add(mem_words) 216 | implicit none 217 | ! 218 | integer mem_words 219 | ! 220 | ! --- add mem_words to mem_alloc_ statistics 221 | ! --- note that mem_words can be negative 222 | ! --- call after every allocate and deallocate statement 223 | ! 224 | mem_alloc_now = mem_alloc_now + mem_words 225 | mem_alloc_high = max( mem_alloc_high, mem_alloc_now ) 226 | ! 227 | end subroutine mem_stat_add 228 | 229 | subroutine mem_stat_print(ctitle) 230 | implicit none 231 | ! 232 | character*(*) ctitle 233 | ! 234 | ! --- print memory statistics 235 | ! --- only call mem_stat_print on the processors that you want to print 236 | ! 237 | real*8 a3_1,a3_now,a3_high,gb_now,gb_high 238 | integer*8 mem_3d,mem_3df 239 | ! 240 | gb_now = mem_alloc_now / (1024.d0**3/8.d0) 241 | gb_high = mem_alloc_high / (1024.d0**3/8.d0) 242 | ! 243 | a3_1 = (idm+2*nbdy)*(jdm+2*nbdy)*kdm 244 | ! 245 | mem_3d = mem_alloc_now /((idm+2*nbdy)*(jdm+2*nbdy)*kdm) 246 | mem_3df = mem_alloc_now - & 247 | mem_3d*((idm+2*nbdy)*(jdm+2*nbdy)*kdm) 248 | a3_now = mem_3d + mem_3df/a3_1 249 | ! 250 | mem_3d = mem_alloc_high/((idm+2*nbdy)*(jdm+2*nbdy)*kdm) 251 | mem_3df = mem_alloc_high - & 252 | mem_3d*((idm+2*nbdy)*(jdm+2*nbdy)*kdm) 253 | a3_high = mem_3d + mem_3df/a3_1 254 | ! 255 | write(lp,'(/a,a,2i16/a,a,4x,2f16.3/a,a,4x,2f16.3/)') & 256 | trim(ctitle),' memory (words) now,high =', & 257 | mem_alloc_now,mem_alloc_high, & 258 | trim(ctitle),' memory (GB) now,high =', & 259 | gb_now,gb_high, & 260 | trim(ctitle),' eq. 3-D arrays now,high =', & 261 | a3_now,a3_high 262 | ! 263 | end subroutine mem_stat_print 264 | 265 | #if defined(NAN2003) 266 | subroutine set_r_init 267 | use ieee_arithmetic, only : ieee_value, & 268 | ieee_quiet_nan 269 | implicit none 270 | ! 271 | ! --- inititialize r_init 272 | ! --- the value that allocated arrays should be set to 273 | ! --- version with ieee_arithmetic intrinsic module 274 | ! 275 | r_init = ieee_value(r_init, ieee_quiet_nan) 276 | ! 277 | end subroutine set_r_init 278 | #else 279 | subroutine set_r_init 280 | implicit none 281 | ! 282 | ! --- inititialize r_init 283 | ! --- the value that allocated arrays should be set to 284 | ! --- version without ieee_arithmetic intrinsic module 285 | ! 286 | r_init = huge(r_init) 287 | ! 288 | end subroutine set_r_init 289 | #endif 290 | 291 | end module mod_dimensions 292 | ! 293 | !> Revision history: 294 | !> 295 | !> Jan. 2014 - inline some of dimensions.h 296 | !> Jan. 2014 - add r_init and set_r_init; r_init is NaN via /* NAN2003 */ macro 297 | !> Jan. 2014 - dimensions_relo.h for relocatable (region independent) case 298 | !> Feb. 2014 - removed margin, no longer a global variable 299 | !> Apr. 2014 - added ishlf 300 | !> May 2014 - added ipim1,ipip1,ipjm1,ipjp1,ipim1x,ipip1x,ipjm1x,ipjp1x 301 | !> May 2014 - added allip,alliq,alliu,alliv 302 | !> Feb. 2015 - added gb_now,gb_high 303 | -------------------------------------------------------------------------------- /mod_xc.F90: -------------------------------------------------------------------------------- 1 | module mod_xc 2 | use mod_dimensions !include 'dimensions.h' 3 | implicit none 4 | ! 5 | ! --- HYCOM communication interface. 6 | ! --- see README.src.mod_xc for more details. 7 | ! 8 | include 'unit_offset.h' 9 | ! 10 | ! --- tile dimensions and tile numbers (counting from 1), see xcspmd 11 | integer, public, save :: ipr, jpr, ijpr, & 12 | mproc,nproc,mnproc, & 13 | mp_1st 14 | #if defined(MPI) 15 | ! 16 | ! --- needed for some versions of mod_za 17 | integer, public, save :: group_1st_in_row 18 | #if defined(OCEANS2) 19 | ! 20 | ! --- two copies of HYCOM on distinct MPI tasks, master/slave via mod_pipe. 21 | integer, public, save :: nocean,idp1_1,idp1_2 22 | #endif 23 | #endif 24 | ! 25 | ! --- region type (-1==unknown, 26 | ! --- 0== closed/closed, 27 | ! --- 1==periodic/closed, 28 | ! --- 2==periodic/arctic, 29 | ! --- 3==periodic/fplane 30 | ! --- 4== closed/fplane) 31 | integer, public, save :: nreg 32 | ! 33 | ! --- timers on, usually and default .true. 34 | logical, public, save :: timer_on=.true. 35 | ! 36 | ! --- fill value for land, usually 0.0 37 | real, public, save :: vland 38 | real*4, public, save :: vland4 !xcget4 only 39 | ! 40 | ! --- xctilr halo options 41 | integer, public, parameter :: halo_ps=1, halo_pv=11, & 42 | halo_qs=2, halo_qv=12, & 43 | halo_us=3, halo_uv=13, & 44 | halo_vs=4, halo_vv=14 45 | ! 46 | ! --- xcsync stdout flushing options 47 | logical, public, parameter :: flush_lp=.true., & 48 | no_flush=.false. 49 | ! 50 | ! --- generic subroutine names 51 | interface xcmaxr 52 | module procedure xcmaxr_0 ! rank 0 array (i.e. scalar) 53 | module procedure xcmaxr_1 ! rank 1 array 54 | module procedure xcmaxr_0o ! rank 0 array, old interface 55 | module procedure xcmaxr_1o ! rank 1 array, old interface 56 | end interface 57 | 58 | interface xcminr 59 | module procedure xcminr_0 ! rank 0 array (i.e. scalar) 60 | module procedure xcminr_1 ! rank 1 array 61 | module procedure xcminr_0o ! rank 0 array, old interface 62 | module procedure xcminr_1o ! rank 1 array, old interface 63 | end interface 64 | 65 | interface xcsumr 66 | module procedure xcsumr_0 ! rank 0 array (i.e. scalar) 67 | module procedure xcsumr_1 ! rank 1 array 68 | end interface 69 | #if defined(USE_ESMF4) || defined(ESPC_COUPLE) 70 | ! 71 | ! --- public data structures for ESMF, see xcspmd 72 | integer, public, save :: deBlockList(2,2,iqr*jqr) 73 | #endif 74 | ! 75 | ! --- private subroutines 76 | private xciget_sm 77 | ! 78 | ! --- private timer variables, see xctmri 79 | character*6, private, dimension(97), save :: cc 80 | integer, private, save :: nxc 81 | integer, private, dimension(97), save :: nc,nca,nci 82 | real*8, private, dimension(97), save :: tc,t0 83 | real*8, private, dimension(2), save :: tcxc,tcxl 84 | #if defined(MPI) || defined(SHMEM) 85 | ! 86 | ! --- private message passing data structures, see xcspmd 87 | #if defined(RELO) 88 | integer, private, save, allocatable, dimension(:,:) :: mpe_i 89 | integer, private, save, allocatable, dimension(:) :: npe_j 90 | #else 91 | integer, private, save :: mpe_i(0:itdm+1,0:jqr),npe_j(0:jtdm+1) 92 | #endif 93 | integer, private, save :: idproc( 0: iqr+1,0:jqr+1), & 94 | idproc1(0:ijqr+1),idhalo(2), & 95 | i0_pe(iqr,jqr),ii_pe(iqr,jqr), & 96 | j0_pe(iqr,jqr),jj_pe(iqr,jqr), & 97 | mpe_1(jqr), & 98 | mpe_e(jqr) 99 | integer, private, save :: i1sum(iqr,jqr),iisum(iqr,jqr) 100 | integer, private, save :: m0_top,i0_st(iqr),ii_st(iqr), & 101 | mm_top,i0_gt(iqr),ii_gt(iqr), & 102 | m0_bot,i0_sb(iqr),ii_sb(iqr), & 103 | mm_bot,i0_gb(iqr),ii_gb(iqr) 104 | integer, private, save :: null_tile 105 | #endif 106 | #if defined(MPI) 107 | integer, private, save :: mpi_comm_hycom 108 | #endif 109 | #if defined(MPI) || defined(SHMEM) 110 | ! 111 | ! --- private message passing buffers, used by more than one routine 112 | #if defined(RELO) 113 | real, save, private, allocatable, dimension(:,:) :: & 114 | al ! xcaget and xcaput 115 | real, save, private, allocatable, dimension(:) :: & 116 | at ! xcaget and xcaput 117 | real*4, save, private, allocatable, dimension(:,:) :: & 118 | al4, & ! xcaget4 and xcaput4 119 | alt4 ! xcaget4 and xcaput4 120 | real*4, save, private, allocatable, dimension(:) :: & 121 | at4 ! xcaget4 and xcaput4 122 | integer, save, private :: & 123 | mxsum 124 | real*8, save, private, allocatable, dimension(:) :: & 125 | sum8t, & ! xcsum and xcsumj 126 | sum8j ! xcsum and xcsumj 127 | real*8, save, private :: & 128 | sum8s 129 | #else 130 | real, save, private, dimension(itdm,jdm) :: & 131 | al ! xcaget and xcaput 132 | real, save, private, dimension(idm*jdm) :: & 133 | at ! xcaget and xcaput 134 | real*4, save, private, dimension(itdm,jdm) :: & 135 | al4 ! xcaget4 and xcaput4 136 | real*4, save, private, dimension(idm*jdm,jpr) :: & 137 | alt4 ! xcaget4 and xcaput4 138 | real*4, save, private, dimension(idm*jdm) :: & 139 | at4 ! xcaget4 and xcaput4 140 | integer, private, parameter :: mxsum=(idm+4*nbdy)/(2*nbdy+1) 141 | real*8, save, private, dimension(mxsum*jdm) :: & 142 | sum8t ! xcsum and xcsumj 143 | real*8, save, private, dimension(jdm) :: & 144 | sum8j ! xcsum and xcsumj 145 | real*8, save, private :: & 146 | sum8s ! xcsum and xcsumj 147 | #endif 148 | integer, private, parameter :: nmax=1024 149 | real, save, private, dimension(nmax) :: & 150 | b,c ! xcastr, xcmaxr, xcminr, xcsumr 151 | #endif 152 | ! 153 | ! --- actual module subroutines 154 | contains 155 | #if defined(MPI) || defined(SHMEM) 156 | # include "mod_xc_mp.h" 157 | #else 158 | # include "mod_xc_sm.h" 159 | #endif 160 | end module mod_xc 161 | -------------------------------------------------------------------------------- /mod_za.F90: -------------------------------------------------------------------------------- 1 | module mod_za 2 | use mod_xc ! HYCOM communication API 3 | ! 4 | implicit none 5 | ! 6 | ! --- HYCOM I/O interface. 7 | ! 8 | ! --- See README.src.mod_za for more details. 9 | ! 10 | #if defined(MPI) && ! defined(SERIAL_IO) 11 | integer, save, private :: & 12 | file_info_zaiord,file_count_zaiord, & 13 | file_info_zaiowr,file_count_zaiowr 14 | #else 15 | private zaiordd,zaiowrd 16 | #endif 17 | private ztiowrd 18 | ! 19 | integer, private, parameter :: uaoff = 1000 + uoff !array I/O unit offset 20 | #if defined(RELO) 21 | ! 22 | ! --- initialized in zaiost. 23 | integer, private, save :: n2drec 24 | real*4, private, save, allocatable, dimension(:) :: & 25 | wminy,wmaxy,htmp 26 | #else 27 | ! 28 | integer, parameter :: n2drec=((itdm*jtdm+4095)/4096)*4096 29 | real*4, private, save, dimension(jtdm) :: wminy,wmaxy 30 | real*4, private, save, dimension(idm*jdm) :: htmp 31 | #endif 32 | ! 33 | real*4, private, save, allocatable, dimension(:) :: w 34 | ! 35 | contains 36 | #if ! defined(MPI) && ! defined(SHMEM) 37 | # include "mod_za_sm.h" 38 | #elif defined(SERIAL_IO) 39 | # include "mod_za_mp1.h" 40 | #else 41 | # include "mod_za_mp.h" 42 | #endif 43 | # include "mod_za_zt.h" 44 | end module mod_za 45 | 46 | #if defined(ENDIAN_IO_F90) /* see mach_i.c for new C version */ 47 | subroutine zaio_endian(a,n) 48 | implicit none 49 | ! 50 | integer, intent(in) :: n 51 | integer(kind=4), intent(inout) :: a(n) ! 4-bytes 52 | ! 53 | !********** 54 | !* 55 | ! 1) swap the endian-ness of the array. 56 | ! 57 | ! 2) assumes integer(kind=1) and integer(kind=4) ocupy one and four 58 | ! bytes respectively. 59 | !* 60 | !********** 61 | ! 62 | integer k 63 | ! 64 | integer(kind=4) ii4, io4 ! 4-bytes 65 | common/czioxe/ ii4, io4 ! helps prevent unwanted optimization 66 | save /czioxe/ 67 | ! 68 | integer(kind=1) ii1(4),io1(4) ! 1-byte 69 | equivalence (ii4,ii1(1)), (io4,io1(1)) ! non-standard f90 70 | ! 71 | do k= 1,n 72 | ii4 = a(k) 73 | io1(1) = ii1(4) 74 | io1(2) = ii1(3) 75 | io1(3) = ii1(2) 76 | io1(4) = ii1(1) 77 | a(k) = io4 78 | enddo 79 | return 80 | end subroutine zaio_endian 81 | #endif /* ENDIAN_IO_F90 */ 82 | -------------------------------------------------------------------------------- /overtn.F90: -------------------------------------------------------------------------------- 1 | subroutine overtn(dtime,dyear) 2 | use mod_xc ! HYCOM communication interface 3 | use mod_cb_arrays ! HYCOM saved arrays 4 | implicit none 5 | ! 6 | real*8 dtime,dyear 7 | ! 8 | ! --- diagnose meridional heat flux in basin model 9 | ! 10 | real*8 dsmall 11 | parameter (dsmall=0.001d0) 12 | ! 13 | integer i,j,k,l,noo 14 | ! 15 | logical lfirst 16 | save lfirst 17 | data lfirst / .true. / 18 | ! 19 | #if defined(RELO) 20 | real*8, save, allocatable, dimension(:,:) :: & 21 | zonavt,zonavf 22 | real*8, save, allocatable, dimension(:) :: & 23 | anum,heatf,heatfl,hfxzon 24 | #else 25 | real*8, save, dimension(jtdm,kdm) :: & 26 | zonavt,zonavf 27 | real*8, save, dimension(jtdm) :: & 28 | anum,heatf,heatfl,hfxzon 29 | #endif 30 | ! 31 | #if defined(RELO) 32 | if (.not.allocated(zonavt)) then 33 | allocate( & 34 | zonavt(jtdm,kdm), & 35 | zonavf(jtdm,kdm) ) 36 | call mem_stat_add( 2*jtdm*kdm ) 37 | zonavt = r_init 38 | zonavf = r_init 39 | allocate( & 40 | anum(jtdm), & 41 | heatf(jtdm), & 42 | heatfl(jtdm), & 43 | hfxzon(jtdm) ) 44 | call mem_stat_add( 4*jtdm ) 45 | anum = r_init 46 | heatf = r_init 47 | heatfl = r_init 48 | hfxzon = r_init 49 | endif 50 | #endif 51 | ! 52 | ! --- integrate meridional heat fluxes vertically and in zonal direction 53 | do j=1,jtdm 54 | hfxzon(j)=0. 55 | heatfl(j)=0. 56 | enddo 57 | ! 58 | do k=1,kk 59 | do j=1,jj 60 | do i=1,ii 61 | if (iv(i,j).ne.0) then 62 | util1(i,j) = (temp(i,j,k,1)+temp(i,j-1,k,1)) 63 | util2(i,j) = vflx(i,j,k) 64 | util3(i,j) = (temp(i,j,k,1)+temp(i,j-1,k,1))*vflx(i,j,k) 65 | endif 66 | enddo 67 | enddo 68 | call xcsumj(zonavt(1,k), util1,iv) 69 | call xcsumj(zonavf(1,k), util2,iv) 70 | call xcsumj(heatf, util3,iv) 71 | if (lfirst) then 72 | util4 = 1.0 73 | call xcsumj(anum, util4,iv) 74 | endif 75 | if (mnproc.eq.1) then 76 | do j=1,jtdm 77 | if (anum(j).ne.0.0) then 78 | heatfl(j)=heatfl(j)+heatf(j) 79 | hfxzon(j)=hfxzon(j)+zonavt(j,k)*zonavf(j,k)/anum(j) 80 | endif 81 | enddo 82 | endif 83 | enddo 84 | if (mnproc.eq.1) then 85 | do j= 1,jtdm 86 | hfxzon(j)=.5*hfxzon(j)*spcifh/g * 1.e-15 87 | heatfl(j)=.5*heatfl(j)*spcifh/g * 1.e-15 88 | enddo 89 | !diag print 999, nstep,vflx(31,11,11) 90 | !diag 999 format(' overtn - nstep,vflx=',i10,d20.12) 91 | ! 92 | ! --- save everything in a special file 93 | noo=26 94 | ! 95 | if (lfirst) then 96 | open (unit=noo,file=flnmovr,status='new',form='formatted') 97 | endif 98 | ! 99 | write (noo,'(a,f10.2,i6,f7.2)') & 100 | ' time,year,day =',dtime,int((dtime+dsmall)/dyear), & 101 | mod(dtime+dsmall, dyear) 102 | write (noo,'(a/(11f7.3))') & 103 | ' northward heat flux (petawatts):', (heatfl(j),j=1,jtdm-1) 104 | write (noo,'(a/(11f7.3))') & 105 | ' meridional overturning component:',(hfxzon(j),j=1,jtdm-1) 106 | call flush(noo) 107 | ! 108 | write (lp, '(a/(11f7.3))') & 109 | ' northward heat flux (petawatts):', (heatfl(j),j=1,jtdm-1) 110 | call flush(lp) 111 | endif 112 | call xcsync(flush_lp) 113 | ! 114 | lfirst = .false. 115 | ! 116 | return 117 | end subroutine overtn 118 | 119 | 120 | -------------------------------------------------------------------------------- /poflat.F90: -------------------------------------------------------------------------------- 1 | subroutine profile_lat(theta,press,xlat) 2 | implicit none 3 | ! 4 | real theta,press,xlat 5 | ! 6 | integer lp 7 | common/linepr/ lp 8 | save /linepr/ 9 | ! 10 | ! --- this routine returns either: 11 | ! 12 | ! --- pressure as function of density and latitude 13 | ! --- density as function of pressure and latitude 14 | ! 15 | ! --- set press < 0.0 on input to return pressure 16 | ! 17 | ! --- typically invoked via either poflat or roflat. 18 | ! 19 | integer ix,kz 20 | real p1,p2,pinthi,pintlo,pz,thet,thetlo,thethi,x,xla,z 21 | ! 22 | integer kdpth,klat 23 | parameter (kdpth=14,klat=19) ! kdpth>1, klat>3 24 | ! 25 | real onem,thet1,thet2,dthet,xlat1,xlat2,dlat 26 | real pdat(kdpth,klat) 27 | ! 28 | data onem/9806./ ! SI units 29 | data thet1,thet2,dthet/30.0,37.8,0.6/ 30 | data xlat1,xlat2,dlat/-90.,90.,10./ 31 | ! 32 | !--- depth (m) of isopycnals of potential density 30.0, 30.6, ... , 37.8 33 | !--- at latitudes 90s ... 90n for GLBa (source: levitus atlas) 34 | ! 35 | data pdat / & 36 | 0.,0., 0., 0., 0., 0., 1., 23.,158.,257.,575.,1009.,8100.,8100. & !90s 37 | ,0.,0., 0., 0., 0., 0., 1., 23.,158.,257.,575.,1009.,8100.,8100. & !80s 38 | ,0.,0., 0., 0., 0., 0., 1., 23.,158.,257.,575.,1009.,8100.,8100. & !70s 39 | ,0.,0., 0., 0., 0., 0., 1., 23.,158.,257.,575.,1009.,8100.,8100. & !60s 40 | ,0.,0., 0., 0., 0., 0., 1., 23.,158.,257.,575.,1009.,8100.,8100. & !50s 41 | ,0.,0., 0., 0., 0., 0., 1., 23.,158.,257.,575.,1009.,8100.,8100. & !40s 42 | ,0.,0., 0., 0., 0., 0., 1., 23.,158.,257.,575.,1009.,8100.,8100. & !30s 43 | ,0.,0., 0., 0., 0., 0., 1., 40.,159.,233.,478., 913.,8100.,8100. & !20s 44 | ,0.,0., 0., 0., 3.,38.,79., 98.,120.,156.,336.,1033.,8100.,8100. & !10s 45 | ,1.,1., 1., 5.,36.,51.,62., 71., 86.,121.,407., 873.,8100.,8100. & ! 0 46 | ,3.,5.,10.,24.,45.,60.,72., 86.,104.,137.,283., 929.,8100.,8100. & !10n 47 | ,0.,0., 2.,20.,34.,47.,69.,112.,154.,224.,446., 794.,8100.,8100. & !20n 48 | ,0.,0., 1., 3., 6.,15.,24., 42., 77.,193.,557., 761.,8100.,8100. & !30n 49 | ,0.,0., 0., 0., 1., 6., 9., 19., 38., 72.,227., 617.,8100.,8100. & !40n 50 | ,0.,0., 0., 0., 1., 2., 3., 5., 8., 28., 78., 353.,8100.,8100. & !50n 51 | ,0.,0., 0., 0., 0., 0., 0., 0., 1., 3., 12., 132.,1367.,8100. & !60n 52 | ,0.,0., 0., 0., 0., 0., 0., 0., 1., 2., 9., 32., 239.,8100. & !70n 53 | ,0.,0., 0., 0., 0., 0., 0., 0., 1., 2., 9., 32., 239.,8100. & !80n 54 | ,0.,0., 0., 0., 0., 0., 0., 0., 1., 2., 9., 32., 239.,8100. & !90n 55 | / 56 | ! 57 | !--- quasi-hermite interpolation function (0 < xx < 1) 58 | ! 59 | real parabl,xx,a,b,c 60 | parabl(xx,a,b,c)=b+.5*xx*(c-a+xx*(a+c-b-b)) 61 | ! 62 | xla=(xlat-xlat1)/dlat+1. 63 | ix=max(2,min(klat-2,int(xla))) 64 | x=max(0.,min(1.,xla-real(ix))) 65 | ! 66 | if (press.lt.0.0) then 67 | ! 68 | ! ---- pressure from density. 69 | ! 70 | thet=(theta-thet1)/dthet+1. 71 | if (thet.lt.1.0) then 72 | press=0.0 73 | else ! normal case 74 | kz=max(1,min(kdpth-1,int(thet))) 75 | z=max(0.,min(1.,thet-real(kz))) 76 | ! 77 | ! --- horizontal/vertical interpolation: quasi-hermite/linear 78 | ! 79 | p1=parabl( x,pdat(kz ,ix-1),pdat(kz ,ix ),pdat(kz ,ix+1)) 80 | p2=parabl(1.-x,pdat(kz ,ix+2),pdat(kz ,ix+1),pdat(kz ,ix )) 81 | pintlo=p1*(1.-x)+p2*x 82 | p1=parabl( x,pdat(kz+1,ix-1),pdat(kz+1,ix ),pdat(kz+1,ix+1)) 83 | p2=parabl(1.-x,pdat(kz+1,ix+2),pdat(kz+1,ix+1),pdat(kz+1,ix )) 84 | pinthi=p1*(1.-x)+p2*x 85 | press =(pintlo*(1.-z)+pinthi*z)*onem 86 | endif 87 | !diag write (lp,'('' poflat'',2f7.2,2i6,2f7.2,f7.1)') & 88 | !diag theta,xlat,ix,kz,x,z,press/onem 89 | else 90 | ! 91 | ! ---- density from pressure. 92 | ! 93 | pz=press/onem 94 | kz=1 95 | p1=parabl( x,pdat(kz,ix-1),pdat(kz,ix ),pdat(kz,ix+1)) 96 | p2=parabl(1.-x,pdat(kz,ix+2),pdat(kz,ix+1),pdat(kz,ix )) 97 | pinthi=p1*(1.-x)+p2*x 98 | if (pinthi.ge.pz) then 99 | theta=thet1 100 | else ! normal range 101 | do kz= 2,kdpth 102 | pintlo=pinthi 103 | p1=parabl( x,pdat(kz,ix-1),pdat(kz,ix ),pdat(kz,ix+1)) 104 | p2=parabl(1.-x,pdat(kz,ix+2),pdat(kz,ix+1),pdat(kz,ix )) 105 | pinthi=p1*(1.-x)+p2*x 106 | if (pinthi.ge.pz) then 107 | exit 108 | elseif (kz.eq.kdpth) then 109 | exit 110 | endif 111 | enddo 112 | z=max((pinthi-pz)/(pinthi-pintlo),0.0) 113 | theta=thet1+(kz-z-1.0)*dthet 114 | endif 115 | !diag write (lp,'('' roflat'',2f7.2,2i6,2f7.2,f7.1)') & 116 | !diag theta,xlat,ix,kz,x,z,pz 117 | endif 118 | return 119 | end 120 | 121 | real function poflat(theta,xlat) 122 | implicit none 123 | ! 124 | real theta,xlat 125 | ! 126 | ! --- returns pressure as function of density and latitude 127 | ! 128 | real press 129 | press = -1.0 130 | call profile_lat(theta,press,xlat) 131 | poflat = press 132 | return 133 | end 134 | 135 | real function roflat(press,xlat) 136 | implicit none 137 | ! 138 | real press,xlat 139 | ! 140 | ! --- returns density as function of pressure and latitude 141 | ! 142 | real theta 143 | ! 144 | call profile_lat(theta,press,xlat) 145 | roflat = theta 146 | return 147 | end 148 | 149 | ! 150 | !> Revision history 151 | !> 152 | !> May 2000 - conversion to SI units 153 | !> Aug 2001 - added roflat and profile_lat to poflat. 154 | !> Feb. 2025 - printout now ok for kdm<1000 and idm,jdm<100,000 155 | -------------------------------------------------------------------------------- /prtmsk.F90: -------------------------------------------------------------------------------- 1 | subroutine prtmsk(mask,array,work,idm,ii,jj,offset,scale,title) 2 | ! 3 | ! --- Delete 'array' elements outside 'mask'. Then 4 | ! --- break 'array' into sections, each 'nchar' characters wide, for printing. 5 | ! 6 | implicit none 7 | integer nchar 8 | parameter (nchar=120) 9 | !cc parameter (nchar= 76) 10 | !cc parameter (nchar= 80) 11 | !cc parameter (nchar=132) 12 | ! 13 | integer idm,ii,jj 14 | integer mask(idm,*) 15 | real array(idm,*),work(idm,*) 16 | real offset,scale 17 | character title*(*) 18 | ! 19 | integer lp 20 | common/linepr/ lp 21 | save /linepr/ 22 | ! 23 | integer i,i1,i2,j,n,ncols 24 | ! 25 | real cvmgp,cvmgz,a,b,c 26 | integer ic 27 | cvmgp(a,b,c)=a*(.5+sign(.5,c))+b*(.5-sign(.5,c)) 28 | cvmgz(a,b,ic)=cvmgp(a,b,-1.*iabs(ic)) 29 | ! 30 | ncols=nchar/4 31 | do n=1,ii/ncols+1 32 | i1=ncols*(n-1)+1 33 | i2=min0(ncols*n,ii) 34 | if (i1.gt.i2) exit 35 | write & 36 | (lp,'(/'' Sec.'',i2,'' (cols'',i4,'' -'',i4,'') -- '',a)') & 37 | n,i1,i2,title 38 | !cc if (i2.lt.i1+5) then 39 | !cc write (lp,'('' (Not printed. Too few columns. Save paper.)'')') 40 | !cc exit 41 | !cc end if 42 | do j=jj,1,-1 43 | do i=i1,i2 44 | work(i,j)=cvmgz(0.,array(i,j),mask(i,j)) 45 | enddo 46 | do i=i1,i2 47 | work(i,j)=cvmgz(0.,(work(i,j)-offset)*scale,mask(i,j)) 48 | enddo 49 | write (lp,'(32i4)') j,(int(work(i,j)),i=i1,i2) 50 | !cc write (lp,'(i4,1x,75i1)') j,(int(work(i,j)),i=i1,i2) 51 | !cc write (lp,'(i4,1x,120i1)') j,(int(work(i,j)),i=i1,i2) 52 | enddo 53 | enddo 54 | call flush(lp) 55 | return 56 | end 57 | -------------------------------------------------------------------------------- /psmoo.F90: -------------------------------------------------------------------------------- 1 | subroutine psmooth(a,margin_a,margin_smooth, imask, w) 2 | use mod_xc ! HYCOM communication interface 3 | use mod_cb_arrays ! HYCOM saved arrays 4 | implicit none 5 | ! 6 | integer margin_a,margin_smooth 7 | integer imask(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) 8 | real a(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 9 | w(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) 10 | ! 11 | ! --- ragged boundary version of basic 9-point smoothing routine. 12 | ! --- this routine is set up to smooth data carried at -p- points. 13 | ! 14 | ! --- margin_a is the margin on entry, and 15 | ! --- margin_smooth is the margin on exit. 16 | ! --- imask is ip or ishlf. 17 | ! 18 | ! --- see also psmooth_ice and psmooth_dif. 19 | ! 20 | ! --- w used as workspace, overwritten on exit 21 | ! 22 | integer i,ismth,j,jsmth,msmth 23 | real qc,sh 24 | ! 25 | real c(-1:1,-1:1) 26 | save c 27 | data c / 1.0, 2.0, 1.0, & 28 | 2.0, 4.0, 2.0, & 29 | 1.0, 2.0, 1.0 / 30 | ! 31 | qc = 1.0/sum(c(:,:)) 32 | ! 33 | msmth = min(margin_smooth,nbdy-1) 34 | ! 35 | if (margin_a.lt.msmth+1) then 36 | ! --- update the halo 37 | call xctilr(a,1,1, msmth+1,msmth+1, halo_ps) 38 | endif 39 | ! 40 | !$OMP PARALLEL DO PRIVATE(j,i) & 41 | !$OMP SCHEDULE(STATIC) 42 | do j=0-msmth,jj+msmth+1 43 | do i=0-msmth,ii+msmth+1 44 | w(i,j) = a(i,j) 45 | enddo 46 | enddo 47 | !$OMP END PARALLEL DO 48 | ! 49 | !$OMP PARALLEL DO PRIVATE(j,i,sh,jsmth,ismth) & 50 | !$OMP SCHEDULE(STATIC) 51 | do j=1-msmth,jj+msmth 52 | do i=1-msmth,ii+msmth 53 | if (imask(i,j).eq.1) then 54 | sh = 0.0 55 | do jsmth= -1,1 56 | do ismth= -1,1 57 | if (imask(i+ismth,j+jsmth).eq.1) then 58 | sh = sh + c(ismth,jsmth)*w(i+ismth,j+jsmth) 59 | else 60 | sh = sh + c(ismth,jsmth)*w(i, j) 61 | endif 62 | enddo 63 | enddo 64 | a(i,j) = sh*qc 65 | endif !imask.eq.1 66 | enddo 67 | enddo 68 | !$OMP END PARALLEL DO 69 | return 70 | end subroutine psmooth 71 | 72 | subroutine psmooth_new(a,b,margin_a,margin_smooth, imask, w) 73 | use mod_xc ! HYCOM communication interface 74 | use mod_cb_arrays ! HYCOM saved arrays 75 | implicit none 76 | ! 77 | integer margin_a,margin_smooth 78 | integer imask(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) 79 | real a(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 80 | b(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 81 | w(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) 82 | ! 83 | ! --- ragged boundary version of basic 9-point smoothing routine. 84 | ! --- this routine is set up to smooth data carried at -p- points. 85 | ! --- input in a, output in b. 86 | ! 87 | ! --- margin_a is the margin on entry, and 88 | ! --- margin_smooth is the margin on exit. 89 | ! --- imask is ip or ishlf. 90 | ! 91 | ! --- see also psmooth. 92 | ! 93 | ! --- a and b must not be the same array. 94 | ! 95 | integer i,ismth,j,jsmth,msmth 96 | real qc,sh 97 | ! 98 | real c(-1:1,-1:1) 99 | save c 100 | data c / 1.0, 2.0, 1.0, & 101 | 2.0, 4.0, 2.0, & 102 | 1.0, 2.0, 1.0 / 103 | ! 104 | qc = 1.0/sum(c(:,:)) 105 | ! 106 | msmth = min(margin_smooth,nbdy-1) 107 | ! 108 | if (margin_a.lt.msmth+1) then 109 | ! --- update the halo 110 | call xctilr(a,1,1, msmth+1,msmth+1, halo_ps) 111 | endif 112 | ! 113 | !$OMP PARALLEL DO PRIVATE(j,i,sh,jsmth,ismth) & 114 | !$OMP SCHEDULE(STATIC) 115 | do j=1-msmth,jj+msmth 116 | do i=1-msmth,ii+msmth 117 | if (imask(i,j).eq.1) then 118 | sh = 0.0 119 | do jsmth= -1,1 120 | do ismth= -1,1 121 | if (imask(i+ismth,j+jsmth).eq.1) then 122 | sh = sh + c(ismth,jsmth)*a(i+ismth,j+jsmth) 123 | else 124 | sh = sh + c(ismth,jsmth)*a(i, j) 125 | endif 126 | enddo 127 | enddo 128 | b(i,j) = sh*qc 129 | endif !imask.eq.1 130 | enddo 131 | enddo 132 | !$OMP END PARALLEL DO 133 | return 134 | end subroutine psmooth_new 135 | 136 | subroutine psmooth_ice(a,margin_a,margin_smooth, imask, w) 137 | use mod_xc ! HYCOM communication interface 138 | use mod_cb_arrays ! HYCOM saved arrays 139 | implicit none 140 | ! 141 | integer margin_a,margin_smooth 142 | integer imask(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) 143 | real a(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 144 | w(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) 145 | ! 146 | ! --- ragged boundary version of basic 9-point smoothing routine. 147 | ! --- this routine is set up to smooth data carried at -p- points. 148 | ! --- it also smooths covice=1.0 and covice=0.0 regions separately, 149 | ! --- leaving areas with fractional covice untouched. note that 150 | ! --- covice must be valid in the halo out to margin_smooth. 151 | ! 152 | ! --- margin_a is the margin on entry, and 153 | ! --- margin_smooth is the margin on exit. 154 | ! --- imask is ip or ishlf. 155 | ! 156 | ! --- see also psmooth and psmooth_dif 157 | ! 158 | ! --- array a can't be covice 159 | ! --- w used as workspace, overwritten on exit 160 | ! 161 | integer i,ismth,j,jsmth,msmth 162 | real qc,sh,ci 163 | ! 164 | real c(-1:1,-1:1) 165 | save c 166 | data c / 1.0, 2.0, 1.0, & 167 | 2.0, 4.0, 2.0, & 168 | 1.0, 2.0, 1.0 / 169 | ! 170 | qc = 1.0/sum(c(:,:)) 171 | ! 172 | msmth = min(margin_smooth,nbdy-1) 173 | ! 174 | if (margin_a.lt.msmth+1) then 175 | ! --- update the halo 176 | call xctilr(a,1,1, msmth+1,msmth+1, halo_ps) 177 | endif 178 | ! 179 | !$OMP PARALLEL DO PRIVATE(j,i) & 180 | !$OMP SCHEDULE(STATIC) 181 | do j=0-msmth,jj+msmth+1 182 | do i=0-msmth,ii+msmth+1 183 | w(i,j) = a(i,j) 184 | enddo 185 | enddo 186 | !$OMP END PARALLEL DO 187 | ! 188 | !$OMP PARALLEL DO PRIVATE(j,i,sh,ci,jsmth,ismth) & 189 | !$OMP SCHEDULE(STATIC) 190 | do j=1-msmth,jj+msmth 191 | do i=1-msmth,ii+msmth 192 | if (imask(i,j).eq.1) then 193 | ci = covice(i,j) 194 | if (ci.eq.0.0 .or. & 195 | ci.eq.1.0 ) then !full sea or full ice 196 | sh = 0.0 197 | do jsmth= -1,1 198 | do ismth= -1,1 199 | if ( imask(i+ismth,j+jsmth).eq.1 .and. & 200 | covice(i+ismth,j+jsmth).eq.ci ) then 201 | sh = sh + c(ismth,jsmth)*w(i+ismth,j+jsmth) 202 | else 203 | sh = sh + c(ismth,jsmth)*w(i, j) 204 | endif 205 | enddo 206 | enddo 207 | a(i,j) = sh*qc 208 | endif !full sea or full ice 209 | endif !imask.eq.1 210 | enddo 211 | enddo 212 | !$OMP END PARALLEL DO 213 | return 214 | end subroutine psmooth_ice 215 | 216 | subroutine psmooth_dif(a,aklist,k,margin_a,margin_smooth, & 217 | imask, w) 218 | use mod_xc ! HYCOM communication interface 219 | use mod_cb_arrays ! HYCOM saved arrays 220 | implicit none 221 | ! 222 | integer k,margin_a,margin_smooth 223 | integer imask( 1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) 224 | real a( 1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 225 | aklist(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy), & 226 | w( 1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) 227 | ! 228 | ! --- ragged boundary version of basic 9-point smoothing routine. 229 | ! --- this routine is set up to smooth vcty carried at -p- points. 230 | ! --- it return the maximum of the original and smoothed value and 231 | ! --- ignores locations where k > aklist(i,j). 232 | ! 233 | ! --- margin_a is the margin on entry, and 234 | ! --- margin_smooth is the margin on exit. 235 | ! --- imask is ip or ishlf. 236 | ! 237 | ! --- see also psmooth and psmooth_ice. 238 | ! 239 | ! --- w used as workspace, overwritten on exit 240 | ! --- assumes that aklist's halo is valid out to msmth+1. 241 | ! 242 | integer i,ismth,j,jsmth,msmth 243 | real qc,sh 244 | ! 245 | real c(-1:1,-1:1) 246 | save c 247 | data c / 1.0, 2.0, 1.0, & 248 | 2.0, 4.0, 2.0, & 249 | 1.0, 2.0, 1.0 / 250 | ! 251 | qc = 1.0/sum(c(:,:)) 252 | ! 253 | msmth = min(margin_smooth,nbdy-1) 254 | ! 255 | if (margin_a.lt.msmth+1) then 256 | ! --- update the halo 257 | call xctilr(a,1,1, msmth+1,msmth+1, halo_ps) 258 | endif 259 | ! 260 | !$OMP PARALLEL DO PRIVATE(j,i) & 261 | !$OMP SCHEDULE(STATIC) 262 | do j=0-msmth,jj+msmth+1 263 | do i=0-msmth,ii+msmth+1 264 | w(i,j) = a(i,j) 265 | enddo 266 | enddo 267 | !$OMP END PARALLEL DO 268 | ! 269 | !$OMP PARALLEL DO PRIVATE(j,i,sh,jsmth,ismth) & 270 | !$OMP SCHEDULE(STATIC) 271 | do j=1-msmth,jj+msmth 272 | do i=1-msmth,ii+msmth 273 | if ( imask(i,j).eq.1 .and. & 274 | aklist(i,j).ge.k ) then 275 | sh = 0.0 276 | do jsmth= -1,1 277 | do ismth= -1,1 278 | if ( imask(i+ismth,j+jsmth).eq.1 .and. & 279 | aklist(i+ismth,j+jsmth).ge.k ) then 280 | sh = sh + c(ismth,jsmth)*w(i+ismth,j+jsmth) 281 | else 282 | sh = sh + c(ismth,jsmth)*w(i, j) 283 | endif 284 | enddo 285 | enddo 286 | a(i,j) = max( a(i,j), sh*qc ) 287 | endif !imask.eq.1 288 | enddo 289 | enddo 290 | !$OMP END PARALLEL DO 291 | return 292 | end subroutine psmooth_dif 293 | ! 294 | ! 295 | !> Revision history: 296 | !> 297 | !> Apr. 2014 - added imask 298 | -------------------------------------------------------------------------------- /unit_offset.h: -------------------------------------------------------------------------------- 1 | ! 2 | ! --- uoff= offset for all unit numbers (in module mod_xc) 3 | integer uoff 4 | parameter (uoff=2000) 5 | -------------------------------------------------------------------------------- /wtime.F90: -------------------------------------------------------------------------------- 1 | #if defined(AIX) 2 | REAL*8 FUNCTION WTIME_DUMMY() 3 | IMPLICIT NONE 4 | ! 5 | ! USE A C-ROUTINE, SEE machi_c.c. 6 | ! 7 | WTIME_DUMMY = 0.0 8 | RETURN 9 | ! END OF WTIME_DUMMY. 10 | END 11 | #elif defined(MPI) 12 | REAL*8 FUNCTION WTIME() 13 | IMPLICIT NONE 14 | ! 15 | ! USE THE MPI FUNCTION MPI_WTIME TO RETURN WALL TIME. 16 | ! 17 | DOUBLE PRECISION MPI_WTIME 18 | ! 19 | WTIME = MPI_WTIME() 20 | RETURN 21 | ! END OF WTIME. 22 | END 23 | #else 24 | REAL*8 FUNCTION WTIME() 25 | IMPLICIT NONE 26 | ! 27 | ! USE THE F90 INTRINSIC SYSTEM_CLOCK TO RETURN WALL TIME. 28 | ! 29 | ! WILL FAIL IF THE COUNT IS EVER NEGATIVE, BUT THE STANDARD 30 | ! SAYS THAT IT IS AWAYS NON-NEGATIVE IF A CLOCK EXISTS. 31 | ! NOT THREAD-SAFE, UNLESS LCOUNT AND IOVER ARE THREADPRIVATE. 32 | ! 33 | REAL*8 ZERO,ONE 34 | PARAMETER (ZERO=0.0, ONE=1.0) 35 | ! 36 | INTEGER COUNT, MCOUNT, RATE 37 | ! 38 | REAL*8 OFFSEC, OFFSET, PERSEC 39 | INTEGER ICOUNT, IOVER, LCOUNT, NCOUNT 40 | SAVE OFFSEC, OFFSET, PERSEC 41 | SAVE ICOUNT, IOVER, LCOUNT, NCOUNT 42 | ! 43 | DATA IOVER, LCOUNT / -1, -1 / 44 | ! 45 | CALL SYSTEM_CLOCK(COUNT) 46 | ! 47 | IF (COUNT.LT.LCOUNT) THEN 48 | ! 49 | ! COUNT IS SUPPOSED TO BE NON-DECREASING EXCEPT WHEN IT WRAPS, 50 | ! BUT SOME IMPLEMENTATIONS DON''T DO THIS. SO IGNORE ANY 51 | ! DECREASE OF LESS THAN ONE PERCENT OF THE RANGE. 52 | ! 53 | IF (LCOUNT-COUNT.LT.NCOUNT) THEN 54 | COUNT = LCOUNT 55 | ELSE 56 | IOVER = IOVER + 1 57 | OFFSET = OFFSET + OFFSEC 58 | ENDIF 59 | ENDIF 60 | LCOUNT = COUNT 61 | ! 62 | IF (IOVER.EQ.0) THEN 63 | ! 64 | ! FIRST CYCLE, FOR ACCURACY WITH 64-BIT COUNTS. 65 | ! 66 | WTIME = (COUNT - ICOUNT) * PERSEC 67 | ELSEIF (IOVER.GT.0) THEN 68 | ! 69 | ! ALL OTHER CYCLES. 70 | ! 71 | WTIME = COUNT * PERSEC + OFFSET 72 | ELSE 73 | ! 74 | ! INITIALIZATION. 75 | ! 76 | CALL SYSTEM_CLOCK(ICOUNT, RATE, MCOUNT) 77 | NCOUNT = MCOUNT/100 78 | PERSEC = ONE/RATE 79 | OFFSEC = MCOUNT * PERSEC 80 | OFFSET = -ICOUNT * PERSEC 81 | IOVER = 0 82 | WTIME = ZERO 83 | ENDIF 84 | RETURN 85 | ! END OF WTIME. 86 | END 87 | #endif /* MPI:else */ 88 | --------------------------------------------------------------------------------