31 #include "time_harmonic_linear_elasticity.h"
34 #include "meshes/triangle_mesh.h"
37 using namespace oomph;
57 : GeomObject(1,2), R_start(r_start), R_end(r_end)
64 BrokenCopy::broken_copy(
"MyStraightLine");
70 BrokenCopy::broken_assign(
"MyStraightLine");
78 void position(
const Vector<double>& zeta, Vector<double>& r)
const
81 r[0] = R_start[0]+(R_end[0]-R_start[0])*zeta[0];
82 r[1] = R_start[1]+(R_end[1]-R_start[1])*zeta[0];
118 Vector<TimeHarmonicIsotropicElasticityTensor*>
E_pt;
131 const Vector<double> &n,
132 Vector<std::complex<double> >&traction)
134 double phi=atan2(x[1],x[0]);
135 double magnitude=exp(-
Alpha*pow(phi-0.25*MathematicalConstants::Pi,2));
137 unsigned dim = traction.size();
138 for(
unsigned i=0;i<dim;i++)
140 traction[i] = complex<double>(-magnitude*
P*n[i],magnitude*
P*n[i]);
154 template<
class ELASTICITY_ELEMENT>
170 void actions_before_adapt();
173 void actions_after_adapt();
181 void create_traction_elements();
184 void delete_traction_elements();
187 void complete_problem_setup();
222 template<
class ELASTICITY_ELEMENT>
230 Vector<double> r_start(2);
231 Vector<double> r_end(2);
234 double r_outer = 1.0;
240 double rib_thick=0.05;
243 double rib_depth=0.2;
252 double half_phi_rib=asin(0.5*rib_thick/r_inner);
255 TriangleMeshClosedCurve* closed_curve_pt=0;
258 Vector<TriangleMeshCurveSection*> curvilinear_boundary_pt;
262 Ellipse* outer_boundary_circle_pt =
new Ellipse(r_outer,r_outer);
263 double zeta_start=-0.5*MathematicalConstants::Pi;
264 double zeta_end=0.5*MathematicalConstants::Pi;
265 unsigned nsegment=50;
266 unsigned boundary_id=curvilinear_boundary_pt.size();
267 curvilinear_boundary_pt.push_back(
268 new TriangleMeshCurviLine(
269 outer_boundary_circle_pt,zeta_start,zeta_end,nsegment,boundary_id));
272 Outer_boundary_id=boundary_id;
285 boundary_id=curvilinear_boundary_pt.size();
286 curvilinear_boundary_pt.push_back(
287 new TriangleMeshCurviLine(
288 upper_sym_pt,zeta_start,zeta_end,nsegment,boundary_id));
291 Upper_symmetry_boundary_id=boundary_id;
295 Ellipse* upper_inner_boundary_pt =
296 new Ellipse(r_inner,r_inner);
297 zeta_start=0.5*MathematicalConstants::Pi;
298 zeta_end=half_phi_rib;
300 boundary_id=curvilinear_boundary_pt.size();
301 curvilinear_boundary_pt.push_back(
302 new TriangleMeshCurviLine(
303 upper_inner_boundary_pt,
304 zeta_start,zeta_end,nsegment,boundary_id));
308 r_start[0]=r_inner*cos(half_phi_rib);
309 r_start[1]=r_inner*sin(half_phi_rib);
310 r_end[0]=r_start[0]-rib_depth;
316 boundary_id=curvilinear_boundary_pt.size();
317 TriangleMeshCurviLine* upper_inward_rib_curviline_pt=
318 new TriangleMeshCurviLine(
319 upper_inward_rib_pt,zeta_start,zeta_end,nsegment,boundary_id);
320 curvilinear_boundary_pt.push_back(upper_inward_rib_curviline_pt);
327 r_end[1]=r_start[1]+0.5*(t_width-rib_thick);
332 boundary_id=curvilinear_boundary_pt.size();
333 curvilinear_boundary_pt.push_back(
334 new TriangleMeshCurviLine(
335 vertical_upper_t_rib_pt,zeta_start,zeta_end,nsegment,boundary_id));
342 r_end[0]=r_start[0]-t_thick;
348 boundary_id=curvilinear_boundary_pt.size();
349 curvilinear_boundary_pt.push_back(
350 new TriangleMeshCurviLine(
351 horizontal_upper_t_rib_pt,zeta_start,zeta_end,nsegment,boundary_id));
358 r_end[1]=-r_start[1];
363 boundary_id=curvilinear_boundary_pt.size();
364 curvilinear_boundary_pt.push_back(
365 new TriangleMeshCurviLine(
366 inner_vertical_rib_pt,zeta_start,zeta_end,nsegment,boundary_id));
373 r_end[0]=r_start[0]+t_thick;
379 boundary_id=curvilinear_boundary_pt.size();
380 curvilinear_boundary_pt.push_back(
381 new TriangleMeshCurviLine(
382 horizontal_lower_t_rib_pt,zeta_start,zeta_end,nsegment,boundary_id));
390 r_end[1]=r_start[1]+0.5*(t_width-rib_thick);
395 boundary_id=curvilinear_boundary_pt.size();
396 curvilinear_boundary_pt.push_back(
397 new TriangleMeshCurviLine(
398 vertical_lower_t_rib_pt,zeta_start,zeta_end,nsegment,boundary_id));
403 r_end[0]=r_inner*cos(half_phi_rib);
404 r_end[1]=-r_inner*sin(half_phi_rib);
405 r_start[0]=r_end[0]-rib_depth;
411 boundary_id=curvilinear_boundary_pt.size();
412 TriangleMeshCurviLine* lower_inward_rib_curviline_pt=
413 new TriangleMeshCurviLine(
414 lower_inward_rib_pt,zeta_start,zeta_end,nsegment,boundary_id);
415 curvilinear_boundary_pt.push_back(lower_inward_rib_curviline_pt);
420 Ellipse* lower_inner_boundary_circle_pt =
new Ellipse(r_inner,r_inner);
421 zeta_start=-half_phi_rib;
422 zeta_end=-0.5*MathematicalConstants::Pi;
424 boundary_id=curvilinear_boundary_pt.size();
425 curvilinear_boundary_pt.push_back(
426 new TriangleMeshCurviLine(
427 lower_inner_boundary_circle_pt,zeta_start,zeta_end,nsegment,boundary_id));
440 boundary_id=curvilinear_boundary_pt.size();
441 curvilinear_boundary_pt.push_back(
442 new TriangleMeshCurviLine(
443 lower_sym_pt,zeta_start,zeta_end,nsegment,boundary_id));
446 Lower_symmetry_boundary_id=boundary_id;
451 new TriangleMeshClosedCurve(curvilinear_boundary_pt);
455 Vector<TriangleMeshCurveSection*> internal_polyline_pt(1);
456 r_start[0]=r_inner*cos(half_phi_rib);
457 r_start[1]=r_inner*sin(half_phi_rib);
458 r_end[0]=r_inner*cos(half_phi_rib);
459 r_end[1]=-r_inner*sin(half_phi_rib);
461 Vector<Vector<double> > boundary_vertices(2);
462 boundary_vertices[0]=r_start;
463 boundary_vertices[1]=r_end;
465 TriangleMeshPolyLine* rib_divider_pt=
466 new TriangleMeshPolyLine(boundary_vertices,boundary_id);
467 internal_polyline_pt[0]=rib_divider_pt;
470 double s_connect=0.0;
471 internal_polyline_pt[0]->connect_initial_vertex_to_curviline(
472 upper_inward_rib_curviline_pt,s_connect);
476 internal_polyline_pt[0]->connect_final_vertex_to_curviline(
477 lower_inward_rib_curviline_pt,s_connect);
480 Vector<TriangleMeshOpenCurve*> inner_boundary_pt;
481 inner_boundary_pt.push_back(
new TriangleMeshOpenCurve(internal_polyline_pt));
484 Vector<double> rib_center(2);
485 rib_center[0]=r_inner-rib_depth;
495 TriangleMeshParameters triangle_mesh_parameters(closed_curve_pt);
498 triangle_mesh_parameters.element_area()=0.2;
501 triangle_mesh_parameters.internal_open_curves_pt()=inner_boundary_pt;
504 triangle_mesh_parameters.add_region_coordinates(1,rib_center);
510 RefineableTriangleMesh<ELASTICITY_ELEMENT>(triangle_mesh_parameters);
513 Solid_mesh_pt->spatial_error_estimator_pt()=
new Z2ErrorEstimator;
519 TriangleMesh<ELASTICITY_ELEMENT>(triangle_mesh_parameters);
525 Solid_mesh_pt->output(
"solid_mesh.dat");
526 Solid_mesh_pt->output_boundaries(
"solid_mesh_boundary.dat");
529 Traction_mesh_pt=
new Mesh;
530 create_traction_elements();
533 add_sub_mesh(Solid_mesh_pt);
536 add_sub_mesh(Traction_mesh_pt);
549 complete_problem_setup();
552 cout << assign_eqn_numbers() << std::endl;
565 template<
class ELASTICITY_ELEMENT>
572 if (!CommandLineArgs::command_line_flag_has_been_set(
"--validation"))
574 Solid_mesh_pt->min_element_size()=1.0e-5;
581 unsigned nreg=Solid_mesh_pt->nregion();
582 for (
unsigned r=0;r<nreg;r++)
584 unsigned nel=Solid_mesh_pt->nregion_element(r);
585 for (
unsigned e=0;e<nel;e++)
588 ELASTICITY_ELEMENT *el_pt =
589 dynamic_cast<ELASTICITY_ELEMENT*
>(Solid_mesh_pt->region_element_pt(r,e));
609 unsigned n_node = Solid_mesh_pt->nboundary_node(Upper_symmetry_boundary_id);
610 for(
unsigned i=0;i<n_node;i++)
612 Node* nod_pt=Solid_mesh_pt->boundary_node_pt(Upper_symmetry_boundary_id,i);
616 nod_pt->set_value(0,0.0);
620 nod_pt->set_value(2,0.0);
626 unsigned n_node = Solid_mesh_pt->nboundary_node(Lower_symmetry_boundary_id);
627 for(
unsigned i=0;i<n_node;i++)
629 Node* nod_pt=Solid_mesh_pt->boundary_node_pt(Lower_symmetry_boundary_id,i);
633 nod_pt->set_value(0,0.0);
637 nod_pt->set_value(2,0.0);
647 template<
class ELASTICITY_ELEMENT>
651 delete_traction_elements();
654 rebuild_global_mesh();
663 template<
class ELASTICITY_ELEMENT>
668 create_traction_elements();
671 rebuild_global_mesh();
674 complete_problem_setup();
682 template<
class ELASTICITY_ELEMENT>
686 unsigned b=Outer_boundary_id;
689 unsigned n_element = Solid_mesh_pt->nboundary_element(b);
692 for(
unsigned e=0;e<n_element;e++)
695 ELASTICITY_ELEMENT* bulk_elem_pt =
dynamic_cast<ELASTICITY_ELEMENT*
>(
696 Solid_mesh_pt->boundary_element_pt(b,e));
699 int face_index = Solid_mesh_pt->face_index_at_boundary(b,e);
702 TimeHarmonicLinearElasticityTractionElement<ELASTICITY_ELEMENT>* el_pt=
703 new TimeHarmonicLinearElasticityTractionElement<ELASTICITY_ELEMENT>
704 (bulk_elem_pt,face_index);
707 Traction_mesh_pt->add_element_pt(el_pt);
711 el_pt->set_boundary_number_in_bulk_mesh(b);
727 template<
class ELASTICITY_ELEMENT>
731 unsigned n_element = Traction_mesh_pt->nelement();
734 for(
unsigned e=0;e<n_element;e++)
737 delete Traction_mesh_pt->element_pt(e);
741 Traction_mesh_pt->flush_element_and_node_storage();
752 template<
class ELASTICITY_ELEMENT>
764 sprintf(filename,
"%s/elast_soln%i.dat",Doc_info.directory().c_str(),
766 some_file.open(filename);
767 Solid_mesh_pt->output(some_file,n_plot);
772 sprintf(filename,
"%s/traction_soln%i.dat",Doc_info.directory().c_str(),
774 some_file.open(filename);
775 Traction_mesh_pt->output(some_file,n_plot);
780 unsigned nreg=Solid_mesh_pt->nregion();
781 for (
unsigned r=0;r<nreg;r++)
783 sprintf(filename,
"%s/region%i_%i.dat",Doc_info.directory().c_str(),
784 r,Doc_info.number());
785 some_file.open(filename);
786 unsigned nel=Solid_mesh_pt->nregion_element(r);
787 for (
unsigned e=0;e<nel;e++)
789 FiniteElement* el_pt=Solid_mesh_pt->region_element_pt(r,e);
790 el_pt->output(some_file,n_plot);
797 sprintf(filename,
"%s/norm%i.dat",Doc_info.directory().c_str(),
799 some_file.open(filename);
801 unsigned nel=Solid_mesh_pt->nelement();
802 for (
unsigned e=0;e<nel;e++)
805 Solid_mesh_pt->compute_norm(el_norm);
808 some_file << norm << std::endl;
820 int main(
int argc,
char **argv)
824 CommandLineArgs::setup(argc,argv);
832 unsigned max_adapt=3;
833 CommandLineArgs::specify_command_line_flag(
"--max_adapt",&max_adapt);
838 CommandLineArgs::specify_command_line_flag(
"--alpha",
842 CommandLineArgs::specify_command_line_flag(
"--validation");
845 CommandLineArgs::parse_and_assign();
848 CommandLineArgs::doc_specified_flags();
854 <TTimeHarmonicLinearElasticityElement<2,3> > >
870 for(
unsigned i=0;i<nstep;i++)
877 problem.newton_solve(max_adapt);
882 problem.newton_solve();
887 problem.doc_solution();
////////////////////////////////////////////////////////////////////
Vector< double > R_start
Start point of line.
MyStraightLine(const Vector< double > &r_start, const Vector< double > &r_end)
Constructor: Pass start and end points.
MyStraightLine(const MyStraightLine &dummy)
Broken copy constructor.
void operator=(const MyStraightLine &)
Broken assignment operator.
~MyStraightLine()
Destructor: Empty.
void position(const Vector< double > &zeta, Vector< double > &r) const
Position Vector at Lagrangian coordinate zeta.
Vector< double > R_end
End point of line.
DocInfo Doc_info
DocInfo object for output.
void doc_solution()
Doc the solution.
void actions_after_newton_solve()
Update function (empty)
void actions_before_adapt()
Actions before adapt: Wipe the mesh of traction elements.
void complete_problem_setup()
Helper function to complete problem setup.
void actions_after_adapt()
Actions after adapt: Rebuild the mesh of traction elements.
unsigned Outer_boundary_id
Boundary ID of outer boundary.
RefineableTriangleMesh< ELASTICITY_ELEMENT > * Solid_mesh_pt
Pointer to refineable solid mesh.
unsigned Lower_symmetry_boundary_id
Boundary ID of lower symmetry boundary.
void actions_before_newton_solve()
Update function (empty)
void delete_traction_elements()
Delete traction elements.
Mesh * Traction_mesh_pt
Pointer to mesh of traction elements.
void create_traction_elements()
Create traction elements.
TriangleMesh< ELASTICITY_ELEMENT > * Solid_mesh_pt
Pointer to solid mesh.
RingWithTRibProblem()
Constructor:
unsigned Upper_symmetry_boundary_id
Boundary ID of upper symmetry boundary.
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
double H_annulus
Thickness of annulus.
void pressure_load(const Vector< double > &x, const Vector< double > &n, Vector< std::complex< double > > &traction)
Constant pressure load (real and imag part)
double Nu
Poisson's ratio.
string Directory
Output directory.
double P
Uniform pressure.
Vector< double > Omega_sq_region(2, Omega_sq)
Square of non-dim frequency for the two regions.
Vector< TimeHarmonicIsotropicElasticityTensor * > E_pt
The elasticity tensors for the two regions.
double Omega_sq
Square of non-dim frequency.
double Alpha
Peakiness parameter for pressure load.
int main(int argc, char **argv)
Driver for annular disk loaded by pressure.