Skip to content

Commit 532c707

Browse files
jvdp1Vandenplas, Jeremiemilancurcic
authored
Fixed bugs + some other improvements (#49)
* Addition of .gitignore * Changed integer constants to real constants to satisfy API in loop.f90 * Addition of CPP directives for enabling MPI * Set restartwritefreq to 1 to avoid trigggering a IEEE FP issue (division by 0) * Improved README.md in the directory expt * Update formatting, wording, etc. * Make source files non-executable * Clean up arch files and Makefile; remove unused stuff --------- Co-authored-by: Vandenplas, Jeremie <jeremie.vandenplas@wur.nl> Co-authored-by: milancurcic <caomaco@gmail.com>
1 parent b690f22 commit 532c707

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+123
-88
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.o
2+
*.mod

cms-master/arch/gfortran_compiler

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
# Makefile
1+
# GNU arch file
2+
# Include and link paths are default for Ubuntu.
3+
# Edit if they're installed somewhere else on your system.
24

35
#the Fortran compiler to create object files
46
FC = gfortran
57
#the Fortran flags to create object files
6-
FCFLAGS = -I/usr/local/Cellar/netcdf/4.6.1_4/include -I/usr/local/opt/netcdf/include -I/usr/local/include
8+
FCFLAGS = -I/usr/include -cpp
79
#the C-compiler to create object files
810
CC = gcc
911
#the C flags to create object files
1012
CCFLAGS = -O
11-
1213
#the Fortran compiler to create executable
1314
LD = $(FC)
1415
#the Fortran flags to create executable
15-
LDFLAGS = -L/usr/local/Cellar/netcdf/4.6.1_4/lib -L/usr/local/opt/netcdf/lib -L/usr/local/lib -lnetcdf -lnetcdff -lcurl -lm
16-
EXTRALIBS = -L/usr/local/Cellar/netcdf/4.6.1_4/lib -lnetcdf -lhdf5_hl -lhdf5 -lsz -lz -ldl -lm -lcurl
16+
LDFLAGS = -L/usr/lib/x86_64-linux-gnu -lnetcdf -lnetcdff -lcurl -lm
1717

1818
# Rules
19-
2019
.c.o:
2120
$(CC) -c $*.c $(CCFLAGS)
2221

@@ -25,5 +24,3 @@ EXTRALIBS = -L/usr/local/Cellar/netcdf/4.6.1_4/lib -lnetcdf -lhdf5_hl -lhdf5
2524

2625
.f.o:
2726
$(FC) -c $*.f $(FCFLAGS)
28-
29-

cms-master/arch/mpi_compiler

100755100644
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
# Makefile
1+
# MPI arch file
2+
# Include and link paths are default for GNU compiled NetCDF on Ubuntu.
3+
# Edit if they are different on your system.
24

35
#the Fortran compiler to create object files
46
FC = mpif90
57
#the Fortran flags to create object files
6-
FCFLAGS = -I/usr/local/netcdf/include -I/usr/local/include
8+
FCFLAGS = -I/usr/include -cpp -D_MPI
79
#the C-compiler to create object files
810
CC = gcc
911
#the C flags to create object files
1012
CCFLAGS = -O
11-
1213
#the Fortran compiler to create executable
1314
LD = $(FC)
1415
#the Fortran flags to create executable
15-
LDFLAGS = -L/usr/local/netcdf/lib -L/usr/local/lib -lnetcdf -lnetcdff -lcurl -lm
16-
EXTRALIBS =
16+
LDFLAGS = -L/usr/lib/x86_64-linux-gnu -lnetcdf -lnetcdff -lcurl -lm
1717

1818
# Rules
19-
2019
.c.o:
2120
$(CC) -c $*.c $(CCFLAGS)
2221

@@ -25,5 +24,3 @@ EXTRALIBS =
2524

2625
.f.o:
2726
$(FC) -c $*.f $(FCFLAGS)
28-
29-

cms-master/expt/README.md

Lines changed: 98 additions & 0 deletions

cms-master/expt/input_example/runconf.list

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ loopfilesendday = 0
3939
!Options for saving restart files and restarting
4040
writerestart = .false.
4141
restartfromfile = .false.
42-
restartwritefreq = 0 !in seconds
42+
restartwritefreq = 1 !in seconds
4343
!====================================================================!
4444
!Options for mixed layer physics
4545
mixedlayerphysics = .false.

cms-master/expt/readme

Lines changed: 0 additions & 66 deletions
This file was deleted.

cms-master/src/Makefile

100755100644
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
#
1+
# CMS Makefile
2+
# Please edit the include line to point to the correct arch file
23

3-
include ../arch/mpi_compiler
4+
include ../arch/gfortran_compiler
45

56
.SUFFIXES:
67
.SUFFIXES: .cpp .c .F .f .o .f90
@@ -31,10 +32,10 @@ MODS_larva = $(MODS) mod_buoyancy_larva.o mod_mort_larva.o
3132
OBJS_larva = $(OBJS)
3233

3334
cms : $(MODS_larva) $(OBJS_larva)
34-
$(LD) $(MODS_larva) $(OBJS_larva) $(LDFLAGS) -o cms $(EXTRALIBS)
35+
$(LD) $(MODS_larva) $(OBJS_larva) $(LDFLAGS) -o cms
3536

3637
getdata : $(MODS_getdata) $(OBJS_getdata)
37-
$(LD) $(MODS_getdata) $(OBJS_getdata) $(LDFLAGS) -o getdata $(EXTRALIBS)
38+
$(LD) $(MODS_getdata) $(OBJS_getdata) $(LDFLAGS) -o getdata
3839

3940
cms.o: cms.f90
4041
getdata.o: getdata.f90

cms-master/src/cms.f90

100755100644
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424

2525
PROGRAM CMS
2626

27+
#ifdef _MPI
2728
USE MPI !remove if not using mpi
29+
#endif
2830
USE globalvariables
2931
USE mod_random
3032

@@ -39,12 +41,14 @@ PROGRAM CMS
3941
my_id = 0 !used if not using mpi
4042
npes = 1 !used if not using mpi
4143

44+
#ifdef _MPI
4245
!initialise MPI
4346
CALL MPI_INIT(ierr) !remove if not using mpi
4447
!what processor am I (what is my rank)?
4548
CALL MPI_COMM_RANK(MPI_COMM_WORLD, my_id, ierr) !remove if not using mpi
4649
!how many processors are there?
4750
CALL MPI_COMM_SIZE(MPI_COMM_WORLD, npes, ierr) !remove if not using mpi
51+
#endif
4852

4953
!check which experiment to run
5054
IF (command_argument_count() .eq. 0) THEN
@@ -90,7 +94,9 @@ PROGRAM CMS
9094
!finish up
9195
CALL dealloc_all
9296

97+
#ifdef _MPI
9398
!quit MPI
9499
CALL MPI_FINALIZE(ierr) !remove if not using mpi
100+
#endif
95101

96-
END PROGRAM CMS
102+
END PROGRAM CMS

cms-master/src/dealloc.f90

100755100644
File mode changed.

cms-master/src/def_constants.f90

100755100644
File mode changed.

cms-master/src/def_globalvariables.f90

100755100644
File mode changed.

cms-master/src/def_nests.f90

100755100644
File mode changed.

cms-master/src/def_particle.f90

100755100644
File mode changed.

cms-master/src/findnest.f90

100755100644
File mode changed.

cms-master/src/fldinterp.f90

100755100644
File mode changed.

cms-master/src/getdata.f90

100755100644
File mode changed.

cms-master/src/getfilename.f90

100755100644
File mode changed.

cms-master/src/getnestinfo.f90

100755100644
File mode changed.

cms-master/src/getphysicaldata.f90

100755100644
File mode changed.

cms-master/src/input.f90

100755100644
File mode changed.

cms-master/src/lonlat2ij.f90

100755100644
File mode changed.

cms-master/src/loop.f90

100755100644
File mode changed.

cms-master/src/mod_buoyancy_larva.f90

100755100644
File mode changed.

cms-master/src/mod_calendar.f90

100755100644
File mode changed.

cms-master/src/mod_diffpart.f90

100755100644
File mode changed.

cms-master/src/mod_directory.c

100755100644
File mode changed.

cms-master/src/mod_directory.h

100755100644
File mode changed.

cms-master/src/mod_getdata.f90

100755100644
File mode changed.

cms-master/src/mod_ibio.f90

100755100644
File mode changed.

cms-master/src/mod_iounits.f90

100755100644
File mode changed.

cms-master/src/mod_kinds.f90

100755100644
File mode changed.

cms-master/src/mod_mixedlayerphysics.f90

100755100644
File mode changed.

cms-master/src/mod_mort_larva.f90

100755100644
File mode changed.

cms-master/src/mod_nciorw.f90

100755100644
File mode changed.

cms-master/src/mod_netcdf.f90

100755100644
File mode changed.

cms-master/src/mod_netcdfoutput.f90

100755100644
File mode changed.

cms-master/src/mod_random.f90

100755100644
File mode changed.

cms-master/src/mod_reef.f90

100755100644
File mode changed.

cms-master/src/mod_strata.f90

100755100644
File mode changed.

cms-master/src/mod_turb.f90

100755100644
File mode changed.

cms-master/src/move.f90

100755100644
File mode changed.

cms-master/src/output.f90

100755100644
File mode changed.

cms-master/src/restart.f90

100755100644
File mode changed.

cms-master/src/rungekutta.f90

100755100644
File mode changed.

cms-master/src/updateloc.f90

100755100644
File mode changed.

cms-master/src/util.f90

100755100644
File mode changed.

0 commit comments

Comments
 (0)