Reports and Monitors¶
Reports query data from the simulation. They generally use coefficient functions available in the Coefficient Manager.
Probe Report¶
A Probe Report (mufem.ProbeReport) queries data at a specific point
in the mesh.
It extracts scalar or vector fields at a given position.
probe_report = mufem.ProbeReport.SinglePoint(
name="Probe Report", cff_name="Position", x=0.5, y=0.2, z=0.3,
)
print(probe_report.evaluate())
Volume Integral Report¶
A Volume Integral Report (mufem.VolumeIntegralReport) computes
integrals over a volume that a coefficient function defines.
volume_integral_report = mufem.VolumeIntegralReport(
name="Volume Integral Report", marker=1 @ Vol, cff_name="Cell Volume",
)
print(volume_integral_report.evaluate())
Surface Integral Report¶
A Surface Integral Report (mufem.SurfaceIntegralReport) computes
integrals over a surface that a coefficient function defines.
surface_integral_report = mufem.SurfaceIntegralReport(
name="Surface Integral Report", marker=1 @ Bnd, cff_name="Cell Volume",
)
print(surface_integral_report.evaluate())
Surface Average Report¶
A Surface Average Report (mufem.SurfaceAverageReport) computes the
average value of a coefficient function over a surface.
surface_average_report = mufem.SurfaceAverageReport(
name="Surface Average Report", marker=1 @ Bnd, cff_name="Cell Volume",
)
print(surface_average_report.evaluate())
MinMax Report¶
A MinMax Report (mufem.MinMaxReport) computes the minimum and
maximum values of a coefficient function over the mesh.
minmax_report = mufem.MinMaxReport(
name="MinMax Report", marker=1 @ Vol, cff_name="Cell Volume",
)
print(minmax_report.evaluate())
Note
Currently only the maximum value is returned.
Report Values¶
evaluate() returns a Python value. The type depends on the coefficient
function:
| Result | Python type | Access |
|---|---|---|
| Real scalar | float |
— |
| Complex scalar | complex |
— |
| Real vector | mufem.FixedVector |
x, y, z, mag,
[i], to_tuple(), to_numpy() |
| Complex vector | mufem.ComplexFixedVector |
x, y, z, real,
imag, mag, rms,
[i], to_numpy() |
| Real matrix | mufem.Matrix |
[i, j], to_numpy() |
| Complex matrix | mufem.ComplexMatrix |
real(), imag(), to_numpy() |
For a ComplexFixedVector \(\hat{\mathbf{v}}\) with the complex components
\(\hat{v}_i\), \(i = x, y, z\):
magis the peak magnitude \(\sqrt{\sum_i |\hat{v}_i|^2}\).rmsis the RMS magnitude \(\sqrt{\tfrac{1}{2}\sum_i |\hat{v}_i|^2}\). It is smaller thanmagby \(\sqrt{2}\).realandimagare the real and imaginary parts asFixedVectorobjects.
The units are the units of the coefficient function.
Note
FixedVector no longer has the __array__ method. Use
vector.to_numpy() to get a NumPy array.
Example¶
The code below shows how to query data from the simulation with reports:
import mufem
from mufem import Vol, Bnd, Everywhere
sim = mufem.Simulation.New(
name="My Case",
mesh_path="data/geometry.mesh",
verbosity_level=mufem.Verbosity.WARNING,
)
refinement_model = mufem.RefinementModel()
sim.get_model_manager().add_model(refinement_model)
volume_integral_report = mufem.VolumeIntegralReport(
name="Volume Integral Report", marker=1 @ Vol, cff_name="Cell Volume",
)
print(f"Volume Integral Report: {volume_integral_report.evaluate()}")
minmax_report = mufem.MinMaxReport(
name="MinMax Report", marker=1 @ Vol, cff_name="Cell Volume",
)
print(f"MinMax Report: {minmax_report.evaluate()}")