Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/allocatable_arrays' into allocat…
Browse files Browse the repository at this point in the history
…able_arrays
  • Loading branch information
Austin Blevins committed Dec 12, 2022
2 parents 2aad6a7 + 7734120 commit 46a8c08
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 36 deletions.
3 changes: 2 additions & 1 deletion examples/global-lunar-bombardment/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.jpg
*.png
*.out
surface_*
surface_*
temp.in
2 changes: 1 addition & 1 deletion python/ctem/ctem/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def __init__(self, param_file="ctem.in", isnew=True):
shutil.copy2(self.user['ctemfile'], tempfile )

#Write a temporary input file to generate the necessary quasimc files
util.write_temp_input(tempfile)
util.write_temp_input(self.user, tempfile)
util.write_datfile(self.user, self.output_filenames['dat'], self.seedarr)
self.compute_one_interval(ctemin=tempfile)
os.remove(tempfile)
Expand Down
4 changes: 2 additions & 2 deletions python/ctem/ctem/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,11 @@ def write_realcraters(filename, realcraters):

return

def write_temp_input(filename):
def write_temp_input(user, filename):
"""Makes changes to a temporary input file for use when generating craterlist.dat for quasimc runs"""

sed('testflag', 'testflag T!', filename)
sed('testimp', 'testimp 10 !', filename)
sed('testimp', f'testimp {user["pix"]*1e-3} !', filename) # Make a tiny test crater. We don't care about the crater itself, just that we run CTEM once to get all of the converted files
sed('quasimc', 'quasimc F!', filename)
sed('interval', 'interval 1 !', filename)
sed('numinterval 1 !s', 'numintervals 1 !', filename)
Expand Down
35 changes: 19 additions & 16 deletions src/crater/crater_populate.f90
Original file line number Diff line number Diff line change
Expand Up @@ -358,23 +358,26 @@ subroutine crater_populate(user,surf,crater,domain,prod,production_list,vdist,nt
end if
end do ! end crater production loop

if (ntrue > 0) then

call move_alloc(truelist, tmptruelist)
allocate(truelist(TRUECOLS,ntrue))
truelist(:,1:ntrue) = tmptruelist(:,1:ntrue)
deallocate(tmptruelist)

! Resize the true crater size array to the actual number of craters produced
! Display stats
ddmax = rmax / cmax
ddmin = rmin / cmin
rhpmax = rhmax / cmax
rhpmin = rhmin / cmin
write(*,*)
write(*,*) 'Minimum impactor diameter = ',imin
write(*,*) 'Maximum impactor diameter = ',imax
write(*,*) 'Minimum crater diameter = ',cmin,' d/D = ',ddmin,' r/D = ', rhpmin
write(*,*) 'Maximum crater diameter = ',cmax,' d/D = ',ddmax,' r/D = ', rhpmax
call move_alloc(truelist, tmptruelist)
allocate(truelist(TRUECOLS,ntrue))
truelist(:,1:ntrue) = tmptruelist(:,1:ntrue)
deallocate(tmptruelist)

! Resize the true crater size array to the actual number of craters produced
! Display stats
ddmax = rmax / cmax
ddmin = rmin / cmin
rhpmax = rhmax / cmax
rhpmin = rhmin / cmin
write(*,*)
write(*,*) 'Minimum impactor diameter = ',imin
write(*,*) 'Maximum impactor diameter = ',imax
write(*,*) 'Minimum crater diameter = ',cmin,' d/D = ',ddmin,' r/D = ', rhpmin
write(*,*) 'Maximum crater diameter = ',cmax,' d/D = ',ddmax,' r/D = ', rhpmax

end if

return
end subroutine crater_populate
34 changes: 18 additions & 16 deletions src/main/CTEM.f90
Original file line number Diff line number Diff line change
Expand Up @@ -135,23 +135,25 @@ program CTEM
call crater_tally_true(domain,truelist(:,1:ntrue),ntrue,truedist)
end if

write(*,*) "Tallying craters"
if (.not.user%tallyonly) then
write(*,*) "Total craters generated: ",ntotcrat
write(*,*) "Surface-affecting craters generated: ",ntrue
write(*,*) "Visible craters generated: ",vistrue
end if
call crater_tally_observed(user,surf,domain,nkilled,onum,obsdist,obslist,oposlist,depthdiam,degradation_state)
ntotkilled = ntotkilled + nkilled
write(*,*) 'Craters killed during tally: ',ntotkilled
call io_write_tally(truedist,truelist(:,1:ntrue),obsdist,obslist,oposlist,depthdiam,degradation_state)
if (.not.user%tallyonly) then
write(*,*) "Writing surface files"
call io_write_surf(user,surf,domain)
end if
if (ntrue > 0) then
write(*,*) "Tallying craters"
if (.not.user%tallyonly) then
write(*,*) "Total craters generated: ",ntotcrat
write(*,*) "Surface-affecting craters generated: ",ntrue
write(*,*) "Visible craters generated: ",vistrue
end if
call crater_tally_observed(user,surf,domain,nkilled,onum,obsdist,obslist,oposlist,depthdiam,degradation_state)
ntotkilled = ntotkilled + nkilled
write(*,*) 'Craters killed during tally: ',ntotkilled
call io_write_tally(truedist,truelist(:,1:ntrue),obsdist,obslist,oposlist,depthdiam,degradation_state)
if (.not.user%tallyonly) then
write(*,*) "Writing surface files"
call io_write_surf(user,surf)
end if

if (user%testflag) then ! Draw a profile across the crater
call io_crater_profile(user,surf)
if (user%testflag) then ! Draw a profile across the crater
call io_crater_profile(user,surf)
end if
end if
write(*,*) 'Writing output files'

Expand Down

0 comments on commit 46a8c08

Please sign in to comment.