Skip to content
Snippets Groups Projects
Commit 017efff9 authored by Sebastien Masson's avatar Sebastien Masson
Browse files

Merge branch '13-debug_2022_closea' into 'main'

Resolve "debug_2022_closea"

Closes #13

See merge request nemo/core!22
parents 16324fa9 465ac38c
No related branches found
No related tags found
No related merge requests found
......@@ -38,11 +38,11 @@ MODULE sbcclo
PUBLIC sbc_clo
PUBLIC sbc_clo_init
!
REAL(wp), PUBLIC, SAVE, ALLOCATABLE, DIMENSION(:) :: rsurfsrcg, rsurftrgg !: closed sea source/target glo surface areas
REAL(wp), PUBLIC, SAVE, ALLOCATABLE, DIMENSION(:) :: rsurfsrcr, rsurftrgr !: closed sea source/target rnf surface areas
REAL(wp), PUBLIC, SAVE, ALLOCATABLE, DIMENSION(:) :: rsurfsrce, rsurftrge !: closed sea source/target emp surface areas
REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:) :: rsurfsrcg, rsurftrgg !: closed sea source/target glo surface areas
REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:) :: rsurfsrcr, rsurftrgr !: closed sea source/target rnf surface areas
REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:) :: rsurfsrce, rsurftrge !: closed sea source/target emp surface areas
!
INTEGER, PUBLIC, SAVE, ALLOCATABLE, DIMENSION(:) :: mcsgrpg, mcsgrpr, mcsgrpe !: closed sea group for glo, rnf and emp
INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: mcsgrpg, mcsgrpr, mcsgrpe !: closed sea group for glo, rnf and emp
!
CONTAINS
!
......@@ -301,19 +301,21 @@ MODULE sbcclo
imsk_trg = kmsk_grp * kmsk_opnsea
END IF
!
!! 3. Subtract residuals from source points
zcsfwf = zcsfw / zsurfsrc
pwcs(:,:) = pwcs(:,:) - zcsfwf * imsk_src(:,:)
pqcs(:,:) = pqcs(:,:) + rcp * zcsfwf * sst_m(:,:) * imsk_src(:,:)
!
!! 4. Add residuals to target points
!! Do not use pqcs(:,:) = pqcs(:,:) - rcp * zcsfw * sst_m(:,:) / zsurftrg
!! as there is no reason heat will be conserved with this formulation
zcsh = glob_sum( 'closea', e1e2t(:,:) * rcp * zcsfwf * sst_m(:,:) * imsk_src(:,:) )
WHERE( imsk_trg(:,:) == kcsgrp(jcs) )
pwcs(:,:) = pwcs(:,:) + zcsfw / zsurftrg
pqcs(:,:) = pqcs(:,:) - zcsh / zsurftrg
ENDWHERE
IF( zsurftrg > 0._wp ) THEN ! target area /=0
!! 3. Subtract residuals from source points
zcsfwf = zcsfw / zsurfsrc
pwcs(:,:) = pwcs(:,:) - zcsfwf * imsk_src(:,:)
pqcs(:,:) = pqcs(:,:) + rcp * zcsfwf * sst_m(:,:) * imsk_src(:,:)
!
!! 4. Add residuals to target points
!! Do not use pqcs(:,:) = pqcs(:,:) - rcp * zcsfw * sst_m(:,:) / zsurftrg
!! as there is no reason heat will be conserved with this formulation
zcsh = glob_sum( 'closea', e1e2t(:,:) * rcp * zcsfwf * sst_m(:,:) * imsk_src(:,:) )
WHERE( imsk_trg(:,:) == kcsgrp(jcs) )
pwcs(:,:) = pwcs(:,:) + zcsfw / zsurftrg
pqcs(:,:) = pqcs(:,:) - zcsh / zsurftrg
ENDWHERE
ENDIF
!
END DO ! jcs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment