airy_cantilever2.cc
Go to the documentation of this file.
1 //LIC// ====================================================================
2 //LIC// This file forms part of oomph-lib, the object-oriented,
3 //LIC// multi-physics finite-element library, available
4 //LIC// at http://www.oomph-lib.org.
5 //LIC//
6 //LIC// Copyright (C) 2006-2023 Matthias Heil and Andrew Hazel
7 //LIC//
8 //LIC// This library is free software; you can redistribute it and/or
9 //LIC// modify it under the terms of the GNU Lesser General Public
10 //LIC// License as published by the Free Software Foundation; either
11 //LIC// version 2.1 of the License, or (at your option) any later version.
12 //LIC//
13 //LIC// This library is distributed in the hope that it will be useful,
14 //LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15 //LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 //LIC// Lesser General Public License for more details.
17 //LIC//
18 //LIC// You should have received a copy of the GNU Lesser General Public
19 //LIC// License along with this library; if not, write to the Free Software
20 //LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 //LIC// 02110-1301 USA.
22 //LIC//
23 //LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24 //LIC//
25 //LIC//====================================================================
26 //Driver for Airy cantilever beam problem
27 
28 //Oomph-lib includes
29 #include "generic.h"
30 #include "solid.h"
31 #include "constitutive.h"
32 
33 //The mesh
34 #include "meshes/rectangular_quadmesh.h"
35 
36 using namespace std;
37 
38 using namespace oomph;
39 
40 //#define REFINE
41 
42 namespace oomph
43 {
44 
45 //=================start_wrapper==================================
46 /// Wrapper class for solid elements to modify their output
47 /// functions.
48 //================================================================
49 template <class ELEMENT>
50 class MySolidElement : public virtual ELEMENT
51 {
52 
53 public:
54 
55  /// Constructor: Call constructor of underlying element
56  MySolidElement() : ELEMENT() {};
57 
58  /// Overload output function:
59  void output(std::ostream &outfile, const unsigned &n_plot)
60  {
61 
62  // Element dimension
63  unsigned el_dim = this->dim();
64 
65  Vector<double> s(el_dim);
66  Vector<double> x(el_dim);
67  DenseMatrix<double> sigma(el_dim,el_dim);
68 
69  switch(el_dim)
70  {
71 
72  case 2:
73 
74  //Tecplot header info
75  outfile << "ZONE I=" << n_plot << ", J=" << n_plot << std::endl;
76 
77  //Loop over element nodes
78  for(unsigned l2=0;l2<n_plot;l2++)
79  {
80  s[1] = -1.0 + l2*2.0/(n_plot-1);
81  for(unsigned l1=0;l1<n_plot;l1++)
82  {
83  s[0] = -1.0 + l1*2.0/(n_plot-1);
84 
85  // Get Eulerian coordinates and stress
86  this->interpolated_x(s,x);
87  this->get_stress(s,sigma);
88 
89  //Output the x,y,..
90  for(unsigned i=0;i<el_dim;i++)
91  {outfile << x[i] << " ";}
92 
93  // Output stress
94  outfile << sigma(0,0) << " "
95  << sigma(1,0) << " "
96  << sigma(1,1) << " "
97  << std::endl;
98  }
99  }
100 
101  break;
102 
103  default:
104 
105  std::ostringstream error_message;
106  error_message << "Output for dim !=2 not implemented" << std::endl;
107  throw OomphLibError(error_message.str(),
108  OOMPH_CURRENT_FUNCTION,
109  OOMPH_EXCEPTION_LOCATION);
110  }
111 
112  }
113 
114 };
115 
116 
117 
118 //===========start_face_geometry==============================================
119 /// FaceGeometry of wrapped element is the same as the underlying element
120 //============================================================================
121 template<class ELEMENT>
122 class FaceGeometry<MySolidElement<ELEMENT> > :
123  public virtual FaceGeometry<ELEMENT>
124 {
125 
126 public:
127 
128  /// Constructor [this was only required explicitly
129  /// from gcc 4.5.2 onwards...]
130  FaceGeometry() : FaceGeometry<ELEMENT>() {}
131 
132 };
133 
134 
135 }
136 
137 
138 
139 
140 
141 
142 /// ////////////////////////////////////////////////////////////////////
143 /// ////////////////////////////////////////////////////////////////////
144 /// ////////////////////////////////////////////////////////////////////
145 
146 
147 
148 //=======start_namespace==========================================
149 /// Global variables
150 //================================================================
152 {
153 
154  /// Pointer to strain energy function
155  StrainEnergyFunction*Strain_energy_function_pt;
156 
157  /// "Mooney Rivlin" coefficient for generalised Mooney Rivlin law
158  double C1=1.3;
159 
160  /// "Mooney Rivlin" coefficient for generalised Mooney Rivlin law
161  double C2=1.3;
162 
163  /// Half height of beam
164  double H=0.5;
165 
166  /// Length of beam
167  double L=10.0;
168 
169  /// Pointer to constitutive law
170  ConstitutiveLaw* Constitutive_law_pt;
171 
172  /// Elastic modulus
173  double E=1.0;
174 
175  /// Poisson's ratio
176  double Nu=0.3;
177 
178  /// Uniform pressure
179  double P = 0.0;
180 
181  /// Constant pressure load. The arguments to this function are imposed
182  /// on us by the SolidTractionElements which allow the traction to
183  /// depend on the Lagrangian and Eulerian coordinates x and xi, and on the
184  /// outer unit normal to the surface. Here we only need the outer unit
185  /// normal.
186  void constant_pressure(const Vector<double> &xi, const Vector<double> &x,
187  const Vector<double> &n, Vector<double> &traction)
188  {
189  unsigned dim = traction.size();
190  for(unsigned i=0;i<dim;i++)
191  {
192  traction[i] = -P*n[i];
193  }
194  } // end traction
195 
196 
197  /// Non-dim gravity
198  double Gravity=0.0;
199 
200  /// Non-dimensional gravity as body force
201  void gravity(const double& time,
202  const Vector<double> &xi,
203  Vector<double> &b)
204  {
205  b[0]=0.0;
206  b[1]=-Gravity;
207  }
208 
209 } //end namespace
210 
211 
212 
213 //=============begin_problem============================================
214 /// Problem class for the cantilever "beam" structure.
215 //======================================================================
216 template<class ELEMENT>
217 class CantileverProblem : public Problem
218 {
219 
220 public:
221 
222  /// Constructor:
223  CantileverProblem(const bool& incompress, const bool& use_fd);
224 
225  /// Update function (empty)
227 
228  /// Update function (empty)
230 
231 #ifdef REFINE
232 
233  /// Access function for the solid mesh
234  ElasticRefineableRectangularQuadMesh<ELEMENT>*& solid_mesh_pt()
235  {return Solid_mesh_pt;}
236 
237 #else
238 
239  /// Access function for the solid mesh
240  ElasticRectangularQuadMesh<ELEMENT>*& solid_mesh_pt()
241  {return Solid_mesh_pt;}
242 
243 #endif
244 
245 
246  /// Access function to the mesh of surface traction elements
247  SolidMesh*& traction_mesh_pt(){return Traction_mesh_pt;}
248 
249  /// Actions before adapt: Wipe the mesh of traction elements
251 
252  /// Actions after adapt: Rebuild the mesh of traction elements
254 
255  /// Doc the solution
256  void doc_solution();
257 
258  /// Run the job -- doc in RESLTi_case
259  void run_it(const unsigned& i_case);
260 
261 private:
262 
263  /// Pass pointer to traction function to the
264  /// elements in the traction mesh
266 
267  /// Create traction elements
269 
270  /// Delete traction elements
272 
273  /// Trace file
274  ofstream Trace_file;
275 
276  /// Pointers to node whose position we're tracing
277  Node* Trace_node_pt;
278 
279 
280 #ifdef REFINE
281 
282  /// Pointer to solid mesh
283  ElasticRefineableRectangularQuadMesh<ELEMENT>* Solid_mesh_pt;
284 
285 #else
286 
287  /// Pointer to solid mesh
288  ElasticRectangularQuadMesh<ELEMENT>* Solid_mesh_pt;
289 
290 #endif
291 
292 
293  /// Pointers to meshes of traction elements
294  SolidMesh* Traction_mesh_pt;
295 
296  /// DocInfo object for output
297  DocInfo Doc_info;
298 
299 };
300 
301 
302 //===========start_of_constructor=======================================
303 /// Constructor:
304 //======================================================================
305 template<class ELEMENT>
307  const bool& use_fd)
308 {
309 
310  // Create the mesh
311 
312  // # of elements in x-direction
313  unsigned n_x=20;
314 
315  // # of elements in y-direction
316  unsigned n_y=2;
317 
318  // Domain length in x-direction
319  double l_x= Global_Physical_Variables::L;
320 
321  // Domain length in y-direction
322  double l_y=2.0*Global_Physical_Variables::H;
323 
324  // Shift mesh downwards so that centreline is at y=0:
325  Vector<double> origin(2);
326  origin[0]=0.0;
327  origin[1]=-0.5*l_y;
328 
329 #ifdef REFINE
330 
331  //Now create the mesh
332  solid_mesh_pt() = new ElasticRefineableRectangularQuadMesh<ELEMENT>(
333  n_x,n_y,l_x,l_y,origin);
334 
335  // Set error estimator
336  dynamic_cast<ElasticRefineableRectangularQuadMesh<ELEMENT>* >(
337  solid_mesh_pt())->spatial_error_estimator_pt()=new Z2ErrorEstimator;
338 
339 #else
340 
341  //Now create the mesh
342  solid_mesh_pt() = new ElasticRectangularQuadMesh<ELEMENT>(
343  n_x,n_y,l_x,l_y,origin);
344 
345 #endif
346 
347 
348  //Assign the physical properties to the elements before any refinement
349  //Loop over the elements in the main mesh
350  unsigned n_element =solid_mesh_pt()->nelement();
351  for(unsigned i=0;i<n_element;i++)
352  {
353  //Cast to a solid element
354  ELEMENT *el_pt = dynamic_cast<ELEMENT*>(solid_mesh_pt()->element_pt(i));
355 
356  // Set the constitutive law
357  el_pt->constitutive_law_pt() =
359 
360  //Set the body force
361  el_pt->body_force_fct_pt() = Global_Physical_Variables::gravity;
362 
363  // Get Jacobian by FD?
364  if(use_fd)
365  {
366  el_pt->enable_evaluate_jacobian_by_fd();
367  }
368  else
369  {
370  el_pt->disable_evaluate_jacobian_by_fd();
371  }
372 
373  // Is it incompressible
374  if (incompress)
375  {
376  PVDEquationsWithPressure<2>* test_pt =
377  dynamic_cast<PVDEquationsWithPressure<2>*>(
378  solid_mesh_pt()->element_pt(i));
379  if (test_pt!=0)
380  {
381  test_pt->set_incompressible();
382  }
383  }
384  }
385 
386 
387  // Choose a control node: The last node in the solid mesh
388  unsigned nnod=solid_mesh_pt()->nnode();
389  Trace_node_pt=solid_mesh_pt()->node_pt(nnod-1);
390 
391 #ifdef REFINE
392 
393  // Refine the mesh uniformly
394  dynamic_cast<ElasticRefineableRectangularQuadMesh<ELEMENT>* >(
395  solid_mesh_pt())->refine_uniformly();
396 
397 #endif
398 
399  // Construct the traction element mesh
400  Traction_mesh_pt=new SolidMesh;
401  create_traction_elements();
402 
403  // Pass pointer to traction function to the elements
404  // in the traction mesh
405  set_traction_pt();
406 
407  // Solid mesh is first sub-mesh
408  add_sub_mesh(solid_mesh_pt());
409 
410  // Add traction sub-mesh
411  add_sub_mesh(traction_mesh_pt());
412 
413  // Build combined "global" mesh
414  build_global_mesh();
415 
416  // Pin the left boundary (boundary 3) in both directions
417  unsigned n_side = mesh_pt()->nboundary_node(3);
418 
419  //Loop over the nodes
420  for(unsigned i=0;i<n_side;i++)
421  {
422  solid_mesh_pt()->boundary_node_pt(3,i)->pin_position(0);
423  solid_mesh_pt()->boundary_node_pt(3,i)->pin_position(1);
424  }
425 
426 
427  // Pin the redundant solid pressures (if any)
428  PVDEquationsBase<2>::pin_redundant_nodal_solid_pressures(
429  solid_mesh_pt()->element_pt());
430 
431  //Attach the boundary conditions to the mesh
432  cout << assign_eqn_numbers() << std::endl;
433 
434 
435 } //end of constructor
436 
437 
438 //=====================start_of_actions_before_adapt======================
439 /// Actions before adapt: Wipe the mesh of traction elements
440 //========================================================================
441 template<class ELEMENT>
443 {
444  // Kill the traction elements and wipe surface mesh
445  delete_traction_elements();
446 
447  // Rebuild the Problem's global mesh from its various sub-meshes
448  rebuild_global_mesh();
449 
450 }// end of actions_before_adapt
451 
452 
453 
454 //=====================start_of_actions_after_adapt=======================
455 /// Actions after adapt: Rebuild the mesh of traction elements
456 //========================================================================
457 template<class ELEMENT>
459 {
460  // Create traction elements from all elements that are
461  // adjacent to boundary 2 and add them to surface meshes
462  create_traction_elements();
463 
464  // Rebuild the Problem's global mesh from its various sub-meshes
465  rebuild_global_mesh();
466 
467  // Pin the redundant solid pressures (if any)
468  PVDEquationsBase<2>::pin_redundant_nodal_solid_pressures(
469  solid_mesh_pt()->element_pt());
470 
471  // Set pointer to prescribed traction function for traction elements
472  set_traction_pt();
473 
474 }// end of actions_after_adapt
475 
476 
477 
478 //==================start_of_set_traction_pt==============================
479 /// Set pointer to traction function for the relevant
480 /// elements in the traction mesh
481 //========================================================================
482 template<class ELEMENT>
484 {
485  // Loop over the elements in the traction element mesh
486  // for elements on the top boundary (boundary 2)
487  unsigned n_element=traction_mesh_pt()->nelement();
488  for(unsigned i=0;i<n_element;i++)
489  {
490  //Cast to a solid traction element
491  SolidTractionElement<ELEMENT> *el_pt =
492  dynamic_cast<SolidTractionElement<ELEMENT>*>
493  (traction_mesh_pt()->element_pt(i));
494 
495  //Set the traction function
496  el_pt->traction_fct_pt() = Global_Physical_Variables::constant_pressure;
497  }
498 
499 }// end of set traction pt
500 
501 
502 
503 //============start_of_create_traction_elements==============================
504 /// Create traction elements
505 //=======================================================================
506 template<class ELEMENT>
508 {
509  // Traction elements are located on boundary 2:
510  unsigned b=2;
511 
512  // How many bulk elements are adjacent to boundary b?
513  unsigned n_element = solid_mesh_pt()->nboundary_element(b);
514 
515  // Loop over the bulk elements adjacent to boundary b?
516  for(unsigned e=0;e<n_element;e++)
517  {
518  // Get pointer to the bulk element that is adjacent to boundary b
519  ELEMENT* bulk_elem_pt = dynamic_cast<ELEMENT*>(
520  solid_mesh_pt()->boundary_element_pt(b,e));
521 
522  //Find the index of the face of element e along boundary b
523  int face_index = solid_mesh_pt()->face_index_at_boundary(b,e);
524 
525  // Create new element and add to mesh
526  Traction_mesh_pt->add_element_pt(new SolidTractionElement<ELEMENT>
527  (bulk_elem_pt,face_index));
528  }
529 
530  // Pass the pointer to the traction function to the traction elements
531  set_traction_pt();
532 
533 } // end of create_traction_elements
534 
535 
536 
537 
538 //============start_of_delete_traction_elements==============================
539 /// Delete traction elements and wipe the traction meshes
540 //=======================================================================
541 template<class ELEMENT>
543 {
544  // How many surface elements are in the surface mesh
545  unsigned n_element = Traction_mesh_pt->nelement();
546 
547  // Loop over the surface elements
548  for(unsigned e=0;e<n_element;e++)
549  {
550  // Kill surface element
551  delete Traction_mesh_pt->element_pt(e);
552  }
553 
554  // Wipe the mesh
555  Traction_mesh_pt->flush_element_and_node_storage();
556 
557 } // end of delete_traction_elements
558 
559 
560 
561 //==============start_doc===========================================
562 /// Doc the solution
563 //==================================================================
564 template<class ELEMENT>
566 {
567 
568  ofstream some_file;
569  char filename[100];
570 
571  // Number of plot points
572  unsigned n_plot = 5;
573 
574  // Output shape of and stress in deformed body
575  //--------------------------------------------
576  sprintf(filename,"%s/soln%i.dat",Doc_info.directory().c_str(),
577  Doc_info.number());
578  some_file.open(filename);
579  solid_mesh_pt()->output(some_file,n_plot);
580  some_file.close();
581 
582 
583  // Output St. Venant solution
584  //---------------------------
585  sprintf(filename,"%s/exact_soln%i.dat",Doc_info.directory().c_str(),
586  Doc_info.number());
587  some_file.open(filename);
588 
589  // Element dimension
590  unsigned el_dim=2;
591 
592  Vector<double> s(el_dim);
593  Vector<double> x(el_dim);
594  Vector<double> xi(el_dim);
595  DenseMatrix<double> sigma(el_dim,el_dim);
596 
597  // Constants for exact (St. Venant) solution
598  double a=-1.0/4.0*Global_Physical_Variables::P;
600  double c=1.0/8.0*Global_Physical_Variables::P/
603 
604  // Loop over all elements to plot exact solution for stresses
605  unsigned nel=solid_mesh_pt()->nelement();
606  for (unsigned e=0;e<nel;e++)
607  {
608  // Get pointer to element
609  ELEMENT* el_pt=dynamic_cast<ELEMENT*>(
610  solid_mesh_pt()->element_pt(e));
611 
612  //Tecplot header info
613  some_file << "ZONE I=" << n_plot << ", J=" << n_plot << std::endl;
614 
615  //Loop over plot points
616  for(unsigned l2=0;l2<n_plot;l2++)
617  {
618  s[1] = -1.0 + l2*2.0/(n_plot-1);
619  for(unsigned l1=0;l1<n_plot;l1++)
620  {
621  s[0] = -1.0 + l1*2.0/(n_plot-1);
622 
623  // Get Eulerian and Lagrangian coordinates
624  el_pt->interpolated_x(s,x);
625  el_pt->interpolated_xi(s,xi);
626 
627  //Output the x,y,..
628  for(unsigned i=0;i<el_dim;i++)
629  {some_file << x[i] << " ";}
630 
631  // Change orientation of coordinate system relative
632  // to solution in lecture notes
633  double xx=Global_Physical_Variables::L-xi[0];
634  double yy=xi[1];
635 
636  // Approximate analytical (St. Venant) solution
637  sigma(0,0)=c*(6.0*xx*xx*yy-4.0*yy*yy*yy)+
638  6.0*d*yy;
639  sigma(1,1)=2.0*(a+b*yy+c*yy*yy*yy);
640  sigma(1,0)=2.0*(b*xx+3.0*c*xx*yy*yy);
641  sigma(0,1)=sigma(1,0);
642 
643  // Output stress
644  some_file << sigma(0,0) << " "
645  << sigma(1,0) << " "
646  << sigma(1,1) << " "
647  << std::endl;
648  }
649  }
650  }
651  some_file.close();
652 
653  // Write trace file: Load/displacement characteristics
654  Trace_file << Global_Physical_Variables::P << " "
655  << Trace_node_pt->x(0) << " "
656  << Trace_node_pt->x(1) << " "
657  << std::endl;
658 
659  // Increment label for output files
660  Doc_info.number()++;
661 
662 } //end doc
663 
664 
665 
666 
667 
668 //==============start_run_it========================================
669 /// Run it
670 //==================================================================
671 template<class ELEMENT>
672 void CantileverProblem<ELEMENT>::run_it(const unsigned& i_case)
673 {
674 
675 #ifdef TIME_SOLID_JAC
676  PVDEquationsBase<2>::Solid_timer.reset();
677 #endif
678 
679  // Set output directory
680  char dirname[100];
681 
682 #ifdef REFINE
683  sprintf(dirname,"RESLT_refine%i",i_case);
684 #else
685  sprintf(dirname,"RESLT_norefine%i",i_case);
686 #endif
687 
688  Doc_info.set_directory(dirname);
689 
690  // Open trace file
691  char filename[100];
692  sprintf(filename,"%s/trace.dat",Doc_info.directory().c_str());
693  Trace_file.open(filename);
694 
695 
696  // Doc solution
697  doc_solution();
698 
699  // Initial values for parameter values
702 
703  //Parameter incrementation
704  unsigned nstep=1;
705  double p_increment=1.0e-5;
706  for(unsigned i=0;i<nstep;i++)
707  {
708  // Increment pressure load
709  Global_Physical_Variables::P+=p_increment;
710 
711  // Solve the problem with Newton's method, allowing
712  // up to max_adapt mesh adaptations after every solve.
713 
714 #ifdef REFINE
715 
716  // Max. number of adaptations per solve
717  unsigned max_adapt=1;
718 
719  newton_solve(max_adapt);
720 
721 #else
722 
723  newton_solve();
724 
725 #endif
726 
727  // Doc solution
728  doc_solution();
729 
730  }
731 
732 #ifdef TIME_SOLID_JAC
733 
734  std::cout << "Total fill_in... : "
735  << PVDEquationsBase<2>::Solid_timer.cumulative_time(0)
736  << std::endl;
737 
738  std::cout << "Total d_stress_dG: "
739  << PVDEquationsBase<2>::Solid_timer.cumulative_time(1)
740  << std::endl;
741 
742  std::cout << "Total Jac : "
743  << PVDEquationsBase<2>::Solid_timer.cumulative_time(2)
744  << std::endl;
745 
746  PVDEquationsBase<2>::Solid_timer.reset();
747 
748 #endif
749 
750 }
751 
752 
753 //=======start_of_main==================================================
754 /// Driver for cantilever beam loaded by surface traction and/or
755 /// gravity
756 //======================================================================
757 int main()
758 {
759 
760  bool use_fd=false;
761 
762  // Is the material incomressible
763  bool incompress=false;
764 
765  // Number of cases per implementation
766  unsigned ncase=5;
767 
768 
769  // Loop over fd and analytical implementation
770  for (unsigned i=0;i<2;i++)
771  {
772 
773  // Generalised Hookean constitutive equations
774  //-------------------------------------------
775  {
777  new GeneralisedHookean(&Global_Physical_Variables::Nu,
779 
780  incompress=false;
781 
782 #ifdef REFINE
783  {
784  //Set up the problem with pure displacement based elements
786  problem(incompress,use_fd);
787 
788  problem.run_it(0+i*ncase);
789  }
790 #else
791  {
792  //Set up the problem with pure displacement based elements
794  problem(incompress,use_fd);
795 
796  problem.run_it(0+i*ncase);
797  }
798 #endif
799 
800 
801 #ifdef REFINE
802  {
803  //Set up the problem with continous pressure/displacement
805  RefineableQPVDElementWithContinuousPressure<2> > >
806  problem(incompress,use_fd);
807 
808  problem.run_it(1+i*ncase);
809  }
810 #else
811  {
812  //Set up the problem with continous pressure/displacement
814  QPVDElementWithContinuousPressure<2> > >
815  problem(incompress,use_fd);
816 
817  problem.run_it(1+i*ncase);
818  }
819 #endif
820 
821 
822 #ifdef REFINE
823  {
824  //Set up the problem with discontinous pressure/displacement
826  RefineableQPVDElementWithPressure<2> > > problem(incompress,use_fd);
827 
828  problem.run_it(2+i*ncase);
829  }
830 #else
831  {
832  //Set up the problem with discontinous pressure/displacement
834  QPVDElementWithPressure<2> > > problem(incompress,use_fd);
835 
836  problem.run_it(2+i*ncase);
837  }
838 #endif
839 
842  }
843 
844 
845 
846  // Incompressible Mooney Rivlin
847  //-----------------------------
848  {
850  new MooneyRivlin(&Global_Physical_Variables::C1,
852 
853  // Define a constitutive law (based on strain energy function)
855  new IsotropicStrainEnergyFunctionConstitutiveLaw(
857 
858  incompress=true;
859 
860 
861 #ifdef REFINE
862  {
863  //Set up the problem with continous pressure/displacement
865  RefineableQPVDElementWithContinuousPressure<2> > >
866  problem(incompress,use_fd);
867 
868  problem.run_it(3+i*ncase);
869  }
870 #else
871  {
872  //Set up the problem with continous pressure/displacement
874  QPVDElementWithContinuousPressure<2> > >
875  problem(incompress,use_fd);
876 
877  problem.run_it(3+i*ncase);
878  }
879 #endif
880 
881 
882 
883 #ifdef REFINE
884  {
885  //Set up the problem with discontinous pressure/displacement
887  RefineableQPVDElementWithPressure<2> > >
888  problem(incompress,use_fd);
889 
890  problem.run_it(4+i*ncase);
891  }
892 #else
893  {
894  //Set up the problem with discontinous pressure/displacement
896  QPVDElementWithPressure<2> > >
897  problem(incompress,use_fd);
898 
899  problem.run_it(4+i*ncase);
900  }
901 #endif
902 
905 
908  }
909 
910 
911  use_fd=true;
912  std::cout << "\n\n\n CR Total fill_in... : bla \n\n\n " << std::endl;
913 
914  }
915 
916 } //end of main
917 
918 
919 
920 
921 
922 
923 
924 
int main()
Driver for cantilever beam loaded by surface traction and/or gravity.
Problem class for the cantilever "beam" structure.
ElasticRefineableRectangularQuadMesh< ELEMENT > *& solid_mesh_pt()
Access function for the solid mesh.
void actions_before_newton_solve()
Update function (empty)
void actions_after_newton_solve()
Update function (empty)
void actions_before_adapt()
Actions before adapt: Wipe the mesh of traction elements.
void run_it(const unsigned &i_case)
Run the job – doc in RESLTi_case.
ElasticRectangularQuadMesh< ELEMENT > *& solid_mesh_pt()
Access function for the solid mesh.
void doc_solution()
Doc the solution.
void set_traction_pt()
Pass pointer to traction function to the elements in the traction mesh.
void create_traction_elements()
Create traction elements.
CantileverProblem()
Constructor:
void delete_traction_elements()
Delete traction elements.
ElasticRectangularQuadMesh< ELEMENT > * Solid_mesh_pt
Pointer to solid mesh.
void actions_after_adapt()
Actions after adapt: Rebuild the mesh of traction elements.
SolidMesh *& traction_mesh_pt()
Access function to the mesh of surface traction elements.
FaceGeometry()
Constructor [this was only required explicitly from gcc 4.5.2 onwards...].
Wrapper class for solid elements to modify their output functions.
void output(std::ostream &outfile, const unsigned &n_plot)
Overload output function:
MySolidElement()
Constructor: Call constructor of underlying element.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
void gravity(const double &time, const Vector< double > &xi, Vector< double > &b)
Non-dimensional gravity as body force.
double E
Elastic modulus.
void constant_pressure(const Vector< double > &xi, const Vector< double > &x, const Vector< double > &n, Vector< double > &traction)
Constant pressure load. The arguments to this function are imposed on us by the SolidTractionElements...
double L
Length of beam.
double P
Uniform pressure.
double Nu
Poisson's ratio.
ConstitutiveLaw * Constitutive_law_pt
Pointer to constitutive law.
StrainEnergyFunction * Strain_energy_function_pt
Pointer to strain energy function.
double C1
"Mooney Rivlin" coefficient for generalised Mooney Rivlin law
double Gravity
Non-dim gravity.
double H
Half height of beam.
double C2
"Mooney Rivlin" coefficient for generalised Mooney Rivlin law