SheetGlueProblem< ELEMENT > Class Template Reference

Deformation of elastic pouch. More...

+ Inheritance diagram for SheetGlueProblem< ELEMENT >:

Public Member Functions

 SheetGlueProblem ()
 Constructor: More...
 
void run (const std::string &dirname)
 Run simulation. More...
 
void doc_solution (DocInfo &doc_info)
 Doc the solution. More...
 
void actions_after_newton_solve ()
 Update function (empty) More...
 
void create_traction_elements (SolidMesh *traction_mesh_pt, SolidMesh *solid_mesh_pt, const unsigned &b)
 Create traction elements. More...
 
void actions_before_newton_solve ()
 Update before solve: Empty. More...
 
 SheetGlueProblem ()
 Constructor: More...
 
void run (const std::string &dirname)
 Run simulation. More...
 
void doc_solution (DocInfo &doc_info)
 Doc the solution. More...
 
void actions_after_newton_solve ()
 Update function (empty) More...
 
void create_traction_elements (SolidMesh *traction_mesh_pt, SolidMesh *solid_mesh_pt, const unsigned &b)
 Create traction elements. More...
 
void actions_before_newton_solve ()
 Update before solve: Empty. More...
 

Private Member Functions

void get_unique_nodes_that_meet_sidewalls (const bool &on_left, std::set< SolidNode * > &unique_nodes)
 

Private Attributes

Vector< SolidMesh * > Solid_mesh_pt
 Pointers to solid meshes. More...
 
Vector< SolidMesh * > Traction_mesh_pt
 Pointers to meshes of traction elements. More...
 
GluedSolidMeshGlued_mesh_pt
 Glued mesh. More...
 

Detailed Description

template<class ELEMENT>
class SheetGlueProblem< ELEMENT >

Deformation of elastic pouch.

Constructor & Destructor Documentation

◆ SheetGlueProblem() [1/2]

template<class ELEMENT >
SheetGlueProblem< ELEMENT >::SheetGlueProblem

Constructor:

170  {
171 
172  bool glue_it = true;
173 
174  Problem::Max_newton_iterations = 20;
175 
176  // make space for meshes
177  unsigned n_mesh = 2;
178  Solid_mesh_pt.resize(n_mesh);
179  Traction_mesh_pt.resize(n_mesh);
180 
181  // How thick is the sheet?
182  double sheet_thickness = 0.1;
183 
184  // Sheet dimensions
185  double x_min = -sheet_thickness / 2.0;
186  double x_max = sheet_thickness / 2.0;
187  double y_min = -1.0;
188  double y_max = 1.0;
189  double z_min = -1.0;
190  double z_max = 1.0;
191 
192  // Elements
193  unsigned n_x = 2;
194  unsigned n_y = 5;
195  unsigned n_z = 5;
196 
197  // Width of glued layer:
198  double glue_layer_width_y = 2.0 / double(n_y);
199  double glue_layer_width_z = 2.0 / double(n_z);
200 
201 
202  // Create bulk meshes
203  for (unsigned i_mesh = 0; i_mesh < n_mesh; i_mesh++) {
204  //Now create the mesh
205  Solid_mesh_pt[i_mesh] = new SolidCubicMesh<ELEMENT>(n_x, n_y, n_z,
206  x_min, x_max,
207  y_min, y_max,
208  z_min, z_max);
209 
210  //Output boundaries
211  std::string filename = "mesh_boundaries" + to_string(i_mesh) + ".dat";
212  Solid_mesh_pt[i_mesh]->output_boundaries(filename);
213 
214  // Solid mesh is first sub-mesh
215  if (!glue_it) {
216  add_sub_mesh(Solid_mesh_pt[i_mesh]);
217  }
218 
219  //Loop over the elements in the mesh to set parameters/function pointers
220  unsigned n_element = Solid_mesh_pt[i_mesh]->nelement();
221  for (unsigned i = 0; i < n_element; i++) {
222  //Cast to a solid element
223  ELEMENT *el_pt =
224  dynamic_cast<ELEMENT *>(Solid_mesh_pt[i_mesh]->element_pt(i));
225 
226  // Set the constitutive law
227  el_pt->constitutive_law_pt() =
229  }
230 
231 
232  // Setup boundary conditions
233  //--------------------------
234 
235  // hierher: use
236  bool minimal_constraint = true;
237 
238  // Suppress rigid body modes by pinning six displacements
239  //--------------------------------------------------------
240  // at lower-left, etc. nodes on
241  //------------------------------
242  // const y face at the glued end of the first sheet
243  //-------------------------------------------------
244  if (i_mesh == 0) {
245 
246  unsigned b = 4;
247  SolidNode *ll_node_pt = Solid_mesh_pt[i_mesh]->boundary_node_pt(b, 0);
248  SolidNode *ur_node_pt = Solid_mesh_pt[i_mesh]->boundary_node_pt(b, 0);
249  SolidNode *ul_node_pt = Solid_mesh_pt[i_mesh]->boundary_node_pt(b, 0);
250  SolidNode *lr_node_pt = Solid_mesh_pt[i_mesh]->boundary_node_pt(b, 0);
251 
252  unsigned n_node = Solid_mesh_pt[i_mesh]->nboundary_node(b);
253  for (unsigned n = 0; n < n_node; n++) {
254  SolidNode *nod_pt = Solid_mesh_pt[i_mesh]->boundary_node_pt(b, n);
255  double y = nod_pt->x(1);
256  double z = nod_pt->x(2);
257  if ((y <= ll_node_pt->x(1)) && (z <= ll_node_pt->x(2))) {
258  ll_node_pt = nod_pt;
259  }
260  if ((y <= ul_node_pt->x(1)) && (z >= ul_node_pt->x(2))) {
261  ul_node_pt = nod_pt;
262  }
263  if ((y >= ur_node_pt->x(1)) && (z >= ur_node_pt->x(2))) {
264  ur_node_pt = nod_pt;
265  }
266  if ((y >= lr_node_pt->x(1)) && (z <= lr_node_pt->x(2))) {
267  lr_node_pt = nod_pt;
268  }
269  }
270 
271  // Note sharp deformation near ll node because it has to balance
272  // the entire z force exerted downwards by the pressure acting on the
273  // increasingly inflated pouch
274 
275  // Suppress rigid body motion
276  ll_node_pt->pin_position(0);
277  ll_node_pt->pin_position(1);
278  ll_node_pt->pin_position(2);
279 
280  // Suppress rotation about x and y axes
281  ul_node_pt->pin_position(0);
282  ul_node_pt->pin_position(1);
283 
284  // suppress rotation about z axis
285  lr_node_pt->pin_position(0);
286 
287  oomph_info << "Pinning at: \n"
288  << ll_node_pt->x(0) << " "
289  << ll_node_pt->x(1) << " "
290  << ll_node_pt->x(2) << "\n"
291  << ul_node_pt->x(0) << " "
292  << ul_node_pt->x(1) << " "
293  << ul_node_pt->x(2) << "\n"
294  << lr_node_pt->x(0) << " "
295  << lr_node_pt->x(1) << " "
296  << lr_node_pt->x(2) << "\n";
297 
298  }
299 
300  //######################################################################
301 
302 
303  // // y=0
304  // //----
305  // {
306  // unsigned b=1;
307  // unsigned n_node = Solid_mesh_pt[i_mesh]->nboundary_node(b);
308  // for(unsigned n=0;n<n_node;n++)
309  // {
310  // //Pin all nodes
311  // for(unsigned i=0;i<3;i++)
312  // {
313  // Solid_mesh_pt[i_mesh]->boundary_node_pt(b,n)->pin_position(i);
314  // }
315  // }
316  // }
317  // // y=1
318  // //----
319  // {
320  // unsigned b=3;
321  // unsigned n_node = Solid_mesh_pt[i_mesh]->nboundary_node(b);
322  // for(unsigned n=0;n<n_node;n++)
323  // {
324  // //Pin all nodes
325  // for(unsigned i=0;i<3;i++)
326  // {
327  // Solid_mesh_pt[i_mesh]->boundary_node_pt(b,n)->pin_position(i);
328  // }
329  // }
330  // }
331 
332  //######################################################################
333 
334  // Pin the redundant solid pressures
335  PVDEquationsBase<3>::pin_redundant_nodal_solid_pressures(
336  Solid_mesh_pt[i_mesh]->element_pt());
337  }
338 
339 
340  // Shift second sheet:
341  unsigned nnode = Solid_mesh_pt[1]->nnode();
342  for (unsigned j = 0; j < nnode; j++) {
343  Solid_mesh_pt[1]->node_pt(j)->x(0) += sheet_thickness;
344  }
345  Solid_mesh_pt[1]->set_lagrangian_nodal_coordinates();
346 
347 
348  if (glue_it) {
349  // Create glued mesh
351 
352 
353  // Select nodes to be glued:
354  //--------------------------
355 
356  // We retain them on mesh 0 where the glued
357  // nodes are on boundary 2
358  {
359  double tol = 1.0e-2;
360  unsigned i_mesh = 0;
361  unsigned b = 2;
362  unsigned n_node = Solid_mesh_pt[i_mesh]->nboundary_node(b);
363  oomph_info << "# of glue nodes: " << n_node << std::endl;
364  Vector<Node *> glue_node_pt;
365  glue_node_pt.reserve(n_node);
366  for (unsigned n = 0; n < n_node; n++) {
367  Node *potential_node_pt = Solid_mesh_pt[i_mesh]->boundary_node_pt(b, n);
368  if (
369  (potential_node_pt->x(1) < (y_min + glue_layer_width_y + tol)) ||
370  (potential_node_pt->x(1) > (y_max - glue_layer_width_y - tol)) ||
371  (potential_node_pt->x(2) < (z_min + glue_layer_width_z + tol))) {
372  glue_node_pt.push_back(potential_node_pt);
373  }
374  }
375 
376  // Glue specified nodes to co-located nodes in consituent mesh 1
377  unsigned i_mesh_replace = 1;
378  Glued_mesh_pt->glue(glue_node_pt, i_mesh_replace);
379 
380  // Add to global mesh
381  add_sub_mesh(Glued_mesh_pt);
382  }
383  } else {
384  Glued_mesh_pt = 0;
385  }
386 
387 
388  // Create traction meshes (attach to elements in still existing
389  //-------------------------------------------------------------
390  // original meshes)
391  //-----------------
392  for (unsigned i_mesh = 0; i_mesh < n_mesh; i_mesh++) {
393  // Make new mesh
394  Traction_mesh_pt[i_mesh] = new SolidMesh;
395 
396  // Create elements on x=1
397  unsigned b = 2;
398  if (i_mesh == 1) {
399  b = 4;
400  }
402 
403  // Add it!
404  add_sub_mesh(Traction_mesh_pt[i_mesh]);
405  }
406 
407 
408  // Build combined "global" mesh
409  build_global_mesh();
410 
411 
412  //Attach the boundary conditions to the mesh
413  cout << assign_eqn_numbers() << std::endl;
414 
415 }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:32
Definition: glued_mesh_stuff.h:20
void glue(const Vector< Node * > glue_node_pt, const unsigned &i_mesh_replace)
Definition: glued_mesh_stuff.h:72
Vector< SolidMesh * > Traction_mesh_pt
Pointers to meshes of traction elements.
Definition: TwenteMeshGluing.cpp:159
Vector< SolidMesh * > Solid_mesh_pt
Pointers to solid meshes.
Definition: TwenteMeshGluing.cpp:156
GluedSolidMesh * Glued_mesh_pt
Glued mesh.
Definition: TwenteMeshGluing.cpp:162
void create_traction_elements(SolidMesh *traction_mesh_pt, SolidMesh *solid_mesh_pt, const unsigned &b)
Create traction elements.
Definition: TwenteMeshGluing.cpp:116
Simple cubic mesh upgraded to become a solid mesh.
Definition: glued_mesh_stuff.h:208
ConstitutiveLaw * Constitutive_law_pt
Pointer to constitutive law.
Definition: TwenteMeshGluing.cpp:61
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51

References Global_Physical_Variables::Constitutive_law_pt, constants::i, and n.

◆ SheetGlueProblem() [2/2]

template<class ELEMENT >
SheetGlueProblem< ELEMENT >::SheetGlueProblem ( )

Constructor:

Member Function Documentation

◆ actions_after_newton_solve() [1/2]

template<class ELEMENT >
void SheetGlueProblem< ELEMENT >::actions_after_newton_solve ( )
inline

Update function (empty)

112 {}

◆ actions_after_newton_solve() [2/2]

template<class ELEMENT >
void SheetGlueProblem< ELEMENT >::actions_after_newton_solve ( )
inline

Update function (empty)

108 {}

◆ actions_before_newton_solve() [1/2]

template<class ELEMENT >
void SheetGlueProblem< ELEMENT >::actions_before_newton_solve ( )
inline

Update before solve: Empty.

151 {}

◆ actions_before_newton_solve() [2/2]

template<class ELEMENT >
void SheetGlueProblem< ELEMENT >::actions_before_newton_solve ( )
inline

Update before solve: Empty.

149 {}

◆ create_traction_elements() [1/2]

template<class ELEMENT >
void SheetGlueProblem< ELEMENT >::create_traction_elements ( SolidMesh traction_mesh_pt,
SolidMesh solid_mesh_pt,
const unsigned &  b 
)
inline

Create traction elements.

118  {
119  unsigned n_element = solid_mesh_pt->nboundary_element(b);
120  for (unsigned e = 0; e < n_element; e++) {
121  // The element itself:
122  FiniteElement *fe_pt = solid_mesh_pt->boundary_element_pt(b, e);
123 
124  // Find the index of the face of element e along boundary b
125  int face_index = solid_mesh_pt->face_index_at_boundary(b, e);
126 
127 
128  // Create new element
129  traction_mesh_pt->add_element_pt(
130  new SolidTractionElement<ELEMENT>
131  (fe_pt, face_index));
132 
133  }
134 
135  // Complete build process for SolidTractionElements
136  n_element = traction_mesh_pt->nelement();
137  for (unsigned i = 0; i < n_element; i++) {
138 
139  //Cast to a solid traction element
140  SolidTractionElement<ELEMENT> *el_pt =
141  dynamic_cast<SolidTractionElement<ELEMENT> *>
142  (traction_mesh_pt->element_pt(i));
143 
144  //Set the traction function
145  el_pt->traction_fct_pt() = Global_Physical_Variables::constant_pressure;
146  }
147 
148  }
void constant_pressure(const Vector< double > &xi, const Vector< double > &x, const Vector< double > &n, Vector< double > &traction)
Constant pressure load.
Definition: TwenteMeshGluing.cpp:76

References Global_Physical_Variables::constant_pressure(), and constants::i.

◆ create_traction_elements() [2/2]

template<class ELEMENT >
void SheetGlueProblem< ELEMENT >::create_traction_elements ( SolidMesh traction_mesh_pt,
SolidMesh solid_mesh_pt,
const unsigned &  b 
)
inline

Create traction elements.

114  {
115  unsigned n_element = solid_mesh_pt->nboundary_element(b);
116  for (unsigned e=0;e<n_element;e++)
117  {
118  // The element itself:
119  FiniteElement* fe_pt = solid_mesh_pt->boundary_element_pt(b,e);
120 
121  // Find the index of the face of element e along boundary b
122  int face_index = solid_mesh_pt->face_index_at_boundary(b,e);
123 
124  // Create new element
125  traction_mesh_pt->add_element_pt(
126  new SolidTractionElement<ELEMENT>
127  (fe_pt,face_index));
128 
129  }
130 
131  // Complete build process for SolidTractionElements
132  n_element=traction_mesh_pt->nelement();
133  for(unsigned i=0;i<n_element;i++)
134  {
135 
136  //Cast to a solid traction element
137  SolidTractionElement<ELEMENT> *el_pt =
138  dynamic_cast<SolidTractionElement<ELEMENT>*>
139  (traction_mesh_pt->element_pt(i));
140 
141  //Set the traction function
142  el_pt->traction_fct_pt() = Global_Physical_Variables::constant_pressure;
143  }
144 
145  }

References Global_Physical_Variables::constant_pressure(), and constants::i.

◆ doc_solution() [1/2]

template<class ELEMENT >
void SheetGlueProblem< ELEMENT >::doc_solution ( DocInfo &  doc_info)

Doc the solution.

422  {
423 
424  ofstream some_file;
425  char filename[100];
426 
427  // Number of plot points
428  unsigned npts = 5;
429 
430  // Output shape of deformed body
431  sprintf(filename, "%s/sol1n%i.dat", doc_info.directory().c_str(),
432  doc_info.number());
433  some_file.open(filename);
434  Solid_mesh_pt[0]->output(some_file, npts);
435  Solid_mesh_pt[1]->output(some_file, npts);
436  some_file.close();
437 
438  // Output traction
439  //----------------
440  sprintf(filename, "%s/traction%i.dat", doc_info.directory().c_str(),
441  doc_info.number());
442  some_file.open(filename);
443  Traction_mesh_pt[0]->output(some_file, npts);
444  Traction_mesh_pt[1]->output(some_file, npts);
445  some_file.close();
446 
447 
448  // Output glued mesh
449  //------------------
450  if (Glued_mesh_pt != 0) {
451  sprintf(filename, "%s/glued_sol1n%i.dat", doc_info.directory().c_str(),
452  doc_info.number());
453  some_file.open(filename);
454  Glued_mesh_pt->output(some_file, npts);
455  some_file.close();
456  }
457 
458 }

◆ doc_solution() [2/2]

template<class ELEMENT >
void SheetGlueProblem< ELEMENT >::doc_solution ( DocInfo &  doc_info)

Doc the solution.

◆ get_unique_nodes_that_meet_sidewalls()

template<class ELEMENT >
void SheetGlueProblem< ELEMENT >::get_unique_nodes_that_meet_sidewalls ( const bool on_left,
std::set< SolidNode * > &  unique_nodes 
)
inlineprivate

Helper function to get unique nodes of central sheets where they meet the sidewalls. This happens after the colocated nodes have been glued together, so visiting them through the boundary lookup schemes of the glued mesh's constituent meshes produces duplicates.

162  {
163 
164  // Wipe
165  unique_nodes.clear();
166 
167  // On left (min. y) or right (max. y)?
168  unsigned b=1;
169  if (!on_left)
170  {
171  b=3;
172  }
173 
174  // Populate set
175  for (unsigned i_mesh=0;i_mesh<4;i_mesh++)
176  {
177  unsigned n_node = Solid_mesh_pt[i_mesh]->nboundary_node(b);
178  for(unsigned n=0;n<n_node;n++)
179  {
180  unique_nodes.insert(Solid_mesh_pt[i_mesh]->boundary_node_pt(b,n));
181  }
182  }
183 
184  // oomph_info << "Unique nodes on ";
185  // if (on_left)
186  // {
187  // oomph_info << "left : ";
188  // }
189  // else
190  // {
191  // oomph_info << "right: ";
192  // }
193  // oomph_info << unique_nodes.size() << std::endl;
194 
195  }

References n.

◆ run() [1/2]

template<class ELEMENT >
void SheetGlueProblem< ELEMENT >::run ( const std::string &  dirname)

Run simulation.

Run the problem.

465  {
466 
467  // Output
468  DocInfo doc_info;
469 
470  // Set output directory
471  doc_info.set_directory(dirname);
472 
473  // Step number
474  doc_info.number() = 0;
475 
476  // Doc initial configuration
477  doc_solution(doc_info);
478  doc_info.number()++;
479 
480 
481  // Pressure increment
482  double dp = 0.0005;
483  Global_Physical_Variables::P = 0.0; // dp;
484 
485  //Parameter incrementation
486  unsigned nstep = 10;
487  if (CommandLineArgs::Argc != 1) {
488  std::cout << "Validation -- only doing one step" << std::endl;
489  nstep = 1;
490  }
491 
492  for (unsigned i = 0; i < nstep; i++) {
493 
494  // Solve the problem with Newton's method
495  newton_solve();
496 
497  // Doc solution
498  doc_solution(doc_info);
499  doc_info.number()++;
500 
501  //Increase the pressure
503  }
504 
505 }
void doc_solution(DocInfo &doc_info)
Doc the solution.
Definition: TwenteMeshGluing.cpp:422
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:73

References constants::i, and Global_Physical_Variables::P.

Referenced by main().

◆ run() [2/2]

template<class ELEMENT >
void SheetGlueProblem< ELEMENT >::run ( const std::string &  dirname)

Run simulation.

Member Data Documentation

◆ Glued_mesh_pt

template<class ELEMENT >
GluedSolidMesh * SheetGlueProblem< ELEMENT >::Glued_mesh_pt
private

Glued mesh.

◆ Solid_mesh_pt

template<class ELEMENT >
Vector< SolidMesh * > SheetGlueProblem< ELEMENT >::Solid_mesh_pt
private

Pointers to solid meshes.

◆ Traction_mesh_pt

template<class ELEMENT >
Vector< SolidMesh * > SheetGlueProblem< ELEMENT >::Traction_mesh_pt
private

Pointers to meshes of traction elements.


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