ZeroResidualGenElement Class Reference

Mini Element to implement the eigenvalue constraint. More...

+ Inheritance diagram for ZeroResidualGenElement:

Public Member Functions

 ZeroResidualGenElement ()
 Simple constructor. More...
 
virtual ~ZeroResidualGenElement ()
 Destructor. More...
 
doubleeval ()
 Access function for the the eigenvalue. More...
 
doubleeval_pt ()
 
void fill_in_contribution_to_residuals (Vector< double > &residuals)
 
void get_residuals (Vector< double > &residuals)
 
void output (std::ostream &output, const unsigned &)
 
- 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_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

OrrSommerfeldProblem< QOrrSommerfeldElement< 1, 3 > > * eigenvalue_problem_pt
 

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_jacobian (Vector< double > &residuals, DenseMatrix< double > &jacobian)
 
virtual void fill_in_contribution_to_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &mass_matrix)
 
virtual void fill_in_contribution_to_jacobian_and_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &jacobian, 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
 

Detailed Description

Mini Element to implement the eigenvalue constraint.

///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////

Constructor & Destructor Documentation

◆ ZeroResidualGenElement()

ZeroResidualGenElement::ZeroResidualGenElement ( )
inline

Simple constructor.

938  {
939  //One item of internal data will store the real part of the eigenvalue
940  add_internal_data(new Data(1));
941 
942  //Construct the eigenvalue problem
943  eigenvalue_problem_pt = new
946  }
OrrSommerfeld problem in unit interval.
Definition: orr_sommerfeld.cc:790
OrrSommerfeldProblem< QOrrSommerfeldElement< 1, 3 > > * eigenvalue_problem_pt
Definition: orr_sommerfeld.cc:933
Definition: nodes.h:86
double * value_pt(const unsigned &i) const
Definition: nodes.h:324
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
Definition: elements.h:622
unsigned add_internal_data(Data *const &data_pt, const bool &fd=true)
Definition: elements.cc:62
unsigned N_element
Definition: orr_sommerfeld.cc:45

References oomph::GeneralisedElement::add_internal_data(), eigenvalue_problem_pt, oomph::GeneralisedElement::internal_data_pt(), Param::N_element, and oomph::Data::value_pt().

◆ ~ZeroResidualGenElement()

virtual ZeroResidualGenElement::~ZeroResidualGenElement ( )
inlinevirtual

Destructor.

950  {delete eigenvalue_problem_pt;}

References eigenvalue_problem_pt.

Member Function Documentation

◆ eval()

◆ eval_pt()

double* ZeroResidualGenElement::eval_pt ( )
inline

◆ fill_in_contribution_to_residuals()

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

Add the elemental contribution to the residuals vector. Note that this function will NOT initialise the residuals vector. It must be called after the residuals vector has been initialised to zero.

Reimplemented from oomph::GeneralisedElement.

958  {
959  //There is only one value
960  unsigned n_dof = ndof();
961  //If we're pinned return
962  if(n_dof==0) return;
963 
964  //Solve the eigenvalue problem
966  eigenvalue_problem_pt->solve_eigenproblem(4,eval);
967  //We need to make sure that we pick the eigenvalue with the largest real
968  //part
969  unsigned index=0;
970  double e_real = eval[0].real();
971 
972  //Loop over the eigenvalues and find the smallest magnitude
973  for(unsigned i=1;i<eval.size();i++)
974  {
975  if(eval[i].real() > e_real) {e_real = eval[i].real(); index=i;}
976  }
977  //Now set the residuals to be the eigenvalue with largest real part
978  residuals[0] = eval[index].real();
979  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
double & eval()
Access function for the the eigenvalue.
Definition: orr_sommerfeld.cc:953
unsigned ndof() const
Return the number of equations/dofs in the element.
Definition: elements.h:835
Definition: oomph-lib/src/generic/Vector.h:58
float real
Definition: datatypes.h:10

References eigenvalue_problem_pt, eval(), i, and oomph::GeneralisedElement::ndof().

Referenced by get_residuals().

◆ get_residuals()

void ZeroResidualGenElement::get_residuals ( Vector< double > &  residuals)
inlinevirtual

Calculate the vector of residuals of the equations in the element. By default initialise the vector to zero and then call the fill_in_contribution_to_residuals() function. Note that this entire function can be overloaded if desired.

Reimplemented from oomph::GeneralisedElement.

983  {
985  }
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Definition: orr_sommerfeld.cc:957

References fill_in_contribution_to_residuals().

◆ output()

void ZeroResidualGenElement::output ( std::ostream &  output,
const unsigned  
)
inline
988  {
989  eigenvalue_problem_pt->mesh_pt()->output(output,5);
990  }
void output(std::ostream &output, const unsigned &)
Definition: orr_sommerfeld.cc:987

References eigenvalue_problem_pt.

Member Data Documentation

◆ eigenvalue_problem_pt

OrrSommerfeldProblem<QOrrSommerfeldElement<1,3> >* ZeroResidualGenElement::eigenvalue_problem_pt
private

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