24 #ifndef CRANKNICOLSONProblem_H_
25 #define CRANKNICOLSONProblem_H_
52 template<
typename OPTPROBLEM,
typename SPARSITYPATTERN,
typename VECTOR,
53 int dopedim,
int dealdim,
54 template <
int,
int>
class FE = dealii::FESystem,
55 template <
int,
int>
class DH = dealii::DoFHandler>
57 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>
61 PrimalTSBase<OPTPROBLEM, SPARSITYPATTERN, VECTOR, dopedim, dealdim,
64 initial_problem_ = NULL;
68 if (initial_problem_ != NULL)
69 delete initial_problem_;
77 return "Crank-Nicolson";
83 dealdim, FE, DH>, VECTOR, dealdim>&
86 if (initial_problem_ == NULL)
90 dopedim, dealdim, FE, DH>, VECTOR, dealdim>(*this);
92 return *initial_problem_;
105 template<
typename EDC>
108 dealii::Vector<double> &local_vector,
double scale,
double )
112 dealii::Vector<double> tmp(local_vector);
117 this->
GetProblem().ElementEquation(edc, tmp, 0.5 * scale, scale);
121 this->
GetProblem().ElementTimeEquation(edc, tmp,
125 this->
GetProblem().ElementTimeEquationExplicit(edc, local_vector,
129 else if (this->
GetPart() ==
"Old")
131 dealii::Vector<double> tmp(local_vector);
136 this->
GetProblem().ElementEquation(edc, tmp, 0.5 * scale, 0.);
152 template<
typename EDC>
155 dealii::Vector<double> &local_vector,
double scale)
159 this->
GetProblem().ElementRhs(edc, local_vector, 0.5 * scale);
161 else if (this->
GetPart() ==
"Old")
163 this->
GetProblem().ElementRhs(edc, local_vector, 0.5 * scale);
175 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
176 const std::map<std::string, const VECTOR*> &domain_values,
177 VECTOR& rhs_vector,
double scale)
181 this->
GetProblem().PointRhs(param_values, domain_values, rhs_vector,
184 else if (this->
GetPart() ==
"Old")
186 this->
GetProblem().PointRhs(param_values, domain_values, rhs_vector,
197 template<
typename EDC>
200 dealii::FullMatrix<double> &local_matrix)
202 assert(this->
GetPart() ==
"New");
203 dealii::FullMatrix<double> m(local_matrix);
207 this->
GetProblem().ElementMatrix(edc, local_matrix, 0.5, 1.);
215 this->
GetProblem().ElementTimeMatrixExplicit(edc, m);
222 template<
typename FDC>
225 dealii::Vector<double> &local_vector,
double scale,
double )
229 this->
GetProblem().FaceEquation(fdc, local_vector, 0.5 * scale, scale);
231 else if (this->
GetPart() ==
"Old")
233 this->
GetProblem().FaceEquation(fdc, local_vector, 0.5 * scale,0.);
244 template<
typename FDC>
247 dealii::Vector<double> &local_vector,
double scale,
double )
251 this->
GetProblem().InterfaceEquation(fdc, local_vector,
254 else if (this->
GetPart() ==
"Old")
256 this->
GetProblem().InterfaceEquation(fdc, local_vector,
268 template<
typename FDC>
271 dealii::Vector<double> &local_vector,
double scale = 1.)
273 this->
GetProblem().FaceRhs(fdc, local_vector, scale);
278 template<
typename FDC>
281 dealii::FullMatrix<double> &local_matrix)
283 assert(this->
GetPart() ==
"New");
285 dealii::FullMatrix<double> m(local_matrix);
289 this->
GetProblem().FaceMatrix(fdc, m, 0.5, 1.);
291 local_matrix.add(1., m);
296 template<
typename FDC>
299 dealii::FullMatrix<double> &local_matrix)
301 assert(this->
GetPart() ==
"New");
302 dealii::FullMatrix<double> m(local_matrix);
306 this->
GetProblem().InterfaceMatrix(fdc, m, 0.5, 1.);
308 local_matrix.add(1., m);
313 template<
typename FDC>
316 dealii::Vector<double> &local_vector,
double scale,
double )
320 this->
GetProblem().BoundaryEquation(fdc, local_vector, 0.5 * scale, scale);
322 else if (this->
GetPart() ==
"Old")
324 this->
GetProblem().BoundaryEquation(fdc, local_vector, 0.5 * scale, 0.);
335 template<
typename FDC>
338 dealii::Vector<double> &local_vector,
double scale)
340 this->
GetProblem().BoundaryRhs(fdc, local_vector, scale);
345 template<
typename FDC>
348 dealii::FullMatrix<double> &local_matrix)
350 assert(this->
GetPart() ==
"New");
351 dealii::FullMatrix<double> m(local_matrix);
355 this->
GetProblem().BoundaryMatrix(fdc, m, 0.5, 1.);
356 local_matrix.add(1., m);
void ElementEquation(const EDC &edc, dealii::Vector< double > &local_vector, double scale, double)
Definition: crank_nicolson_problem.h:107
~CrankNicolsonProblem()
Definition: crank_nicolson_problem.h:66
void BoundaryEquation(const FDC &fdc, dealii::Vector< double > &local_vector, double scale, double)
Definition: crank_nicolson_problem.h:315
InitialProblem< CrankNicolsonProblem< OPTPROBLEM, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH >, VECTOR, dealdim > & GetInitialProblem()
Definition: crank_nicolson_problem.h:84
void FaceRhs(const FDC &fdc, dealii::Vector< double > &local_vector, double scale=1.)
Definition: crank_nicolson_problem.h:270
void FaceEquation(const FDC &fdc, dealii::Vector< double > &local_vector, double scale, double)
Definition: crank_nicolson_problem.h:224
Definition: primal_ts_base.h:49
CrankNicolsonProblem(OPTPROBLEM &OP)
Definition: crank_nicolson_problem.h:60
void ElementRhs(const EDC &edc, dealii::Vector< double > &local_vector, double scale)
Definition: crank_nicolson_problem.h:154
void ElementMatrix(const EDC &edc, dealii::FullMatrix< double > &local_matrix)
Definition: crank_nicolson_problem.h:199
Definition: initialproblem.h:42
std::string GetName()
Definition: crank_nicolson_problem.h:75
void InterfaceMatrix(const FDC &fdc, dealii::FullMatrix< double > &local_matrix)
Definition: crank_nicolson_problem.h:298
OPTPROBLEM & GetProblem()
Definition: ts_base.h:480
void BoundaryRhs(const FDC &fdc, dealii::Vector< double > &local_vector, double scale)
Definition: crank_nicolson_problem.h:337
Definition: crank_nicolson_problem.h:56
void FaceMatrix(const FDC &fdc, dealii::FullMatrix< double > &local_matrix)
Definition: crank_nicolson_problem.h:280
std::string GetPart() const
Definition: ts_base.h:493
void PointRhs(const std::map< std::string, const dealii::Vector< double > * > ¶m_values, const std::map< std::string, const VECTOR * > &domain_values, VECTOR &rhs_vector, double scale)
Definition: crank_nicolson_problem.h:174
void InterfaceEquation(const FDC &fdc, dealii::Vector< double > &local_vector, double scale, double)
Definition: crank_nicolson_problem.h:246
void BoundaryMatrix(const FDC &fdc, dealii::FullMatrix< double > &local_matrix)
Definition: crank_nicolson_problem.h:347
CrankNicolsonProblem< OPTPROBLEM, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH > & GetBaseProblem()
Definition: crank_nicolson_problem.h:98