Code Collection

This program collection contains a semi-implicit one-dimensional thermal model for planetary surfaces, an explicit subsurface vapor diffusion and deposition model, models for the equilibrium ice table on Mars, a fast method for subsurface-atmosphere vapor exchange for Mars, a Monte-Carlo model for ballistic hops on the lunar surface, and a 3D model of shadowing, illumination, and scattering.

GroupFilenameCommentsprovides

Basic Models for Planetary Surfaces

Basic Thermal Model flux_noatm.f90 Insolation on horizontal or sloped surface without atmosphere function flux_noatm
conductionQ.f 1D thermal conduction with heterogeneous thermal properties and flux/radiation boundary condition, semi-implicit solver conductionQ
tridag.f from Numerical Recipes (©), without stop and pause statements, NMAX=1000tridag
asteroid_thermal.f90 main program module constants
module body
main
function flux2T
oneasteroid_thermal1d.f90 1D diffusion of temperture for asteroid oneasteroid
function a2Torb
props
grids.f creates appropriate 1D grids, calculates thermal properties of soil with ice setgrid
smartgrid
smartgrid_allice
soilthprop
smartzfac
General Purpose makefile Example makefile; shows file dependencies 
psv.f vapor pressure of H2O function psv
function frostpoint
psvco2.f vapor pressure of CO2 function psvco2
function tfrostco2
generalorbit.f distance, longitude, and declination of the sun from orbital elementsgeneralorbit
julday.for from Numerical Recipes (©), but without the pause statementfunction julday
derivs.f90 first and second derivatives on irregular grid deriv1
deriv2_full
deriv2_coeff
deriv2
deriv2_simple
deriv1_onesided

Mars Subsurface Ice Model (M-SIM)

Mars Thermal Model flux.f Insolation on horizontal or sloped surface with a poor man's Mars atmosphere function flux
marsorbit.f position of the sun as seen from Mars; data from Allison & McEwen (2000)marsorbit
conductionT.f 1D thermal conduction with heterogeneous thermal properties and temperature boundary condition, semi-implicit solver conductionT
tprofile.mMatlab script that compares temperature profile with analytic solution 
modeldescription.pdf Notes on Numerics (see Part 1) 
mars_thermal1d.f 1D diffusion of temperature for Mars; prototype example of how to call conductionQ/T with seasonal CO2 frost cover main
input.par Example input file for mars_thermal1d.f 
Diffusion Model vapordiffusioni.f Diffusion of water vapor with phase transitions on irregular grid, explicit solver, (adsorption is turned off)vapordiffusioni
adsorption.f amount of adsorbed H2O and moreadsorption
adsorption2
modeldescription.pdf Notes on Numerics (see Part 2) 
exper_thermal1d.f 1D diffusion of temperature and optionally also vapor with prescribed surface temperature main
exper.par Example input file for exper_thermal1d.f 
Equilibrium
Ice Table
jsub.f net flux between ice table and surface, includes thermal modeljsub
jsubv.f90 vectorized version of jsub, includes emission from one surface to anotherjsubv
mars_mapi.f determines equilibrium ice table depth for a list of locations (such as the entire globe); contains leftover Numerical Recipes code (©) main
function rtbis
mapgrid.dat Example input file for mars_mapi.f 
mars_mapt2.f calls jsub for a list of locations (such as the entire globe) main
mars_mapiqh2v.f90 version of mars_mapi that uses jsubv and slope coupling, configured for cluster main
function rtbis
rtbisv
Fast Method
for Subsurface
Ice Dynamics
fast_modules.f90 numerically accelerated routines for growth and depletion of subsurfac ice, Fortran modules module miscparameters
module allinterfaces
fast_subs_univ.f90 numerically accelerated routines for growth and depletion of subsurface ice, general subroutines function zint
function colint
function equildepth
depths_avmeth
function constriction
icechanges_poreonly
icechanges
assignthermalproperties
compactoutput
fast_subs_exper.f90 numerically accelerated routines for growth and depletion of subsurface ice icelayer_exper
ajsub_exper
outputmoduleparameters
module thermalmodelparam_exper
fast_subs_mars.f90 numerically accelerated routines for growth and depletion of subsurface ice icelayer_mars
ajsub_mars
outputmoduleparameters
module thermalmodelparam_mars
stabgrow_fast.f90 numerically accelerated growth of pore ice main
icelayer2
ajsub2
exper_fast.f90 numerically accelerated growth and depletion of subsurface ice main
input_fast.par Example input file for stabgrow_fast.f90 and exper_fast.f90  
mars_fast.f90 numerically accelerated growth and depletion of subsurface ice main
lats.ph Example input file for mars_fast.f90  

Lunar Models

Monte-Carlo
Model for
Surface-bounded
Exosphere
moon4.f90 main program; event driven Monte Carlo model for ballistic hops of water molecules on the lunar surface module grid
module body
module species
main
writegloble
function deblank
SurfaceTemperature
k2lonlat
particles2sigma
montecarlo.f90 ballistic hops, event scheduler hop1
function inbox
function residence_time
montecarlo
production
destruction
writeparticles
totalnrs
function incoldtrap
subl_subs.f90 miscellaneous physical parametrizations function subrate
function Ewhole
function evaprate_crystalline
function desorptionrate
function padsr
gasdev.for Gaussian probability distribution, Numerical Recipes(©) function gasdev
ran2.for random number generator, Numerical Recipes(©) function ran2
Shadowing and
illumination
shadows.f90 main program; calculates horizons main
fieldofviews.f90 main program; calculates horizons and field of views main
cratersQ_snapshot.f90 main program; instanteneous surface temperature with 3D shadowing and reflections main
cratersQ_moon.f90 main program; surface temperature with 3D shadowing and reflections main
topos.f90 input topography information module filemanager
module filemanager_ll
readdem
readdem_ll
crater_modules.f90 interface definitions module allinterfaces
crater_common.f90 common routines function horizontaldistance
function azimuth
function viewing_angle
difftopo1
compactoutput
shadow_subs.f90 subroutines for shadows findonehorizon
function diffangle
findonehorizon_wsort
fieldofview_subs.f90 subroutines for fieldofviews find3dangle
xyz2thetaphi
function area_spherical_quadrangle
function distanceonsphere refinevisibility
model_subs.f90 subroutines for cratersQ_* gethorizon
difftopo
equatorial2horizontal
function flux_wgeom
getfieldofview
getmaxfieldsize
subsurfaceconduction
hpsort.for heapsort, Numerical Recipes(©) hpsort
topo40.xyz example input topography

OldVersions

ChangeLog

1 Jun 2015: added 3D model of shadowing and illumination (incl. reflection and thermal emission) on planetary surfaces, unfortunately without any documentation whatsoever; this code is computationally much slower than it could be, but good enough for small topographies

5 Feb 2015: added lunar Monte Carlo model for exospheric transport of water molecules

3/4 Jun 2014: changed NMAX=2000 to NMAX=1000 almost everywhere

31 May 2014: added a few simple routines for thermal modeling of asteroids; reorganized webpage

4 Sep 2011: better implementation of "mode 2" ice growth, affecting fast_subs_mars.f90 and fast_subs_univ.f90

25 Aug 2011: generalizations to mars_fast.f90, fast_modules.f90, and fast_subs_mars.f90

20 Jul 2011: technical updates (generalizations) to grids.f, jsub.f, mars_mapt2.f, and mars_mapi.f

28 Mar 2010: updated fast_subs_mars.f90; icelayer_mars has been parallelized, but parallelization is disabled by default; fewer calls to conductionT in ajsub_mars

27 Mar 2010: minor polish of the very old program mars_thermal1d.f

9 Feb 2010: grids.f has an additional subroutine and the default for the parametrization of thermal conductivity has changed.

4 Feb 2010: From now on, old versions will be archived in directory OldVersions.

2 Jan 2010: routines for fast method have been added. Their filenames contain the string fast.

Summer 2009: switched from g95/g77 to gfortran compiler.

31 Oct 2008: added deriv1_onesided to derivs.f90

Acknowledgements

2006: Troy Hudson discovered a grid-point offset in conductionT and conductionQ, which has been corrected.

2005: Thanks to Mischa Kreslavsky for providing correct formulas for energy balance on a slope.

Many Thanks to Andy Vaught for developing an open-source Fortran 95 compiler (www.g95.org). The early versions of this code were developed with this compiler.


-NS