Skip to content
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 change: 1 addition & 0 deletions src/ModInputs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ module ModInputs
real :: MaxEField = 0.1
! Lower limit on ion density
real :: MinIonDensity = 100.0
real :: MinIonDensityAdvect = 1e5

!\
! Methods for completing chemistry
Expand Down
10 changes: 6 additions & 4 deletions src/calc_electron_temperature.Earth.f90
Original file line number Diff line number Diff line change
Expand Up @@ -355,16 +355,18 @@ subroutine calc_electron_ion_temperature(iBlock)
where (etemp .LT. tn) etemp = tn
where (etemp .GT. 6000.) etemp = 6000.

eTemperature(1:nLons, 1:nLats, 0:nAlts + 1, iBlock) = etemp(1:nLons, 1:nLats, 0:nAlts + 1)
eTemperature(1:nLons, 1:nLats, -1, iBlock) = etemp(1:nLons, 1:nLats, 0)
eTemperature(1:nLons, 1:nLats, 1:nAlts + 1, iBlock) = etemp(1:nLons, 1:nLats, 1:nAlts + 1)
eTemperature(1:nLons, 1:nLats, 0, iBlock) = Temperature(1:nLons, 1:nLats, 0, iBlock)*TempUnit(1:nLons, 1:nLats, 0)
eTemperature(1:nLons, 1:nLats, -1, iBlock) = Temperature(1:nLons, 1:nLats, -1, iBlock)*TempUnit(1:nLons, 1:nLats, -1)
eTemperature(1:nLons, 1:nLats, nAlts + 2, iBlock) = etemp(1:nLons, 1:nLats, nAlts + 1)

where (itemp .GT. tipct*etemp) itemp = tipct*etemp
where (itemp .LT. tn) itemp = tn
where (itemp .GT. 6000.) itemp = 6000.

iTemperature(1:nLons, 1:nLats, 0:nAlts + 1, iBlock) = itemp(1:nLons, 1:nLats, 0:nAlts + 1)
iTemperature(1:nLons, 1:nLats, -1, iBlock) = itemp(1:nLons, 1:nLats, 0)
iTemperature(1:nLons, 1:nLats, 1:nAlts + 1, iBlock) = itemp(1:nLons, 1:nLats, 1:nAlts + 1)
iTemperature(1:nLons, 1:nLats, 0, iBlock) = Temperature(1:nLons, 1:nLats, 0, iBlock)*TempUnit(1:nLons, 1:nLats, 0)
iTemperature(1:nLons, 1:nLats, -1, iBlock) = Temperature(1:nLons, 1:nLats, -1, iBlock)*TempUnit(1:nLons, 1:nLats, -1)
iTemperature(1:nLons, 1:nLats, nAlts + 2, iBlock) = itemp(1:nLons, 1:nLats, nAlts + 1)

call report("done with calc_electron_temperature", 2)
Expand Down
44 changes: 31 additions & 13 deletions src/check_for_nans.f90
Original file line number Diff line number Diff line change
Expand Up @@ -152,28 +152,46 @@ subroutine correct_min_ion_density

use ModSizeGitm
use ModGitm
use ModInputs, only: minIonDensity, iDebugLevel
use ModInputs, only: minIonDensity, minIonDensityAdvect, iDebugLevel
implicit none
integer :: iLon, iLat, iAlt, iIon

if (minval(IDensityS) < MinIonDensity) then
if (iDebugLevel > 5) &
write(*, *) "low ion density found... replacing with min ion density"
do iIon = 1, nIons
if (minval(IDensityS(:, :, :, iIon, 1)) < MinIonDensity) then
do iLon = -1, nLons + 2
do iLat = -1, nLats + 2
do iAlt = -1, nAlts + 2
if (iDensityS(iLon, iLat, iAlt, iIon, 1) < MinIonDensity) then
if (iDebugLevel > 7) &
write(*, *) ' -> low density found in iDensityS : ', &
iLon, iLat, iAlt, iProc, iIon, iDensityS(iLon, iLat, iAlt, iIon, 1), &
MinIonDensity
iDensityS(iLon, iLat, iAlt, iIon, 1) = MinIonDensity
endif
if (iIon > nIonsAdvect) then
if (minval(IDensityS(:, :, :, iIon, 1)) < MinIonDensity) then
do iLon = -1, nLons + 2
do iLat = -1, nLats + 2
do iAlt = -1, nAlts + 2
if (iDensityS(iLon, iLat, iAlt, iIon, 1) < MinIonDensity) then
if (iDebugLevel > 7) &
write(*, *) ' -> low density found in iDensityS : ', &
iLon, iLat, iAlt, iProc, iIon, iDensityS(iLon, iLat, iAlt, iIon, 1), &
MinIonDensity
iDensityS(iLon, iLat, iAlt, iIon, 1) = MinIonDensity
endif
enddo
enddo
enddo
enddo
endif
else
if (minval(IDensityS(:, :, :, iIon, 1)) < MinIonDensityAdvect) then
do iLon = -1, nLons + 2
do iLat = -1, nLats + 2
do iAlt = -1, nAlts + 2
if (iDensityS(iLon, iLat, iAlt, iIon, 1) < MinIonDensityAdvect) then
if (iDebugLevel > 7) &
write(*, *) ' -> low density found in iDensityS : ', &
iLon, iLat, iAlt, iProc, iIon, iDensityS(iLon, iLat, iAlt, iIon, 1), &
MinIonDensity
iDensityS(iLon, iLat, iAlt, iIon, 1) = MinIonDensityAdvect
endif
enddo
enddo
enddo
endif
endif
enddo
endif
Expand Down
14 changes: 7 additions & 7 deletions src/get_potential.f90
Original file line number Diff line number Diff line change
Expand Up @@ -537,22 +537,22 @@ subroutine set_ie_indices(IEModel_, TimeIn)
if (iError /= 0) call set_error("Issue reading IMF file in get_potential")

call get_IMF_Bz(TimeIn + TimeDelayHighLat, val, iError)
if (val < -50.0) val = -50.0
if (val > 50.0) val = 50.0
if (val < -40.0) val = -40.0
if (val > 40.0) val = 40.0
call IEModel_%imfBz(val)

call get_IMF_By(TimeIn, val, iError)
if (val < -50.0) val = -50.0
if (val > 50.0) val = 50.0
if (val < -40.0) val = -40.0
if (val > 40.0) val = 40.0
call IEModel_%imfBy(val)

call get_SW_V(TimeIn, val, iError)
if (val < -1800.0) val = -1800.0
if (val > 1800.0) val = 1800.0
if (val < -1500.0) val = -1500.0
if (val > 1500.0) val = 1500.0
call IEModel_%swV(val)

call get_SW_N(TimeIn, val, iError)
if (val > 80) val = 80
if (val > 80) val = 50
call IEModel_%swN(val)

if (iError /= 0 .or. .not. isOk) then
Expand Down
2 changes: 2 additions & 0 deletions src/logfile.f90
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ subroutine write_code_information(dir)
write(iCodeInfoFileUnit_, *) "#IONLIMITS"
write(iCodeInfoFileUnit_, *) MaxVParallel
write(iCodeInfoFileUnit_, *) MaxEField
write(iCodeInfoFileUnit_, *) MinIonDensity
write(iCodeInfoFileUnit_, *) MinIonDensityAdvect
write(iCodeInfoFileUnit_, *) ""

write(iCodeInfoFileUnit_, *) "#VERTICALSOURCES"
Expand Down
2 changes: 2 additions & 0 deletions src/set_inputs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -910,13 +910,15 @@ subroutine set_inputs
call read_in_real(MaxVParallel, iError)
call read_in_real(MaxEField, iError)
call read_in_real(MinIonDensity, iError)
call read_in_real(MinIonDensityAdvect, iError)
if (iError /= 0) then
write(*, *) 'Incorrect format for #IONLIMITS:'
write(*, *) ''
write(*, *) '#IONLIMITS'
write(*, *) "MaxVParallel (real, default=100 m/s)"
write(*, *) "MaxEField (real, default=0.1 V/m)"
write(*, *) "MinIonDensity (real, default=100 m^-3)"
write(*, *) "MinIonDensityAdvect (real, default=1e5 m^-3)"
IsDone = .true.
endif

Expand Down
1 change: 1 addition & 0 deletions srcDoc/set_inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ code to sync up a LOT.
MaxVParallel (real, default=100 m/s)
MaxEField (real, default=0.1 V/m)
MinIonDensity (real, default=100 m^-3)
MinIonDensityAdvect (real, default=1e5 m^-3)

### PHOTOELECTRON

Expand Down
1 change: 1 addition & 0 deletions srcTests/auto_test/UAM.in.03.IonLowerLimit.test
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ T Shift the [O] density at the lower boundary by 6 months
100 # max Vparallel
0.1 # max E-field
1e8 # min ion density - absurdly high, but good to test.
1e10 # min advected ion density

#AUSMSOLVER
T Use AUSM+-up Solvers
Expand Down
Loading
Loading