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

Public Member Functions

 UnstructuredImmersedEllipseProblem ()
 Constructor. More...
 
 ~UnstructuredImmersedEllipseProblem ()
 Destructor. More...
 
void actions_before_implicit_timestep ()
 Reset the boundary conditions when timestepping. More...
 
void actions_before_adapt ()
 Wipe the meshes of Lagrange multiplier and drag elements. More...
 
void actions_after_adapt ()
 Rebuild the meshes of Lagrange multiplier and drag elements. More...
 
void actions_before_newton_convergence_check ()
 
void complete_problem_setup ()
 
void set_boundary_velocity ()
 Set the boundary velocity. More...
 
void solve_for_consistent_nodal_positions ()
 
void doc_solution (const bool &project=false)
 Doc the solution. More...
 
void output_exact_solution (std::ofstream &output_file)
 Output the exact solution. 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
 
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 Member Functions

void create_lagrange_multiplier_elements ()
 
void delete_lagrange_multiplier_elements ()
 
void create_drag_elements ()
 
void delete_drag_elements ()
 
void pin_rigid_body ()
 Pin the degrees of freedom associated with the solid bodies. More...
 
void unpin_rigid_body ()
 Unpin the degrees of freedom associated with the solid bodies. More...
 

Private Attributes

SolidMesh * Lagrange_multiplier_mesh_pt
 Pointers to mesh of Lagrange multiplier elements. More...
 
RefineableSolidTriangleMesh< ELEMENT > * Fluid_mesh_pt
 Pointer to Fluid_mesh. More...
 
TriangleMeshPolygon * Outer_boundary_polygon_pt
 Triangle mesh polygon for outer boundary. More...
 
Vector< Mesh * > Drag_mesh_pt
 Mesh of drag elements. More...
 
Mesh * Rigid_body_mesh_pt
 Mesh of the generalised elements for the rigid bodies. More...
 
Vector< GeomObject * > Rigid_body_pt
 Storage for the geom object. More...
 
DocInfo Doc_info
 Internal DocInfo object. More...
 
ofstream Norm_file
 File to document the norm of the solution (for validation purposes) More...
 
ofstream Cog_file
 File to document the motion of the centre of gravity. More...
 
ofstream Cog_exact_file
 File to document the exact motion of the centre of gravity. 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_solve ()
 
virtual void actions_after_newton_solve ()
 
virtual void actions_before_newton_step ()
 
virtual void actions_after_newton_step ()
 
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

template<class ELEMENT>
class UnstructuredImmersedEllipseProblem< ELEMENT >

//////////////////////////////////////////////////////// //////////////////////////////////////////////////////// //////////////////////////////////////////////////////// Unstructured Navier-Stokes ALE Problem for a rigid ellipse immersed within a viscous fluid

Constructor & Destructor Documentation

◆ UnstructuredImmersedEllipseProblem()

Constructor.

Constructor: Open output files, construct time steppers, build fluid mesh, immersed rigid body and combine to form the problem

307 {
308  // Output directory
309  this->Doc_info.set_directory("RESLT");
310 
311  // Open norm file
312  this->Norm_file.open("RESLT/norm.dat");
313 
314  // Open file to trace the centre of gravity
315  this->Cog_file.open("RESLT/cog_trace.dat");
316 
317  // Open file to document the exact motion of the centre of gravity
318  this->Cog_exact_file.open("RESLT/cog_exact_trace.dat");
319 
320  // Allocate the timestepper -- this constructs the Problem's
321  // time object with a sufficient amount of storage to store the
322  // previous timsteps.
323  this->add_time_stepper_pt(new BDF<2>);
324 
325  // Allocate a timestepper for the rigid body
326  this->add_time_stepper_pt(new Newmark<2>);
327 
328  // Define the boundaries: Polyline with 4 different
329  // boundaries for the outer boundary and 1 internal elliptical hole
330 
331  // Build the boundary segments for outer boundary, consisting of
332  //--------------------------------------------------------------
333  // four separate polyline segments
334  //---------------------------------
335  Vector<TriangleMeshCurveSection*> boundary_segment_pt(4);
336 
337  //Set the length of the channel
338  double half_length = 5.0;
339  double half_height = 2.5;
340 
341  // Initialize boundary segment
342  Vector<Vector<double> > bound_seg(2);
343  for(unsigned i=0;i<2;i++) {bound_seg[i].resize(2);}
344 
345  // First boundary segment
346  bound_seg[0][0]=-half_length;
347  bound_seg[0][1]=-half_height;
348  bound_seg[1][0]=-half_length;
349  bound_seg[1][1]=half_height;
350 
351  // Specify 1st boundary id
352  unsigned bound_id = 0;
353 
354  // Build the 1st boundary segment
355  boundary_segment_pt[0] = new TriangleMeshPolyLine(bound_seg,bound_id);
356 
357  // Second boundary segment
358  bound_seg[0][0]=-half_length;
359  bound_seg[0][1]=half_height;
360  bound_seg[1][0]=half_length;
361  bound_seg[1][1]=half_height;
362 
363  // Specify 2nd boundary id
364  bound_id = 1;
365 
366  // Build the 2nd boundary segment
367  boundary_segment_pt[1] = new TriangleMeshPolyLine(bound_seg,bound_id);
368 
369  // Third boundary segment
370  bound_seg[0][0]=half_length;
371  bound_seg[0][1]=half_height;
372  bound_seg[1][0]=half_length;
373  bound_seg[1][1]=-half_height;
374 
375  // Specify 3rd boundary id
376  bound_id = 2;
377 
378  // Build the 3rd boundary segment
379  boundary_segment_pt[2] = new TriangleMeshPolyLine(bound_seg,bound_id);
380 
381  // Fourth boundary segment
382  bound_seg[0][0]=half_length;
383  bound_seg[0][1]=-half_height;
384  bound_seg[1][0]=-half_length;
385  bound_seg[1][1]=-half_height;
386 
387  // Specify 4th boundary id
388  bound_id = 3;
389 
390  // Build the 4th boundary segment
391  boundary_segment_pt[3] = new TriangleMeshPolyLine(bound_seg,bound_id);
392 
393  // Create the triangle mesh polygon for outer boundary using boundary segment
394  Outer_boundary_polygon_pt = new TriangleMeshPolygon(boundary_segment_pt);
395 
396  // Now build the moving rigid body
397  //-------------------------------------
398 
399  // We have one rigid body
400  Rigid_body_pt.resize(1);
402 
403  // Build Rigid Body
404  //-----------------
405  double x_center = 0.0;
406  double y_center = 0.0;
407  double A = Problem_Parameter::A;
408  double B = Problem_Parameter::B;
409  GeomObject* temp_hole_pt = new GeneralEllipse(x_center,y_center,A,B);
410  Rigid_body_pt[0] = new ImmersedRigidBodyElement(temp_hole_pt,
411  this->time_stepper_pt(1));
412 
413  // Build the two parts of the curvilinear boundary from the rigid body
414  Vector<TriangleMeshCurveSection*> curvilinear_boundary_pt(2);
415 
416  //First section (boundary 4)
417  double zeta_start=0.0;
418  double zeta_end=MathematicalConstants::Pi;
419  unsigned nsegment=8;
420  unsigned boundary_id=4;
421  curvilinear_boundary_pt[0]=new TriangleMeshCurviLine(
422  Rigid_body_pt[0],zeta_start,zeta_end,nsegment,boundary_id);
423 
424  //Second section (boundary 5)
425  zeta_start=MathematicalConstants::Pi;
426  zeta_end=2.0*MathematicalConstants::Pi;
427  nsegment=8;
428  boundary_id=5;
429  curvilinear_boundary_pt[1]=new TriangleMeshCurviLine(
430  Rigid_body_pt[0],zeta_start,zeta_end,
431  nsegment,boundary_id);
432 
433  // Combine to form a hole in the fluid mesh
434  Vector<double> hole_coords(2);
435  hole_coords[0]=0.0;
436  hole_coords[1]=0.0;
437  Vector<TriangleMeshClosedCurve*> curvilinear_hole_pt(1);
438  hole_pt[0]=
440  curvilinear_boundary_pt,hole_coords);
441 
442  // Now build the mesh, based on the boundaries specified by
443  //---------------------------------------------------------
444  // polygons just created
445  //----------------------
446 
448 
449  double uniform_element_area=1.0;
450 
451  // Use the TriangleMeshParameters object for gathering all
452  // the necessary arguments for the TriangleMesh object
453  TriangleMeshParameters triangle_mesh_parameters(
454  closed_curve_pt);
455 
456  // Define the holes on the domain
457  triangle_mesh_parameters.internal_closed_curve_pt() =
458  hole_pt;
459 
460  // Define the maximum element area
461  triangle_mesh_parameters.element_area() =
462  uniform_element_area;
463 
464  // Create the mesh
465  Fluid_mesh_pt =
466  new RefineableSolidTriangleMesh<ELEMENT>(
467  triangle_mesh_parameters, this->time_stepper_pt());
468 
469  // Set error estimator for bulk mesh
471  Fluid_mesh_pt->spatial_error_estimator_pt()=error_estimator_pt;
472 
473  // Set targets for spatial adaptivity
474  Fluid_mesh_pt->max_permitted_error()=0.005;
475  Fluid_mesh_pt->min_permitted_error()=0.001;
476  Fluid_mesh_pt->max_element_size()=1.0;
477  Fluid_mesh_pt->min_element_size()=0.001;
478 
479  // Use coarser mesh during validation
481  {
482  Fluid_mesh_pt->min_element_size()=0.01;
483  }
484 
485  // Set boundary condition, assign auxiliary node update fct,
486  // complete the build of all elements, attach power elements that allow
487  // computation of drag vector
489 
490  //Set the parameters of the rigid body elements
491  ImmersedRigidBodyElement* rigid_element1_pt =
492  dynamic_cast<ImmersedRigidBodyElement*>(Rigid_body_pt[0]);
493  rigid_element1_pt->initial_centre_of_mass(0) = x_center;
494  rigid_element1_pt->initial_centre_of_mass(1) = y_center;
495  rigid_element1_pt->mass_shape() = MathematicalConstants::Pi*A*B;
496  rigid_element1_pt->moment_of_inertia_shape() =
497  0.25*MathematicalConstants::Pi*A*B*(A*A + B*B);
498  rigid_element1_pt->re_pt() = &Problem_Parameter::Re;
499  rigid_element1_pt->st_pt() = &Problem_Parameter::St;
500  rigid_element1_pt->density_ratio_pt() = &Problem_Parameter::Density_ratio;
501 
502  //Pin the position of the centre of mass
503  rigid_element1_pt->pin_centre_of_mass_coordinate(0);
504  rigid_element1_pt->pin_centre_of_mass_coordinate(1);
505 
506  // Create the mesh for the rigid bodies
507  Rigid_body_mesh_pt = new Mesh;
508  Rigid_body_mesh_pt->add_element_pt(rigid_element1_pt);
509 
510  // Create the drag mesh for the rigid bodies
511  Drag_mesh_pt.resize(1);
512  for(unsigned m=0;m<1;m++) {Drag_mesh_pt[m] = new Mesh;}
513  this->create_drag_elements();
514 
515  //Add the drag mesh to the appropriate rigid bodies
516  rigid_element1_pt->set_drag_mesh(Drag_mesh_pt[0]);
517 
518 
519 
520  // Create Lagrange multiplier mesh for boundary motion
521  //----------------------------------------------------
522  // Construct the mesh of elements that enforce prescribed boundary motion
523  // of pseudo-solid fluid mesh by Lagrange multipliers
526 
527 
528  // Combine meshes
529  //---------------
530 
531  // Add Fluid_mesh_pt sub meshes
533 
534  // Add Lagrange_multiplier sub meshes
536 
537  this->add_sub_mesh(this->Rigid_body_mesh_pt);
538 
539  // Build global mesh
540  this->build_global_mesh();
541 
542  // Setup equation numbering scheme
543  cout <<"Number of equations: " << this->assign_eqn_numbers() << std::endl;
544 
545 } // end_of_constructor
int i
Definition: BiCGSTAB_step_by_step.cpp:9
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
My own Ellipse class.
Definition: adaptive_hopf.cc:80
RefineableSolidTriangleMesh< ELEMENT > * Fluid_mesh_pt
Pointer to Fluid_mesh.
Definition: jeffery_orbit.cc:271
void create_drag_elements()
Definition: jeffery_orbit.cc:1006
DocInfo Doc_info
Internal DocInfo object.
Definition: jeffery_orbit.cc:286
Mesh * Rigid_body_mesh_pt
Mesh of the generalised elements for the rigid bodies.
Definition: jeffery_orbit.cc:280
void create_lagrange_multiplier_elements()
Definition: jeffery_orbit.cc:898
ofstream Cog_exact_file
File to document the exact motion of the centre of gravity.
Definition: jeffery_orbit.cc:295
void complete_problem_setup()
Definition: jeffery_orbit.cc:654
ofstream Norm_file
File to document the norm of the solution (for validation purposes)
Definition: jeffery_orbit.cc:289
Vector< Mesh * > Drag_mesh_pt
Mesh of drag elements.
Definition: jeffery_orbit.cc:277
Vector< GeomObject * > Rigid_body_pt
Storage for the geom object.
Definition: jeffery_orbit.cc:283
ofstream Cog_file
File to document the motion of the centre of gravity.
Definition: jeffery_orbit.cc:292
SolidMesh * Lagrange_multiplier_mesh_pt
Pointers to mesh of Lagrange multiplier elements.
Definition: jeffery_orbit.cc:268
TriangleMeshPolygon * Outer_boundary_polygon_pt
Triangle mesh polygon for outer boundary.
Definition: jeffery_orbit.cc:274
void set_directory(const std::string &directory)
Definition: oomph_utilities.cc:298
Definition: geom_objects.h:101
Definition: immersed_rigid_body_elements.h:93
double & mass_shape()
Definition: immersed_rigid_body_elements.h:222
void pin_centre_of_mass_coordinate(const unsigned &i)
Pin the i-th coordinate of the centre of mass.
Definition: immersed_rigid_body_elements.h:271
double & initial_centre_of_mass(const unsigned &i)
Access function for the initial centre of mass.
Definition: immersed_rigid_body_elements.h:174
double *& re_pt()
Access function for the pointer to the fluid Reynolds number.
Definition: immersed_rigid_body_elements.h:446
double *& density_ratio_pt()
Access function for the pointer to the density ratio.
Definition: immersed_rigid_body_elements.h:483
double & moment_of_inertia_shape()
Access to dimensionless polar "moment of inertia" shape parameter.
Definition: immersed_rigid_body_elements.h:228
void set_drag_mesh(Mesh *const &drag_mesh_pt)
Definition: immersed_rigid_body_elements.cc:206
double *& st_pt()
Access function for the pointer to the fluid Strouhal number.
Definition: immersed_rigid_body_elements.h:458
Definition: matrices.h:74
Definition: mesh.h:67
void add_element_pt(GeneralisedElement *const &element_pt)
Add a (pointer to) an element to the mesh.
Definition: mesh.h:617
void add_time_stepper_pt(TimeStepper *const &time_stepper_pt)
Definition: problem.cc:1545
unsigned add_sub_mesh(Mesh *const &mesh_pt)
Definition: problem.h:1330
void build_global_mesh()
Definition: problem.cc:1493
unsigned long assign_eqn_numbers(const bool &assign_local_eqn_numbers=true)
Definition: problem.cc:1989
TimeStepper *& time_stepper_pt()
Definition: problem.h:1524
Definition: mesh.h:2562
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
int * m
Definition: level2_cplx_impl.h:294
double Pi
Definition: two_d_biharmonic.cc:235
Z2ErrorEstimator * error_estimator_pt
Definition: MortaringCantileverCompareToNonMortaring.cpp:190
double A
Initial axis of the elliptical solid in x-direction.
Definition: jeffery_orbit.cc:68
double Density_ratio
Density ratio (Solid density / Fluid density)
Definition: jeffery_orbit.cc:65
double St
Strouhal number.
Definition: jeffery_orbit.cc:62
double B
Definition: jeffery_orbit.cc:72
double Re
Reynolds number.
Definition: jeffery_orbit.cc:59
bool command_line_flag_has_been_set(const std::string &flag)
Definition: oomph_utilities.cc:501

References Problem_Parameter::A, oomph::Mesh::add_element_pt(), Problem_Parameter::B, oomph::CommandLineArgs::command_line_flag_has_been_set(), Problem_Parameter::Density_ratio, oomph::ImmersedRigidBodyElement::density_ratio_pt(), GlobalParameters::Doc_info, oomph::TriangleMeshParameters::element_area(), MeshRefinement::error_estimator_pt, i, oomph::ImmersedRigidBodyElement::initial_centre_of_mass(), oomph::TriangleMeshParameters::internal_closed_curve_pt(), m, oomph::ImmersedRigidBodyElement::mass_shape(), oomph::ImmersedRigidBodyElement::moment_of_inertia_shape(), oomph::Problem_Parameter::Norm_file, BiharmonicTestFunctions2::Pi, oomph::ImmersedRigidBodyElement::pin_centre_of_mass_coordinate(), Problem_Parameter::Re, oomph::ImmersedRigidBodyElement::re_pt(), oomph::DocInfo::set_directory(), oomph::ImmersedRigidBodyElement::set_drag_mesh(), Problem_Parameter::St, and oomph::ImmersedRigidBodyElement::st_pt().

◆ ~UnstructuredImmersedEllipseProblem()

Destructor.

Destructor that cleans up memory and closes files.

554 {
555  // Delete Fluid timestepper
556  delete this->time_stepper_pt(0);
557 
558  //Delete solid timestepper
559  delete this->time_stepper_pt(1);
560 
561  // Kill data associated with outer boundary
563  for (unsigned j=0;j<n;j++)
564  {
566  }
568 
569  //Flush the drag mesh from the rigid body
570  dynamic_cast<ImmersedRigidBodyElement*>(Rigid_body_pt[0])->
571  flush_drag_mesh();
572 
573  // Flush Lagrange multiplier mesh
576 
577  // Delete error estimator
578  delete Fluid_mesh_pt->spatial_error_estimator_pt();
579 
580  // Delete fluid mesh
581  delete Fluid_mesh_pt;
582 
583  // Kill const eqn
585 
586  // Close norm and trace files
587  this->Cog_exact_file.close();
588  this->Cog_file.close();
589  this->Norm_file.close();
590 }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
void delete_lagrange_multiplier_elements()
Definition: jeffery_orbit.cc:981
unsigned npolyline() const
Number of constituent polylines.
Definition: unstructured_two_d_mesh_geometry_base.h:1482
TriangleMeshPolyLine * polyline_pt(const unsigned &i) const
Pointer to i-th constituent polyline.
Definition: unstructured_two_d_mesh_geometry_base.h:1488
ConstitutiveLaw * Constitutive_law_pt
Constitutive law used to determine the mesh deformation.
Definition: jeffery_orbit.cc:82
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References Problem_Parameter::Constitutive_law_pt, j, n, and oomph::Problem_Parameter::Norm_file.

Member Function Documentation

◆ actions_after_adapt()

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

Rebuild the meshes of Lagrange multiplier and drag elements.

Actions after adapt: Rebuild the mesh of Lagrange multiplier elements.

Reimplemented from oomph::Problem.

619 {
620  //Reset the lagrangian coordinates for the solid mechanics
621  //an updated lagrangian approach
622  Fluid_mesh_pt->set_lagrangian_nodal_coordinates();
623 
624  // Create the elements that impose the displacement constraint
626 
627  // Create the drag elements anew
629 
630  // Add the drag elements to the rigid body
631  dynamic_cast<ImmersedRigidBodyElement*>(Rigid_body_pt[0])->
632  set_drag_mesh(this->Drag_mesh_pt[0]);
633 
634  // Rebuild the Problem's global mesh from its various sub-meshes
635  this->rebuild_global_mesh();
636 
637  // Setup the problem again -- remember that fluid mesh has been
638  // completely rebuilt and its element's don't have any
639  // pointers to Re etc. yet
641 
642  // Output solution after adaptation/projection
643  bool doc_projection=true;
644  doc_solution(doc_projection);
645 }// end of actions_after_adapt
void doc_solution(const bool &project=false)
Doc the solution.
Definition: jeffery_orbit.cc:1106
void rebuild_global_mesh()
Definition: problem.cc:1533

◆ actions_before_adapt()

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

Wipe the meshes of Lagrange multiplier and drag elements.

Actions before adapt: Wipe the mesh of Lagrange multiplier elements.

Reimplemented from oomph::Problem.

598 {
599  //Flush the drag mesh from the rigid body
600  dynamic_cast<ImmersedRigidBodyElement*>(Rigid_body_pt[0])->
601  flush_drag_mesh();
602 
603  //Kill the drag element
605 
606  // Kill the elements and wipe surface mesh
608 
609  // Rebuild the Problem's global mesh from its various sub-meshes
610  this->rebuild_global_mesh();
611 } // end of actions_before_adapt
void delete_drag_elements()
Definition: jeffery_orbit.cc:1079

◆ actions_before_implicit_timestep()

template<class ELEMENT >
void UnstructuredImmersedEllipseProblem< ELEMENT >::actions_before_implicit_timestep ( )
inlinevirtual

Reset the boundary conditions when timestepping.

Reimplemented from oomph::Problem.

206  {
207  this->set_boundary_velocity();
208  }
void set_boundary_velocity()
Set the boundary velocity.
Definition: jeffery_orbit.cc:737

◆ actions_before_newton_convergence_check()

template<class ELEMENT >
void UnstructuredImmersedEllipseProblem< ELEMENT >::actions_before_newton_convergence_check ( )
inlinevirtual

Re-apply the no slip condition (imposed indirectly via dependent velocities)

Reimplemented from oomph::Problem.

219  {
220  // Update mesh -- this applies the auxiliary node update function
221  Fluid_mesh_pt->node_update();
222  }

◆ complete_problem_setup()

template<class ELEMENT >
void UnstructuredImmersedEllipseProblem< ELEMENT >::complete_problem_setup

Set boundary condition, assign auxiliary node update fct. Complete the build of all elements, attach power elements that allow computation of drag vector

655 {
656  // Set the boundary conditions for fluid problem: All nodes are
657  // free by default -- just pin the ones that have Dirichlet conditions
658  // here.
659  unsigned nbound=Fluid_mesh_pt->nboundary();
660  for(unsigned ibound=0;ibound<nbound;ibound++)
661  {
662  unsigned num_nod=Fluid_mesh_pt->nboundary_node(ibound);
663  for (unsigned inod=0;inod<num_nod;inod++)
664  {
665  // Cache pointer to node
666  Node* const nod_pt=Fluid_mesh_pt->boundary_node_pt(ibound,inod);
667 
668  //Pin x-velocity unless on inlet (0) and outlet (2) boundaries
669  //of the external rectangular box
670  if((ibound!=0) && (ibound!=2)) {nod_pt->pin(0);}
671  //Pin the y-velocity on all boundaries
672  nod_pt->pin(1);
673 
674  // Pin pseudo-solid positions apart from on the
675  // ellipse boundary that is allowed to move
676  // Cache cast pointer to solid node
677  SolidNode* const solid_node_pt = dynamic_cast<SolidNode*>(nod_pt);
678 
679  //Pin the solid positions on all external boundaries
680  if(ibound < 4)
681  {
682  solid_node_pt->pin_position(0);
683  solid_node_pt->pin_position(1);
684  }
685  // Unpin the position of all the nodes on hole boundaries:
686  // since they will be moved using Lagrange Multiplier
687  else
688  {
689  solid_node_pt->unpin_position(0);
690  solid_node_pt->unpin_position(1);
691 
692  // Assign auxiliary node update fct, which determines the
693  // velocity on the moving boundary using the position history
694  // values
695  // A more accurate version may be obtained by using velocity
696  // based on the actual position of the geometric object,
697  // but this introduces additional dependencies between the
698  // Data of the rigid body and the fluid elements.
701  }
702  } //End of loop over boundary nodes
703  } // End loop over boundaries
704 
705  // Complete the build of all elements so they are fully functional
706  unsigned n_element = Fluid_mesh_pt->nelement();
707  for(unsigned e=0;e<n_element;e++)
708  {
709  // Upcast from GeneralisedElement to the present element
710  ELEMENT* el_pt = dynamic_cast<ELEMENT*>(Fluid_mesh_pt->element_pt(e));
711 
712  // Set the Reynolds number
713  el_pt->re_pt() = &Problem_Parameter::Re;
714 
715  // Set the Womersley number (same as Re since St=1)
716  el_pt->re_st_pt() = &Problem_Parameter::Re;
717 
718  // Set the constitutive law for pseudo-elastic mesh deformation
719  el_pt->constitutive_law_pt()=Problem_Parameter::Constitutive_law_pt;
720 
721  // Set the "density" for pseudo-elastic mesh deformation
722  el_pt->lambda_sq_pt()=&Problem_Parameter::Lambda_sq;
723  }
724 
725  // Re-apply Dirichlet boundary conditions for current and history values
726  // (projection ignores boundary conditions!)
727  this->set_boundary_velocity();
728 
729 } //end_of_complete_problem_setup
Array< double, 1, 3 > e(1./3., 0.5, 2.)
void pin(const unsigned &i)
Pin the i-th stored variable.
Definition: nodes.h:385
Definition: nodes.h:906
void set_auxiliary_node_update_fct_pt(AuxNodeUpdateFctPt aux_node_update_fct_pt)
Definition: nodes.h:1596
Definition: nodes.h:1686
void pin_position(const unsigned &i)
Pin the nodal position.
Definition: nodes.h:1816
void unpin_position(const unsigned &i)
Unpin the nodal position.
Definition: nodes.h:1829
double Lambda_sq
Definition: jeffery_orbit.cc:79
void apply_no_slip_on_moving_wall(Node *node_pt)
Definition: fsi.cc:48

References oomph::FSI_functions::apply_no_slip_on_moving_wall(), Problem_Parameter::Constitutive_law_pt, e(), Problem_Parameter::Lambda_sq, oomph::Data::pin(), oomph::SolidNode::pin_position(), Problem_Parameter::Re, oomph::Node::set_auxiliary_node_update_fct_pt(), and oomph::SolidNode::unpin_position().

◆ create_drag_elements()

template<class ELEMENT >
void UnstructuredImmersedEllipseProblem< ELEMENT >::create_drag_elements
private

Create elements that calculate the drag and torque on the boundaries

Create elements that calculate the drag and torque on the obstacles in the fluid mesh

1007 {
1008  //The idea is only to attach drag elements to those
1009  //boundaries associated with each particular rigid body
1010  //The loop is slightly inefficient, but should work in general
1011 
1012  // Get the number of rigid bodies
1013  unsigned n_rigid = Rigid_body_pt.size();
1014 
1015  // Get the number of boundaries in the mesh
1016  unsigned n_boundary = Fluid_mesh_pt->nboundary();
1017 
1018  //Loop over the rigid bodies
1019  for(unsigned r=0;r<n_rigid;r++)
1020  {
1021  //Get the rigid boundary geometric object
1022  ImmersedRigidBodyElement* rigid_el_pt =
1023  dynamic_cast<ImmersedRigidBodyElement*>(this->Rigid_body_pt[r]);
1024 
1025  // Loop over all boundaries
1026  for(unsigned b=0;b<n_boundary;b++)
1027  {
1028  //Does the boundary correspond to the current rigid body
1029  if(dynamic_cast<ImmersedRigidBodyElement*>
1030  (Fluid_mesh_pt->boundary_geom_object_pt(b)) == rigid_el_pt)
1031  {
1032  // How many bulk fluid elements are adjacent to boundary b?
1033  unsigned n_element = Fluid_mesh_pt->nboundary_element(b);
1034 
1035  // Loop over the bulk fluid elements adjacent to boundary b?
1036  for(unsigned e=0;e<n_element;e++)
1037  {
1038  // Get pointer to the bulk fluid element that is
1039  // adjacent to boundary b
1040  ELEMENT* bulk_elem_pt = dynamic_cast<ELEMENT*>(
1041  Fluid_mesh_pt->boundary_element_pt(b,e));
1042 
1043  //Find the index of the face of element e along boundary b
1044  int face_index = Fluid_mesh_pt->face_index_at_boundary(b,e);
1045 
1046  // Create new element. Note that we use different Lagrange
1047  // multiplier fields for each distinct boundary (here indicated
1048  // by b.
1051  bulk_elem_pt,face_index);
1052 
1053  // Add it to the mesh
1054  Drag_mesh_pt[r]->add_element_pt(el_pt);
1055 
1056  //Set the original centre of rotation
1057  //from the rigid body in the drag element
1058  for(unsigned i=0;i<2;i++)
1059  {el_pt->centre_of_rotation(i) =
1060  rigid_el_pt->initial_centre_of_mass(i);}
1061 
1062  //Set the data to the translation and rotation data
1063  //as well because these data will enter the Jacobian terms
1064  //in the DragTorqueElement
1065  el_pt->set_translation_and_rotation(rigid_el_pt->geom_data_pt(0));
1066  } // end loop over the element
1067  }
1068  } //End of loop over boundaries
1069  } // end loop over the rigid bodies
1070 }
Scalar * b
Definition: benchVecAdd.cpp:17
Data * geom_data_pt(const unsigned &j)
Definition: immersed_rigid_body_elements.h:428
Definition: navier_stokes_surface_drag_torque_elements.h:51
void set_translation_and_rotation(Data *const &object_data_pt)
Definition: navier_stokes_surface_drag_torque_elements.h:72
double & centre_of_rotation(const unsigned &i)
Access function for the centre of rotation.
Definition: navier_stokes_surface_drag_torque_elements.h:79
r
Definition: UniformPSDSelfTest.py:20

References b, oomph::NavierStokesSurfaceDragTorqueElement< ELEMENT >::centre_of_rotation(), e(), oomph::ImmersedRigidBodyElement::geom_data_pt(), i, oomph::ImmersedRigidBodyElement::initial_centre_of_mass(), UniformPSDSelfTest::r, and oomph::NavierStokesSurfaceDragTorqueElement< ELEMENT >::set_translation_and_rotation().

◆ create_lagrange_multiplier_elements()

template<class ELEMENT >
void UnstructuredImmersedEllipseProblem< ELEMENT >::create_lagrange_multiplier_elements
private

Create elements that enforce prescribed boundary motion for the pseudo-solid fluid mesh by Lagrange multipliers

Create elements that impose the prescribed boundary displacement for the pseudo-solid fluid mesh

899 {
900  // The idea is to apply Lagrange multipliers to the boundaries in
901  // the mesh that have associated geometric objects
902 
903  //Find the number of boundaries
904  unsigned n_boundary = Fluid_mesh_pt->nboundary();
905 
906  // Loop over the boundaries
907  for(unsigned b=0;b<n_boundary;b++)
908  {
909  //Get the geometric object associated with the boundary
910  GeomObject* boundary_geom_obj_pt =
911  Fluid_mesh_pt->boundary_geom_object_pt(b);
912 
913  //Only bother to do anything if there is a geometric object
914  if(boundary_geom_obj_pt!=0)
915  {
916  // How many bulk fluid elements are adjacent to boundary b?
917  unsigned n_element = Fluid_mesh_pt->nboundary_element(b);
918 
919  // Loop over the bulk fluid elements adjacent to boundary b?
920  for(unsigned e=0;e<n_element;e++)
921  {
922  // Get pointer to the bulk fluid element that is
923  // adjacent to boundary b
924  ELEMENT* bulk_elem_pt = dynamic_cast<ELEMENT*>(
925  Fluid_mesh_pt->boundary_element_pt(b,e));
926 
927  //Find the index of the face of element e along boundary b
928  int face_index = Fluid_mesh_pt->face_index_at_boundary(b,e);
929 
930  // Create new element. Note that we use different Lagrange
931  // multiplier fields for each distinct boundary (here indicated
932  // by b.
935  bulk_elem_pt,face_index,b);
936 
937  // Add it to the mesh
939 
940  // Set the GeomObject that defines the boundary shape and set
941  // which bulk boundary we are attached to (needed to extract
942  // the boundary coordinate from the bulk nodes)
944  boundary_geom_obj_pt,b);
945 
946  // Loop over the nodes to pin Lagrange multiplier
947  unsigned nnod=el_pt->nnode();
948  for(unsigned j=0;j<nnod;j++)
949  {
950  Node* nod_pt = el_pt->node_pt(j);
951 
952  // How many nodal values were used by the "bulk" element
953  // that originally created this node?
954  unsigned n_bulk_value=el_pt->nbulk_value(j);
955 
956  // Pin two of the four Lagrange multipliers at vertices
957  // This is not totally robust, but will work in this application
958  unsigned nval=nod_pt->nvalue();
959  if (nval==7)
960  {
961  for (unsigned i=0;i<2;i++)
962  {
963  // Pin lagrangian multipliers
964  nod_pt->pin(n_bulk_value+2+i);
965  }
966  }
967  }
968  } // end loop over the element
969  } //End of case if there is a geometric object
970  } //End of loop over boundaries
971 }
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
Definition: nodes.h:483
unsigned & nbulk_value(const unsigned &n)
Definition: elements.h:4845
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2175
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2210
Definition: solid_traction_elements.h:1107
void set_boundary_shape_geom_object_pt(GeomObject *boundary_shape_geom_object_pt, const unsigned &boundary_number_in_bulk_mesh)
Definition: solid_traction_elements.h:1209

References b, e(), i, j, oomph::FaceElement::nbulk_value(), oomph::FiniteElement::nnode(), oomph::FiniteElement::node_pt(), oomph::Data::nvalue(), oomph::Data::pin(), and oomph::ImposeDisplacementByLagrangeMultiplierElement< ELEMENT >::set_boundary_shape_geom_object_pt().

◆ delete_drag_elements()

template<class ELEMENT >
void UnstructuredImmersedEllipseProblem< ELEMENT >::delete_drag_elements
private

Delete elements that calculate the drag and torque on the boundaries

1080 {
1081  unsigned n_bodies = Drag_mesh_pt.size();
1082  for(unsigned n=0;n<n_bodies;n++)
1083  {
1084  // How many surface elements are in the surface mesh
1085  unsigned n_element = Drag_mesh_pt[n]->nelement();
1086 
1087  // Loop over the surface elements
1088  for(unsigned e=0;e<n_element;e++)
1089  {
1090  // Kill surface element
1091  delete Drag_mesh_pt[n]->element_pt(e);
1092  }
1093 
1094  // Wipe the mesh
1095  Drag_mesh_pt[n]->flush_element_and_node_storage();
1096  }
1097 } // end of delete_drag_elements

References e(), and n.

◆ delete_lagrange_multiplier_elements()

template<class ELEMENT >
void UnstructuredImmersedEllipseProblem< ELEMENT >::delete_lagrange_multiplier_elements
private

Delete elements that impose the prescribed boundary displacement and wipe the associated mesh

982 {
983  // How many surface elements are in the surface mesh
984  unsigned n_element = Lagrange_multiplier_mesh_pt->nelement();
985 
986  // Loop over the surface elements
987  for(unsigned e=0;e<n_element;e++)
988  {
989  // Kill surface element
991  }
992 
993  // Wipe the mesh
995 
996 } // end of delete_lagrange_multiplier_elements
void flush_element_and_node_storage()
Definition: mesh.h:407
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

References e().

◆ doc_solution()

template<class ELEMENT >
void UnstructuredImmersedEllipseProblem< ELEMENT >::doc_solution ( const bool &  project = false)

Doc the solution.

1108 {
1109 
1110  oomph_info << "Docing step: " << this->Doc_info.number()
1111  << std::endl;
1112 
1113  ofstream some_file;
1114  char filename[100];
1115 
1116  // Number of plot points
1117  unsigned npts;
1118  npts=5;
1119 
1120 
1121  // Output solution and projection files
1122  if(!project)
1123  {
1124  sprintf(filename,"%s/soln%i.dat",
1125  this->Doc_info.directory().c_str(),
1126  this->Doc_info.number());
1127  }
1128  else
1129  {
1130  sprintf(filename,"%s/proj%i.dat",
1131  this->Doc_info.directory().c_str(),
1132  this->Doc_info.number()-1);
1133  }
1134 
1135  // Assemble square of L2 norm
1136  double square_of_l2_norm=0.0;
1137  unsigned nel=Fluid_mesh_pt->nelement();
1138  for (unsigned e=0;e<nel;e++)
1139  {
1141  dynamic_cast<ELEMENT*>(this->Fluid_mesh_pt->element_pt(e))->
1143  }
1144 
1145  std::cout << "Checking " << sqrt(square_of_l2_norm) << "\n";
1146  this->Norm_file << sqrt(square_of_l2_norm) << "\n";
1147 
1148  some_file.open(filename);
1149  some_file << dynamic_cast<ELEMENT*>(this->Fluid_mesh_pt->element_pt(0))
1150  ->variable_identifier();
1151  this->Fluid_mesh_pt->output(some_file,npts);
1152  some_file.close();
1153 
1154  // No trace file writing after projection
1155  if(project) return;
1156 
1157  //Output the boundary only if not projecting
1158  sprintf(filename,"%s/int%i.dat",
1159  this->Doc_info.directory().c_str(),
1160  this->Doc_info.number());
1161  some_file.open(filename);
1162  this->Lagrange_multiplier_mesh_pt->output(some_file);
1163  some_file.close();
1164 
1165  // Increment the doc_info number
1166  this->Doc_info.number()++;
1167 
1168  //Output the motion of the centre of gravity
1169  dynamic_cast<ImmersedRigidBodyElement*>(this->Rigid_body_pt[0])->
1170  output_centre_of_gravity(this->Cog_file);
1171 
1172  //Output the exact solution
1174 
1175 }
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
void output_exact_solution(std::ofstream &output_file)
Output the exact solution.
Definition: jeffery_orbit.cc:1183
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
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
double square_of_l2_norm()
Get square of L2 norm of velocity.
Definition: overloaded_element_body.h:1031

References oomph::DocInfo::directory(), GlobalParameters::Doc_info, e(), MergeRestartFiles::filename, oomph::Problem_Parameter::Norm_file, oomph::DocInfo::number(), oomph::oomph_info, sqrt(), and square_of_l2_norm().

◆ output_exact_solution()

template<class ELEMENT >
void UnstructuredImmersedEllipseProblem< ELEMENT >::output_exact_solution ( std::ofstream &  output_file)

Output the exact solution.

1184  {
1185  //Get the current time
1186  double time = this->time();
1187  //Output the exact solution
1188  output_file << time << " " << Jeffery_Solution::angle(time)
1189  << " " << Jeffery_Solution::velocity(time)
1190  << " " << Jeffery_Solution::acceleration(time) << std::endl;
1191  }
double & time()
Return the current value of continuous time.
Definition: problem.cc:11531
double velocity(const double &t)
Angular velocity as function of time t.
Definition: jeffery_orbit.cc:107
double angle(const double &t)
Angular position as a function of time t.
Definition: jeffery_orbit.cc:98
double acceleration(const double &t)
Angular acceleration as a function of time t (should always be zero)
Definition: jeffery_orbit.cc:120

References Jeffery_Solution::acceleration(), Jeffery_Solution::angle(), and Jeffery_Solution::velocity().

◆ pin_rigid_body()

template<class ELEMENT >
void UnstructuredImmersedEllipseProblem< ELEMENT >::pin_rigid_body
private

Pin the degrees of freedom associated with the solid bodies.

825 {
826  unsigned n_rigid_body = Rigid_body_pt.size();
827  for(unsigned i=0;i<n_rigid_body;++i)
828  {
829  unsigned n_geom_data = Rigid_body_pt[i]->ngeom_data();
830  for(unsigned j=0;j<n_geom_data;j++)
831  {
832  Rigid_body_pt[i]->geom_data_pt(j)->pin_all();
833  }
834  }
835 }

References i, and j.

◆ set_boundary_velocity()

template<class ELEMENT >
void UnstructuredImmersedEllipseProblem< ELEMENT >::set_boundary_velocity

Set the boundary velocity.

Set the boundary velocity for current and history values.

738 {
739  //Loop over top and bottom walls, inlet and outlet
740  for(unsigned ibound=0;ibound<4;ibound++)
741  {
742  //If we are on the inlet or outlet only zero the
743  //y velocity, leave x alone
744  if((ibound==0) || (ibound==2))
745  {
746  unsigned num_nod=this->Fluid_mesh_pt->nboundary_node(ibound);
747  for (unsigned inod=0;inod<num_nod;inod++)
748  {
749  // Get node
750  Node* const nod_pt=this->Fluid_mesh_pt->boundary_node_pt(ibound,inod);
751 
752  // Get number of previous (history) values
753  unsigned n_prev=nod_pt->time_stepper_pt()->nprev_values();
754 
755  //Zero all current and previous y-velocities
756  for(unsigned t=0;t<=n_prev;t++)
757  {
758  nod_pt->set_value(t,1,0.0);
759  }
760  }
761  }
762  //Otherwise on the top and bottom walls set a smooth x-velocity
763  //and zero y-velocity
764  else
765  {
766  unsigned num_nod=this->Fluid_mesh_pt->nboundary_node(ibound);
767  for (unsigned inod=0;inod<num_nod;inod++)
768  {
769  // Get node
770  Node* nod_pt=this->Fluid_mesh_pt->boundary_node_pt(ibound,inod);
771 
772  // Get number of previous (history) values
773  unsigned n_prev=nod_pt->time_stepper_pt()->nprev_values();
774 
775  //Now set the boundary velocity
776  double y = nod_pt->x(1);
777  //Get the previous time
778  for(unsigned t=0;t<=n_prev;t++)
779  {
780  //Get the time
781  double time_ = this->time_pt()->time(t);
782 
783  //Get the velocity ramp
784  //Initially zero (nothing at all is going on)
785  double ramp = 0.0;
786  double delta = 5.0;
787 
788  double e1 = exp(-delta);
789  double a1 = 1.0 - (1.0 + delta + 0.5*delta*delta)*e1;
790  double b1 = (3.0 + 3.0*delta + delta*delta)*e1 - 3.0;
791  double c1 = 3.0 - (3.0 + 2.0*delta + 0.5*delta*delta)*e1;
792  //Smooth start
793  if((time_ >= 0.0) & (time_ <= 1.0))
794  {
795  ramp = a1*time_*time_*time_
796  + b1*time_*time_
797  + c1*time_;
798  }
799  //Coupled to exponential levelling
800  else if (time_ > 1.0)
801  {
802  ramp = 1.0 - exp(-delta*time_);
803  }
804 
805  nod_pt->set_value(t,0,-y*ramp);
806  }
807 
808  // Zero all current and previous veloc values
809  // for the v-velocity
810  for (unsigned t=0;t<=n_prev;t++)
811  {
812  nod_pt->set_value(t,1,0.0);
813  }
814  }
815  }
816  }
817 }
double ramp(double x)
Definition: class_CwiseUnaryOp_ptrfun.cpp:5
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
Definition: nodes.h:238
void set_value(const unsigned &i, const double &value_)
Definition: nodes.h:271
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060
Time *& time_pt()
Return a pointer to the global time object.
Definition: problem.h:1504
virtual unsigned nprev_values() const =0
Number of previous values available: 0 for static, 1 for BDF<1>,...
double & time()
Return the current value of the continuous time.
Definition: timesteppers.h:123
Scalar * y
Definition: level1_cplx_impl.h:128
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 exp(const bfloat16 &a)
Definition: BFloat16.h:615
int delta
Definition: MultiOpt.py:96
t
Definition: plotPSD.py:36

References MultiOpt::delta, Eigen::bfloat16_impl::exp(), oomph::TimeStepper::nprev_values(), ramp(), oomph::Data::set_value(), plotPSD::t, oomph::Data::time_stepper_pt(), oomph::Node::x(), and y.

◆ solve_for_consistent_nodal_positions()

template<class ELEMENT >
void UnstructuredImmersedEllipseProblem< ELEMENT >::solve_for_consistent_nodal_positions

Function that solves a simplified problem to ensure that the positions of the boundary nodes are initially consistent with the lagrange multiplier formulation

Assemble and solve a simplified problem that ensures that the positions of the boundary nodes are consistent with the weak imposition of the displacement boundary conditions on the surface of the ellipse.

865 {
866  //First pin all degrees of freedom in the rigid body
867  this->pin_rigid_body();
868 
869  //Must reassign equation numbrs
870  this->assign_eqn_numbers();
871 
872  //Do a steady solve to map the nodes to the boundary of the ellipse
873  this->steady_newton_solve();
874 
875  //Now unpin the rigid body...
876  this->unpin_rigid_body();
877 
878  //...and then repin the position of the centre of mass
879  ImmersedRigidBodyElement* rigid_element1_pt =
880  dynamic_cast<ImmersedRigidBodyElement*>(Rigid_body_pt[0]);
881  rigid_element1_pt->pin_centre_of_mass_coordinate(0);
882  rigid_element1_pt->pin_centre_of_mass_coordinate(1);
883 
884  //and then reassign equation numbers
885  this->assign_eqn_numbers();
886 
887 } //end_solve_for_consistent_nodal_positions
void pin_rigid_body()
Pin the degrees of freedom associated with the solid bodies.
Definition: jeffery_orbit.cc:824
void unpin_rigid_body()
Unpin the degrees of freedom associated with the solid bodies.
Definition: jeffery_orbit.cc:842
void steady_newton_solve(unsigned const &max_adapt=0)
Definition: problem.cc:9292

References oomph::ImmersedRigidBodyElement::pin_centre_of_mass_coordinate().

◆ unpin_rigid_body()

template<class ELEMENT >
void UnstructuredImmersedEllipseProblem< ELEMENT >::unpin_rigid_body
private

Unpin the degrees of freedom associated with the solid bodies.

843 {
844  unsigned n_rigid_body = Rigid_body_pt.size();
845  for(unsigned i=0;i<n_rigid_body;++i)
846  {
847  unsigned n_geom_data = Rigid_body_pt[i]->ngeom_data();
848  for(unsigned j=0;j<n_geom_data;j++)
849  {
850  Rigid_body_pt[i]->geom_data_pt(j)->unpin_all();
851  }
852  }
853 }

References i, and j.

Member Data Documentation

◆ Cog_exact_file

template<class ELEMENT >
ofstream UnstructuredImmersedEllipseProblem< ELEMENT >::Cog_exact_file
private

File to document the exact motion of the centre of gravity.

◆ Cog_file

template<class ELEMENT >
ofstream UnstructuredImmersedEllipseProblem< ELEMENT >::Cog_file
private

File to document the motion of the centre of gravity.

◆ Doc_info

template<class ELEMENT >
DocInfo UnstructuredImmersedEllipseProblem< ELEMENT >::Doc_info
private

Internal DocInfo object.

◆ Drag_mesh_pt

template<class ELEMENT >
Vector<Mesh*> UnstructuredImmersedEllipseProblem< ELEMENT >::Drag_mesh_pt
private

Mesh of drag elements.

◆ Fluid_mesh_pt

template<class ELEMENT >
RefineableSolidTriangleMesh<ELEMENT>* UnstructuredImmersedEllipseProblem< ELEMENT >::Fluid_mesh_pt
private

Pointer to Fluid_mesh.

◆ Lagrange_multiplier_mesh_pt

template<class ELEMENT >
SolidMesh* UnstructuredImmersedEllipseProblem< ELEMENT >::Lagrange_multiplier_mesh_pt
private

Pointers to mesh of Lagrange multiplier elements.

◆ Norm_file

template<class ELEMENT >
ofstream UnstructuredImmersedEllipseProblem< ELEMENT >::Norm_file
private

File to document the norm of the solution (for validation purposes)

◆ Outer_boundary_polygon_pt

template<class ELEMENT >
TriangleMeshPolygon* UnstructuredImmersedEllipseProblem< ELEMENT >::Outer_boundary_polygon_pt
private

Triangle mesh polygon for outer boundary.

◆ Rigid_body_mesh_pt

template<class ELEMENT >
Mesh* UnstructuredImmersedEllipseProblem< ELEMENT >::Rigid_body_mesh_pt
private

Mesh of the generalised elements for the rigid bodies.

◆ Rigid_body_pt

template<class ELEMENT >
Vector<GeomObject*> UnstructuredImmersedEllipseProblem< ELEMENT >::Rigid_body_pt
private

Storage for the geom object.


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