oomph::StreamfunctionProblem Class Reference

Polar Streamfunction problem class. More...

#include <streamfunction_include.h>

+ Inheritance diagram for oomph::StreamfunctionProblem:

Public Member Functions

 StreamfunctionProblem (const bool &eigen)
 Constructor: Pass pointer to source function. More...
 
 ~StreamfunctionProblem ()
 Destructor (empty – all the cleanup is done in base class) More...
 
void actions_before_solve ()
 
void actions_after_solve ()
 Update the problem after solve (empty) More...
 
void actions_before_adapt ()
 Before adaptation: More...
 
void actions_after_adapt ()
 After adaptation: Unpin all pressures and then pin redudant pressure dofs. More...
 
streamfunction_mesh * mesh_pt ()
 
void pin_boundaries ()
 Pin boundaries. More...
 
void pin_velocities ()
 Pin velocities. More...
 
void assign_velocities ()
 Assign velocities to nodes. More...
 
void get_vels (const Vector< double > &x_to_get, double &stream)
 Return the value of the streamfunction at given global coordinates. More...
 
void my_output (const int radial, const int azimuthal, bool log_output, string file_name)
 Output the streamfunction on a regular grid. More...
 
void doc_solution (DocInfo &doc_info)
 Doc the solution: doc_info contains labels/output directory etc. More...
 
void header (ofstream &some_file)
 
- 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 ()
 

Protected Attributes

bool eigenfunction
 Storage for whether we're solving for an eigenfunction or not. More...
 
- 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
 

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_convergence_check ()
 
virtual void actions_before_newton_step ()
 
virtual void actions_after_newton_step ()
 
virtual void actions_before_implicit_timestep ()
 
virtual void actions_after_implicit_timestep ()
 
virtual void actions_after_implicit_timestep_and_error_estimation ()
 
virtual void actions_before_explicit_timestep ()
 Actions that should be performed before each explicit time step. More...
 
virtual void actions_after_explicit_timestep ()
 Actions that should be performed after each explicit time step. More...
 
virtual void actions_before_read_unstructured_meshes ()
 
virtual void actions_after_read_unstructured_meshes ()
 
virtual void actions_after_change_in_global_parameter (double *const &parameter_pt)
 
virtual void actions_after_change_in_bifurcation_parameter ()
 
virtual void actions_after_parameter_increase (double *const &parameter_pt)
 
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 ()
 
- Static Protected Attributes inherited from oomph::Problem
static ContinuationStorageScheme Continuation_time_stepper
 Storage for the single static continuation timestorage object. More...
 

Detailed Description

Polar Streamfunction problem class.

2D Streamfunction problem on rectangular domain

Constructor & Destructor Documentation

◆ StreamfunctionProblem()

oomph::StreamfunctionProblem::StreamfunctionProblem ( const bool &  eigen)

Constructor: Pass pointer to source function.

Constructor for Streamfunction problem: Pass pointer to source function.

244 {
245  // Are we solving for an eigenfunction?
246  this->eigenfunction=eigen;
247 
248  // Setup mesh
249 
250  // # of elements in x-direction
253 
254  // Build and assign mesh
255  //Problem::mesh_pt() = new streamfunction_mesh<RefineablePolarStreamfunctionElement>(n_x,n_y);
256  Problem::mesh_pt() = new streamfunction_mesh(n_x,n_y);
257 
258  // Set error estimator
259  Z2ErrorEstimator* error_estimator_pt=new Z2ErrorEstimator;
261 
262  // Pin the relevant boundaries
263  pin_boundaries();
264 
265  // Now loop over all nodes and pin the nodal dofs storing velocities
266  pin_velocities();
267 
268  // Complete the build of all elements so they are fully functional
269 
270  //Find number of fluid elements in mesh
271  unsigned n_fluid = mesh_pt()->fluid_elt_length();
272  for(unsigned i=0;i<n_fluid;i++)
273  {
274  // Upcast from GeneralsedElement to the present element
275  RefineablePolarStreamfunctionElement *el_pt = dynamic_cast<RefineablePolarStreamfunctionElement*>(mesh_pt()->element_pt(i));
276 
277  //Set the pointer to the angle Alpha
278  el_pt->alpha_pt() = &Global_Physical_Variables::Alpha;
279  }
280 
281  //Find number of traction elements in mesh
282 
283  // Setup equation numbering scheme
284  std::cout <<"Number of equations: " << assign_eqn_numbers() << std::endl;
285 
286 } // end of constructor
int i
Definition: BiCGSTAB_step_by_step.cpp:9
GeneralisedElement *& element_pt(const unsigned long &e)
Return pointer to element e.
Definition: mesh.h:448
Mesh *& mesh_pt()
Return a pointer to the global mesh.
Definition: problem.h:1280
unsigned long assign_eqn_numbers(const bool &assign_local_eqn_numbers=true)
Definition: problem.cc:1989
ErrorEstimator *& spatial_error_estimator_pt()
Access to spatial error estimator.
Definition: refineable_mesh.h:143
unsigned fluid_elt_length()
Return length of fluid element vector.
Definition: refineable_r_mesh.h:49
void pin_velocities()
Pin velocities.
Definition: streamfunction_include.h:347
streamfunction_mesh * mesh_pt()
Definition: streamfunction_include.h:207
void pin_boundaries()
Pin boundaries.
Definition: streamfunction_include.h:328
bool eigenfunction
Storage for whether we're solving for an eigenfunction or not.
Definition: streamfunction_include.h:165
int ymesh
Definition: jeffery_hamel.cc:62
int xmesh
Definition: jeffery_hamel.cc:61
double Alpha
Scaling factor for wall thickness (to be used in an exercise)
Definition: unsteady_ring.cc:73
Z2ErrorEstimator * error_estimator_pt
Definition: MortaringCantileverCompareToNonMortaring.cpp:190

References Global_Physical_Variables::Alpha, oomph::PolarStreamfunctionEquations::alpha_pt(), oomph::Problem::assign_eqn_numbers(), eigenfunction, oomph::Mesh::element_pt(), MeshRefinement::error_estimator_pt, oomph::Refineable_r_mesh< ELEMENT >::fluid_elt_length(), i, mesh_pt(), oomph::Problem::mesh_pt(), pin_boundaries(), pin_velocities(), oomph::RefineableMeshBase::spatial_error_estimator_pt(), Global_Physical_Variables::xmesh, and Global_Physical_Variables::ymesh.

◆ ~StreamfunctionProblem()

oomph::StreamfunctionProblem::~StreamfunctionProblem ( )
inline

Destructor (empty – all the cleanup is done in base class)

173 {};

Member Function Documentation

◆ actions_after_adapt()

void oomph::StreamfunctionProblem::actions_after_adapt ( )
inlinevirtual

After adaptation: Unpin all pressures and then pin redudant pressure dofs.

Reimplemented from oomph::Problem.

191  {
192  //Reassign fluid elements to storage
194 
195  //Add traction elements back onto the mesh
198 
199  //Repin the velocities stored at all nodes
200  pin_velocities();
201 
202  //Repin boundaries?
203  //pin_boundaries();
204  }
void make_traction_elements(const bool &outlet)
Definition: streamfunction_include.h:74
void assign_fluid_element_vector()
Definition: streamfunction_include.h:129

References oomph::streamfunction_mesh::assign_fluid_element_vector(), oomph::streamfunction_mesh::make_traction_elements(), mesh_pt(), and pin_velocities().

Referenced by PolarNSProblem< ELEMENT >::output_streamfunction().

◆ actions_after_solve()

void oomph::StreamfunctionProblem::actions_after_solve ( )
inline

Update the problem after solve (empty)

180 {}

◆ actions_before_adapt()

void oomph::StreamfunctionProblem::actions_before_adapt ( )
inlinevirtual

Before adaptation:

Reimplemented from oomph::Problem.

184  {
185  // Strip traction elements from mesh before refine
187  }
void remove_traction_elements()
Definition: streamfunction_include.h:106

References mesh_pt(), and oomph::streamfunction_mesh::remove_traction_elements().

Referenced by PolarNSProblem< ELEMENT >::output_streamfunction().

◆ actions_before_solve()

void oomph::StreamfunctionProblem::actions_before_solve ( )

Update the problem specs before solve: Reset boundary conditions to the values from the exact solution.

Update the problem specs before solve: (Re-)set boundary conditions to the values from the exact solution.

293 {
294  // How many boundaries are there?
295  unsigned n_bound = mesh_pt()->nboundary();
296 
297  //Loop over the side boundaries
298  for(unsigned i=0;i<n_bound;i+=2)
299  {
300  // How many nodes are there on this boundary?
301  unsigned n_node = mesh_pt()->nboundary_node(i);
302 
303  // Loop over the nodes on boundary
304  for (unsigned n=0;n<n_node;n++)
305  {
306  // Get pointer to node
307  Node* nod_pt=mesh_pt()->boundary_node_pt(i,n);
308 
309  // Extract nodal coordinates from node:
310  Vector<double> x(2);
311  x[0]=nod_pt->x(0);
312  x[1]=nod_pt->x(1);
313 
314  double stream = 0.5*x[1];
315  // Zero boundary conditions for eigenproblem
316  if(this->eigenfunction) stream=0.0;
317 
318  // Assign values to the first nodal value
319  nod_pt->set_value(0,stream);
320 
321  }
322  }
323 } // end of actions before solve
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
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
Node *& boundary_node_pt(const unsigned &b, const unsigned &n)
Return pointer to node n on boundary b.
Definition: mesh.h:493
list x
Definition: plotDoE.py:28

References oomph::Mesh::boundary_node_pt(), eigenfunction, i, mesh_pt(), n, oomph::Mesh::nboundary(), oomph::Mesh::nboundary_node(), oomph::Data::set_value(), plotDoE::x, and oomph::Node::x().

◆ assign_velocities()

void oomph::StreamfunctionProblem::assign_velocities ( )

Assign velocities to nodes.

363 {
364  // Loop over all nodes and asign values for velocites
365  unsigned num_nod = mesh_pt()->nnode();
366  for(unsigned i=0;i<num_nod;i++)
367  {
368  // Extract nodal coordinates from node:
369  Vector<double> x(2);
370  x[0]=mesh_pt()->node_pt(i)->x(0);
371  x[1]=mesh_pt()->node_pt(i)->x(1);
372 
373  //double A = Global_Physical_Variables::Alpha;
374 
375  //double u=(x[0]/A)*cos(x[1])-(1./(4.*A));
376  //double v=-2.*x[0]*sin(x[1])+0.25*x[1];
377  //A=0.0;
378  double u=0.0;double v=0.0;
379 
380  mesh_pt()->node_pt(i)->set_value(1,u);
381  mesh_pt()->node_pt(i)->set_value(2,v);
382  }
383 
384 } // end of assign_velocities
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
void set_value(const unsigned &i, const double &value_)
Definition: nodes.h:271
unsigned long nnode() const
Return number of nodes in the mesh.
Definition: mesh.h:596
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
Definition: mesh.h:436
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060

References i, mesh_pt(), oomph::Mesh::nnode(), oomph::Mesh::node_pt(), oomph::Data::set_value(), v, plotDoE::x, and oomph::Node::x().

◆ doc_solution()

void oomph::StreamfunctionProblem::doc_solution ( DocInfo &  doc_info)

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

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

571 {
572  ofstream some_file;
573  char filename[100];
574 
575  // Number of plot points: npts x npts
576  unsigned npts=3;
577 
578  // Output solution
579  //-----------------
580  sprintf(filename,"%s/streamfunction%i.dat",doc_info.directory().c_str(),
581  doc_info.number());
582  some_file.open(filename);
583  header(some_file);
584  mesh_pt()->output(some_file,npts);
585  some_file.close();
586 
587 } // end of doc
void output(std::ostream &outfile)
Output for all elements.
Definition: mesh.cc:2027
void header(ofstream &some_file)
Definition: streamfunction_include.h:589
string filename
Definition: MergeRestartFiles.py:39

References oomph::DocInfo::directory(), MergeRestartFiles::filename, header(), mesh_pt(), oomph::DocInfo::number(), and oomph::Mesh::output().

Referenced by PolarNSProblem< ELEMENT >::output_streamfunction().

◆ get_vels()

void oomph::StreamfunctionProblem::get_vels ( const Vector< double > &  x_to_get,
double &  stream 
)

Return the value of the streamfunction at given global coordinates.

392 {
393  // local coord
394  Vector<double> s( 2, 0.0 );
395  // global coords
396  Vector<double> x_lower_left( 2, 0.0 );
397  Vector<double> x_centre( 2, 0.0 );
398  Vector<double> x_upper_right( 2, 0.0 );
399  Vector<double> x( 2, 0.0 );
400  double a,b,c,sub;
401  //Reset interpolated velocity - check they're being set at some point
402  stream=-2.;
403 
404  // Loop over all the (fluid) elements
405  unsigned long n_element = mesh_pt() -> nelement();
406  for ( unsigned long e = 0; e < n_element; e++ )
407  {
408  // Cast to the particular element type, this is necessary because
409  // the base elements don't have the member functions that we're about
410  // to call!
411  RefineablePolarStreamfunctionElement* elt_pt = dynamic_cast<RefineablePolarStreamfunctionElement*>( mesh_pt() -> element_pt(e) );
412 
413  s[0] = -1.0; s[1] = -1.0;
414  elt_pt -> get_x( s, x_lower_left );
415 
416  s[0] = 1.0; s[1] = 1.0;
417  elt_pt -> get_x( s, x_upper_right );
418 
419  // check the elts lower left corner is SW of point to return
420  if ( ( x_lower_left[0] <= x_to_get[0] )
421  && ( x_lower_left[1] <= x_to_get[1] ) )
422  {
423  // check the elts upper right corner is NE of point to return
424  if ( ( x_upper_right[0] > x_to_get[0] )
425  && ( x_upper_right[1] > x_to_get[1] ) )
426  {
427  //Quadratic interpolation:
428  a=x_lower_left[0];
429  s[0] = 0.0; s[1] = 0.0;
430  elt_pt -> get_x( s, x_centre );
431  b=x_centre[0];
432  c=x_upper_right[0];
433  sub=pow(c-a,2.0)-8.0*(a+c-2.0*b)*(b-x_to_get[0]);
434 
435  if(abs(a+c-2.*b)<1.e-8)s[0] = -1.0 + 2.*( x_to_get[0] - x_lower_left[0] )
436  / ( x_upper_right[0] - x_lower_left[0] );
437  else s[0]=((a-c)+sqrt(sub))/(2.0*(a+c-2.0*b));
438 
439  // our point to get is in the current elt
440  // now work out the local coordinate
441  // This only works for evenly spaced global
442  // coordinates across the element - Not true
443  // in radial direction.
444  s[1] = -1.0 + 2.*( x_to_get[1] - x_lower_left[1] )
445  / ( x_upper_right[1] - x_lower_left[1] );
446 
447  // check on my quadratic interpolation
448  elt_pt -> get_x( s, x );
449 
450  if(abs(x[0]-x_to_get[0])>1.e-12)
451  {
452  if(abs(a+c-2.*b)<1.e-8) std::cout << "Element almost linear: " << abs(a+c-2.*b) << std::endl;
453  std::cout << "error in interpolation: " << (x[0]-x_to_get[0]) << std::endl;
454  std::cout << "r:" << x[0] << "r to get: " << x_to_get[0] << std::endl;
455  }
456 
457  // get the position of this
458  elt_pt -> get_x( s, x );
459  stream = elt_pt -> interpolated_streamfunction( s );
460 
461  break;
462  }
463  }
464  //return vels;
465  }
466 }
AnnoyingScalar abs(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:135
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Scalar * b
Definition: benchVecAdd.cpp:17
RealScalar s
Definition: level1_cplx_impl.h:130
const Scalar * a
Definition: level2_cplx_impl.h:32
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 pow(const bfloat16 &a, const bfloat16 &b)
Definition: BFloat16.h:625
int c
Definition: calibrate.py:100
EIGEN_DONT_INLINE T sub(T a, T b)
Definition: svd_common.h:238

References a, abs(), b, calibrate::c, e(), mesh_pt(), Eigen::bfloat16_impl::pow(), s, sqrt(), sub(), and plotDoE::x.

Referenced by my_output().

◆ header()

void oomph::StreamfunctionProblem::header ( ofstream &  some_file)
590  {
591  some_file << "# Refineable streamfunction mesh" << "\n";
592  some_file << "# Re = " << Global_Physical_Variables::Re << " Alpha = " << Global_Physical_Variables::Alpha
593  << " R_l = " << Global_Physical_Variables::R_l << "\n";
594  some_file << "# Initial xmesh = " << Global_Physical_Variables::xmesh
595  << " Initial ymesh = " << Global_Physical_Variables::ymesh << "\n";
596  some_file << "# Uniform refinements: " << Global_Physical_Variables::uniform
597  << " Adaptive refinements: " << Global_Physical_Variables::adaptive << "\n";
598  some_file << "# inlet_traction = " << Global_Physical_Variables::inlet_traction
599  << " eta_inlet = " << Global_Physical_Variables::eta_inlet << "\n";
600  some_file << "# outlet_traction = " << Global_Physical_Variables::outlet_traction
601  << " eta_outlet = " << Global_Physical_Variables::eta_outlet << "\n";
602  some_file << "# log_mesh = " << Global_Physical_Variables::log_mesh
603  << " new_outlet_region = " << Global_Physical_Variables::new_outlet_region << "\n";
604  some_file << "# pinv = " << Global_Physical_Variables::pinv << "\n";
605  some_file << "\n";
606  }
int adaptive
Definition: jeffery_hamel.cc:106
bool pinv
Definition: jeffery_hamel.cc:86
bool new_outlet_region
Definition: jeffery_hamel.cc:93
bool outlet_traction
Definition: jeffery_hamel.cc:82
bool log_mesh
Definition: jeffery_hamel.cc:92
int uniform
Definition: jeffery_hamel.cc:106
double R_l
Definition: jeffery_hamel.cc:57
double eta_inlet
Definition: jeffery_hamel.cc:80
bool inlet_traction
Definition: jeffery_hamel.cc:79
double eta_outlet
Definition: jeffery_hamel.cc:83
double Re
Hydrodynamic Parameters.
Definition: refineable_two_layer_soluble_surfactant.cc:106

References Global_Physical_Variables::adaptive, Global_Physical_Variables::Alpha, Global_Physical_Variables::eta_inlet, Global_Physical_Variables::eta_outlet, Global_Physical_Variables::inlet_traction, Global_Physical_Variables::log_mesh, Global_Physical_Variables::new_outlet_region, Global_Physical_Variables::outlet_traction, Global_Physical_Variables::pinv, Global_Physical_Variables::R_l, oomph::Global_Physical_Variables::Re, Global_Physical_Variables::uniform, Global_Physical_Variables::xmesh, and Global_Physical_Variables::ymesh.

Referenced by doc_solution().

◆ mesh_pt()

streamfunction_mesh* oomph::StreamfunctionProblem::mesh_pt ( )
inline
208  {
209  // Upcast from pointer to the Mesh base class to the specific
210  // element type that we're using here.
211  return dynamic_cast<streamfunction_mesh* >(Problem::mesh_pt());
212  }

References oomph::Problem::mesh_pt().

Referenced by actions_after_adapt(), actions_before_adapt(), actions_before_solve(), assign_velocities(), doc_solution(), get_vels(), PolarNSProblem< ELEMENT >::output_streamfunction(), pin_boundaries(), pin_velocities(), and StreamfunctionProblem().

◆ my_output()

void oomph::StreamfunctionProblem::my_output ( const int  radial,
const int  azimuthal,
bool  log_output,
string  file_name 
)

Output the streamfunction on a regular grid.

473 {
474  // Quick adjustment so that I don't ever end up exactly on a boundary
475  // (get_vels fails on certain boundaries)
476  // (current difference between x_to_get and x_upper_right around 7.e-15 so
477  // 1.e-13 should be fine...)
478  double inner=Global_Physical_Variables::R_l+1.e-13;
479  double outer=Global_Physical_Variables::R_r-1.e-13;
480  // And the same for azimuthal direction
481  double left=-1.+1.e-13;
482  double right=1.-1.e-13;
483 
484  // Set up common ratio for log spaced output
485  double R = pow((outer/inner),(1.0/(radial - 1.0)));
486 
487  // New output file
488  ofstream out;
489  out.open(file_name.c_str());
490 
491  out << "# Streamfunction output at " << radial << " radial and " << azimuthal << " azimuthal points" << std::endl;
492  out << "# Re = " << Global_Physical_Variables::Re << " Alpha = " << Global_Physical_Variables::Alpha
493  << " R_l = " << Global_Physical_Variables::R_l << std::endl;
494  out << "# Initial xmesh: " << Global_Physical_Variables::xmesh << " Initial ymesh " << Global_Physical_Variables::ymesh << std::endl;
495  out << "# Uniform refinements: " << Global_Physical_Variables::uniform << " Adaptive refinements: " << Global_Physical_Variables::adaptive << std::endl;
496  out << "# log_mesh = " << Global_Physical_Variables::log_mesh << " new_outlet_region = " << Global_Physical_Variables::new_outlet_region << std::endl;
497  out << "# Inlet traction: " << Global_Physical_Variables::inlet_traction << " Outlet traction: " << Global_Physical_Variables::outlet_traction << std::endl;
498  out << "# eta_inlet: " << Global_Physical_Variables::eta_inlet << " eta_outlet: " << Global_Physical_Variables::eta_outlet << std::endl;
499  out << "# Pin v at inlet: " << Global_Physical_Variables::pinv << std::endl;
500  out << std::endl;
501 
502  std::cout << endl;
503  std::cout << "Outputting streamfunction to file " << file_name << " at " << radial
504  << " radial plot points and " << azimuthal << " azimuthal points." << std::endl;
505  std::cout << std::endl;
506 
507  //Position of elements
508  Vector<double> position(2,0.0);
509  double stream=0.0;
510 
511  //Loops now radial inside azimuthal to agree with my poisson solver
512  if(log_output)
513  {
514  for(int i=0;i<radial;i++)
515  {
516  // Update radial position
517  position[0]=inner*pow(R,i);
518 
519  for(int j=0;j<azimuthal;j++)
520  {
521  // Update azimuthal position
522  position[1]=left + ((right-left)*j)/(azimuthal-1.0);
523 
524  // Read off the velocity at this point
525  get_vels(position,stream);
526 
527  // Output to file
528  out << position[0] << " " << position[1] << " " << stream << std::endl;
529 
530  } // End of loop over azimuthal
531 
532  out << std::endl;
533 
534  } // End of loop over radial
535 
536  } // End of log spaced output loop
537  else
538  {
539  for(int i=0;i<radial;i++)
540  {
541  // Update radial position
542  position[0]=inner + ((outer-inner)*i)/(radial-1.0);
543 
544  for(int j=0;j<azimuthal;j++)
545  {
546  // Update azimthual position
547  position[1]=left + ((right-left)*j)/(azimuthal-1.0);
548 
549  // Read off the velocity at this point
550  get_vels(position,stream);
551 
552  // Output to file
553  out << position[0] << " " << position[1] << " " << stream << std::endl;
554 
555  } // End of loop over azimuthal
556 
557  out << std::endl;
558 
559  } // End of loop over radial
560 
561  } // End of regular spaced output loop
562 
563  out.close();
564 
565 }
@ R
Definition: StatisticsVector.h:21
void get_vels(const Vector< double > &x_to_get, double &stream)
Return the value of the streamfunction at given global coordinates.
Definition: streamfunction_include.h:391
double R_r
Definition: jeffery_hamel.cc:58
string file_name
Definition: Particles2023AnalysisHung.py:321
std::ofstream out("Result.txt")
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References Global_Physical_Variables::adaptive, Global_Physical_Variables::Alpha, Global_Physical_Variables::eta_inlet, Global_Physical_Variables::eta_outlet, Particles2023AnalysisHung::file_name, get_vels(), i, Global_Physical_Variables::inlet_traction, j, Global_Physical_Variables::log_mesh, Global_Physical_Variables::new_outlet_region, out(), Global_Physical_Variables::outlet_traction, Global_Physical_Variables::pinv, Eigen::bfloat16_impl::pow(), R, Global_Physical_Variables::R_l, Global_Physical_Variables::R_r, oomph::Global_Physical_Variables::Re, Global_Physical_Variables::uniform, Global_Physical_Variables::xmesh, and Global_Physical_Variables::ymesh.

Referenced by PolarNSProblem< ELEMENT >::output_streamfunction().

◆ pin_boundaries()

void oomph::StreamfunctionProblem::pin_boundaries ( )

Pin boundaries.

pin boundaries

329 {
330  unsigned n_bound = mesh_pt()->nboundary();
331  //for(unsigned i=0;i<n_bound;i++)
332  for(unsigned i=0;i<n_bound;i+=2)
333  {
334  unsigned n_node = mesh_pt()->nboundary_node(i);
335  for (unsigned n=0;n<n_node;n++)
336  {
337  //Pin both streamfunction and vorcitity at boundaries
338  mesh_pt()->boundary_node_pt(i,n)->pin(0);
339  }
340  }
341 
342 } // end of pin_boundaries
void pin(const unsigned &i)
Pin the i-th stored variable.
Definition: nodes.h:385

References oomph::Mesh::boundary_node_pt(), i, mesh_pt(), n, oomph::Mesh::nboundary(), oomph::Mesh::nboundary_node(), and oomph::Data::pin().

Referenced by StreamfunctionProblem().

◆ pin_velocities()

void oomph::StreamfunctionProblem::pin_velocities ( )

Pin velocities.

pin velocities at all nodes

348 {
349  // Loop over all nodes and asign values for velocites
350  unsigned num_nod = mesh_pt()->nnode();
351  for(unsigned i=0;i<num_nod;i++)
352  {
353  mesh_pt()->node_pt(i)->pin(1);
354  mesh_pt()->node_pt(i)->pin(2);
355  }
356 
357 } // end of pin_velocities

References i, mesh_pt(), oomph::Mesh::nnode(), oomph::Mesh::node_pt(), and oomph::Data::pin().

Referenced by actions_after_adapt(), and StreamfunctionProblem().

Member Data Documentation

◆ eigenfunction

bool oomph::StreamfunctionProblem::eigenfunction
protected

Storage for whether we're solving for an eigenfunction or not.

Referenced by actions_before_solve(), and StreamfunctionProblem().


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