67 lines
4.7 KiB
Markdown
67 lines
4.7 KiB
Markdown
|
|
# Operator migration: code-size estimate
|
||
|
|
|
||
|
|
Measured from the working trees on 2026-09-24, after the rotational-force port.
|
||
|
|
These are source-line counts, not a claim that every old capability has migrated.
|
||
|
|
The original repository is retained: total source across both repositories has grown.
|
||
|
|
The **replacement implementation** is substantially smaller.
|
||
|
|
|
||
|
|
| Production scope | MeanField | SERiF | Reduction |
|
||
|
|
| --- | ---: | ---: | ---: |
|
||
|
|
| Closure, hydrostatic balance, mixed gravity, gravitational force and rotational force, including their operator machinery | 15,995 | 2,145 | 13,850 lines (86.6%) |
|
||
|
|
| Same comparison, excluding blank and comment-only lines | 12,860 | 1,632 | 11,228 lines (87.3%) |
|
||
|
|
| More conservative baseline: only the old stateless kernels and rigid-rotation law, versus the entire new layer above | 4,319 | 2,145 | 2,174 lines (50.3%) |
|
||
|
|
|
||
|
|
SERiF's count charges all of `src/include/serif/equations/`, all of
|
||
|
|
`src/include/serif/operators/`, both MFEM binding/DOF-map headers in
|
||
|
|
`src/include/serif/discretization/backend/`, and `discretization/forms/value.hpp`
|
||
|
|
to these migrated equations. This includes the reusable infrastructure, not just
|
||
|
|
the short physics files. Both sides exclude mesh generation, general mapping,
|
||
|
|
EOS implementation, pre-existing term/form/quadrature infrastructure, build files,
|
||
|
|
documentation and tests. The old generic field/DOF infrastructure is also excluded;
|
||
|
|
charging the new bindings makes the estimate more conservative on the new side.
|
||
|
|
|
||
|
|
The old production manifest consists of interface and implementation files for:
|
||
|
|
|
||
|
|
| Old family | File stems under `libmeanfield/{interface,impl}/operators/` | Lines |
|
||
|
|
| --- | --- | ---: |
|
||
|
|
| Closure | `kernels/barotropic_closure_kernels`, `contexts/barotropic_closure_linearization_context`, `prepared_barotropic_closure`, `prepared_barotropic_closure_operator` | 2,401 |
|
||
|
|
| Hydrostatic | `kernels/hydrostatic_equilibrium_kernels`, `contexts/hydrostatic_equilibrium_context`, `prepared_hydrostatic_equilibrium`, `prepared_hydrostatic_equilibrium_operator` | 3,141 |
|
||
|
|
| Mixed gravity | `gravity_field`, `gravity_field_jacobian`, `kernels/gravity_kernels`, `contexts/gravity_field_context`, `prepared_hdiv_mass`, `prepared_gravity_source` | 5,560 |
|
||
|
|
| Gravity force | `kernels/gravity_displacement_force_kernels`, `prepared_gravity_displacement_force` | 2,203 |
|
||
|
|
| Rotation force | `kernels/rotation_displacement_force_kernels`, `contexts/rotation_displacement_force_context`, `prepared_rotation_displacement_force`, plus `interface/physics/rigid_rotation.cppm` | 2,518 |
|
||
|
|
| Shared force contractions | `impl/operators/interior_displacement_contractions.hpp` | 172 |
|
||
|
|
|
||
|
|
Each physical file is counted once. The 4,319-line conservative baseline includes
|
||
|
|
only the eleven kernel interface/implementation and rotation-law files from that
|
||
|
|
manifest. Physical lines include comments and blanks. The secondary code-line
|
||
|
|
estimate removes C++ comments while preserving quoted strings, then counts nonblank
|
||
|
|
lines; formatting differences still affect it.
|
||
|
|
|
||
|
|
## This addition
|
||
|
|
|
||
|
|
Rotation needs **121 lines** in two new production headers (87 excluding comments
|
||
|
|
and blanks), plus a net **5 lines** in hydrostatic equilibrium to share the law and
|
||
|
|
preserve the old constructor. The operator backend is unchanged. Its old dedicated
|
||
|
|
law/context/kernel/prepared implementation occupies 2,518 lines. The small marginal
|
||
|
|
addition is the clearest evidence that the shared backend is now paying off.
|
||
|
|
|
||
|
|
Tests are separate. The new rotational tests and their reference helper occupy
|
||
|
|
682 physical lines (615 code lines). The current equation-test directory, its
|
||
|
|
shared helpers, and operator compile-time checks total 4,240 lines (3,851 code lines).
|
||
|
|
The selected related old closure/hydrostatic/gravity/rotation tests occupy 17,184
|
||
|
|
lines (12,872 code lines). These test inventories have different scope, including
|
||
|
|
old solver and optimization checks, so their difference is not presented as a
|
||
|
|
coverage-equivalent saving. Existing test cases are retained without tolerance edits.
|
||
|
|
|
||
|
|
The old implementation includes selective cache invalidation, optimized tensor
|
||
|
|
paths, MPI/root-layout plumbing, and parts of the gravity solve that the present
|
||
|
|
SERiF backend does not reproduce. Some reduction therefore comes from deferring
|
||
|
|
capabilities, as well as removing repeated assembly and derivative code. Pressure,
|
||
|
|
global constraints and the complete coupled solver are outside this estimate.
|
||
|
|
Future migration will increase SERiF's count; this is a current footprint comparison,
|
||
|
|
not a prediction of the final percentage.
|
||
|
|
|
||
|
|
The final count includes concurrent formatting edits in the equation headers. A
|
||
|
|
compile-time count extracted during those edits needed `constexpr` for its
|
||
|
|
`static_assert`; that one-keyword correction preserves the rewritten structure.
|