Skip to content

Commit 7557b47

Browse files
committed
Merge branch 'hotfix-v7.1'
This merge addresses several issues in the MPAS-Atmosphere model and initialization, and it corrects several minor compilation issues. MPAS-Atmosphere: ---------------- * In calculating moist air density in the real-data initialization case, virtual temperature, rather than temperature, should be used. * An out-of-bounds array access in the GWDO scheme when running with multiple OpenMP threads has been corrected. * A check has been added in the init_atmosphere core to ensure that the intermediate file interval and the 'surface' stream output interval are consistent. * A non-standard BOZ-literal constant has been corrected in the module_ra_cam_support.F file. The non-standard constant lead to build failures, particularly with newer versions of the GNU compilers. General software: ----------------- * The logic to add PIO libraries to the definition of LIBS in the top-level Makefile has been updated to accommodate newer versions (approx. 2.5.2 or later) of the PIO library; without the fix to the Makefile, builds would fail with the message Checking for a usable PIO library... ************ ERROR ************ Failed to compile a PIO test program Please ensure the PIO environment variable is set to the PIO installation directory ************ ERROR ************ * Various options for the 'gfortran' build target have been cleaned up. * Occasional parallel build failures related to a race condition in the ezxml library compilation have been addressed.
2 parents 51d5624 + 310e962 commit 7557b47

File tree

16 files changed

+57
-44
lines changed

16 files changed

+57
-44
lines changed

Makefile

+19-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
MODEL_FORMULATION =
1+
MODEL_FORMULATION =
22

33

44
dummy:
@@ -219,14 +219,14 @@ gfortran:
219219
"CC_SERIAL = gcc" \
220220
"CXX_SERIAL = g++" \
221221
"FFLAGS_PROMOTION = -fdefault-real-8 -fdefault-double-8" \
222-
"FFLAGS_OPT = -O3 -m64 -ffree-line-length-none -fconvert=big-endian -ffree-form" \
223-
"CFLAGS_OPT = -O3 -m64" \
224-
"CXXFLAGS_OPT = -O3 -m64" \
225-
"LDFLAGS_OPT = -O3 -m64" \
226-
"FFLAGS_DEBUG = -g -m64 -ffree-line-length-none -fconvert=big-endian -ffree-form -fbounds-check -fbacktrace -ffpe-trap=invalid,zero,overflow" \
227-
"CFLAGS_DEBUG = -g -m64" \
228-
"CXXFLAGS_DEBUG = -O3 -m64" \
229-
"LDFLAGS_DEBUG = -g -m64" \
222+
"FFLAGS_OPT = -O3 -ffree-line-length-none -fconvert=big-endian -ffree-form" \
223+
"CFLAGS_OPT = -O3" \
224+
"CXXFLAGS_OPT = -O3" \
225+
"LDFLAGS_OPT = -O3" \
226+
"FFLAGS_DEBUG = -g -ffree-line-length-none -fconvert=big-endian -ffree-form -fcheck=all -fbacktrace -ffpe-trap=invalid,zero,overflow" \
227+
"CFLAGS_DEBUG = -g" \
228+
"CXXFLAGS_DEBUG = -g" \
229+
"LDFLAGS_DEBUG = -g" \
230230
"FFLAGS_OMP = -fopenmp" \
231231
"CFLAGS_OMP = -fopenmp" \
232232
"CORE = $(CORE)" \
@@ -421,9 +421,9 @@ llvm:
421421
"OPENMP = $(OPENMP)" \
422422
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
423423

424-
CPPINCLUDES =
425-
FCINCLUDES =
426-
LIBS =
424+
CPPINCLUDES =
425+
FCINCLUDES =
426+
LIBS =
427427

428428
#
429429
# If user has indicated a PIO2 library, define USE_PIO2 pre-processor macro
@@ -458,9 +458,15 @@ endif
458458
# Depending on PIO version, libraries may be libpio.a, or libpiof.a and libpioc.a
459459
# Keep open the possibility of shared libraries in future with, e.g., .so suffix
460460
#
461+
# Check if libpio.* exists and link -lpio if so, but we make an exception for
462+
# libpio.settings (a file added in PIO2), which is not a library to link
461463
ifneq ($(wildcard $(PIO_LIB)/libpio\.*), )
462-
LIBS += -lpio
464+
# Makefiles don't support "and" operators so we have nested "if" instead
465+
ifneq "$(wildcard $(PIO_LIB)/libpio\.*)" "$(PIO_LIB)/libpio.settings"
466+
LIBS += -lpio
467+
endif
463468
endif
469+
464470
ifneq ($(wildcard $(PIO_LIB)/libpiof\.*), )
465471
LIBS += -lpiof
466472
endif

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
MPAS-v7.0
1+
MPAS-v7.1
22
====
33

44
The Model for Prediction Across Scales (MPAS) is a collaborative project for

src/core_atmosphere/Registry.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<registry model="mpas" core="atmosphere" core_abbrev="atm" version="7.0">
2+
<registry model="mpas" core="atmosphere" core_abbrev="atm" version="7.1">
33

44
<!-- **************************************************************************************** -->
55
<!-- ************************************** Dimensions ************************************** -->
@@ -1352,10 +1352,10 @@
13521352
description="weights for cell-centered second derivative, normal to edge, for transport scheme"/>
13531353

13541354
<var name="adv_coefs" type="real" dimensions="FIFTEEN nEdges" units="unitless"
1355-
description="Weighting coefficents used for reconstructing cell-based foelds at edges"/>
1355+
description="Weighting coefficients used for reconstructing cell-based fields at edges"/>
13561356

13571357
<var name="adv_coefs_3rd" type="real" dimensions="FIFTEEN nEdges" units="unitless"
1358-
description="Weighting coefficents used for reconstructing cell-based foelds at edges"/>
1358+
description="Weighting coefficients used for reconstructing cell-based fields at edges"/>
13591359

13601360
<var name="advCellsForEdge" type="integer" dimensions="FIFTEEN nEdges" units="-"
13611361
description="Cells used to reconstruct a cell-based field at an edge"/>
@@ -3009,7 +3009,7 @@
30093009
description="terrain height"/>
30103010

30113011
<var name="albedo12m" type="real" dimensions="nMonths nCells" units="unitless"
3012-
description="monthly-mean climatological aurface albedo"/>
3012+
description="monthly-mean climatological surface albedo"/>
30133013

30143014
<var name="greenfrac" type="real" dimensions="nMonths nCells" units="unitless"
30153015
description="monthly-mean climatological greeness fraction"/>

src/core_atmosphere/physics/physics_wrf/module_bl_gwdo.F

+1-1
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ subroutine gwdo2d(dudt, dvdt, dtaux2d, dtauy2d, &
365365
dxy4p(its:ite,3) = dxy4(its:ite,4)
366366
dxy4p(its:ite,4) = dxy4(its:ite,3)
367367
!
368-
cleff(its:ite) = dxmeter
368+
cleff(its:ite) = dxmeter(its:ite)
369369
!
370370
! initialize arrays
371371
!

src/core_atmosphere/physics/physics_wrf/module_ra_cam_support.F

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ MODULE module_ra_cam_support
88
implicit none
99
integer, parameter :: r8 = 8
1010
real(r8), parameter:: inf = 1.e20 ! CAM sets this differently in infnan.F90
11-
integer, parameter:: bigint = O'17777777777' ! largest possible 32-bit integer
11+
integer, parameter:: bigint = int(O'17777777777') ! largest possible 32-bit integer
1212

1313
integer :: ixcldliq
1414
integer :: ixcldice

src/core_init_atmosphere/Registry.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<registry model="mpas" core="init_atmosphere" core_abbrev="init_atm" version="7.0">
2+
<registry model="mpas" core="init_atmosphere" core_abbrev="init_atm" version="7.1">
33

44
<!-- **************************************************************************************** -->
55
<!-- ************************************** Dimensions ************************************** -->

src/core_init_atmosphere/mpas_init_atm_cases.F

+18-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ subroutine init_atm_setup_case(domain, stream_manager)
7474
character(len=StrKIND), pointer :: xtime
7575

7676
type (MPAS_Time_type) :: curr_time, stop_time
77-
type (MPAS_TimeInterval_type) :: clock_interval, lbc_stream_interval
77+
type (MPAS_TimeInterval_type) :: clock_interval, lbc_stream_interval, surface_stream_interval
7878
character(len=StrKIND) :: timeString
7979

8080
integer, pointer :: nCells
@@ -264,6 +264,21 @@ subroutine init_atm_setup_case(domain, stream_manager)
264264
else if (config_init_case == 8 ) then
265265
266266
call mpas_log_write('real-data surface (SST) update test case ')
267+
268+
!
269+
! Check that config_fg_interval matches the output_interval of the surface stream
270+
!
271+
clock_interval = mpas_get_clock_timestep(domain % clock, ierr=ierr)
272+
surface_stream_interval = MPAS_stream_mgr_get_stream_interval(stream_manager, 'surface', MPAS_STREAM_OUTPUT, ierr)
273+
if (clock_interval /= surface_stream_interval) then
274+
call mpas_log_write('****************************************************************', messageType=MPAS_LOG_ERR)
275+
call mpas_log_write('The intermediate SST file interval specified by ''config_fg_interval''', messageType=MPAS_LOG_ERR)
276+
call mpas_log_write('does not match the output_interval for the ''surface'' stream.', messageType=MPAS_LOG_ERR)
277+
call mpas_log_write('Please correct the namelist.init_atmosphere and/or', messageType=MPAS_LOG_ERR)
278+
call mpas_log_write('streams.init_atmosphere files.', messageType=MPAS_LOG_ERR)
279+
call mpas_log_write('****************************************************************', messageType=MPAS_LOG_CRIT)
280+
end if
281+
267282
block_ptr => domain % blocklist
268283
do while (associated(block_ptr))
269284
call mpas_pool_get_subpool(block_ptr % structs, 'mesh', mesh)
@@ -4758,7 +4773,8 @@ subroutine init_atm_case_gfs(block, mesh, nCells, nEdges, nVertLevels, fg, state
47584773
t(k,iCell) = t(k,iCell) * (p0 / pressure(k,iCell)) ** (rgas / cp)
47594774
47604775
! RHO_ZZ
4761-
rho_zz(k,iCell) = pressure(k,iCell) / rgas / (p(k,iCell) * t(k,iCell))
4776+
rho_zz(k,iCell) = pressure(k,iCell) / rgas / (p(k,iCell) * t(k,iCell) &
4777+
* (1.0 + (rvord - 1.0) * scalars(index_qv,k,iCell)))
47624778
rho_zz(k,iCell) = rho_zz(k,iCell) / (1.0 + scalars(index_qv,k,iCell))
47634779
end do
47644780
end do

src/core_landice/Registry.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<registry model="mpas" core="landice" core_abbrev="li" version="7.0">
2+
<registry model="mpas" core="landice" core_abbrev="li" version="7.1">
33

44

55
<!-- ======================================================================= -->

src/core_ocean/Registry.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<registry model="mpas" core="ocean" core_abbrev="ocn" version="7.0">
2+
<registry model="mpas" core="ocean" core_abbrev="ocn" version="7.1">
33

44
<dims>
55
<dim name="nCells" units="unitless"

src/core_seaice/Registry.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<registry model="mpas" core="seaice" core_abbrev="seaice" version="7.0">
2+
<registry model="mpas" core="seaice" core_abbrev="seaice" version="7.1">
33

44
<dims>
55
<dim name="nCells"

src/core_sw/Registry.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<registry model="mpas" core="sw" core_abbrev="sw" version="7.0">
2+
<registry model="mpas" core="sw" core_abbrev="sw" version="7.1">
33
<dims>
44
<dim name="nCells"/>
55
<dim name="nEdges"/>

src/core_test/Registry.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<registry model="mpas" core="test" core_abbrev="test" version="7.0">
2+
<registry model="mpas" core="test" core_abbrev="test" version="7.1">
33
<dims>
44
<dim name="nCells"/>
55
<dim name="nEdges"/>

src/external/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ esmf_time:
66
( cd esmf_time_f90; $(MAKE) FC="$(FC) $(FFLAGS)" CPP="$(CPP)" CPPFLAGS="$(CPPFLAGS) -DHIDE_MPI" GEN_F90=$(GEN_F90) )
77

88
ezxml-lib:
9-
( cd ezxml; $(MAKE) )
9+
( cd ezxml; $(MAKE) OBJFILE="ezxml.o" )
1010

1111
clean:
1212
( cd esmf_time_f90; $(MAKE) clean )

src/external/ezxml/Makefile

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
1-
.SUFFIXES: .c .o
2-
3-
OBJS = ezxml.o
4-
5-
all: clean
6-
$(MAKE) -j 1 library
7-
8-
library: $(OBJS)
1+
$(OBJFILE): ezxml.c
2+
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $(OBJFILE)
93

104
clean:
115
$(RM) *.o *.i
12-
13-
.c.o:
14-
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<

src/tools/input_gen/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ EZXML_PATH= ../../external/ezxml
44

55
NL_OBJS = namelist_gen.o test_functions.o
66
ST_OBJS = streams_gen.o test_functions.o
7-
XML_OBJS = $(EZXML_PATH)/ezxml.o
7+
XML_OBJS = $(EZXML_PATH)/ezxml_tools.o
88

99
all: ezxml
1010
($(MAKE) -j 1 namelist_gen CPPFLAGS="$(CPPFLAGS)" CPPINCLUDES="$(CPPINCLUDES)")
1111
($(MAKE) -j 1 streams_gen CPPFLAGS="$(CPPFLAGS)" CPPINCLUDES="$(CPPINCLUDES)")
1212

1313
ezxml:
14-
(cd $(EZXML_PATH); $(MAKE) CFLAGS="$(CFLAGS) $(TOOL_TARGET_ARCH)")
14+
(cd $(EZXML_PATH); $(MAKE) CFLAGS="$(CFLAGS) $(TOOL_TARGET_ARCH)" OBJFILE="ezxml_tools.o")
1515

1616
namelist_gen: ezxml $(NL_OBJS) $(XML_OBJS)
1717
$(CC) $(CPPFLAGS) $(CFLAGS) -I$(EZXML_PATH) -o $@ $(NL_OBJS) $(XML_OBJS)

src/tools/registry/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ all: ezxml
99
($(MAKE) parse CPPFLAGS="$(CPPFLAGS)" CPPINCLUDES="$(CPPINCLUDES)")
1010

1111
ezxml:
12-
(cd $(EZXML_PATH); $(MAKE) CFLAGS="$(CFLAGS) $(TOOL_TARGET_ARCH)")
12+
(cd $(EZXML_PATH); $(MAKE) CFLAGS="$(CFLAGS) $(TOOL_TARGET_ARCH)" OBJFILE="ezxml_tools.o")
1313

1414
parse: $(OBJS)
15-
$(CC) $(CPPFLAGS) $(CFLAGS) $(EZXML_PATH)/ezxml.o -I$(EZXML_PATH) -o $@ $(OBJS)
15+
$(CC) $(CPPFLAGS) $(CFLAGS) $(EZXML_PATH)/ezxml_tools.o -I$(EZXML_PATH) -o $@ $(OBJS)
1616

1717
parse.o:
1818

0 commit comments

Comments
 (0)