CppNoddy  0.92
Loading...
Searching...
No Matches
reversed_BL.h
Go to the documentation of this file.
1/// \file reversed_BL.h
2/// An implementation of the zig-zag modification for unsteady parabolic
3/// marching with reverse flow. The reversal detection is hard-wired (hacked)
4/// in the method below -- applicable to a box scheme boundary layer approach.
5
6#ifndef REVERSED_BL_H
7#define REVERSED_BL_H
8
9#include <DenseVector.h>
10#include <DenseMatrix.h>
11#include <BandedMatrix.h>
12#include <Equation_3matrix.h>
14#include <TwoD_Node_Mesh.h>
15#include <Uncopyable.h>
16#include <Timer.h>
17
18namespace CppNoddy {
19
20 /// A templated object for real/complex vector system
21 /// of unsteady equations.
22
23 template <typename _Type>
24 class reversed_BL : private Uncopyable {
25 public:
26
27 /// The class is defined by a vector function for the system.
28 /// \param equation_ptr A pointer to an inherited Equation object.
29 /// \param xnodes A vector that defines the nodal x-positions.
30 /// \param ynodes A vector that defines the nodal y-positions.
31 /// \param ptr_to_bottom_residual A pointer to a residual object that defines the y=y1 boundary conditions.
32 /// \param ptr_to_top_residual A pointer to a residual object that defines the y=y2 boundary conditions.
34 const DenseVector<double>& xnodes,
35 const DenseVector<double>& ynodes,
36 Residual_with_coords<_Type>* ptr_to_bottom_residual,
37 Residual_with_coords<_Type>* ptr_to_top_residual);
38
39 /// Destructor
41
42 /// Copy the current solution to the previous solution
44 PREV_SOLN = SOLN;
45 UPDATED = true;
46 }
47
48 /// A Crank-Nicolson 'time' stepper.
49 void step2(const double& dt);
50
51 /// A Crank-Nicolson 'time' stepper.
52 void bidirectional_step2(const double& dt);
53
54 /// Return a reference to the current value of the 'timelike' coordinate
55 /// \return A handle to the current timelinke coordinate stored in the object
56 double& t();
57
58 /// Return a reference to the convergence tolerance
59 double& tolerance() {
60 return TOL;
61 }
62
63 /// \return A handle to the solution mesh
65
66 private:
67
68 /// Assembles the matrix problem for a BVP solve at the current time level
69 /// and for the j+1 x-location.
70 /// \param a The LHS (banded) matrix.
71 /// \param b The RHS (dense) vector.
72 /// \param j The index of the last x-position for which a solution is known, hence the matrix
73 /// assembled is for the x=x_{j+1} position.
74 void assemble_matrix_problem(BandedMatrix<_Type>& a, DenseVector<_Type>& b, const std::size_t& j);
75
76
77 void first_order_assemble_matrix_problem(BandedMatrix<_Type>& a, DenseVector<_Type>& b, const std::size_t& j);
78
79
80 void bidirectional_assemble_matrix_problem(BandedMatrix<_Type>& a, DenseVector<_Type>& b, const std::size_t& j);
81
82 /// The solution mesh at the current time value
84 /// The solution at the previous time step
85 TwoD_Node_Mesh<_Type> PREV_SOLN;
86 /// tolerance
87 double TOL;
88 /// The current value of the timelike variable
89 double T;
90 /// (uniform) temporal step size
91 double DT;
92 /// maximum number of iterations
93 int MAX_ITERATIONS;
94 /// The function associated with this instance.
95 Equation_3matrix<_Type > *p_EQUATION;
96 /// Pointer to the residual defining the 'bottom' BC
97 Residual_with_coords<_Type > *p_BOTTOM_RESIDUAL;
98 /// Pointer to the residual defining the 'top' BC
99 Residual_with_coords<_Type > *p_TOP_RESIDUAL;
100 /// A flag to make sure the update has been done
101 bool UPDATED;
102
103#ifdef TIME
104 /// Timers for debug use
105 Timer T_ASSEMBLE;
106 Timer T_SOLVE;
107#endif
108
109 }
110 ; // end class
111
112 template <typename _Type>
114 return SOLN;
115 }
116
117 template <typename _Type>
118 inline double& reversed_BL<_Type>::t() {
119 return T;
120 }
121
122} // end namespace
123
124#endif
A matrix class that constructs a BANDED matrix.
A matrix class that constructs a DENSE matrix as an STL Vector of DenseVectors.
Specification for a templated DenseVector class – a dense, dynamic, vector object.
A templated class for equations that can be inherited from to allow instantiation of PDE_double_IBVP ...
A specification of a (double/complex) residual class that not only defines a vector residual of a vec...
A spec for the CppNoddy Timer object.
A specification for a two dimensional mesh object.
A matrix class that constructs a BANDED matrix.
Definition: BandedMatrix.h:16
An DenseVector class – a dense vector object.
Definition: DenseVector.h:34
An equation object base class used in the PDE_double_IBVP class.
A base class to be inherited by objects that define residuals.
A simple CPU-clock-tick timer for timing metods.
Definition: Timer.h:19
A two dimensional mesh utility object.
An object to block copying.
Definition: Uncopyable.h:8
A templated object for real/complex vector system of unsteady equations.
Definition: reversed_BL.h:24
TwoD_Node_Mesh< _Type > & solution()
Definition: reversed_BL.h:113
double & t()
Return a reference to the current value of the 'timelike' coordinate.
Definition: reversed_BL.h:118
void update_previous_solution()
Copy the current solution to the previous solution.
Definition: reversed_BL.h:43
void step2(const double &dt)
A Crank-Nicolson 'time' stepper.
Definition: reversed_BL.cpp:55
~reversed_BL()
Destructor.
Definition: reversed_BL.cpp:44
void bidirectional_step2(const double &dt)
A Crank-Nicolson 'time' stepper.
double & tolerance()
Return a reference to the convergence tolerance.
Definition: reversed_BL.h:59
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...

© 2012

R.E. Hewitt