naturedynamics 1.2__tar.gz → 1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. {naturedynamics-1.2 → naturedynamics-1.4}/PKG-INFO +1 -1
  2. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/__init__.py +1 -1
  3. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/astrophysics/atmospheric.py +22 -3
  4. naturedynamics-1.4/naturedynamics/astrophysics/insolation.py +72 -0
  5. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/constants.py +22 -0
  6. naturedynamics-1.4/naturedynamics/geophysics/convection.py +133 -0
  7. naturedynamics-1.4/naturedynamics/geophysics/plate_kinematics.py +127 -0
  8. naturedynamics-1.4/naturedynamics/tools/__init__.py +0 -0
  9. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/utils/conversions.py +1 -0
  10. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/utils/units.py +3 -0
  11. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics.egg-info/PKG-INFO +1 -1
  12. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics.egg-info/SOURCES.txt +4 -0
  13. {naturedynamics-1.2 → naturedynamics-1.4}/pyproject.toml +1 -1
  14. {naturedynamics-1.2 → naturedynamics-1.4}/LICENSE +0 -0
  15. {naturedynamics-1.2 → naturedynamics-1.4}/README.md +0 -0
  16. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/applications/__init__.py +0 -0
  17. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/applications/energy.py +0 -0
  18. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/applications/engineering.py +0 -0
  19. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/applications/environmental.py +0 -0
  20. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/applications/medical.py +0 -0
  21. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/astrophysics/__init__.py +0 -0
  22. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/astrophysics/cosmology.py +0 -0
  23. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/astrophysics/galactic.py +0 -0
  24. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/astrophysics/magnetism.py +0 -0
  25. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/astrophysics/orbital.py +0 -0
  26. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/astrophysics/photometry.py +0 -0
  27. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/astrophysics/planetary.py +0 -0
  28. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/astrophysics/stellar.py +0 -0
  29. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/astrophysics/tidal.py +0 -0
  30. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/biophysics/__init__.py +0 -0
  31. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/biophysics/biomechanics.py +0 -0
  32. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/biophysics/diffusion.py +0 -0
  33. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/biophysics/membrane.py +0 -0
  34. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/biophysics/neuroscience.py +0 -0
  35. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/biophysics/photosynthesis.py +0 -0
  36. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/computational/__init__.py +0 -0
  37. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/computational/finite_elements.py +0 -0
  38. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/computational/monte_carlo.py +0 -0
  39. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/computational/numerical_methods.py +0 -0
  40. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/computational/optimization.py +0 -0
  41. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/data/CIE_CMF.py +0 -0
  42. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/data/__init__.py +0 -0
  43. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/data/materials/__init__.py +0 -0
  44. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/data/materials/materials.py +0 -0
  45. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/data/spectroscopic_data/__init__.py +0 -0
  46. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/data/spectroscopic_data/spectra.py +0 -0
  47. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/electromagnetism/__init__.py +0 -0
  48. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/electromagnetism/circuits.py +0 -0
  49. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/electromagnetism/electrostatics.py +0 -0
  50. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/electromagnetism/magnetostatics.py +0 -0
  51. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/electromagnetism/maxwell.py +0 -0
  52. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/electromagnetism/optics.py +0 -0
  53. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/electromagnetism/waves.py +0 -0
  54. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/experimental/__init__.py +0 -0
  55. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/experimental/data_analysis.py +0 -0
  56. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/experimental/error_analysis.py +0 -0
  57. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/experimental/instrumentation.py +0 -0
  58. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/experimental/measurement.py +0 -0
  59. {naturedynamics-1.2/naturedynamics/mathematical → naturedynamics-1.4/naturedynamics/geophysics}/__init__.py +0 -0
  60. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/laws/__init__.py +0 -0
  61. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/laws/conservation.py +0 -0
  62. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/laws/electromagnetic.py +0 -0
  63. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/laws/momentum.py +0 -0
  64. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/laws/newtons_laws.py +0 -0
  65. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/laws/work_energy.py +0 -0
  66. {naturedynamics-1.2/naturedynamics/plasma → naturedynamics-1.4/naturedynamics/mathematical}/__init__.py +0 -0
  67. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/mathematical/complex_analysis.py +0 -0
  68. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/mathematical/differential_equations.py +0 -0
  69. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/mathematical/group_theory.py +0 -0
  70. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/mathematical/mathematical_neuroscience.py +0 -0
  71. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/mathematical/special_functions.py +0 -0
  72. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/mathematical/tensor_calculus.py +0 -0
  73. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/mechanics/__init__.py +0 -0
  74. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/mechanics/continuum.py +0 -0
  75. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/mechanics/dynamics.py +0 -0
  76. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/mechanics/fluid_mechanics.py +0 -0
  77. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/mechanics/kinematics.py +0 -0
  78. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/mechanics/lagrangian.py +0 -0
  79. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/mechanics/rotational_mechanics.py +0 -0
  80. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/mechanics/sound.py +0 -0
  81. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/mechanics/statics.py +0 -0
  82. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/mechanics/stress_strain.py +0 -0
  83. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/nuclear/__init__.py +0 -0
  84. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/nuclear/binding_energy.py +0 -0
  85. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/nuclear/decay.py +0 -0
  86. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/nuclear/fission_fusion.py +0 -0
  87. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/nuclear/particles.py +0 -0
  88. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/nuclear/reactions.py +0 -0
  89. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/oscillations/__init__.py +0 -0
  90. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/oscillations/acoustics.py +0 -0
  91. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/oscillations/coupled_oscillators.py +0 -0
  92. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/oscillations/shm.py +0 -0
  93. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/oscillations/vibrations.py +0 -0
  94. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/oscillations/wave_oscillation.py +0 -0
  95. {naturedynamics-1.2/naturedynamics/relativity → naturedynamics-1.4/naturedynamics/plasma}/__init__.py +0 -0
  96. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/plasma/basic.py +0 -0
  97. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/plasma/kinetic.py +0 -0
  98. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/plasma/magnetohydrodynamics.py +0 -0
  99. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/plasma/waves.py +0 -0
  100. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/quantum/__init__.py +0 -0
  101. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/quantum/harmonic_oscillator.py +0 -0
  102. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/quantum/hydrogen_atom.py +0 -0
  103. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/quantum/operators.py +0 -0
  104. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/quantum/perturbation.py +0 -0
  105. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/quantum/spin.py +0 -0
  106. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/quantum/statistics.py +0 -0
  107. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/quantum/tunneling.py +0 -0
  108. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/quantum/wave_functions.py +0 -0
  109. {naturedynamics-1.2/naturedynamics/solidstate → naturedynamics-1.4/naturedynamics/relativity}/__init__.py +0 -0
  110. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/relativity/cosmology.py +0 -0
  111. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/relativity/general.py +0 -0
  112. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/relativity/spacetime.py +0 -0
  113. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/relativity/special.py +0 -0
  114. {naturedynamics-1.2/naturedynamics/tools → naturedynamics-1.4/naturedynamics/solidstate}/__init__.py +0 -0
  115. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/solidstate/crystal_structure.py +0 -0
  116. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/solidstate/electronic.py +0 -0
  117. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/solidstate/magnetic.py +0 -0
  118. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/solidstate/phonons.py +0 -0
  119. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/solidstate/superconductivity.py +0 -0
  120. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/solutions/__init__.py +0 -0
  121. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/solutions/atomic.py +0 -0
  122. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/solutions/field_theory.py +0 -0
  123. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/solutions/molecular.py +0 -0
  124. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/solutions/operators.py +0 -0
  125. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/solutions/statistical.py +0 -0
  126. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/statistical_mechanics/__init__.py +0 -0
  127. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/statistical_mechanics/critical_phenomena.py +0 -0
  128. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/statistical_mechanics/distributions.py +0 -0
  129. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/statistical_mechanics/partition_functions.py +0 -0
  130. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/statistical_mechanics/quantum_statistics.py +0 -0
  131. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/thermodynamics/__init__.py +0 -0
  132. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/thermodynamics/heat_engines.py +0 -0
  133. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/thermodynamics/heat_transfer.py +0 -0
  134. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/thermodynamics/laws.py +0 -0
  135. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/thermodynamics/phase_transitions.py +0 -0
  136. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/tools/calculators.py +0 -0
  137. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/tools/exporters.py +0 -0
  138. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/tools/simulators.py +0 -0
  139. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/tools/visualizers.py +0 -0
  140. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/utils/__init__.py +0 -0
  141. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/utils/decorators.py +0 -0
  142. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/utils/plotting.py +0 -0
  143. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics/utils/validators.py +0 -0
  144. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics.egg-info/dependency_links.txt +0 -0
  145. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics.egg-info/requires.txt +0 -0
  146. {naturedynamics-1.2 → naturedynamics-1.4}/naturedynamics.egg-info/top_level.txt +0 -0
  147. {naturedynamics-1.2 → naturedynamics-1.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: naturedynamics
3
- Version: 1.2
3
+ Version: 1.4
4
4
  Summary: A comprehensive physics library providing constants, equations, and formulas
5
5
  Author-email: Fabian Schober <reach@fabianschober.com>
6
6
  License: MIT
@@ -2,4 +2,4 @@
2
2
 
3
3
  from . import constants
4
4
 
5
- __version__ = "1.2"
5
+ __version__ = "1.4"
@@ -36,11 +36,30 @@ def rayleigh_optical_depth(wavelength_nm, refractivity, king_factor, column_dens
36
36
 
37
37
 
38
38
  def beer_lambert_transmission(optical_depth, air_mass=1.0):
39
- """Fraction of a beam surviving a slab: exp(-tau/mu_0).
39
+ """Fraction of a beam surviving a slab: exp(-tau * X) = exp(-tau/mu_0).
40
40
 
41
- air_mass is 1/cos(solar zenith angle); 1.0 is the overhead sun.
41
+ air_mass X is the path through the atmosphere relative to the vertical,
42
+ 1/cos(zenith angle) for a flat slab (see `air_mass` for the curved one);
43
+ 1.0 is the overhead sun. (It divided by the air mass until 1.3, which
44
+ was only right at 1.0 -- the only value anything passed.)
42
45
  """
43
- return math.exp(-optical_depth / air_mass)
46
+ return math.exp(-optical_depth * air_mass)
47
+
48
+
49
+ def air_mass(altitude):
50
+ """Relative optical air mass towards an altitude above the horizon.
51
+
52
+ Kasten & Young's fit, which stays finite at the horizon where a flat
53
+ slab's 1/sin(altitude) does not: X = 1 / (sin h + 0.50572 (h + 6.07995)^-1.6364),
54
+ h in degrees. 1.0 at the zenith, ~38 at the horizon. F. Kasten and
55
+ A. T. Young, "Revised optical air mass tables and approximation
56
+ formula", Applied Optics 28(22), 4735-4738 (1989),
57
+ https://doi.org/10.1364/AO.28.004735
58
+
59
+ Args: altitude (rad), above about -6 degrees where the fit holds.
60
+ """
61
+ degrees = math.degrees(altitude)
62
+ return 1.0 / (math.sin(altitude) + 0.50572 * (degrees + 6.07995) ** -1.6364)
44
63
 
45
64
 
46
65
  def single_scatter_fraction(optical_depth, air_mass=1.0):
@@ -0,0 +1,72 @@
1
+ """Sunlight at the top of a planet's atmosphere, by latitude and season.
2
+
3
+ Formulas follow Berger, "Long-term variations of daily insolation and
4
+ Quaternary climatic changes", J. Atmos. Sci. 35 (1978), 2362-2367,
5
+ https://doi.org/10.1175/1520-0469(1978)035%3C2362:LTVODI%3E2.0.CO;2: angles
6
+ in radians, the solar longitude measured in the orbital plane from the
7
+ planet's vernal equinox (0 at northern spring, pi/2 at northern summer
8
+ solstice).
9
+ """
10
+
11
+ import math
12
+
13
+
14
+ def solar_longitude(true_anomaly, longitude_of_periapsis):
15
+ """
16
+ The star's longitude as seen from the planet, from its vernal equinox.
17
+
18
+ With the planet at heliocentric longitude pi at its vernal equinox, the
19
+ star's planetocentric longitude is the planet's heliocentric one less pi:
20
+ Ls = f + varpi - pi.
21
+
22
+ Args:
23
+ true_anomaly (float): f (rad), from periapsis
24
+ longitude_of_periapsis (float): varpi (rad), from the vernal equinox
25
+ direction
26
+
27
+ Returns:
28
+ float: Ls (rad), in [0, 2 pi)
29
+ """
30
+ return (true_anomaly + longitude_of_periapsis - math.pi) % (2 * math.pi)
31
+
32
+
33
+ def solar_declination(obliquity, solar_longitude):
34
+ """
35
+ Latitude of the subsolar point: sin(delta) = sin(epsilon) sin(Ls).
36
+
37
+ Args:
38
+ obliquity (float): epsilon (rad), the axial tilt
39
+ solar_longitude (float): Ls (rad)
40
+
41
+ Returns:
42
+ float: delta (rad)
43
+ """
44
+ return math.asin(math.sin(obliquity) * math.sin(solar_longitude))
45
+
46
+
47
+ def daily_mean_insolation(flux, latitude, declination):
48
+ """
49
+ Top-of-atmosphere flux averaged over one rotation, Berger (1978) eq. 1:
50
+ Q = (S / pi) (h0 sin(phi) sin(delta) + cos(phi) cos(delta) sin(h0)), with
51
+ h0 the hour angle of sunset, cos(h0) = -tan(phi) tan(delta); h0 is pi in
52
+ polar day and 0 in polar night.
53
+
54
+ Args:
55
+ flux (float): S (W/m^2), the stellar flux at the planet's distance
56
+ at that moment
57
+ latitude (float): phi (rad)
58
+ declination (float): delta (rad)
59
+
60
+ Returns:
61
+ float: Q (W/m^2)
62
+ """
63
+ product = math.tan(latitude) * math.tan(declination)
64
+ sunset = math.acos(max(-1.0, min(1.0, -product)))
65
+ return (
66
+ flux
67
+ / math.pi
68
+ * (
69
+ sunset * math.sin(latitude) * math.sin(declination)
70
+ + math.cos(latitude) * math.cos(declination) * math.sin(sunset)
71
+ )
72
+ )
@@ -128,6 +128,17 @@ KING_FACTOR = {
128
128
  "xe": 1.000,
129
129
  }
130
130
 
131
+ # Dry air at sea level, percent by volume: the reference other atmospheres
132
+ # are compared against, e.g. a sky's Rayleigh scattering relative to Earth's.
133
+ # U.S. Standard Atmosphere, 1976 (NOAA-S/T 76-1562), Table 3, its four major
134
+ # constituents: https://ntrs.nasa.gov/citations/19770009539
135
+ DRY_AIR_COMPOSITION = {
136
+ "n_2": 78.084,
137
+ "o_2": 20.9476,
138
+ "ar": 0.934,
139
+ "co_2": 0.0314,
140
+ }
141
+
131
142
  # Longest wavelength (nm) a photosynthetic pigment can usefully absorb.
132
143
  # Oxygenic photosynthesis must split water, which costs ~1.77 eV per photon
133
144
  # in a two-photon Z-scheme; anoxygenic pathways using H2S/Fe2+/H2 are cheaper.
@@ -265,6 +276,13 @@ CHAPMAN_FERRARO_FACTOR = 2.0 # boundary currents roughly double the field
265
276
  BOW_SHOCK_STANDOFF_RATIO = 1.3 # bow shock / magnetopause distance
266
277
  MAGNETOTAIL_LENGTH_RATIO = 20.0 # tail length / magnetopause, very loose
267
278
  EARTH_ORBITAL_PERIOD = 31558149.504
279
+
280
+ # Earth's mantle, the reference of mantle convection (Turcotte & Schubert,
281
+ # Geodynamics, 3rd ed., 2014): thermal expansivity (1/K), thermal
282
+ # diffusivity (m^2/s) and conductivity (W/(m K)).
283
+ MANTLE_THERMAL_EXPANSIVITY = 3e-5
284
+ MANTLE_THERMAL_DIFFUSIVITY = 1e-6
285
+ MANTLE_THERMAL_CONDUCTIVITY = 4.0
268
286
  MOON_ORBITAL_PERIOD = 2.360592e6
269
287
  MOON_DISTANCE = 3.844e8
270
288
 
@@ -406,6 +424,7 @@ __all__ = [
406
424
  "LOSCHMIDT_NUMBER",
407
425
  "REFRACTIVITY_STP",
408
426
  "KING_FACTOR",
427
+ "DRY_AIR_COMPOSITION",
409
428
  "EARTH_PHOTOSYNTHETIC_PHOTON_FLUX",
410
429
  "OXYGENIC_RED_LIMIT_NM",
411
430
  "ANOXYGENIC_RED_LIMIT_NM",
@@ -528,6 +547,9 @@ __all__ = [
528
547
  "BOW_SHOCK_STANDOFF_RATIO",
529
548
  "MAGNETOTAIL_LENGTH_RATIO",
530
549
  "EARTH_ORBITAL_PERIOD",
550
+ "MANTLE_THERMAL_EXPANSIVITY",
551
+ "MANTLE_THERMAL_DIFFUSIVITY",
552
+ "MANTLE_THERMAL_CONDUCTIVITY",
531
553
  "MOON_ORBITAL_PERIOD",
532
554
  "MOON_DISTANCE",
533
555
  # Conversion Factors
@@ -0,0 +1,133 @@
1
+ """Mantle convection by boundary-layer theory: how vigorously a planet's
2
+ mantle turns over, how much heat it carries, and the heat that drives it.
3
+
4
+ Formulas follow Turcotte & Schubert, *Geodynamics* (3rd ed., Cambridge
5
+ University Press, 2014), https://doi.org/10.1017/CBO9780511843877: the
6
+ Rayleigh number of a layer heated from below (ch. 6), its Nusselt number
7
+ from boundary-layer scaling (Nu ~ Ra^(1/3)), and the heat production of
8
+ the long-lived radioactive isotopes (ch. 4, table 4.2), with the bulk
9
+ silicate Earth's concentrations of McDonough & Sun 1995,
10
+ https://doi.org/10.1016/0009-2541(94)00140-4. SI units throughout; ages
11
+ in years.
12
+ """
13
+
14
+ import math
15
+
16
+ #: Present heat production per kg of isotope (W/kg), its half-life (years)
17
+ #: and its present mass fraction in the bulk silicate Earth, the mantle
18
+ #: and crust together: (heat, half_life, concentration). Uranium is 99.27%
19
+ #: U-238 and 0.72% U-235 by mass, potassium 0.0128% K-40.
20
+ ISOTOPES = {
21
+ "U-238": (9.46e-5, 4.47e9, 20.3e-9 * 0.9927),
22
+ "U-235": (5.69e-4, 7.04e8, 20.3e-9 * 0.0072),
23
+ "Th-232": (2.64e-5, 1.40e10, 79.5e-9),
24
+ "K-40": (2.92e-5, 1.25e9, 240e-6 * 1.28e-4),
25
+ }
26
+
27
+ #: Earth's age (years), the moment the concentrations above are measured.
28
+ EARTH_AGE = 4.5e9
29
+
30
+
31
+ def rayleigh_number(
32
+ density, gravity, expansivity, temperature_difference, depth, diffusivity, viscosity
33
+ ):
34
+ """
35
+ Rayleigh number of a fluid layer heated from below: buoyancy against
36
+ viscous drag and thermal diffusion, Ra = rho g alpha dT d^3 / (kappa eta)
37
+ (Turcotte & Schubert eq. 6.319). Convection sets in above ~10^3; Earth's
38
+ mantle is ~10^7.
39
+
40
+ Args:
41
+ density (float): rho (kg/m^3)
42
+ gravity (float): g (m/s^2)
43
+ expansivity (float): alpha, thermal expansion (1/K)
44
+ temperature_difference (float): dT across the layer (K)
45
+ depth (float): d, the layer's thickness (m)
46
+ diffusivity (float): kappa, thermal diffusivity (m^2/s)
47
+ viscosity (float): eta, dynamic viscosity (Pa s)
48
+
49
+ Returns:
50
+ float: Ra (dimensionless)
51
+ """
52
+ return (
53
+ density
54
+ * gravity
55
+ * expansivity
56
+ * temperature_difference
57
+ * depth**3
58
+ / (diffusivity * viscosity)
59
+ )
60
+
61
+
62
+ def nusselt_number(rayleigh, critical_rayleigh=1100.0, exponent=1 / 3):
63
+ """
64
+ Convective heat flow over conductive heat flow, from boundary-layer
65
+ scaling: Nu = (Ra / Ra_c)^beta above the onset of convection, 1 below
66
+ it (Turcotte & Schubert section 6.21; beta = 1/3 for a layer whose
67
+ boundary layers set the heat flow).
68
+
69
+ Args:
70
+ rayleigh (float): Ra
71
+ critical_rayleigh (float): Ra_c, where convection begins
72
+ exponent (float): beta
73
+
74
+ Returns:
75
+ float: Nu (dimensionless), at least 1
76
+ """
77
+ return max(1.0, (rayleigh / critical_rayleigh) ** exponent)
78
+
79
+
80
+ def convective_heat_flux(conductivity, temperature_difference, depth, nusselt):
81
+ """
82
+ Heat flow out of a convecting layer: Nu times what conduction alone
83
+ would carry, q = Nu k dT / d.
84
+
85
+ Args:
86
+ conductivity (float): k (W/(m K))
87
+ temperature_difference (float): dT across the layer (K)
88
+ depth (float): d (m)
89
+ nusselt (float): Nu
90
+
91
+ Returns:
92
+ float: q (W/m^2)
93
+ """
94
+ return nusselt * conductivity * temperature_difference / depth
95
+
96
+
97
+ def radiogenic_heat_production(age, abundance=1.0):
98
+ """
99
+ Heat produced per kg of rock by U-238, U-235, Th-232 and K-40 in a body
100
+ `age` years old that formed with `abundance` times the bulk silicate
101
+ Earth's initial concentrations. Each isotope decays as exp(-lambda t),
102
+ so going back from Earth's present each concentration grows by
103
+ exp(lambda (EARTH_AGE - age)): a newly formed Earth made about five
104
+ times today's heat (4.9).
105
+
106
+ Args:
107
+ age (float): years since the body formed
108
+ abundance (float): initial concentrations relative to Earth's
109
+
110
+ Returns:
111
+ float: H (W/kg)
112
+ """
113
+ return abundance * sum(
114
+ heat * concentration * math.exp(math.log(2) / half_life * (EARTH_AGE - age))
115
+ for heat, half_life, concentration in ISOTOPES.values()
116
+ )
117
+
118
+
119
+ def convection_degree(radius, mantle_depth, aspect_ratio):
120
+ """
121
+ The spherical-harmonic degree of convection cells `aspect_ratio` times
122
+ as wide as the mantle is deep: the number of rising-and-sinking pairs
123
+ that fit around a great circle, l = 2 pi R / (2 a d), at least 1.
124
+
125
+ Args:
126
+ radius (float): R, the planet's radius (m)
127
+ mantle_depth (float): d (m)
128
+ aspect_ratio (float): a, cell width over depth
129
+
130
+ Returns:
131
+ int: l
132
+ """
133
+ return max(1, round(2 * math.pi * radius / (2 * aspect_ratio * mantle_depth)))
@@ -0,0 +1,127 @@
1
+ """Rigid plates on a sphere: Euler poles, finite rotations, surface velocity.
2
+
3
+ Every plate motion on a sphere is a rotation about an axis through its
4
+ centre (Euler's fixed-point theorem); where that axis pierces the surface is
5
+ the plate's Euler pole. Conventions follow Cox & Hart, *Plate Tectonics: How
6
+ It Works* (Blackwell, 1986), ch. 4, and the GPlates rotation files: latitude
7
+ and longitude in radians, east-positive longitude, a positive angle turning
8
+ counter-clockwise seen from above the pole (right-hand rule about the pole).
9
+ Points are unit vectors (x towards 0 deg N 0 deg E, z towards the north pole).
10
+ """
11
+
12
+ import math
13
+
14
+
15
+ def unit_vector(latitude, longitude):
16
+ """
17
+ The point at a latitude and longitude, as a unit vector.
18
+
19
+ Args:
20
+ latitude (float): rad, north positive
21
+ longitude (float): rad, east positive
22
+
23
+ Returns:
24
+ tuple: (x, y, z)
25
+ """
26
+ cos_lat = math.cos(latitude)
27
+ return (
28
+ cos_lat * math.cos(longitude),
29
+ cos_lat * math.sin(longitude),
30
+ math.sin(latitude),
31
+ )
32
+
33
+
34
+ def latitude_longitude(vector):
35
+ """
36
+ Latitude and longitude of a vector's direction.
37
+
38
+ Args:
39
+ vector (tuple): (x, y, z), any non-zero length
40
+
41
+ Returns:
42
+ tuple: (latitude, longitude) in rad, longitude in (-pi, pi]
43
+ """
44
+ x, y, z = vector
45
+ return math.atan2(z, math.hypot(x, y)), math.atan2(y, x)
46
+
47
+
48
+ def euler_pole_from_arc(start, end):
49
+ """
50
+ The rotation taking one point to another along the great circle between
51
+ them: its pole is start x end, its angle the arc length.
52
+
53
+ This is the pole a plate needs to carry `start` to `end` by the shortest
54
+ route; any pole on the perpendicular bisector of the arc would carry the
55
+ point there too, but would turn the rest of the plate differently.
56
+
57
+ Args:
58
+ start (tuple): unit vector
59
+ end (tuple): unit vector
60
+
61
+ Returns:
62
+ tuple: (pole, angle) -- pole a unit vector, angle in rad, 0..pi.
63
+ pole is None when the points coincide (no rotation) and raises
64
+ for antipodal points (every great circle joins them).
65
+ """
66
+ cross = (
67
+ start[1] * end[2] - start[2] * end[1],
68
+ start[2] * end[0] - start[0] * end[2],
69
+ start[0] * end[1] - start[1] * end[0],
70
+ )
71
+ sine = math.sqrt(sum(c * c for c in cross))
72
+ cosine = sum(a * b for a, b in zip(start, end))
73
+ angle = math.atan2(sine, cosine)
74
+ if sine < 1e-15:
75
+ if cosine > 0:
76
+ return None, 0.0
77
+ raise ValueError("antipodal points: no unique great circle joins them")
78
+ return tuple(c / sine for c in cross), angle
79
+
80
+
81
+ def rotate_about_pole(point, pole, angle):
82
+ """
83
+ A point turned about a pole by an angle (Rodrigues' rotation formula).
84
+
85
+ Args:
86
+ point (tuple): vector
87
+ pole (tuple): unit vector, the rotation axis
88
+ angle (float): rad, right-handed about the pole
89
+
90
+ Returns:
91
+ tuple: the rotated vector
92
+ """
93
+ c, s = math.cos(angle), math.sin(angle)
94
+ dot = sum(p * k for p, k in zip(point, pole))
95
+ cross = (
96
+ pole[1] * point[2] - pole[2] * point[1],
97
+ pole[2] * point[0] - pole[0] * point[2],
98
+ pole[0] * point[1] - pole[1] * point[0],
99
+ )
100
+ return tuple(
101
+ point[i] * c + cross[i] * s + pole[i] * dot * (1 - c) for i in range(3)
102
+ )
103
+
104
+
105
+ def surface_velocity(point, pole, angular_rate, radius):
106
+ """
107
+ Velocity of a point on a plate turning about its Euler pole: omega x r.
108
+
109
+ Args:
110
+ point (tuple): unit vector of the point
111
+ pole (tuple): unit vector of the Euler pole
112
+ angular_rate (float): rad per unit time
113
+ radius (float): sphere radius
114
+
115
+ Returns:
116
+ tuple: (vx, vy, vz) in radius units per unit time, tangent to the
117
+ sphere at the point
118
+ """
119
+ w = tuple(angular_rate * k for k in pole)
120
+ return tuple(
121
+ radius * v
122
+ for v in (
123
+ w[1] * point[2] - w[2] * point[1],
124
+ w[2] * point[0] - w[0] * point[2],
125
+ w[0] * point[1] - w[1] * point[0],
126
+ )
127
+ )
File without changes
@@ -265,6 +265,7 @@ VELOCITY_CONVERSIONS = {
265
265
  "mph": 0.44704,
266
266
  "ft/s": 0.3048,
267
267
  "knot": 0.514444,
268
+ "mm/yr": 1e-3 / 31557600.0,
268
269
  "c": SPEED_OF_LIGHT,
269
270
  }
270
271
 
@@ -114,6 +114,7 @@ class VelocityUnit(Enum):
114
114
  MPH = "mph"
115
115
  FT_S = "ft/s"
116
116
  KNOT = "knot"
117
+ MM_YR = "mm/yr" # plate motion
117
118
  C = "c" # speed of light
118
119
 
119
120
 
@@ -198,6 +199,8 @@ class IdentityUnit(Enum):
198
199
  TIDAL_GRADIENT = "m/s²/m"
199
200
  MOLAR_MASS = "kg/mol"
200
201
  SPECIFIC_GAS_CONSTANT = "J/(kg·K)"
202
+ VISCOSITY = "Pa·s"
203
+ HEAT_PRODUCTION = "W/kg"
201
204
  MAGNETIC_MOMENT = "A·m²"
202
205
 
203
206
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: naturedynamics
3
- Version: 1.2
3
+ Version: 1.4
4
4
  Summary: A comprehensive physics library providing constants, equations, and formulas
5
5
  Author-email: Fabian Schober <reach@fabianschober.com>
6
6
  License: MIT
@@ -17,6 +17,7 @@ naturedynamics/astrophysics/__init__.py
17
17
  naturedynamics/astrophysics/atmospheric.py
18
18
  naturedynamics/astrophysics/cosmology.py
19
19
  naturedynamics/astrophysics/galactic.py
20
+ naturedynamics/astrophysics/insolation.py
20
21
  naturedynamics/astrophysics/magnetism.py
21
22
  naturedynamics/astrophysics/orbital.py
22
23
  naturedynamics/astrophysics/photometry.py
@@ -52,6 +53,9 @@ naturedynamics/experimental/data_analysis.py
52
53
  naturedynamics/experimental/error_analysis.py
53
54
  naturedynamics/experimental/instrumentation.py
54
55
  naturedynamics/experimental/measurement.py
56
+ naturedynamics/geophysics/__init__.py
57
+ naturedynamics/geophysics/convection.py
58
+ naturedynamics/geophysics/plate_kinematics.py
55
59
  naturedynamics/laws/__init__.py
56
60
  naturedynamics/laws/conservation.py
57
61
  naturedynamics/laws/electromagnetic.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "naturedynamics"
7
- version = "1.2"
7
+ version = "1.4"
8
8
  authors = [{name = "Fabian Schober", email = "reach@fabianschober.com"}]
9
9
  description = "A comprehensive physics library providing constants, equations, and formulas"
10
10
  readme = "README.md"
File without changes
File without changes
File without changes