mirror of
https://github.com/JHUAPL/kaiju.git
synced 2026-01-10 07:38:00 -05:00
Fixing bug in precip flux accumulation. Bug fix in CC tau calculation
This commit is contained in:
@@ -9,6 +9,12 @@ module raijuLoss_CC
|
||||
|
||||
type, extends(baseRaijuLoss_T) :: raiLoss_CC_T
|
||||
logical :: reqsGood = .false.
|
||||
|
||||
! Idea: Have a local 3D copy of our taus and heat fluxes
|
||||
! On step update, zero out locals and populate tau array. calcTau just returns already calculated value for this time step
|
||||
! Additiona subroutine "AccumHeatFlux" will accum in local head flux array
|
||||
! Then IO can reach in here for these outputs if desired
|
||||
|
||||
contains
|
||||
|
||||
procedure :: doInit => CCLossInit
|
||||
@@ -76,7 +82,7 @@ module raijuLoss_CC
|
||||
associate(spc => Grid%spc(Grid%k2spc(k)))
|
||||
psphIdx = spcIdx(Grid, F_PSPH)
|
||||
tau = CCTau(spc%spcType, Grid%alamc(k), &
|
||||
State%bVol(i,j)**(-2./3.), State%Den(i,j,1+psphIdx)) ! Add 1 cause we're grabbing from density, which has bulk as first element
|
||||
State%bvol_cc(i,j)**(-2./3.), State%Den(i,j,1+psphIdx)) ! Add 1 cause we're grabbing from density, which has bulk as first element
|
||||
end associate
|
||||
|
||||
end function CCLossCalcTau
|
||||
|
||||
@@ -149,8 +149,8 @@ module raijuAdvancer
|
||||
! Divide losses and precip fluxes by big dt to turn them into proper rates
|
||||
State%precipNFlux(:,:,k) = State%precipNFlux(:,:,k)/State%dt
|
||||
State%precipEFlux(:,:,k) = State%precipEFlux(:,:,k)/State%dt
|
||||
State%dEta_dt(:,:,k) = State%dEta_dt(:,:,k)/State%dt
|
||||
State%CCHeatFlux(:,:,k) = State%CCHeatFlux(:,:,k)/State%dt
|
||||
State%dEta_dt(:,:,k) = State%dEta_dt (:,:,k)/State%dt
|
||||
State%CCHeatFlux(:,:,k) = State%CCHeatFlux (:,:,k)/State%dt
|
||||
endif
|
||||
|
||||
State%nStepk(k) = State%nStepk(k) + n
|
||||
|
||||
@@ -206,7 +206,8 @@ module raijulosses
|
||||
! Then calculate precipitation flux using lossRatesPrecip
|
||||
deleta = eta0*(1.0-exp(-dt*State%lossRatesPrecip(i,j,k)))
|
||||
pNFlux = deleta2NFlux(deleta, Model%planet%rp_m, Grid%Brcc(i,j), dt)
|
||||
State%precipNFlux(i,j,k) = State%precipNFlux(i,j,k) + pNFlux
|
||||
! Just accumulate total #/cm2 and erg/cm2, we divide by coupling dt at the end of advance
|
||||
State%precipNFlux(i,j,k) = State%precipNFlux(i,j,k) + pNFlux*dt
|
||||
State%precipEFlux(i,j,k) = State%precipEFlux(i,j,k) + nFlux2EFlux(pNFlux, Grid%alamc(k), State%bVol_cc(i,j))
|
||||
|
||||
! Do special stuff for Coulomb collision effects
|
||||
@@ -216,8 +217,10 @@ module raijulosses
|
||||
! Treating this separately from precipication since its not actually precipitating ions
|
||||
tau = max(TINY, State%lps(State%lp_cc_idx)%p%calcTau(Model, Grid, State, i,j,k))
|
||||
deleta = eta0*(1.0 - exp(-dt/tau))
|
||||
pNFlux = deleta2NFlux(deleta, Model%planet%rp_m, Grid%Brcc(i,j), dt)
|
||||
State%CCHeatFlux(i,j,k) = State%CCHeatFlux(i,j,k) + nFlux2EFlux(pNFlux, Grid%alamc(k), State%bvol_cc(i,j))
|
||||
pNFlux = deleta2NFlux(deleta, Model%planet%rp_m, Grid%Brcc(i,j), dt)*dt
|
||||
! Just accumulate total #/cm2 and erg/cm2, we divide by coupling dt at the end of advance
|
||||
!State%CCHeatFlux(i,j,k) = State%CCHeatFlux(i,j,k) + nFlux2EFlux(pNFlux, Grid%alamc(k), State%bvol_cc(i,j))
|
||||
State%CCHeatFlux(i,j,k) = State%CCHeatFlux(i,j,k) + pNFlux*abs(Grid%alamc(k))*State%bVol_cc(i,j)**(-2./3.) ! [eV/cm2]
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
@@ -235,7 +238,7 @@ module raijulosses
|
||||
real(rp) :: deleta2NFlux
|
||||
|
||||
deleta2NFlux = (eta/sclEta) * (Rp_m*1.e2) * Bmag / dt
|
||||
!! (#/cm^3 * Rp/T * T/nT) * cm * nT / s = #/cm^2/s
|
||||
!! ((#/cm^3 * Rp/T) * T/nT) * cm * nT / s = #/cm^2/s
|
||||
|
||||
end function deleta2NFlux
|
||||
|
||||
|
||||
Reference in New Issue
Block a user