1D Heat Equation Solver 1.0
Computational Methods Assignment 2025
Loading...
Searching...
No Matches
Method Class Referenceabstract

Abstract interface for time-integration schemes solving the 1D heat equation. More...

#include <method.hpp>

Inheritance diagram for Method:
Inheritance graph
Collaboration diagram for Method:
Collaboration graph

Public Member Functions

virtual ~Method ()=default
virtual std::string name () const =0
 Get human-readable name of the scheme.
virtual void step (const Grid &g, double D, double dt, const std::vector< double > &Tprev, const std::vector< double > &Tcurr, std::vector< double > &Tnext) const =0
 Computes the temperature field at the next time step (T^{n+1}).
virtual bool uses_previous_step () const =0
 Indicates if the scheme requires data from time step n-1.

Detailed Description

Abstract interface for time-integration schemes solving the 1D heat equation.

This interface abstracts away the difference between explicit/implicit schemes and 2-level/3-level time stepping schemes.

Definition at line 27 of file method.hpp.

Constructor & Destructor Documentation

◆ ~Method()

virtual Method::~Method ( )
virtualdefault

Member Function Documentation

◆ name()

virtual std::string Method::name ( ) const
pure virtual

Get human-readable name of the scheme.

Implemented in CrankNicolson, DuFortFrankel, Laasonen, and Richardson.

◆ step()

virtual void Method::step ( const Grid & g,
double D,
double dt,
const std::vector< double > & Tprev,
const std::vector< double > & Tcurr,
std::vector< double > & Tnext ) const
pure virtual

Computes the temperature field at the next time step (T^{n+1}).

Parameters
gGrid metadata (spacing dx and node count Nx).
DThermal diffusivity [cm^2/h].
dtTime step size [h].
TprevTemperature at time step n-1 (Read-only). Required only for 3-level schemes (Richardson, DuFort-Frankel). For 2-level schemes, this vector may be ignored.
TcurrTemperature at time step n (Read-only).
TnextOutput vector to be filled with temperature at time step n+1.

Implemented in CrankNicolson, DuFortFrankel, Laasonen, and Richardson.

◆ uses_previous_step()

virtual bool Method::uses_previous_step ( ) const
pure virtual

Indicates if the scheme requires data from time step n-1.

Returns
true For 3-level schemes (e.g., Richardson, DuFort-Frankel).
false For 2-level schemes (e.g., Laasonen, Crank-Nicolson).

Implemented in CrankNicolson, DuFortFrankel, Laasonen, and Richardson.


The documentation for this class was generated from the following file: