Skip to content

Commit

Permalink
Merge branch 'develop' into bugfix/wjiang/getAerosolSum
Browse files Browse the repository at this point in the history
  • Loading branch information
amdasilva authored May 26, 2022
2 parents 1b857f7 + 279bb81 commit 2fe4a45
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 79 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Fix bug in getAerosolSum
- more hard-coded name changes for Issue #93
- Fixed bug in MieQuery.H, shape of not present variable is used
- remove logic dinosaur "goto"
- Removed some print statements that have been commented out.
- Update `CODEOWNERS` file to make approvals less restrictive
- Updated the CircleCI to use circleci-tools 0.13.0 orb
- Moves CI to use Baselibs 6.2.13 needed by MAPL development
Expand Down
42 changes: 21 additions & 21 deletions ESMF/GOCART2G_GridComp/CA2G_GridComp/CA2G_GridCompMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,15 @@ subroutine SetServices (GC, RC)
RESTART = MAPL_RestartSkip, __RC__)

call MAPL_AddInternalSpec(GC, &
short_name = 'CAphobic'//trim(comp_name), &
short_name = trim(comp_name)//'phobic', &
long_name = trim(GCsuffix)//' phobic Mixing Ratio',&
units = 'kg kg-1', &
restart = MAPL_RestartOptional, &
dims = MAPL_DimsHorzVert, &
vlocation = MAPL_VLocationCenter, __RC__)

call MAPL_AddInternalSpec(GC, &
short_name = 'CAphilic'//trim(comp_name), &
short_name = trim(comp_name)//'philic', &
long_name = trim(GCsuffix)//' philic Mixing Ratio',&
units = 'kg kg-1', &
restart = MAPL_RestartOptional, &
Expand Down Expand Up @@ -458,26 +458,26 @@ subroutine Initialize (GC, import, export, clock, RC)
call ESMF_StateGet (export, trim(COMP_NAME)//'_AERO' , aero , __RC__)
call ESMF_StateGet (export, trim(COMP_NAME)//'_AERO_DP' , Bundle_DP, __RC__)

call ESMF_StateGet (internal, 'CAphobic'//trim(comp_name), field, __RC__)
call ESMF_StateGet (internal, trim(comp_name)//'phobic', field, __RC__)
call ESMF_AttributeSet (field, NAME='ScavengingFractionPerKm', VALUE=self%fscav(1), __RC__)
fld = MAPL_FieldCreate (field, 'CAphobic'//trim(comp_name), __RC__)
fld = MAPL_FieldCreate (field, trim(comp_name)//'phobic', __RC__)
call MAPL_StateAdd (aero, fld, __RC__)

! Set internal CAphobic values to 0 where above klid
call MAPL_GetPointer (internal, int_ptr, 'CAphobic'//trim(comp_name), __RC__)
call MAPL_GetPointer (internal, int_ptr, trim(comp_name)//'phobic', __RC__)
call setZeroKlid(self%km, self%klid, int_ptr)

call ESMF_StateGet (internal, 'CAphilic'//trim(comp_name), field, __RC__)
call ESMF_StateGet (internal, trim(comp_name)//'philic', field, __RC__)
call ESMF_AttributeSet (field, NAME='ScavengingFractionPerKm', VALUE=self%fscav(2), __RC__)
fld = MAPL_FieldCreate (field, 'CAphilic'//trim(comp_name), __RC__)
fld = MAPL_FieldCreate (field, trim(comp_name)//'philic', __RC__)
call MAPL_StateAdd (aero, fld, __RC__)

if (.not. data_driven) then
! Set klid
call MAPL_GetPointer(import, ple, 'PLE', __RC__)
call findKlid (self%klid, self%plid, ple, __RC__)
! Set internal CAphilic values to 0 where above klid
call MAPL_GetPointer (internal, int_ptr, 'CAphilic'//trim(comp_name), __RC__)
call MAPL_GetPointer (internal, int_ptr, trim(comp_name)//'philic', __RC__)
call setZeroKlid(self%km, self%klid, int_ptr)
end if

Expand All @@ -502,16 +502,16 @@ subroutine Initialize (GC, import, export, clock, RC)
instance = instanceComputational

! Dry deposition
call append_to_bundle('CADP'//trim(comp_name), providerState, prefix, Bundle_DP, __RC__)
call append_to_bundle(trim(comp_name)//'DP', providerState, prefix, Bundle_DP, __RC__)

! Wet deposition (Convective scavenging)
call append_to_bundle('CASV'//trim(comp_name), providerState, prefix, Bundle_DP, __RC__)
call append_to_bundle(trim(comp_name)//'SV', providerState, prefix, Bundle_DP, __RC__)

! Wet deposition
call append_to_bundle('CAWT'//trim(comp_name), providerState, prefix, Bundle_DP, __RC__)
call append_to_bundle(trim(comp_name)//'WT', providerState, prefix, Bundle_DP, __RC__)

! Gravitational Settling
call append_to_bundle('CASD'//trim(comp_name), providerState, prefix, Bundle_DP, __RC__)
call append_to_bundle(trim(comp_name)//'SD', providerState, prefix, Bundle_DP, __RC__)
end if

self%instance = instance
Expand Down Expand Up @@ -561,8 +561,8 @@ subroutine Initialize (GC, import, export, clock, RC)
call ESMF_AttributeSet(aero, name='mieTable_pointer', valueList=mieTable_pointer, itemCount=size(mieTable_pointer), __RC__)

allocate(aerosol_names(self%nbins), __STAT__)
aerosol_names(1) = 'CAphobic'//trim(comp_name)
aerosol_names(2) = 'CAphilic'//trim(comp_name)
aerosol_names(1) = trim(comp_name)//'phobic'
aerosol_names(2) = trim(comp_name)//'philic'
call ESMF_AttributeSet(aero, name='internal_variable_name', valueList=aerosol_names, &
itemCount=size(aerosol_names), __RC__)

Expand Down Expand Up @@ -711,8 +711,8 @@ subroutine Run1 (GC, import, export, clock, RC)
GCsuffix = 'BR'
end if

call MAPL_GetPointer (internal, intPtr_phobic, 'CAphobic'//trim(comp_name), __RC__)
call MAPL_GetPointer (internal, intPtr_philic, 'CAphilic'//trim(comp_name), __RC__)
call MAPL_GetPointer (internal, intPtr_phobic, trim(comp_name)//'phobic', __RC__)
call MAPL_GetPointer (internal, intPtr_philic, trim(comp_name)//'philic', __RC__)

! Get my private internal state
! ------------------------------
Expand Down Expand Up @@ -923,8 +923,8 @@ subroutine Run2 (GC, import, export, clock, RC)
call MAPL_Get (MAPL, INTERNAL_ESMF_STATE=internal, &
INTERNALSPEC = InternalSpec, __RC__)

call MAPL_GetPointer (internal, intPtr_phobic, 'CAphobic'//trim(comp_name), __RC__)
call MAPL_GetPointer (internal, intPtr_philic, 'CAphilic'//trim(comp_name), __RC__)
call MAPL_GetPointer (internal, intPtr_phobic, trim(comp_name)//'phobic', __RC__)
call MAPL_GetPointer (internal, intPtr_philic, trim(comp_name)//'philic', __RC__)

#include "CA2G_GetPointer___.h"

Expand Down Expand Up @@ -1084,10 +1084,10 @@ subroutine Run_data (GC, IMPORT, EXPORT, INTERNAL, RC)
VERIFY_(STATUS)
self => wrap%ptr

! Update interal data pointers with ExtData
! Update internal data pointers with ExtData
! -----------------------------------------
call MAPL_GetPointer (internal, NAME='CAphobic'//trim(comp_name), ptr=ptr3d_int_phobic, __RC__)
call MAPL_GetPointer (internal, NAME='CAphilic'//trim(comp_name), ptr=ptr3d_int_philic, __RC__)
call MAPL_GetPointer (internal, NAME=trim(comp_name)//'phobic', ptr=ptr3d_int_phobic, __RC__)
call MAPL_GetPointer (internal, NAME=trim(comp_name)//'philic', ptr=ptr3d_int_philic, __RC__)

call MAPL_GetPointer (import, NAME='clim'//trim(GCsuffix)//'phobic', ptr=ptr3d_imp, __RC__)
ptr3d_int_phobic = ptr3d_imp
Expand Down
44 changes: 22 additions & 22 deletions ESMF/GOCART2G_GridComp/GOCART2G_GridCompMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -875,11 +875,11 @@ subroutine Run2 (GC, import, export, clock, RC)
if ((self%CA%instances(n)%is_active) .and. (index(self%CA%instances(n)%name, 'data') == 0 ) &
.and. (index(self%CA%instances(n)%name, 'CA.bc') > 0)) then

call MAPL_GetPointer (gex(self%CA%instances(n)%id), bcexttau, 'CAEXTTAUCA.bc', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), bcstexttau, 'CASTEXTTAUCA.bc', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), bcscatau, 'CASCATAUCA.bc', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), bcstscatau, 'CASTSCATAUCA.bc', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), bcangstr, 'CAANGSTRCA.bc', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), bcexttau, 'CA.bcEXTTAU', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), bcstexttau, 'CA.bcSTEXTTAU', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), bcscatau, 'CA.bcSCATAU', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), bcstscatau, 'CA.bcSTSCATAU', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), bcangstr, 'CA.bcANGSTR', __RC__)

! Iterate over the wavelengths
do w = 1, size(self%wavelengths_vertint)
Expand All @@ -893,7 +893,7 @@ subroutine Run2 (GC, import, export, clock, RC)
if(associated(totscatfm) .and. associated(bcscatau)) totscatfm(:,:,w) = totscatfm(:,:,w)+bcscatau(:,:,w)
end do

call MAPL_GetPointer (gex(self%CA%instances(n)%id), bcsmass, 'CASMASSCA.bc', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), bcsmass, 'CA.bcSMASS', __RC__)
if(associated(pm) .and. associated(bcsmass)) pm = pm + bcsmass
if(associated(pm25) .and. associated(bcsmass)) pm25 = pm25 + bcsmass
if(associated(pm_rh35) .and. associated(bcsmass)) pm_rh35 = pm_rh35 + bcsmass
Expand All @@ -908,11 +908,11 @@ subroutine Run2 (GC, import, export, clock, RC)

else if ((self%CA%instances(n)%is_active) .and. (index(self%CA%instances(n)%name, 'data') == 0 ) &
.and. (index(self%CA%instances(n)%name, 'CA.oc') > 0)) then
call MAPL_GetPointer (gex(self%CA%instances(n)%id), ocexttau, 'CAEXTTAUCA.oc', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), ocstexttau, 'CASTEXTTAUCA.oc', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), ocscatau, 'CASCATAUCA.oc', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), ocstscatau, 'CASTSCATAUCA.oc', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), ocangstr, 'CAANGSTRCA.oc', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), ocexttau, 'CA.ocEXTTAU', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), ocstexttau, 'CA.ocSTEXTTAU', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), ocscatau, 'CA.ocSCATAU', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), ocstscatau, 'CA.ocSTSCATAU', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), ocangstr, 'CA.ocANGSTR', __RC__)

! Iterate over the wavelengths
do w = 1, size(self%wavelengths_vertint)
Expand All @@ -926,7 +926,7 @@ subroutine Run2 (GC, import, export, clock, RC)
if(associated(totscatfm) .and. associated(ocscatau)) totscatfm(:,:,w) = totscatfm(:,:,w)+ocscatau(:,:,w)
end do

call MAPL_GetPointer (gex(self%CA%instances(n)%id), ocsmass, 'CASMASSCA.oc', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), ocsmass, 'CA.ocSMASS', __RC__)
if(associated(pm) .and. associated(ocsmass)) pm = pm + ocsmass
if(associated(pm25) .and. associated(ocsmass)) pm25 = pm25 + ocsmass
if(associated(pm_rh35) .and. associated(ocsmass)) pm_rh35 = pm_rh35 + 1.16*ocsmass ! needs to be revisited: OCpho + 1.16 OCphi
Expand All @@ -941,11 +941,11 @@ subroutine Run2 (GC, import, export, clock, RC)

else if ((self%CA%instances(n)%is_active) .and. (index(self%CA%instances(n)%name, 'data') == 0 ) &
.and. (index(self%CA%instances(n)%name, 'CA.br') > 0)) then
call MAPL_GetPointer (gex(self%CA%instances(n)%id), brexttau, 'CAEXTTAUCA.br', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), brstexttau, 'CASTEXTTAUCA.br', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), brscatau, 'CASCATAUCA.br', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), brstscatau, 'CASTSCATAUCA.br', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), brangstr, 'CAANGSTRCA.br', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), brexttau, 'CA.brEXTTAU', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), brstexttau, 'CA.brSTEXTTAU', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), brscatau, 'CA.brSCATAU', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), brstscatau, 'CA.brSTSCATAU', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), brangstr, 'CA.brANGSTR', __RC__)

! Iterate over the wavelengths
do w = 1, size(self%wavelengths_vertint)
Expand All @@ -959,7 +959,7 @@ subroutine Run2 (GC, import, export, clock, RC)
if(associated(totscatfm) .and. associated(brscatau)) totscatfm(:,:,w) = totscatfm(:,:,w)+brscatau(:,:,w)
end do

call MAPL_GetPointer (gex(self%CA%instances(n)%id), brsmass, 'CASMASSCA.br', __RC__)
call MAPL_GetPointer (gex(self%CA%instances(n)%id), brsmass, 'CA.brSMASS', __RC__)
if(associated(pm) .and. associated(brsmass)) pm = pm + brsmass
if(associated(pm25) .and. associated(brsmass)) pm25 = pm25 + brsmass
if(associated(pm_rh35) .and. associated(brsmass)) pm_rh35 = pm_rh35 + 1.16*brsmass ! needs to be revisited: OCpho + 1.16 OCphi
Expand Down Expand Up @@ -1558,7 +1558,7 @@ subroutine aerosol_activation_properties(state, rc)
varNameLen = len_trim(aeroList(i))
! the '5' refers to '_AERO', which we want to remove to get the CA component name (e.g. CA.oc, or CA.oc.data)
varNameLen = varNameLen - 5
call MAPL_GetPointer(child_state, ptr_3d, 'CAphilic'//aeroList(i)(1:varNameLen), __RC__)
call MAPL_GetPointer(child_state, ptr_3d, aeroList(i)(1:varNameLen)//'philic', __RC__)
q = q + ptr_3d
hygroscopicity = k_ORG * ptr_3d + hygroscopicity
density = densORG * ptr_3d + density
Expand Down Expand Up @@ -1589,7 +1589,7 @@ subroutine aerosol_activation_properties(state, rc)
varNameLen = len_trim(aeroList(i))
! the '5' refers to '_AERO', which we want to remove to get the CA component name (e.g. CA.bc, or CA.bc.data)
varNameLen = varNameLen - 5
call MAPL_GetPointer(child_state, ptr_3d, 'CAphilic'//aeroList(i)(1:varNameLen), __RC__)
call MAPL_GetPointer(child_state, ptr_3d, aeroList(i)(1:varNameLen)//'philic', __RC__)
q = q + ptr_3d
hygroscopicity = k_BC
density = densBC
Expand All @@ -1603,7 +1603,7 @@ subroutine aerosol_activation_properties(state, rc)
varNameLen = len_trim(aeroList(i))
! the '5' refers to '_AERO', which we want to remove to get the CA component name (e.g. CA.oc, or CA.oc.data)
varNameLen = varNameLen - 5
call MAPL_GetPointer(child_state, ptr_3d, 'CAphilic'//aeroList(i)(1:varNameLen), __RC__)
call MAPL_GetPointer(child_state, ptr_3d, aeroList(i)(1:varNameLen)//'philic', __RC__)
q = q + ptr_3d
hygroscopicity = k_OC
density = densOC
Expand All @@ -1617,7 +1617,7 @@ subroutine aerosol_activation_properties(state, rc)
varNameLen = len_trim(aeroList(i))
! the '5' refers to '_AERO', which we want to remove to get the CA component name (e.g. CA.bc, or CA.bc.data)
varNameLen = varNameLen - 5
call MAPL_GetPointer(child_state, ptr_3d, 'CAphilic'//aeroList(i)(1:varNameLen), __RC__)
call MAPL_GetPointer(child_state, ptr_3d, aeroList(i)(1:varNameLen)//'philic', __RC__)
q = q + ptr_3d
hygroscopicity = k_BR
density = densBR
Expand Down
4 changes: 2 additions & 2 deletions ESMF/Shared/Chem_AeroGeneric.F90
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ subroutine append_to_bundle(varName, providerState, prefix, bundle, rc)
do i = 1, size(orig_ptr, 3)
write (bin_index,'(A, I0.3)') '', i
ptr2d => orig_ptr(:,:,i)
varNameNew = 'OC'//trim(varName(3:4))
varNameNew = 'OC'//varName(6:7)
field2D = ESMF_FieldCreate(grid=grid, datacopyflag=ESMF_DATACOPY_REFERENCE, farrayPtr=ptr2d,&
name=trim(varNameNew)//trim(bin_index) , __RC__)
call MAPL_AllocateCoupling (field2D, __RC__)
Expand All @@ -196,7 +196,7 @@ subroutine append_to_bundle(varName, providerState, prefix, bundle, rc)
do i = 1, size(orig_ptr, 3)
write (bin_index,'(A, I0.3)') '', i
ptr2d => orig_ptr(:,:,i)
varNameNew = 'BC'//trim(varName(3:4))
varNameNew = 'BC'//varName(6:7)
field2D = ESMF_FieldCreate(grid=grid, datacopyflag=ESMF_DATACOPY_REFERENCE, farrayPtr=ptr2d,&
name=trim(varNameNew)//trim(bin_index) , __RC__)
call MAPL_AllocateCoupling (field2D, __RC__)
Expand Down
8 changes: 0 additions & 8 deletions Process_Library/GOCART2G_MieMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ type(GOCART2G_Mie) function GOCART2G_MieCreate ( rcfile, wavelengths, nmom, rc )
exit
endif
enddo
! print *, j, this%rhi(j), this%rha(j), this%rh(this%rhi(j))
enddo

return
Expand All @@ -469,16 +468,9 @@ subroutine polint(x,y,n,xWant,yWant,yErr)
! on out of bounds, set i to lower or upper limit
i = 0
if(xWant .lt. x(1)) then
! write(msg,*) "in polint, wanted: ", xWant, ", got lower bound: ", x(1)
! call warn(myname,msg)
! if (mapl_am_i_root()) print *,'in polint(), wnted: ', xWant, ', got lower bound: ', x(1)
i = 1
endif
if(xWant .gt. x(n)) then
! write(msg,*) "in polint, wanted: ", xWant, ", got upper bound: ", x(n)
! call warn(myname,msg)
! if (mapl_am_i_root()) print *,'in polint(), wnted: ', xWant, ', got upper bound: ', x(n)

i = n
endif

Expand Down
Loading

0 comments on commit 2fe4a45

Please sign in to comment.