Gen1 analytic gravity models¶
This guide covers the approved high-level models for moving point masses,
small-cavern wall motion, acoustic pressure in a halfspace, and prescribed
temperature perturbations. Each factory returns a model; .at(targets) fixes
target IDs and coordinate frames, and .run() returns SI fields with model
metadata and one application of G_SI. The API entries are in
Sources, targets and geometry and
Fields, waves and coherent.
Frames and outputs¶
Geometry and source coordinates belong to the Frame supplied with the source.
TargetPoints retains the frame in which its positions were entered. Pass
output_frame to .at() when acceleration and gradient components should be
expressed in another connected frame. Potential is unchanged by rotation;
vectors and both gradient indices are rotated. The result context records the
output frame, while the source model keeps its own frame and geometry.
Each model rejects targets on physical boundaries where its derivatives have one-sided limits or its native formulas are singular. Move the target to a physical side of the boundary; increasing a numerical tolerance does not make the boundary field defined.
Small-cavern approximation wall contribution¶
analytic.seismic.small_cavity_wall accepts a Sphere, Cuboid, or Cylinder, one uniform
displacement vector in the geometry frame, density, and optionally a single
frequency with a reference GPS time. It evaluates only the selected wall
contribution in the small-cavern approximation. It does not add the bulk
response or a separate scattering term. Treat displacement as a first-order
linearized input whose magnitude must remain small for the approximation to
apply. The physical wall is excluded for every observable.
"""Run a phasor SCA wall model and a sampled causal point force."""
import numpy as np
from astropy import units as u
from gragra.analytic.seismic import point_force, small_cavity_wall
from gragra.geometry import Frame, Sphere
from gragra.gravity_sources import ForceHistory
from gragra.results import PotentialReference, TimeSampling
from gragra.targets import TargetPoints
frame = Frame("elastic medium")
sphere = Sphere([0.0, 0.0, 0.0] * u.m, 1.0 * u.m, frame)
targets = TargetPoints([[3.0, 0.4, -0.2]] * u.m, ("outside-wall",), frame)
wall = small_cavity_wall(
sphere,
[1e-4, 2e-4, -1e-4] * u.m,
density=2500.0 * u.kg / u.m**3,
frequency=2.0 * u.Hz,
reference_time=(1_400_000_000, 0),
)
wall_result = wall.at(targets).run()
assert wall_result.record.g_applications == 1
assert wall_result.potential.shape == (1, 1, 1)
assert (
wall_result.context.model_spec.field_definition.potential_reference
is PotentialReference.ZERO_AT_INFINITY
)
# Each interval is 16 u^2 (1-u)^2. It starts and ends with zero force and
# zero time derivative, so the joined history is C1; after="zero" sets force
# to zero after the final knot.
onset = (1_400_000_000, 0)
history = ForceHistory(
knots=[0.0, 0.5, 1.0] * u.s,
coefficients=[
[0.0, 0.0, 16.0, -32.0, 16.0],
[0.0, 0.0, 16.0, -32.0, 16.0],
]
* u.N,
onset=onset,
after="zero",
)
sampling = TimeSampling(epoch=onset, dt=0.1 * u.s, count=3)
force = point_force(
[0.0, 0.0, 0.0] * u.m,
[1.0, 0.0, 0.0],
history,
frame=frame,
vp=3000.0 * u.m / u.s,
sampling=sampling,
)
force_result = force.at(targets).run()
potential_samples = np.asarray(force_result.potential)
assert potential_samples.shape == (1, 1, 3)
assert np.isfinite(potential_samples).all()
assert np.abs(potential_samples[0, 0, 1]) > 0.0
assert force_result.potential.epoch == sampling.epoch
The snippet also exercises the causal point-force model described below.
Causal point force¶
ForceHistory stores a real scalar force after a GPS onset. Its knot values are
elapsed seconds from that onset. Each coefficient row gives ascending powers
of the interval-local coordinate
with coefficients in newtons. Intervals are left-closed and right-open; the
last knot belongs to the after region. Adjacent intervals must join with
continuous force and first time derivative, including the zero-force onset and
the chosen final continuation. Before onset the force is zero. The after
option chooses zero force or a held final force after the last knot.
analytic.seismic.point_force evaluates this causal source in an infinite,
homogeneous elastic medium using a positive P-wave speed vp. Its time axis
comes from a TimeSampling object. The force onset and sampling epoch are
separate coordinates; retarded time includes source-target travel time.
The returned matrix stores target rows, component columns, and time samples.
Construct the immutable axis with keyword arguments, for example
TimeSampling(epoch=..., dt=0.1 * u.s, count=3).
At large GPS epochs a displayed times coordinate may round in floating
point; the canonical axis remains the integer GPS epoch pair, dt, and sample
count.
Moving point masses¶
The analytic.objects motion factories use positive PointMass or
PointMassCloud inputs and Newtonian gravity:
constant_velocitymoves one point mass at constant velocity from its position atmotion_epoch. It samples the exact translated source at each requested time.fixed_axis_rotationrotates a cloud at constant angular speed about a fixed axis and origin. The supplied cloud is its zero-angle configuration;angle0is the angle atangle_epoch. That epoch is independent of the sampling epoch.translational_oscillationis a first-order, uniform-translation response for a fixed point mass or cloud. Its displacement is a complex peak phasor at one positive frequency, referenced toreference_time.
The time-domain models use the exact TimeSampling coordinates and reject
target-source collisions at any evaluated sample. translational_oscillation is a
linearized response: it assumes displacement is small relative to each
source-target distance. The phasor convention reconstructs as
\(\mathrm{Re}[P e^{-2\pi i f(t-t_\mathrm{ref})}]\), with no additional
one-half factor.
"""Evaluate exact moving point masses and a linearized oscillation."""
import numpy as np
from astropy import units as u
from gragra.analytic.objects import (
constant_velocity,
fixed_axis_rotation,
translational_oscillation,
)
from gragra.geometry import Frame
from gragra.gravity_sources import PointMass, PointMassCloud
from gragra.results import TimeSampling
from gragra.targets import TargetPoints
root = Frame("motion root")
output = Frame(
"rotated output",
basis=[[0.0, -1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 1.0]],
parent=root,
)
targets = TargetPoints([[4.0, 2.0, 1.0]] * u.m, ("far-field",), root)
sampling = TimeSampling(
epoch=(1_400_000_000, 0),
dt=0.25 * u.s,
count=3,
)
# PointMass positions are SI coordinates in the supplied frame. motion_epoch
# sets the time at which this position is valid; sampling.epoch is independent.
mass = PointMass(2.0e8, [0.0, 0.0, 0.0])
translation = constant_velocity(
mass,
[0.1, 0.0, 0.0] * u.m / u.s,
frame=root,
motion_epoch=(1_400_000_000, 0),
sampling=sampling,
)
translated_result = translation.at(targets, output_frame=output).run()
assert translated_result.potential.shape == (1, 1, 3)
assert translated_result.acceleration.shape == (1, 3, 3)
assert translated_result.context.frame is output
assert np.isfinite(np.asarray(translated_result.acceleration)).all()
assert translated_result.potential.epoch == sampling.epoch
# A cloud's input coordinates define zero angle. angle_epoch is not the
# TimeSampling epoch, even when both happen to have the same value here.
cloud = PointMassCloud([1.0e8, 1.5e8], [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0]])
rotating = fixed_axis_rotation(
cloud,
[0.0, 0.0, 1.0],
0.2 * u.rad / u.s,
frame=root,
origin=[0.0, 0.0, 0.0] * u.m,
angle0=0.0 * u.rad,
angle_epoch=(1_400_000_000, 0),
sampling=sampling,
)
rotated_result = rotating.at(targets, output_frame=output).run()
assert rotated_result.gradient.shape == (1, 9, 3)
assert np.isfinite(np.asarray(rotated_result.gradient)).all()
# Oscillation is a small-displacement, peak-phasor response about fixed source
# positions. Reconstruct at a quarter period with the package's negative-time
# exponential convention; do not divide the phasor by two.
oscillating = translational_oscillation(
mass,
[1e-3 + 2e-4j, 0.0, 0.0] * u.m,
frame=root,
frequency=2.0 * u.Hz,
reference_time=(1_400_000_000, 0),
)
phasor_result = oscillating.at(targets, output_frame=output).run()
potential_phasor = np.asarray(phasor_result.potential)[0, 0, 0]
at_reference = np.real(potential_phasor)
at_quarter_period = np.real(potential_phasor * np.exp(-0.5j * np.pi))
assert np.isfinite(potential_phasor)
assert not np.isclose(at_reference, at_quarter_period, rtol=0.0, atol=1e-30)
The examples include a time-series result and a request with rotated output
components. motion_epoch, angle_epoch, and TimeSampling.epoch describe
different things and must be supplied independently.
Acoustic halfspace¶
analytic.atmospheric.acoustic_halfspace accepts a HalfSpace, total surface pressure
phasor, sound speed, frequency, incidence angle, azimuth, phase origin, and
reference time. The local halfspace plane is z=0; air is z>0 and ground is
z<0. The incidence angle is measured from the surface normal and must obey
\(0 < \theta \leq \pi/2\). Its wavenumbers are
\(k=2\pi f/c_s\), \(q=k\sin\theta\), and
\(k_z=k\cos\theta\). Exact grazing incidence is valid, with \(k_z=0\) and
nonzero horizontal wavenumber. Normal incidence (q=0) is excluded by this
model.
surface_pressure is the total surface-pressure coefficient under the
rigid-reflection solution, including the incident and reflected air-side
waves. phase_origin sets the phase in horizontal coordinates. The model
returns the air and ground fields and enforces continuity at the interface;
targets on the interface itself are rejected.
"""Evaluate the rigid-reflection acoustic halfspace on both sides."""
import numpy as np
from astropy import units as u
from gragra.analytic.atmospheric import acoustic_halfspace
from gragra.geometry import Frame, HalfSpace
from gragra.results import PotentialReference
from gragra.targets import TargetPoints
frame = Frame("acoustic halfspace")
model = acoustic_halfspace(
HalfSpace(frame),
2.0 * u.Pa,
sound_speed=340.0 * u.m / u.s,
frequency=3.0 * u.Hz,
incidence_angle=(np.pi / 4.0) * u.rad,
azimuth=0.3 * u.rad,
phase_origin=np.zeros(3) * u.m,
reference_time=(1_400_000_000, 0),
)
targets = TargetPoints(
[[0.4, -0.2, 1e-8], [0.4, -0.2, -1e-8]] * u.m,
("air-side", "ground-side"),
frame,
)
result = model.at(targets).run()
potential = np.asarray(result.potential)
assert potential.shape == (2, 1, 1)
assert np.isfinite(potential).all()
assert result.record.g_applications == 1
assert (
result.context.model_spec.field_definition.potential_reference
is PotentialReference.ACOUSTIC_HALFSPACE_FOURIER_POSITIVE_Q
)
assert np.allclose(potential[0], potential[1], rtol=1e-6, atol=1e-25)
Rigid acoustic cavity modes¶
analytic.atmospheric.acoustic_cavity_mode evaluates one real positive-frequency
Neumann mode for a rigid cavity. The constant zero mode is excluded. In a
Sphere, SphereAcousticMode(l, m, n) uses a real spherical harmonic and the
nth strictly positive root of the derivative of the spherical Bessel
function of degree l. The positive normalization makes the mode's spatial
RMS one. Thus pressure_amplitude is a spatial-RMS peak phasor; a sinusoid's
time RMS is its amplitude divided by \(\sqrt{2}\). The frequency is derived
from sound speed and the mode wavenumber; it is not an independent input.
"""Evaluate a nonzero real spherical Neumann mode outside a rigid cavity."""
import numpy as np
from astropy import units as u
from gragra.analytic.atmospheric import (
AcousticCavityNumerics,
SphereAcousticMode,
acoustic_cavity_mode,
)
from gragra.geometry import Frame, Sphere
from gragra.targets import TargetPoints
frame = Frame("spherical cavity")
sphere = Sphere([0.0, 0.0, 0.0] * u.m, 1.0 * u.m, frame)
mode = SphereAcousticMode(l=1, m=1, n=1)
model = acoustic_cavity_mode(
sphere,
mode,
(2.0e-3 + 1.0e-3j) * u.Pa,
sound_speed=340.0 * u.m / u.s,
reference_time=(1_400_000_000, 0),
# These are integration resource ceilings, not a user-set accuracy target.
numerics=AcousticCavityNumerics(max_evaluations=200_000, max_refinements=12),
)
targets = TargetPoints(
[[2.0, 0.3, -0.2], [1.6, 0.5, 0.4]] * u.m,
("outside-a", "outside-b"),
frame,
)
result = model.at(targets).run()
assert result.potential.shape == (2, 1, 1)
assert result.acceleration.shape == (2, 3, 1)
assert result.gradient.shape == (2, 9, 1)
assert np.isfinite(np.asarray(result.potential)).all()
assert result.record.g_applications == 1
assert len(result.context.frequencies_hz) == 1
assert result.context.frequencies_hz[0] > 0.0
assert result.context.reference_time_gps == (1_400_000_000, 0)
The sphere calculation uses a closed-form radial solution and rejects points on its physical wall.
Cuboid modes¶
CuboidAcousticMode(nx, ny, nz) uses nonnegative cosine indices. Let Lx,
Ly, and Lz be the full edge lengths and let coordinates be measured from
the cuboid center in its local frame. The real mode is
where r counts nonzero indices. This normalization gives spatial RMS one.
The all-zero constant mode is unsupported. The derived frequency is
sound_speed * k / (2*pi). The cuboid's faces are excluded for potential,
acceleration, and gradient.
"""Evaluate one real cuboid Neumann mode at an exterior target."""
import numpy as np
from astropy import units as u
from gragra.analytic.atmospheric import (
AcousticCavityNumerics,
CuboidAcousticMode,
acoustic_cavity_mode,
)
from gragra.geometry import Cuboid, Frame
from gragra.targets import TargetPoints
frame = Frame("cuboid cavity")
box = Cuboid(
np.array([0.0, 0.0, 0.0]) * u.m,
np.array([2.0, 3.0, 4.0]) * u.m,
frame,
)
model = acoustic_cavity_mode(
box,
CuboidAcousticMode(1, 0, 0),
(2.0e-3 + 1.0e-3j) * u.Pa,
sound_speed=340.0 * u.m / u.s,
reference_time=(1_400_000_000, 0),
numerics=AcousticCavityNumerics(max_evaluations=200_000, max_refinements=12),
)
targets = TargetPoints([[1.5, 0.2, -0.1]] * u.m, ("outside-face",), frame)
result = model.at(targets, observables=("potential",)).run()
value = np.asarray(result.potential)[0, 0, 0]
assert result.potential.shape == (1, 1, 1)
assert np.isfinite(value.real) and np.isfinite(value.imag)
assert abs(value) > 0.0
assert result.record.g_applications == 1
assert result.context.frequencies_hz[0] > 0.0
assert result.context.reference_time_gps == (1_400_000_000, 0)
Cylinder modes¶
CylinderAcousticMode(m, n, q, azimuth="cos") describes a real cylindrical
mode in local coordinates centered on the cylinder. m is the nonnegative
azimuthal order, n selects the positive root \(\alpha_{mn}\) of
\(J'_m(\alpha)=0\), and q is the nonnegative axial cosine index. For m>0,
azimuth selects cos(m*phi) or sin(m*phi); the sine choice is undefined
for m=0. The mode shape is proportional to
where \(R\) and \(H\) are the radius and height. Its normalization is
geometry-specific and gives spatial RMS one. For n>=1, it is
[
N=[\eta_q\eta_m J_m(\alpha_{mn})^2(1-m^2/\alpha_{mn}^2)]^{-1/2},
]
where \(\eta_q=1\) at q=0 and \(1/2\) otherwise, while \(\eta_m=1\) at
m=0 and \(1/2\) otherwise. The radial-constant case n=0 is allowed only
for m=0, q>0; it uses \(\sqrt{2}\) normalization. The constant m=n=q=0
mode is unsupported. The derived frequency is again sound_speed * k / (2*pi).
The side wall, caps, and rims are excluded for all observables.
"""Evaluate all three observables for one real cylindrical Neumann mode."""
import numpy as np
from astropy import units as u
from gragra.analytic.atmospheric import (
AcousticCavityNumerics,
CylinderAcousticMode,
acoustic_cavity_mode,
)
from gragra.geometry import Cylinder, Frame
from gragra.targets import TargetPoints
frame = Frame("cylindrical cavity")
cylinder = Cylinder(
np.array([0.2, -0.4, 0.1]) * u.m,
1.7 * u.m,
2.3 * u.m,
frame,
)
model = acoustic_cavity_mode(
cylinder,
CylinderAcousticMode(m=0, n=0, q=1),
(2.0e-3 + 1.0e-3j) * u.Pa,
sound_speed=340.0 * u.m / u.s,
reference_time=(1_400_000_000, 0),
numerics=AcousticCavityNumerics(max_evaluations=200_000, max_refinements=12),
)
targets = TargetPoints(
[[0.43, -0.57, -0.21]] * u.m,
("inside-cylinder",),
frame,
)
result = model.at(targets).run()
assert result.potential.shape == (1, 1, 1)
assert result.acceleration.shape == (1, 3, 1)
assert result.gradient.shape == (1, 9, 1)
assert np.isfinite(np.asarray(result.potential)).all()
assert np.isfinite(np.asarray(result.acceleration)).all()
assert np.isfinite(np.asarray(result.gradient)).all()
assert result.record.g_applications == 1
assert len(result.record.numerical_diagnostics) == 3
assert all(
item.termination == "converged" for item in result.record.numerical_diagnostics
)
The complex pressure coefficient multiplies the real, spatially normalized mode. Time dependence reconstructs as \(\mathrm{Re}[P e^{-2\pi i f(t-t_\mathrm{ref})}]\), without a one-half factor. Each geometry has its own real-mode normalization; do not reuse a complex-mode norm or infer frequency from a caller-supplied value. The Cuboid example requests potential only to keep transform work bounded; the Sphere and Cylinder examples request all three observables. Every request uses the same fixed accuracy policy, regardless of the number of observables.
AcousticCavityNumerics contains resource ceilings only (max_evaluations and
max_refinements). They do not change the fixed Gen1 accuracy policy. For a
cavity route that needs numerical integration, NumericalDiagnostic separates
the quadrature/numerical error estimate from the rigorous omitted-integral
tail bound; runtime convergence uses their sum per target and observable. A
tail bound covers only the omitted integral and does not bound the total
evaluation error. High-level run() wraps producer failures in
EvaluationError; for a convergence failure, inspect exc.cause
(gragra.exceptions.ConvergenceError) and read exc.cause.diagnostics. A
resource-limit failure can justify a larger resource ceiling, but relaxing a
tolerance is not a recovery method.
Isobaric temperature perturbations¶
analytic.atmospheric.isobaric_temperature applies the linearization
[
\delta\rho=-\rho_0\,\delta T/T_0
]
to a positive homogeneous background density rho0 and temperature T0.
The finite Sphere, Cuboid, and Cylinder inputs describe a prescribed bounded
temperature anomaly in that background; they do not model sealed uniform
heating or solve a thermodynamic boundary-value problem. Targets on the
material boundary are rejected for potential, acceleration, and gradient.
TemperatureFourierMode uses
\(\delta T=\Delta T\cos[k\cdot(x-x_0)]\) for Static output and
\(\widetilde{\delta T}=\widetilde{\Delta T}e^{+ik\cdot(x-x_0)}\) for a
Phasor output. The wavevector must be nonzero. The periodic potential uses a
zero-mean gauge with its zero Fourier mode excluded. Phasors are peak
coefficients and need no factor of one-half.
TemperatureGaussian has all-space support and a zero-at-infinity potential
gauge. Its center limits are finite:
\(\Phi(0)=-4\pi G\rho_c\sigma^2\), \(a(0)=0\), and
\(\Gamma(0)=-4\pi G\rho_c I/3\), where
\(\rho_c=-\rho_0\Delta T/T_0\). Far from the Gaussian, the potential and
acceleration approach the monopole field of
\(M=(2\pi)^{3/2}\rho_c\sigma^3\).
"""Evaluate static and phasor isobaric plane-wave temperature models."""
import numpy as np
from astropy import units as u
from gragra.analytic.atmospheric import isobaric_temperature
from gragra.fields import TemperatureFourierMode, TemperatureGaussian
from gragra.geometry import Frame
from gragra.results import PotentialReference
from gragra.targets import TargetPoints
frame = Frame("temperature field")
wave = TemperatureFourierMode(
wavevector=[2.0, 0.0, 0.0] / u.m,
phase_origin=[0.0, 0.0, 0.0] * u.m,
frame=frame,
)
targets = TargetPoints([[0.0, 0.0, 0.0]] * u.m, ("origin",), frame)
# A complex delta_temperature is a peak phasor. Time reconstruction uses the
# package convention Re[P exp(-2 pi i f (t - t_ref))], without a half factor.
frequency_hz = 5.0
reference_seconds = 1_400_000_000
phasor_model = isobaric_temperature(
wave,
(4.0 + 2.0j) * u.K,
rho0=2.0 * u.kg / u.m**3,
T0=400.0 * u.K,
frequency=frequency_hz * u.Hz,
reference_time=(reference_seconds, 0),
)
phasor_result = phasor_model.at(targets).run()
potential_phasor = np.asarray(phasor_result.potential)[0, 0, 0]
assert phasor_result.record.g_applications == 1
assert (
phasor_result.context.model_spec.field_definition.potential_reference
is PotentialReference.PERIODIC_ZERO_MEAN_NONZERO_K
)
at_reference = np.real(potential_phasor)
at_quarter_period = np.real(
potential_phasor * np.exp(-2j * np.pi * frequency_hz / (4.0 * frequency_hz))
)
assert np.isclose(at_reference, 0.02 * np.pi * 6.67430e-11, rtol=1e-12, atol=1e-25)
assert np.isclose(at_quarter_period, 0.5 * at_reference, rtol=1e-12, atol=1e-25)
# The Gaussian uses a zero-at-infinity gauge and has a finite center limit.
gaussian = TemperatureGaussian(
center=[0.3, -0.2, 0.1] * u.m,
sigma=0.4 * u.m,
frame=frame,
)
gaussian_model = isobaric_temperature(
gaussian,
1.0 * u.K,
rho0=1.2 * u.kg / u.m**3,
T0=280.0 * u.K,
)
center_result = gaussian_model.at(
TargetPoints(gaussian.center[None, :], ("center",), frame)
).run()
assert np.isfinite(np.asarray(center_result.potential)).all()
assert center_result.record.g_applications == 1
Real temperature grids¶
TemperaturePerturbationGrid stores real Kelvin values with shape (Nx, Ny, Nz) and
explicit strictly increasing length-Quantity edges. It places one signed
mass element at every cell center, using the product of the three edge widths
as volume. Flattening is C order, so z is the fastest-changing index.
Use the grid's public field_definition and
point_sum_provenance(rho0=..., T0=...) to connect it to the existing
point_sum model. Keep frame=grid.frame; this frame locates source cells.
output_frame on .at() controls acceleration and gradient components and
does not change source coordinates. This is a cell-center approximation for
the supplied grid, not an analytic replacement for a plane wave, Gaussian, or
finite-body model.
"""Convert a signed Kelvin grid to a frame-aware point-sum model."""
import numpy as np
from astropy import units as u
from gragra.analytic.atmospheric import isobaric_temperature
from gragra.fields import TemperatureGaussian, TemperaturePerturbationGrid
from gragra.geometry import Frame
from gragra.gravity_sources import point_sum
from gragra.targets import TargetPoints
root = Frame("world")
grid_frame = Frame("temperature grid", origin=[0.4, -0.2, 0.1] * u.m, parent=root)
output_frame = Frame(
"rotated output",
basis=[[0.0, -1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 1.0]],
parent=root,
)
grid = TemperaturePerturbationGrid(
x_edges=[-1.0, -0.1, 1.2] * u.m,
y_edges=[-0.7, 0.5, 1.5] * u.m,
z_edges=[-0.3, 0.8] * u.m,
delta_temperature=[[[1.0], [-0.4]], [[-0.7], [1.3]]] * u.K,
frame=grid_frame,
)
rho0 = 1.4 * u.kg / u.m**3
T0 = 285.0 * u.K
source = grid.as_volume_element_source(rho0=rho0, T0=T0)
model = point_sum(
source,
frame=grid.frame,
field_definition=grid.field_definition,
provenance=grid.point_sum_provenance(rho0=rho0, T0=T0),
)
targets = TargetPoints(
[[3.2, -2.1, 1.7], [-2.4, 1.3, 4.0]] * u.m,
("target-a", "target-b"),
root,
)
result = model.at(targets, output_frame=output_frame).run()
analytic_definition = isobaric_temperature(
TemperatureGaussian(center=[0, 0, 0] * u.m, sigma=1 * u.m, frame=grid.frame),
1 * u.K,
rho0=rho0,
T0=T0,
).spec.field_definition
assert result.context.model_spec.field_definition == analytic_definition
assert result.context.frame is output_frame
assert model.binding.frame is grid.frame
assert result.record.g_applications == 1
assert np.isfinite(np.asarray(result.potential)).all()
assert np.isfinite(np.asarray(result.acceleration)).all()
assert np.isfinite(np.asarray(result.gradient)).all()
Numerical diagnostics and edited results¶
For numerical cavity models, NumericalDiagnostic reports one target and
observable in SI units. A numerical or quadrature error estimate (excluding
the integral tail) and a rigorous integral-tail bound are distinct fields.
The runtime stopping rule uses their sum for each requested target and
observable. The estimate is not itself a proved bound; the tail bound covers
only the omitted integral. Neither field alone proves agreement with the exact
physical field. A successful diagnostic describes the native evaluation that
produced the result. It does not certify values a caller edits afterward.
Result payloads can remain mutable where the native matrix API permits it.
The high-level result checks that each payload still matches its declared
observable, units, IDs, component labels, and canonical time or frequency
axis when accessed. Finite edits that preserve those contracts remain visible
and are not recomputed or physically revalidated. compare requires exact
canonical axes and does not resample or interpolate results.