Skip to content

Commit 47fb4e6

Browse files
authored
Merge pull request #477 from mvertens/feature/bugfix
bug fix primarily for usf testing
2 parents 3305e11 + 7a265d7 commit 47fb4e6

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

mediator/med_fraction_mod.F90

+16-11
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ module med_fraction_mod
134134
use med_methods_mod , only : fldbun_init => med_methods_FB_init
135135
use med_methods_mod , only : fldbun_reset => med_methods_FB_reset
136136
use med_map_mod , only : med_map_field
137-
use med_internalstate_mod , only : ncomps
137+
use med_internalstate_mod , only : ncomps, samegrid_atmlnd
138138

139139
implicit none
140140
private
@@ -496,21 +496,26 @@ subroutine med_fraction_init(gcomp, rc)
496496
call med_map_field(field_src, field_dst, is_local%wrap%RH(complnd,compatm,:), maptype, rc=rc)
497497
if (ChkErr(rc,__LINE__,u_FILE_u)) return
498498

499-
call fldbun_getdata1d(is_local%wrap%FBfrac(compatm), 'lfrac', lfrac, rc)
500-
if (ChkErr(rc,__LINE__,u_FILE_u)) return
499+
! Reset ofrac in FBFrac(compatm)
500+
if (samegrid_atmlnd) then
501+
call fldbun_getdata1d(is_local%wrap%FBfrac(compatm), 'lfrac', lfrac, rc)
502+
if (ChkErr(rc,__LINE__,u_FILE_u)) return
503+
else
504+
call fldbun_getdata1d(is_local%wrap%FBfrac(compatm), 'lfrin', lfrac, rc)
505+
if (ChkErr(rc,__LINE__,u_FILE_u)) return
506+
end if
501507
call fldbun_getdata1d(is_local%wrap%FBfrac(compatm), 'ofrac', ofrac, rc)
502508
if (ChkErr(rc,__LINE__,u_FILE_u)) return
503509
if (associated(ofrac)) then
504-
do n = 1,size(lfrac)
505-
lfrac(n) = lfrin(n)
506-
ofrac(n) = 1.0_R8 - lfrac(n)
507-
if (abs(ofrac(n)) < eps_fraclim) then
508-
ofrac(n) = 0.0_R8
509-
end if
510-
end do
510+
do n = 1,size(lfrac)
511+
ofrac(n) = 1.0_R8 - lfrac(n)
512+
if (abs(ofrac(n)) < eps_fraclim) then
513+
ofrac(n) = 0.0_R8
514+
end if
515+
end do
511516
end if
512517

513-
end if
518+
end if
514519
end if
515520

516521
!---------------------------------------

0 commit comments

Comments
 (0)