Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates to noresm_develop to be close as possible to noresm2_3_develop #13

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,075 changes: 0 additions & 1,075 deletions oslo_aero_share.F90

This file was deleted.

38 changes: 19 additions & 19 deletions src/aero_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ module aero_model
use oslo_aero_share, only: lifeCycleNumberMedianRadius, rhopart, lifeCycleSigma
use oslo_aero_share, only: l_so4_a2, l_bc_n, l_bc_ax
use oslo_aero_share, only: MODE_IDX_BC_NUC, MODE_IDX_BC_EXT_AC
use oslo_aero_share, only: getNumberofTracersInMode, getCloudTracerIndexDirect, getCloudTracerName
use oslo_aero_share, only: getCloudTracerName, getTracerIndex, aero_register
use oslo_aero_control, only: oslo_aero_ctl_readnl
use oslo_aero_depos, only: oslo_aero_depos_init
use oslo_aero_depos, only: oslo_aero_depos_dry, oslo_aero_depos_wet, oslo_aero_wetdep_init
Expand All @@ -54,6 +52,8 @@ module aero_model
use oslo_aero_seasalt, only: oslo_aero_seasalt_init, oslo_aero_seasalt_emis, seasalt_active
use oslo_aero_dust, only: oslo_aero_dust_init, oslo_aero_dust_emis, dust_active
use oslo_aero_ocean, only: oslo_aero_ocean_init, oslo_aero_dms_emis
use oslo_aero_share, only: getNumberofTracersInMode, getCloudTracerIndexDirect, getCloudTracerName
use oslo_aero_share, only: getCloudTracerName, getTracerIndex, aero_register
use oslo_aero_sox_cldaero, only: sox_cldaero_init
use oslo_aero_microp, only: oslo_aero_microp_readnl
use oslo_aero_sw_tables, only: initopt
Expand Down Expand Up @@ -213,34 +213,34 @@ subroutine aero_model_init( pbuf2d )
endif
enddo

call addfld ('NUCLRATE' ,(/'lev'/), 'A', '#/cm3/s','Nucleation rate')
call addfld ('FORMRATE' ,(/'lev'/), 'A', '#/cm3/s','Formation rate of 12nm particles')
call addfld ('COAGNUCL' ,(/'lev'/), 'A', '/s' ,'Coagulation sink for nucleating particles')
call addfld ('GRH2SO4' ,(/'lev'/), 'A', 'nm/hour','Growth rate H2SO4')
call addfld ('GRSOA' ,(/'lev'/), 'A', 'nm/hour','Growth rate SOA')
call addfld ('GR' ,(/'lev'/), 'A', 'nm/hour','Growth rate, H2SO4+SOA')
call addfld ('NUCLSOA' ,(/'lev'/), 'A', 'kg/kg' ,'SOA nucleate')
call addfld ('ORGNUCL' ,(/'lev'/), 'A', 'kg/kg' ,'Organic gas available for nucleation')
call addfld ('NUCLRATE',(/'lev'/), 'A','#/cm3/s','Nucleation rate')
call addfld ('FORMRATE',(/'lev'/), 'A','#/cm3/s','Formation rate of 12nm particles')
call addfld ('COAGNUCL',(/'lev'/), 'A', '/s','Coagulation sink for nucleating particles')
call addfld ('GRH2SO4',(/'lev'/), 'A', 'nm/hour','Growth rate H2SO4')
call addfld ('GRSOA',(/'lev'/),'A','nm/hour','Growth rate SOA')
call addfld ('GR',(/'lev'/), 'A', 'nm/hour','Growth rate, H2SO4+SOA')
call addfld ('NUCLSOA',(/'lev'/),'A','kg/kg','SOA nucleate')
call addfld ('ORGNUCL',(/'lev'/),'A','kg/kg','Organic gas available for nucleation')

if(history_aerosol)then
call add_default ('NUCLRATE', 1, ' ')
call add_default ('FORMRATE', 1, ' ')
call add_default ('COAGNUCL', 1, ' ')
call add_default ('GRH2SO4', 1, ' ')
call add_default ('GRSOA', 1, ' ')
call add_default ('GR', 1, ' ')
call add_default ('NUCLSOA', 1, ' ')
call add_default ('ORGNUCL', 1, ' ')
call add_default ('GRH2SO4', 1, ' ')
call add_default ('GRSOA', 1, ' ')
call add_default ('GR', 1, ' ')
call add_default ('NUCLSOA', 1, ' ')
call add_default ('ORGNUCL', 1, ' ')
end if

call addfld( 'XPH_LWC', (/ 'lev' /), 'A','kg/kg', 'pH value multiplied by lwc')
call addfld ('AQSO4_H2O2', horiz_only, 'A','kg/m2/s', 'SO4 aqueous phase chemistry due to H2O2')
call addfld ('AQSO4_O3', horiz_only, 'A','kg/m2/s', 'SO4 aqueous phase chemistry due to O3')

if ( history_aerosol ) then
call add_default ('XPH_LWC', 1, ' ')
call add_default ('XPH_LWC', 1, ' ')
call add_default ('AQSO4_H2O2', 1, ' ')
call add_default ('AQSO4_O3', 1, ' ')
call add_default ('AQSO4_O3', 1, ' ')
endif

end subroutine aero_model_init
Expand Down Expand Up @@ -668,8 +668,8 @@ end subroutine vmr2qqcw

!=============================================================================
subroutine aero_model_constants()
!
! A number of constants used in the emission and size-calculation in CAM-Oslo Jan 2011.

! A number of constants used in the emission and size-calculation in CAM-Oslo

! local variables
integer :: kcomp,i
Expand Down
50 changes: 25 additions & 25 deletions src/oslo_aero_coag.F90
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ module oslo_aero_coag
real(r8), parameter :: temperatureLookupTables = 293.15_r8 !Temperature used in look up tables
real(r8), parameter :: mfpAir = 63.3e-9_r8 ![m] mean free path air
real(r8), parameter :: viscosityAir = 1.983e-5_r8 ![Pa s] viscosity of air
real(r8), parameter :: rhoh2o = 1000._r8 ! Density of water
real(r8), parameter :: rhoh2o = 1000._r8 !Density of water

!================================================================
contains
Expand Down Expand Up @@ -202,14 +202,14 @@ subroutine initializeCoagulation(rhob,rk)
call calculateCoagulationCoefficient(CoagulationCoefficient & !O [m3/s] coagulation coefficient
, rk(modeIndexCoagulator) & !I [m] radius of coagulator
, rhob(modeIndexCoagulator) & !I [kg/m3] density of coagulator
, rhob(modeIndexReceiver) ) !I [kg/m3] density of receiver
, rhob(modeIndexReceiver) ) !I [kg/m3] density of receiver

!Save values
CoagCoeffModeAdd(iReceiverMode,:) = CoagulationCoefficient(:)

end do !receiver modes

! Onl one receivermode for cloud coagulation (water)
! Only one receivermode for cloud coagulation (water)
do iCoagulatingMode = 1,numberOfCoagulatingModes

!Index of the coagulating mode (0-14), see list above
Expand All @@ -221,7 +221,7 @@ subroutine initializeCoagulation(rhob,rk)
call calculateCoagulationCoefficient(CoagulationCoefficient & !O [m3/s] coagulation coefficient
, rk(modeIndexCoagulator) & !I [m] radius of coagulator
, rhob(modeIndexCoagulator) & !I [kg/m3] density of coagulator
, rhoh2o ) !I [kg/m3] density of receiver
, rhoh2o ) !I [kg/m3] density of receiver

!Save values
K12Cl(iCoagulatingMode,:) = CoagulationCoefficient(:)
Expand Down Expand Up @@ -361,8 +361,8 @@ subroutine calculateCoagulationCoefficient(CoagulationCoefficient, modeRadius, m
real(r8) :: mfv1 ![m] mean free path particle
real(r8) :: mfv2 ![m] mean free path particle

! coagulation coefficient for SO4 (Brownian, Fuchs form)
!Loop through indexes in look-up table
! coagulation coefficient for SO4 (Brownian, Fuchs form)
! Loop through indexes in look-up table
do i=1,nBinsTab
c1=calculateThermalVelocity(rBinMidPoint(i), receiverDensity) !receiving size
c2=calculateThermalVelocity(modeRadius, modeDensity) !coagulating aerosol
Expand All @@ -379,14 +379,13 @@ subroutine calculateCoagulationCoefficient(CoagulationCoefficient, modeRadius, m

g12=sqrt(g1**2+g2**2)

!Coagulation coefficient of receiver size "i" with the coagulating
!mode "kcomp"
!Coagulation coefficient of receiver size "i" with the coagulating mode "kcomp"
CoagulationCoefficient(i) = &
4.0_r8*pi*(rBinMidPoint(i)+modeRadius)*(diff1+diff2) &
/((rBinMidPoint(i)+modeRadius)/(rBinMidPoint(i)+modeRadius+g12) &
+(4.0_r8/c12)*(diff1+diff2)/(modeRadius+rBinMidPoint(i)))

enddo ! loop on imax
enddo
end subroutine calculateCoagulationCoefficient

!================================================================
Expand Down Expand Up @@ -495,9 +494,9 @@ subroutine coagtend(q, pmid, pdel, temperature, delt_inverse, ncol, lchnk)

!process modes don't change mode except so4 condensate which becomes coagulate instead
!assumed to have same sink as MODE_IDX_OMBC_INTMIX_AIT
if( .NOT. is_process_mode(l_index_donor,.true.) &
.OR. ( (l_index_donor.eq.chemistryIndex(l_so4_a1)) &
.AND. modeIndexCoagulator .eq. MODE_IDX_OMBC_INTMIX_COAT_AIT) ) then
if( .NOT. is_process_mode(l_index_donor,.true.) .or. &
( (l_index_donor == chemistryIndex(l_so4_a1)) .and. &
modeIndexCoagulator == MODE_IDX_OMBC_INTMIX_COAT_AIT) ) then

!Done summing total loss of this coagulating specie
totalLoss(i,k,l_index_donor) = coagulationSink & !loss rate for a mode in [1/s] summed over all receivers
Expand All @@ -515,16 +514,16 @@ subroutine coagtend(q, pmid, pdel, temperature, delt_inverse, ncol, lchnk)
end do ! k


!UPDATE THE TRACERS AND DO DIAGNOSTICS
! UPDATE THE TRACERS AND DO DIAGNOSTICS
do iCoagulator = 1, numberOfCoagulatingModes
do ispecie = 1, getNumberOfTracersInMode(coagulatingMode(iCoagulator))

l_index_donor = getTracerIndex(coagulatingMode(iCoagulator) , ispecie ,.true.)

!so4_a1 is a process mode (condensate), but is still lost in coagulation
if( .NOT. is_process_mode(l_index_donor, .true.) &
.OR. ( (l_index_donor.eq.chemistryIndex(l_so4_a1)) .AND. &
coagulatingMode(iCoagulator) .eq. MODE_IDX_OMBC_INTMIX_COAT_AIT) ) then
if( .NOT. is_process_mode(l_index_donor, .true.) .or. &
( (l_index_donor == chemistryIndex(l_so4_a1)) .and. &
coagulatingMode(iCoagulator) == MODE_IDX_OMBC_INTMIX_COAT_AIT) ) then

l_index_donor = getTracerIndex(coagulatingMode(iCoagulator) , ispecie,.true. )

Expand Down Expand Up @@ -639,13 +638,14 @@ subroutine clcoag(q, pmid, pdel, temperature, cldnum, cldfrc, delt_inverse, ncol

!process modes don't change mode except so4 condensate which becomes coagulate instead
!assumed to have same sink as MODE_IDX_OMBC_INTMIX_AIT
if( .NOT. is_process_mode(l_index_donor,.true.) &
.OR. ( (l_index_donor.eq.chemistryIndex(l_so4_a1)) .AND. modeIndexCoagulator .eq. MODE_IDX_OMBC_INTMIX_COAT_AIT) ) then
if( .NOT. is_process_mode(l_index_donor,.true.) .or. &
( (l_index_donor == chemistryIndex(l_so4_a1)) .and. &
modeIndexCoagulator == MODE_IDX_OMBC_INTMIX_COAT_AIT) ) then
Comment on lines +642 to +643
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are parentheses around the first equality check but not the second one. Something to fix someday?


!Done summing total loss of this coagulating specie
cloudLoss(i,k,l_index_donor) = coagulationSink & !loss rate for a mode in [1/s] summed over all receivers
* cldfrc(i,k)*q(i,k,l_index_donor) & !* mixing ratio ==> MMR/s
/ delt_inverse ! seconds ==> MMR
cloudLoss(i,k,l_index_donor) = coagulationSink & !loss rate for a mode in [1/s] summed over all receivers
* cldfrc(i,k)*q(i,k,l_index_donor) & !* mixing ratio ==> MMR/s
/ delt_inverse !/ seconds ==> MMR

!Can not loose more than we have
! At present day assumed lost within the cloud
Expand All @@ -659,15 +659,15 @@ subroutine clcoag(q, pmid, pdel, temperature, cldnum, cldfrc, delt_inverse, ncol
end do ! i
end do ! k

!UPDATE THE TRACERS AND DO DIAGNOSTICS
! UPDATE THE TRACERS AND DO DIAGNOSTICS
do iCoagulator = 1, numberOfCoagulatingModes
do ispecie = 1, getNumberOfTracersInMode(coagulatingMode(iCoagulator))
l_index_donor = getTracerIndex(coagulatingMode(iCoagulator) , ispecie ,.true.)

!so4_a1 is a process mode (condensate), but is still lost in coagulation
if( .NOT. is_process_mode(l_index_donor, .true.) &
.OR. ( (l_index_donor.eq.chemistryIndex(l_so4_a1)) .AND. coagulatingMode(iCoagulator) &
.eq. MODE_IDX_OMBC_INTMIX_COAT_AIT) ) then
if( .NOT. is_process_mode(l_index_donor, .true.) .or. &
( (l_index_donor == chemistryIndex(l_so4_a1)) .and. &
coagulatingMode(iCoagulator) == MODE_IDX_OMBC_INTMIX_COAT_AIT) ) then
Comment on lines +668 to +670
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are parentheses around the first equality check but not the second one. Something to fix someday?


l_index_donor = getTracerIndex(coagulatingMode(iCoagulator), ispecie, .true.)

Expand Down
16 changes: 3 additions & 13 deletions src/oslo_aero_nucleate_ice.F90
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ module oslo_aero_nucleate_ice
use tropopause, only: tropopause_findChemTrop
use cam_logfile, only: iulog
use cam_abortutils, only: endrun
use time_manager, only: is_first_step
use nucleate_ice, only: nucleati_init, nucleati ! portable module
!
use oslo_aero_share, only: l_dst_a2, l_dst_a3, MODE_IDX_DST_A2, MODE_IDX_DST_A3, rhopart, qqcw_get_field
Expand Down Expand Up @@ -164,13 +163,6 @@ subroutine nucleate_ice_oslo_init(mincld_in, bulk_scale_in)
mincld = mincld_in
bulk_scale = bulk_scale_in

! TODO: IS this necessary?
! if (is_first_step()) then
! call pbuf_set_field(pbuf, naai_idx, 0.0_r8)
! end if

! Initialize naai.

if( masterproc ) then
write(iulog,*) 'nucleate_ice parameters:'
write(iulog,*) ' mincld = ', mincld_in
Expand Down Expand Up @@ -299,16 +291,14 @@ subroutine nucleate_ice_oslo_calc( state, wsubi, pbuf, dtime, ptend, numberConce
real(r8), pointer :: qi(:,:) ! cloud ice mixing ratio (kg/kg)
real(r8), pointer :: ni(:,:) ! cloud ice number conc (1/kg)
real(r8), pointer :: pmid(:,:) ! pressure at layer midpoints (pa)

real(r8), pointer :: cld_dst_a2(:,:) ! mmr cld dst a2
real(r8), pointer :: cld_dst_a3(:,:) ! mass m.r. of coarse dust
real(r8), pointer :: ast(:,:)
real(r8) :: icecldf(pcols,pver) ! ice cloud fraction
real(r8), pointer :: qsatfac(:,:) ! Subgrid cloud water saturation scaling factor.

real(r8), pointer :: cld_dst_a2(:,:) ! mmr cld dst a2
real(r8), pointer :: cld_dst_a3(:,:) ! mass m.r. of coarse dust

real(r8) :: icecldf(pcols,pver) ! ice cloud fraction
real(r8) :: rho(pcols,pver) ! air density (kg m-3)

real(r8) :: qs(pcols) ! liquid-ice weighted sat mixing rat (kg/kg)
real(r8) :: es(pcols) ! liquid-ice weighted sat vapor press (pa)
real(r8) :: gammas(pcols) ! parameter for cond/evap of cloud water
Expand Down
10 changes: 5 additions & 5 deletions src/oslo_aero_ocean.F90
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module oslo_aero_ocean

! Public interfaces
public :: oslo_aero_ocean_init ! initializing, reading file
public :: oslo_aero_ocean_time ! time interpolation
public :: oslo_aero_ocean_adv ! spatial and time interpolation
public :: oslo_aero_dms_emis ! calculate dms surface emissions
public :: oslo_aero_dms_inq ! logical function which tells mo_srf_emis what to do
public :: oslo_aero_opom_emis ! calculate opom surface emissions
Expand All @@ -58,7 +58,7 @@ module oslo_aero_ocean
integer :: dms_cycle_yr = 0 !will be collected from NAMELIST

!will be collected from NAMELIST - but can be overwritten by atm_import_export if the ocean is sending DMS to the atm
character(len=20), public :: dms_source = 'emission_file'
character(len=20), public :: dms_source = 'emission_file'
!
character(len=16) :: opomo_fld_name = 'chlor_a' !not set from namelist, hard coded, name of nc var
character(len=16) :: opomn_fld_name = 'poc' !not set from namelist, hard coded, name of nc var
Expand Down Expand Up @@ -189,7 +189,7 @@ subroutine oslo_aero_ocean_init()
endsubroutine oslo_aero_ocean_init

!===============================================================================
subroutine oslo_aero_ocean_time(state, pbuf2d)
subroutine oslo_aero_ocean_adv(state, pbuf2d)

! Interpolate ocean_species in space and time to model grid and time

Expand All @@ -204,7 +204,7 @@ subroutine oslo_aero_ocean_time(state, pbuf2d)
call advance_trcdata( oceanspcs(m)%fields, oceanspcs(m)%file, state, pbuf2d )
end do

endsubroutine oslo_aero_ocean_time
endsubroutine oslo_aero_ocean_adv

!===============================================================================
subroutine oslo_aero_dms_emis(ncol, lchnk, u, v, zm, ocnfrc, icefrc, sst, fdms, cflx)
Expand All @@ -219,7 +219,7 @@ subroutine oslo_aero_dms_emis(ncol, lchnk, u, v, zm, ocnfrc, icefrc, sst, fdms,
real(r8) , intent(in) :: icefrc(pcols)
real(r8) , intent(in) :: sst(pcols)
real(r8) , intent(in) :: fdms(pcols)
real(r8) , intent(inout) :: cflx(pcols,pcnst)
real(r8) , intent(inout) :: cflx(pcols,pcnst)

! local variables
real(r8) :: u10m(pcols) ! [m/s]
Expand Down
Loading