SolidProblem< ELEMENT_TYPE > Class Template Reference

#include <SolidProblem.h>

+ Inheritance diagram for SolidProblem< ELEMENT_TYPE >:

Public Types

enum  Boundary : unsigned {
  Z_MIN = 0 , Y_MIN = 1 , X_MAX = 2 , Y_MAX = 3 ,
  X_MIN = 4 , Z_MAX = 5
}
 
- 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 Member Functions

 SolidProblem ()
 Constructor: set default constitutive law and time stepper. More...
 
void setName (const std::string &name)
 set function for name_ More...
 
std::string getName () const
 get function for name_ More...
 
void setElasticModulus (double elasticModulus)
 set function for elasticModulus_ More...
 
double getElasticModulus () const
 get function for elasticModulus_ More...
 
void addDissipation (double dissipation)
 
void setupRefinementParameters (const double &min_error_target, const double &max_error_target, Z2ErrorEstimator *&error_estimator_pt)
 
void addAnisotropy (double Ex, double Ey, double Ez)
 
void setOomphGravity (double gravity)
 set function for elasticModulus_ More...
 
double getOomphGravity () const
 get function for gravity_ More...
 
void setPoissonRatio (double poissonRatio)
 set function for poissonRatio_ More...
 
double getPoissonRatio () const
 get function for poissonRatio_ More...
 
void setDensity (double density)
 set function for density_ More...
 
double getDensity () const
 get function for density_ More...
 
void setBodyForceAsGravity (double gravity=9.8)
 set function for body_force_pt More...
 
void setIsPinned (std::function< bool(SolidNode *, unsigned)> isPinned)
 set function for isPinned_ More...
 
void pinBoundary (unsigned b)
 
void pinBoundaries (std::vector< unsigned > b)
 
std::enable_if< std::is_base_of< RefineableQDPVDElement< 3, 2 >, ELEMENT >::value, void > setDissipation (double dissipation)
 Sets the dissipation coefficient for all elements. More...
 
void setNewtonSolverTolerance (double Newton_solver_tolerance)
 set function for Newton_solver_tolerance More...
 
void setMaxNewtonIterations (unsigned Max_newton_iterations)
 set function for Max_newton_iterations More...
 
void setOomphTimeStep (double dt)
 set function for time step More...
 
double getOomphTimeStep () const
 get function for time step More...
 
double getOomphTime () const
 get function for current time More...
 
SolidMesh *& solid_mesh_pt ()
 Get function for the solid mesh pointer. More...
 
SolidMesh *& traction_mesh_pt ()
 Get function for the traction mesh pointer. More...
 
SolidMesh *const & solid_mesh_pt () const
 Get function for the solid mesh pointer. More...
 
SolidMesh *const & traction_mesh_pt () const
 Get function for the traction mesh pointer. More...
 
void getDomainSize (std::array< double, 3 > &min, std::array< double, 3 > &max) const
 Computes the domain size (min/max of the nodal positions in x/y/z) More...
 
void prepareForSolve ()
 
void countPinned ()
 returns statistics about pinned nodes to the console More...
 
void solveSteady (const unsigned &max_adapt=0)
 
virtual void actionsBeforeSolve ()
 
virtual void actionsAfterSolve ()
 
virtual void actionsBeforeOomphTimeStep ()
 
void solveUnsteady (double timeMax, double dt, unsigned saveCount=10, const unsigned &max_adapt=0)
 
void solveUnsteadyForgiving (double timeMax, double timeMaxMin, double dt, unsigned saveCount=10)
 
void removeOldFiles () const
 
void get_x (const Vector< double > &xi, Vector< double > &x) const
 
double getDeflection (Vector< double > xi, unsigned d) const
 
void setSolidCubicMesh (const unsigned &nx, const unsigned &ny, const unsigned &nz, const double &xMin, const double &xMax, const double &yMin, const double &yMax, const double &zMin, const double &zMax)
 
void saveSolidMesh ()
 
void loadSolidMesh (std::string infileName, bool cubic=true)
 
void writeToVTK ()
 
void getMassMomentumEnergy (double &mass, Vector< double > &com, Vector< double > &linearMomentum, Vector< double > &angularMomentum, double &elasticEnergy, double &kineticEnergy) const
 See PVDEquationsBase<DIM>::get_energy. More...
 
- Public Member Functions inherited from oomph::Problem
virtual void debug_hook_fct (const unsigned &i)
 
void set_analytic_dparameter (double *const &parameter_pt)
 
void unset_analytic_dparameter (double *const &parameter_pt)
 
bool is_dparameter_calculated_analytically (double *const &parameter_pt)
 
void set_analytic_hessian_products ()
 
void unset_analytic_hessian_products ()
 
bool are_hessian_products_calculated_analytically ()
 
void set_pinned_values_to_zero ()
 
bool distributed () const
 
virtual void actions_before_adapt ()
 
virtual void actions_after_adapt ()
 Actions that are to be performed after a mesh adaptation. More...
 
OomphCommunicatorcommunicator_pt ()
 access function to the oomph-lib communicator More...
 
const OomphCommunicatorcommunicator_pt () const
 access function to the oomph-lib communicator, const version More...
 
 Problem ()
 
 Problem (const Problem &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const Problem &)=delete
 Broken assignment operator. More...
 
virtual ~Problem ()
 Virtual destructor to clean up memory. More...
 
Mesh *& mesh_pt ()
 Return a pointer to the global mesh. More...
 
Mesh *const & mesh_pt () const
 Return a pointer to the global mesh (const version) More...
 
Mesh *& mesh_pt (const unsigned &imesh)
 
Mesh *const & mesh_pt (const unsigned &imesh) const
 Return a pointer to the i-th submesh (const version) More...
 
unsigned nsub_mesh () const
 Return number of submeshes. More...
 
unsigned add_sub_mesh (Mesh *const &mesh_pt)
 
void flush_sub_meshes ()
 
void build_global_mesh ()
 
void rebuild_global_mesh ()
 
LinearSolver *& linear_solver_pt ()
 Return a pointer to the linear solver object. More...
 
LinearSolver *const & linear_solver_pt () const
 Return a pointer to the linear solver object (const version) More...
 
LinearSolver *& mass_matrix_solver_for_explicit_timestepper_pt ()
 
LinearSolvermass_matrix_solver_for_explicit_timestepper_pt () const
 
EigenSolver *& eigen_solver_pt ()
 Return a pointer to the eigen solver object. More...
 
EigenSolver *const & eigen_solver_pt () const
 Return a pointer to the eigen solver object (const version) More...
 
Time *& time_pt ()
 Return a pointer to the global time object. More...
 
Timetime_pt () const
 Return a pointer to the global time object (const version). More...
 
doubletime ()
 Return the current value of continuous time. More...
 
double time () const
 Return the current value of continuous time (const version) More...
 
TimeStepper *& time_stepper_pt ()
 
const TimeSteppertime_stepper_pt () const
 
TimeStepper *& time_stepper_pt (const unsigned &i)
 Return a pointer to the i-th timestepper. More...
 
ExplicitTimeStepper *& explicit_time_stepper_pt ()
 Return a pointer to the explicit timestepper. More...
 
unsigned long set_timestepper_for_all_data (TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data=false)
 
virtual void shift_time_values ()
 Shift all values along to prepare for next timestep. More...
 
AssemblyHandler *& assembly_handler_pt ()
 Return a pointer to the assembly handler object. More...
 
AssemblyHandler *const & assembly_handler_pt () const
 Return a pointer to the assembly handler object (const version) More...
 
doubleminimum_dt ()
 Access function to min timestep in adaptive timestepping. More...
 
doublemaximum_dt ()
 Access function to max timestep in adaptive timestepping. More...
 
unsignedmax_newton_iterations ()
 Access function to max Newton iterations before giving up. More...
 
void problem_is_nonlinear (const bool &prob_lin)
 Access function to Problem_is_nonlinear. More...
 
doublemax_residuals ()
 
booltime_adaptive_newton_crash_on_solve_fail ()
 Access function for Time_adaptive_newton_crash_on_solve_fail. More...
 
doublenewton_solver_tolerance ()
 
void add_time_stepper_pt (TimeStepper *const &time_stepper_pt)
 
void set_explicit_time_stepper_pt (ExplicitTimeStepper *const &explicit_time_stepper_pt)
 
void initialise_dt (const double &dt)
 
void initialise_dt (const Vector< double > &dt)
 
Data *& global_data_pt (const unsigned &i)
 Return a pointer to the the i-th global data object. More...
 
void add_global_data (Data *const &global_data_pt)
 
void flush_global_data ()
 
LinearAlgebraDistribution *const & dof_distribution_pt () const
 Return the pointer to the dof distribution (read-only) More...
 
unsigned long ndof () const
 Return the number of dofs. More...
 
unsigned ntime_stepper () const
 Return the number of time steppers. More...
 
unsigned nglobal_data () const
 Return the number of global data values. More...
 
unsigned self_test ()
 Self-test: Check meshes and global data. Return 0 for OK. More...
 
void enable_store_local_dof_pt_in_elements ()
 
void disable_store_local_dof_pt_in_elements ()
 
unsigned long assign_eqn_numbers (const bool &assign_local_eqn_numbers=true)
 
void describe_dofs (std::ostream &out= *(oomph_info.stream_pt())) const
 
void enable_discontinuous_formulation ()
 
void disable_discontinuous_formulation ()
 
void get_dofs (DoubleVector &dofs) const
 
void get_dofs (const unsigned &t, DoubleVector &dofs) const
 Return vector of the t'th history value of all dofs. More...
 
void set_dofs (const DoubleVector &dofs)
 Set the values of the dofs. More...
 
void set_dofs (const unsigned &t, DoubleVector &dofs)
 Set the history values of the dofs. More...
 
void set_dofs (const unsigned &t, Vector< double * > &dof_pt)
 
void add_to_dofs (const double &lambda, const DoubleVector &increment_dofs)
 Add lambda x incremenet_dofs[l] to the l-th dof. More...
 
doubleglobal_dof_pt (const unsigned &i)
 
doubledof (const unsigned &i)
 i-th dof in the problem More...
 
double dof (const unsigned &i) const
 i-th dof in the problem (const version) More...
 
double *& dof_pt (const unsigned &i)
 Pointer to i-th dof in the problem. More...
 
doubledof_pt (const unsigned &i) const
 Pointer to i-th dof in the problem (const version) More...
 
virtual void get_inverse_mass_matrix_times_residuals (DoubleVector &Mres)
 
virtual void get_dvaluesdt (DoubleVector &f)
 
virtual void get_residuals (DoubleVector &residuals)
 Get the total residuals Vector for the problem. More...
 
virtual void get_jacobian (DoubleVector &residuals, DenseDoubleMatrix &jacobian)
 
virtual void get_jacobian (DoubleVector &residuals, CRDoubleMatrix &jacobian)
 
virtual void get_jacobian (DoubleVector &residuals, CCDoubleMatrix &jacobian)
 
virtual void get_jacobian (DoubleVector &residuals, SumOfMatrices &jacobian)
 
void get_fd_jacobian (DoubleVector &residuals, DenseMatrix< double > &jacobian)
 Get the full Jacobian by finite differencing. More...
 
void get_derivative_wrt_global_parameter (double *const &parameter_pt, DoubleVector &result)
 
void get_hessian_vector_products (DoubleVectorWithHaloEntries const &Y, Vector< DoubleVectorWithHaloEntries > const &C, Vector< DoubleVectorWithHaloEntries > &product)
 
void solve_eigenproblem (const unsigned &n_eval, Vector< std::complex< double >> &eigenvalue, Vector< DoubleVector > &eigenvector, const bool &steady=true)
 Solve the eigenproblem. More...
 
void solve_eigenproblem (const unsigned &n_eval, Vector< std::complex< double >> &eigenvalue, const bool &steady=true)
 
virtual void get_eigenproblem_matrices (CRDoubleMatrix &mass_matrix, CRDoubleMatrix &main_matrix, const double &shift=0.0)
 
void assign_eigenvector_to_dofs (DoubleVector &eigenvector)
 Assign the eigenvector passed to the function to the dofs. More...
 
void add_eigenvector_to_dofs (const double &epsilon, const DoubleVector &eigenvector)
 
void store_current_dof_values ()
 Store the current values of the degrees of freedom. More...
 
void restore_dof_values ()
 Restore the stored values of the degrees of freedom. More...
 
void enable_jacobian_reuse ()
 
void disable_jacobian_reuse ()
 Disable recycling of Jacobian in Newton iteration. More...
 
bool jacobian_reuse_is_enabled ()
 Is recycling of Jacobian in Newton iteration enabled? More...
 
booluse_predictor_values_as_initial_guess ()
 
void newton_solve ()
 Use Newton method to solve the problem. More...
 
void enable_globally_convergent_newton_method ()
 enable globally convergent Newton method More...
 
void disable_globally_convergent_newton_method ()
 disable globally convergent Newton method More...
 
void newton_solve (unsigned const &max_adapt)
 
void steady_newton_solve (unsigned const &max_adapt=0)
 
void copy (Problem *orig_problem_pt)
 
virtual Problemmake_copy ()
 
virtual void read (std::ifstream &restart_file, bool &unsteady_restart)
 
virtual void read (std::ifstream &restart_file)
 
virtual void dump (std::ofstream &dump_file) const
 
void dump (const std::string &dump_file_name) const
 
void delete_all_external_storage ()
 
virtual void symmetrise_eigenfunction_for_adaptive_pitchfork_tracking ()
 
doublebifurcation_parameter_pt () const
 
void get_bifurcation_eigenfunction (Vector< DoubleVector > &eigenfunction)
 
void activate_fold_tracking (double *const &parameter_pt, const bool &block_solve=true)
 
void activate_bifurcation_tracking (double *const &parameter_pt, const DoubleVector &eigenvector, const bool &block_solve=true)
 
void activate_bifurcation_tracking (double *const &parameter_pt, const DoubleVector &eigenvector, const DoubleVector &normalisation, const bool &block_solve=true)
 
void activate_pitchfork_tracking (double *const &parameter_pt, const DoubleVector &symmetry_vector, const bool &block_solve=true)
 
void activate_hopf_tracking (double *const &parameter_pt, const bool &block_solve=true)
 
void activate_hopf_tracking (double *const &parameter_pt, const double &omega, const DoubleVector &null_real, const DoubleVector &null_imag, const bool &block_solve=true)
 
void deactivate_bifurcation_tracking ()
 
void reset_assembly_handler_to_default ()
 Reset the system to the standard non-augemented state. More...
 
double arc_length_step_solve (double *const &parameter_pt, const double &ds, const unsigned &max_adapt=0)
 
double arc_length_step_solve (Data *const &data_pt, const unsigned &data_index, const double &ds, const unsigned &max_adapt=0)
 
void reset_arc_length_parameters ()
 
intsign_of_jacobian ()
 
void explicit_timestep (const double &dt, const bool &shift_values=true)
 Take an explicit timestep of size dt. More...
 
void unsteady_newton_solve (const double &dt)
 
void unsteady_newton_solve (const double &dt, const bool &shift_values)
 
void unsteady_newton_solve (const double &dt, const unsigned &max_adapt, const bool &first, const bool &shift=true)
 
double doubly_adaptive_unsteady_newton_solve (const double &dt, const double &epsilon, const unsigned &max_adapt, const bool &first, const bool &shift=true)
 
double doubly_adaptive_unsteady_newton_solve (const double &dt, const double &epsilon, const unsigned &max_adapt, const unsigned &suppress_resolve_after_spatial_adapt_flag, const bool &first, const bool &shift=true)
 
double adaptive_unsteady_newton_solve (const double &dt_desired, const double &epsilon)
 
double adaptive_unsteady_newton_solve (const double &dt_desired, const double &epsilon, const bool &shift_values)
 
void assign_initial_values_impulsive ()
 
void assign_initial_values_impulsive (const double &dt)
 
void calculate_predictions ()
 Calculate predictions. More...
 
void enable_mass_matrix_reuse ()
 
void disable_mass_matrix_reuse ()
 
bool mass_matrix_reuse_is_enabled ()
 Return whether the mass matrix is being reused. More...
 
void refine_uniformly (const Vector< unsigned > &nrefine_for_mesh)
 
void refine_uniformly (const Vector< unsigned > &nrefine_for_mesh, DocInfo &doc_info)
 
void refine_uniformly_and_prune (const Vector< unsigned > &nrefine_for_mesh)
 
void refine_uniformly_and_prune (const Vector< unsigned > &nrefine_for_mesh, DocInfo &doc_info)
 
void refine_uniformly (DocInfo &doc_info)
 
void refine_uniformly_and_prune (DocInfo &doc_info)
 
void refine_uniformly ()
 
void refine_uniformly (const unsigned &i_mesh, DocInfo &doc_info)
 Do uniform refinement for submesh i_mesh with documentation. More...
 
void refine_uniformly (const unsigned &i_mesh)
 Do uniform refinement for submesh i_mesh without documentation. More...
 
void p_refine_uniformly (const Vector< unsigned > &nrefine_for_mesh)
 
void p_refine_uniformly (const Vector< unsigned > &nrefine_for_mesh, DocInfo &doc_info)
 
void p_refine_uniformly_and_prune (const Vector< unsigned > &nrefine_for_mesh)
 
void p_refine_uniformly_and_prune (const Vector< unsigned > &nrefine_for_mesh, DocInfo &doc_info)
 
void p_refine_uniformly (DocInfo &doc_info)
 
void p_refine_uniformly_and_prune (DocInfo &doc_info)
 
void p_refine_uniformly ()
 
void p_refine_uniformly (const unsigned &i_mesh, DocInfo &doc_info)
 Do uniform p-refinement for submesh i_mesh with documentation. More...
 
void p_refine_uniformly (const unsigned &i_mesh)
 Do uniform p-refinement for submesh i_mesh without documentation. More...
 
void refine_selected_elements (const Vector< unsigned > &elements_to_be_refined)
 
void refine_selected_elements (const Vector< RefineableElement * > &elements_to_be_refined_pt)
 
void refine_selected_elements (const unsigned &i_mesh, const Vector< unsigned > &elements_to_be_refined)
 
void refine_selected_elements (const unsigned &i_mesh, const Vector< RefineableElement * > &elements_to_be_refined_pt)
 
void refine_selected_elements (const Vector< Vector< unsigned >> &elements_to_be_refined)
 
void refine_selected_elements (const Vector< Vector< RefineableElement * >> &elements_to_be_refined_pt)
 
void p_refine_selected_elements (const Vector< unsigned > &elements_to_be_refined)
 
void p_refine_selected_elements (const Vector< PRefineableElement * > &elements_to_be_refined_pt)
 
void p_refine_selected_elements (const unsigned &i_mesh, const Vector< unsigned > &elements_to_be_refined)
 
void p_refine_selected_elements (const unsigned &i_mesh, const Vector< PRefineableElement * > &elements_to_be_refined_pt)
 
void p_refine_selected_elements (const Vector< Vector< unsigned >> &elements_to_be_refined)
 
void p_refine_selected_elements (const Vector< Vector< PRefineableElement * >> &elements_to_be_refined_pt)
 
unsigned unrefine_uniformly ()
 
unsigned unrefine_uniformly (const unsigned &i_mesh)
 
void p_unrefine_uniformly (DocInfo &doc_info)
 
void p_unrefine_uniformly (const unsigned &i_mesh, DocInfo &doc_info)
 Do uniform p-unrefinement for submesh i_mesh without documentation. More...
 
void adapt (unsigned &n_refined, unsigned &n_unrefined)
 
void adapt ()
 
void p_adapt (unsigned &n_refined, unsigned &n_unrefined)
 
void p_adapt ()
 
void adapt_based_on_error_estimates (unsigned &n_refined, unsigned &n_unrefined, Vector< Vector< double >> &elemental_error)
 
void adapt_based_on_error_estimates (Vector< Vector< double >> &elemental_error)
 
void get_all_error_estimates (Vector< Vector< double >> &elemental_error)
 
void doc_errors (DocInfo &doc_info)
 Get max and min error for all elements in submeshes. More...
 
void doc_errors ()
 Get max and min error for all elements in submeshes. More...
 
void enable_info_in_newton_solve ()
 
void disable_info_in_newton_solve ()
 Disable the output of information when in the newton solver. More...
 
- Public Member Functions inherited from oomph::ExplicitTimeSteppableObject
 ExplicitTimeSteppableObject ()
 Empty constructor. More...
 
 ExplicitTimeSteppableObject (const ExplicitTimeSteppableObject &)=delete
 Broken copy constructor. More...
 
void operator= (const ExplicitTimeSteppableObject &)=delete
 Broken assignment operator. More...
 
virtual ~ExplicitTimeSteppableObject ()
 Empty destructor. More...
 
virtual void actions_before_explicit_stage ()
 
virtual void actions_after_explicit_stage ()
 

Protected Types

typedef ELEMENT_TYPE ELEMENT
 
- 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 Attributes

std::string name_
 
double elasticModulus_ = 0
 Elastic modulus (set via setSolid) More...
 
double poissonRatio_ = 0
 Poisson's ratio (set via setSolid) More...
 
double density_ = 0
 Density. More...
 
double gravity_ = 0
 Density. More...
 
void(* body_force_fct )(const double &time, const Vector< double > &xi, Vector< double > &b) = nullptr
 Pointer to the body force function. More...
 
ConstitutiveLawconstitutive_law_pt = nullptr
 Pointer to constitutive law (should be set in constructor) More...
 
SolidMeshSolid_mesh_pt = nullptr
 Pointer to solid mesh. More...
 
SolidMeshTraction_mesh_pt = nullptr
 Pointer to mesh of traction elements. More...
 
std::function< bool(SolidNode *, unsigned)> isPinned_
 Function to determine which nodal positions are pinned. More...
 
- Protected Attributes inherited from oomph::Problem
Vector< Problem * > Copy_of_problem_pt
 
std::map< double *, boolCalculate_dparameter_analytic
 
bool Calculate_hessian_products_analytic
 
LinearAlgebraDistributionDof_distribution_pt
 
Vector< double * > Dof_pt
 Vector of pointers to dofs. More...
 
DoubleVectorWithHaloEntries Element_count_per_dof
 
double Relaxation_factor
 
double Newton_solver_tolerance
 
unsigned Max_newton_iterations
 Maximum number of Newton iterations. More...
 
unsigned Nnewton_iter_taken
 
Vector< doubleMax_res
 Maximum residuals at start and after each newton iteration. More...
 
double Max_residuals
 
bool Time_adaptive_newton_crash_on_solve_fail
 
bool Jacobian_reuse_is_enabled
 Is re-use of Jacobian in Newton iteration enabled? Default: false. More...
 
bool Jacobian_has_been_computed
 
bool Problem_is_nonlinear
 
bool Pause_at_end_of_sparse_assembly
 
bool Doc_time_in_distribute
 
unsigned Sparse_assembly_method
 
unsigned Sparse_assemble_with_arrays_initial_allocation
 
unsigned Sparse_assemble_with_arrays_allocation_increment
 
Vector< Vector< unsigned > > Sparse_assemble_with_arrays_previous_allocation
 
double Numerical_zero_for_sparse_assembly
 
double FD_step_used_in_get_hessian_vector_products
 
bool Mass_matrix_reuse_is_enabled
 
bool Mass_matrix_has_been_computed
 
bool Discontinuous_element_formulation
 
double Minimum_dt
 Minimum desired dt: if dt falls below this value, exit. More...
 
double Maximum_dt
 Maximum desired dt. More...
 
double DTSF_max_increase
 
double DTSF_min_decrease
 
double Minimum_dt_but_still_proceed
 
bool Scale_arc_length
 Boolean to control whether arc-length should be scaled. More...
 
double Desired_proportion_of_arc_length
 Proportion of the arc-length to taken by the parameter. More...
 
double Theta_squared
 
int Sign_of_jacobian
 Storage for the sign of the global Jacobian. More...
 
double Continuation_direction
 
double Parameter_derivative
 Storage for the derivative of the global parameter wrt arc-length. More...
 
double Parameter_current
 Storage for the present value of the global parameter. More...
 
bool Use_continuation_timestepper
 Boolean to control original or new storage of dof stuff. More...
 
unsigned Dof_derivative_offset
 
unsigned Dof_current_offset
 
Vector< doubleDof_derivative
 Storage for the derivative of the problem variables wrt arc-length. More...
 
Vector< doubleDof_current
 Storage for the present values of the variables. More...
 
double Ds_current
 Storage for the current step value. More...
 
unsigned Desired_newton_iterations_ds
 
double Minimum_ds
 Minimum desired value of arc-length. More...
 
bool Bifurcation_detection
 Boolean to control bifurcation detection via determinant of Jacobian. More...
 
bool Bisect_to_find_bifurcation
 Boolean to control wheter bisection is used to located bifurcation. More...
 
bool First_jacobian_sign_change
 Boolean to indicate whether a sign change has occured in the Jacobian. More...
 
bool Arc_length_step_taken
 Boolean to indicate whether an arc-length step has been taken. More...
 
bool Use_finite_differences_for_continuation_derivatives
 
OomphCommunicatorCommunicator_pt
 The communicator for this problem. More...
 
bool Always_take_one_newton_step
 
double Timestep_reduction_factor_after_nonconvergence
 
bool Keep_temporal_error_below_tolerance
 

Additional Inherited Members

- 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 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)
 
doubledof_derivative (const unsigned &i)
 
doubledof_current (const unsigned &i)
 
virtual void set_initial_condition ()
 
virtual double global_temporal_error_norm ()
 
unsigned newton_solve_continuation (double *const &parameter_pt)
 
unsigned newton_solve_continuation (double *const &parameter_pt, DoubleVector &z)
 
void calculate_continuation_derivatives (double *const &parameter_pt)
 
void calculate_continuation_derivatives (const DoubleVector &z)
 
void calculate_continuation_derivatives_fd (double *const &parameter_pt)
 
bool does_pointer_correspond_to_problem_data (double *const &parameter_pt)
 
void set_consistent_pinned_values_for_continuation ()
 
- 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_TYPE>
class SolidProblem< ELEMENT_TYPE >

Base class for (surface-coupled) problems with a solid body.

Assumptions:

  • The element type is derived from QPVDElement, i.e. a solid.
  • The mesh type is derived from SolidMesh.
  • The constitutive law is derived from Hookean, with parameters elasticModulus, poissonRatio, density.

The solid properties (elasticModulus, poissonRatio, density, constitutive_law_pt, body_force_fct, etc.) are stored in member variables, not in globals as typical in oomph-lib, and accessed by setters and getters.

Additional functionality:

  • setIsPinned allows one to define the pinned nodes using a function.

Member Typedef Documentation

◆ ELEMENT

template<class ELEMENT_TYPE >
typedef ELEMENT_TYPE SolidProblem< ELEMENT_TYPE >::ELEMENT
protected

Member Enumeration Documentation

◆ Boundary

template<class ELEMENT_TYPE >
enum SolidProblem::Boundary : unsigned
Enumerator
Z_MIN 
Y_MIN 
X_MAX 
Y_MAX 
X_MIN 
Z_MAX 
566  {
567  Z_MIN = 0, Y_MIN = 1, X_MAX = 2, Y_MAX = 3, X_MIN = 4, Z_MAX = 5
568  };
@ Z_MIN
Definition: SolidProblem.h:567
@ X_MIN
Definition: SolidProblem.h:567
@ Z_MAX
Definition: SolidProblem.h:567
@ Y_MAX
Definition: SolidProblem.h:567
@ Y_MIN
Definition: SolidProblem.h:567
@ X_MAX
Definition: SolidProblem.h:567

Constructor & Destructor Documentation

◆ SolidProblem()

template<class ELEMENT_TYPE >
SolidProblem< ELEMENT_TYPE >::SolidProblem ( )
inline

Constructor: set default constitutive law and time stepper.

99  {
100  logger(INFO, "Set default constitutive law (AnisotropicHookean) and time stepper (Newmark<2>)");
101 
102  // Set Newton solver tolerance and maximum number of Newton iterations
106 
107  // Set constitutive law
109 
110  // Allocate the timestepper
112 
113  //build_mesh();
114 
115  // setup boundary conditions
116  //pin_and_assign_eqn_numbers();
117  };
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ INFO
double elasticModulus_
Elastic modulus (set via setSolid)
Definition: SolidProblem.h:69
double poissonRatio_
Poisson's ratio (set via setSolid)
Definition: SolidProblem.h:72
ConstitutiveLaw * constitutive_law_pt
Pointer to constitutive law (should be set in constructor)
Definition: SolidProblem.h:84
Definition: AnisotropicHookean.h:16
void add_time_stepper_pt(TimeStepper *const &time_stepper_pt)
Definition: problem.cc:1545
unsigned Max_newton_iterations
Maximum number of Newton iterations.
Definition: problem.h:599
double Newton_solver_tolerance
Definition: problem.h:596
double Max_residuals
Definition: problem.h:610
const Mdouble inf
Definition: GeneralDefine.h:23

References e(), constants::inf, INFO, logger, and oomph::Locate_zeta_helpers::Max_newton_iterations.

Member Function Documentation

◆ actionsAfterSolve()

template<class ELEMENT_TYPE >
virtual void SolidProblem< ELEMENT_TYPE >::actionsAfterSolve ( )
inlinevirtual

Reimplemented in Beam.

435 {}

◆ actionsBeforeOomphTimeStep()

template<class ELEMENT_TYPE >
virtual void SolidProblem< ELEMENT_TYPE >::actionsBeforeOomphTimeStep ( )
inlinevirtual

Reimplemented in Beam, SolidBag, and Beam.

437 {}

◆ actionsBeforeSolve()

template<class ELEMENT_TYPE >
virtual void SolidProblem< ELEMENT_TYPE >::actionsBeforeSolve ( )
inlinevirtual

Reimplemented in Beam, and Beam.

433 {}

◆ addAnisotropy()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::addAnisotropy ( double  Ex,
double  Ey,
double  Ez 
)
inline
166  {
167  logger(INFO,"Adding anisotropy E = [% % %]",Ex, Ey, Ez);
168  // make constitutive law anisotropic in x-direction
169  elasticModulus_ = Ex;
170  auto hooke_law_pt = dynamic_cast<AnisotropicHookean*>(constitutive_law_pt);
171  hooke_law_pt->setAnisotropy({1.0, Ey/Ex, Ez/Ex});
172  }
void setAnisotropy(std::array< double, 3 > anisotropy)
Definition: AnisotropicHookean.h:21

References INFO, logger, and oomph::AnisotropicHookean::setAnisotropy().

◆ addDissipation()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::addDissipation ( double  dissipation)
inline
147  {
148  logger(INFO,"Adding dissipation %",dissipation);
149  for (int i = 0; i < solid_mesh_pt()->nelement(); ++i)
150  {
151  dynamic_cast<ELEMENT*>(solid_mesh_pt()->element_pt(i))->dissipation_ = dissipation;
152  }
153  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
ELEMENT_TYPE ELEMENT
Definition: SolidProblem.h:63
SolidMesh *& solid_mesh_pt()
Get function for the solid mesh pointer.
Definition: SolidProblem.h:293
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 i, INFO, and logger.

◆ countPinned()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::countPinned ( )
inline

returns statistics about pinned nodes to the console

402  {
403  // count pinned
404  std::array<unsigned,3> countPinned {0,0,0};
405  unsigned countAll = 0;
406  for (unsigned n = 0; n < solid_mesh_pt()->nnode(); n++)
407  {
408  for (unsigned i = 0; i < 3; i++)
409  {
411  countAll++;
412  }
413  }
414  unsigned countPinnedAll = countPinned[0] + countPinned[1] +countPinned[2];
415  logger(INFO, "Pinned % of % positions (% free): % in x, % in y, % in z", countPinnedAll, countAll, countAll - countPinnedAll, countPinned[0], countPinned[1], countPinned[2]);
416  }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
void countPinned()
returns statistics about pinned nodes to the console
Definition: SolidProblem.h:401
unsigned long nnode() const
Return number of nodes in the mesh.
Definition: mesh.h:596
SolidNode * node_pt(const unsigned long &n)
Return a pointer to the n-th global SolidNode.
Definition: mesh.h:2594
bool position_is_pinned(const unsigned &i)
Test whether the i-th coordinate is pinned, 0: false; 1: true.
Definition: nodes.h:1803

References i, INFO, logger, and n.

◆ get_x()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::get_x ( const Vector< double > &  xi,
Vector< double > &  x 
) const
inline

Returns the x value at a certain xi value

530  {
531  if (OOMPH_MPI_PROCESSOR_NUM>1) {
532  logger(INFO, "get_x does not work with MPI");
533  for (int i = 0; i < 3; ++i) {
534  x[i] = xi[i];
535  }
536  } else {
537  Vector<double> s(3);
538  GeomObject *geom_obj_pt = nullptr;
539  const unsigned long nelement = solid_mesh_pt()->nelement();
540  for (unsigned long i = 0; i < nelement; i++) {
541  auto el_pt = dynamic_cast<ELEMENT *>(solid_mesh_pt()->element_pt(i));
542  el_pt->locate_zeta(xi, geom_obj_pt, s);
543  if (geom_obj_pt) {
544  //logger(INFO,"Point % % % is in element % at % % %",
545  // xi[0],xi[1],xi[2],i,s[0], s[1], s[2]);
546  el_pt->interpolated_x(s, x); //deformed coordinate
547  return;
548  }
549  }
550  logger(ERROR, "x(xi) could not be found");
551  }
552  }
@ ERROR
#define OOMPH_MPI_PROCESSOR_NUM
Definition: SolidProblem.h:35
Definition: geom_objects.h:101
RealScalar s
Definition: level1_cplx_impl.h:130
list x
Definition: plotDoE.py:28

References ERROR, i, INFO, oomph::GeomObject::locate_zeta(), logger, OOMPH_MPI_PROCESSOR_NUM, s, and plotDoE::x.

◆ getDeflection()

template<class ELEMENT_TYPE >
double SolidProblem< ELEMENT_TYPE >::getDeflection ( Vector< double xi,
unsigned  d 
) const
inline

Returns the difference between the x and xi value in dimension d at a certain xi value

558  {
559  Vector<double> x(3);
560  get_x(xi, x);
561  return x[d] - xi[d];
562  }
void get_x(const Vector< double > &xi, Vector< double > &x) const
Definition: SolidProblem.h:529

References plotDoE::x.

◆ getDensity()

template<class ELEMENT_TYPE >
double SolidProblem< ELEMENT_TYPE >::getDensity ( ) const
inline

get function for density_

209  {
210  return density_;
211  }
double density_
Density.
Definition: SolidProblem.h:75

◆ getDomainSize()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::getDomainSize ( std::array< double, 3 > &  min,
std::array< double, 3 > &  max 
) const
inline

Computes the domain size (min/max of the nodal positions in x/y/z)

306  {
307  min[0] = min[1] = min[2] = constants::inf;
308  max[0] = max[1] = max[2] = -constants::inf;
309  logger.assert_always(solid_mesh_pt(),"mesh not found");
310  for (unsigned i = 0; i < solid_mesh_pt()->nnode(); i++)
311  {
312  const auto n = solid_mesh_pt()->node_pt(i);
313  for (int j = 0; j < 3; ++j)
314  {
315  min[j] = std::min(min[j], n->xi(j));
316  max[j] = std::max(max[j], n->xi(j));
317  }
318  }
319  }
#define min(a, b)
Definition: datatypes.h:22
#define max(a, b)
Definition: datatypes.h:23
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References i, constants::inf, j, logger, max, min, and n.

◆ getElasticModulus()

template<class ELEMENT_TYPE >
double SolidProblem< ELEMENT_TYPE >::getElasticModulus ( ) const
inline

get function for elasticModulus_

141  {
142  return elasticModulus_;
143  }

◆ getMassMomentumEnergy()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::getMassMomentumEnergy ( double mass,
Vector< double > &  com,
Vector< double > &  linearMomentum,
Vector< double > &  angularMomentum,
double elasticEnergy,
double kineticEnergy 
) const
inline

See PVDEquationsBase<DIM>::get_energy.

929  {
930  // Initialise mass
931  mass = 0;
932  // Initialise center of mass
933  com.initialise(0);
934  // Initialise momentum
935  linearMomentum.initialise(0);
936  angularMomentum.initialise(0);
937  // Initialise energy
938  elasticEnergy = 0;
939  kineticEnergy = 0;
940 
941  // For each element
942  const unsigned long nelement = this->solid_mesh_pt()->nelement();
943  for (unsigned long e = 0; e < nelement; e++) {
944 
945  // Get the pointer to the element
946  ELEMENT* e_pt = dynamic_cast<ELEMENT*>(Solid_mesh_pt->element_pt(e));
947 
948  const unsigned DIM = e_pt->dim();
949 
950  //Find out how many integration points there are
951  unsigned n_intpt = e_pt->integral_pt()->nweight();
952 
953  //Set the Vector to hold local coordinates
955 
956  //Find out how many nodes there are
957  const unsigned n_node = e_pt->nnode();
958 
959  //Find out how many positional dofs there are
960  const unsigned n_position_type = e_pt->nnodal_position_type();
961 
962  //Set up memory for the shape functions
963  Shape psi(n_node, n_position_type);
964  DShape dpsidxi(n_node, n_position_type, DIM);
965 
966  // Timescale ratio (non-dim density)
967  double lambda_sq = e_pt->lambda_sq();
968 
969  //Loop over the integration points
970  for (unsigned ipt = 0; ipt < n_intpt; ipt++) {
971  //Assign local coordinate s
972  for (unsigned i = 0; i < DIM; i++) { s[i] = e_pt->integral_pt()->knot(ipt, i); }
973 
974  //Get the integral weight
975  double w = e_pt->integral_pt()->weight(ipt);
976 
977  //Evaluate the shape function and its derivatives, and get Jacobian
978  double J = e_pt->dshape_lagrangian_at_knot(ipt, psi, dpsidxi);
979 
980  //Get mass and the coupling weight at the integration point
981  double coupling_w = 0;
982  //for (unsigned l = 0; l < n_node; l++)
983  //{
984  // double nodal_coupling_w = dynamic_cast<SolidNode*>(e_pt->node_pt(l))->get_coupling_weight();
985  // double psi_ = psi(l);
986  // coupling_w += psi_ * nodal_coupling_w;
987  //}
988 
989  //Get the coordinates of the integration point
990  Vector<double> x(DIM, 0.0);
991  e_pt->interpolated_x(s,x);
992 
993  //Storage for Lagrangian coordinates and velocity (initialised to zero)
994  Vector<double> interpolated_xi(DIM, 0.0);
995  Vector<double> veloc(DIM, 0.0);
996 
997  //Calculate lagrangian coordinates
998  for (unsigned l = 0; l < n_node; l++) {
999  //Loop over positional dofs
1000  for (unsigned k = 0; k < n_position_type; k++) {
1001  //Loop over displacement components (deformed position)
1002  for (unsigned i = 0; i < DIM; i++) {
1003  //Calculate the Lagrangian coordinates
1004  interpolated_xi[i] += e_pt->lagrangian_position_gen(l, k, i) * psi(l, k);
1005 
1006  //Calculate the velocity components (if unsteady solve)
1007  if (e_pt->is_inertia_enabled()) {
1008  veloc[i] += e_pt->dnodal_position_gen_dt(l, k, i) * psi(l, k);
1009  }
1010  }
1011  }
1012  }
1013 
1014  //Get isotropic growth factor
1015  double gamma = 1.0;
1016  e_pt->get_isotropic_growth(ipt, s, interpolated_xi, gamma);
1017 
1018  //Premultiply the undeformed volume ratio (from the isotropic
1019  // growth), the integral weights, the coupling weights, and the Jacobian
1020  double W = gamma * w * (1.0 - coupling_w) * J;
1021 
1023  DenseMatrix<double> strain(DIM, DIM);
1024 
1025  //Now calculate the stress tensor from the constitutive law
1026  e_pt->get_stress(s, sigma);
1027 
1028  // Add pre-stress
1029  for (unsigned i = 0; i < DIM; i++) {
1030  for (unsigned j = 0; j < DIM; j++) {
1031  sigma(i, j) += e_pt->prestress(i, j, interpolated_xi);
1032  }
1033  }
1034 
1035  //get the strain
1036  e_pt->get_strain(s, strain);
1037 
1038  // Initialise
1039  double localElasticEnergy = 0;
1040  double velocitySquared = 0;
1041 
1042  // Compute integrals
1043  for (unsigned i = 0; i < DIM; i++) {
1044  for (unsigned j = 0; j < DIM; j++) {
1045  localElasticEnergy += sigma(i, j) * strain(i, j);
1046  }
1047  velocitySquared += veloc[i] * veloc[i];
1048  }
1049 
1050  // Mass
1051  mass += lambda_sq * W;
1052  // Linear momentum and angular momentum
1053  Vector<double> cross_product(DIM, 0);
1054  VectorHelpers::cross(interpolated_xi, veloc, cross_product);
1055  for (unsigned i = 0; i < DIM; i++) {
1056  com[i] += lambda_sq * W * x[i];
1057  linearMomentum[i] += lambda_sq * veloc[i] * W;
1058  angularMomentum[i] += lambda_sq * cross_product[i] * W;
1059  }
1060  // Potential energy
1061  elasticEnergy += 0.5 * localElasticEnergy * W;
1062  // Kinetic energy
1063  kineticEnergy += lambda_sq * 0.5 * velocitySquared * W;
1064  }
1065  }
1066  for (unsigned i = 0; i < com.size(); i++) {
1067  com[i] /= mass;
1068  }
1069  }
JacobiRotation< float > J
Definition: Jacobi_makeJacobi.cpp:3
RowVector3d w
Definition: Matrix_resize_int.cpp:3
SolidMesh * Solid_mesh_pt
Pointer to solid mesh.
Definition: SolidProblem.h:87
Definition: shape.h:278
Definition: shape.h:76
void initialise(const _Tp &__value)
Iterate over all values and set to the desired value.
Definition: oomph-lib/src/generic/Vector.h:167
char char char int int * k
Definition: level2_impl.h:374
#define DIM
Definition: linearised_navier_stokes_elements.h:44
int sigma
Definition: calibrate.py:179
Mdouble gamma(Mdouble gamma_in)
This is the gamma function returns the true value for the half integer value.
Definition: ExtendedMath.cc:116
@ W
Definition: quadtree.h:63
void cross(const Vector< double > &A, const Vector< double > &B, Vector< double > &C)
Definition: oomph-lib/src/generic/Vector.h:319

References oomph::VectorHelpers::cross(), DIM, e(), oomph::Mesh::element_pt(), mathsFunc::gamma(), i, oomph::Vector< _Tp >::initialise(), J, j, k, s, calibrate::sigma, w, oomph::QuadTreeNames::W, and plotDoE::x.

◆ getName()

template<class ELEMENT_TYPE >
std::string SolidProblem< ELEMENT_TYPE >::getName ( ) const
inline

get function for name_

128  {
129  return name_;
130  }
std::string name_
Definition: SolidProblem.h:66

◆ getOomphGravity()

template<class ELEMENT_TYPE >
double SolidProblem< ELEMENT_TYPE >::getOomphGravity ( ) const
inline

get function for gravity_

183  {
184  return gravity_;
185  }
double gravity_
Density.
Definition: SolidProblem.h:78

◆ getOomphTime()

template<class ELEMENT_TYPE >
double SolidProblem< ELEMENT_TYPE >::getOomphTime ( ) const
inline

get function for current time

288  {
289  return time_pt()->time();
290  }
Time *& time_pt()
Return a pointer to the global time object.
Definition: problem.h:1504
double & time()
Return the current value of the continuous time.
Definition: timesteppers.h:123

◆ getOomphTimeStep()

template<class ELEMENT_TYPE >
double SolidProblem< ELEMENT_TYPE >::getOomphTimeStep ( ) const
inline

get function for time step

283  {
284  return time_pt()->dt();
285  }
double & dt(const unsigned &t=0)
Definition: timesteppers.h:136

◆ getPoissonRatio()

template<class ELEMENT_TYPE >
double SolidProblem< ELEMENT_TYPE >::getPoissonRatio ( ) const
inline

get function for poissonRatio_

196  {
197  return poissonRatio_;
198  }

◆ loadSolidMesh()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::loadSolidMesh ( std::string  infileName,
bool  cubic = true 
)
inline
625  {
626  logger(INFO, "Loading % (cubic=%)",infileName, cubic);
627  //if (useTetgen()) logger(ERROR, "Not implemented for Tetgen meshes");
628 
629  std::ifstream mesh(infileName);
630  logger.assert_always(mesh.good(),"Mesh file % could not be opened",infileName);
631 
632  if (cubic) {
633  unsigned nx, ny, nz;
634  mesh >> nx >> ny >> nz;
635  logger(INFO, "Loaded %x%x% cubic mesh from %", nx, ny, nz, infileName);
636  logger.assert_debug(nx > 1 and ny > 1 and nz > 1, "Mesh size invalid");
638  // Assign physical properties to the elements before any refinement
639  for (unsigned i = 0; i < solid_mesh_pt()->nelement(); i++)
640  {
641  //Cast to a solid element
642  ELEMENT* el_pt = dynamic_cast<ELEMENT*>(solid_mesh_pt()->element_pt(i));
643  // Set the constitutive law
644  el_pt->constitutive_law_pt() = constitutive_law_pt;
645  }
646  }
647 
648  double xi, x;
649  bool pin;
650  logger(INFO, "Loading % nodes", solid_mesh_pt()->nnode());
651  for (int i = 0; i < solid_mesh_pt()->nnode(); ++i)
652  {
654  for (int j = 0; j < 3; ++j)
655  {
656  mesh >> xi >> x >> pin;
657  n->xi(j) = xi;
658  n->x(j) = x;
659  if (pin) n->pin_position(j);
660  }
661  }
662  }
TimeStepper *& time_stepper_pt()
Definition: problem.h:1524
Definition: solid_cubic_mesh.h:17
Definition: nodes.h:1686
const unsigned nz
Definition: ConstraintElementsUnitTest.cpp:32
const unsigned nx
Definition: ConstraintElementsUnitTest.cpp:30
const unsigned ny
Definition: ConstraintElementsUnitTest.cpp:31
T cubic(const T val)
calculates the cube of a number
Definition: ExtendedMath.h:95

References mathsFunc::cubic(), i, INFO, j, logger, n, Mesh_Parameters::nx, Mesh_Parameters::ny, Mesh_Parameters::nz, and plotDoE::x.

◆ pinBoundaries()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::pinBoundaries ( std::vector< unsigned b)
inline
244  {
245  for (const auto a: b) {
246  logger(INFO, "Pinning nodes on boundary %", a);
247  }
248  isPinned_ = [b](SolidNode *n, unsigned d) {
249  for (const auto a : b) {
250  if (n->is_on_boundary(a)) return true;
251  }
252  return false;
253  };
254  }
Scalar * b
Definition: benchVecAdd.cpp:17
std::function< bool(SolidNode *, unsigned)> isPinned_
Function to determine which nodal positions are pinned.
Definition: SolidProblem.h:93
const Scalar * a
Definition: level2_cplx_impl.h:32

References a, b, INFO, logger, and n.

◆ pinBoundary()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::pinBoundary ( unsigned  b)
inline
236  {
237  logger(INFO, "Pinning nodes on boundary %", b);
238  isPinned_ = [b](SolidNode *n, unsigned d) {
239  return n->is_on_boundary(b);
240  };
241  }

References b, INFO, logger, and n.

◆ prepareForSolve()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::prepareForSolve ( )
inline
  • Asserts all parameters are set
  • Assign pointers for all elements
  • Builds global mesh
  • Pins nodes
  • Pins solid pressure
  • Assigns equation numbers

This function should be called before solve(), after creating the mesh, defining body force and constitutive law.

Todo:
UMBU Note, prepareForSolve did not set lambda correctly before
332  {
333  // check certain values are set
334  logger.assert_always(!name_.empty(), "Set name via setName(..)");
335  logger.assert_always(elasticModulus_>0, "Set elastic modulus via setElasticModulus(..)");
336  logger.assert_always(density_>0, "Set density via setDensity(..)");
337  logger.assert_always(solid_mesh_pt(), "Set solid mesh via e.g. setSolidCubicMesh(..)");
338 
339  // Assign constitutive_law_pt and body_force_fct_pt of each element
340  logger(INFO, "Assign constitutive_law, body_force, density to all elements");
341  for (unsigned i = 0; i < solid_mesh_pt()->nelement(); i++)
342  {
343  //Cast to a solid element
344  ELEMENT* el_pt = dynamic_cast<ELEMENT*>(solid_mesh_pt()->element_pt(i));
346  // Set the constitutive law
347  el_pt->constitutive_law_pt() = constitutive_law_pt;
348  // Set body force
349  el_pt->body_force_fct_pt() = body_force_fct;
350  // Set density
351  el_pt->lambda_sq_pt() = &density_;
352  }
353 
354  // Construct the traction element mesh
355  // Traction_mesh_pt = new SolidMesh;
356  // create_traction_elements();
357 
358  //Build combined "global" mesh
360  if (traction_mesh_pt()) {
362  logger(INFO, "Built global mesh from solid mesh and traction mesh");
363  } else {
364  logger(INFO, "Built global mesh from solid mesh");
365  }
367 
368  //Pin nodes
369  if (isPinned_)
370  {
371  for ( unsigned n = 0; n < solid_mesh_pt()->nnode(); n++ )
372  {
373  SolidNode* n_pt = solid_mesh_pt()->node_pt( n );
374  //Pin all nodes
375  for ( unsigned i = 0; i < 3; i++ )
376  {
377  if ( isPinned_( n_pt, i ) )
378  {
379  n_pt->pin_position( i );
380  }
381  else
382  {
383  n_pt->unpin_position( i );
384  }
385  }
386  }
387  }
388  countPinned();
389 
390  // Pin the redundant solid pressures (if any)
392  solid_mesh_pt()->element_pt());
393  logger(INFO, "Pinned redundant nodal solid pressures");
394 
395  // Attach the boundary conditions to the mesh
396  unsigned n_eq = assign_eqn_numbers();
397  logger(INFO, "Assigned % equation numbers", n_eq);
398  }
SolidMesh *& traction_mesh_pt()
Get function for the traction mesh pointer.
Definition: SolidProblem.h:296
void(* body_force_fct)(const double &time, const Vector< double > &xi, Vector< double > &b)
Pointer to the body force function.
Definition: SolidProblem.h:81
Definition: solid_elements.h:58
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
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

References i, INFO, logger, n, oomph::SolidNode::pin_position(), oomph::PVDEquationsBase< DIM >::pin_redundant_nodal_solid_pressures(), and oomph::SolidNode::unpin_position().

◆ removeOldFiles()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::removeOldFiles ( ) const
inline

Removes old output files (vtu) with the same name as this problem.

517  {
518  for (int i = 0; true; ++i)
519  {
520  std::string fileName = name_ + "FEM_" + std::to_string(i) + ".vtu";
521  if (remove(fileName.c_str())) break;
522  std::cout << "Deleted " << fileName << '\n';
523  }
524  }
string fileName
Definition: UniformPSDSelfTest.py:10
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
std::string to_string(T object, unsigned float_precision=8)
Definition: oomph_utilities.h:189

References UniformPSDSelfTest::fileName, i, oomph::Global_string_for_annotation::string(), and oomph::StringConversion::to_string().

◆ saveSolidMesh()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::saveSolidMesh ( )
inline
583  {
585 #ifdef OOMPH_HAS_MPI
586  // When the problem hasn't been distributed, the whole mesh is stored on every processor.
587  // Prevent writing the same file multiple times, so only write for the first processor.
588  if (!Problem_has_been_distributed && OOMPH_MPI_PROCESSOR_ID != 0)
589  return;
590 
591  // When the problem has been distributed, add the processor id to the filename.
592  if (Problem_has_been_distributed)
594 #endif
595  filename += ".mesh";
596 
597  //if (useTetgen()) logger(ERROR, "Not implemented for Tetgen meshes");
598 
599  std::ofstream mesh(filename);
600  auto solid_cubic_mesh_pt = dynamic_cast<RefineableSolidCubicMesh<ELEMENT_TYPE>*>(solid_mesh_pt());
601  if (solid_cubic_mesh_pt) {
602  //logger.assert_always(solid_cubic_mesh_pt, "Mesh is not cubic");
603  mesh << solid_cubic_mesh_pt->nx() << ' ';
604  mesh << solid_cubic_mesh_pt->ny() << ' ';
605  mesh << solid_cubic_mesh_pt->nz() << '\n';
606  }
607  for (int i = 0; i < solid_mesh_pt()->nnode(); ++i)
608  {
610  for (int j = 0; j < 3; ++j)
611  {
612  mesh << n->xi(j) << ' ' << n->x(j) << ' ' << n->position_is_pinned(j) << ' ';
613  }
614  mesh << '\n';
615  }
616  if (solid_cubic_mesh_pt) {
617  logger(INFO, "Saved %x%x% mesh to %",
618  solid_cubic_mesh_pt->nx(), solid_cubic_mesh_pt->ny(), solid_cubic_mesh_pt->nz(), filename);
619  } else {
620  logger(INFO, "Saved mesh to % (% nodes)", filename, solid_mesh_pt()->nnode());
621  }
622  }
#define OOMPH_MPI_PROCESSOR_ID
Definition: SolidProblem.h:41
const unsigned & nx() const
Access function for number of elements in x directions.
Definition: simple_cubic_mesh.template.h:108
string filename
Definition: MergeRestartFiles.py:39

References MergeRestartFiles::filename, i, INFO, j, logger, n, oomph::SimpleCubicMesh< ELEMENT >::nx(), OOMPH_MPI_PROCESSOR_ID, oomph::Global_string_for_annotation::string(), and oomph::StringConversion::to_string().

◆ setBodyForceAsGravity()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::setBodyForceAsGravity ( double  gravity = 9.8)
inline

set function for body_force_pt

215  {
216  logger(INFO, "Setting oomph-gravity in z-direction");
217  gravity_ = gravity;
218  // define a static body force
219  static double& Density = density_;
220  static double& Gravity = gravity_;
221  body_force_fct = [](const double& time, const Vector<double>& xi, Vector<double>& b) {
222  b[0] = 0.0;
223  b[1] = 0.0;
224  b[2] = -Gravity * Density;
225  };
226  }
double & time()
Return the current value of continuous time.
Definition: problem.cc:11531
Definition: ConstraintElementsUnitTest.cpp:19
void gravity(const double &t, const Vector< double > &xi, Vector< double > &b)
Definition: ConstraintElementsUnitTest.cpp:20

References b, Gravity::gravity(), INFO, and logger.

◆ setDensity()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::setDensity ( double  density)
inline

set function for density_

202  {
203  density_ = density;
204  logger(INFO, "Density: %", density_);
205  }
density
Definition: UniformPSDSelfTest.py:19

References UniformPSDSelfTest::density, INFO, and logger.

◆ setDissipation()

template<class ELEMENT_TYPE >
std::enable_if<std::is_base_of<RefineableQDPVDElement<3,2>, ELEMENT>::value, void> SolidProblem< ELEMENT_TYPE >::setDissipation ( double  dissipation)
inline

Sets the dissipation coefficient for all elements.

258  {
259  for (int i = 0; i < solid_mesh_pt()->nelement(); ++i)
260  {
261  dynamic_cast<RefineableQDPVDElement<3,2>*>(solid_mesh_pt()->element_pt(i))->setDissipation(dissipation);
262  }
263  }
std::enable_if< std::is_base_of< RefineableQDPVDElement< 3, 2 >, ELEMENT >::value, void > setDissipation(double dissipation)
Sets the dissipation coefficient for all elements.
Definition: SolidProblem.h:257
Definition: RefineableQDPVDElement.h:23

References i.

◆ setElasticModulus()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::setElasticModulus ( double  elasticModulus)
inline

set function for elasticModulus_

134  {
135  elasticModulus_ = elasticModulus;
136  logger(INFO, "Elastic Modulus: %", elasticModulus_);
137  }

References INFO, and logger.

◆ setIsPinned()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::setIsPinned ( std::function< bool(SolidNode *, unsigned)>  isPinned)
inline

set function for isPinned_

230  {
231  isPinned_ = std::move(isPinned);
232  logger(INFO, "Setting which positions on which nodes are pinned");
233  }

References INFO, and logger.

◆ setMaxNewtonIterations()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::setMaxNewtonIterations ( unsigned  Max_newton_iterations)
inline

set function for Max_newton_iterations

273  {
274  this->Max_newton_iterations = Max_newton_iterations;
275  }

References oomph::Locate_zeta_helpers::Max_newton_iterations.

◆ setName()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::setName ( const std::string &  name)
inline

set function for name_

121  {
122  name_ = name;
123  logger(INFO, "Name: %", name_);
124  }
string name
Definition: plotDoE.py:33

References INFO, logger, and plotDoE::name.

◆ setNewtonSolverTolerance()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::setNewtonSolverTolerance ( double  Newton_solver_tolerance)
inline

set function for Newton_solver_tolerance

267  {
268  this->Newton_solver_tolerance = Newton_solver_tolerance;
269  }

◆ setOomphGravity()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::setOomphGravity ( double  gravity)
inline

set function for elasticModulus_

176  {
177  gravity_ = gravity;
178  logger(INFO, "Elastic Modulus: %", gravity_);
179  }

References Gravity::gravity(), INFO, and logger.

◆ setOomphTimeStep()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::setOomphTimeStep ( double  dt)
inline

set function for time step

278  {
279  time_pt()->initialise_dt(dt);
280  }
void initialise_dt(const double &dt_)
Set all timesteps to the same value, dt.
Definition: timesteppers.h:99

◆ setPoissonRatio()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::setPoissonRatio ( double  poissonRatio)
inline

set function for poissonRatio_

189  {
190  poissonRatio_ = poissonRatio;
191  logger(INFO, "Poisson Ratio: %", poissonRatio_);
192  }

References INFO, and logger.

◆ setSolidCubicMesh()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::setSolidCubicMesh ( const unsigned nx,
const unsigned ny,
const unsigned nz,
const double xMin,
const double xMax,
const double yMin,
const double yMax,
const double zMin,
const double zMax 
)
inline
574  {
575  // Create mesh
576  solid_mesh_pt() = new RefineableSolidCubicMesh<ELEMENT_TYPE>(nx, ny, nz, xMin, xMax, yMin, yMax, zMin, zMax, time_stepper_pt());
577 
578  logger(INFO, "Created %x%x% cubic mesh on domain [%,%]x[%,%]x[%,%]",
579  nx, ny, nz, xMin, xMax, yMin, yMax, zMin, zMax);
580  }

References INFO, logger, Mesh_Parameters::nx, Mesh_Parameters::ny, and Mesh_Parameters::nz.

◆ setupRefinementParameters()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::setupRefinementParameters ( const double min_error_target,
const double max_error_target,
Z2ErrorEstimator *&  error_estimator_pt 
)
inline
156  {
158  // Set error estimator
159  refineable_mesh_pt->spatial_error_estimator_pt()=error_estimator_pt;
160  // Error targets for adaptive refinement
161  refineable_mesh_pt->max_permitted_error()=max_error_target;
162  refineable_mesh_pt->min_permitted_error()=min_error_target;
163  }
double & min_permitted_error()
Definition: refineable_mesh.h:156
double & max_permitted_error()
Definition: refineable_mesh.h:163
ErrorEstimator *& spatial_error_estimator_pt()
Access to spatial error estimator.
Definition: refineable_mesh.h:143
Z2ErrorEstimator * error_estimator_pt
Definition: MortaringCantileverCompareToNonMortaring.cpp:190

References MeshRefinement::error_estimator_pt, oomph::RefineableMeshBase::max_permitted_error(), oomph::RefineableMeshBase::min_permitted_error(), and oomph::RefineableMeshBase::spatial_error_estimator_pt().

◆ solid_mesh_pt() [1/2]

template<class ELEMENT_TYPE >
SolidMesh*& SolidProblem< ELEMENT_TYPE >::solid_mesh_pt ( )
inline

Get function for the solid mesh pointer.

293 { return Solid_mesh_pt; }

◆ solid_mesh_pt() [2/2]

template<class ELEMENT_TYPE >
SolidMesh* const& SolidProblem< ELEMENT_TYPE >::solid_mesh_pt ( ) const
inline

Get function for the solid mesh pointer.

299 { return Solid_mesh_pt; }

◆ solveSteady()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::solveSteady ( const unsigned max_adapt = 0)
inline

Solves a steady problem.

422  {
423  logger.assert_always(mesh_pt(), "Mesh pointer not set; did you call prepareForSolve?");
424  logger(INFO, "Solve steady-state problem");
426  if(max_adapt==0) newton_solve();
427  else newton_solve(max_adapt);
429  writeToVTK();
430  saveSolidMesh();
431  }
void saveSolidMesh()
Definition: SolidProblem.h:582
virtual void actionsBeforeSolve()
Definition: SolidProblem.h:433
void writeToVTK()
Definition: SolidProblem.h:665
virtual void actionsAfterSolve()
Definition: SolidProblem.h:435
Mesh *& mesh_pt()
Return a pointer to the global mesh.
Definition: problem.h:1280
void newton_solve()
Use Newton method to solve the problem.
Definition: problem.cc:8783

References INFO, and logger.

◆ solveUnsteady()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::solveUnsteady ( double  timeMax,
double  dt,
unsigned  saveCount = 10,
const unsigned max_adapt = 0 
)
inline

Solves an unsteady problem.

Todo:
UMBU changed from
Todo:
UMBU Changed counting back to the old way, otherwise we did not plot the same time step
443  {
444  logger.assert_always(mesh_pt(), "Mesh pointer not set; did you call prepareForSolve?");
445 
446  std::cout << "Solving oomph with dt=" << dt << " until timeMax=" << timeMax << std::endl;
447 
448  // Setup initial conditions. Default is a non-impulsive start
449  this->time_pt()->initialise_dt(dt);
452 
453  // This is the main loop over advancing time
454  double& time = time_stepper_pt()->time();
455  unsigned count = 0;
456  const unsigned countMax = std::ceil(timeMax/dt);
457  while (time < timeMax)
458  {
459  logger(INFO, "Time %s of %s (% of %)", time, timeMax, count, countMax);
461  // solve the oomphProb for one time step (this also increments time)
463  //adaptive_unsteady_newton_solve(dt,2e-7);
464  if(max_adapt == 0)
465  {
466  unsteady_newton_solve(dt, true);
467  }
468  else
469  {
470  unsteady_newton_solve(dt, max_adapt, false, true);
471  }
472  // increase count
474  //count++;
475  // write outputs of the oomphProb
476  if (count++ % saveCount == 0 or time + dt > timeMax) {
477  writeToVTK();
478  // save in case code breaks
479  // saveSolidMesh();
480  }
481  // abort if problem
482  if (Max_res.back()==0) {
483  saveSolidMesh();
484  logger(ERROR, "Maximum residual is 0; exiting the code");
485  }
486  }
487  saveSolidMesh();
489  }
virtual void actionsBeforeOomphTimeStep()
Definition: SolidProblem.h:437
void assign_initial_values_impulsive()
Definition: problem.cc:11499
Vector< double > Max_res
Maximum residuals at start and after each newton iteration.
Definition: problem.h:606
void unsteady_newton_solve(const double &dt)
Definition: problem.cc:10953
double & time()
Return current value of continous time.
Definition: timesteppers.h:332
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 ceil(const bfloat16 &a)
Definition: BFloat16.h:644

References Eigen::bfloat16_impl::ceil(), ERROR, INFO, and logger.

◆ solveUnsteadyForgiving()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::solveUnsteadyForgiving ( double  timeMax,
double  timeMaxMin,
double  dt,
unsigned  saveCount = 10 
)
inline

Solves an unsteady problem, returns successful if timeMaxMin has been reached

494  {
495  // solve
496  try {
497  solveUnsteady(timeMax, dt, saveCount);
498  } catch(OomphLibError& error) {
499  //Store output if newton solver fails
500  saveSolidMesh();
501  if (time_stepper_pt()->time()-dt >= timeMaxMin) {
502  // take it as successful if a fraction of the time evolution has finished
503  logger(INFO,"Newton solver failed at t=% (tMax=%), but code will continue.",
504  time_stepper_pt()->time()-dt, timeMax);
505  exit(0);
506  } else {
507  logger(ERROR,"Newton solver failed at t=% (tMax=%).",
508  time_stepper_pt()->time()-dt, timeMax);
509  }
510  }
511  }
void solveUnsteady(double timeMax, double dt, unsigned saveCount=10, const unsigned &max_adapt=0)
Definition: SolidProblem.h:442
Definition: oomph_definitions.h:222
int error
Definition: calibrate.py:297

References calibrate::error, ERROR, INFO, and logger.

◆ traction_mesh_pt() [1/2]

template<class ELEMENT_TYPE >
SolidMesh*& SolidProblem< ELEMENT_TYPE >::traction_mesh_pt ( )
inline

Get function for the traction mesh pointer.

296 { return Traction_mesh_pt; }
SolidMesh * Traction_mesh_pt
Pointer to mesh of traction elements.
Definition: SolidProblem.h:90

◆ traction_mesh_pt() [2/2]

template<class ELEMENT_TYPE >
SolidMesh* const& SolidProblem< ELEMENT_TYPE >::traction_mesh_pt ( ) const
inline

Get function for the traction mesh pointer.

302 { return Traction_mesh_pt; }

◆ writeToVTK()

template<class ELEMENT_TYPE >
void SolidProblem< ELEMENT_TYPE >::writeToVTK ( )
inline
666  {
667 #ifdef OOMPH_HAS_MPI
668  // When the problem hasn't been distributed, the whole mesh is stored on every processor.
669  // Prevent writing the same file multiple times, so only write for the first processor.
670  if (!Problem_has_been_distributed && OOMPH_MPI_PROCESSOR_ID != 0)
671  return;
672 #endif
673 
674  //set local coordinates list
675  std::vector<std::vector<double>> sList0;
676  // order of nodes
677  std::vector<unsigned> nList;
678  // vtkFormat for given shape
679  // https://kitware.github.io/vtk-examples/site/VTKFileFormats/
680  unsigned vtkFormat;
681 
682  // define differently for tetrahedral and hexahedral (quad) elements
683  if (std::is_base_of<SolidTElement<3, 2>, ELEMENT>::value)
684  {
685  vtkFormat = 10; // TETRA
686 
687  sList0 = {
688  {1, 0, 0},
689  {0, 1, 0},
690  {0, 0, 1},
691  {0, 0, 0}
692  };
693 
694  nList = {0, 1, 2, 3};
695  }
696  else if (std::is_base_of<SolidQElement<3, 2>, ELEMENT>::value)
697  {
698  vtkFormat = 12; // HEXAHEDRON
699 
700  sList0 = {
701  {-1, -1, -1},
702  {-1, -1, +1},
703  {-1, +1, +1},
704  {-1, +1, -1},
705  {+1, -1, -1},
706  {+1, -1, +1},
707  {+1, +1, +1},
708  {+1, +1, -1}
709  };
710  // order of nodes
711  nList = {0, 4, 6, 2, 1, 5, 7, 3};
712  } else {
713  logger(ERROR,"Element type unknown");
714  }
715 
716  // convert to Vector
717  std::vector<Vector<double>> sList;
718  for (auto s0 : sList0)
719  {
720  Vector<double> s(3);
721  s[0] = s0[0];
722  s[1] = s0[1];
723  s[2] = s0[2];
724  sList.push_back(s);
725  }
726 
727  // number of cells
728  unsigned nel = solid_mesh_pt()->nelement();
729 
730  // set up vtu Points
731  struct Point
732  {
733  Vector<double> coordinate;
734  struct Data
735  {
737  std::vector<double> value;
738  };
739  std::vector<Data> data;
740  };
741  std::vector<Point> points;
742  points.reserve(nel * sList.size());
743 
744  // set up vtu Cells
745  struct Cell
746  {
747  std::vector<unsigned long> connectivity;
748  unsigned long offset;
749  unsigned type;
750  };
751  std::vector<Cell> cells;
752  points.reserve(nel);
753 
754  //for all elements
755  for (unsigned e = 0; e < nel; e++)
756  {
757  // Get pointer to element
758  auto el_pt = dynamic_cast<ELEMENT*>(
760 
761  std::vector<unsigned long> connectivity;
762  unsigned ix = 0; // node index
763  for (const auto& s : sList)
764  {
765  // pointer to node info
766  auto n = nList[ix];
767  auto n_pt = dynamic_cast<SolidNode*>(el_pt->node_pt(n));
768  // Get Eulerian coordinates
769  Vector<double> x(3);
770  el_pt->interpolated_x(s, x);
771  // get velocity
772  Vector<double> dxdt(3);
773  el_pt->interpolated_dxdt(s, 1, dxdt);
774  // get displacement
775  Vector<double> xi(3);
776  el_pt->interpolated_xi(s, xi);
777  // getBodyForce
779  auto bodyForceFct = el_pt->body_force_fct_pt();
780  if (bodyForceFct) bodyForceFct(time(), xi, body_force);
781  // get coupling residual (fails)
782  //std::vector<double> couplingResidual
783  // {el_pt->get_nodal_coupling_residual(n, 0),
784  // el_pt->get_nodal_coupling_residual(n, 1),
785  // el_pt->get_nodal_coupling_residual(n, 2)};
786  // get stress/pressure
788  el_pt->get_stress(s, sigma);
789  // first invariant
790  double pressure = (sigma(0,0)+sigma(1,1)+sigma(2,2))/3;
791  //https://en.wikipedia.org/wiki/Von_Mises_yield_criterion
792  double J2 = 0;
793  for (int i = 0; i < 3; ++i) {
794  for (int j = 0; j < 3; ++j) {
795  J2 += 0.5*sigma(i,j)*sigma(i,j);
796  }
797  }
798  //std::cout << " " << J2;
799  // get strain
800  DenseMatrix<double> strain(3,3);
801  el_pt->get_strain(s, strain);
802  // get velocity (fails)
803  std::vector<double> dudt
804  {el_pt->dnodal_position_dt(n, 0),
805  el_pt->dnodal_position_dt(n, 1),
806  el_pt->dnodal_position_dt(n, 2)};
807  // get boundary (works)
808  std::set<unsigned>* boundaries_pt;
809  n_pt->get_boundaries_pt(boundaries_pt);
810  double b = boundaries_pt ? *boundaries_pt->begin()+1 : 0;
811  std::vector<double> pin {(double) n_pt->position_is_pinned(0),
812  (double) n_pt->position_is_pinned(1),
813  (double) n_pt->position_is_pinned(2)};
814  points.push_back(
815  {x, {
816  {"Velocity", {dxdt[0], dxdt[1], dxdt[2]}},
817  {"Displacement", {x[0] - xi[0], x[1] - xi[1], x[2] - xi[2]}},
818  {"BodyForce", {body_force[0], body_force[1], body_force[2]}},
819  {"Pin", pin},
820  //{"CouplingResidual", couplingResidual},
821  {"Velocity2", dudt},
822  {"Pressure", {pressure}},
823  {"J2", {J2}},
824  {"Stress", {sigma(0,0), sigma(0,1), sigma(0,2),
825  sigma(1,0), sigma(1,1), sigma(1,2),
826  sigma(2,0), sigma(2,1), sigma(2,2)}},
827 // {"Strain", {strain(0,0), strain(0,1), strain(0,2),
828 // strain(1,0), strain(1,1), strain(1,2),
829 // strain(2,0), strain(2,1), strain(2,2)}},
830  //\todo undo this comment, but it causes a problem in the output
831  {"Boundary", {b}}
832  }});
833 
834  // add to connectivity
835  connectivity.push_back(points.size() - 1);
836  ix++;
837  }
838  cells.push_back({connectivity, points.size(), vtkFormat});
839  }
840 
841  //open vtk file
842  static unsigned count = 0;
843 #ifdef OOMPH_HAS_MPI
844  std::string vtkFileName = name_ + "FEM_" + std::to_string(OOMPH_MPI_PROCESSOR_ID) + "_" + std::to_string(count++) + ".vtu";
845 #else
846  std::string vtkFileName = name_ + "FEM_" + std::to_string(count++) + ".vtu";
847 #endif
848 
849  std::ofstream vtk(vtkFileName);
850 
851  //write vtk file
852  vtk << "<?xml version=\"1.0\"?>\n"
853  "<!-- time 10.548-->\n"
854  "<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">\n"
855  "<UnstructuredGrid>\n"
856  "<Piece NumberOfPoints=\""
857  << points.size()
858  << "\" NumberOfCells=\""
859  << cells.size()
860  << "\">\n"
861  "\n"
862  "<Points>\n"
863  "<DataArray type=\"Float32\" Name=\"Position\" NumberOfComponents=\"3\" format=\"ascii\">\n";
864  for (auto point : points)
865  {
866  vtk << point.coordinate[0] << " " << point.coordinate[1] << " " << point.coordinate[2] << "\n";
867  }
868  vtk << "</DataArray>\n"
869  "</Points>\n\n";
870  if (not points.empty())
871  {
872  vtk << "<PointData Vectors=\"vector\">\n";
873  for (int i = 0; i < points.front().data.size(); ++i)
874  {
875  auto data = points.front().data[i];
876  vtk << R"(<DataArray type="Float32" Name=")"
877  << points.front().data[i].name
878  << R"(" NumberOfComponents=")"
879  << points.front().data[i].value.size()
880  << R"(" format="ascii">)" << "\n";
881  for (const Point& point : points)
882  {
883  for (const auto& value : point.data[i].value)
884  {
885  //ensure values are not too small (VTK issue)
886  vtk << ((!isfinite(value) or fabs(value)<1e-33 or fabs(value)>1e33)?0.0:value) << " ";
887  }
888  }
889  vtk << "\n"
890  "</DataArray>\n";
891  }
892  vtk << "</PointData>\n"
893  "\n";
894  }
895  vtk << "<Cells>\n"
896  "<DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n";
897  for (const Cell& cell : cells)
898  {
899  for (auto point : cell.connectivity)
900  {
901  vtk << point << " ";
902  }
903  }
904  vtk << "</DataArray>\n"
905  "<DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n";
906  for (const Cell& cell : cells)
907  {
908  vtk << cell.offset << " ";
909  }
910  vtk << "</DataArray>\n"
911  "<DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n";
912  for (const Cell& cell : cells)
913  {
914  vtk << cell.type << " ";
915  }
916  vtk << "\n"
917  "</DataArray>\n"
918  "</Cells>\n"
919  "\n"
920  "</Piece>\n"
921  "</UnstructuredGrid>\n"
922  "</VTKFile>\n";
923  vtk.close();
924  logger(INFO, "Written %", vtkFileName);
925  }
int data[]
Definition: Map_placement_new.cpp:1
Definition: nodes.h:86
Definition: Qelements.h:1742
Definition: Telements.h:3728
#define isfinite(X)
Definition: main.h:111
squared absolute value
Definition: GlobalFunctions.h:87
void body_force(const double &time, const Vector< double > &x, Vector< double > &result)
Definition: axisym_linear_elasticity/cylinder/cylinder.cc:96
Real fabs(const Real &a)
Definition: boostmultiprec.cpp:117
type
Definition: compute_granudrum_aor.py:141

References b, Global_Parameters::body_force(), data, e(), ERROR, boost::multiprecision::fabs(), i, INFO, isfinite, j, logger, n, plotDoE::name, OOMPH_MPI_PROCESSOR_ID, s, calibrate::sigma, oomph::Global_string_for_annotation::string(), oomph::StringConversion::to_string(), compute_granudrum_aor::type, Eigen::value, and plotDoE::x.

Member Data Documentation

◆ body_force_fct

template<class ELEMENT_TYPE >
void(* SolidProblem< ELEMENT_TYPE >::body_force_fct) (const double &time, const Vector< double > &xi, Vector< double > &b) = nullptr
protected

Pointer to the body force function.

◆ constitutive_law_pt

template<class ELEMENT_TYPE >
ConstitutiveLaw* SolidProblem< ELEMENT_TYPE >::constitutive_law_pt = nullptr
protected

Pointer to constitutive law (should be set in constructor)

◆ density_

template<class ELEMENT_TYPE >
double SolidProblem< ELEMENT_TYPE >::density_ = 0
protected

Density.

◆ elasticModulus_

template<class ELEMENT_TYPE >
double SolidProblem< ELEMENT_TYPE >::elasticModulus_ = 0
protected

Elastic modulus (set via setSolid)

◆ gravity_

template<class ELEMENT_TYPE >
double SolidProblem< ELEMENT_TYPE >::gravity_ = 0
protected

Density.

◆ isPinned_

template<class ELEMENT_TYPE >
std::function<bool(SolidNode*, unsigned)> SolidProblem< ELEMENT_TYPE >::isPinned_
protected

Function to determine which nodal positions are pinned.

◆ name_

template<class ELEMENT_TYPE >
std::string SolidProblem< ELEMENT_TYPE >::name_
protected

◆ poissonRatio_

template<class ELEMENT_TYPE >
double SolidProblem< ELEMENT_TYPE >::poissonRatio_ = 0
protected

Poisson's ratio (set via setSolid)

◆ Solid_mesh_pt

template<class ELEMENT_TYPE >
SolidMesh* SolidProblem< ELEMENT_TYPE >::Solid_mesh_pt = nullptr
protected

Pointer to solid mesh.

◆ Traction_mesh_pt

template<class ELEMENT_TYPE >
SolidMesh* SolidProblem< ELEMENT_TYPE >::Traction_mesh_pt = nullptr
protected

Pointer to mesh of traction elements.


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