PRISMS-PF  v2.1
test_invM.h
Go to the documentation of this file.
1 // Unit test(s) for the method "computeInvM"
2 template <int dim, int degree>
3 class testInvM: public MatrixFreePDE<dim,degree>
4 {
5  public:
6  testInvM(userInputParameters<dim> _userInputs): MatrixFreePDE<dim,degree>(_userInputs) {
7 
8  // Initialize the test field object (needed for computeInvM())
10  this->fields.push_back(test_field);
11 
12  //init the MatrixFreePDE class for testing
13  this->initForTests();
14 
15  //call computeInvM()
16  this->computeInvM();
17  invMNorm=this->invM.l2_norm();
18 
19  };
21  this->matrixFreeObject.clear();
22  };
23 
24  double invMNorm;
25 
26  void setBCs(){};
27 
28  // Function to set the initial conditions (in ICs_and_BCs.h)
29  void setInitialCondition(const dealii::Point<dim> &p, const unsigned int index, double & scalar_IC, dealii::Vector<double> & vector_IC){};
30 
31  // Function to set the non-uniform Dirichlet boundary conditions (in ICs_and_BCs.h)
32  void setNonUniformDirichletBCs(const dealii::Point<dim> &p, const unsigned int index, const unsigned int direction, const double time, double & scalar_BC, dealii::Vector<double> & vector_BC){};
33 
34  private:
35  //RHS implementation for explicit solve
36  void getRHS(const MatrixFree<dim,double> &data,
37  std::vector<vectorType*> &dst,
38  const std::vector<vectorType*> &src,
39  const std::pair<unsigned int,unsigned int> &cell_range) const{};
40 
41  // Function to set the RHS of the governing equations for explicit time dependent equations (in equations.h)
42  void explicitEquationRHS(variableContainer<dim,degree,dealii::VectorizedArray<double> > & variable_list,
43  dealii::Point<dim, dealii::VectorizedArray<double> > q_point_loc) const {};
44 
45  // Function to set the RHS of the governing equations for all other equations (in equations.h)
46  void nonExplicitEquationRHS(variableContainer<dim,degree,dealii::VectorizedArray<double> > & variable_list,
47  dealii::Point<dim, dealii::VectorizedArray<double> > q_point_loc) const {};
48 
49  // Function to set the LHS of the governing equations (in equations.h)
50  void equationLHS(variableContainer<dim,degree,dealii::VectorizedArray<double> > & variable_list,
51  dealii::Point<dim, dealii::VectorizedArray<double> > q_point_loc) const {};
52 
53 
54 };
55 
56 template <int dim,typename T>
57  bool unitTest<dim,T>::test_computeInvM(int argc, char** argv, userInputParameters<dim> userInputs){
58  bool pass = false;
59  std::cout << "\nTesting 'computeInvM' in " << dim << " dimension(s)...'" << std::endl;
60 
61  //create test problem class object
62  //userInputParameters userInputs;
63  //userInputs.loadUserInput();
64 
65  testInvM<dim,1> test(userInputs);
66  //check invM norm
67  if ((test.invMNorm - 1700.0) < 1.0e-10) {pass=true;}
68  char buffer[100];
69  sprintf (buffer, "Test result for 'computeInvM' in %u dimension(s): %u\n", dim, pass);
70  std::cout << buffer;
71 
72  return pass;
73 }
std::vector< Field< dim > > fields
double invMNorm
Definition: test_invM.h:22
void setInitialCondition(const dealii::Point< dim > &p, const unsigned int index, double &scalar_IC, dealii::Vector< double > &vector_IC)
Definition: test_invM.h:29
testInvM(userInputParameters< dim > _userInputs)
Definition: test_invM.h:6
vectorType invM
~testInvM()
Definition: test_invM.h:20
bool test_computeInvM(int argc, char **argv, userInputParameters< dim >)
Definition: test_invM.h:57
void computeInvM()
Definition: invM.cc:7
Definition: fields.h:9
void getRHS(const MatrixFree< dim, double > &data, std::vector< vectorType *> &dst, const std::vector< vectorType *> &src, const std::pair< unsigned int, unsigned int > &cell_range) const
Definition: test_invM.h:36
void equationLHS(variableContainer< dim, degree, dealii::VectorizedArray< double > > &variable_list, dealii::Point< dim, dealii::VectorizedArray< double > > q_point_loc) const
Definition: test_invM.h:50
MatrixFree< dim, double > matrixFreeObject
void explicitEquationRHS(variableContainer< dim, degree, dealii::VectorizedArray< double > > &variable_list, dealii::Point< dim, dealii::VectorizedArray< double > > q_point_loc) const
Definition: test_invM.h:42
void setNonUniformDirichletBCs(const dealii::Point< dim > &p, const unsigned int index, const unsigned int direction, const double time, double &scalar_BC, dealii::Vector< double > &vector_BC)
Definition: test_invM.h:32
void nonExplicitEquationRHS(variableContainer< dim, degree, dealii::VectorizedArray< double > > &variable_list, dealii::Point< dim, dealii::VectorizedArray< double > > q_point_loc) const
Definition: test_invM.h:46
void setBCs()
Definition: test_invM.h:26
void initForTests()
Definition: initForTests.cc:7