40 #include "meshes/one_d_lagrangian_mesh.h" 44 using namespace oomph;
69 const Vector<double> &x,
70 const Vector<double>& N,
73 for(
unsigned i=0;i<2;i++)
75 load[i] = (Pext_data_pt->value(0)-Pcos*cos(2.0*xi[0]))*N[i];
84 {
return *Pext_data_pt->value_pt(0);}
100 template<
class ELEMENT>
110 bool& load_data_already_exists);
115 return dynamic_cast<OneDLagrangianMesh<ELEMENT>*
>(Problem::mesh_pt());
125 void doc_solution(DocInfo& doc_info, ofstream& trace_file);
128 void parameter_study(DocInfo& doc_info);
152 template<
class ELEMENT>
154 (
const unsigned& n_element,
bool& displ_control,
bool& load_data_already_exists) :
155 Displ_control(displ_control),Nbeam_element(n_element)
159 Undef_geom_pt=
new Ellipse(1.0,1.0);
162 double length=2.0*atan(1.0);
166 new OneDLagrangianMesh<ELEMENT>(n_element,length,Undef_geom_pt);
173 mesh_pt()->boundary_node_pt(ibound,0)->pin_position(1);
175 mesh_pt()->boundary_node_pt(ibound,0)->pin_position(1,0);
180 mesh_pt()->boundary_node_pt(ibound,0)->pin_position(0);
182 mesh_pt()->boundary_node_pt(ibound,0)->pin_position(1,1);
201 SolidFiniteElement* controlled_element_pt=
202 dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(Nbeam_element-1));
205 unsigned controlled_direction=1;
208 Vector<double> s_displ_control(1);
209 s_displ_control[0]=1.0;
212 DisplacementControlElement* displ_control_el_pt;
216 if (!load_data_already_exists)
220 new DisplacementControlElement(controlled_element_pt,
222 controlled_direction,
229 displacement_control_load_pt();
248 new DisplacementControlElement(controlled_element_pt,
250 controlled_direction,
256 mesh_pt()->add_element_pt(displ_control_el_pt);
263 for(
unsigned i=0;i<Nbeam_element;i++)
266 ELEMENT *elem_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(i));
275 elem_pt->undeformed_beam_pt() = Undef_geom_pt;
289 cout <<
"# of dofs " << assign_eqn_numbers() << std::endl;
297 template<
class ELEMENT>
299 ofstream& trace_file)
308 sprintf(filename,
"%s/ring%i.dat",doc_info.directory().c_str(),
310 some_file.open(filename);
311 mesh_pt()->output(some_file,npts);
315 Vector<double> s_left(1);
317 Vector<double> s_right(1);
325 <<
dynamic_cast<ELEMENT*
>(mesh_pt()->
326 element_pt(0))->interpolated_x(s_left,0)
328 <<
dynamic_cast<ELEMENT*
> 329 (mesh_pt()->element_pt(Nbeam_element-1))->interpolated_x(s_right,1)
340 template<
class ELEMENT>
346 sprintf(filename,
"%s/trace.dat",doc_info.directory().c_str());
347 ofstream trace_file(filename);
348 trace_file <<
"VARIABLES=\"p_e_x_t\",\"R_1\",\"R_2\"" << std::endl;
349 trace_file <<
"ZONE" << std::endl;
352 doc_solution(doc_info,trace_file);
358 double displ_increment=1.0/double(nstep-1);
361 double pext_increment=(p_owc-p_buckl)/
double(nstep-1);
374 Max_newton_iterations=100;
387 for(
unsigned i=1;i<=nstep;i++)
407 doc_solution(doc_info,trace_file);
420 trace_file <<
"ZONE" << std::endl;
424 for(
unsigned i=nstep;i<2*nstep;i++)
444 doc_solution(doc_info,trace_file);
463 unsigned n_element = 13;
466 bool displ_control=
true;
474 bool load_data_already_exists=
true;
478 problem(n_element,displ_control,load_data_already_exists);
481 doc_info.set_directory(
"RESLT_global");
490 bool load_data_already_exists=
false;
494 problem(n_element,displ_control,load_data_already_exists);
497 doc_info.set_directory(
"RESLT_no_global");
double Pcos
Perturbation pressure.
bool Displ_control
Use displacement control?
int main()
Driver for ring test problem.
GeomObject * Undef_geom_pt
Pointer to geometric object that represents the undeformed shape.
double & external_pressure()
Return a reference to the external pressure load on the elastic ring. A reference is obtained by de-r...
void actions_before_newton_solve()
Update function is empty.
unsigned Nbeam_element
Number of elements in the beam mesh.
void press_load(const Vector< double > &xi, const Vector< double > &x, const Vector< double > &N, Vector< double > &load)
Load function: Constant external pressure with cos variation to induce buckling in n=2 mode...
OneDLagrangianMesh< ELEMENT > * mesh_pt()
Access function for the specific mesh.
Data * Pext_data_pt
Pointer to pressure load (stored in Data so it can become an unknown in the problem when displacement...
void actions_after_newton_solve()
Update function is empty.
Namespace for physical parameters.
double H
Nondim thickness.
void parameter_study(DocInfo &doc_info)
Perform the parameter study.
void doc_solution(DocInfo &doc_info, ofstream &trace_file)
Doc solution.
ElasticRingProblem(const unsigned &n_element, bool &displ_control, bool &load_data_already_exists)
Constructor for elastic ring problem.
double Xprescr
Prescribed position (only used for displacement control)