Skip to content

Instantly share code, notes, and snippets.

@chaityacshah
Created October 7, 2019 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chaityacshah/6c5306718532c03ecc922942516bc63e to your computer and use it in GitHub Desktop.
Save chaityacshah/6c5306718532c03ecc922942516bc63e to your computer and use it in GitHub Desktop.
GlowScript 2.9 VPython
# https://www.wired.com/story/plant-a-tree-for-climate-change/?mod=djemTECH
na=6.022e23
#diameter of tree
d=1.5 #m
#height of tree
h=15 #
#density of tree
rho=500 #kg/m^3
V=pi*h*(d/2)**2
mt=rho*V
#fraction carbon in tree
fcarbon=0.5
mcarbon=fcarbon*mt
mucarbon=0.012 #kg/mole
ncarbon=mcarbon*na/mucarbon
#number of trees
Ntree=100e9
NCO2=Ntree*ncarbon
muair=28.97e-3 #kg/mol
#mass of atmosphere
mair=5e18 #kg
Nair=mair*na/muair
fractionCO2=NCO2/Nair
ppmCO2=fractionCO2*1e6
newppm=400-ppmCO2
print("Starting CO2 Concentration = ",400," ppm")
print("CO2 with 1 Tree per Person = ",newppm," ppm")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment