marian::CrankNicolsonScheme Class Reference
Class implements Crank-Nicolson Scheme. More...
#include <crankNicolsonScheme.hpp>
Inheritance diagram for marian::CrankNicolsonScheme:

Public Member Functions | |
CrankNicolsonScheme () | |
Constructor. | |
CrankNicolsonScheme (SmartPointer< TridiagonalSolver > solver) | |
Provides a solver used in implicit scheme. | |
void | setSolver (const SmartPointer< TridiagonalSolver > &solver) override |
Provides a solver used in implicit scheme. | |
std::vector< double > | solve (std::vector< double > f, const std::vector< SmartPointer< BoundaryCondition > > &bcs, const std::vector< double > &time_grid, const TridiagonalOperator &L) override |
Solves PDE defined by provided linear operator L and initial and boundary conditions. More... | |
std::vector< double > | solveAndSave (std::vector< double > f, const std::vector< SmartPointer< BoundaryCondition > > &bcs, const std::vector< double > &spatial_grid, const std::vector< double > &time_grid, const TridiagonalOperator &L, const std::string file_name) override |
Solves PDE defined by provided linear operator L and initial and boundary conditions. Additionally saves solution to CSV file. More... | |
std::string | info () const override |
Returns scheme name. | |
![]() | |
virtual FDScheme * | clone () const |
Virtual copy constructor. | |
![]() | |
virtual | ~FDScheme () |
Deconstructor. | |
Private Attributes | |
SmartPointer< TridiagonalSolver > | solver_ |
Sovler used in implicit step. | |
Detailed Description
Crank-Nicolson is a combination of the implicit method and the explicit Euler method. In each time step, two steps: explicit and implicit are performed. The Crank-Nicolson scheme is unconditionally stable and have better convergence that implicit schemes and explicit schemes alone.
- Examples:
- convergenceExample.cpp, EuroOptExample.cpp, and FokkerPlanckEqExample.cpp.
Member Function Documentation
|
overridevirtual |
- Parameters
-
f Initial condition bcs Boundary conditions time_grid Time grid used in L Linear operator defining PDE
- Returns
- Solution in form of std::vector
Implements marian::FDScheme.
|
overridevirtual |
- Parameters
-
f Initial condition bcs Boundary conditions spatial_grid Spatial grid corresponding to initial conditions (used only to save the solution to CSV file) time_grid Time grid used for time dimension of FDM L Linear operator defining PDE file_name Name of CSV file
- Returns
- Solution in form of std::vector
Implements marian::FDScheme.
The documentation for this class was generated from the following files:
- C:/Unix/home/OEM/fdm/src/FDM/schemes/crankNicolsonScheme.hpp
- C:/Unix/home/OEM/fdm/src/FDM/schemes/crankNicolsonScheme.cpp