This is a technical note on how to build and execute FVCOM 4.3 in series mode using Intel compilers on CHESS lab HPC at Hiroshima University. Suppose the source code exists in fvcom43/FVCOM_source
, and fvcom43/Examples/River plume
is a selected test case.
Check line feed of source files
Some line feed in the source files was CRLF
(this is for Windows while LF for Linux). Check them using the file
command and convert them to LF
using dos2unix
.
$ file *.F
If displayed as ASCII text
with CRLF line terminators, convert the file using dos2unix
command
$ dos2unix *.F
Preparing libraries
Before compiling FVCOM, you need to prepare the necessary libraries in ./FVCOM_source/libs
. netCDF should be installed separately (see here). In ./FVCOM_source
, copy make.inc_example
to make.inc
and edit it.$ cp make.inc_example make.inc
First, set TOPDIR
as follows:
TOPDIR = /home2/hslee/FVCOM/fvcom43/FVCOM_source
Next, set the path of the libraries. Comment out its part of MEDM ENVIRONMENT and set LOCAL INSTALL as follows. Also, activate DTLIBS and DTINCS.
####################### MEDM ENVIRONMENT ################################# # Use the environmental variables, LIBPATH and INCLUDEPATH, set by MODULE # to find the packages used by this build. # colon =: # empty = # dashI = $(empty) - I # dashL = $(empty) - L # ### UNCOMMENT HERE! # LIBDIR = -L (subst(subst(colon), (dashL),(dashL),(LIBPATH)) # INCDIR = -I (subst(subst(colon), (dashI),(dashI),(INCLUDEPATH))
###########################################################################
# LOCAL INSTAL LIBDIR = -L$(INSTALLDIR)/lib INCDIR = -I$(INSTALLDIR)/include # ------------------------------------------------------------------------ # STANDARD LIBRARIES FOR DATA AND TIME IN fVCOM: # DTLIBS = -ljulian DTINCS = # DTLIBS = -L/${TOPDIR}/libs # DTINCS =
Next, set the environment variable for Intel compilers in series. Optimization is to stay at -O3 at this moment.
# ----------------------------------------------------------------------- # Intel Compiler Definitions for Series # ------------------------------------------------------------------------ CPP = /usr/bin/cpp COMPILER = -DIFORT FC = ifort CC = icc CXX = icpc CFLAGS = -O3 DEBFLGS = # -check all OPT = -O3
Next, move to ./FVCOM_source/libs
, and open and edit makefile
:
PACKAGES = proj fproj julian
Delete metis
and netcdf
. Similarly, comment out the parts associated with metis
and netcdf
below. metis
should be installed when executing in MPI
. Then execute make
:
$ make
./install
These libraries should have been installed in directories below ./install
.
Edit make.inc
Return to ./FVCOM_source
directory, open make.inc
, confirm the Intel compiler environment parameters are defined and the full path to FVCOM_source
is set at TOPDIR
. In addition, set the environmental parameters for netcdf
:
### netcdf (CHESS lab HPC) IOLIBS = -L/usr/local/netcdf-3.6.3_intel/lib -lnetcdf IOINCS = -I/usr/local/netcdf-3.6.3_intel/include
Next, FLAG
should be edited according to the simulation condition. Here, as an example of Examples/River plume
, FLAGs
to be activated are shown below:
FLAG_1 = -DDOUBLE_PRECISION
FLAG_3 = -DWET_DRY
FLAG_8 = -DLIMITED_NO
FLAG_10 = -DGCN
FLAG_14 = -DRIVER_FLOAT
Correct typo in makefile
The module of mod_esmf_nesting.F
is not in use
anywhere, and thus it seems that it is not used. To avoid linking error, delete mod_esmf_nesting.F
in makefile
.
Edit the makedepends
Remove the line for mod_esmf_nesting.F
in the makedepends
file.
Or, you can recreate the makedepends
file as below. But it takes a long time in a case.
Recreate makedepends
The file of makedepends
needs to be recreated using makedepf90
(unless installed, see here) in the directory of ./FVCOM_source
as follows:
$ rm makedepneds
$ touch makedepends
$ make depend
Minor correction of a source file (for FVCOM4.1)
To avoid Warning
at compile time, delete the comment below at line 131 in wreal.F
.
# endif !! ice_embedding yding
In FVCOM4.3, the line 131 is modified already so that it does not need to edit in wreal.F
.
Build FVCOM4.3
Now you can build FVCOM4.3
in ./FVCOM_source
:
$ make
Successful if the executable file of fvcom
is created.
Interactive execution of test case River Plume
Run a basic test case of River Plume
interactively. The file of chn_run.nml
of River plume
has a bug. Move to ../Examples/River Plume/run
and open chn_run.nml
with an editor and change the number of rivers to 0
(the original was 3).
& NML_RIVER_TYPE RIVER_NUMBER = 1,
Add the NML_NETCDF_SURFACE section in the chn_run.nml
.
&NML_NETCDF_SURFACE NCSF_ON = F, NCSF_FIRST_OUT = 'seconds=0.0' , NCSF_OUT_INTERVAL = 'second=3600.' , NCSF_OUTPUT_STACK = 0, NCSF_SUBDOMAIN_FILES = FVCOM, NCSF_GRID_METRICS = F, NCSF_FILE_DATE = F, NCSF_VELOCITY = F, NCSF_SALT_TEMP = F, NCSF_TURBULENCE = F, NCSF_WIND_VEL = F, NCSF_WIND_STRESS = F, NCSF_EVAP_PRECIP = F, NCSF_SURFACE_HEAT = F /
Copy the executable file of fvcom
created in ./fvcom43/FVCOM_source/
to the current directory (./fvcom43/Examples/River plume/run
(or set up the link)) and execute:
$ ./fvcom --casename=chn
Progress of computation is displayed on the screen, and when completed, TADA!
should be displayed at the end. Also, chn_0001.nc
containing the calculation result should have been created.