numerics
Loading...
Searching...
No Matches
field.hpp
Go to the documentation of this file.
1/// @file field.hpp
2/// @brief EM-specific field types and solvers.
3///
4/// ScalarField3D, VectorField3D, FieldSolver, and MagneticSolver now live in
5/// the numerics library (include/spatial/fields.hpp) in the num:: namespace.
6/// This file brings them into the physics:: namespace and adds the
7/// EM-specific ElectricSolver (variable-conductivity current flow).
8#pragma once
9
10#include "spatial/fields.hpp"
12#include <vector>
13
14namespace physics {
15
20
21// ============================================================
22// ElectrodeBC + ElectricSolver
23// ============================================================
24
25/// A grid node with a fixed voltage (Dirichlet BC for current flow).
27 int flat_idx; ///< Flat grid index: k*ny*nx + j*nx + i
28 float voltage; ///< Applied voltage [V]
29};
30
32public:
33 /// Solve div(σ∇φ) = 0 with Dirichlet BCs at electrode nodes,
34 /// Neumann (zero normal flux) on all remaining boundaries.
35 ///
36 /// Uses symmetric elimination so the system is SPD → CG converges.
38 const ScalarField3D& sigma,
39 const std::vector<ElectrodeBC>& bcs,
40 double tol = 1e-6,
41 int max_iter = 500);
42
43 /// Compute Joule heating power density Q = σ|∇φ|² [W/m³].
44 static ScalarField3D joule_heating(const ScalarField3D& sigma,
45 const ScalarField3D& phi);
46};
47
48} // namespace physics
static num::SolverResult solve_potential(ScalarField3D &phi, const ScalarField3D &sigma, const std::vector< ElectrodeBC > &bcs, double tol=1e-6, int max_iter=500)
Definition field.cpp:13
static ScalarField3D joule_heating(const ScalarField3D &sigma, const ScalarField3D &phi)
Compute Joule heating power density Q = σ|∇φ|² [W/m³].
Definition field.cpp:82
Umbrella include for all linear solvers.
Forwarding shim — field types have moved to pde/fields.hpp.
A grid node with a fixed voltage (Dirichlet BC for current flow).
Definition field.hpp:26
float voltage
Applied voltage [V].
Definition field.hpp:28
int flat_idx
Flat grid index: k*ny*nx + j*nx + i.
Definition field.hpp:27