PredatorPreyElement Class Reference
+ Inheritance diagram for PredatorPreyElement:

Public Member Functions

 PredatorPreyElement ()
 
const doublelambda () const
 
const doublemu () const
 
double *& lambda_pt ()
 
double *& mu_pt ()
 
void fill_in_contribution_to_residuals (Vector< double > &residuals)
 Add the element's contribution to its residual vector (wrapper) More...
 
void fill_in_contribution_to_jacobian (Vector< double > &residuals, DenseMatrix< double > &jacobian)
 
void fill_in_contribution_to_jacobian_and_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix)
 
void fill_in_generic_residual_contribution (Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
 
void output (ostream &output)
 
- Public Member Functions inherited from oomph::GeneralisedElement
 GeneralisedElement ()
 Constructor: Initialise all pointers and all values to zero. More...
 
virtual ~GeneralisedElement ()
 Virtual destructor to clean up any memory allocated by the object. More...
 
 GeneralisedElement (const GeneralisedElement &)=delete
 Broken copy constructor. More...
 
void operator= (const GeneralisedElement &)=delete
 Broken assignment operator. More...
 
Data *& internal_data_pt (const unsigned &i)
 Return a pointer to i-th internal data object. More...
 
Data *const & internal_data_pt (const unsigned &i) const
 Return a pointer to i-th internal data object (const version) More...
 
Data *& external_data_pt (const unsigned &i)
 Return a pointer to i-th external data object. More...
 
Data *const & external_data_pt (const unsigned &i) const
 Return a pointer to i-th external data object (const version) More...
 
unsigned long eqn_number (const unsigned &ieqn_local) const
 
int local_eqn_number (const unsigned long &ieqn_global) const
 
unsigned add_external_data (Data *const &data_pt, const bool &fd=true)
 
bool external_data_fd (const unsigned &i) const
 
void exclude_external_data_fd (const unsigned &i)
 
void include_external_data_fd (const unsigned &i)
 
void flush_external_data ()
 Flush all external data. More...
 
void flush_external_data (Data *const &data_pt)
 Flush the object addressed by data_pt from the external data array. More...
 
unsigned ninternal_data () const
 Return the number of internal data objects. More...
 
unsigned nexternal_data () const
 Return the number of external data objects. More...
 
unsigned ndof () const
 Return the number of equations/dofs in the element. More...
 
void dof_vector (const unsigned &t, Vector< double > &dof)
 Return the vector of dof values at time level t. More...
 
void dof_pt_vector (Vector< double * > &dof_pt)
 Return the vector of pointers to dof values. More...
 
void set_internal_data_time_stepper (const unsigned &i, TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
 
void assign_internal_eqn_numbers (unsigned long &global_number, Vector< double * > &Dof_pt)
 
void describe_dofs (std::ostream &out, const std::string &current_string) const
 
virtual void describe_local_dofs (std::ostream &out, const std::string &current_string) const
 
void add_internal_value_pt_to_map (std::map< unsigned, double * > &map_of_value_pt)
 
virtual void assign_local_eqn_numbers (const bool &store_local_dof_pt)
 
virtual void complete_setup_of_dependencies ()
 
virtual void get_residuals (Vector< double > &residuals)
 
virtual void get_jacobian (Vector< double > &residuals, DenseMatrix< double > &jacobian)
 
virtual void get_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &mass_matrix)
 
virtual void get_jacobian_and_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix)
 
virtual void get_dresiduals_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam)
 
virtual void get_djacobian_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam)
 
virtual void get_djacobian_and_dmass_matrix_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam, DenseMatrix< double > &dmass_matrix_dparam)
 
virtual void get_hessian_vector_products (Vector< double > const &Y, DenseMatrix< double > const &C, DenseMatrix< double > &product)
 
virtual void get_inner_products (Vector< std::pair< unsigned, unsigned >> const &history_index, Vector< double > &inner_product)
 
virtual void get_inner_product_vectors (Vector< unsigned > const &history_index, Vector< Vector< double >> &inner_product_vector)
 
virtual unsigned self_test ()
 
virtual void compute_norm (Vector< double > &norm)
 
virtual void compute_norm (double &norm)
 
virtual unsigned ndof_types () const
 
virtual void get_dof_numbers_for_unknowns (std::list< std::pair< unsigned long, unsigned >> &dof_lookup_list) const
 

Private Attributes

doubleLambda_pt
 
doubleMu_pt
 
unsigned Internal_index
 

Additional Inherited Members

- Static Public Attributes inherited from oomph::GeneralisedElement
static bool Suppress_warning_about_repeated_internal_data
 
static bool Suppress_warning_about_repeated_external_data = true
 
static double Default_fd_jacobian_step = 1.0e-8
 
- Protected Member Functions inherited from oomph::GeneralisedElement
unsigned add_internal_data (Data *const &data_pt, const bool &fd=true)
 
bool internal_data_fd (const unsigned &i) const
 
void exclude_internal_data_fd (const unsigned &i)
 
void include_internal_data_fd (const unsigned &i)
 
void clear_global_eqn_numbers ()
 
void add_global_eqn_numbers (std::deque< unsigned long > const &global_eqn_numbers, std::deque< double * > const &global_dof_pt)
 
virtual void assign_internal_and_external_local_eqn_numbers (const bool &store_local_dof_pt)
 
virtual void assign_all_generic_local_eqn_numbers (const bool &store_local_dof_pt)
 
virtual void assign_additional_local_eqn_numbers ()
 
int internal_local_eqn (const unsigned &i, const unsigned &j) const
 
int external_local_eqn (const unsigned &i, const unsigned &j)
 
void fill_in_jacobian_from_internal_by_fd (Vector< double > &residuals, DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
 
void fill_in_jacobian_from_internal_by_fd (DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
 
void fill_in_jacobian_from_external_by_fd (Vector< double > &residuals, DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
 
void fill_in_jacobian_from_external_by_fd (DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
 
virtual void update_before_internal_fd ()
 
virtual void reset_after_internal_fd ()
 
virtual void update_in_internal_fd (const unsigned &i)
 
virtual void reset_in_internal_fd (const unsigned &i)
 
virtual void update_before_external_fd ()
 
virtual void reset_after_external_fd ()
 
virtual void update_in_external_fd (const unsigned &i)
 
virtual void reset_in_external_fd (const unsigned &i)
 
virtual void fill_in_contribution_to_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &mass_matrix)
 
virtual void fill_in_contribution_to_dresiduals_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam)
 
virtual void fill_in_contribution_to_djacobian_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam)
 
virtual void fill_in_contribution_to_djacobian_and_dmass_matrix_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam, DenseMatrix< double > &dmass_matrix_dparam)
 
virtual void fill_in_contribution_to_hessian_vector_products (Vector< double > const &Y, DenseMatrix< double > const &C, DenseMatrix< double > &product)
 
virtual void fill_in_contribution_to_inner_products (Vector< std::pair< unsigned, unsigned >> const &history_index, Vector< double > &inner_product)
 
virtual void fill_in_contribution_to_inner_product_vectors (Vector< unsigned > const &history_index, Vector< Vector< double >> &inner_product_vector)
 
- Static Protected Attributes inherited from oomph::GeneralisedElement
static DenseMatrix< doubleDummy_matrix
 
static std::deque< double * > Dof_pt_deque
 

Constructor & Destructor Documentation

◆ PredatorPreyElement()

PredatorPreyElement::PredatorPreyElement ( )
inline
65  {
66  Internal_index = this->add_internal_data(new Data(3));
67  }
unsigned Internal_index
Definition: hopf.cc:60
Definition: nodes.h:86
unsigned add_internal_data(Data *const &data_pt, const bool &fd=true)
Definition: elements.cc:62

Member Function Documentation

◆ fill_in_contribution_to_jacobian()

void PredatorPreyElement::fill_in_contribution_to_jacobian ( Vector< double > &  residuals,
DenseMatrix< double > &  jacobian 
)
inlinevirtual

Add the element's contribution to its residual vector and element Jacobian matrix (wrapper)

Reimplemented from oomph::GeneralisedElement.

93  {
94  //Call the generic routine with the flag set to 1
96  jacobian,
97  GeneralisedElement::Dummy_matrix,1);
98  }
void fill_in_generic_residual_contribution(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Definition: hopf.cc:113

◆ fill_in_contribution_to_jacobian_and_mass_matrix()

void PredatorPreyElement::fill_in_contribution_to_jacobian_and_mass_matrix ( Vector< double > &  residuals,
DenseMatrix< double > &  jacobian,
DenseMatrix< double > &  mass_matrix 
)
inlinevirtual

Add the element's contribution to its residuals vector, jacobian matrix and mass matrix

Reimplemented from oomph::GeneralisedElement.

106  {
107  //Call the generic routine with the flag set to 2
108  fill_in_generic_residual_contribution(residuals,jacobian,mass_matrix,2);
109  }

◆ fill_in_contribution_to_residuals()

void PredatorPreyElement::fill_in_contribution_to_residuals ( Vector< double > &  residuals)
inlinevirtual

Add the element's contribution to its residual vector (wrapper)

Reimplemented from oomph::GeneralisedElement.

81  {
82  //Call the generic residuals function with flag set to 0
83  //using a dummy matrix arguments
85  residuals,GeneralisedElement::Dummy_matrix,
86  GeneralisedElement::Dummy_matrix,0);
87  }

◆ fill_in_generic_residual_contribution()

void PredatorPreyElement::fill_in_generic_residual_contribution ( Vector< double > &  residuals,
DenseMatrix< double > &  jacobian,
DenseMatrix< double > &  mass_matrix,
unsigned  flag 
)
inline

Calculate the elemental contributions to the global residual vector for the weak form of the Poisson equation

117  {
118  //Set the mass matrix
119  if(flag==2)
120  {
121  for(unsigned i=0;i<3;i++) {mass_matrix(i,i) = 1.0;}
122  }
123 
124  //Get the value of the parameter
125  double lam = lambda();
126  double m = mu();
127 
128  //Get the values of the unknowns
129  double u[3];
130  for(unsigned i=0;i<3;i++)
132 
133  unsigned local_eqn = internal_local_eqn(Internal_index,0);
134  residuals[local_eqn] = u[0]*(1.0-u[0]) - m*u[0]*u[1];
135 
136  if(flag)
137  {
138  unsigned local_unknown = internal_local_eqn(Internal_index,0);
139  jacobian(local_eqn,local_unknown) = 1.0 - 2.0*u[0] - m*u[1];
140 
141  local_unknown = internal_local_eqn(Internal_index,1);
142  jacobian(local_eqn,local_unknown) = -m*u[0];
143  }
144 
145 
146  local_eqn = internal_local_eqn(Internal_index,1);
147  residuals[local_eqn] =
148  -0.25*u[1] + m*u[0]*u[1] - 3.0*u[1]*u[2] - lam*(1.0 - exp(-5.0*u[1]));
149 
150  if(flag)
151  {
152  unsigned local_unknown = internal_local_eqn(Internal_index,0);
153  jacobian(local_eqn,local_unknown) =
154  m*u[1];
155 
156  local_unknown = internal_local_eqn(Internal_index,1);
157  jacobian(local_eqn,local_unknown) =
158  -0.25 + m*u[0] - 3.0*u[2] - lam*5.0*exp(-5.0*u[1]);
159 
160  local_unknown = internal_local_eqn(Internal_index,2);
161  jacobian(local_eqn,local_unknown) = -3.0*u[1];
162  }
163 
164  local_eqn = internal_local_eqn(Internal_index,2);
165  residuals[local_eqn] =
166  -0.5*u[2] + 3.0*u[1]*u[2];
167 
168  if(flag)
169  {
170  unsigned local_unknown = internal_local_eqn(Internal_index,1);
171  jacobian(local_eqn,local_unknown) = 3.0*u[2];
172 
173  local_unknown = internal_local_eqn(Internal_index,2);
174  jacobian(local_eqn,local_unknown) = -0.5 + 3.0*u[1];
175  }
176 
177  } //End of function
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const double & mu() const
Definition: hopf.cc:72
const double & lambda() const
Definition: hopf.cc:70
double value(const unsigned &i) const
Definition: nodes.h:293
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
Definition: elements.h:622
int internal_local_eqn(const unsigned &i, const unsigned &j) const
Definition: elements.h:267
int * m
Definition: level2_cplx_impl.h:294
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 exp(const bfloat16 &a)
Definition: BFloat16.h:615

References Eigen::bfloat16_impl::exp(), i, lambda, m, and Global_Parameters::mu.

◆ lambda()

const double& PredatorPreyElement::lambda ( ) const
inline
70 {return *Lambda_pt;}
double * Lambda_pt
Definition: hopf.cc:56

References Global_Physical_Variables::Lambda_pt.

◆ lambda_pt()

double* & PredatorPreyElement::lambda_pt ( )
inline

◆ mu()

const double& PredatorPreyElement::mu ( ) const
inline
72 {return *Mu_pt;}
double * Mu_pt
Definition: hopf.cc:58

References Global_Physical_Variables::Mu_pt.

◆ mu_pt()

double* & PredatorPreyElement::mu_pt ( )
inline
77 {return Mu_pt;}

References Global_Physical_Variables::Mu_pt.

◆ output()

void PredatorPreyElement::output ( ostream &  output)
inline
181  {
182  for(unsigned n=0;n<3;n++)
183  {
184  output << this->internal_data_pt(Internal_index)->value(n) << " ";
185  }
186  output << std::endl;
187  } //End of function
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
void output(ostream &output)
Definition: hopf.cc:180

References n, and output().

Member Data Documentation

◆ Internal_index

unsigned PredatorPreyElement::Internal_index
private

◆ Lambda_pt

double* PredatorPreyElement::Lambda_pt
private

◆ Mu_pt

double* PredatorPreyElement::Mu_pt
private

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