Skip to content

Commit

Permalink
Small fixes (#894)
Browse files Browse the repository at this point in the history
  • Loading branch information
blackyblack authored Aug 18, 2024
1 parent 635a5b5 commit c1e3f65
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
**Waveguides*
=========================
**Waveguides**
==============
A *waveguide* is a structure that guides waves by restricting the transmission of energy
to one direction. Common types of waveguides include acoustic waveguides which direct
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
**Conditions:**
#. Only applicable in the limits :math:`b \ll V_m` and :math:`a \ll p V_m^2`.
#. Inapplicable for large pressures.
#. Inapplicable for high pressures.
"""

from sympy import Eq, solve, exp
Expand Down Expand Up @@ -78,6 +78,9 @@
"""
Parameter specific to each individual substance, usually attributed to the amount of
excluded molar volume due to a finite size of particles.
Symbol:
:code:`b`
"""

law = Eq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
To more accurately describe the behavior of real gases at low temperatures,
a Van der Waals gas model was created, taking into account the forces of intermolecular interaction.
In this model, internal energy becomes a function not only of temperature, but also of molar_volume.
In this model, internal energy becomes a function not only of temperature, but also of molar volume.
The Van der Waals equation is one of the well-known approximate equations of state describing
the properties of a real gas, having a compact form and taking
Expand Down Expand Up @@ -32,7 +32,10 @@
Volume of the van der Waals fluid per unit amount of substance.
Symbol:
:code:`v`
:code:`V_m`
Latex:
:math:`V_m`
"""

temperature = symbols.thermodynamics.temperature
Expand Down Expand Up @@ -72,11 +75,11 @@
units.molar_gas_constant * temperature,
)
r"""
:code:`(p + a / v^2) * (v - b) = R * T`
:code:`(p + a / V_m^2) * (V_m - b) = R * T`
Latex:
.. math::
\left( p + \frac{a}{v^2} \right) (v - b) = R T
\left( p + \frac{a}{V_m^2} \right) (V_m - b) = R T
"""


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@
Volume of the van der Waals fluid per unit amount of substance.
Symbol:
:code:`v`
:code:`V_m`
Latex:
:math:`V_m`
"""

law = Eq(
Expand All @@ -77,11 +80,11 @@
attractive_forces_parameter / molar_volume,
)
r"""
:code:`u = Integral(c_V(T), T) - a / v`
:code:`u = Integral(c_V(T), T) - a / V_m`
Latex:
.. math::
u = \int c_V(T) \, dT - \frac{a}{v}
u = \int c_V(T) \, dT - \frac{a}{V_m}
"""


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,21 @@
Also called the *virial expansion*, the *virial equation of state* expresses the compressibility factor
(and therefore the pressure) of a real gas in local equilibrium as a power series of molar density.
#. :math:`O(\dots)` is the mathematical *Big O*. In this law the limit :math:`\rho \to 0` is
assumed.
**Notes:**
#. The first virial coefficient :math:`A` is defined to be 1 in order to enforce that the equation
reduces to the ideal gas equation as gas density approaches zero.
#. The :math:`n`-th virial coefficient represents non-additive :math:`n`-body interactions of
particles and all mutual interactions of :math:`2` up to :math:`(n - 1)` particles.
#. In general, virial coefficients are functions of temperature.
#. :math:`O(\dots)` is the mathematical *Big O*.
**Conditions:**
#. Interactions between 4 and more bodies are quite rare to happen, so the expansion is truncated to contain only
the second and third virial coefficients. Moreover, the latter have been extensively studied and tabulated
for many fluids.
#. In this law the limit :math:`\rho \to 0` is assumed.
"""

from sympy import Eq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
**Conditions:**
#. There are not heat sources in the system, i.e. the heat distribution only depends on
#. There are no heat sources in the system, i.e. the heat distribution only depends on
the initial conditions.
#. Thermal diffusivity :math:`\chi` does not depend on position.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@
**Notes:**
.. _heat_transfer_zero_temperature_solution_coefficient_note:
#. :math:`f(x)` represents initial spatial distribution of temperature.
1. Values :math:`B_n` are found using the boundary condition :math:`f(x) = \sum_n T_n(x, 0)`
.. _heat_transfer_zero_temperature_solution_coefficient_note:
#. Values :math:`B_n` are found using the boundary condition :math:`f(x) = \sum_n T_n(x, 0)`
with the help of the Fourier method.
2. The total solution :math:`T(x, t) = \sum_n T_n(x, t)`.
#. The total solution :math:`T(x, t) = \sum_n T_n(x, t)`.
**Conditions:**
1. Position :math:`x \in [0, L]`.
#. Position :math:`x \in [0, L]`.
#. Temperature on both ends is zero: :math:`T_n(0, t) = 0`, :math:`T_n(L, t) = 0`
"""

from sympy import Eq, sin, exp, pi
Expand Down Expand Up @@ -48,6 +51,9 @@
Symbol:
:code:`B_n`
Latex:
:math:`B_n`
"""

thermal_diffusivity = Symbol("thermal_diffusivity", units.area / units.time)
Expand Down Expand Up @@ -98,7 +104,7 @@
scaling_coefficient * sin(mode_number * pi * position / maximum_position) *
exp(-1 * thermal_diffusivity * (mode_number * pi / maximum_position)**2 * time))
r"""
:code:`T_n(x, t) = B_n * sin(n * pi * x / L) * exp(-1 * chi * (n * pi / L)^2 t)`
:code:`T_n(x, t) = B_n * sin(n * pi * x / L) * exp(-1 * chi * (n * pi / L)^2 * t)`
Latex:
.. math::
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
"""
r"""
Statistical weight of macrostate
================================
If a physical system can be described as having several states which can be occupied by
different numbers of particles but with the total number of particles being conserved and
a condition that all allowed microstates of the closed system are equiprobable, the formula
for the statistical weight of the system can be found in combinatorics.
**Notes:**
#. Law can also be represented in form :math:`W = \frac{N!}{\prod_i (N_i!)}`
(:code:`W = factorial(N) / Product(factorial(N_i), i)`)
"""

from typing import Sequence
Expand Down Expand Up @@ -46,11 +51,11 @@
ProductIndexed(factorial(particle_count_in_state[global_index]), global_index),
)
r"""
:code:`W = factorial(N) / Product(factorial(N_i), i) = factorial(Sum(N_i, i)) / Product(factorial(N_i), i)`
:code:`W = factorial(Sum(N_i, i)) / Product(factorial(N_i), i)`
Latex:
.. math::
W = \frac{N}{\prod_i (N_i!)} = \frac{(\sum_i N_i)!}{\prod_i (N_i!)}
W = \frac{(\sum_i N_i)!}{\prod_i (N_i!)}
"""


Expand Down

0 comments on commit c1e3f65

Please sign in to comment.