Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
lat and long now required for real crater list (assumes 3.08e3 m pixel size)
  • Loading branch information
Austin Blevins committed Apr 19, 2021
1 parent ceb5809 commit d0b981b
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 27 deletions.
17 changes: 14 additions & 3 deletions examples/global-lunar-bombardment/craterlist.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Dcrat(m) vel ang xoff yoff t_Ga
1198390 18.3e3 45.0 -5.17529e5 1.037286e6 0.03
249840 18.3e3 45.0 -9.38629e5 1.3466084e6 0.02
# Dcrat(m) vel(m/s) ang(deg) lat(lunar_deg) yoff(lunar_deg) t(Ga)
900000 18.3e3 45.0 0.0 0.0 0.09
400000 18.3e3 45.0 30.0 -30.0 0.02
400000 18.3e3 45.0 -30.0 30.0 0.045
400000 18.3e3 45.0 30.0 30.0 0.04
400000 18.3e3 45.0 -30.0 -30.0 0.035
400000 18.3e3 45.0 60.0 0.0 0.03
400000 18.3e3 45.0 0.0 -20.0 0.01
500000 18.3e3 45.0 90.0 50.0 0.05
800000 18.3e3 45.0 -90.0 -115.0 0.08
600000 18.3e3 45.0 65.0 180.0 0.06
300000 18.3e3 45.0 -40.0 -180.0 0.01
700000 18.3e3 45.0 20.0 -310.0 0.07
500000 18.3e3 45.0 -70.0 350.0 0.056
8 changes: 4 additions & 4 deletions examples/global-lunar-bombardment/ctem.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

! Testing input. These are used to perform non-Monte Carlo tests.
testflag F ! Set to T to create a single crater with user-defined impactor properties
testimp 192832.5674475569 ! Diameter of test impactor (m)
testimp 186296.7168337693 ! Diameter of test impactor (m)
testvel 18.3e3 ! Velocity of test crater (m/s)
testang 45.0 ! Impact angle of test crater (deg) - Default 90.0
testxoffset 0.0e0 ! x-axis offset of crater center from grid center (m) - Default 0.0
testyoffset 0.0e0 ! y-axis offset of crater center from grid center (m) - Default 0.0
testxoffset -5.124646221681263e6 ! x-axis offset of crater center from grid center (m) - Default 0.0
testyoffset -1.6071375724799227e6 ! y-axis offset of crater center from grid center (m) - Default 0.0
tallyonly F ! Tally the craters without generating any craters
testtally F
quasimc T ! MC run constrained by non-MC 'real' craters given in a list
Expand All @@ -16,7 +16,7 @@ realcraterlist craterlist.in ! list of 'real' craters for Quas


! IDL driver in uts
interval 0.6
interval 0.1
numintervals 1 ! Total number of intervals (total time = interval * numintervals) <--when runtype is 'single'
restart F ! Restart a previous run
impfile NPFextrap.dat ! Impactor SFD rate file (col 1: Dimp (m), col 2: ! impactors > D (m**(-2) y**(-1))
Expand Down
25 changes: 24 additions & 1 deletion examples/global-lunar-bombardment/ctem_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
impfile = parameters['workingdir'] + parameters['impfile']
prodfunction = ctem_io_readers.read_formatted_ascii(impfile, skip_lines = 0)

#Read list of real craters and export to dat file for Fortran code
if (parameters['quasimc'] == 'T'):

#Read list of real craters
Expand All @@ -94,9 +93,33 @@
interp = interp1d(xnew, ynew, fill_value='extrapolate')
rclist[:,0] = numpy.exp(interp(numpy.log(rclist[:,0])))

#Convert latitude and longitude to y- and x-offset
for lat in range(0, len(rclist[:,3])):
if numpy.abs(rclist[lat,3]) > 90.0:
print("non-physical latitude on line %i of craterlist.in. Please enter a value between -90 and 90 degrees." %(lat+1))
quit()
else:
rclist[lat,3] = rclist[lat,3] * 3.42222222e4 #this calculation assumes the area being modeled is equal to the surface area of the Moon

for lon in range(0, len(rclist[:,4])):
if numpy.abs(rclist[lon,4]) > 360.0:
print("Non-physical longitude on line %i of craterlist.in. Please enter a value between -360 and 360 degrees." %(lon+1))
quit()
else:
if rclist[lon,4] < -180.0:
rclist[lon,4] = 360.0 - numpy.abs(rclist[lon,4])
elif rclist[lon,4] > 180.0:
rclist[lon,4] = -(360.0 - rclist[lon,4])
else:
rclist[lon,4] = rclist[lon,4]

rclist[:,4] = rclist[:,4] * 1.71111111e4 #this calculation assumes the area being modeled is equal to the surface area of the Moon

#Convert age in Ga to "interval time"
rclist[:,5] = (parameters['interval'] * parameters['numintervals']) - craterproduction.Tscale(rclist[:,5], 'NPF_Moon')
rclist = rclist[rclist[:,5].argsort()]

#Export to dat file for Fortran use
ctem_io_writers.write_realcraters(parameters, rclist)

#Create impactor production population
Expand Down
52 changes: 35 additions & 17 deletions examples/global-lunar-bombardment/scale.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -14,7 +14,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -23,7 +23,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -129,7 +129,7 @@
"[1418 rows x 2 columns]"
]
},
"execution_count": 4,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -140,16 +140,16 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x7fcf97f6fc10>]"
"[<matplotlib.lines.Line2D at 0x7feb017f2e50>]"
]
},
"execution_count": 5,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
},
Expand All @@ -172,16 +172,16 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x7fcf9823c9d0>]"
"[<matplotlib.lines.Line2D at 0x7feb019bedc0>]"
]
},
"execution_count": 6,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
},
Expand All @@ -207,7 +207,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -217,7 +217,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -228,7 +228,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 8,
"metadata": {},
"outputs": [
{
Expand All @@ -237,7 +237,7 @@
"192832.5674475569"
]
},
"execution_count": 15,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -262,12 +262,30 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"186296.7168337693"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.exp(interp(np.log(500000)))"
"np.exp(interp(np.log(2400000)))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
4 changes: 2 additions & 2 deletions src/crater/crater_populate.f90
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ subroutine crater_populate(user,surf,crater,domain,prod,production_list,vdist,nt
user%testimp = rclist(1, rccount)
user%testvel = rclist(2, rccount)
user%testang = rclist(3, rccount)
user%testxoffset = rclist(4, rccount)
user%testyoffset = rclist(5, rccount)
user%testxoffset = rclist(5, rccount) !x-offset is longitude
user%testyoffset = rclist(4, rccount) !y-offset is latitude
end if
end if
! generate random crater
Expand Down

0 comments on commit d0b981b

Please sign in to comment.