Skip to content

Commit

Permalink
added the red sea debug case for the wave model
Browse files Browse the repository at this point in the history
  • Loading branch information
iurnus committed Nov 30, 2023
1 parent 25dab28 commit a8c6b33
Show file tree
Hide file tree
Showing 75 changed files with 17,728 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@
clevsList = [np.arange(-205,205.01,10),np.arange(-20.5,20.51,1),np.arange(0,2001.01,200),\
np.arange(-205,205.01,10),np.arange(20,50.01,1),np.arange(24,32.01,0.1),\
np.arange(0,0.02001,0.0005),np.arange(0,2.01,0.1),np.arange(0,20.01,1),\
np.arange(0,1.001e-7,0.02e-7),np.arange(0,1.001e-7,0.02e-7)]
np.arange(0,1.001e-10,0.02e-10),np.arange(0,1.001e-7,0.02e-7)]
cmapList = [cmocean.cm.balance,cmocean.cm.balance,cmocean.cm.thermal,\
cmocean.cm.balance,cmocean.cm.thermal,cmocean.cm.thermal,\
cmocean.cm.turbid,cmocean.cm.speed,cmocean.cm.speed,\
cmocean.cm.speed,cmocean.cm.speed]
tickList = [np.arange(-200,201,100),np.arange(-20,20.01,10),np.arange(0,2001.01,500),\
np.arange(-200,201,100),np.arange(20,50.01,5),np.arange(24,32.01,1),\
np.arange(0,0.02001,0.002),np.arange(0,2.01,0.4),np.arange(0,20.01,4),\
np.arange(0,1.001e-7,0.2e-7),np.arange(0,1.001e-7,0.2e-7)]
np.arange(0,1.001e-10,0.2e-10),np.arange(0,1.001e-7,0.2e-7)]
nFigures = 11

print "plot mitgcm..."
Expand Down Expand Up @@ -88,6 +88,9 @@
clevs = clevsList[i]
cs = m.contourf(mitgcm_meshX,mitgcm_meshY,fieldName[i],\
clevs,extend='both',cmap=cmapList[i])
if (fieldString[i] == 'SST'):
print (np.mean(mitgcm_sst))

if (fieldString[i] == 'wind'):
nQ = 8
cs_quiver = m.quiver(mitgcm_meshX[::nQ,::nQ],mitgcm_meshY[::nQ,::nQ],\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@
clevsList = [np.arange(-205,205.01,10),np.arange(-20.5,20.51,1),np.arange(0,2001.01,200),\
np.arange(-205,205.01,10),np.arange(20,50.01,1),np.arange(24,32.01,0.1),\
np.arange(0,0.02001,0.0005),np.arange(0,2.01,0.1),np.arange(0,20.01,1),\
np.arange(0,1.001e-7,0.02e-7),np.arange(0,1.001e-7,0.02e-7)]
np.arange(0,1.001e-10,0.02e-10),np.arange(0,1.001e-7,0.02e-7)]
cmapList = [cmocean.cm.balance,cmocean.cm.balance,cmocean.cm.thermal,\
cmocean.cm.balance,cmocean.cm.thermal,cmocean.cm.thermal,\
cmocean.cm.turbid,cmocean.cm.speed,cmocean.cm.speed,\
cmocean.cm.speed,cmocean.cm.speed]
tickList = [np.arange(-200,201,100),np.arange(-20,20.01,10),np.arange(0,2001.01,500),\
np.arange(-200,201,100),np.arange(20,50.01,5),np.arange(24,32.01,1),\
np.arange(0,0.02001,0.002),np.arange(0,2.01,0.4),np.arange(0,20.01,4),\
np.arange(0,1.001e-7,0.2e-7),np.arange(0,1.001e-7,0.2e-7)]
np.arange(0,1.001e-10,0.2e-10),np.arange(0,1.001e-7,0.2e-7)]
nFigures = 11

print "plot WRF..."
Expand Down
2 changes: 1 addition & 1 deletion coupler/L3.C3.coupled_SouthernOcean/README
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
First, download the test case from:

wget ftp://sioftp.ucsd.edu/CW3E_DataShare/RSun_SKRIPS/L3.C3.coupled_SouthernOcean.zip
wget ftp://sioftp.ucsd.edu/CW3E_DataShare/RSun_SKRIPS/share/L3.C3.coupled_SouthernOcean.zip
7 changes: 0 additions & 7 deletions coupler/L4.C1.coupled_RS2012_ring/README

This file was deleted.

70 changes: 70 additions & 0 deletions coupler/L4.C1.coupled_RS2012_ring/README.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
This is the debug case for coupled ocean-wave-atmosphere simulations

To download the entire test case, use:
wget ftp://sioftp.ucsd.edu/CW3E_DataShare/RSun_SKRIPS/share/L4.C1.coupled_RS2012_ring.zip

To generate the case generator, use:
wget ftp://sioftp.ucsd.edu/CW3E_DataShare/RSun_SKRIPS/share/generate_rs_wave.zip

-------------------------------------------
MITgcm-WRF coupled simulation test: Red Sea

This folder contains an MITgcm-WRF coupled test case. The coupled simulation is
driven by ESMF. The case aims to test the implementation of the coupled code.
In this test, the ESMF driver drives both MITgcm and WRF. Both MITgcm and WRF
are divided into "init", "run", "finalize" parts. This coupled code drives the
realistic simulations in the Red Sea region.

The WRF bulf formula is used in this case.
This should be compiled using PGI compiler (run it on ring).

simulation:
Red Sea region

Notes:
To install and run this case::

./install.sh
cd runCase.init
./Allrun
cd runCase
./Allrun

To clean this case::

./clean.sh

How to check if the code is installed?

MITGCM executable is: build/mitgcmuv
MITGCM library is: build/mmout/libmitgcm_org_ocn.a
MITGCM run time library is: build/mmout/libmitgcmrtl.a
MITGCM mod file is: build/mitgcm_org_ocn.mod
The coupled MITGCM-ESMF solver is: coupledCode/esmf_application

###############
DEBUGGING CASES
###############
MUST run the coupled case first:

./allrun.sh

runMITtest: Test if the MITgcm flux is added correctly. (To install stand-alone MITgcm code, run ./install_mit.sh)
runWRFtest: Test if the WRF flux is added correctly
latexSummary: Generate the report automatically.

####################
WARNING!!!WARNING!!!
####################
The MITgcm path is defined as '${HOME}/scripps_kaust_model_github/MITgcm_c67m' in install.sh
The MPI_HOME path is defined as '/project_shared/Libraries/openmpi-2.1.1_pgi_fortran_17.5-0/include' in install.sh

The ESMF should be installed to run this case. The variable ESMFMKFILE should
be defined:

export ESMFMKFILE=$ESMF_DIR/lib/libg/Linux.pgi.64.openmpi.default/esmf.mk

where ESMF_DIR should be the location that ESMF is installed.

Make sure MATLAB is installed.
Make sure NCL is installed.
20 changes: 20 additions & 0 deletions coupler/L4.C1.coupled_RS2012_ring/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/csh -f

rm -rf build code
rm -rf build_mit code_mit

cd coupledCode
make distclean
cd ..

# cd runCase
# ./Allclean
# cd ..

# cd runCase.init
# ./Allclean
# cd ..

# cd latexSummary
# ./clean.sh
# cd ..
17 changes: 17 additions & 0 deletions coupler/L4.C1.coupled_RS2012_ring/coupledCode/Allmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

make distclean

ln -s ../build/*.mod .
ln -s ../build/mmout/*.a .
ln -s ../build/setrlstk.o .
ln -s ../build/sigreg.o .

ln -s $WRF_DIR/main/wrf_ESMFMod.o .
ln -s $WRF_DIR/main/module_wrf_top.o .
ln -s $WRF_DIR/main/libwrflib.a .

ln -sf $WW3_DIR/model/mod/ww3_esmf.mod .
ln -sf $WW3_DIR/model/ftn/ww3_esmf.ftn .

make
67 changes: 67 additions & 0 deletions coupler/L4.C1.coupled_RS2012_ring/coupledCode/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# GNU Makefile template for user ESMF application

################################################################################
################################################################################
## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ##
## 'include' line below. Following the ESMF User's Guide, a complete ESMF ##
## installation should ensure that a single environment variable "ESMFMKFILE" ##
## is made available on the system. This variable should point to the ##
## "esmf.mk" file. ##
## ##
## This example Makefile uses the "ESMFMKFILE" environment variable. ##
## ##
## If you notice that this Makefile cannot find variable ESMFMKFILE then ##
## please contact the person responsible for the ESMF installation on your ##
## system. ##
## As a work-around you can simply hardcode the path to "esmf.mk" in the ##
## include line below. However, doing so will render this Makefile a lot less ##
## flexible and non-portable. ##
################################################################################

ifneq ($(origin ESMFMKFILE), environment)
$(error Environment variable ESMFMKFILE was not set.)
endif

include $(ESMFMKFILE)
include ./wrflib.mk
include ./ww3lib.mk

################################################################################
################################################################################

.SUFFIXES: .f90 .F90 .c .C

%.o : %.f90
$(ESMF_F90COMPILER) -byteswapio -r8 -Mnodclchk -Mextend -fast -fastsse -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(WRF_INC) $(WW3_INC) $(ESMF_F90COMPILEFREENOCPP) $< -I${PWD} -L${PWD} ${WW3_MOD} $(WRF_LIB) -lmitgcm_org_ocn -lmitgcmrtl

%.o : %.F90
$(ESMF_F90COMPILER) -byteswapio -r8 -Mnodclchk -Mextend -fast -fastsse -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(WRF_INC) $(WW3_INC) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< -I${PWD} -L${PWD} ${WW3_MOD} $(WRF_LIB) -lmitgcm_org_ocn -lmitgcmrtl

% : %.c
$(ESMF_CXXCOMPILER) -byteswapio -r8 -Mnodclchk -Mextend -fast -fastsse -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $<

% : %.C
$(ESMF_CXXCOMPILER) -byteswapio -r8 -Mnodclchk -Mextend -fast -fastsse -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $<



# -----------------------------------------------------------------------------
esmf_application: mod_config.o mod_types.o mod_esmf_ocn.o mod_esmf_atm.o mod_esmf_wav.o mod_esmf_cpl.o mod_esmf_esm.o mitgcm_wrf.o libmitgcm_org_ocn.a libmitgcmrtl.a
$(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) $(WW3_INC) $(WRF_INC) -L${PWD} -o $@ $^ $(ESMF_F90ESMFLINKLIBS) $(WW3_LIB) $(WRF_LIB) setrlstk.o sigreg.o -lmitgcm_org_ocn -lmitgcmrtl

# module dependencies:
mod_esmf_esm.o: mod_esmf_ocn.o mod_esmf_atm.o mod_esmf_wav.o mod_types.o
mod_esmf_cpl.o:
mod_esmf_ocn.o: mod_types.o
mod_esmf_atm.o: mod_types.o
mod_esmf_wav.o: mod_types.o
mod_config.o: mod_types.o
mod_types.o:

# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
.PHONY: clean distclean
clean:
rm -f esmf_application *.o
distclean: clean
rm -f PET*.ESMF_LogFile mod*.mod *.a mit*.mod ww3_esmf*
141 changes: 141 additions & 0 deletions coupler/L4.C1.coupled_RS2012_ring/coupledCode/mitgcm_wrf.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
! Earth System Modeling Framework
! Copyright 2002-2017, University Corporation for Atmospheric Research,
! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
! Laboratory, University of Michigan, National Centers for Environmental
! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
! NASA Goddard Space Flight Center.
! Licensed under the University of Illinois-NCSA License.
#define FILENAME "mitgcm_wrf.F90"
!
!-----------------------------------------------------------------------
! Main function
!-----------------------------------------------------------------------
!
program esmf_application

! modules
use ESMF
use NUOPC
use mod_esmf_esm, only : ESM_SetServices
use mod_config, only : read_config
! use mod_config, only : set_field_dir

implicit none

! local variables
integer :: rc, urc
type(ESMF_GridComp) :: esmComp
type(ESMF_VM) :: vm
!
!-----------------------------------------------------------------------
! Initialize ESMF framework
!-----------------------------------------------------------------------
!
call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, &
defaultCalkind=ESMF_CALKIND_GREGORIAN, &
vm=vm, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
!
!-----------------------------------------------------------------------
! Create component
!-----------------------------------------------------------------------
!
esmComp = ESMF_GridCompCreate(name="NEW_GRID", rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
!
!-----------------------------------------------------------------------
! Read main configuration file
!-----------------------------------------------------------------------
!
call read_config(vm, rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
!
!-----------------------------------------------------------------------
! Add additional fields to NUOPC field dictionary
!-----------------------------------------------------------------------
!
!! call set_field_dir(vm, rc)
!! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
!! line=__LINE__, file=__FILE__)) &
!! call ESMF_Finalize(endflag=ESMF_END_ABORT)
!
!-----------------------------------------------------------------------
! Register component
!-----------------------------------------------------------------------
!
call ESMF_GridCompSetServices(esmComp, ESM_SetServices, &
userRc=urc, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
!
!-----------------------------------------------------------------------
! Wait for finishing initialize phase
!-----------------------------------------------------------------------
!
!! call ESMF_VMBarrier(vm, rc=rc)
!! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
!! line=__LINE__, file=__FILE__)) &
!! call ESMF_Finalize(endflag=ESMF_END_ABORT)
!
!-----------------------------------------------------------------------
! Initialize component
!-----------------------------------------------------------------------
!
call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
!
!-----------------------------------------------------------------------
! Run component
!-----------------------------------------------------------------------
!
call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
!
!-----------------------------------------------------------------------
! Finalize component
!-----------------------------------------------------------------------
!
call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
!
!-----------------------------------------------------------------------
! Destroy the earth system Component
!-----------------------------------------------------------------------
!
call ESMF_GridCompDestroy(esmComp, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
!
!-----------------------------------------------------------------------
! Finalize ESMF framework
!-----------------------------------------------------------------------
!
call ESMF_Finalize(rc=rc)

end program esmf_application
Loading

0 comments on commit a8c6b33

Please sign in to comment.