Skip to content
Open
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
32 changes: 32 additions & 0 deletions MOSAIC_v2/aerosol/module_mosaic_ext.f90
Original file line number Diff line number Diff line change
Expand Up @@ -803,13 +803,42 @@ subroutine calculate_XT(ibin,jp,XT,aer)
else
XT = -1.0
endif
call snap_XT(XT) ! XT within roundoff of 2 or 1 -> 2 or 1


return
end subroutine calculate_XT



!***********************************************************************
! sets the sulfate ratio XT to exactly 2 or 1 when it is within a relative
! xt_snap_rtol (module_data_mosaic_aero) of that regime boundary, so that a
! neutral (or exactly bisulfate) particle whose ratio is off by roundoff
! gets the same regime in every routine that tests XT (MESA,
! compute_activities, ions_to_electrolytes, MESA_estimate_eleliquid,
! form_electrolytes, conform_electrolytes, and the ASTEM routines that
! use their XT). Applied wherever XT is computed from the ions.
!-----------------------------------------------------------------------
subroutine snap_XT(XT)
use module_data_mosaic_aero, only: r8, xt_snap_rtol

implicit none

! subr arguments
real(r8), intent(inout) :: XT

if(abs(XT - 2.0_r8) .le. 2.0_r8*xt_snap_rtol)then
XT = 2.0_r8
elseif(abs(XT - 1.0_r8) .le. xt_snap_rtol)then
XT = 1.0_r8
endif

return
end subroutine snap_XT



!***********************************************************************
! called when aerosol bin is completely solid.
!
Expand Down Expand Up @@ -2434,6 +2463,7 @@ subroutine ions_to_electrolytes(jp,ibin,XT,aer,electrolyte,zc,za,xeq_a,na_Ma,
else
XT = -1.0
endif
call snap_XT(XT) ! XT within roundoff of 2 or 1 -> 2 or 1



Expand Down Expand Up @@ -3821,6 +3851,7 @@ subroutine form_electrolytes(jp,ibin,XT,aer,gas,electrolyte,total_species,tot_cl
else
XT = -1.0
endif
call snap_XT(XT) ! XT within roundoff of 2 or 1 -> 2 or 1



Expand Down Expand Up @@ -5357,6 +5388,7 @@ subroutine conform_electrolytes(jp,ibin,XT,aer,gas,electrolyte,total_species,tot
else
XT = -1.0
endif
call snap_XT(XT) ! XT within roundoff of 2 or 1 -> 2 or 1


! if(XT .ge. 1.9999 .or. XT.lt.0.)then ! RAZ 11/10/2014
Expand Down
13 changes: 13 additions & 0 deletions MOSAIC_v2/datamodules/module_data_mosaic_aero.f90
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,19 @@ module module_data_mosaic_aero
! will most likely reside in a minor fraction of the particles of the bin,
! and should not control the bin aerosol water. (value = 0.0 in previous versions of mosaic)

real(r8), parameter :: xt_snap_rtol = 1.0e-9_r8
! The sulfate ratio XT = (NH4 + Na + 2 Ca)/(SO4 + MSA/2) selects the
! sulfate-poor (XT >= 2) or sulfate-rich (XT < 2) treatment, and XT < 1
! the excess-sulfate case, in several routines. An exactly neutral
! particle (e.g. NH4 = 2 SO4) can come out a few units of roundoff on
! either side of 2 after a mass <-> mole conversion, and would then take
! either branch at random. snap_XT (module_mosaic_ext) sets XT to 2 or 1
! when it is within a relative xt_snap_rtol of it, so that every routine
! puts such a particle in the regime it is in exactly at the boundary.
! 1e-9 is about 1e7 times double-precision roundoff (1.1e-16) and far
! below any physically meaningful excess of cations or sulfate;
! 0 restores the exact comparisons.

integer, parameter :: no_aerosol = 0 ! flag
integer, parameter :: all_solid = 1 ! flag
integer, parameter :: all_liquid = 2 ! flag
Expand Down
Loading