Skip to content

Commit

Permalink
BFM integration
Browse files Browse the repository at this point in the history
  • Loading branch information
georgu committed Apr 15, 2020
1 parent 5d9bb2f commit a9b3a61
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 39 deletions.
15 changes: 15 additions & 0 deletions COMMIT
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
============================================================

Wed Apr 15 16:54:16 CEST 2020

BFM integration

Makefile | 18 +++++++-
Rules.make | 1 +
fem3d/Makefile | 10 +++--
femcheck/netcdf/Makefile | 6 ++-
femcheck/netcdf/set_netcdf.sh | 93 ++++++++++++++++++++++++++++--------------
femcheck/netcdf/test_netcdf.sh | 4 ++
femcheck/rules/Rules.dist | 1 +
7 files changed, 96 insertions(+), 37 deletions(-)

============================================================

Sat Apr 11 14:59:21 CEST 2020

strings, realtime, nudging
Expand Down
18 changes: 17 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ ifeq ($(ECOLOGICAL),ERSEM)
FEMEXTRA += femersem/src
endif

ifeq ($(FORTRAN_COMPILER),INTEL)
CMODULE = intel-openmpi
else
CMODULE = openmpi-x86_64
endif

FEMDIRS = $(FEMLIBS) $(FEMEXTRA) $(FEMGRID) $(FEMMESH) $(FEMPROG) $(FEMUTIL)
FEMNOGRAPH = $(FEMLIBS) $(FEMEXTRA) $(FEMMESH) $(FEMPROG) $(FEMUTIL)

Expand Down Expand Up @@ -127,7 +133,7 @@ para_clean:
@cd $(PARADIR)/src; make clean

bfm_compile:
@fembfm/bfm_compile.sh $(BFMDIR)
@fembfm/bfm_compile.sh $(BFMDIR) $(FORTRAN_COMPILER)

bfm_clean:
@fembfm/bfm_compile.sh -clean $(BFMDIR)
Expand Down Expand Up @@ -340,6 +346,13 @@ help_dev:
@echo "advance_time advances modification time of VERSION"
@echo "make_executable makes scripts executable"

rules:
@echo "rules_save saves actual Rules.make file"
@echo "rules_restore restores last saved Rules.make file"
@echo "rules_dist substitutes Rules.make with Rules.dist file"
@echo "rules_new copies Rules.make file to Rules.dist"
@echo "rules_diff difference between Rules.make and Rules.dist"

test_compile:
@femcheck/test_compile.sh

Expand Down Expand Up @@ -444,6 +457,9 @@ nemoff:
git_nemunas:
. fem3d/bin/nemunas-git.sh

fluxus:
$(info please run: module load $(CMODULE))

#---------------------------------------------------------------
# check if routines are executable
#---------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions Rules.make
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ ECOLOGICAL = NONE
#BFMDIR = /gpfs/work/OGS18_PRACE_P_0/SHYFEM_BFM/bfm
#BFMDIR = /home/georg/appl/donata/bfm/bfmv5
#BFMDIR = /home/georg/appl/donata/bfm/BiogeochemicalFluxModel-5.1.0
#BFMDIR = /home/gumgiesser/bfm/BiogeochemicalFluxModel-5.1.0

##############################################
# Experimental features
Expand Down
2 changes: 2 additions & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
version 7_5_69 06-03-2020 VERS_7_5_69 commit_2020-04-15

version 7_5_69 06-03-2020 VERS_7_5_69 commit_2020-04-11

version 7_5_69 06-03-2020 VERS_7_5_69 commit_2020-04-09
Expand Down
10 changes: 6 additions & 4 deletions fem3d/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ endif
ifeq ($(ECOLOGICAL),BFM)
LIBBFM = bfm
ECOLOGICAL_OBJ = ecological_dummy.o newbfm_internal.o
LIBG_BFM = -L $(BFMDIR)/lib/ -l$(LIBBFM)
LIBG_BFM = -L$(BFMDIR)/lib/ -l$(LIBBFM)
LIBF_BFM = $(BFMDIR)/lib/lib$(LIBBFM).a
INCL_BFM = $(BFMDIR)/include
endif
Expand All @@ -250,9 +250,11 @@ endif
# all libraries
#------------------------------------------------------------

LIBGS = $(LIBLS) $(LIBG_NETCDF) $(LIBG_GOTM) $(LIBG_ERSEM) $(LIBG_MKL) \
$(LIBG_BFM) $(LIBG_PARA)
LIBFS = $(LIBF_NETCDF) $(LIBF_GOTM) $(LIBF_ERSEM) $(LIBF_BFM)
# important: LIBF_BFM must come before LIBF_NETCDF (intel compiler)

LIBGS = $(LIBLS) $(LIBG_GOTM) $(LIBG_ERSEM) $(LIBG_MKL) \
$(LIBG_BFM) $(LIBG_PARA) $(LIBG_NETCDF)
LIBFS = $(LIBF_GOTM) $(LIBF_ERSEM) $(LIBF_BFM) $(LIBF_NETCDF)
INCLUDE = $(INCL_NETCDF) $(INCL_BFM)

#------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions fem3d/subver.f
Original file line number Diff line number Diff line change
Expand Up @@ -380,14 +380,14 @@ module shyfem_version
c
c \newcommand{\VERSION}{7.5.69}
c \newcommand{\version}{7\_5\_69}
c \newcommand{\COMMIT}{2020-04-11}
c \newcommand{\COMMIT}{2020-04-15}
c
c DOCS END

implicit none

character*10, parameter :: version = '7.5.69'
character*10, parameter :: commit = '2020-04-11'
character*10, parameter :: commit = '2020-04-15'
character*17, parameter :: text = 'SHYFEM VERSION = '

character*40, parameter :: string = text//version//' '//commit
Expand Down
6 changes: 5 additions & 1 deletion femcheck/netcdf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,17 @@ FFLAGS = $(DIRINC_NETCDF)

EXES = nc_include nc_mod

#--------------------------------------------------

default: $(EXES)

test: test_netcdf
test_netcdf:
./test_netcdf.sh

nc_include: nc_include.o
$(F77) $(LIBG_NETCDF) -o $@ $@.o
#$(F77) $(LIBG_NETCDF) -o $@ $@.o
$(F77) $@.o $(LIBG_NETCDF) -o $@

nc_mod: nc_mod.o
$(F77) $(LIBG_NETCDF) -o $@ $@.o
Expand Down
93 changes: 62 additions & 31 deletions femcheck/netcdf/set_netcdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
debug="YES"
debug="NO"

what=$1 #can be lib or include
what=$1 #can be lib or include or file name
compiler=$2
usrdir=$3

Expand All @@ -23,14 +23,25 @@ usrdir=$3
SetupDirs()
{
dirs="/usr /opt/sw/netcdf /usr/local/netcdf /usr/local"
dirs_intel="/usr/local/intel"
dirs_gfortran="/usr/lib64 /usr/lib64/gfortran/modules \
/usr/lib/x86_64-linux-gnu"

if [ $compiler = "INTEL" ]; then
dirs="$usrdir /usr/local/intel $dirs"
dirs="$usrdir $dirs_intel $dirs"
else
dirs="$usrdir $dirs"
dirs="$usrdir $dirs_gfortran $dirs"
fi
}

TestFile()
{
nc_out=$1
[ $debug = "YES" ] && echo "checking $nc_out/$2"
[ -f $nc_out/$2 ] && return 0
return 1
}

LookUp()
{
pre=$1
Expand All @@ -40,18 +51,10 @@ LookUp()

for dir in $dirs
do
if [ -f $dir/$pre/$file ]; then
nc_out=$dir/$pre
return 0
fi
[ -n "$pre" ] && TestFile $dir/$pre $file && return 0
TestFile $dir $file && return 0
done

dir=/usr/lib/x86_64-linux-gnu
if [ -f $dir/$file ]; then
nc_out=$dir
return 0
fi

return 1
}

Expand All @@ -65,39 +68,64 @@ SetIncDir()
SetDir include $1
}

SetFileDir()
{
pre=""
[[ $1 == *.mod ]] && pre=include
[[ $1 == *.inc ]] && pre=include
[[ $1 == *.a ]] && pre=lib
[[ $1 == *.so ]] && pre=lib

if [ -z "$pre" ]; then
if [[ $1 == lib* ]]; then
SetLibDir $1
else
echo "*** unknown file type $1 ...aborting" >> /dev/stderr
exit 7
fi
else
SetDir $pre $1
fi
}

SetDir()
{
pre=$1
lib=$2
search=$2
shift 2

file=$lib
if [ $# -gt 0 ]; then
file=$lib.$1
shift
fi
files=$search
for ext
do
files="$files $search.$ext"
done
[ $debug = "YES" ] && echo "looking for $files"

LookUp $pre $file
if [ $? -ne 0 ]; then
file=$lib.$1
LookUp $pre $file
if [ $? -ne 0 ]; then
echo "*** cannot find directory for $lib... aborting" >> /dev/stderr
exit 1
fi
for file in $files
do
LookUp "$pre" $file
status=$?
[ $status -eq 0 ] && break
done

if [ $status -ne 0 ]; then
echo "*** cannot find directory for $lib ...aborting" >> /dev/stderr
exit 1
fi

if [ $debug = "YES" ]; then
echo "directory found for $file: $nc_out" >> /dev/stderr
fi

if [ $pre = "lib" ]; then
if [ "$pre" = "lib" ]; then
#name=$( echo $file | sed -e 's/^lib//' )
name=$( echo $lib | sed -e 's/^lib//' )
name=$( echo $search | sed -e 's/^lib//' )
nc_libdir="$nc_libdir -L$nc_out"
nc_libs="$nc_libs -l$name"
else
elif [ "$pre" = "include" ]; then
nc_inc="$nc_inc -I$nc_out"
else
nc_inc="$nc_out"
fi
}

Expand All @@ -116,11 +144,14 @@ if [ $what = "lib" ]; then
nc_libdir=$( Unique $nc_libdir )
nc_libds=$( Unique $nc_libs )
echo "$nc_libdir $nc_libs"
else
elif [ $what = "include" ]; then
SetIncDir netcdf.inc
SetIncDir netcdf.mod
nc_inc=$( Unique $nc_inc )
echo "$nc_inc"
else
SetFileDir $what
echo "$nc_out"
fi

#echo "$nc_libdir" | xargs -n1 | sort -u | xargs
Expand Down
4 changes: 4 additions & 0 deletions femcheck/netcdf/test_netcdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ Compile_intel()

file=nc_include.f
echo " compiling $file"
echo " FLAGS: $FLAGS"
#$f77 $FLAGS $file
$f77 $file $FLAGS
[ $? -eq 0 ] || exit 1

file=nc_mod.f
echo " compiling $file"
echo " FLAGS: $FLAGS"
$f77 $FLAGS $file
[ $? -eq 0 ] || exit 1
}
Expand All @@ -50,11 +52,13 @@ Compile_gfortran()

file=nc_include.f
echo " compiling $file"
echo " FLAGS: $FLAGS"
$f77 $FLAGS $file
[ $? -eq 0 ] || exit 1

file=nc_mod.f
echo " compiling $file"
echo " FLAGS: $FLAGS"
$f77 $FLAGS $file
[ $? -eq 0 ] || exit 1
}
Expand Down
1 change: 1 addition & 0 deletions femcheck/rules/Rules.dist
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ ECOLOGICAL = NONE
#BFMDIR = /gpfs/work/OGS18_PRACE_P_0/SHYFEM_BFM/bfm
#BFMDIR = /home/georg/appl/donata/bfm/bfmv5
#BFMDIR = /home/georg/appl/donata/bfm/BiogeochemicalFluxModel-5.1.0
#BFMDIR = /home/gumgiesser/bfm/BiogeochemicalFluxModel-5.1.0

##############################################
# Experimental features
Expand Down

0 comments on commit a9b3a61

Please sign in to comment.