13 ,
grid_(phys.L_cm, num.dx)
37 T.front() =
phys_.Tsur;
38 T.back() =
phys_.Tsur;
43 std::fill(
T_.begin(),
T_.end(),
phys_.Tin);
59 const double dx =
grid_.dx;
60 const double r =
phys_.D_cm2h *
num_.dt / (dx * dx);
61 const std::size_t N =
grid_.Nx;
69 for (std::size_t i = 1; i + 1 < N; ++i)
84 const std::function<
void(
double,
const Grid&,
const std::vector<double>&)>& onDump)
87 const double dt =
num_.dt;
88 const double tEnd =
num_.tEnd;
89 const double outEvery =
num_.outEvery;
90 double nextDump = 0.0;
104 while (t < tEnd - 1e-12)
135 if (t + 1e-12 >= nextDump)
138 nextDump += outEvery;
std::vector< double > Tprev_
Previous solution (stores T^{n-1} when required).
PhysParams phys_
Physical parameters (copied for convenience).
void apply_dirichlet(std::vector< double > &T) const
Apply Dirichlet boundary conditions (Tsur) at both ends of the vector.
std::vector< double > next_
Buffer used to store the next time layer T^{n+1}.
NumParams num_
Numerical parameters (copied for convenience).
std::unique_ptr< Method > method_
Selected time integration method.
void bootstrap_if_needed()
Perform a warm-up step when the method needs two previous time levels.
void run(const std::function< void(double, const Grid &, const std::vector< double > &)> &onDump)
Run the simulation from t=0 to t=tEnd.
HeatSolver(const PhysParams &phys, const NumParams &num, SchemeKind scheme)
Construct the solver with physical and numerical parameters and a scheme kind.
Grid grid_
Spatial grid built from phys/num input.
std::vector< double > T_
Current solution (typically holds T^n).
void init_field()
Initialize the temperature field with Tin and enforce boundary conditions.
bool uses_prev_step_
True when the method requires T^{n-1}.
SchemeKind
Enumeration of the numerical schemes available in the solver.
std::unique_ptr< Method > make_method(SchemeKind scheme)
Factory function to create a concrete method instance.
High-level solver orchestrating BCs and time integration.
Uniform 1D grid on x ∈ [0, L], including both boundary nodes.
Numerical parameters controlling the discretization and output.
Physical parameters of the wall heat conduction problem.