{"id":2687,"date":"2019-11-21T19:59:53","date_gmt":"2019-11-21T10:59:53","guid":{"rendered":"http:\/\/home.hiroshima-u.ac.jp\/~leehs\/?p=2687"},"modified":"2019-11-22T18:55:11","modified_gmt":"2019-11-22T09:55:11","slug":"how-to-compile-fvcom4-3-series-mode","status":"publish","type":"post","link":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/?p=2687","title":{"rendered":"How to compile FVCOM4.3 (Series mode)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"> 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\u00a0<code>fvcom43\/FVCOM_source<\/code>, and\u00a0<code>fvcom43\/Examples\/River plume<\/code>\u00a0is a selected test case. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Check line feed of source files<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Some line feed in the source files was&nbsp;<code>CRLF<\/code>&nbsp;(this is for Windows while LF for Linux). Check them using the&nbsp;<code>file<\/code>&nbsp;command and convert them to&nbsp;<code>LF<\/code>&nbsp;using&nbsp;<code>dos2unix<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$<em>&nbsp;<\/em>file&nbsp;*.F<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If displayed as&nbsp;<code>ASCII text<\/code> with  CRLF line terminators, convert the file using &nbsp;<code>dos2unix<\/code> command <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ dos2unix *.F <\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Preparing libraries<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Before compiling FVCOM, you need to prepare the necessary libraries in&nbsp;<code>.\/FVCOM_source\/libs<\/code>. netCDF should be installed separately (<a href=\"https:\/\/www.unidata.ucar.edu\/software\/netcdf\/release-notes-3.6.3.html\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">see here<\/a>). In&nbsp;<code>.\/FVCOM_source<\/code>, copy&nbsp;<code>make.inc_example<\/code>&nbsp;to&nbsp;<code>make.inc<\/code>&nbsp;and edit it.<em>$&nbsp;<\/em>cp&nbsp;make.inc_example make.inc<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, set&nbsp;<code>TOPDIR<\/code>&nbsp;as follows:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">TOPDIR = \/home2\/hslee\/FVCOM\/fvcom43\/FVCOM_source<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><em>####################### MEDM ENVIRONMENT #################################<\/em>\n<em># Use the environmental variables, LIBPATH and INCLUDEPATH, set by MODULE<\/em>\n<em># to find the packages used by this build.<\/em>\n<em># colon =:<\/em>\n<em># empty =<\/em>\n<em># dashI = $(empty) - I<\/em>\n<em># dashL = $(empty) - L<\/em>\n<em># ### UNCOMMENT HERE!<\/em>\n<em># LIBDIR = -L&nbsp;(subst(subst(colon),&nbsp;(dashL),(dashL),(LIBPATH))<\/em>\n<em># INCDIR = -I&nbsp;(subst(subst(colon),&nbsp;(dashI),(dashI),(INCLUDEPATH))<\/em><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><em>###########################################################################<\/em><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><em># LOCAL INSTAL<\/em>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LIBDIR = -L$(INSTALLDIR)\/lib\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;INCDIR = -I$(INSTALLDIR)\/include\n<em># ------------------------------------------------------------------------<\/em>\n<em># STANDARD LIBRARIES FOR DATA AND TIME IN fVCOM:<\/em>\n<em>#<\/em>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DTLIBS =&nbsp;-ljulian\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DTINCS =\n<em># &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DTLIBS = -L\/${TOPDIR}\/libs<\/em>\n<em># &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DTINCS =<\/em><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"> Next, set the environment variable for Intel compilers in series. Optimization is to stay at -O3 at this moment. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> <em># -----------------------------------------------------------------------<\/em>\n<em># Intel Compiler Definitions for Series<\/em>\n<em># ------------------------------------------------------------------------<\/em>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CPP &nbsp; &nbsp; &nbsp;=&nbsp;\/usr\/bin\/cpp\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;COMPILER =&nbsp;-DIFORT\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FC &nbsp; &nbsp; &nbsp; = ifort\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CC &nbsp; &nbsp; &nbsp; = icc\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CXX &nbsp; &nbsp; &nbsp;= icpc\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CFLAGS =&nbsp;-O3\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DEBFLGS =&nbsp;<em># -check all<\/em>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OPT =&nbsp;-O3 <\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"> Next, move to&nbsp;<code>.\/FVCOM_source\/libs<\/code>, and open and edit&nbsp;<code>makefile<\/code>: <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PACKAGES = proj fproj julian<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Delete&nbsp;<code>metis<\/code>&nbsp;and&nbsp;<code>netcdf<\/code>. Similarly, comment out the parts associated with&nbsp;<code>metis<\/code>&nbsp;and&nbsp;<code>netcdf<\/code>&nbsp;below.&nbsp;<code>metis<\/code>&nbsp;should be installed when executing in&nbsp;<code>MPI<\/code>. Then execute&nbsp;<code>make<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$<em>&nbsp;<\/em>make<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>.\/install<\/code>&nbsp;These libraries should have been installed in directories below&nbsp;<code>.\/install<\/code>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Edit make.inc<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Return to&nbsp;<code>.\/FVCOM_source<\/code>&nbsp;directory, open&nbsp;<code>make.inc<\/code>, confirm the Intel compiler environment parameters are defined and the full path to&nbsp;<code>FVCOM_source<\/code>&nbsp;is set at&nbsp;<code>TOPDIR<\/code>. In addition, set the environmental parameters for&nbsp;<code>netcdf<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">### netcdf (CHESS lab HPC)\nIOLIBS = -L\/usr\/local\/netcdf-3.6.3_intel\/lib -lnetcdf\nIOINCS = -I\/usr\/local\/netcdf-3.6.3_intel\/include<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Next,\u00a0<code>FLAG<\/code>\u00a0should be edited according to the simulation condition. Here, as an example of\u00a0<code>Examples\/River plume<\/code>,\u00a0<code>FLAGs<\/code>\u00a0to be activated are shown below:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">FLAG_1 = &nbsp;-DDOUBLE_PRECISION<br>FLAG_3 = &nbsp;-DWET_DRY<br>FLAG_8 = &nbsp;-DLIMITED_NO<br>FLAG_10 = -DGCN<br>FLAG_14 = -DRIVER_FLOAT<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Correct typo in makefile<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The module of\u00a0<code>mod_esmf_nesting.F<\/code>\u00a0is not in\u00a0<code>use<\/code>\u00a0anywhere, and thus it seems that it is not used. To avoid linking error, delete\u00a0<code>mod_esmf_nesting.F<\/code>\u00a0in\u00a0<code>makefile<\/code>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Edit the makedepends<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Remove the line for <code>mod_esmf_nesting.F<\/code> in the <code>makedepends<\/code> file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Or, you can recreate the <code>makedepends<\/code> file as below. But it takes a long time in a case.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Recreate makedepends<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The file of&nbsp;<code>makedepends<\/code>&nbsp;needs to be recreated using&nbsp;<code>makedepf90<\/code>&nbsp;(unless installed, see here) in the directory of&nbsp;<code>.\/FVCOM_source<\/code>&nbsp;as follows:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$&nbsp;rm&nbsp;makedepneds<br>$&nbsp;touch&nbsp;makedepends<br>$&nbsp;make&nbsp;depend<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Minor correction of a source file (for FVCOM4.1)<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">To avoid&nbsp;<code>Warning<\/code>&nbsp;at compile time, delete the comment below at line 131 in&nbsp;<code>wreal.F<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><em>#\u00a0<\/em>endif\u00a0!!\u00a0ice_embedding yding<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In FVCOM4.3, the line 131 is modified already so that it does not need to edit in <code>wreal.F<\/code>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Build FVCOM4.3<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Now you can build&nbsp;<code>FVCOM4.3<\/code>&nbsp;in&nbsp;<code>.\/FVCOM_source<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ make<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Successful if the executable file of&nbsp;<code>fvcom<\/code>&nbsp;is created.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Interactive execution of test case River Plume<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Run a basic test case of\u00a0<code>River Plume<\/code>\u00a0interactively. The file of\u00a0<code>chn_run.nml<\/code>\u00a0of\u00a0<code>River plume<\/code>\u00a0has a bug. Move to\u00a0<code>..\/Examples\/River Plume\/run<\/code>\u00a0and open\u00a0<code>chn_run.nml<\/code>\u00a0with an editor and change the number of rivers to\u00a0<code>0<\/code>\u00a0(the original was 3).<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&amp; NML_RIVER_TYPE\nRIVER_NUMBER = 1,<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the NML_NETCDF_SURFACE section in the <code>chn_run.nml<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&amp;NML_NETCDF_SURFACE\n NCSF_ON = F,\n NCSF_FIRST_OUT  = 'seconds=0.0'   ,\n NCSF_OUT_INTERVAL       = 'second=3600.'  ,\n NCSF_OUTPUT_STACK       =           0,\n NCSF_SUBDOMAIN_FILES    = FVCOM,\n NCSF_GRID_METRICS       = F,\n NCSF_FILE_DATE  = F,\n NCSF_VELOCITY   = F,\n NCSF_SALT_TEMP  = F,\n NCSF_TURBULENCE = F,\n NCSF_WIND_VEL   = F,\n NCSF_WIND_STRESS        = F,\n NCSF_EVAP_PRECIP        = F,\n NCSF_SURFACE_HEAT       = F\n \/<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Copy the executable file of\u00a0<code>fvcom<\/code>\u00a0created in\u00a0<code>.\/fvcom43\/FVCOM_source\/<\/code>\u00a0to the current directory (<code>.\/fvcom43\/Examples\/River plume\/run<\/code>\u00a0(or set up the link)) and execute:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$<em>\u00a0<\/em>.\/fvcom\u00a0--casename=chn<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Progress of computation is displayed on the screen, and when completed,\u00a0<code>TADA!<\/code>\u00a0should be displayed at the end. Also,\u00a0<code>chn_0001.nc<\/code>\u00a0containing the calculation result should have been created.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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\u00a0fvcom43\/FVCOM_source, and\u00a0fvcom43\/Examples\/River plume\u00a0is a selected test case. Check line&#8230;<br \/><a class=\"read-more-button\" href=\"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/?p=2687\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-2687","post","type-post","status-publish","format-standard","hentry","category-tool"],"rttpg_featured_image_url":null,"rttpg_author":{"display_name":"hslee","author_link":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/?author=1"},"rttpg_comment":0,"rttpg_category":"<a href=\"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/?cat=12\" rel=\"category\">Tool<\/a>","rttpg_excerpt":"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\u00a0fvcom43\/FVCOM_source, and\u00a0fvcom43\/Examples\/River plume\u00a0is a selected test case. Check line...Read more","_links":{"self":[{"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=\/wp\/v2\/posts\/2687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2687"}],"version-history":[{"count":13,"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=\/wp\/v2\/posts\/2687\/revisions"}],"predecessor-version":[{"id":2717,"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=\/wp\/v2\/posts\/2687\/revisions\/2717"}],"wp:attachment":[{"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}