Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
32 views
ubuntu2404
Kernel: Julia 1.11

Modern Thermodynamics with Julia in CoCalc

Part 2: Biological Thermodynamics and Life

This notebook contains Part 2 from the main Modern Thermodynamics with Julia in CoCalc notebook.

For the complete course, please refer to the main notebook: Modern Thermodynamics with Julia in CoCalc

import Pkg; Pkg.add("PlotThemes") using Plots, Printf, Statistics, LinearAlgebra using PlotThemes theme(:bright) # Fundamental constants (2018 CODATA values) const k_B = 1.380649e-23 # Boltzmann constant (J/K) const N_A = 6.02214076e23 # Avogadro's number (1/mol) const R = k_B * N_A # Universal gas constant (J/mol·K) println("🧬 MODERN THERMODYNAMICS: BIOLOGICAL SYSTEMS") println(repeat("=", 55)) println("Exploring thermodynamics in living organisms") println() println("Biological Constants:") println("• Boltzmann constant: k_B = $(k_B) J/K") println("• Avogadro's number: N_A = $(N_A) molecules/mol") println("• Gas constant: R = $(R) J/(mol·K)")

Biological Thermodynamics and Life

Thermodynamics of Living Systems

Living organisms are non-equilibrium thermodynamic systems that:

  • Maintain low entropy through continuous energy input

  • Convert chemical energy to work and heat

  • Create and maintain complex organized structures

  • Operate far from thermodynamic equilibrium

Cellular Energy Currency: ATP

ATP hydrolysis provides energy for cellular processes: ATP+H2OADP+Pi+energy\text{ATP} + \text{H}_2\text{O} \rightarrow \text{ADP} + \text{P}_i + \text{energy}

Standard Gibbs free energy: ΔG°=30.5\Delta G^° = -30.5 kJ/mol

Cellular conditions: ΔG50\Delta G ≈ -50 to 65-65 kJ/mol

Photosynthesis: Solar Energy Conversion

Overall reaction: 6CO2+6H2O+lightC6H12O6+6O26\text{CO}_2 + 6\text{H}_2\text{O} + \text{light} \rightarrow \text{C}_6\text{H}_{12}\text{O}_6 + 6\text{O}_2

Thermodynamic efficiency: ~1-3% (conversion of solar energy to chemical energy)

Metabolic Heat Generation

Basal metabolic rate for mammals: BMRM3/4\text{BMR} \propto M^{3/4}

where MM is body mass (Kleiber's law).

Protein Folding Thermodynamics

Protein folding is driven by:

  • Enthalpy: Hydrogen bonds, van der Waals interactions

  • Entropy: Hydrophobic effect, configurational entropy

  • Free energy minimization: ΔG=ΔHTΔS\Delta G = \Delta H - T\Delta S

using Printf const N_A = 6.02214076e23 # 1/mol, Avogadro's number # Biological thermodynamics functions function atp_energy_release() """Standard ATP hydrolysis energy in J/mol""" return 30.5e3 # J/mol (standard conditions) end function cellular_atp_energy() """ATP hydrolysis energy under cellular conditions in J/mol""" return 55e3 # J/mol (typical cellular conditions) end function basal_metabolic_rate(mass_kg) """Kleiber's law: BMR = 70 * M^0.75 kcal/day for mammals""" bmr_kcal_day = 70 * mass_kg^0.75 bmr_watts = bmr_kcal_day * 4184 / (24 * 3600) # Convert to watts return bmr_watts end function photosynthesis_efficiency() """Typical photosynthesis efficiency""" return 0.02 # 2% average efficiency end println("=== BIOLOGICAL THERMODYNAMICS ===") println("Energy and Entropy in Living Systems") println() # ATP energetics ΔG_ATP_standard = atp_energy_release() ΔG_ATP_cellular = cellular_atp_energy() T_body = 37 + 273.15 # K (body temperature) println("=== CELLULAR ENERGY CURRENCY (ATP) ===") @printf "• Standard ATP hydrolysis: ΔG° = %.1f kJ/mol\n" (ΔG_ATP_standard / 1000) @printf "• Cellular conditions: ΔG ≈ %.1f kJ/mol\n" (ΔG_ATP_cellular / 1000) @printf "• Body temperature: T = %.1f K = %.1f°C\n" T_body (T_body - 273.15) println() # Human ATP turnover human_mass = 70.0 # kg (average adult) bmr_human = basal_metabolic_rate(human_mass) daily_energy = bmr_human * 24 * 3600 # J/day atp_molecules_per_day = daily_energy / ΔG_ATP_cellular * N_A println("Human Energy Metabolism:") @printf "• Adult human mass: %.0f kg\n" human_mass @printf "• Basal metabolic rate: %.0f W\n" bmr_human @printf "• Daily energy expenditure: %.1f MJ/day\n" (daily_energy / 1e6) @printf "• ATP molecules hydrolyzed: %.2e molecules/day\n" atp_molecules_per_day @printf "• ATP turnover rate: %.2e molecules/second\n" (atp_molecules_per_day / (24 * 3600)) @printf "• Equivalent ATP mass: %.0f kg/day (recycled ~1000 times!)\n" (atp_molecules_per_day * 507 / N_A / 1000) println() # Metabolic scaling println("=== METABOLIC SCALING (KLEIBER'S LAW) ===") animals = [ ("Mouse", 0.025), ("Rat", 0.3), ("Cat", 4.0), ("Human", 70.0), ("Horse", 500.0), ("Elephant", 5000.0) ] println("Metabolic Rate Scaling (BMR ∝ M^0.75):") println(repeat("-", 60)) @printf "%-15s %10s %12s %15s\n" "Animal" "Mass (kg)" "BMR (W)" "BMR/Mass (W/kg)" println(repeat("-", 60)) for (animal, mass) in animals bmr = basal_metabolic_rate(mass) bmr_per_kg = bmr / mass @printf "%-15s %10.3f %12.1f %15.2f\n" animal mass bmr bmr_per_kg end println() println("Metabolic Insights:") println("• Larger animals have lower metabolic rate per unit mass") println("• Surface area to volume ratio affects heat loss") println("• Metabolic efficiency improves with size") println("• Evolutionary advantage of larger size in cold climates") println()
using Printf # Photosynthesis analysis println("=== PHOTOSYNTHESIS: SOLAR ENERGY CONVERSION ===") solar_irradiance = 1000 # W/m² (peak sunlight) photosynthesis_eff = photosynthesis_efficiency() leaf_areas = [0.001, 0.01, 0.1, 1.0] # m² (different leaf sizes) leaf_descriptions = ["Small leaf (1 cm²)", "Medium leaf (10 cm²)", "Large leaf (100 cm²)", "Plant canopy (1 m²)"] println("Plant Solar Energy Conversion:") println(repeat('-', 70)) @printf "%-20s %10s %12s %15s %15s\n" "System" "Area (cm²)" "Solar (W)" "Chemical (W)" "Daily Energy (kJ)" println(repeat('-', 70)) for (i, area) in enumerate(leaf_areas) solar_power = solar_irradiance * area chemical_power = solar_power * photosynthesis_eff daily_energy = chemical_power * 8 * 3600 / 1000 # 8 hours daylight in kJ @printf "%-20s %10.1f %12.3f %15.4f %15.2f\n" leaf_descriptions[i] (area*10000) solar_power chemical_power daily_energy end println() println("Photosynthesis Efficiency Analysis:") @printf "• Average efficiency: %.1f%% (solar → chemical energy)\n" (photosynthesis_eff * 100) println("• Theoretical maximum: ~11% (thermodynamic limit)") println("• Loss mechanisms: reflection, non-photosynthetic absorption,") println(" quantum yield losses, metabolic costs") println("• Still remarkably efficient for a biological process!") println() # Compare to human energy needs human_daily_energy = bmr_human * 24 * 3600 / 1000 # kJ/day forest_area_needed = human_daily_energy / (photosynthesis_eff * solar_irradiance * 8 * 3600 / 1000) println("Sustaining Human Life through Photosynthesis:") @printf "• Human daily energy need: %.0f kJ/day\n" human_daily_energy @printf "• Forest area required: %.1f m² per person\n" forest_area_needed @printf "• That's a %.1f × %.1f meter square of forest!\n" sqrt(forest_area_needed) sqrt(forest_area_needed) println("• Demonstrates the fundamental role of plants in ecosystems") println()

From Living Systems to Planetary Energy

We've discovered how life harnesses thermodynamics to create order from chaos. From the molecular currency of ATP to the remarkable efficiency of photosynthesis, biological systems demonstrate nature's ingenious solutions to energy conversion and entropy management.

Our exploration revealed that organisms are sophisticated thermodynamic machines, operating far from equilibrium to maintain their complex structures. Kleiber's law showed us how metabolic scaling follows precise mathematical relationships, while the analysis of photosynthesis revealed how life captures and transforms stellar energy into the chemical bonds that power the biosphere.

But how do these principles scale up to planetary systems and human technology?

The same thermodynamic laws that govern cellular metabolism also dictate the efficiency of our power plants, the dynamics of Earth's climate, and the fundamental limits of renewable energy technologies. Understanding these connections is crucial for addressing humanity's greatest challenges.

Journey from Biology to Global Energy

The metabolic processes we've studied in organisms provide profound insights into energy systems at all scales. Just as cells must balance energy input with entropy export, our civilization must manage energy flows while minimizing environmental impact.

In Part 3, we'll explore modern energy systems and climate applications—from the thermodynamic limits of solar cells and wind turbines to Earth's energy balance and the greenhouse effect. You'll discover how renewable energy technologies approach theoretical efficiency limits, why the Betz limit constrains wind power, and how thermodynamics shapes our planet's climate system.

Continue to Part 3: Modern Energy Systems and Climate Applications →

or

Read the Complete Series