1D Heat Equation Solver 1.0
Computational Methods Assignment 2025
Loading...
Searching...
No Matches
dufort_frankel.hpp
Go to the documentation of this file.
1#pragma once
2/**
3 * @file dufort_frankel.hpp
4 * @brief DuFort–Frankel explicit method (3-level scheme).
5 *
6 * Update:
7 * T_i^{n+1} = [ (1 - 2r) T_i^{n-1} + 2r (T_{i+1}^n + T_{i-1}^n) ] / (1 + 2r),
8 * with r = D dt / dx^2.
9 */
10#include "method.hpp"
11
12class DuFortFrankel final : public Method
13{
14 public:
15 std::string name() const override
16 {
17 return "DuFort-Frankel";
18 }
19 void step(const Grid& g,
20 double D,
21 double dt,
22 const std::vector<double>& Tprev,
23 const std::vector<double>& Tcurr,
24 std::vector<double>& Tnext) const override;
25 bool uses_previous_step() const noexcept override
26 {
27 return true;
28 }
29};
std::string name() const override
Get human-readable name of the scheme.
bool uses_previous_step() const noexcept override
Indicates if the scheme requires data from time step n-1.
void step(const Grid &g, double D, double dt, const std::vector< double > &Tprev, const std::vector< double > &Tcurr, std::vector< double > &Tnext) const override
Computes the temperature field at the next time step (T^{n+1}).
Abstract interface for time-integration schemes solving the 1D heat equation.
Definition method.hpp:28
Uniform 1D grid on x ∈ [0, L], including both boundary nodes.
Definition grid.hpp:15