Skip to content

Commit c24e9ec

Browse files
committed
Consistently use integer mask (MASKED_VALUE=1)
1 parent 7f50d02 commit c24e9ec

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/drivers/fabm_pelagic_driver.F90

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
!> @brief 3D generic driver for the Framework for Aquatic Biogeochemical Models (FABM)
33
!>
44
!> This computer program is part of MOSSCO.
5-
!> @copyright Copyright 2021-2022 Helmholtz-Zentrum Hereon
6-
!> @copyright Copyright 2013-2021 Helmholtz-Zentrum Geesthacht
5+
!> @copyright Copyright 2021-2025 Helmholtz-Zentrum hereon GmbH
6+
!> @copyright Copyright 2013-2021 Helmholtz-Zentrum Geesthacht GmbH
77
!> @author Richard Hofmeister
88
!> @author Carsten Lemmen <carsten.lemmen@hereon.de
99
!
@@ -217,8 +217,8 @@ subroutine initialize_domain(pf,inum,jnum,knum,dt,mask)
217217
class(type_mossco_fabm_pelagic) :: pf
218218
integer :: inum,jnum,knum
219219
real(rk) :: dt
220-
logical, dimension(1:inum,1:jnum,1:knum), optional :: mask
221-
logical, dimension(1:inum,1:jnum), target :: mask_hz
220+
integer, dimension(1:inum,1:jnum,1:knum), optional :: mask
221+
integer, dimension(1:inum,1:jnum), target :: mask_hz
222222

223223
type(export_state_type), pointer :: export_state
224224
integer :: n
@@ -240,9 +240,9 @@ subroutine initialize_domain(pf,inum,jnum,knum,dt,mask)
240240
if (present(mask)) then
241241
pf%mask=mask
242242
else
243-
pf%mask(:,:,:) = .false.
243+
pf%mask(:,:,:) = 0
244244
end if
245-
mask_hz = any(pf%mask, dim=3)
245+
mask_hz = maxval(pf%mask, dim=3)
246246

247247
call fabm_set_mask(pf%model, pf%mask, mask_hz)
248248

@@ -369,7 +369,7 @@ subroutine update_grid(pf)
369369
do i=1,pf%inum
370370
do j=1,pf%jnum
371371
do k=1,pf%knum
372-
if (.not.pf%mask(i,j,k)) &
372+
if (pf%mask(i,j,k) == 0) &
373373
pf%layer_height(i,j,k) = pf%zi(i,j,k0+k) - pf%zi(i,j,k0+k-1)
374374
end do
375375
end do
@@ -402,7 +402,7 @@ subroutine get_rhs(rhs_driver,rhs)
402402
do i=1,rhs_driver%inum
403403
rhs(i,j,rhs_driver%knum,:) = rhs(i,j,rhs_driver%knum,:)/rhs_driver%layer_height(i,j,rhs_driver%knum)
404404
end do
405-
!if (.not.rhs_driver%mask(i,j,1)) then
405+
!if (rhs_driver%mask(i,j,1) == 0) then
406406
! call fabm_do_bottom()
407407
!end if
408408
end do
@@ -803,7 +803,7 @@ subroutine light(pf)
803803

804804
do i=1,pf%inum
805805
do j=1,pf%jnum
806-
! if (.not.pf%mask(i,j,1)) then
806+
! if (pf%mask(i,j,1) == 0) then
807807
if ( pf%I_0(i,j) /= pf%I_0(i,j) ) write(0,*) 'ERROR: fabm_pelagic_driver#800 pf%I_0 = ',i,j,pf%I_0(i,j)
808808
if ( pf%albedo(i,j) /= pf%albedo(i,j) ) write(0,*) 'ERROR: fabm_pelagic_driver#809 pf%albedo = ',i,j,pf%albedo(i,j)
809809
if ( any(pf%par(i,j,:) /= pf%par(i,j,:)) ) write(0,*) 'ERROR: fabm_pelagic_driver#810 pf%par = ',i,j,pf%par(i,j,:)

src/utilities/solver_library.F90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
!!
44
!! @author Richard Hofmeister
55
!! @author Carsten Lemmen <carsten.lemmen@hereon.de
6-
!! @copyright 2021-2022 Helmholtz-Zentrum Hereon
7-
!! @copyright 2013-2021 Helmholtz-Zentrum Geesthacht
6+
!! @copyright 2021-2025 Helmholtz-Zentrum Hereon GmbH
7+
!! @copyright 2013-2021 Helmholtz-Zentrum Geesthacht GmbH
88
!
99
! MOSSCO is free software: you can redistribute it and/or modify it under the
1010
! terms of the GNU General Public License v3+. MOSSCO is distributed in the
@@ -40,7 +40,7 @@ module solver_library
4040
real(selected_real_kind(13)) :: dt_min=1.d-9 ! minimum timestep
4141
real(selected_real_kind(13)) :: relative_change_min=-0.9d0 ! minimum relative change
4242
real(selected_real_kind(13)),dimension(:,:,:,:),pointer :: conc=>null()
43-
logical, dimension(:,:,:), pointer :: mask=>null()
43+
integer, dimension(:,:,:), pointer :: mask=>null()
4444
real(selected_real_kind(13)) :: last_min_dt=1.e20
4545
integer :: last_min_dt_grid_cell(4)=(/-99,-99,-99,-99/)
4646
logical :: adaptive_solver_diagnostics=.false.

0 commit comments

Comments
 (0)