From d0b981b4117b9445a97a6adfe350805acb688cac Mon Sep 17 00:00:00 2001 From: Austin Blevins Date: Mon, 19 Apr 2021 17:42:09 -0400 Subject: [PATCH] lat and long now required for real crater list (assumes 3.08e3 m pixel size) --- .../global-lunar-bombardment/craterlist.in | 17 ++++-- examples/global-lunar-bombardment/ctem.in | 8 +-- .../global-lunar-bombardment/ctem_driver.py | 25 ++++++++- examples/global-lunar-bombardment/scale.ipynb | 52 +++++++++++++------ src/crater/crater_populate.f90 | 4 +- 5 files changed, 79 insertions(+), 27 deletions(-) diff --git a/examples/global-lunar-bombardment/craterlist.in b/examples/global-lunar-bombardment/craterlist.in index e69d09d4..04a821cf 100644 --- a/examples/global-lunar-bombardment/craterlist.in +++ b/examples/global-lunar-bombardment/craterlist.in @@ -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 \ No newline at end of file diff --git a/examples/global-lunar-bombardment/ctem.in b/examples/global-lunar-bombardment/ctem.in index 6ed56192..a4288dfc 100755 --- a/examples/global-lunar-bombardment/ctem.in +++ b/examples/global-lunar-bombardment/ctem.in @@ -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 @@ -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)) diff --git a/examples/global-lunar-bombardment/ctem_driver.py b/examples/global-lunar-bombardment/ctem_driver.py index bd09e69a..ea3e738a 100644 --- a/examples/global-lunar-bombardment/ctem_driver.py +++ b/examples/global-lunar-bombardment/ctem_driver.py @@ -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 @@ -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 diff --git a/examples/global-lunar-bombardment/scale.ipynb b/examples/global-lunar-bombardment/scale.ipynb index 9bed3d3c..ccf1059f 100644 --- a/examples/global-lunar-bombardment/scale.ipynb +++ b/examples/global-lunar-bombardment/scale.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -14,7 +14,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -23,7 +23,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -129,7 +129,7 @@ "[1418 rows x 2 columns]" ] }, - "execution_count": 4, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -140,16 +140,16 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[]" + "[]" ] }, - "execution_count": 5, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" }, @@ -172,16 +172,16 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[]" + "[]" ] }, - "execution_count": 6, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" }, @@ -207,7 +207,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -217,7 +217,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -228,7 +228,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -237,7 +237,7 @@ "192832.5674475569" ] }, - "execution_count": 15, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -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": { diff --git a/src/crater/crater_populate.f90 b/src/crater/crater_populate.f90 index b49e70ea..bec41e7f 100644 --- a/src/crater/crater_populate.f90 +++ b/src/crater/crater_populate.f90 @@ -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