FpTestProblem Class Reference

Test problem for Fp/PCD preconditioner. More...

+ Inheritance diagram for FpTestProblem:

Public Member Functions

 FpTestProblem (const unsigned &n_element, const bool &use_tets, const bool &use_adaptivity, const bool &use_lsc, const bool &use_hypre_for_pressure, const bool &use_block_diagonal_for_momentum, const bool &use_hypre_for_momentum_diagonals, const int &problem_id)
 Constructor. More...
 
 ~FpTestProblem ()
 Destructor: Cleanup. More...
 
void fix_pressure (const unsigned &e, const unsigned &pdof, const double &pvalue)
 Fix pressure in element e at pressure dof pdof and set to pvalue. More...
 
void actions_after_adapt ()
 After adaptation: Unpin pressure and pin redudant pressure dofs. More...
 
void actions_after_newton_step ()
 Actions after Newton step record number of iterations. More...
 
void actions_after_newton_solve ()
 Update the after solve (empty) More...
 
void actions_before_newton_solve ()
 Update the problem specs before solve. More...
 
void doc_solution (DocInfo &doc_info)
 Doc the solution. More...
 
template<class ELEMENT >
void create_traction_elements ()
 Create traction elements on outflow boundary. More...
 
template<class ELEMENT >
void create_refineable_traction_elements ()
 Create refineable traction elements on outflow boundary. More...
 
template<class FP_ELEMENT >
void validate_fp ()
 Validate fp. More...
 
Mesh *& bulk_mesh_pt ()
 Pointer to the "bulk" mesh. More...
 
 FpTestProblem (const unsigned &n_element, const bool &use_triangles, const bool &use_adaptivity, const bool &use_lsc, const bool &use_robin, const bool &use_hypre_for_pressure, const bool &use_block_diagonal_for_momentum, const bool &use_hypre_for_momentum_diagonals, const int &problem_id)
 Constructor. More...
 
 ~FpTestProblem ()
 Destructor: Cleanup. More...
 
void fix_pressure (const unsigned &e, const unsigned &pdof, const double &pvalue)
 Fix pressure in element e at pressure dof pdof and set to pvalue. More...
 
void actions_after_adapt ()
 After adaptation: Unpin pressure and pin redudant pressure dofs. More...
 
void actions_after_newton_step ()
 Actions after Newton step record number of iterations. More...
 
void actions_after_newton_solve ()
 Update the after solve (empty) More...
 
void actions_before_newton_solve ()
 Update the problem specs before solve. More...
 
void doc_solution (DocInfo &doc_info)
 Doc the solution. More...
 
template<class FP_ELEMENT >
void validate_fp ()
 Validate fp. 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
 
virtual void actions_before_adapt ()
 
OomphCommunicator * communicator_pt ()
 access function to the oomph-lib communicator More...
 
const OomphCommunicator * communicator_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 ()
 
LinearSolver * mass_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...
 
Time * time_pt () const
 Return a pointer to the global time object (const version). More...
 
double & time ()
 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 TimeStepper * time_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...
 
double & minimum_dt ()
 Access function to min timestep in adaptive timestepping. More...
 
double & maximum_dt ()
 Access function to max timestep in adaptive timestepping. More...
 
unsigned & max_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...
 
double & max_residuals ()
 
bool & time_adaptive_newton_crash_on_solve_fail ()
 Access function for Time_adaptive_newton_crash_on_solve_fail. More...
 
double & newton_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...
 
double * global_dof_pt (const unsigned &i)
 
double & dof (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...
 
double * dof_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...
 
bool & use_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 Problem * make_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 ()
 
double * bifurcation_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 ()
 
int & sign_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 Attributes

IterativeLinearSolver * Solver_pt
 Solver. More...
 
Preconditioner * Prec_pt
 Solver. More...
 
Preconditioner * P_matrix_preconditioner_pt
 Inexact solver for P block. More...
 
Preconditioner * F_matrix_preconditioner_pt
 Inexact solver for F block. More...
 
unsigned Driven_boundary
 ID of driven boundary. More...
 
unsigned Inflow_boundary
 ID of inflow boundary. More...
 
unsigned Outflow_boundary
 ID of outflow boundary. More...
 
unsigned Problem_id
 Problem id. More...
 
Mesh * Bulk_mesh_pt
 Pointer to the "bulk" mesh. More...
 
Mesh * Surface_mesh_pt
 Pointer to the "surface" mesh. 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_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)
 
double & dof_derivative (const unsigned &i)
 
double & dof_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 *, bool > Calculate_dparameter_analytic
 
bool Calculate_hessian_products_analytic
 
LinearAlgebraDistribution * Dof_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< double > Max_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< double > Dof_derivative
 Storage for the derivative of the problem variables wrt arc-length. More...
 
Vector< double > Dof_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
 
OomphCommunicator * Communicator_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

Test problem for Fp/PCD preconditioner.

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

Constructor & Destructor Documentation

◆ FpTestProblem() [1/2]

FpTestProblem::FpTestProblem ( const unsigned &  n_element,
const bool &  use_tets,
const bool &  use_adaptivity,
const bool &  use_lsc,
const bool &  use_hypre_for_pressure,
const bool &  use_block_diagonal_for_momentum,
const bool &  use_hypre_for_momentum_diagonals,
const int &  problem_id 
)

Constructor.

Constructor for DrivenCavity problem.

317 {
318 
319  // Store flag
320  Problem_id=problem_id;
321 
322  // Setup mesh
323 
324  // # of elements in x-direction
325  unsigned n_x=n_el;
326 
327  // # of elements in y-direction
328  unsigned n_y=n_el;
329 
330  // # of elements in z-direction
331  unsigned n_z=n_el;
332 
333  // Domain length in x-direction
334  double l_x=1.0;
335 
336  // Domain length in y-direction
337  double l_y=1.0;
338 
339  // Domain length in y-direction
340  double l_z=1.0;
341 
342 
343  // Build and assign mesh
344  if (use_tets)
345  {
347  (n_x,n_y,n_z,l_x,l_y,l_z);
348 
350  ->setup_boundary_element_info();
351 
352  Driven_boundary=4;
353  Inflow_boundary=0;
355  }
356  else
357  {
358  if (use_adaptivity)
359  {
360  Bulk_mesh_pt =
362  (n_x,n_y,n_z,l_x,l_y,l_z);
363 
364  Driven_boundary=0;
365  Inflow_boundary=4;
366  Outflow_boundary=2;
367  }
368  else
369  {
370  Bulk_mesh_pt =
371  new SimpleCubicMesh<QTaylorHoodElement<3> >(n_x,n_y,n_z,l_x,l_y,l_z);
372 
373  Driven_boundary=0;
374  Inflow_boundary=4;
376  }
377  }
378 
379  // Create "surface mesh" that will contain only the prescribed-traction
380  // elements.
381  Surface_mesh_pt = new Mesh;
382 
383  // Add the two sub meshes to the problem
386 
387  // Combine all submeshes into a single Mesh
389 
390  // Build preconditoner
393  Prec_pt=prec_pt;
394 
395 
396  // By default, the Schur Complement Preconditioner uses SuperLU as
397  // an exact preconditioner (i.e. a solver) for the
398  // momentum and Schur complement blocks.
399  // Can overwrite this by passing pointers to
400  // other preconditioners that perform the (approximate)
401  // solves of these blocks.
402 
403 
404  // Create internal preconditioners used on Schur block
406  if (use_hypre_for_pressure)
407  {
408 #ifdef OOMPH_HAS_HYPRE
409 
410  // Create preconditioner
412 
413  // Set parameters for use as preconditioner on Poisson-type problem
416 
417  // Use Hypre for the Schur complement block
419 
420  // Shut up!
422  disable_doc_time();
423 
424 #endif
425  }
426 
427  // Create block-diagonal preconditioner used on momentum block
429  if (use_block_diagonal_for_momentum)
430  {
431 
434 
435  // Use Hypre as block preconditioner
436  if (use_hypre_for_pressure)
437  {
438 #ifdef OOMPH_HAS_HYPRE
440  (F_matrix_preconditioner_pt)->set_subsidiary_preconditioner_function
441  (Hypre_Subsidiary_Preconditioner_Helper::set_hypre_preconditioner);
442 #endif
443  }
444 
445  // Use Hypre for momentum block
447  }
448 
449 
450 
451  // Use LSC?
452  if (use_lsc)
453  {
454  prec_pt->use_lsc();
455  }
456  else
457  {
458  prec_pt->use_fp();
459  }
460 
461  // Set Navier Stokes mesh
463 
464 
465  // Set the boundary conditions for this problem: All nodes are
466  // free by default -- just pin the ones that have Dirichlet conditions
467  // here.
468  unsigned num_bound = Bulk_mesh_pt->nboundary();
469  for(unsigned ibound=0;ibound<num_bound;ibound++)
470  {
471  unsigned num_nod= Bulk_mesh_pt->nboundary_node(ibound);
472  for (unsigned inod=0;inod<num_nod;inod++)
473  {
474  // Loop over values (u, v and w velocities)
475  for (unsigned i=0;i<3;i++)
476  {
477  Bulk_mesh_pt->boundary_node_pt(ibound,inod)->pin(i);
478  }
479  }
480  } // end loop over boundaries
481 
482 
483 
484  // In/outflow bcs
486  {
487  unsigned ibound=Outflow_boundary;
488  unsigned num_nod= Bulk_mesh_pt->nboundary_node(ibound);
489  for (unsigned inod=0;inod<num_nod;inod++)
490  {
491  Node* nod_pt=Bulk_mesh_pt->boundary_node_pt(ibound,inod);
492  // Only free if node is ONLY on a single boundary
493  std::set<unsigned>* bnd_pt=0;
494  nod_pt->get_boundaries_pt(bnd_pt);
495  if (bnd_pt!=0)
496  {
497  if (bnd_pt->size()<2)
498  {
499  if (!(nod_pt->is_on_boundary(0)))
500  {
501  if ((nod_pt->x(1)<0.5)&&nod_pt->x(2)<0.5) nod_pt->unpin(0);
502  }
503  }
504  }
505  }
506  }
507 
508  // Complete the build of all elements so they are fully functional
509 
510  //Find number of elements in mesh
511  unsigned n_element = Bulk_mesh_pt->nelement();
512 
513  // Loop over the elements to set up element-specific
514  // things that cannot be handled by constructor
515  for(unsigned e=0;e<n_element;e++)
516  {
517  // Upcast from GeneralisedElement to the present element
518  NavierStokesEquations<3>* el_pt =
520 
521  //Set the Reynolds number
522  el_pt->re_pt() = &Global_Variables::Re;
523  } // end loop over elements
524 
525 
526  // Pin redundant pressure dofs
527  if (use_adaptivity)
528  {
531  }
532 
533  // Now set the first pressure value in element 0 to 0.0
535 
536  // Setup equation numbering scheme
537  oomph_info <<"Number of equations: " << assign_eqn_numbers() << std::endl;
538 
539 #ifdef OOMPH_HAS_TRILINOS
540 
541  // Build iterative linear solver
542  oomph_info << "Using Trilinos GMRES\n";
543  TrilinosAztecOOSolver* iterative_linear_solver_pt =
545 
546  Solver_pt=iterative_linear_solver_pt;
547 
548 #else
549 
550  // Build solve and preconditioner
552  dynamic_cast<GMRES<CRDoubleMatrix>*>(Solver_pt)->set_preconditioner_RHS();
553 
554 #endif
555 
556  // Set solver and preconditioner
559 
560 } // end_of_constructor
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Array< double, 1, 3 > e(1./3., 0.5, 2.)
IterativeLinearSolver * Solver_pt
Solver.
Definition: three_d_fp.cc:274
Mesh * Bulk_mesh_pt
Pointer to the "bulk" mesh.
Definition: three_d_fp.cc:298
unsigned Outflow_boundary
ID of outflow boundary.
Definition: three_d_fp.cc:292
unsigned Driven_boundary
ID of driven boundary.
Definition: three_d_fp.cc:286
Preconditioner * F_matrix_preconditioner_pt
Inexact solver for F block.
Definition: three_d_fp.cc:283
Mesh * Surface_mesh_pt
Pointer to the "surface" mesh.
Definition: three_d_fp.cc:301
unsigned Inflow_boundary
ID of inflow boundary.
Definition: three_d_fp.cc:289
void fix_pressure(const unsigned &e, const unsigned &pdof, const double &pvalue)
Fix pressure in element e at pressure dof pdof and set to pvalue.
Definition: three_d_fp.cc:140
unsigned Problem_id
Problem id.
Definition: three_d_fp.cc:295
Preconditioner * P_matrix_preconditioner_pt
Inexact solver for P block.
Definition: three_d_fp.cc:280
Preconditioner * Prec_pt
Solver.
Definition: three_d_fp.cc:277
Definition: general_purpose_block_preconditioners.h:321
void pin(const unsigned &i)
Pin the i-th stored variable.
Definition: nodes.h:385
void unpin(const unsigned &i)
Unpin the i-th stored variable.
Definition: nodes.h:391
The GMRES method.
Definition: iterative_linear_solver.h:1227
Definition: hypre_solver.h:826
Preconditioner *& preconditioner_pt()
Access function to preconditioner.
Definition: iterative_linear_solver.h:95
Definition: mesh.h:67
unsigned long nboundary_node(const unsigned &ibound) const
Return number of nodes on a particular boundary.
Definition: mesh.h:833
unsigned nboundary() const
Return number of boundaries.
Definition: mesh.h:827
GeneralisedElement *& element_pt(const unsigned long &e)
Return pointer to element e.
Definition: mesh.h:448
Node *& boundary_node_pt(const unsigned &b, const unsigned &n)
Return pointer to node n on boundary b.
Definition: mesh.h:493
unsigned long nelement() const
Return number of elements in the mesh.
Definition: mesh.h:590
Definition: navier_stokes_elements.h:395
double *& re_pt()
Pointer to Reynolds number.
Definition: navier_stokes_elements.h:715
Definition: navier_stokes_preconditioners.h:607
void use_fp()
Use Fp version of the preconditioner.
Definition: navier_stokes_preconditioners.h:788
void set_p_preconditioner(Preconditioner *new_p_preconditioner_pt)
Function to set a new pressure matrix preconditioner (inexact solver)
Definition: navier_stokes_preconditioners.h:745
void set_f_preconditioner(Preconditioner *new_f_preconditioner_pt)
Function to set a new momentum matrix preconditioner (inexact solver)
Definition: navier_stokes_preconditioners.h:769
void set_navier_stokes_mesh(Mesh *mesh_pt, const bool &allow_multiple_element_type_in_navier_stokes_mesh=false)
Definition: navier_stokes_preconditioners.h:732
void use_lsc()
Use LSC version of the preconditioner.
Definition: navier_stokes_preconditioners.h:782
Definition: nodes.h:906
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060
virtual bool is_on_boundary() const
Definition: nodes.h:1373
virtual void get_boundaries_pt(std::set< unsigned > *&boundaries_pt)
Definition: nodes.h:1365
unsigned add_sub_mesh(Mesh *const &mesh_pt)
Definition: problem.h:1330
LinearSolver *& linear_solver_pt()
Return a pointer to the linear solver object.
Definition: problem.h:1466
void build_global_mesh()
Definition: problem.cc:1493
unsigned long assign_eqn_numbers(const bool &assign_local_eqn_numbers=true)
Definition: problem.cc:1989
Definition: refineable_navier_stokes_elements.h:322
Refineable version of simple cubic 3D Brick mesh class.
Definition: simple_cubic_mesh.template.h:169
Simple cubic 3D Brick mesh class.
Definition: simple_cubic_mesh.template.h:47
MySimple 3D tet mesh for TElements.
Definition: simple_cubic_tet_mesh.template.h:40
Definition: trilinos_solver.h:267
@ Driven_cavity
Definition: three_d_fp.cc:76
@ Through_flow
Definition: three_d_fp.cc:76
double Re
Reynolds number.
Definition: two_d_tilted_square.cc:80
void set_defaults_for_2D_poisson_problem(HyprePreconditioner *hypre_preconditioner_pt)
Definition: hypre_solver.cc:45
OomphInfo oomph_info
Definition: oomph_definitions.cc:319

References Global_Variables::Driven_cavity, e(), oomph::Node::get_boundaries_pt(), i, oomph::Node::is_on_boundary(), oomph::oomph_info, Global_Variables::Re, oomph::NavierStokesEquations< DIM >::re_pt(), oomph::Hypre_default_settings::set_defaults_for_2D_poisson_problem(), oomph::NavierStokesSchurComplementPreconditioner::set_f_preconditioner(), oomph::NavierStokesSchurComplementPreconditioner::set_navier_stokes_mesh(), oomph::NavierStokesSchurComplementPreconditioner::set_p_preconditioner(), Global_Variables::Through_flow, oomph::Data::unpin(), oomph::NavierStokesSchurComplementPreconditioner::use_fp(), oomph::NavierStokesSchurComplementPreconditioner::use_lsc(), and oomph::Node::x().

◆ ~FpTestProblem() [1/2]

FpTestProblem::~FpTestProblem ( )
inline

Destructor: Cleanup.

132  {
133  delete Solver_pt;
134  delete Prec_pt;
137  }

◆ FpTestProblem() [2/2]

FpTestProblem::FpTestProblem ( const unsigned &  n_element,
const bool &  use_triangles,
const bool &  use_adaptivity,
const bool &  use_lsc,
const bool &  use_robin,
const bool &  use_hypre_for_pressure,
const bool &  use_block_diagonal_for_momentum,
const bool &  use_hypre_for_momentum_diagonals,
const int &  problem_id 
)

Constructor.

277 {
278  // Allow for poor initial guess
279  Problem::Max_residuals=1.0e10;
280 
281  // Which problem?
282  Problem_id=problem_id;
283 
284  // Build preconditoner
287  Prec_pt=prec_pt;
288 
289  // By default, the LSC Preconditioner uses SuperLU as
290  // an exact preconditioner (i.e. a solver) for the
291  // momentum and Schur complement blocks.
292  // Can overwrite this by passing pointers to
293  // other preconditioners that perform the (approximate)
294  // solves of these blocks.
295 
296 
297  // Create internal preconditioners used on Schur block
299  if (use_hypre_for_pressure)
300  {
301 #ifdef OOMPH_HAS_HYPRE
302 
303  // Create preconditioner
305 
306  // Set parameters for use as preconditioner on Poisson-type problem
309 
310  // Use Hypre for the Schur complement block
312 
313  // Shut up!
315  disable_doc_time();
316 
317 #endif
318  }
319 
320  // Create block-diagonal preconditioner used on momentum block
322  if (use_block_diagonal_for_momentum)
323  {
324 
327 
328  // Use Hypre as block preconditioner
329  if (use_hypre_for_pressure)
330  {
331 #ifdef OOMPH_HAS_HYPRE
333  (F_matrix_preconditioner_pt)->set_subsidiary_preconditioner_function
334  (Hypre_Subsidiary_Preconditioner_Helper::set_hypre_preconditioner);
335 #endif
336  }
337 
338  // Use Hypre for momentum block
340  }
341 
342 
343 
344  // Use LSC?
345  if (use_lsc)
346  {
347  prec_pt->use_lsc();
348  }
349  else
350  {
351  prec_pt->use_fp();
352  if (use_robin)
353  {
354  prec_pt->enable_robin_for_fp();
355  }
356  else
357  {
358  prec_pt->disable_robin_for_fp();
359  }
360  }
361 
362 
363  // Setup mesh
364 
365  // # of elements in x-direction
366  unsigned n_x=n_el;
367 
368  // # of elements in y-direction
369  unsigned n_y=n_el;
370 
371  // Domain length in x-direction
372  double l_x=1.0;
373 
374  // Domain length in y-direction
375  double l_y=1.0;
376 
377 
378  // Build and assign meshes
379 
380  // Triangular meshes
381  //------------------
382  if (use_triangles)
383  {
384  // Backward step domain
385  //---------------------
387  {
388  oomph_info << "Can't do backward step with triangles\n";
389  exit(1);
390  }
391  // Square domain
392  //--------------
393  else
394  {
396  (n_x,n_y,l_x,l_y);
397 
399  ->setup_boundary_element_info();
400  }
401  }
402  // Quad meshes
403  //-----------
404  else
405  {
406  // Backward step domain
407  //---------------------
409  {
410  l_x=6.0;
411  l_y=2.0;
412  n_x=6*n_el; // These are appropriate for n_el = number of elements across
413  n_y=2*n_el; // inflow, as in David's book
414  unsigned nx_cut_out=5*n_el;
415  unsigned ny_cut_out=1*n_el;
416  if (use_adaptivity)
417  {
418  mesh_pt()=new
420  (n_x,n_y,nx_cut_out,ny_cut_out,l_x,l_y);
421  }
422  else
423  {
425  (n_x,n_y,nx_cut_out,ny_cut_out,l_x,l_y);
426  }
427  }
428  // Square domain
429  //--------------
430  else
431  {
432  if (use_adaptivity)
433  {
434  mesh_pt() = new
436  (n_x,n_y,l_x,l_y);
437  }
438  else
439  {
440  mesh_pt() =
442  (n_x,n_y,l_x,l_y);
443  }
444  }
445  }
446 
447 
448  // Set Navier Stokes mesh
449  prec_pt->set_navier_stokes_mesh(mesh_pt());
450 
451 
452 
453 
454 
455  // In/outflow bcs
456  //---------------
457 
458  // Set the boundary conditions for this problem: All nodes are
459  // free by default -- just pin the ones that have Dirichlet conditions
460  // here.
461  unsigned num_bound = mesh_pt()->nboundary();
462  for(unsigned ibound=0;ibound<num_bound;ibound++)
463  {
464  unsigned num_nod= mesh_pt()->nboundary_node(ibound);
465  for (unsigned inod=0;inod<num_nod;inod++)
466  {
467  // Loop over values (u and v velocities)
468  for (unsigned i=0;i<2;i++)
469  {
470  mesh_pt()->boundary_node_pt(ibound,inod)->pin(i);
471  }
472  }
473  } // end loop over boundaries
474 
475 
476  // Backward step: Unpin outflow on boundary 5
478  {
479  unsigned ibound=5;
480  unsigned num_nod= mesh_pt()->nboundary_node(ibound);
481  for (unsigned inod=0;inod<num_nod;inod++)
482  {
483  Node* nod_pt=mesh_pt()->boundary_node_pt(ibound,inod);
484  if ( (!(nod_pt->is_on_boundary(4))) &&
485  (!(nod_pt->is_on_boundary(0))) )
486  {
487  nod_pt->unpin(0);
488  // Unpin transverse velocity if non-stress divergence form
490  {
491  nod_pt->unpin(1);
492  }
493  }
494  }
495  }
496 
497 
498  // Complete the build of all elements so they are fully functional
499 
500  //Find number of elements in mesh
501  unsigned n_element = mesh_pt()->nelement();
502 
503  // Loop over the elements to set up element-specific
504  // things that cannot be handled by constructor
505  for(unsigned e=0;e<n_element;e++)
506  {
507  // Upcast from GeneralisedElement to the present element
508  NavierStokesEquations<2>* el_pt =
509  dynamic_cast<NavierStokesEquations<2>*>(mesh_pt()->element_pt(e));
510 
511  //Set the Reynolds number
512  el_pt->re_pt() = &Global_Variables::Re;
513  } // end loop over elements
514 
515 
516  // Pin redundant pressure dofs
517  if (use_adaptivity)
518  {
520  pin_redundant_nodal_pressures(mesh_pt()->element_pt());
521  }
522 
523  // Now set the first pressure value in element 0 to 0.0
525 
526  // Setup equation numbering scheme
527  oomph_info <<"Number of equations: " << assign_eqn_numbers() << std::endl;
528 
529 #ifdef OOMPH_HAS_TRILINOS
530 
531  // Build iterative linear solver
532  oomph_info << "Using Trilinos GMRES\n";
533  TrilinosAztecOOSolver* iterative_linear_solver_pt =
535 
536  Solver_pt=iterative_linear_solver_pt;
537 
538 #else
539 
540  // Build solve and preconditioner
542  dynamic_cast<GMRES<CRDoubleMatrix>*>(Solver_pt)->set_preconditioner_RHS();
543 
544 #endif
545 
546  // Limit max. number of iterations
547  Solver_pt->max_iter()=200;
548  //Solver_pt->tolerance()=1.0e-10;
549 
550  // Set solver and preconditioner
553 
554 } // end_of_constructor
Backward step mesh.
Definition: backward_step_mesh.template.h:46
unsigned & max_iter()
Access to max. number of iterations.
Definition: iterative_linear_solver.h:113
void enable_robin_for_fp()
Use Robin BC elements for the Fp preconditioner.
Definition: navier_stokes_preconditioners.h:820
void disable_robin_for_fp()
Don't use Robin BC elements for the Fp preconditioenr.
Definition: navier_stokes_preconditioners.h:826
Mesh *& mesh_pt()
Return a pointer to the global mesh.
Definition: problem.h:1280
Refineable backward step mesh.
Definition: backward_step_mesh.template.h:95
Definition: rectangular_quadmesh.template.h:326
Definition: simple_rectangular_quadmesh.template.h:58
Simple 2D triangular mesh for TElements.
Definition: simple_rectangular_tri_mesh.template.h:49
@ Step
Definition: two_d_fp.cc:75

References oomph::NavierStokesSchurComplementPreconditioner::disable_robin_for_fp(), Global_Variables::Driven_cavity, e(), oomph::NavierStokesSchurComplementPreconditioner::enable_robin_for_fp(), i, oomph::Node::is_on_boundary(), oomph::oomph_info, Global_Variables::Re, oomph::NavierStokesEquations< DIM >::re_pt(), oomph::Hypre_default_settings::set_defaults_for_2D_poisson_problem(), oomph::NavierStokesSchurComplementPreconditioner::set_f_preconditioner(), oomph::NavierStokesSchurComplementPreconditioner::set_navier_stokes_mesh(), oomph::NavierStokesSchurComplementPreconditioner::set_p_preconditioner(), Global_Variables::Step, oomph::Data::unpin(), oomph::NavierStokesSchurComplementPreconditioner::use_fp(), and oomph::NavierStokesSchurComplementPreconditioner::use_lsc().

◆ ~FpTestProblem() [2/2]

FpTestProblem::~FpTestProblem ( )
inline

Destructor: Cleanup.

119  {
120  delete Solver_pt;
121  delete Prec_pt;
124  delete mesh_pt();
125  }

Member Function Documentation

◆ actions_after_adapt() [1/2]

void FpTestProblem::actions_after_adapt ( )
inlinevirtual

After adaptation: Unpin pressure and pin redudant pressure dofs.

Reimplemented from oomph::Problem.

152  {
153  // Unpin all pressure dofs
156 
157  // Pin redundant pressure dofs
160 
161  // Now set the first pressure dof in the first element to 0.0
163  } // end_of_actions_after_adapt

References Global_Variables::Driven_cavity.

◆ actions_after_adapt() [2/2]

void FpTestProblem::actions_after_adapt ( )
inlinevirtual

After adaptation: Unpin pressure and pin redudant pressure dofs.

Reimplemented from oomph::Problem.

141  {
142  // Unpin all pressure dofs
144  unpin_all_pressure_dofs(mesh_pt()->element_pt());
145 
146  // Pin redundant pressure dofs
148  pin_redundant_nodal_pressures(mesh_pt()->element_pt());
149 
150  // Now set the first pressure dof in the first element to 0.0
152  } // end_of_actions_after_adapt

References Global_Variables::Driven_cavity.

◆ actions_after_newton_solve() [1/2]

void FpTestProblem::actions_after_newton_solve ( )
inlinevirtual

Update the after solve (empty)

Reimplemented from oomph::Problem.

178 {}

◆ actions_after_newton_solve() [2/2]

void FpTestProblem::actions_after_newton_solve ( )
inlinevirtual

Update the after solve (empty)

Reimplemented from oomph::Problem.

169 {}

◆ actions_after_newton_step() [1/2]

void FpTestProblem::actions_after_newton_step ( )
inlinevirtual

Actions after Newton step record number of iterations.

Reimplemented from oomph::Problem.

168  {
170  dynamic_cast<IterativeLinearSolver*>
171  (this->linear_solver_pt())->iterations());
172 
174  linear_solver_pt()->linear_solver_solution_time());
175  }
Definition: iterative_linear_solver.h:54
Vector< unsigned > Iterations
Storage for number of iterations during Newton steps.
Definition: two_d_tilted_square.cc:111
Vector< double > Linear_solver_time
Storage for linear solver times during Newton steps.
Definition: three_d_fp.cc:86

References Global_Variables::Iterations, and Global_Variables::Linear_solver_time.

◆ actions_after_newton_step() [2/2]

void FpTestProblem::actions_after_newton_step ( )
inlinevirtual

Actions after Newton step record number of iterations.

Reimplemented from oomph::Problem.

158  {
160  dynamic_cast<IterativeLinearSolver*>
161  (this->linear_solver_pt())->iterations());
162 
164  linear_solver_pt()->linear_solver_solution_time());
165  }

References Global_Variables::Iterations, and Global_Variables::Linear_solver_time.

◆ actions_before_newton_solve() [1/2]

void FpTestProblem::actions_before_newton_solve ( )
inlinevirtual

Update the problem specs before solve.

Reimplemented from oomph::Problem.

182  {
183  // Initialise counter for iterations
186 
187  // Driven cavity bcs
189  {
190  // Setup tangential flow along driven boundary
191  unsigned ibound=Driven_boundary;
192  unsigned num_nod= Bulk_mesh_pt->nboundary_node(ibound);
193  for (unsigned inod=0;inod<num_nod;inod++)
194  {
195  // Tangential flow
196  Bulk_mesh_pt->boundary_node_pt(ibound,inod)->set_value(0,1.0);
197  Bulk_mesh_pt->boundary_node_pt(ibound,inod)->set_value(1,0.0);
198 
199  // No penetration
200  Bulk_mesh_pt->boundary_node_pt(ibound,inod)->set_value(2,0.0);
201  }
202 
203  // Overwrite with no flow along the other boundaries
204  unsigned num_bound = Bulk_mesh_pt->nboundary();
205  for(unsigned ibound=0;ibound<num_bound;ibound++)
206  {
207  if (ibound!=Driven_boundary)
208  {
209  unsigned num_nod= Bulk_mesh_pt->nboundary_node(ibound);
210  for (unsigned inod=0;inod<num_nod;inod++)
211  {
212  for (unsigned i=0;i<3;i++)
213  {
214  Bulk_mesh_pt->boundary_node_pt(ibound,inod)->set_value(i,0.0);
215  }
216  }
217  }
218  }
219  }
220  // Inflow at left boundary
221  else
222  {
223  // Inflow in upper half of inflow boundary
224  unsigned ibound=Inflow_boundary;
225  unsigned num_nod= Bulk_mesh_pt->nboundary_node(ibound);
226  for (unsigned inod=0;inod<num_nod;inod++)
227  {
228  Node* nod_pt=Bulk_mesh_pt->boundary_node_pt(ibound,inod);
229  double y=nod_pt->x(1);
230  double z=nod_pt->x(2);
231  if ((y>0.5)&&(z>0.5))
232  {
233  double u=(y-0.5)*(1.0-y)*(z-0.5)*(1.0-z);
234  nod_pt->set_value(0,u);
235  }
236  else
237  {
238  nod_pt->set_value(0,0.0);
239  }
240  nod_pt->set_value(1,0.0);
241  nod_pt->set_value(2,0.0);
242  }
243  }
244 
245  } // end_of_actions_before_newton_solve
void set_value(const unsigned &i, const double &value_)
Definition: nodes.h:271
Scalar * y
Definition: level1_cplx_impl.h:128

References Global_Variables::Driven_cavity, i, Global_Variables::Iterations, Global_Variables::Linear_solver_time, oomph::Data::set_value(), oomph::Node::x(), and y.

◆ actions_before_newton_solve() [2/2]

void FpTestProblem::actions_before_newton_solve ( )
inlinevirtual

Update the problem specs before solve.

Reimplemented from oomph::Problem.

174  {
175  // Initialise counter for iterations
178 
179  // Driven cavity bcs
180  //------------------
182  {
183  // Setup tangential flow along boundary 0:
184  unsigned ibound=0;
185  unsigned num_nod= mesh_pt()->nboundary_node(ibound);
186  for (unsigned inod=0;inod<num_nod;inod++)
187  {
188  // Tangential flow
189  mesh_pt()->boundary_node_pt(ibound,inod)->set_value(0,1.0);
190  // No penetration
191  mesh_pt()->boundary_node_pt(ibound,inod)->set_value(1,0.0);
192  }
193 
194  // Overwrite with no flow along the other boundaries
195  unsigned num_bound = mesh_pt()->nboundary();
196  for(unsigned ibound=1;ibound<num_bound;ibound++)
197  {
198  unsigned num_nod= mesh_pt()->nboundary_node(ibound);
199  for (unsigned inod=0;inod<num_nod;inod++)
200  {
201  for (unsigned i=0;i<2;i++)
202  {
203  mesh_pt()->boundary_node_pt(ibound,inod)->set_value(i,0.0);
204  }
205  }
206  }
207  }
208  // Step
209  //-----
211  {
212  // Inflow on boundary 3
213  unsigned ibound=3;
214  unsigned num_nod= mesh_pt()->nboundary_node(ibound);
215  for (unsigned inod=0;inod<num_nod;inod++)
216  {
217  Node* nod_pt=mesh_pt()->boundary_node_pt(ibound,inod);
218  double x=nod_pt->x(1);
219  double u=-4.0*(2.0-x)*(x-1.0);
220  nod_pt->set_value(0,u);
221  nod_pt->set_value(1,0.0);
222  }
223  }
224 
225 
226  } // end_of_actions_before_newton_solve
list x
Definition: plotDoE.py:28

References Global_Variables::Driven_cavity, i, Global_Variables::Iterations, Global_Variables::Linear_solver_time, oomph::Data::set_value(), Global_Variables::Step, plotDoE::x, and oomph::Node::x().

◆ bulk_mesh_pt()

Mesh*& FpTestProblem::bulk_mesh_pt ( )
inline

Pointer to the "bulk" mesh.

269 {return Bulk_mesh_pt;}

◆ create_refineable_traction_elements()

template<class ELEMENT >
void FpTestProblem::create_refineable_traction_elements

Create refineable traction elements on outflow boundary.

Create Navier-Stokes traction elements on outflow boundary.

568 {
569 
570  unsigned b=Outflow_boundary;
571 
572  // How many bulk elements are adjacent to boundary b?
573  unsigned n_element = Bulk_mesh_pt->nboundary_element(b);
574 
575  // Loop over the bulk elements adjacent to boundary b?
576  for(unsigned e=0;e<n_element;e++)
577  {
578  // Get pointer to the bulk element that is adjacent to boundary b
579  ELEMENT* bulk_elem_pt = dynamic_cast<ELEMENT*>(
581 
582  //What is the index of the face of element e along boundary b
583  int face_index = Bulk_mesh_pt->face_index_at_boundary(b,e);
584 
585  // Build the corresponding prescribed-flux element
586  RefineableNavierStokesTractionElement<ELEMENT>* flux_element_pt = new
587  RefineableNavierStokesTractionElement<ELEMENT>(bulk_elem_pt,face_index);
588 
589  //Add the prescribed-flux element to the surface mesh
590  Surface_mesh_pt->add_element_pt(flux_element_pt);
591 
592  // Set the pointer to the prescribed traction function
594 
595  } //end of loop over bulk elements adjacent to boundary b
596 
597  // Now rebuild the global mesh
599 
600  // Reassign equation numbers
601  oomph_info <<"Number of equations: " << assign_eqn_numbers() << std::endl;
602 
603 } // end of create_traction_elements
Scalar * b
Definition: benchVecAdd.cpp:17
int face_index_at_boundary(const unsigned &b, const unsigned &e) const
Definition: mesh.h:896
unsigned nboundary_element(const unsigned &b) const
Return number of finite elements that are adjacent to boundary b.
Definition: mesh.h:878
FiniteElement * boundary_element_pt(const unsigned &b, const unsigned &e) const
Return pointer to e-th finite element on boundary b.
Definition: mesh.h:840
void add_element_pt(GeneralisedElement *const &element_pt)
Add a (pointer to) an element to the mesh.
Definition: mesh.h:617
void(*&)(const double &t, const Vector< double > &x, const Vector< double > &n, Vector< double > &result) traction_fct_pt()
Definition: fluid_traction_elements.h:186
void rebuild_global_mesh()
Definition: problem.cc:1533
Definition: fluid_traction_elements.h:338
void prescribed_traction(const double &t, const Vector< double > &x, const Vector< double > &n, Vector< double > &traction)
Traction at the outflow boundary.
Definition: three_d_fp.cc:89

References b, e(), oomph::oomph_info, Global_Variables::prescribed_traction(), and oomph::NavierStokesTractionElement< ELEMENT >::traction_fct_pt.

◆ create_traction_elements()

template<class ELEMENT >
void FpTestProblem::create_traction_elements

Create traction elements on outflow boundary.

Create Navier-Stokes traction elements on outflow boundary.

615 {
616 
617  unsigned b=Outflow_boundary;
618 
619  // How many bulk elements are adjacent to boundary b?
620  unsigned n_element = Bulk_mesh_pt->nboundary_element(b);
621 
622  // Loop over the bulk elements adjacent to boundary b?
623  for(unsigned e=0;e<n_element;e++)
624  {
625  // Get pointer to the bulk element that is adjacent to boundary b
626  ELEMENT* bulk_elem_pt = dynamic_cast<ELEMENT*>(
628 
629  //What is the index of the face of element e along boundary b
630  int face_index = Bulk_mesh_pt->face_index_at_boundary(b,e);
631 
632  // Build the corresponding prescribed-flux element
633  NavierStokesTractionElement<ELEMENT>* flux_element_pt = new
634  NavierStokesTractionElement<ELEMENT>(bulk_elem_pt,face_index);
635 
636  //Add the prescribed-flux element to the surface mesh
637  Surface_mesh_pt->add_element_pt(flux_element_pt);
638 
639  // Set the pointer to the prescribed traction function
641 
642  } //end of loop over bulk elements adjacent to boundary b
643 
644  // Now rebuild the global mesh
646 
647  // Reassign equation numbers
648  oomph_info <<"Number of equations: " << assign_eqn_numbers() << std::endl;
649 
650 } // end of create_traction_elements
Definition: fluid_traction_elements.h:55

References b, e(), oomph::oomph_info, Global_Variables::prescribed_traction(), and oomph::NavierStokesTractionElement< ELEMENT >::traction_fct_pt.

◆ doc_solution() [1/2]

void FpTestProblem::doc_solution ( DocInfo &  doc_info)

Doc the solution.

658 {
659  ofstream some_file;
660  char filename[100];
661 
662  // Number of plot points
663  unsigned npts;
664  npts=5;
665 
666  // Output solution
667  sprintf(filename,"%s/soln%i.dat",doc_info.directory().c_str(),
668  doc_info.number());
669  some_file.open(filename);
670  Bulk_mesh_pt->output(some_file,npts);
671  some_file.close();
672 
673 } // end_of_doc_solution
std::string directory() const
Output directory.
Definition: oomph_utilities.h:524
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
string filename
Definition: MergeRestartFiles.py:39

References oomph::DocInfo::directory(), MergeRestartFiles::filename, and oomph::DocInfo::number().

◆ doc_solution() [2/2]

void FpTestProblem::doc_solution ( DocInfo &  doc_info)

Doc the solution.

◆ fix_pressure() [1/2]

void FpTestProblem::fix_pressure ( const unsigned &  e,
const unsigned &  pdof,
const double &  pvalue 
)
inline

Fix pressure in element e at pressure dof pdof and set to pvalue.

142  {
143  //Cast to full element type and fix the pressure at that element
145  fix_pressure(pdof,pvalue);
146  } // end of fix_pressure

References e().

◆ fix_pressure() [2/2]

void FpTestProblem::fix_pressure ( const unsigned &  e,
const unsigned &  pdof,
const double &  pvalue 
)
inline

Fix pressure in element e at pressure dof pdof and set to pvalue.

131  {
132  //Cast to full element type and fix the pressure at that element
133  dynamic_cast<NavierStokesEquations<2>*>(mesh_pt()->element_pt(e))->
134  fix_pressure(pdof,pvalue);
135  } // end of fix_pressure

References e().

◆ validate_fp() [1/2]

template<class FP_ELEMENT >
void FpTestProblem::validate_fp ( )
inline

Validate fp.

261  {
262  DocInfo my_doc_info;
264  Prec_pt)->template validate<FP_ELEMENT>(my_doc_info,this);
265  pause("done validation");
266  }
Definition: oomph_utilities.h:499
void pause(std::string message)
Pause and display message.
Definition: oomph_utilities.cc:1265

References oomph::pause().

◆ validate_fp() [2/2]

template<class FP_ELEMENT >
void FpTestProblem::validate_fp ( )
inline

Validate fp.

236  {
237  DocInfo my_doc_info;
239  Prec_pt)->template validate<FP_ELEMENT>(my_doc_info,this);
240  pause("done validation");
241  }

References oomph::pause().

Member Data Documentation

◆ Bulk_mesh_pt

Mesh* FpTestProblem::Bulk_mesh_pt
private

Pointer to the "bulk" mesh.

◆ Driven_boundary

unsigned FpTestProblem::Driven_boundary
private

ID of driven boundary.

◆ F_matrix_preconditioner_pt

Preconditioner * FpTestProblem::F_matrix_preconditioner_pt
private

Inexact solver for F block.

◆ Inflow_boundary

unsigned FpTestProblem::Inflow_boundary
private

ID of inflow boundary.

◆ Outflow_boundary

unsigned FpTestProblem::Outflow_boundary
private

ID of outflow boundary.

◆ P_matrix_preconditioner_pt

Preconditioner * FpTestProblem::P_matrix_preconditioner_pt
private

Inexact solver for P block.

◆ Prec_pt

Preconditioner * FpTestProblem::Prec_pt
private

Solver.

◆ Problem_id

unsigned FpTestProblem::Problem_id
private

Problem id.

◆ Solver_pt

IterativeLinearSolver * FpTestProblem::Solver_pt
private

Solver.

◆ Surface_mesh_pt

Mesh* FpTestProblem::Surface_mesh_pt
private

Pointer to the "surface" mesh.


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