Mms module (mms.h)

Defines

MMS_E_L2_NORM
MMS_E_HCURL_NORM

Functions

static inline void mmsExactE(const PetscReal X[NUM_DIMENSIONS], PetscScalar E[NUM_DIMENSIONS])

Exact manufactured field E*(X) at a physical point.

Parameters:
  • X[in] Physical coordinates (x, y, z).

  • E[out] E*(X), stored as PetscScalar (E* is real-valued).

static inline void mmsExactCurlE(const PetscReal X[NUM_DIMENSIONS], PetscScalar C[NUM_DIMENSIONS])

Exact curl of the manufactured field, curl E*(X), at a physical point.

(curl E*)_x = pi sin(pi x) [cos(pi y) - cos(pi z)] (and cyclic).

Parameters:
  • X[in] Physical coordinates (x, y, z).

  • C[out] curl E*(X), stored as PetscScalar (real-valued).

static inline void mmsForcingF(const PetscReal X[NUM_DIMENSIONS], PetscReal omega, const PetscReal sigma[NUM_DIMENSIONS], PetscScalar F[NUM_DIMENSIONS])

Manufactured forcing f*(X) = (2 pi^2 - i omega mu sigma_d) E*_d(X).

This is the volumetric current density the RHS assembly integrates against the Nedelec basis. The per-component conductivity keeps f* consistent with the diagonal mass matrix Ms even for an anisotropic sigma.

Parameters:
  • X[in] Physical coordinates (x, y, z).

  • omega[in] Angular frequency 2 pi f.

  • sigma[in] Diagonal conductivity (sigma_x, sigma_y, sigma_z).

  • F[out] f*(X), complex-valued.

PetscErrorCode runMMSVerification(const petgemParams params, const DM dm, const Grid grid, const Vec conductivity, const CsemSourceSet sources)

Runs the complete MMS verification for one (order, mesh).

Single entry point dispatched from runForward on -mms. Performs the Galerkin solve and the L2-projection best-approximation and writes both error norms and the solve residual to an HDF5 file (one per run); -mms_diagnostics and -mms_conditioning add the over-integration and conditioning metrics. See src/mms.c.

Runs the complete MMS verification for one (order, mesh).

Level 1 (-mms): Galerkin solve + L2 projection, both error norms and the solve residual -> one HDF5 file {output_filename}.h5. Level 2 (-mms_diagnostics): also the over-integrated solve norms and the kappa/floor conditioning probe (extra attributes in the same file). Level 3 (-mms_conditioning): instead runs the mass-term scale sweep -> one HDF5 file per scale, {output_filename}_s<i>.h5.

Parameters:
  • params[in] Forward-modeling parameters (order, output dir).

  • dm[in] DMPlex mesh and H(curl) discretization.

  • grid[in] Finite-element grid descriptor.

  • conductivity[in] Per-cell conductivity Vec.

  • sources[in] Transmitter set; only sources.freq (-> omega) is used.

Returns:

PetscErrorCode PETSC_SUCCESS on success, or a PETSc error code.