Skip to content
Get started

5. Fields and spatial domains

A scalar such as pressure assigns one value to each point of a region. A velocity field assigns a spatial vector. Writing only a quantity and its unit is therefore incomplete: a spatial model must also say which support carries the field and what shape its values have.

Eqiora separates the semantic support from concrete geometry. A volume says that a field lives in a region; its boundaries identify the places where the interior model meets its surroundings. Meshes and discretization choices come later.

After this chapter, you should be able to:

  • distinguish a field’s role, support, dimension, and value shape;
  • read grad, div, trace, and normal by their mathematical roles;
  • identify which quantities live in a volume and which are compared on its boundary; and
  • diagnose an operator applied to the wrong kind of field.

The steady cylinder example declares one two-dimensional fluid volume and four named parts of its boundary:

eqiora
component FlowRegion(
support fluid: volume(ambient_dimension = 2),
support inlet: boundary(parent = fluid),
support outlet: boundary(parent = fluid),
support walls: boundary(parent = fluid),
support cylinder: boundary(parent = fluid),
) {
variable velocity: vector<m / s, 2> on fluid;
variable pressure: kg / (m * s ^ 2) on fluid;
// Interior and boundary equations complete the component.
}

velocity and pressure share the support fluid, but their value shapes differ. The four boundary supports do not create four new fluids; they name where distinct boundary relations apply.

For a scalar field pp and vector field u\boldsymbol{u}:

Expression Meaning Where the result is used
p\nabla p spatial rate of change of a scalar in the volume
 ⁣u\nabla\!\cdot\boldsymbol{u} net outward tendency per unit volume in the volume
tru\operatorname{tr}\boldsymbol{u} interior value restricted to a boundary on the boundary
Tn\boldsymbol{T}\boldsymbol{n} normal action of a tensor on the boundary

The operators also transform dimensions. If velocity has dimension L/TL/T, its divergence has dimension 1/T1/T. If pressure has dimension force per area, its gradient has dimension force per volume. Shape and dimension are separate checks, and both must make sense.

The model uses these roles directly:

eqiora
relation incompressibility on fluid {
div(velocity) = 0;
}
relation wall_velocity on walls {
trace(velocity) = 0;
}

The first relation is an interior statement. The second compares the boundary trace of the interior velocity with a prescribed zero velocity.

Read the complete steady-flow model.

For a scalar field on the unit square, a useful checking problem is

div(gradu)=2π2sin(πx)sin(πy),u=0 on all four sides.-\operatorname{div}(\operatorname{grad} u) =2\pi^2\sin(\pi x)\sin(\pi y), \qquad u=0\text{ on all four sides}.

The source is chosen so the solution is known: u(x,y)=sin(πx)sin(πy)u(x,y)=\sin(\pi x)\sin(\pi y). This is a scalar Poisson problem, not the cylinder-flow model above. Knowing the answer in advance lets a numerical comparison measure error instead of relying on a plausible-looking picture.

The Poisson verification package contains its Eqiora declarations, and the registered Poisson case describes the numerical comparison. For a complete public spatial workflow, follow the cylinder Gallery case, whose equations and execution both refer to the same flow problem.

Deliberate failure: divergence of a scalar

Section titled “Deliberate failure: divergence of a scalar”

Replace the incompressibility relation with div(pressure) = 0. Pressure is a scalar, while divergence here expects a spatial vector or tensor. The field is still on the right support and its unit is still valid, but the operator has no matching shape. Repair the mathematical statement; changing the mesh or solver cannot make the expression meaningful.

  1. State the support, dimension, and value shape of velocity and pressure.
  2. Explain why trace(velocity) belongs in a relation on walls, not in the volume relation for incompressibility.
  3. If temperature has dimension Θ\Theta, what dimension does its gradient have?
  4. Add a named symmetry boundary to the support declarations. What physical relation would still need to be supplied before the name has meaning?

Previous: Ordinary differential equations · Back to the series map · Next: Conservation laws