From 1979117eaa41f1965f44c7bba80cab84dba8178f Mon Sep 17 00:00:00 2001 From: Austin Blevins Date: Thu, 1 Apr 2021 12:46:22 -0400 Subject: [PATCH] currently doesn't read the correct line of real crater list.. --- .../global-lunar-bombardment/craterlist.in | 4 +-- examples/global-lunar-bombardment/ctem.in | 4 +-- src/crater/crater_populate.f90 | 27 ++++++++++++++++--- src/globals/module_globals.f90 | 5 +++- src/io/io_read_craterlist.f90 | 19 ++++++------- src/io/module_io.f90 | 3 +-- 6 files changed, 42 insertions(+), 20 deletions(-) diff --git a/examples/global-lunar-bombardment/craterlist.in b/examples/global-lunar-bombardment/craterlist.in index 8a9e1669..d7d21187 100644 --- a/examples/global-lunar-bombardment/craterlist.in +++ b/examples/global-lunar-bombardment/craterlist.in @@ -1,3 +1,3 @@ # imp vel ang xoff yoff t_Ga -90856.5 15.0e3 90.0 -5.17529e5 1.037286e6 3.85 -18095.0 15.0e3 90.0 -9.38629e5 1.3466084e6 3.65 \ No newline at end of file +90856.5 15.0e3 90.0 -5.17529e5 1.037286e6 2.00 +18095.0 15.0e3 90.0 -9.38629e5 1.3466084e6 1.00 \ No newline at end of file diff --git a/examples/global-lunar-bombardment/ctem.in b/examples/global-lunar-bombardment/ctem.in index 0a1b45e1..c97d8488 100755 --- a/examples/global-lunar-bombardment/ctem.in +++ b/examples/global-lunar-bombardment/ctem.in @@ -16,8 +16,8 @@ realcraterlist craterlist.in ! list of 'real' craters for Quas ! IDL driver in uts -interval 5.86055 -numintervals 100 ! Total number of intervals (total time = interval * numintervals) <--when runtype is 'single' +interval 4.0 +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)) popupconsole F ! Pop up console window every output interval diff --git a/src/crater/crater_populate.f90 b/src/crater/crater_populate.f90 index 7d519ac7..9858732c 100644 --- a/src/crater/crater_populate.f90 +++ b/src/crater/crater_populate.f90 @@ -30,7 +30,7 @@ subroutine crater_populate(user,surf,crater,domain,prod,production_list,vdist,nt implicit none ! Arguments - type(usertype),intent(in) :: user + type(usertype),intent(inout) :: user type(surftype),dimension(:,:),intent(inout) :: surf type(cratertype),intent(inout) :: crater type(domaintype),intent(inout) :: domain @@ -98,6 +98,14 @@ subroutine crater_populate(user,surf,crater,domain,prod,production_list,vdist,nt write(*,*) "Maximum crater diameter: ",domain%biggest_crater end if + ! read initial quasi-MC position + if (user%doquasimc) then + call io_read_craterlist(user,domain) + rccount = 1 + write(*,*) user%rctime + write(*,*) domain%rcnum + end if + ! create crater population cmin = domain%biggest_crater @@ -135,9 +143,20 @@ subroutine crater_populate(user,surf,crater,domain,prod,production_list,vdist,nt crater%timestamp = real(curyear + real(icrater,kind=DP) / real(ntotcrat,kind=DP) * user%interval,kind=SP) pbarpos = nint(real(icrater) / real(ntotcrat) * PBARRES) !if in quasiMC mode: check to see if it's time for a real crater - !if (user%doquasimc) then - - !end if + if (user%doquasimc) then + if (crater%timestamp > user%rctime) then + write(*,*) "real crater @ ", crater%timestamp + ! add the code to emplace the test crater here + call io_read_craterlist(user, domain) + rccount = rccount + 1 + write(*,*) user%rctime + write(*,*) rccount + if (rccount > domain%rcnum) then + write(*,*) "real crater list complete." + user%rctime = 1e30 + end if + end if + end if ! generate random crater call crater_generate(user,crater,domain,prod,production_list,vdist,surf) if (user%testflag) write(*,*) 'Dcrat = ',crater%fcrat diff --git a/src/globals/module_globals.f90 b/src/globals/module_globals.f90 index e59a245f..686f6e47 100644 --- a/src/globals/module_globals.f90 +++ b/src/globals/module_globals.f90 @@ -214,7 +214,7 @@ module module_globals real(DP) :: testyoffset ! Offset of test crater from center in y direction (m) logical :: tallyonly ! Only run the tally routine (don't generate any new craters) logical :: testtally ! Set to T to count all non-cookie cut craters, regardless of score - real(DP) :: rctime ! time (in interval units) for emplacement of quasi-MC crater. Default 1E30 (aka never emplace real crater) + real(DP) :: rctime ! time (in interval units) for emplacement of quasi-MC crater ! IDL driver variables character(STRMAX) :: impfile ! Name of impactor size distribution file (impacts per m^2 per y) @@ -331,4 +331,7 @@ module module_globals integer(I4B),parameter :: rayq = 4 real(DP),parameter :: rayfmult = (5)**(-4.0_DP / (1.2_DP)) +! quasi-MC test variables +integer(I4B) :: rccount !start line to be read for quasi-MC (should be 0) + end module module_globals diff --git a/src/io/io_read_craterlist.f90 b/src/io/io_read_craterlist.f90 index 138fc750..86f5880c 100644 --- a/src/io/io_read_craterlist.f90 +++ b/src/io/io_read_craterlist.f90 @@ -11,9 +11,9 @@ ! Arguments : ! ! Output -! Arguments : rclist : List of 'real' craters to read in +! Arguments : ! -! Notes : +! Notes : only reads needed line [WIP] ! !********************************************************************************************************************************** subroutine io_read_craterlist(user, domain) @@ -40,13 +40,14 @@ subroutine io_read_craterlist(user, domain) end if - do i=1,domain%rcnum - read(LUN,*,iostat=ierr) user%testimp, user%testvel, user%testang, user%testxoffset, user%testyoffset, user%rctime - if (ierr/=0) then - write(*,*) "Unable to read file ",trim(rcfile) - stop - end if - end do + !do i=0,rccount + !read(LUN,*) + read(LUN,*,iostat=ierr) user%testimp, user%testvel, user%testang, user%testxoffset, user%testyoffset, user%rctime + if (ierr/=0) then + write(*,*) "Unable to read file ",trim(rcfile) + stop + end if + !end do end subroutine io_read_craterlist diff --git a/src/io/module_io.f90 b/src/io/module_io.f90 index d3d36f60..fc1d69e3 100644 --- a/src/io/module_io.f90 +++ b/src/io/module_io.f90 @@ -122,10 +122,9 @@ end subroutine io_read_prod end interface interface - subroutine io_read_craterlist(rclist,user,domain) + subroutine io_read_craterlist(user,domain) use module_globals implicit none - real(DP),dimension(:,:),intent(out) :: rclist type(usertype),intent(in) :: user type(domaintype),intent(in) :: domain end subroutine io_read_craterlist