PMLHelmholtzMGProblem< ELEMENT > Class Template Reference
+ Inheritance diagram for PMLHelmholtzMGProblem< ELEMENT >:

Public Member Functions

 PMLHelmholtzMGProblem ()
 Constructor. More...
 
 ~PMLHelmholtzMGProblem ()
 Destructor (empty) More...
 
void actions_before_newton_solve ()
 Update the problem specs before solve (empty) More...
 
void actions_after_newton_solve ()
 Update the problem specs after solve (empty) More...
 
void doc_solution ()
 Doc the solution: doc_info contains labels/output directory etc. More...
 
void create_pml_meshes ()
 Create PML meshes. More...
 
void apply_boundary_conditions ()
 Apply boundary conditions. More...
 
void actions_before_adapt ()
 Actions before adapt: Wipe the PML meshes. More...
 
void actions_after_adapt ()
 Actions after adapt: Rebuild the PML meshes. More...
 
void set_gmres_multigrid_solver ()
 Set GMRES preconditioner by multigrid as the linear solver. More...
 
- Public Member Functions inherited from oomph::HelmholtzMGProblem
 HelmholtzMGProblem ()
 Constructor. Initialise pointers to coarser and finer levels. More...
 
virtual ~HelmholtzMGProblem ()
 Destructor (empty) More...
 
- Public Member Functions inherited from oomph::Problem
virtual void debug_hook_fct (const unsigned &i)
 
void set_analytic_dparameter (double *const &parameter_pt)
 
void unset_analytic_dparameter (double *const &parameter_pt)
 
bool is_dparameter_calculated_analytically (double *const &parameter_pt)
 
void set_analytic_hessian_products ()
 
void unset_analytic_hessian_products ()
 
bool are_hessian_products_calculated_analytically ()
 
void set_pinned_values_to_zero ()
 
bool distributed () const
 
OomphCommunicatorcommunicator_pt ()
 access function to the oomph-lib communicator More...
 
const OomphCommunicatorcommunicator_pt () const
 access function to the oomph-lib communicator, const version More...
 
 Problem ()
 
 Problem (const Problem &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const Problem &)=delete
 Broken assignment operator. More...
 
virtual ~Problem ()
 Virtual destructor to clean up memory. More...
 
Mesh *& mesh_pt ()
 Return a pointer to the global mesh. More...
 
Mesh *const & mesh_pt () const
 Return a pointer to the global mesh (const version) More...
 
Mesh *& mesh_pt (const unsigned &imesh)
 
Mesh *const & mesh_pt (const unsigned &imesh) const
 Return a pointer to the i-th submesh (const version) More...
 
unsigned nsub_mesh () const
 Return number of submeshes. More...
 
unsigned add_sub_mesh (Mesh *const &mesh_pt)
 
void flush_sub_meshes ()
 
void build_global_mesh ()
 
void rebuild_global_mesh ()
 
LinearSolver *& linear_solver_pt ()
 Return a pointer to the linear solver object. More...
 
LinearSolver *const & linear_solver_pt () const
 Return a pointer to the linear solver object (const version) More...
 
LinearSolver *& mass_matrix_solver_for_explicit_timestepper_pt ()
 
LinearSolvermass_matrix_solver_for_explicit_timestepper_pt () const
 
EigenSolver *& eigen_solver_pt ()
 Return a pointer to the eigen solver object. More...
 
EigenSolver *const & eigen_solver_pt () const
 Return a pointer to the eigen solver object (const version) More...
 
Time *& time_pt ()
 Return a pointer to the global time object. More...
 
Timetime_pt () const
 Return a pointer to the global time object (const version). More...
 
doubletime ()
 Return the current value of continuous time. More...
 
double time () const
 Return the current value of continuous time (const version) More...
 
TimeStepper *& time_stepper_pt ()
 
const TimeSteppertime_stepper_pt () const
 
TimeStepper *& time_stepper_pt (const unsigned &i)
 Return a pointer to the i-th timestepper. More...
 
ExplicitTimeStepper *& explicit_time_stepper_pt ()
 Return a pointer to the explicit timestepper. More...
 
unsigned long set_timestepper_for_all_data (TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data=false)
 
virtual void shift_time_values ()
 Shift all values along to prepare for next timestep. More...
 
AssemblyHandler *& assembly_handler_pt ()
 Return a pointer to the assembly handler object. More...
 
AssemblyHandler *const & assembly_handler_pt () const
 Return a pointer to the assembly handler object (const version) More...
 
doubleminimum_dt ()
 Access function to min timestep in adaptive timestepping. More...
 
doublemaximum_dt ()
 Access function to max timestep in adaptive timestepping. More...
 
unsignedmax_newton_iterations ()
 Access function to max Newton iterations before giving up. More...
 
void problem_is_nonlinear (const bool &prob_lin)
 Access function to Problem_is_nonlinear. More...
 
doublemax_residuals ()
 
booltime_adaptive_newton_crash_on_solve_fail ()
 Access function for Time_adaptive_newton_crash_on_solve_fail. More...
 
doublenewton_solver_tolerance ()
 
void add_time_stepper_pt (TimeStepper *const &time_stepper_pt)
 
void set_explicit_time_stepper_pt (ExplicitTimeStepper *const &explicit_time_stepper_pt)
 
void initialise_dt (const double &dt)
 
void initialise_dt (const Vector< double > &dt)
 
Data *& global_data_pt (const unsigned &i)
 Return a pointer to the the i-th global data object. More...
 
void add_global_data (Data *const &global_data_pt)
 
void flush_global_data ()
 
LinearAlgebraDistribution *const & dof_distribution_pt () const
 Return the pointer to the dof distribution (read-only) More...
 
unsigned long ndof () const
 Return the number of dofs. More...
 
unsigned ntime_stepper () const
 Return the number of time steppers. More...
 
unsigned nglobal_data () const
 Return the number of global data values. More...
 
unsigned self_test ()
 Self-test: Check meshes and global data. Return 0 for OK. More...
 
void enable_store_local_dof_pt_in_elements ()
 
void disable_store_local_dof_pt_in_elements ()
 
unsigned long assign_eqn_numbers (const bool &assign_local_eqn_numbers=true)
 
void describe_dofs (std::ostream &out= *(oomph_info.stream_pt())) const
 
void enable_discontinuous_formulation ()
 
void disable_discontinuous_formulation ()
 
void get_dofs (DoubleVector &dofs) const
 
void get_dofs (const unsigned &t, DoubleVector &dofs) const
 Return vector of the t'th history value of all dofs. More...
 
void set_dofs (const DoubleVector &dofs)
 Set the values of the dofs. More...
 
void set_dofs (const unsigned &t, DoubleVector &dofs)
 Set the history values of the dofs. More...
 
void set_dofs (const unsigned &t, Vector< double * > &dof_pt)
 
void add_to_dofs (const double &lambda, const DoubleVector &increment_dofs)
 Add lambda x incremenet_dofs[l] to the l-th dof. More...
 
doubleglobal_dof_pt (const unsigned &i)
 
doubledof (const unsigned &i)
 i-th dof in the problem More...
 
double dof (const unsigned &i) const
 i-th dof in the problem (const version) More...
 
double *& dof_pt (const unsigned &i)
 Pointer to i-th dof in the problem. More...
 
doubledof_pt (const unsigned &i) const
 Pointer to i-th dof in the problem (const version) More...
 
virtual void get_inverse_mass_matrix_times_residuals (DoubleVector &Mres)
 
virtual void get_dvaluesdt (DoubleVector &f)
 
virtual void get_residuals (DoubleVector &residuals)
 Get the total residuals Vector for the problem. More...
 
virtual void get_jacobian (DoubleVector &residuals, DenseDoubleMatrix &jacobian)
 
virtual void get_jacobian (DoubleVector &residuals, CRDoubleMatrix &jacobian)
 
virtual void get_jacobian (DoubleVector &residuals, CCDoubleMatrix &jacobian)
 
virtual void get_jacobian (DoubleVector &residuals, SumOfMatrices &jacobian)
 
void get_fd_jacobian (DoubleVector &residuals, DenseMatrix< double > &jacobian)
 Get the full Jacobian by finite differencing. More...
 
void get_derivative_wrt_global_parameter (double *const &parameter_pt, DoubleVector &result)
 
void get_hessian_vector_products (DoubleVectorWithHaloEntries const &Y, Vector< DoubleVectorWithHaloEntries > const &C, Vector< DoubleVectorWithHaloEntries > &product)
 
void solve_eigenproblem (const unsigned &n_eval, Vector< std::complex< double >> &eigenvalue, Vector< DoubleVector > &eigenvector, const bool &steady=true)
 Solve the eigenproblem. More...
 
void solve_eigenproblem (const unsigned &n_eval, Vector< std::complex< double >> &eigenvalue, const bool &steady=true)
 
virtual void get_eigenproblem_matrices (CRDoubleMatrix &mass_matrix, CRDoubleMatrix &main_matrix, const double &shift=0.0)
 
void assign_eigenvector_to_dofs (DoubleVector &eigenvector)
 Assign the eigenvector passed to the function to the dofs. More...
 
void add_eigenvector_to_dofs (const double &epsilon, const DoubleVector &eigenvector)
 
void store_current_dof_values ()
 Store the current values of the degrees of freedom. More...
 
void restore_dof_values ()
 Restore the stored values of the degrees of freedom. More...
 
void enable_jacobian_reuse ()
 
void disable_jacobian_reuse ()
 Disable recycling of Jacobian in Newton iteration. More...
 
bool jacobian_reuse_is_enabled ()
 Is recycling of Jacobian in Newton iteration enabled? More...
 
booluse_predictor_values_as_initial_guess ()
 
void newton_solve ()
 Use Newton method to solve the problem. More...
 
void enable_globally_convergent_newton_method ()
 enable globally convergent Newton method More...
 
void disable_globally_convergent_newton_method ()
 disable globally convergent Newton method More...
 
void newton_solve (unsigned const &max_adapt)
 
void steady_newton_solve (unsigned const &max_adapt=0)
 
void copy (Problem *orig_problem_pt)
 
virtual Problemmake_copy ()
 
virtual void read (std::ifstream &restart_file, bool &unsteady_restart)
 
virtual void read (std::ifstream &restart_file)
 
virtual void dump (std::ofstream &dump_file) const
 
void dump (const std::string &dump_file_name) const
 
void delete_all_external_storage ()
 
virtual void symmetrise_eigenfunction_for_adaptive_pitchfork_tracking ()
 
doublebifurcation_parameter_pt () const
 
void get_bifurcation_eigenfunction (Vector< DoubleVector > &eigenfunction)
 
void activate_fold_tracking (double *const &parameter_pt, const bool &block_solve=true)
 
void activate_bifurcation_tracking (double *const &parameter_pt, const DoubleVector &eigenvector, const bool &block_solve=true)
 
void activate_bifurcation_tracking (double *const &parameter_pt, const DoubleVector &eigenvector, const DoubleVector &normalisation, const bool &block_solve=true)
 
void activate_pitchfork_tracking (double *const &parameter_pt, const DoubleVector &symmetry_vector, const bool &block_solve=true)
 
void activate_hopf_tracking (double *const &parameter_pt, const bool &block_solve=true)
 
void activate_hopf_tracking (double *const &parameter_pt, const double &omega, const DoubleVector &null_real, const DoubleVector &null_imag, const bool &block_solve=true)
 
void deactivate_bifurcation_tracking ()
 
void reset_assembly_handler_to_default ()
 Reset the system to the standard non-augemented state. More...
 
double arc_length_step_solve (double *const &parameter_pt, const double &ds, const unsigned &max_adapt=0)
 
double arc_length_step_solve (Data *const &data_pt, const unsigned &data_index, const double &ds, const unsigned &max_adapt=0)
 
void reset_arc_length_parameters ()
 
intsign_of_jacobian ()
 
void explicit_timestep (const double &dt, const bool &shift_values=true)
 Take an explicit timestep of size dt. More...
 
void unsteady_newton_solve (const double &dt)
 
void unsteady_newton_solve (const double &dt, const bool &shift_values)
 
void unsteady_newton_solve (const double &dt, const unsigned &max_adapt, const bool &first, const bool &shift=true)
 
double doubly_adaptive_unsteady_newton_solve (const double &dt, const double &epsilon, const unsigned &max_adapt, const bool &first, const bool &shift=true)
 
double doubly_adaptive_unsteady_newton_solve (const double &dt, const double &epsilon, const unsigned &max_adapt, const unsigned &suppress_resolve_after_spatial_adapt_flag, const bool &first, const bool &shift=true)
 
double adaptive_unsteady_newton_solve (const double &dt_desired, const double &epsilon)
 
double adaptive_unsteady_newton_solve (const double &dt_desired, const double &epsilon, const bool &shift_values)
 
void assign_initial_values_impulsive ()
 
void assign_initial_values_impulsive (const double &dt)
 
void calculate_predictions ()
 Calculate predictions. More...
 
void enable_mass_matrix_reuse ()
 
void disable_mass_matrix_reuse ()
 
bool mass_matrix_reuse_is_enabled ()
 Return whether the mass matrix is being reused. More...
 
void refine_uniformly (const Vector< unsigned > &nrefine_for_mesh)
 
void refine_uniformly (const Vector< unsigned > &nrefine_for_mesh, DocInfo &doc_info)
 
void refine_uniformly_and_prune (const Vector< unsigned > &nrefine_for_mesh)
 
void refine_uniformly_and_prune (const Vector< unsigned > &nrefine_for_mesh, DocInfo &doc_info)
 
void refine_uniformly (DocInfo &doc_info)
 
void refine_uniformly_and_prune (DocInfo &doc_info)
 
void refine_uniformly ()
 
void refine_uniformly (const unsigned &i_mesh, DocInfo &doc_info)
 Do uniform refinement for submesh i_mesh with documentation. More...
 
void refine_uniformly (const unsigned &i_mesh)
 Do uniform refinement for submesh i_mesh without documentation. More...
 
void p_refine_uniformly (const Vector< unsigned > &nrefine_for_mesh)
 
void p_refine_uniformly (const Vector< unsigned > &nrefine_for_mesh, DocInfo &doc_info)
 
void p_refine_uniformly_and_prune (const Vector< unsigned > &nrefine_for_mesh)
 
void p_refine_uniformly_and_prune (const Vector< unsigned > &nrefine_for_mesh, DocInfo &doc_info)
 
void p_refine_uniformly (DocInfo &doc_info)
 
void p_refine_uniformly_and_prune (DocInfo &doc_info)
 
void p_refine_uniformly ()
 
void p_refine_uniformly (const unsigned &i_mesh, DocInfo &doc_info)
 Do uniform p-refinement for submesh i_mesh with documentation. More...
 
void p_refine_uniformly (const unsigned &i_mesh)
 Do uniform p-refinement for submesh i_mesh without documentation. More...
 
void refine_selected_elements (const Vector< unsigned > &elements_to_be_refined)
 
void refine_selected_elements (const Vector< RefineableElement * > &elements_to_be_refined_pt)
 
void refine_selected_elements (const unsigned &i_mesh, const Vector< unsigned > &elements_to_be_refined)
 
void refine_selected_elements (const unsigned &i_mesh, const Vector< RefineableElement * > &elements_to_be_refined_pt)
 
void refine_selected_elements (const Vector< Vector< unsigned >> &elements_to_be_refined)
 
void refine_selected_elements (const Vector< Vector< RefineableElement * >> &elements_to_be_refined_pt)
 
void p_refine_selected_elements (const Vector< unsigned > &elements_to_be_refined)
 
void p_refine_selected_elements (const Vector< PRefineableElement * > &elements_to_be_refined_pt)
 
void p_refine_selected_elements (const unsigned &i_mesh, const Vector< unsigned > &elements_to_be_refined)
 
void p_refine_selected_elements (const unsigned &i_mesh, const Vector< PRefineableElement * > &elements_to_be_refined_pt)
 
void p_refine_selected_elements (const Vector< Vector< unsigned >> &elements_to_be_refined)
 
void p_refine_selected_elements (const Vector< Vector< PRefineableElement * >> &elements_to_be_refined_pt)
 
unsigned unrefine_uniformly ()
 
unsigned unrefine_uniformly (const unsigned &i_mesh)
 
void p_unrefine_uniformly (DocInfo &doc_info)
 
void p_unrefine_uniformly (const unsigned &i_mesh, DocInfo &doc_info)
 Do uniform p-unrefinement for submesh i_mesh without documentation. More...
 
void adapt (unsigned &n_refined, unsigned &n_unrefined)
 
void adapt ()
 
void p_adapt (unsigned &n_refined, unsigned &n_unrefined)
 
void p_adapt ()
 
void adapt_based_on_error_estimates (unsigned &n_refined, unsigned &n_unrefined, Vector< Vector< double >> &elemental_error)
 
void adapt_based_on_error_estimates (Vector< Vector< double >> &elemental_error)
 
void get_all_error_estimates (Vector< Vector< double >> &elemental_error)
 
void doc_errors (DocInfo &doc_info)
 Get max and min error for all elements in submeshes. More...
 
void doc_errors ()
 Get max and min error for all elements in submeshes. More...
 
void enable_info_in_newton_solve ()
 
void disable_info_in_newton_solve ()
 Disable the output of information when in the newton solver. More...
 
- Public Member Functions inherited from oomph::ExplicitTimeSteppableObject
 ExplicitTimeSteppableObject ()
 Empty constructor. More...
 
 ExplicitTimeSteppableObject (const ExplicitTimeSteppableObject &)=delete
 Broken copy constructor. More...
 
void operator= (const ExplicitTimeSteppableObject &)=delete
 Broken assignment operator. More...
 
virtual ~ExplicitTimeSteppableObject ()
 Empty destructor. More...
 
virtual void actions_before_explicit_stage ()
 
virtual void actions_after_explicit_stage ()
 

Private Member Functions

HelmholtzMGProblemmake_new_problem ()
 Overload the make_new_problem function to return an object of this class. More...
 
TreeBasedRefineableMeshBasemg_bulk_mesh_pt ()
 

Private Attributes

RefineableQuadFromTriangleMesh< ELEMENT > * Bulk_mesh_pt
 Pointer to the refineable "bulk" mesh. More...
 
MeshPML_right_mesh_pt
 Pointer to the right PML mesh. More...
 
MeshPML_top_mesh_pt
 Pointer to the top PML mesh. More...
 
MeshPML_left_mesh_pt
 Pointer to the left PML mesh. More...
 
MeshPML_bottom_mesh_pt
 Pointer to the bottom PML mesh. More...
 
MeshPML_top_right_mesh_pt
 Pointer to the top right corner PML mesh. More...
 
MeshPML_top_left_mesh_pt
 Pointer to the top left corner PML mesh. More...
 
MeshPML_bottom_right_mesh_pt
 Pointer to the bottom right corner PML mesh. More...
 
MeshPML_bottom_left_mesh_pt
 Pointer to the bottom left corner PML mesh. More...
 
ofstream Trace_file
 Trace file. More...
 

Additional Inherited Members

- Public Types inherited from oomph::Problem
typedef void(* SpatialErrorEstimatorFctPt) (Mesh *&mesh_pt, Vector< double > &elemental_error)
 Function pointer for spatial error estimator. More...
 
typedef void(* SpatialErrorEstimatorWithDocFctPt) (Mesh *&mesh_pt, Vector< double > &elemental_error, DocInfo &doc_info)
 Function pointer for spatial error estimator with doc. More...
 
- Public Attributes inherited from oomph::Problem
bool Shut_up_in_newton_solve
 
- Static Public Attributes inherited from oomph::Problem
static bool Suppress_warning_about_actions_before_read_unstructured_meshes
 
- Protected Types inherited from oomph::Problem
enum  Assembly_method {
  Perform_assembly_using_vectors_of_pairs , Perform_assembly_using_two_vectors , Perform_assembly_using_maps , Perform_assembly_using_lists ,
  Perform_assembly_using_two_arrays
}
 Enumerated flags to determine which sparse assembly method is used. More...
 
- Protected Member Functions inherited from oomph::Problem
unsigned setup_element_count_per_dof ()
 
virtual void sparse_assemble_row_or_column_compressed (Vector< int * > &column_or_row_index, Vector< int * > &row_or_column_start, Vector< double * > &value, Vector< unsigned > &nnz, Vector< double * > &residual, bool compressed_row_flag)
 
virtual void actions_before_newton_convergence_check ()
 
virtual void actions_before_newton_step ()
 
virtual void actions_after_newton_step ()
 
virtual void actions_before_implicit_timestep ()
 
virtual void actions_after_implicit_timestep ()
 
virtual void actions_after_implicit_timestep_and_error_estimation ()
 
virtual void actions_before_explicit_timestep ()
 Actions that should be performed before each explicit time step. More...
 
virtual void actions_after_explicit_timestep ()
 Actions that should be performed after each explicit time step. More...
 
virtual void actions_before_read_unstructured_meshes ()
 
virtual void actions_after_read_unstructured_meshes ()
 
virtual void actions_after_change_in_global_parameter (double *const &parameter_pt)
 
virtual void actions_after_change_in_bifurcation_parameter ()
 
virtual void actions_after_parameter_increase (double *const &parameter_pt)
 
doubledof_derivative (const unsigned &i)
 
doubledof_current (const unsigned &i)
 
virtual void set_initial_condition ()
 
virtual double global_temporal_error_norm ()
 
unsigned newton_solve_continuation (double *const &parameter_pt)
 
unsigned newton_solve_continuation (double *const &parameter_pt, DoubleVector &z)
 
void calculate_continuation_derivatives (double *const &parameter_pt)
 
void calculate_continuation_derivatives (const DoubleVector &z)
 
void calculate_continuation_derivatives_fd (double *const &parameter_pt)
 
bool does_pointer_correspond_to_problem_data (double *const &parameter_pt)
 
void set_consistent_pinned_values_for_continuation ()
 
- Protected Attributes inherited from oomph::Problem
Vector< Problem * > Copy_of_problem_pt
 
std::map< double *, boolCalculate_dparameter_analytic
 
bool Calculate_hessian_products_analytic
 
LinearAlgebraDistributionDof_distribution_pt
 
Vector< double * > Dof_pt
 Vector of pointers to dofs. More...
 
DoubleVectorWithHaloEntries Element_count_per_dof
 
double Relaxation_factor
 
double Newton_solver_tolerance
 
unsigned Max_newton_iterations
 Maximum number of Newton iterations. More...
 
unsigned Nnewton_iter_taken
 
Vector< doubleMax_res
 Maximum residuals at start and after each newton iteration. More...
 
double Max_residuals
 
bool Time_adaptive_newton_crash_on_solve_fail
 
bool Jacobian_reuse_is_enabled
 Is re-use of Jacobian in Newton iteration enabled? Default: false. More...
 
bool Jacobian_has_been_computed
 
bool Problem_is_nonlinear
 
bool Pause_at_end_of_sparse_assembly
 
bool Doc_time_in_distribute
 
unsigned Sparse_assembly_method
 
unsigned Sparse_assemble_with_arrays_initial_allocation
 
unsigned Sparse_assemble_with_arrays_allocation_increment
 
Vector< Vector< unsigned > > Sparse_assemble_with_arrays_previous_allocation
 
double Numerical_zero_for_sparse_assembly
 
double FD_step_used_in_get_hessian_vector_products
 
bool Mass_matrix_reuse_is_enabled
 
bool Mass_matrix_has_been_computed
 
bool Discontinuous_element_formulation
 
double Minimum_dt
 Minimum desired dt: if dt falls below this value, exit. More...
 
double Maximum_dt
 Maximum desired dt. More...
 
double DTSF_max_increase
 
double DTSF_min_decrease
 
double Minimum_dt_but_still_proceed
 
bool Scale_arc_length
 Boolean to control whether arc-length should be scaled. More...
 
double Desired_proportion_of_arc_length
 Proportion of the arc-length to taken by the parameter. More...
 
double Theta_squared
 
int Sign_of_jacobian
 Storage for the sign of the global Jacobian. More...
 
double Continuation_direction
 
double Parameter_derivative
 Storage for the derivative of the global parameter wrt arc-length. More...
 
double Parameter_current
 Storage for the present value of the global parameter. More...
 
bool Use_continuation_timestepper
 Boolean to control original or new storage of dof stuff. More...
 
unsigned Dof_derivative_offset
 
unsigned Dof_current_offset
 
Vector< doubleDof_derivative
 Storage for the derivative of the problem variables wrt arc-length. More...
 
Vector< doubleDof_current
 Storage for the present values of the variables. More...
 
double Ds_current
 Storage for the current step value. More...
 
unsigned Desired_newton_iterations_ds
 
double Minimum_ds
 Minimum desired value of arc-length. More...
 
bool Bifurcation_detection
 Boolean to control bifurcation detection via determinant of Jacobian. More...
 
bool Bisect_to_find_bifurcation
 Boolean to control wheter bisection is used to located bifurcation. More...
 
bool First_jacobian_sign_change
 Boolean to indicate whether a sign change has occured in the Jacobian. More...
 
bool Arc_length_step_taken
 Boolean to indicate whether an arc-length step has been taken. More...
 
bool Use_finite_differences_for_continuation_derivatives
 
OomphCommunicatorCommunicator_pt
 The communicator for this problem. More...
 
bool Always_take_one_newton_step
 
double Timestep_reduction_factor_after_nonconvergence
 
bool Keep_temporal_error_below_tolerance
 
- Static Protected Attributes inherited from oomph::Problem
static ContinuationStorageScheme Continuation_time_stepper
 Storage for the single static continuation timestorage object. More...
 

Detailed Description

template<class ELEMENT>
class PMLHelmholtzMGProblem< ELEMENT >

/////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// HelmholtzMGProblem class to demonstrate use of perfectly matched layers for Helmholtz problems.

Constructor & Destructor Documentation

◆ PMLHelmholtzMGProblem()

template<class ELEMENT >
PMLHelmholtzMGProblem< ELEMENT >::PMLHelmholtzMGProblem

Constructor.

Constructor for Helmholtz problem.

414 {
415  // Create boundary information: Outer boundary
416  //--------------------------------------------
417  TriangleMeshClosedCurve* outer_boundary_pt=0;
418 
419  Vector<TriangleMeshCurveSection*> outer_boundary_line_pt(4);
420 
421  // Each polyline only has three vertices, provide storage for their
422  // coordinates
423  Vector<Vector<double> > vertex_coord(2);
424  for(unsigned i=0;i<2;i++)
425  {
426  vertex_coord[i].resize(2);
427  }
428 
429  // First polyline
430  vertex_coord[0][0]=0.0;
431  vertex_coord[0][1]=0.0;
432  vertex_coord[1][0]=GlobalParameters::Lx;
433  vertex_coord[1][1]=0.0;
434 
435  // Build the 1st boundary polyline
436  unsigned boundary_id=2;
437  outer_boundary_line_pt[0]=new TriangleMeshPolyLine(vertex_coord,boundary_id);
438 
439  // Second boundary polyline
440  vertex_coord[0][0]=GlobalParameters::Lx;
441  vertex_coord[0][1]=0.0;
442  vertex_coord[1][0]=GlobalParameters::Lx;
443  vertex_coord[1][1]=GlobalParameters::Ly;
444 
445  // Build the 2nd boundary polyline
446  boundary_id=3;
447  outer_boundary_line_pt[1]=new TriangleMeshPolyLine(vertex_coord,boundary_id);
448 
449  // Third boundary polyline
450  vertex_coord[0][0]=GlobalParameters::Lx;
451  vertex_coord[0][1]=GlobalParameters::Ly;
452  vertex_coord[1][0]=0.0;
453  vertex_coord[1][1]=GlobalParameters::Ly;
454 
455  // Build the 3rd boundary polyline
456  boundary_id=4;
457  outer_boundary_line_pt[2]=new TriangleMeshPolyLine(vertex_coord,boundary_id);
458 
459  // Fourth boundary polyline
460  vertex_coord[0][0]=0.0;
461  vertex_coord[0][1]=GlobalParameters::Ly;
462  vertex_coord[1][0]=0.0;
463  vertex_coord[1][1]=0.0;
464 
465  // Build the 4th boundary polyline
466  boundary_id=5;
467  outer_boundary_line_pt[3]=new TriangleMeshPolyLine(vertex_coord,boundary_id);
468 
469  // Create the triangle mesh polygon for outer boundary
470  outer_boundary_pt=new TriangleMeshPolygon(outer_boundary_line_pt);
471 
472  // Create boundary information: Inner boundary
473  //--------------------------------------------
474  // Create circle representing inner boundary. We are comparing this problem
475  // to a problem with a pinned square. Instead of choosing the value of r
476  // such that the diameter of the circle is the same as the side-length of
477  // the pinned square we find the value of r such that the area of both
478  // regions are equivalent so r=sqrt(0.2^{2}/pi)=0.1128...
479  double a=0.1128;
480  double x_c=GlobalParameters::Centre;
481  double y_c=GlobalParameters::Centre;
482  Circle* inner_circle_pt=new Circle(x_c,y_c,a);
483 
484  // Create storage for curves which will represent the obstacle
485  Vector<TriangleMeshCurveSection*> inner_boundary_line_pt(2);
486 
487  // # of segments for each curve (defining the obstacle in the coarsest mesh)
488  unsigned n_segments=GlobalParameters::N_boundary_segment;
489 
490  // The intrinsic coordinates for the beginning and end of the curve
491  double s_start=0.0;
492  double s_end=MathematicalConstants::Pi;
493  boundary_id=0;
494  inner_boundary_line_pt[0]=
495  new TriangleMeshCurviLine(inner_circle_pt,
496  s_start,
497  s_end,
498  n_segments,
499  boundary_id);
500 
501  // The intrinsic coordinates for the beginning and end of the curve
503  s_end=2.0*MathematicalConstants::Pi;
504  boundary_id=1;
505  inner_boundary_line_pt[1]=
506  new TriangleMeshCurviLine(inner_circle_pt,
507  s_start,
508  s_end,
509  n_segments,
510  boundary_id);
511 
512  // Combine to hole
513  //----------------
515  Vector<double> hole_coords(2);
516  hole_coords[0]=GlobalParameters::Centre;
517  hole_coords[1]=GlobalParameters::Centre;
518  hole_pt[0]=new TriangleMeshClosedCurve(inner_boundary_line_pt,hole_coords);
519 
520  // Use the TriangleMeshParameters object for helping on the manage
521  // of the TriangleMesh parameters. The only parameter that needs to take
522  // is the outer boundary.
523  TriangleMeshParameters triangle_mesh_parameters(outer_boundary_pt);
524 
525  // Specify the closed curve using the TriangleMeshParameters object
526  triangle_mesh_parameters.internal_closed_curve_pt()=hole_pt;
527 
528  // Target element size in bulk mesh
529  triangle_mesh_parameters.element_area()=0.10;
530 
531  // Build the mesh using the specified parameters
532  //----------------------------------------------
533  // Build adaptive "bulk" mesh
535  triangle_mesh_parameters);
536 
537  // Output
538  Bulk_mesh_pt->output("RESLT/mesh.dat",2);
539 
540  // Create/set error estimator
541  Bulk_mesh_pt->spatial_error_estimator_pt()=new Z2ErrorEstimator;
542 
543  // Choose error tolerances to force some uniform refinement
544  Bulk_mesh_pt->min_permitted_error()=0.00004;
545  Bulk_mesh_pt->max_permitted_error()=0.0001;
546 
547  // Create the main triangular mesh
549 
550  // If we're using at least one PML element
552  {
553  // Create PML meshes and add them to the global mesh
555  }
556 
557  // Build the entire mesh from its submeshes
559 
560  // Complete the build of all elements so they are fully functional:
561  //-----------------------------------------------------------------
562  // Find out how many elements there are in the mesh
563  unsigned n_element=this->mesh_pt()->nelement();
564 
565  // Loop over the elements in the mesh
566  for(unsigned e=0;e<n_element;e++)
567  {
568  // Upcast from GeneralisedElement to Helmholtz bulk element
569  PMLHelmholtzEquations<2>* el_pt =
570  dynamic_cast<PMLHelmholtzEquations<2>*>(mesh_pt()->element_pt(e));
571 
572  // Set the k_squared double pointer
574 
575  // If we're using Jonathon's new test mapping
577  {
578  // Set the PML mapping function
580  }
581 
582  // If we're using GMRES & MG as the linear solver
584  {
585  // Disable the PML-ification in these layers
586  dynamic_cast<PMLHelmholtzEquations<2>*>
587  (mesh_pt()->element_pt(e))->disable_pml();
588  }
589  } // for(unsigned e=0;e<n_element;e++)
590 
591  // Apply boundary conditions
593 
594  // Setup equation numbering scheme
596 
597  // Indicate that the problem is nonlinear to ensure the residual is
598  // calculated at the end of the iteration
599  problem_is_nonlinear(true);
600 
601  // Set the number of Newton iterations to one
603 
604  // Set up solver specific information:
605  //------------------------------------
606  // If we're choosing to use GMRES & MG as our linear solver
608  {
609  // Set the solver
611  }
612 
613  // Open trace file
614  Trace_file.open("RESLT/trace.dat");
615 } // End of the constructor, PMLHelmholtzMGProblem
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Array< double, 1, 3 > e(1./3., 0.5, 2.)
ofstream Trace_file
Trace file.
Definition: multigrid/helmholtz_multigrid/unstructured_two_d_helmholtz.cc:405
void set_gmres_multigrid_solver()
Set GMRES preconditioner by multigrid as the linear solver.
Definition: multigrid/helmholtz_multigrid/unstructured_two_d_helmholtz.cc:660
void create_pml_meshes()
Create PML meshes.
Definition: multigrid/helmholtz_multigrid/unstructured_two_d_helmholtz.cc:1019
RefineableQuadFromTriangleMesh< ELEMENT > * Bulk_mesh_pt
Pointer to the refineable "bulk" mesh.
Definition: multigrid/helmholtz_multigrid/unstructured_two_d_helmholtz.cc:363
void apply_boundary_conditions()
Apply boundary conditions.
Definition: multigrid/helmholtz_multigrid/unstructured_two_d_helmholtz.cc:828
Definition: geom_objects.h:873
GeneralisedElement *& element_pt(const unsigned long &e)
Return pointer to element e.
Definition: mesh.h:448
unsigned long nelement() const
Return number of elements in the mesh.
Definition: mesh.h:590
Definition: pml_helmholtz_elements.h:62
double *& k_squared_pt()
Get pointer to k_squared.
Definition: pml_helmholtz_elements.h:97
PMLMapping *& pml_mapping_pt()
Return a pointer to the PML Mapping object.
Definition: pml_helmholtz_elements.h:622
unsigned add_sub_mesh(Mesh *const &mesh_pt)
Definition: problem.h:1330
void problem_is_nonlinear(const bool &prob_lin)
Access function to Problem_is_nonlinear.
Definition: problem.h:1600
void build_global_mesh()
Definition: problem.cc:1493
unsigned & max_newton_iterations()
Access function to max Newton iterations before giving up.
Definition: problem.h:1594
Mesh *& mesh_pt()
Return a pointer to the global mesh.
Definition: problem.h:1280
unsigned long assign_eqn_numbers(const bool &assign_local_eqn_numbers=true)
Definition: problem.cc:1989
Unstructured refineable QuadFromTriangleMesh.
Definition: quad_from_triangle_mesh.template.h:578
Base class defining a closed curve for the Triangle mesh generation.
Definition: unstructured_two_d_mesh_geometry_base.h:1339
Definition: unstructured_two_d_mesh_geometry_base.h:662
Definition: triangle_mesh.template.h:94
Class defining a polyline for use in Triangle Mesh generation.
Definition: unstructured_two_d_mesh_geometry_base.h:868
Class defining a closed polygon for the Triangle mesh generation.
Definition: unstructured_two_d_mesh_geometry_base.h:1451
Definition: oomph-lib/src/generic/Vector.h:58
Definition: error_estimator.h:266
const Scalar * a
Definition: level2_cplx_impl.h:32
double Pi
Definition: two_d_biharmonic.cc:235
unsigned Enable_test_pml_mapping_flag
Definition: structured_cubic_point_source.cc:215
double Lx
Definition: structured_cubic_point_source.cc:109
double Ly
Definition: structured_cubic_point_source.cc:110
unsigned N_pml_element
The number of elements in the PML layer.
Definition: multigrid/helmholtz_multigrid/unstructured_two_d_helmholtz.cc:68
double Centre
The x and y coordinate of the centre of the cube.
Definition: structured_cubic_point_source.cc:145
unsigned Disable_pml_flag
Definition: multigrid/helmholtz_multigrid/unstructured_two_d_helmholtz.cc:78
double K_squared
Square of the wavenumber.
Definition: helmholtz_point_source.cc:60
unsigned Linear_solver_flag
Definition: structured_cubic_point_source.cc:85
TestPMLMapping * Test_pml_mapping_pt
Set the new PML mapping.
Definition: structured_cubic_point_source.cc:210
unsigned N_boundary_segment
The number of segments used to define the circular boundary.
Definition: multigrid/helmholtz_multigrid/unstructured_two_d_helmholtz.cc:196

References a, GlobalParameters::Centre, GlobalParameters::Disable_pml_flag, e(), oomph::TriangleMeshParameters::element_area(), GlobalParameters::Enable_test_pml_mapping_flag, i, oomph::TriangleMeshParameters::internal_closed_curve_pt(), GlobalParameters::K_squared, oomph::PMLHelmholtzEquations< DIM >::k_squared_pt(), GlobalParameters::Linear_solver_flag, GlobalParameters::Lx, GlobalParameters::Ly, GlobalParameters::N_boundary_segment, GlobalParameters::N_pml_element, oomph::MathematicalConstants::Pi, oomph::PMLHelmholtzEquations< DIM >::pml_mapping_pt(), GlobalParameters::Test_pml_mapping_pt, and oomph::Problem_Parameter::Trace_file.

◆ ~PMLHelmholtzMGProblem()

template<class ELEMENT >
PMLHelmholtzMGProblem< ELEMENT >::~PMLHelmholtzMGProblem

Destructor (empty)

Destructor for Helmholtz problem.

622 {
623  // If we're using GMRES & MG as the linear solver
625  {
626  // Delete the MG solver pointers
627  delete dynamic_cast<HelmholtzGMRESMG<CRDoubleMatrix>* >
628  (linear_solver_pt())->preconditioner_pt();
629 
630  // Set the pointer to null
631  dynamic_cast<HelmholtzGMRESMG<CRDoubleMatrix>* >
632  (linear_solver_pt())->preconditioner_pt()=0;
633 
634  // Delete the MG solver pointers
635  delete linear_solver_pt();
636 
637  // Set the pointer to null
638  linear_solver_pt()=0;
639  }
640 
641  // Delete the error estimator (allocated as a 'new' object)
642  delete Bulk_mesh_pt->spatial_error_estimator_pt();
643 
644  // Set the pointer to null
645  Bulk_mesh_pt->spatial_error_estimator_pt()=0;
646 
647  // Delete the "bulk" mesh
648  delete Bulk_mesh_pt;
649 
650  // Set the pointer to null
651  Bulk_mesh_pt=0;
652 
653 } // End of ~PMLHelmholtzMGProblem
The GMRES method for the Helmholtz solver.
Definition: complex_smoother.h:1736
LinearSolver *& linear_solver_pt()
Return a pointer to the linear solver object.
Definition: problem.h:1466

References GlobalParameters::Linear_solver_flag.

Member Function Documentation

◆ actions_after_adapt()

template<class ELEMENT >
void PMLHelmholtzMGProblem< ELEMENT >::actions_after_adapt
virtual

Actions after adapt: Rebuild the PML meshes.

Actions after adapt: Rebuild the face element meshes.

Reimplemented from oomph::Problem.

776 {
777  // Re-build the full mesh with PMLs:
778  //----------------------------------
779  // If we're using at least one PML element
781  {
782  // Create PML meshes and add them to the global mesh
784  }
785 
786  // Build the entire mesh from its submeshes
788 
789  // Complete the build of all elements so they are fully functional:
790  //-----------------------------------------------------------------
791  // Calculate the number of elements in the mesh
792  unsigned n_element=this->mesh_pt()->nelement();
793 
794  // Loop over the elements
795  for(unsigned e=0;e<n_element;e++)
796  {
797  // Upcast from GeneralisedElement to PMLHelmholtz bulk element
798  PMLHelmholtzEquations<2> *el_pt =
799  dynamic_cast<PMLHelmholtzEquations<2>*>(mesh_pt()->element_pt(e));
800 
801  // Set the frequency function pointer
803 
804  // If we're using Jonathon's new test mapping
806  {
807  // Set the PML mapping function
809  }
810 
811  // If we're using GMRES & MG as the linear solver
813  {
814  // Disable the PML-ification in these layers
815  dynamic_cast<PMLHelmholtzEquations<2>*>
816  (mesh_pt()->element_pt(e))->disable_pml();
817  }
818  } // for(unsigned e=0;e<n_element;e++)
819 
820  // Re-apply boundary conditions
822 } // End of actions_after_adapt
void rebuild_global_mesh()
Definition: problem.cc:1533

References GlobalParameters::Disable_pml_flag, e(), GlobalParameters::Enable_test_pml_mapping_flag, GlobalParameters::K_squared, oomph::PMLHelmholtzEquations< DIM >::k_squared_pt(), GlobalParameters::N_pml_element, oomph::PMLHelmholtzEquations< DIM >::pml_mapping_pt(), and GlobalParameters::Test_pml_mapping_pt.

◆ actions_after_newton_solve()

template<class ELEMENT >
void PMLHelmholtzMGProblem< ELEMENT >::actions_after_newton_solve ( )
inlinevirtual

Update the problem specs after solve (empty)

Reimplemented from oomph::Problem.

336  {
337  // Document the solution
338  doc_solution();
339  }
void doc_solution()
Doc the solution: doc_info contains labels/output directory etc.
Definition: multigrid/helmholtz_multigrid/unstructured_two_d_helmholtz.cc:910

◆ actions_before_adapt()

template<class ELEMENT >
void PMLHelmholtzMGProblem< ELEMENT >::actions_before_adapt
virtual

Actions before adapt: Wipe the PML meshes.

Actions before adapt: Wipe the mesh of face elements.

Reimplemented from oomph::Problem.

734 {
735  // If we're using at least one PML element
737  {
738  // Before adapting the added PML meshes must be removed
739  // as they are not refineable and are to be rebuilt from the
740  // newly refined triangular mesh
741  delete PML_right_mesh_pt;
743  delete PML_top_mesh_pt;
744  PML_top_mesh_pt=0;
745  delete PML_left_mesh_pt;
747  delete PML_bottom_mesh_pt;
749  delete PML_top_right_mesh_pt;
751  delete PML_top_left_mesh_pt;
757 
758  // Rebuild the HelmholtzMGProblem's global mesh from its various sub-meshes
759  // but first flush all its submeshes
761 
762  // Then add the triangular mesh back
764 
765  // Rebuild the global mesh such that it now stores
766  // the triangular mesh only
768  }
769 } // End of actions_before_adapt
Mesh * PML_bottom_left_mesh_pt
Pointer to the bottom left corner PML mesh.
Definition: multigrid/helmholtz_multigrid/unstructured_two_d_helmholtz.cc:402
Mesh * PML_right_mesh_pt
Pointer to the right PML mesh.
Definition: multigrid/helmholtz_multigrid/unstructured_two_d_helmholtz.cc:381
Mesh * PML_top_right_mesh_pt
Pointer to the top right corner PML mesh.
Definition: multigrid/helmholtz_multigrid/unstructured_two_d_helmholtz.cc:393
Mesh * PML_bottom_mesh_pt
Pointer to the bottom PML mesh.
Definition: multigrid/helmholtz_multigrid/unstructured_two_d_helmholtz.cc:390
Mesh * PML_top_left_mesh_pt
Pointer to the top left corner PML mesh.
Definition: multigrid/helmholtz_multigrid/unstructured_two_d_helmholtz.cc:396
Mesh * PML_top_mesh_pt
Pointer to the top PML mesh.
Definition: multigrid/helmholtz_multigrid/unstructured_two_d_helmholtz.cc:384
Mesh * PML_bottom_right_mesh_pt
Pointer to the bottom right corner PML mesh.
Definition: multigrid/helmholtz_multigrid/unstructured_two_d_helmholtz.cc:399
Mesh * PML_left_mesh_pt
Pointer to the left PML mesh.
Definition: multigrid/helmholtz_multigrid/unstructured_two_d_helmholtz.cc:387
void flush_sub_meshes()
Definition: problem.h:1339

References GlobalParameters::N_pml_element.

◆ actions_before_newton_solve()

template<class ELEMENT >
void PMLHelmholtzMGProblem< ELEMENT >::actions_before_newton_solve ( )
inlinevirtual

Update the problem specs before solve (empty)

Reimplemented from oomph::Problem.

332 {}

◆ apply_boundary_conditions()

template<class ELEMENT >
void PMLHelmholtzMGProblem< ELEMENT >::apply_boundary_conditions

Apply boundary conditions.

829 {
830  // Boundary conditions are set on the surface of the circle
831  // as a constant nonzero Dirichlet boundary condition
832  unsigned n_bound=Bulk_mesh_pt->nboundary();
833 
834  // Vector to hold the coordinates of the node
835  Vector<double> x(2,0.0);
836 
837  // Vector to hold the solution at the given node (first entry holds
838  // the real part and the second entry holds the imaginary part)
839  Vector<double> u(2,0.0);
840 
841  // Loop over the boundaries
842  for(unsigned b=0;b<n_bound;b++)
843  {
844  // Find the number of nodes on the b-th boundary
845  unsigned n_node=Bulk_mesh_pt->nboundary_node(b);
846 
847  // Loop over the nodes on boundary b
848  for (unsigned n=0;n<n_node;n++)
849  {
850  // If we're on the boundary of the obstacle (remembering that
851  // the circle has been broken up into two semi-circle boundaries)
852  if ((0==b) || (1==b))
853  {
854  Node* nod_pt=Bulk_mesh_pt->boundary_node_pt(b,n);
855  nod_pt->pin(0);
856  nod_pt->pin(1);
857 
858  // Get the coordinates of the node
859  for (unsigned k=0;k<2;k++)
860  {
861  // Store the k-th coordinate value
862  x[k]=nod_pt->x(k);
863  }
864 
865  // Get the solution at this point (default setting -- Bessel solution)
867 
868  // Set the values at each dof
869  nod_pt->set_value(0,u[0]);
870  nod_pt->set_value(1,u[1]);
871  }
872  } // for (unsigned n=0;n<n_node;n++)
873  } // for(unsigned b=0;b<n_bound;b++)
874 
875  // If we're not using any PML elements
877  {
878  // Loop over the outer boundaries (not the circle boundary)
879  for(unsigned b=2;b<n_bound;b++)
880  {
881  // Find the number of nodes on the b-th boundary
882  unsigned n_node=Bulk_mesh_pt->nboundary_node(b);
883 
884  // Loop over the nodes on boundary b
885  for (unsigned n=0;n<n_node;n++)
886  {
887  // Grab the n-th node on the b-th boundary
888  Node* nod_pt=Bulk_mesh_pt->boundary_node_pt(b,n);
889 
890  // Pin the first dof at this node
891  nod_pt->pin(0);
892 
893  // Pin the second dof at this node
894  nod_pt->pin(1);
895 
896  // Set the value of the first dof
897  nod_pt->set_value(0,0.0);
898 
899  // Set the value of the second dof
900  nod_pt->set_value(1,0.0);
901  } // for (unsigned n=0;n<n_node;n++)
902  } // for(unsigned b=0;b<n_bound;b++)
903  } // if (GlobalParameters::Disable_pml_flag)
904 } // End of apply_boundary_conditions
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
Scalar * b
Definition: benchVecAdd.cpp:17
void pin(const unsigned &i)
Pin the i-th stored variable.
Definition: nodes.h:385
void set_value(const unsigned &i, const double &value_)
Definition: nodes.h:271
Definition: nodes.h:906
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060
char char char int int * k
Definition: level2_impl.h:374
FiniteElement::SteadyExactSolutionFctPt simple_exact_u_pt
Definition: structured_cubic_point_source.cc:179
list x
Definition: plotDoE.py:28

References b, k, n, GlobalParameters::N_pml_element, oomph::Data::pin(), oomph::Data::set_value(), GlobalParameters::simple_exact_u_pt, plotDoE::x, and oomph::Node::x().

◆ create_pml_meshes()

template<class ELEMENT >
void PMLHelmholtzMGProblem< ELEMENT >::create_pml_meshes

Create PML meshes.

Create PML meshes and add them to the problem's sub-meshes.

1020 {
1021  // Bulk mesh bottom boundary id
1022  unsigned int bottom_boundary_id=2;
1023 
1024  // Bulk mesh right boundary id
1025  unsigned int right_boundary_id=3;
1026 
1027  // Bulk mesh top boundary id
1028  unsigned int top_boundary_id=4;
1029 
1030  // Bulk mesh left boundary id
1031  unsigned int left_boundary_id=5;
1032 
1033  // PML width in elements for the right layer
1034  unsigned n_x_right_pml=GlobalParameters::N_pml_element;
1035 
1036  // PML width in elements for the top layer
1037  unsigned n_y_top_pml=GlobalParameters::N_pml_element;
1038 
1039  // PML width in elements for the left layer
1040  unsigned n_x_left_pml=GlobalParameters::N_pml_element;
1041 
1042  // PML width in elements for the left layer
1043  unsigned n_y_bottom_pml=GlobalParameters::N_pml_element;
1044 
1045  // Outer physical length of the PML layers
1046  double width_x_right_pml=GlobalParameters::Pml_thickness;
1047  double width_y_top_pml=GlobalParameters::Pml_thickness;
1048  double width_x_left_pml=GlobalParameters::Pml_thickness;
1049  double width_y_bottom_pml=GlobalParameters::Pml_thickness;
1050 
1051  // Build the PML meshes based on the new adapted triangular mesh
1055  (Bulk_mesh_pt,right_boundary_id,
1056  n_x_right_pml, width_x_right_pml);
1060  (Bulk_mesh_pt, top_boundary_id,
1061  n_y_top_pml, width_y_top_pml);
1065  (Bulk_mesh_pt, left_boundary_id,
1066  n_x_left_pml, width_x_left_pml);
1070  (Bulk_mesh_pt, bottom_boundary_id,
1071  n_y_bottom_pml, width_y_bottom_pml);
1072 
1073  // Add submeshes to the global mesh
1078 
1079  // Rebuild corner PML meshes
1084  Bulk_mesh_pt, right_boundary_id);
1085 
1090  Bulk_mesh_pt, right_boundary_id);
1091 
1096  Bulk_mesh_pt, left_boundary_id);
1097 
1102  Bulk_mesh_pt, left_boundary_id);
1103 
1104  // Add submeshes to the global mesh
1109 
1110 } // End of create_pml_meshes
Definition: pml_meshes.h:48
double Pml_thickness
Length of cube in each direction.
Definition: structured_cubic_point_source.cc:122
Mesh * create_bottom_right_pml_mesh(Mesh *pml_right_mesh_pt, Mesh *pml_bottom_mesh_pt, Mesh *bulk_mesh_pt, const unsigned &right_boundary_id, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: pml_meshes.h:2103
Mesh * create_top_right_pml_mesh(Mesh *pml_right_mesh_pt, Mesh *pml_top_mesh_pt, Mesh *bulk_mesh_pt, const unsigned &right_boundary_id, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: pml_meshes.h:1968
Mesh * create_top_pml_mesh(Mesh *bulk_mesh_pt, const unsigned &top_boundary_id, const unsigned &n_y_top_pml, const double &width_y_top_pml, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: pml_meshes.h:1646
Mesh * create_top_left_pml_mesh(Mesh *pml_left_mesh_pt, Mesh *pml_top_mesh_pt, Mesh *bulk_mesh_pt, const unsigned &left_boundary_id, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: pml_meshes.h:2234
Mesh * create_bottom_left_pml_mesh(Mesh *pml_left_mesh_pt, Mesh *pml_bottom_mesh_pt, Mesh *bulk_mesh_pt, const unsigned &left_boundary_id, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: pml_meshes.h:2367
Mesh * create_bottom_pml_mesh(Mesh *bulk_mesh_pt, const unsigned &bottom_boundary_id, const unsigned &n_y_bottom_pml, const double &width_y_bottom_pml, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: pml_meshes.h:1860
Mesh * create_left_pml_mesh(Mesh *bulk_mesh_pt, const unsigned &left_boundary_id, const unsigned &n_x_left_pml, const double &width_x_left_pml, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: pml_meshes.h:1752
Mesh * create_right_pml_mesh(Mesh *bulk_mesh_pt, const unsigned &right_boundary_id, const unsigned &n_x_right_pml, const double &width_x_right_pml, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: pml_meshes.h:1539

References oomph::TwoDimensionalPMLHelper::create_bottom_left_pml_mesh(), oomph::TwoDimensionalPMLHelper::create_bottom_pml_mesh(), oomph::TwoDimensionalPMLHelper::create_bottom_right_pml_mesh(), oomph::TwoDimensionalPMLHelper::create_left_pml_mesh(), oomph::TwoDimensionalPMLHelper::create_right_pml_mesh(), oomph::TwoDimensionalPMLHelper::create_top_left_pml_mesh(), oomph::TwoDimensionalPMLHelper::create_top_pml_mesh(), oomph::TwoDimensionalPMLHelper::create_top_right_pml_mesh(), GlobalParameters::N_pml_element, and GlobalParameters::Pml_thickness.

◆ doc_solution()

template<class ELEMENT >
void PMLHelmholtzMGProblem< ELEMENT >::doc_solution

Doc the solution: doc_info contains labels/output directory etc.

Doc the solution. DocInfo object stores flags/labels for where the output gets written to

911 {
912  // Create an output stream
913  ofstream some_file;
914 
915  // Create space for the file name
916  char filename[100];
917 
918  // Number of plot points
919  unsigned npts=5;
920 
921  // Number of plot points in the coarse solution
922  unsigned npts_coarse=2;
923 
924  // Output solution
925  //-----------------
926  sprintf(filename,"%s/soln%i.dat",
927  GlobalParameters::Doc_info.directory().c_str(),
928  GlobalParameters::Doc_info.number());
929  some_file.open(filename);
930  Bulk_mesh_pt->output(some_file,npts);
931  some_file.close();
932 
933  // Ouput exact solution
934  //---------------------
935  sprintf(filename,"%s/exact_soln%i.dat",
936  GlobalParameters::Doc_info.directory().c_str(),
937  GlobalParameters::Doc_info.number());
938  some_file.open(filename);
939  Bulk_mesh_pt->output_fct(some_file,npts,GlobalParameters::simple_exact_u_pt);
940  some_file.close();
941 
942  // If we're using at least one PML element
944  {
945  // Output solution within pml domains
946  //-----------------------------------
947  sprintf(filename,"%s/pml_soln%i.dat",
948  GlobalParameters::Doc_info.directory().c_str(),
949  GlobalParameters::Doc_info.number());
950  some_file.open(filename);
951  PML_top_mesh_pt->output(some_file,npts);
952  PML_right_mesh_pt->output(some_file,npts);
953  PML_bottom_mesh_pt->output(some_file,npts);
954  PML_left_mesh_pt->output(some_file,npts);
955  PML_top_right_mesh_pt->output(some_file,npts);
956  PML_bottom_right_mesh_pt->output(some_file,npts);
957  PML_top_left_mesh_pt->output(some_file,npts);
958  PML_bottom_left_mesh_pt->output(some_file,npts);
959  some_file.close();
960  }
961 
962  // Output coarse solution
963  //-----------------------
964  sprintf(filename,"%s/coarse_soln%i.dat",
965  GlobalParameters::Doc_info.directory().c_str(),
966  GlobalParameters::Doc_info.number());
967  some_file.open(filename);
968  Bulk_mesh_pt->output(some_file,npts_coarse);
969  some_file.close();
970 
971  // If we're using at least one PML element
973  {
974  // Output coarse solution within pml domains
975  //------------------------------------------
976  sprintf(filename,"%s/coarse_pml_soln%i.dat",
977  GlobalParameters::Doc_info.directory().c_str(),
978  GlobalParameters::Doc_info.number());
979  some_file.open(filename);
980  PML_top_mesh_pt->output(some_file,npts_coarse);
981  PML_right_mesh_pt->output(some_file,npts_coarse);
982  PML_bottom_mesh_pt->output(some_file,npts_coarse);
983  PML_left_mesh_pt->output(some_file,npts_coarse);
984  PML_top_right_mesh_pt->output(some_file,npts_coarse);
985  PML_bottom_right_mesh_pt->output(some_file,npts_coarse);
986  PML_top_left_mesh_pt->output(some_file,npts_coarse);
987  PML_bottom_left_mesh_pt->output(some_file,npts_coarse);
988  some_file.close();
989  }
990 
991  // Increment the documentation counter
993 
994  // Doc error and solution norm
995  //----------------------------
996  double error,norm;
997  sprintf(filename,"%s/error%i.dat",
998  GlobalParameters::Doc_info.directory().c_str(),
999  GlobalParameters::Doc_info.number());
1000  some_file.open(filename);
1001  Bulk_mesh_pt->compute_error(some_file,
1003  error,norm);
1004  some_file.close();
1005 
1006  // Document the L2 norm of the error and the L2 norm of the solution
1007  cout << "\nNorm of error : " << error
1008  << "\nNorm of solution : " << norm
1009  << "\nNormalised error norm : " << error/norm << std::endl;
1010 
1011  // Write the L2 norm of the solution to the trace file
1012  Trace_file << norm << std::endl;
1013 } // End of doc
unsigned & number()
Number used (e.g.) for labeling output files.
Definition: oomph_utilities.h:554
void output(std::ostream &outfile)
Output for all elements.
Definition: mesh.cc:2027
DocInfo Doc_info
Helper for documenting.
Definition: extrude_triangle_generated_mesh.cc:57
string filename
Definition: MergeRestartFiles.py:39
int error
Definition: calibrate.py:297

References GlobalParameters::Doc_info, calibrate::error, MergeRestartFiles::filename, GlobalParameters::N_pml_element, oomph::DocInfo::number(), GlobalParameters::simple_exact_u_pt, and oomph::Problem_Parameter::Trace_file.

◆ make_new_problem()

template<class ELEMENT >
HelmholtzMGProblem* PMLHelmholtzMGProblem< ELEMENT >::make_new_problem ( )
inlineprivatevirtual

Overload the make_new_problem function to return an object of this class.

Implements oomph::HelmholtzMGProblem.

367  {
368  // Return a new problem pointer
370  }
Definition: multigrid/helmholtz_multigrid/unstructured_two_d_helmholtz.cc:321

◆ mg_bulk_mesh_pt()

template<class ELEMENT >
TreeBasedRefineableMeshBase* PMLHelmholtzMGProblem< ELEMENT >::mg_bulk_mesh_pt ( )
inlineprivatevirtual

Overload the mg_bulk_mesh_pt function to return a pointer to the "refineable" portion of the mesh

Implements oomph::HelmholtzMGProblem.

375  {
376  // Return the pointer to the bulk mesh
377  return Bulk_mesh_pt;
378  }

◆ set_gmres_multigrid_solver()

template<class ELEMENT >
void PMLHelmholtzMGProblem< ELEMENT >::set_gmres_multigrid_solver

Set GMRES preconditioner by multigrid as the linear solver.

Build and set GMRES preconditioner by multigrid as the linear solver.

661 {
662  // Create linear solver
665 
666  // Use RHS preconditioning
667  solver_pt->set_preconditioner_RHS();
668 
669  // Set the maximum number of iterations
670  solver_pt->max_iter()=200;
671 
672  // Set the tolerance (to ensure the Newton solver converges in one step)
673  solver_pt->tolerance()=1.0e-10;
674 
675  // If the user wishes to document the convergence information
677  {
678  // Create a file to record the convergence history
679  solver_pt->open_convergence_history_file_stream("RESLT/conv.dat");
680  }
681 
682  // Create linear solver
683  linear_solver_pt()=solver_pt;
684 
685  // This preconditioner uses multigrid on the block version of the full
686  // matrix. 2 V-cycles will be used here per preconditioning step
688 
689  // Set preconditioner
690  solver_pt->preconditioner_pt()=prec_pt;
691 
692  // Set the shift
694 
695  // If the user wants to use damped Jacobi on every level as a smoother
697  {
698  // Set the pre-smoother factory function
701  }
702 
703  // If the user wants to use damped Jacobi on every level as a smoother
705  {
706  // Set the post-smoother factory function
709  }
710 
711  // Suppress certain timings
713  {
714  // Disable smoother timings
715  prec_pt->disable_doc_time();
716  }
718  {
719  // Disable all output from the V-cycle
720  prec_pt->disable_v_cycle_output();
721  }
723  {
724  // Suppress all output
725  prec_pt->disable_output();
726  }
727 } // End of set_gmres_multigrid_solver
void set_preconditioner_RHS()
Enable right preconditioning.
Definition: complex_smoother.h:2041
Definition: helmholtz_geometric_multigrid.h:83
void disable_v_cycle_output()
Definition: helmholtz_geometric_multigrid.h:226
void disable_output()
Definition: helmholtz_geometric_multigrid.h:237
void disable_doc_time()
Disable time documentation.
Definition: helmholtz_geometric_multigrid.h:218
void set_post_smoother_factory_function(PostSmootherFactoryFctPt post_smoother_fn)
Access function to set the post-smoother creation function.
Definition: helmholtz_geometric_multigrid.h:102
double & alpha_shift()
Function to change the value of the shift.
Definition: helmholtz_geometric_multigrid.h:211
void set_pre_smoother_factory_function(PreSmootherFactoryFctPt pre_smoother_fn)
Access function to set the pre-smoother creation function.
Definition: helmholtz_geometric_multigrid.h:94
void open_convergence_history_file_stream(const std::string &file_name, const std::string &zone_title="")
Definition: iterative_linear_solver.h:138
Preconditioner *& preconditioner_pt()
Access function to preconditioner.
Definition: iterative_linear_solver.h:95
double & tolerance()
Access to convergence tolerance.
Definition: iterative_linear_solver.h:107
unsigned & max_iter()
Access to max. number of iterations.
Definition: iterative_linear_solver.h:113
double Alpha_shift
Definition: structured_cubic_point_source.cc:129
unsigned Output_management_flag
Definition: structured_cubic_point_source.cc:92
unsigned Doc_convergence_flag
Definition: structured_cubic_point_source.cc:98
unsigned Pre_smoother_flag
Definition: structured_cubic_point_source.cc:75
unsigned Post_smoother_flag
Definition: structured_cubic_point_source.cc:80
HelmholtzSmoother * set_post_smoother()
Definition: structured_cubic_point_source.cc:256
HelmholtzSmoother * set_pre_smoother()
Definition: structured_cubic_point_source.cc:248

References GlobalParameters::Alpha_shift, oomph::HelmholtzMGPreconditioner< DIM >::alpha_shift(), oomph::HelmholtzMGPreconditioner< DIM >::disable_doc_time(), oomph::HelmholtzMGPreconditioner< DIM >::disable_output(), oomph::HelmholtzMGPreconditioner< DIM >::disable_v_cycle_output(), GlobalParameters::Doc_convergence_flag, oomph::IterativeLinearSolver::max_iter(), oomph::IterativeLinearSolver::open_convergence_history_file_stream(), GlobalParameters::Output_management_flag, GlobalParameters::Post_smoother_flag, GlobalParameters::Pre_smoother_flag, oomph::IterativeLinearSolver::preconditioner_pt(), Smoother_Factory_Function_Helper::set_post_smoother(), oomph::HelmholtzMGPreconditioner< DIM >::set_post_smoother_factory_function(), Smoother_Factory_Function_Helper::set_pre_smoother(), oomph::HelmholtzMGPreconditioner< DIM >::set_pre_smoother_factory_function(), oomph::HelmholtzGMRESMG< MATRIX >::set_preconditioner_RHS(), and oomph::IterativeLinearSolver::tolerance().

Member Data Documentation

◆ Bulk_mesh_pt

template<class ELEMENT >
RefineableQuadFromTriangleMesh<ELEMENT>* PMLHelmholtzMGProblem< ELEMENT >::Bulk_mesh_pt
private

Pointer to the refineable "bulk" mesh.

◆ PML_bottom_left_mesh_pt

template<class ELEMENT >
Mesh* PMLHelmholtzMGProblem< ELEMENT >::PML_bottom_left_mesh_pt
private

Pointer to the bottom left corner PML mesh.

◆ PML_bottom_mesh_pt

template<class ELEMENT >
Mesh* PMLHelmholtzMGProblem< ELEMENT >::PML_bottom_mesh_pt
private

Pointer to the bottom PML mesh.

◆ PML_bottom_right_mesh_pt

template<class ELEMENT >
Mesh* PMLHelmholtzMGProblem< ELEMENT >::PML_bottom_right_mesh_pt
private

Pointer to the bottom right corner PML mesh.

◆ PML_left_mesh_pt

template<class ELEMENT >
Mesh* PMLHelmholtzMGProblem< ELEMENT >::PML_left_mesh_pt
private

Pointer to the left PML mesh.

◆ PML_right_mesh_pt

template<class ELEMENT >
Mesh* PMLHelmholtzMGProblem< ELEMENT >::PML_right_mesh_pt
private

Pointer to the right PML mesh.

◆ PML_top_left_mesh_pt

template<class ELEMENT >
Mesh* PMLHelmholtzMGProblem< ELEMENT >::PML_top_left_mesh_pt
private

Pointer to the top left corner PML mesh.

◆ PML_top_mesh_pt

template<class ELEMENT >
Mesh* PMLHelmholtzMGProblem< ELEMENT >::PML_top_mesh_pt
private

Pointer to the top PML mesh.

◆ PML_top_right_mesh_pt

template<class ELEMENT >
Mesh* PMLHelmholtzMGProblem< ELEMENT >::PML_top_right_mesh_pt
private

Pointer to the top right corner PML mesh.

◆ Trace_file

template<class ELEMENT >
ofstream PMLHelmholtzMGProblem< ELEMENT >::Trace_file
private

Trace file.


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