Advection module
Transport and advection of fields.
Lagrangian advances scalar fields on unstructured meshes by tracing characteristics and projecting the transported field into a finite element space. It is used to transport level sets and other evolving fields; boundary policies control the treatment of characteristics that reach the mesh boundary.
Algorithm
At each time step, the Lagrangian method:
- Traces characteristics backward from each mesh vertex along the velocity field for a duration using the
Flowoperator - Interpolates the solution at the departure points
- Projects the interpolated values back onto the finite element space via an projection (mass-matrix solve using CG)
The variational formulation at each step is:
where is the departure point traced backward along .
Time Stepping and Boundary Policies
The characteristic tracing uses configurable time-stepping schemes. The default is Runge-Kutta 4 (Math::RungeKutta::RK4); custom steppers can be passed as the fifth constructor argument.
Two boundary policies handle characteristics that hit the domain boundary:
| Policy | Behavior |
|---|---|
| StopInsideBoundaryPolicy | Clamps the departure point to an interior point with a small inward offset (eps_in_phys, default ). Used automatically for the first time step (from initial condition). |
| TaylorBoundaryShiftPolicy<Field> | Applies a first-order Taylor correction at the boundary hit: shifts the point inward and accumulates the gradient correction . Used automatically for subsequent steps (from the current solution). |
The Lagrangian class tracks time internally (m_t) and switches between the initial condition (first step) and the current solution (later steps).
Typical Usage
P1 Vh(mesh); TrialFunction u(Vh); TestFunction v(Vh); GridFunction phi(Vh); // ... initialize phi ... VectorFunction velocity{1.0, 0.0}; // uniform horizontal advection // Default stepper: RK4 Advection::Lagrangian advection(u, v, phi, velocity); Real dt = 0.01; for (int step = 0; step < 100; ++step) advection.step(dt);
Classes
- class StopInsideBoundaryPolicy
- Boundary policy for characteristic tracing: stop-at-boundary with inward offset.
-
template<class Field>class TaylorBoundaryShiftPolicy
- First-order boundary-hit handler for semi-Lagrangian tracing with an inward shift.
-
template<class ... Params>class Lagrangian
- Lagrangian variational advection for scalar fields.
See specializations
Specialization Description Variational::TrialFunction<…>, Variational::TestFunction<FES>, Initial, VectorField, StepFull specialization
template < class FES, class Data, class Initial, class VectorField, class Step> class Lagrangian< Variational::TrialFunction< Variational::GridFunction< FES, Data >, FES >, Variational::TestFunction< FES >, Initial, VectorField, Step>;
Lagrangian advection specialization for trial/test function formulation.
Functions
- Lagrangian
- Deduction guide for Lagrangian with default RK4 stepper.
See declaration
template<class FES, class Data, class Initial, class VVel>Lagrangian(Variational::TrialFunction<Variational:: GridFunction<FES, Data>, FES>& trial, Variational:: TestFunction<FES>& test, Initial&& initial, VVel&& velocity) -> Lagrangian< Variational::TrialFunction< Variational::GridFunction< FES, Data >, FES >, Variational::TestFunction< FES >, Initial, VVel, Math::RungeKutta::RK4 > - Lagrangian
- Deduction guide for Lagrangian with custom stepper.
See declaration
template<class FES, class Data, class Initial, class VVel, class SStep>Lagrangian(Variational::TrialFunction<Variational:: GridFunction<FES, Data>, FES>& u, Variational:: TestFunction<FES>& v, Initial&& u0, VVel&& vel, SStep&& st) -> Lagrangian< Variational::TrialFunction< Variational::GridFunction< FES, Data >, FES >, Variational::TestFunction< FES >, Initial, VVel, SStep >
Function documentation
Lagrangian
Defined in Rodin/Advection/Lagrangian.h
See declaration
Deduction guide for Lagrangian with default RK4 stepper.
| Parameters | |
|---|---|
| trial | Trial function storing the advected field. |
| test | Test function for the transport problem. |
| initial | Initial field. |
| velocity | Velocity field. |
Allows construction without explicitly specifying the Step template parameter.
Lagrangian
Defined in Rodin/Advection/Lagrangian.h
See declaration
Deduction guide for Lagrangian with custom stepper.
| Parameters | |
|---|---|
| u | Trial function holding the solution |
| v | Test function for variational formulation |
| u0 | Initial condition |
| vel | Velocity field |
| st | Time-stepping scheme (default: RK4) |
Allows construction with explicit time-stepping scheme specification.