eagles-project / mam4xx

A C++ implementation of MAM4
https://eagles-project.github.io/mam4xx/
Other
6 stars 6 forks source link

Conflicting and Absent Definitions for Physical Quantities #157

Closed mjs271 closed 1 year ago

mjs271 commented 1 year ago

In working on the port of a few pieces of aero_model.F90, it is unclear to me what a couple of quantities are. Namely, volume mixing ratio is "defined" at the top of the aero_model_gasaerexch() subroutine as:

real(r8), intent(in) :: vmr0(:,:,:)       ! initial mixing ratios (before gas-phase chem changes) [vmr or mol/mol]
real(r8), intent(inout) :: vmr(:,:,:)     ! mixing ratios [vmr or mol/mol]

Also, I cannot find a satisfactory definition for adv_mass, which appears to be a molecular weight based on usage

subroutine qqcw2vmr(vmr, mbar, fldcw_all)
  !-----------------------------------------------------------------
  ! ... Xfrom from mass to volume mixing ratio
  ! C++ porting: this subroutine is similar to the subroutine mmr2vmr
  ! in mozart/mo_mass_xforms.F90. Maybe can merge them
  ! Note that the subroutine needs adv_mass from module chem_mod,
  ! but the values are assigned from module mo_sim_dat
  !-----------------------------------------------------------------

  implicit none

  !-----------------------------------------------------------------
  ! ... Dummy args
  !-----------------------------------------------------------------
  real(r8), intent(in)    :: mbar(:,:) ! mean wet atmospheric mass [g/mol]
  real(r8), intent(in)    :: fldcw_all(:,:,:) ! mass mixing ratio [kg/kg]
  real(r8), intent(out)   :: vmr(:,:,:) ! volume mixing ratios [mol/mol]

  !-----------------------------------------------------------------
  ! ... Local variables
  !-----------------------------------------------------------------
  integer  :: kk, mm

  vmr(:,:,:) = 0.0_r8
  do mm=1,gas_pcnst
     if( adv_mass(mm) /= 0._r8 ) then
        do kk=1,pver
           vmr(:,kk,mm) = mbar(:,kk) * fldcw_all(:,kk,mm) / adv_mass(mm)
        enddo
     endif
  enddo
end subroutine qqcw2vmr

and the one spot I could find associated units in chemistry.F90:

megan_wght_factors(n) = adv_mass(ii)*1.e-3_r8 ! kg/moles (to convert moles/m2/sec to kg/m2/sec)

Some things I learned while searching:

As best I can tell from doing global searches of the mam4_refactor code base:

@pbosler @singhbalwinder @pressel @jeff-cohere

mjs271 commented 1 year ago

I did some digging around and in chatting with the the eagle-eyed @odiazib, he noticed that the values of adv_mass that are set in mo_sim_dat.F90 are, in fact, molecular weights of the aerosol species. As to the rest of the discussion here, I think it makes the most sense to close this and continue in the related issue #152.