37 #include "constitutive.h" 40 #include "meshes/rectangular_quadmesh.h" 44 using namespace oomph;
57 bool operator()(FiniteElement*
const& el1_pt, FiniteElement*
const& el2_pt)
60 return el1_pt->node_pt(0)->x(0) < el2_pt->node_pt(0)->x(0);
84 BrokenCopy::broken_copy(
"WarpedLine");
90 BrokenCopy::broken_assign(
"WarpedLine");
98 void position(
const Vector<double>& zeta, Vector<double>& r)
const 101 r[0] = zeta[0]+5.0*Ampl*zeta[0]*(zeta[0]-1.0)*(zeta[0]-0.7);
102 r[1] = 1.0+Ampl*0.5*(1.0-cos(2.0*MathematicalConstants::Pi*zeta[0]));
108 void position(
const unsigned& t,
const Vector<double>& zeta,
109 Vector<double>& r)
const 161 template<
class ELEMENT>
178 {
return Solid_mesh_pt;}
181 void actions_before_adapt();
184 void actions_after_adapt();
193 void create_lagrange_multiplier_elements();
197 void delete_lagrange_multiplier_elements();
214 template<
class ELEMENT>
233 solid_mesh_pt() =
new ElasticRefineableRectangularQuadMesh<ELEMENT>(
237 solid_mesh_pt()->spatial_error_estimator_pt()=
new Z2ErrorEstimator;
241 unsigned n_element =solid_mesh_pt()->nelement();
242 for(
unsigned i=0;i<n_element;i++)
245 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(solid_mesh_pt()->element_pt(i));
248 el_pt->constitutive_law_pt()=&Global_Physical_Variables::Constitutive_law;
252 solid_mesh_pt()->refine_uniformly();
256 Lagrange_multiplier_mesh_pt=
new SolidMesh;
257 create_lagrange_multiplier_elements();
260 add_sub_mesh(solid_mesh_pt());
263 add_sub_mesh(Lagrange_multiplier_mesh_pt);
269 for (
unsigned b=0;b<4;b++)
273 unsigned n_side = solid_mesh_pt()->nboundary_node(b);
276 for(
unsigned i=0;i<n_side;i++)
278 solid_mesh_pt()->boundary_node_pt(b,i)->pin_position(0);
279 solid_mesh_pt()->boundary_node_pt(b,i)->pin_position(1);
285 PVDEquationsBase<2>::pin_redundant_nodal_solid_pressures(
286 solid_mesh_pt()->element_pt());
289 cout <<
"Number of dofs: " << assign_eqn_numbers() << std::endl;
292 Doc_info.set_directory(
"RESLT");
301 template<
class ELEMENT>
305 delete_lagrange_multiplier_elements();
308 rebuild_global_mesh();
318 template<
class ELEMENT>
324 create_lagrange_multiplier_elements();
327 rebuild_global_mesh();
330 PVDEquationsBase<2>::pin_redundant_nodal_solid_pressures(
331 solid_mesh_pt()->element_pt());
340 template<
class ELEMENT>
348 unsigned n_element = solid_mesh_pt()->nboundary_element(b);
351 for(
unsigned e=0;e<n_element;e++)
354 ELEMENT* bulk_elem_pt =
dynamic_cast<ELEMENT*
>(
355 solid_mesh_pt()->boundary_element_pt(b,e));
358 int face_index = solid_mesh_pt()->face_index_at_boundary(b,e);
361 Lagrange_multiplier_mesh_pt->add_element_pt(
362 new ImposeDisplacementByLagrangeMultiplierElement<ELEMENT>(
363 bulk_elem_pt,face_index));
369 n_element=Lagrange_multiplier_mesh_pt->nelement();
370 for(
unsigned i=0;i<n_element;i++)
373 ImposeDisplacementByLagrangeMultiplierElement<ELEMENT> *el_pt =
374 dynamic_cast<ImposeDisplacementByLagrangeMultiplierElement<ELEMENT>*
> 375 (Lagrange_multiplier_mesh_pt->element_pt(i));
380 el_pt->set_boundary_shape_geom_object_pt(
384 unsigned nnod=el_pt->nnode();
385 for (
unsigned j=0;j<nnod;j++)
387 Node* nod_pt = el_pt->node_pt(j);
390 if ((nod_pt->is_on_boundary(1))||(nod_pt->is_on_boundary(3)))
394 unsigned n_bulk_value=el_pt->nbulk_value(j);
397 unsigned nval=nod_pt->nvalue();
398 for (
unsigned j=n_bulk_value;j<nval;j++)
415 template<
class ELEMENT>
419 unsigned n_element = Lagrange_multiplier_mesh_pt->nelement();
422 for(
unsigned e=0;e<n_element;e++)
425 delete Lagrange_multiplier_mesh_pt->element_pt(e);
429 Lagrange_multiplier_mesh_pt->flush_element_and_node_storage();
438 template<
class ELEMENT>
451 sprintf(filename,
"%s/soln%i.dat",Doc_info.directory().c_str(),
453 some_file.open(filename);
454 solid_mesh_pt()->output(some_file,n_plot);
459 sprintf(filename,
"%s/lagr%i.dat",Doc_info.directory().c_str(),
461 some_file.open(filename);
465 std::vector<FiniteElement*> el_pt;
466 unsigned nelem=Lagrange_multiplier_mesh_pt->nelement();
467 for (
unsigned e=0;e<nelem;e++)
469 el_pt.push_back(Lagrange_multiplier_mesh_pt->finite_element_pt(e));
472 for (
unsigned e=0;e<nelem;e++)
474 el_pt[e]->output(some_file);
498 unsigned max_adapt=1;
502 for(
unsigned i=0;i<nstep;i++)
509 problem.newton_solve(max_adapt);
void operator=(const WarpedLine &)
Broken assignment operator.
double Ampl
Amplitude of perturbation.
WarpedLine Boundary_geom_object(0.0)
GeomObject specifying the shape of the boundary: Initially it's flat.
void actions_after_newton_solve()
Update function (empty)
void actions_before_adapt()
Actions before adapt: Wipe the mesh of Lagrange multiplier elements.
void actions_before_newton_solve()
Update function (empty)
PrescribedBoundaryDisplacementProblem()
Constructor:
bool operator()(FiniteElement *const &el1_pt, FiniteElement *const &el2_pt) const
Comparison. Is x coordinate of el1_pt less than that of el2_pt?
void actions_after_adapt()
Actions after adapt: Rebuild the mesh of Lagrange multiplier elements.
ElasticRefineableRectangularQuadMesh< ELEMENT > *& solid_mesh_pt()
Access function for the solid mesh.
void doc_solution()
Doc the solution.
unsigned ngeom_data() const
How many items of Data does the shape of the object depend on? None.
double Nu
Poisson's ratio.
void delete_lagrange_multiplier_elements()
void position(const unsigned &t, const Vector< double > &zeta, Vector< double > &r) const
Parametrised position on object: r(zeta). Evaluated at previous timestep. t=0: current time; t>0: pre...
WarpedLine(const double &l)
Constructor: Specify amplitude of deflection from straight horizontal line.
double & ampl()
Access to amplitude.
void create_lagrange_multiplier_elements()
Create elements that enforce prescribed boundary motion by Lagrange multiplilers. ...
~WarpedLine()
Empty Destructor.
ElasticRefineableRectangularQuadMesh< ELEMENT > * Solid_mesh_pt
Pointer to solid mesh.
WarpedLine(const WarpedLine &dummy)
Broken copy constructor.
void position(const Vector< double > &zeta, Vector< double > &r) const
Position vector at Lagrangian coordinate zeta.
SolidMesh * Lagrange_multiplier_mesh_pt
Pointers to meshes of Lagrange multiplier elements.
DocInfo Doc_info
DocInfo object for output.