Skip to content

Commit bb8bcfe

Browse files
mlee03mlee03
authored andcommitted
fixes
1 parent ab1425c commit bb8bcfe

4 files changed

Lines changed: 55 additions & 55 deletions

File tree

configure.ac

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ AC_PREREQ([2.69])
2525

2626
# Initialize with name, version, and support email address.
2727
AC_INIT([GFDL FMS Library],
28-
[2025.04-dev],
28+
[2025.03-dev],
2929
[gfdl.climate.model.info@noaa.gov],
3030
[FMS],
3131
[https://www.github.com/NOAA-GFDL/FMS])
@@ -237,7 +237,7 @@ AC_CHECK_FUNCS([gettid], [], [])
237237
AC_CHECK_FUNCS([sched_getaffinity], [], [])
238238

239239
# Check if the compiler needs special OpenMP flags
240-
#AC_OPENMP()
240+
AC_OPENMP()
241241
AC_LANG_POP(C)
242242

243243
# Fortran specific checks
@@ -305,7 +305,7 @@ GX_FC_QUAD_PRECISION()
305305
GX_FC_INTERNAL_FILE_NML()
306306

307307
# Check if the compiler needs special OpenMP flags
308-
#AC_OPENMP()
308+
AC_OPENMP()
309309

310310
AC_LANG_POP(Fortran)
311311

@@ -360,13 +360,13 @@ if test $enable_setting_flags = yes; then
360360
fi
361361

362362
# Add OpenMP flags
363-
dnl if test ! -z "$OPENMP_CFLAGS"; then
364-
dnl CFLAGS="$CFLAGS $OPENMP_CFLAGS"
365-
dnl CPPFLAGS="$CPPFLAGS $OPENMP_CFLAGS"
366-
dnl fi
367-
dnl if test ! -z "$OPENMP_FCFLAGS"; then
368-
dnl FCFLAGS="$FCFLAGS $OPENMP_FCFLAGS"
369-
dnl fi
363+
if test ! -z "$OPENMP_CFLAGS"; then
364+
CFLAGS="$CFLAGS $OPENMP_CFLAGS"
365+
CPPFLAGS="$CPPFLAGS $OPENMP_CFLAGS"
366+
fi
367+
if test ! -z "$OPENMP_FCFLAGS"; then
368+
FCFLAGS="$FCFLAGS $OPENMP_FCFLAGS"
369+
fi
370370

371371
# Add code coverage flags
372372
if test $enable_code_coverage = yes; then

horiz_interp/include/horiz_interp_conserve.inc

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -497,12 +497,12 @@ subroutine HORIZ_INTERP_CONSERVE_NEW_1DX1D_ ( Interp, lon_in, lat_in, lon_out, l
497497

498498
subroutine HORIZ_INTERP_CONSERVE_NEW_2DX2D_ ( Interp, lon_in, lat_in, lon_out, lat_out, &
499499
mask_in, mask_out, verbose, save_xgrid_area, as_fregrid)
500-
type(horiz_interp_type), intent(inout) :: Interp
501-
real(FMS_HI_KIND_), intent(in), dimension(:,:) :: lon_in , lat_in
502-
real(FMS_HI_KIND_), intent(in), dimension(:,:) :: lon_out, lat_out
503-
real(FMS_HI_KIND_), intent(in), optional, dimension(:,:) :: mask_in
500+
type(horiz_interp_type), intent(inout) :: Interp
501+
real(FMS_HI_KIND_), intent(in), dimension(:,:), target :: lon_in , lat_in
502+
real(FMS_HI_KIND_), intent(in), dimension(:,:), target :: lon_out, lat_out
503+
real(FMS_HI_KIND_), intent(in), optional, dimension(:,:), target :: mask_in
504504
real(FMS_HI_KIND_), intent(inout), optional, dimension(:,:) :: mask_out
505-
integer, intent(in), optional :: verbose
505+
integer, intent(in), optional :: verbose
506506
logical, intent(in), optional :: save_xgrid_area !< option to save xgrid_area
507507
logical, intent(in), optional :: as_fregrid !< save weights as xcell_area/input_cell_area
508508

@@ -518,15 +518,15 @@ subroutine HORIZ_INTERP_CONSERVE_NEW_1DX1D_ ( Interp, lon_in, lat_in, lon_out, l
518518
logical :: as_fregrid_
519519
integer, parameter :: kind_ = FMS_HI_KIND_ !< compiled kind size
520520

521-
if (.not. module_is_initialized) then
521+
if(.not. module_is_initialized) then
522522
call mpp_error(FATAL, 'HORIZ_INTERP_CONSERVE_NEW_2DX2D_: horiz_interp_conserve is not intialized')
523523
end if
524524

525-
if (.not. all(shape(lon_in) == shape(lat_in))) then
525+
if(.not. all(shape(lon_in) == shape(lat_in))) then
526526
call mpp_error(FATAL, 'horiz_interp_conserve_mod: size mismatch between lon_in and lat_in')
527527
end if
528528

529-
if (.not. all(shape(lon_out) == shape(lat_out))) then
529+
if(.not. all(shape(lon_out) == shape(lat_out))) then
530530
call mpp_error(FATAL, 'horiz_interp_conserve_mod: size mismatch between lon_out and lat_out')
531531
end if
532532

@@ -535,65 +535,65 @@ subroutine HORIZ_INTERP_CONSERVE_NEW_1DX1D_ ( Interp, lon_in, lat_in, lon_out, l
535535
nlon_out = size(lon_out, 1) - 1
536536
nlat_out = size(lon_out, 2) - 1
537537

538-
if (present(mask_in)) then
539-
if (.not. all(shape(mask_in) == [nlon_in, nlat_in])) then
538+
if(present(mask_in)) then
539+
if(.not. all(shape(mask_in) == [nlon_in, nlat_in])) then
540540
call mpp_error(FATAL, 'horiz_interp_conserve_mod: size mismatch between mask_in and lon_in/lat_in')
541541
end if
542542
end if
543543

544544
as_fregrid_ = .false.
545-
if (present(as_fregrid)) as_fregrid_ = as_fregrid
545+
if(present(as_fregrid)) as_fregrid_ = as_fregrid
546546

547547
maxxgrid = get_maxxgrid()
548-
allocate (i_src(maxxgrid), j_src(maxxgrid), i_dst(maxxgrid), j_dst(maxxgrid), xgrid_area(maxxgrid))
549-
if (as_fregrid_) then
550-
allocate (parent_area(nlon_in, nlat_in))
548+
allocate(i_src(maxxgrid), j_src(maxxgrid), i_dst(maxxgrid), j_dst(maxxgrid), xgrid_area(maxxgrid))
549+
if(as_fregrid_) then
550+
allocate(parent_area(nlon_in, nlat_in))
551551
else
552-
allocate (parent_area(nlon_out, nlat_out))
552+
allocate(parent_area(nlon_out, nlat_out))
553553
end if
554554

555555
#ifdef HI_R8_CODE_
556556
lon_in_r8 => lon_in
557557
lat_in_r8 => lat_in
558558
lon_out_r8 => lon_out
559559
lat_out_r8 => lat_out
560-
if (present(mask_in)) then
560+
if(present(mask_in)) then
561561
mask_src => mask_in
562562
else
563-
allocate (mask_src(nlon_in, nlat_in), source=1.0_r8_kind)
563+
allocate(mask_src(nlon_in, nlat_in), source=1.0_r8_kind)
564564
end if
565565
#else
566-
allocate (lon_in_r8, source=real(lon_in, r8_kind))
567-
allocate (lat_in_r8, source=real(lat_in, r8_kind))
568-
allocate (lon_out_r8, source=real(lon_out, r8_kind))
569-
allocate (lat_out_r8, source=real(lat_out, r8_kind))
570-
if (present(mask_in)) then
571-
allocate (mask_src, source=real(mask_in, r8_kind))
566+
allocate(lon_in_r8, source=real(lon_in, r8_kind))
567+
allocate(lat_in_r8, source=real(lat_in, r8_kind))
568+
allocate(lon_out_r8, source=real(lon_out, r8_kind))
569+
allocate(lat_out_r8, source=real(lat_out, r8_kind))
570+
if(present(mask_in)) then
571+
allocate(mask_src, source=real(mask_in, r8_kind))
572572
else
573-
allocate (mask_src(nlon_in, nlat_in), source=1.0_r8_kind)
573+
allocate(mask_src(nlon_in, nlat_in), source=1.0_r8_kind)
574574
end if
575575
#endif
576576

577-
if (great_circle_algorithm) then
578-
allocate (clon(maxxgrid), clat(maxxgrid))
577+
if(great_circle_algorithm) then
578+
allocate(clon(maxxgrid), clat(maxxgrid))
579579
nxgrid = create_xgrid_great_circle(nlon_in, nlat_in, nlon_out, nlat_out, lon_in_r8, lat_in_r8, &
580580
lon_out_r8, lat_out_r8, mask_src, i_src, j_src, i_dst, j_dst, xgrid_area, clon, clat)
581-
deallocate (clon, clat)
581+
deallocate(clon, clat)
582582
else
583583
nxgrid = create_xgrid_2DX2D_order1(nlon_in, nlat_in, nlon_out, nlat_out, lon_in_r8, lat_in_r8, &
584584
lon_out_r8, lat_out_r8, mask_src, i_src, j_src, i_dst, j_dst, xgrid_area)
585585
end if
586586

587-
if (as_fregrid_) then
587+
if(as_fregrid_) then
588588
call get_grid_area(nlon_in, nlat_in, lon_in_r8, lat_in_r8, parent_area)
589589
end if
590590

591591
#ifdef HI_R8_CODE_
592-
if (.not. present(mask_in)) deallocate (mask_src)
592+
if(.not. present(mask_in)) deallocate (mask_src)
593593
#else
594-
deallocate (lon_in_r8, lat_in_r8, lon_out_r8, lat_out_r8, mask_src)
594+
deallocate(lon_in_r8, lat_in_r8, lon_out_r8, lat_out_r8, mask_src)
595595
#endif
596-
nullify (lon_in_r8, lat_in_r8, lon_out_r8, lat_out_r8, mask_src)
596+
nullify(lon_in_r8, lat_in_r8, lon_out_r8, lat_out_r8, mask_src)
597597

598598
Interp%version = 2
599599
Interp%nxgrid = nxgrid
@@ -602,18 +602,18 @@ subroutine HORIZ_INTERP_CONSERVE_NEW_1DX1D_ ( Interp, lon_in, lat_in, lon_out, l
602602
Interp%nlon_dst = nlon_out
603603
Interp%nlat_dst = nlat_out
604604
! +1 for C to Fortran conversion, starting index in C is 0
605-
allocate (Interp%i_src, source=i_src(1:nxgrid) + 1)
606-
allocate (Interp%j_src, source=j_src(1:nxgrid) + 1)
607-
allocate (Interp%i_dst, source=i_dst(1:nxgrid) + 1)
608-
allocate (Interp%j_dst, source=j_dst(1:nxgrid) + 1)
609-
allocate (Interp%HI_KIND_TYPE_%area_frac_dst(nxgrid))
610-
if (present(save_xgrid_area)) then
611-
if (save_xgrid_area) then
612-
allocate (Interp%xgrid_area, source=xgrid_area(1:nxgrid))
605+
allocate(Interp%i_src, source=i_src(1:nxgrid) + 1)
606+
allocate(Interp%j_src, source=j_src(1:nxgrid) + 1)
607+
allocate(Interp%i_dst, source=i_dst(1:nxgrid) + 1)
608+
allocate(Interp%j_dst, source=j_dst(1:nxgrid) + 1)
609+
allocate(Interp%HI_KIND_TYPE_%area_frac_dst(nxgrid))
610+
if(present(save_xgrid_area)) then
611+
if(save_xgrid_area) then
612+
allocate(Interp%xgrid_area, source=xgrid_area(1:nxgrid))
613613
end if
614614
end if
615615

616-
if (as_fregrid_) then
616+
if(as_fregrid_) then
617617
do i = 1, nxgrid
618618
ii = Interp%i_src(i)
619619
jj = Interp%j_src(i)
@@ -634,8 +634,8 @@ subroutine HORIZ_INTERP_CONSERVE_NEW_1DX1D_ ( Interp, lon_in, lat_in, lon_out, l
634634
end do
635635
end if
636636

637-
if (present(mask_out)) then
638-
if (.not. all(shape(mask_out) == [nlon_out, nlat_out])) then
637+
if(present(mask_out)) then
638+
if(.not. all(shape(mask_out) == [nlon_out, nlat_out])) then
639639
call mpp_error(FATAL, 'horiz_interp_conserve_mod: size mismatch between mask_out and lon_out/lat_out')
640640
end if
641641
mask_out = 0.0_kind_
@@ -646,7 +646,7 @@ subroutine HORIZ_INTERP_CONSERVE_NEW_1DX1D_ ( Interp, lon_in, lat_in, lon_out, l
646646
end do
647647
end if
648648

649-
deallocate (i_src, j_src, i_dst, j_dst, xgrid_area, parent_area)
649+
deallocate(i_src, j_src, i_dst, j_dst, xgrid_area, parent_area)
650650

651651
Interp%HI_KIND_TYPE_%is_allocated = .true.
652652
Interp%interp_method = CONSERVE

test_fms/horiz_interp/test_horiz_interp2.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,6 @@ test_expect_success "assignment overloads with real kind=8" '
251251
'
252252
test_expect_success "horiz_interp_read_weights_conserve" 'mpirun -n 4 ./test_horiz_interp_read'
253253

254-
test_expect_success "horiz_interp_save_weights_as_fregrid" './test_horiz_interp_fregrid_compatibility'
254+
test_expect_success "horiz_interp_fregrid_compatibility" './test_horiz_interp_fregrid_compatibility'
255255

256256
test_done

test_fms/horiz_interp/test_horiz_interp_fregrid_compatibility.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ program main
5454
call mpp_error(FATAL, "saved xgrid_area does not match answers")
5555
end if
5656

57-
if(.not.any(interp%horizInterpReals8_type%dst == 1.0_r8_kind)) then
57+
if(.not.any(interp%horizInterpReals8_type%area_frac_dst == 1.0_r8_kind)) then
5858
call mpp_error(FATAL, "unexpected weights")
5959
end if
6060

0 commit comments

Comments
 (0)