Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

runoff_to_ocn

cyoo@ewha_ac_kr

New Member
Dear CESM developers: Is there a guideline for how to compile runoff_to_ocn under cesm1_1_1/mapping/gen_mapping_files? The default set up is done for bluefire. I was wondering if I could use some helps. Any comments would be very much appreciated.
 

mlevy

Michael Levy
CSEG and Liaisons
Staff member
Hi there,Before you can build, you need to do two things:
  1. Define a
    Code:
    Macros
    file in the
    Code:
    gen_mapping_files/runoff_to_ocn/src/
    directory (see example below). The easiest way is to run
    Code:
    $CCSMROOT/scripts/ccsm_utils/Machines /configure -mach [machine name]
    and then make a few changes
    1. Change the variables
      Code:
      SCC
      ,
      Code:
      SCXX
      , and
      Code:
      SFC
      to
      Code:
      CC
      ,
      Code:
      CXX
      , and
      Code:
      FC
      , respectively
    2. Add the variables
      Code:
      CPP:= [your preprocessor... for intel, use fpp]
      and
      Code:
      CPPFLAGS:= [preprocessor flags... for intel, use -p]
    3. Add
      Code:
      -c
      argument to variables
      Code:
      CFLAGS
      and
      Code:
      FFLAGS
    4. Add the lines
      Code:
      INCLDIR := -I$(NETCDF_PATH)/include


      Code:
      SLIBS := -L$(NETCDF_PATH)/lib -lnetcdf -lblas -llapack<br />
      to the bottom of the file (anywhere after where
      Code:
      $NETCDF_PATH
      is defined)
  2. Make a file similar to
    Code:
    runoff_to_ocn/build.bluefire.csh
    that uses your new
    Code:
    Macros
    file instead of Macros.bluefire in line 23 (the gmake line)
Here is the text of the Macros file used on yellowstone in the upcoming CESM 1.2. Note that
Code:
$(NETCDF)
is already an environment variable so we skip setting
Code:
$(NETCDF_PATH)
:
Code:
CC := mpicc
#CPP := /usr/bin/cpp
CPP := fpp
CPPFLAGS := -P
CPPDEFS :=  -DLINUX
CFLAGS:= -c -O2
FIXEDFLAGS:= -132 
FREEFLAGS:= -FR 
FC := ifort
FFLAGS := -c -O2 -assume byterecl -ftz -traceback
MOD_SUFFIX := mod
LD := $(FC)
AR := ar
INCLDIR := -I. -I$(NETCDF)/include
SLIBS := -L$(NETCDF)/lib -lnetcdf -L/glade/apps/opt/lib
ULIBS :=

ifeq ($(THREAD), TRUE) 
   LDFLAGS += -openmp 
   CFLAGS += -openmp 
   FFLAGS += -openmp 
endif

ifeq ($(DEBUG), TRUE) 
   CPPDEFS  += -DNO_SHR_VMATH
   FFLAGS += -g -CU -check pointers -fpe0 -ftz 
else
   # SLIBS    += -lmass -lmassv -llapack -lblas
   SLIBS    += -llapack -lblas
endif


edit (May 15, 2013): I forgot to add the -llapack and -lblas to SLIB in my example above. You may also need -L$(PATH_TO_BLAS) and -L$(PATH_TO_LAPACK)
 

cyoo@ewha_ac_kr

New Member
Dear mlevy,I appreciate your guidance, but I am still having trouble compiling the code. It appears the code has some errors, if I am not doing something wrong. Here are the errors that I have encountered.1) map_mod.f90(2736): error #6222: This IMPLICIT statement is not positioned correctly within the scoping unit.   implicit none---> This was remedied by moving the "implicit none" to a proper position.2) mapsort_mod.f90(352): error #6633: The type of the actual argument differs from the type of the dummy argument.      call mapsort_qsortRC(map%s(n:m),map%row(n:m),map%col(n:m))----------------------------^mapsort_mod.f90(566): error #6633: The type of the actual argument differs from the type of the dummy argument.            call mapsort_QsortC(map%s(n:m),map%row(n:m),map%col(n:m))---------------------------------^mapsort_mod.f90(1012): error #6795: The target must be of the same type and kind type parameters as the pointer.      S   => map%s---> I do not know how to fix this error. I'd appreciate your input again.
 

mlevy

Michael Levy
CSEG and Liaisons
Staff member
Hi cyoo, The version of the runoff_to_ocn executable distributed with CESM 1.1 and CESM 1.1.1 was tailored to a specific computer, and a lot of shortcuts were taken with regards to compiler flags and such. The version that will be released with CESM 1.2 is much more flexible - I've made it available on the web at http://www.cesm.ucar.edu/models/cesm1.1/mapping/known_problem_fixes/runoff_to_ocn.tar.gz
If you download the above tarball and replace the entire runoff_to_ocn/ directory with the version above, I believe the steps listed in my previous response will be sufficient for you. I tested this version on a machine here, and the only difference I found was that I needed to add "-lnetcdff" to the SLIBS as well:
SLIBS:= -L$(NETCDF_PATH)/lib -lnetcdf -lnetcdff
 
Top