Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
currently doesn't read the correct line of real crater list..
  • Loading branch information
Austin Blevins committed Apr 1, 2021
1 parent 54d4a22 commit 1979117
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 20 deletions.
4 changes: 2 additions & 2 deletions examples/global-lunar-bombardment/craterlist.in
Original file line number Diff line number Diff line change
@@ -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
90856.5 15.0e3 90.0 -5.17529e5 1.037286e6 2.00
18095.0 15.0e3 90.0 -9.38629e5 1.3466084e6 1.00
4 changes: 2 additions & 2 deletions examples/global-lunar-bombardment/ctem.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 23 additions & 4 deletions src/crater/crater_populate.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/globals/module_globals.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
19 changes: 10 additions & 9 deletions src/io/io_read_craterlist.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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


3 changes: 1 addition & 2 deletions src/io/module_io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1979117

Please sign in to comment.