shock_disk.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// Version 1.0; svn revision $LastChangedRevision$
7 //LIC//
8 //LIC// $LastChangedDate$
9 //LIC//
10 //LIC// Copyright (C) 2006-2016 Matthias Heil and Andrew Hazel
11 //LIC//
12 //LIC// This library is free software; you can redistribute it and/or
13 //LIC// modify it under the terms of the GNU Lesser General Public
14 //LIC// License as published by the Free Software Foundation; either
15 //LIC// version 2.1 of the License, or (at your option) any later version.
16 //LIC//
17 //LIC// This library is distributed in the hope that it will be useful,
18 //LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 //LIC// Lesser General Public License for more details.
21 //LIC//
22 //LIC// You should have received a copy of the GNU Lesser General Public
23 //LIC// License along with this library; if not, write to the Free Software
24 //LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 //LIC// 02110-1301 USA.
26 //LIC//
27 //LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
28 //LIC//
29 //LIC//====================================================================
30 // Driver for large-displacement elasto-dynamic test problem:
31 // Circular disk impulsively loaded by compressive load.
32 
33 #include <iostream>
34 #include <fstream>
35 #include <cmath>
36 
37 //My own includes
38 #include "generic.h"
39 #include "solid.h"
40 
41 //Need to instantiate templated mesh
42 #include "meshes/quarter_circle_sector_mesh.h"
43 
44 using namespace std;
45 
46 using namespace oomph;
47 
48 ///////////////////////////////////////////////////////////////////////
49 ///////////////////////////////////////////////////////////////////////
50 ///////////////////////////////////////////////////////////////////////
51 
52 
53 //================================================================
54 /// Global variables
55 //================================================================
57 {
58  /// Pointer to constitutive law
59  ConstitutiveLaw* Constitutive_law_pt;
60 
61  /// Elastic modulus
62  double E=1.0;
63 
64  /// Poisson's ratio
65  double Nu=0.3;
66 
67  /// Uniform pressure
68  double P = 0.00;
69 
70  /// Constant pressure load
71  void constant_pressure(const Vector<double> &xi,const Vector<double> &x,
72  const Vector<double> &n, Vector<double> &traction)
73  {
74  unsigned dim = traction.size();
75  for(unsigned i=0;i<dim;i++)
76  {
77  traction[i] = -P*n[i];
78  }
79  }
80 
81 }
82 
83 
84 
85 ///////////////////////////////////////////////////////////////////////
86 ///////////////////////////////////////////////////////////////////////
87 ///////////////////////////////////////////////////////////////////////
88 
89 
90 
91 //================================================================
92 /// Elastic quarter circle sector mesh with functionality to
93 /// attach traction elements to the curved surface. We "upgrade"
94 /// the RefineableQuarterCircleSectorMesh to become an
95 /// SolidMesh and equate the Eulerian and Lagrangian coordinates,
96 /// thus making the domain represented by the mesh the stress-free
97 /// configuration.
98 /// \n\n
99 /// The member function \c make_traction_element_mesh() creates
100 /// a separate mesh of SolidTractionElements that are attached to the
101 /// mesh's curved boundary (boundary 1).
102 //================================================================
103 template <class ELEMENT>
105  public virtual RefineableQuarterCircleSectorMesh<ELEMENT>,
106  public virtual SolidMesh
107 {
108 
109 
110 public:
111 
112  /// \short Constructor: Build mesh and copy Eulerian coords to Lagrangian
113  /// ones so that the initial configuration is the stress-free one.
115  const double& xi_lo,
116  const double& fract_mid,
117  const double& xi_hi,
118  TimeStepper* time_stepper_pt=
119  &Mesh::Default_TimeStepper) :
120  RefineableQuarterCircleSectorMesh<ELEMENT>(wall_pt,xi_lo,fract_mid,xi_hi,
121  time_stepper_pt)
122  {
123 #ifdef PARANOID
124  /// Check that the element type is derived from the SolidFiniteElement
125  SolidFiniteElement* el_pt=dynamic_cast<SolidFiniteElement*>
126  (finite_element_pt(0));
127  if (el_pt==0)
128  {
129  throw OomphLibError(
130  "Element needs to be derived from SolidFiniteElement\n",
131  OOMPH_CURRENT_FUNCTION,
132  OOMPH_EXCEPTION_LOCATION);
133  }
134 #endif
135 
136  // Make the current configuration the undeformed one by
137  // setting the nodal Lagrangian coordinates to their current
138  // Eulerian ones
139  set_lagrangian_nodal_coordinates();
140  }
141 
142 
143  /// Function to create mesh made of traction elements
144  void make_traction_element_mesh(SolidMesh*& traction_mesh_pt)
145  {
146 
147  // Make new mesh
148  traction_mesh_pt=new SolidMesh;
149 
150  // Loop over all elements on boundary 1:
151  unsigned b=1;
152  unsigned n_element = this->nboundary_element(b);
153  for (unsigned e=0;e<n_element;e++)
154  {
155  // The element itself:
156  FiniteElement* fe_pt = this->boundary_element_pt(b,e);
157 
158  // Find the index of the face of element e along boundary b
159  int face_index = this->face_index_at_boundary(b,e);
160 
161  // Create new element
162  traction_mesh_pt->add_element_pt(new SolidTractionElement<ELEMENT>
163  (fe_pt,face_index));
164  }
165  }
166 
167 
168  /// Function to wipe and re-create mesh made of traction elements
169  void remake_traction_element_mesh(SolidMesh*& traction_mesh_pt)
170  {
171 
172  // Wipe existing mesh (but don't call it's destructor as this
173  // would wipe all the nodes too!)
174  traction_mesh_pt->flush_element_and_node_storage();
175 
176  // Loop over all elements on boundary 1:
177  unsigned b=1;
178  unsigned n_element = this->nboundary_element(b);
179  for (unsigned e=0;e<n_element;e++)
180  {
181  // The element itself:
182  FiniteElement* fe_pt = this->boundary_element_pt(b,e);
183 
184  // Find the index of the face of element e along boundary b
185  int face_index = this->face_index_at_boundary(b,e);
186 
187  // Create new element
188  traction_mesh_pt->add_element_pt(new SolidTractionElement<ELEMENT>
189  (fe_pt,face_index));
190  }
191  }
192 
193 
194 };
195 
196 
197 
198 
199 
200 /////////////////////////////////////////////////////////////////////////
201 /////////////////////////////////////////////////////////////////////////
202 /////////////////////////////////////////////////////////////////////////
203 
204 
205 
206 //======================================================================
207 /// "Shock" wave propagates through an impulsively loaded
208 /// circular disk.
209 //======================================================================
210 template<class ELEMENT, class TIMESTEPPER>
211 class DiskShockWaveProblem : public Problem
212 {
213 
214 public:
215 
216  /// Constructor:
218 
219  /// \short Run the problem; specify case_number to label output
220  /// directory
221  void run(const unsigned& case_number);
222 
223  /// Access function for the solid mesh
225  {
226  return Solid_mesh_pt;
227  }
228 
229  /// Access function for the mesh of surface traction elements
230  SolidMesh*& traction_mesh_pt()
231  {
232  return Traction_mesh_pt;
233  }
234 
235  /// Doc the solution
236  void doc_solution();
237 
238  /// Update function (empty)
240 
241  /// Update function (empty)
243 
244  /// \short Actions after adaption: Kill and then re-build the traction
245  /// elements on boundary 1 and re-assign the equation numbers
246  void actions_after_adapt();
247 
248  /// \short Doc displacement and velocity: label file with before and after
249  void doc_displ_and_veloc(const int& stage=0);
250 
251  /// \short Dump problem-specific parameters values, then dump
252  /// generic problem data.
253  void dump_it(ofstream& dump_file);
254 
255  /// \short Read problem-specific parameter values, then recover
256  /// generic problem data.
257  void restart(ifstream& restart_file);
258 
259 private:
260 
261  // Output
262  DocInfo Doc_info;
263 
264  /// Trace file
265  ofstream Trace_file;
266 
267  /// Vector of pointers to nodes whose position we're tracing
268  Vector<Node*> Trace_node_pt;
269 
270  /// Pointer to solid mesh
272 
273  /// Pointer to mesh of traction elements
274  SolidMesh* Traction_mesh_pt;
275 
276 };
277 
278 
279 
280 
281 
282 //======================================================================
283 /// Constructor
284 //======================================================================
285 template<class ELEMENT, class TIMESTEPPER>
287 {
288 
289 
290  //Allocate the timestepper
291  add_time_stepper_pt(new TIMESTEPPER);
292 
293  // Set coordinates and radius for the circle that defines
294  // the outer curvilinear boundary of the domain
295  double x_c=0.0;
296  double y_c=0.0;
297  double r=1.0;
298 
299  // Build geometric object that specifies the fish back in the
300  // undeformed configuration (basically a deep copy of the previous one)
301  GeomObject* curved_boundary_pt=new Circle(x_c,y_c,r,time_stepper_pt());
302 
303  // The curved boundary of the mesh is defined by the geometric object
304  // What follows are the start and end coordinates on the geometric object:
305  double xi_lo=0.0;
306  double xi_hi=2.0*atan(1.0);
307 
308  // Fraction along geometric object at which the radial dividing line
309  // is placed
310  double fract_mid=0.5;
311 
312  //Now create the mesh
314  curved_boundary_pt,xi_lo,fract_mid,xi_hi,time_stepper_pt());
315 
316  // Set up trace nodes as the nodes on boundary 1 (=curved boundary) in
317  // the original mesh (they exist under any refinement!)
318  unsigned nnod0=solid_mesh_pt()->nboundary_node(0);
319  unsigned nnod1=solid_mesh_pt()->nboundary_node(1);
320  Trace_node_pt.resize(nnod0+nnod1);
321  for (unsigned j=0;j<nnod0;j++)
322  {
323  Trace_node_pt[j]=solid_mesh_pt()->boundary_node_pt(0,j);
324  }
325  for (unsigned j=0;j<nnod1;j++)
326  {
327  Trace_node_pt[j+nnod0]=solid_mesh_pt()->boundary_node_pt(1,j);
328  }
329 
330  // Build traction element mesh
331  solid_mesh_pt()->make_traction_element_mesh(traction_mesh_pt());
332 
333  // Solid mesh is first sub-mesh
334  add_sub_mesh(solid_mesh_pt());
335 
336  // Traction mesh is first sub-mesh
337  add_sub_mesh(traction_mesh_pt());
338 
339  // Build combined "global" mesh
340  build_global_mesh();
341 
342 
343  // Create/set error estimator
344  solid_mesh_pt()->spatial_error_estimator_pt()=new Z2ErrorEstimator;
345 
346  // Fiddle with adaptivity targets and doc
347  solid_mesh_pt()->max_permitted_error()=0.006; //0.03;
348  solid_mesh_pt()->min_permitted_error()=0.0006;// 0.0006; //0.003;
349  solid_mesh_pt()->doc_adaptivity_targets(cout);
350 
351  // Pin the bottom in the vertical direction
352  unsigned n_bottom = solid_mesh_pt()->nboundary_node(0);
353 
354  //Loop over the node
355  for(unsigned i=0;i<n_bottom;i++)
356  {
357  solid_mesh_pt()->boundary_node_pt(0,i)->pin_position(1);
358  }
359 
360  // Pin the left edge in the horizontal direction
361  unsigned n_side = solid_mesh_pt()->nboundary_node(2);
362  //Loop over the node
363  for(unsigned i=0;i<n_side;i++)
364  {
365  solid_mesh_pt()->boundary_node_pt(2,i)->pin_position(0);
366  }
367 
368  //Find number of elements in solid mesh
369  unsigned n_element =solid_mesh_pt()->nelement();
370 
371  //Set parameters and function pointers for solid elements
372  for(unsigned i=0;i<n_element;i++)
373  {
374  //Cast to a solid element
375  ELEMENT *el_pt = dynamic_cast<ELEMENT*>(mesh_pt()->element_pt(i));
376 
377  //Set the constitutive law
378  el_pt->constitutive_law_pt() =
380 
381  // Switch on inertia
382  el_pt->enable_inertia();
383  }
384 
385  // Pin the redundant solid pressures
386  PVDEquationsBase<2>::pin_redundant_nodal_solid_pressures(
387  solid_mesh_pt()->element_pt());
388 
389  //Find number of elements in traction mesh
390  n_element=traction_mesh_pt()->nelement();
391 
392  //Set function pointers for traction elements
393  for(unsigned i=0;i<n_element;i++)
394  {
395  //Cast to a solid traction element
396  SolidTractionElement<ELEMENT> *el_pt =
397  dynamic_cast<SolidTractionElement<ELEMENT>*>
398  (traction_mesh_pt()->element_pt(i));
399 
400  //Set the traction function
401  el_pt->traction_fct_pt() = Global_Physical_Variables::constant_pressure;
402  }
403 
404  //Attach the boundary conditions to the mesh
405  cout << assign_eqn_numbers() << std::endl;
406 
407  // Refine uniformly
408  refine_uniformly();
409  refine_uniformly();
410  refine_uniformly();
411 
412 
413  // Now the non-pinned positions of the SolidNodes will have been
414  // determined by interpolation. This is appropriate for uniform
415  // refinements once the code is up and running since we can't place
416  // new SolidNodes at the positions determined by the MacroElement.
417  // However, here we want to update the nodes to fit the exact
418  // intitial configuration.
419 
420  // Update all solid nodes based on the Mesh's Domain/MacroElement
421  // representation
422  bool update_all_solid_nodes=true;
423  solid_mesh_pt()->node_update(update_all_solid_nodes);
424 
425  // Now set the Eulerian equal to the Lagrangian coordinates
426  solid_mesh_pt()->set_lagrangian_nodal_coordinates();
427 
428 }
429 
430 
431 
432 
433 
434 
435 //==================================================================
436 /// Kill and then re-build the traction elements on boundary 1,
437 /// pin redundant pressure dofs and re-assign the equation numbers.
438 //==================================================================
439 template<class ELEMENT, class TIMESTEPPER>
441 {
442  // Wipe and re-build traction element mesh
443  solid_mesh_pt()->remake_traction_element_mesh(traction_mesh_pt());
444 
445  // Re-build combined "global" mesh
446  rebuild_global_mesh();
447 
448  //Find number of elements in traction mesh
449  unsigned n_element=traction_mesh_pt()->nelement();
450 
451  //Loop over the elements in the traction element mesh
452  for(unsigned i=0;i<n_element;i++)
453  {
454  //Cast to a solid traction element
455  SolidTractionElement<ELEMENT> *el_pt =
456  dynamic_cast<SolidTractionElement<ELEMENT>*>
457  (traction_mesh_pt()->element_pt(i));
458 
459  //Set the traction function
460  el_pt->traction_fct_pt() = Global_Physical_Variables::constant_pressure;
461  }
462 
463  // Pin the redundant solid pressures
464  PVDEquationsBase<2>::pin_redundant_nodal_solid_pressures(
465  solid_mesh_pt()->element_pt());
466 
467 
468  //Do equation numbering
469  cout << assign_eqn_numbers() << std::endl;
470 
471 }
472 
473 
474 //==================================================================
475 /// Doc the solution
476 //==================================================================
477 template<class ELEMENT, class TIMESTEPPER>
479 {
480  // Number of plot points
481  unsigned npts;
482  npts=5;
483 
484  // Output shape of deformed body
485  ofstream some_file;
486  char filename[100];
487  sprintf(filename,"%s/soln%i.dat",Doc_info.directory().c_str(),
488  Doc_info.number());
489  some_file.open(filename);
490  solid_mesh_pt()->output(some_file,npts);
491  some_file.close();
492 
493 
494  // Output traction
495  unsigned nel=traction_mesh_pt()->nelement();
496  sprintf(filename,"%s/traction%i.dat",Doc_info.directory().c_str(),
497  Doc_info.number());
498  some_file.open(filename);
499  Vector<double> unit_normal(2);
500  Vector<double> traction(2);
501  Vector<double> x_dummy(2);
502  Vector<double> s_dummy(1);
503  for (unsigned e=0;e<nel;e++)
504  {
505  some_file << "ZONE " << std::endl;
506  for (unsigned i=0;i<npts;i++)
507  {
508  s_dummy[0]=-1.0+2.0*double(i)/double(npts-1);
509  SolidTractionElement<ELEMENT>* el_pt=
510  dynamic_cast<SolidTractionElement<ELEMENT>*>(
511  traction_mesh_pt()->finite_element_pt(e));
512  el_pt->outer_unit_normal(s_dummy,unit_normal);
513  el_pt->traction(s_dummy,traction);
514  el_pt->interpolated_x(s_dummy,x_dummy);
515  some_file << x_dummy[0] << " " << x_dummy[1] << " "
516  << traction[0] << " " << traction[1] << " "
517  << std::endl;
518  }
519  }
520  some_file.close();
521 
522  // Doc displacement and velocity
523  doc_displ_and_veloc();
524 
525  // Get displacement as a function of the radial coordinate
526  // along boundary 0
527  {
528 
529  // Number of elements along boundary 0:
530  unsigned nelem=solid_mesh_pt()->nboundary_element(0);
531 
532  // Open files
533  sprintf(filename,"%s/displ%i.dat",Doc_info.directory().c_str(),
534  Doc_info.number());
535  some_file.open(filename);
536 
537  Vector<double> s(2);
538  Vector<double> x(2);
539  Vector<double> dxdt(2);
540  Vector<double> xi(2);
541  Vector<double> r_exact(2);
542  Vector<double> v_exact(2);
543 
544  for (unsigned e=0;e<nelem;e++)
545  {
546  some_file << "ZONE " << std::endl;
547  for (unsigned i=0;i<npts;i++)
548  {
549  // Move along bottom edge of element
550  s[0]=-1.0+2.0*double(i)/double(npts-1);
551  s[1]=-1.0;
552 
553  // Get pointer to element
554  SolidFiniteElement* el_pt=dynamic_cast<SolidFiniteElement*>
555  (solid_mesh_pt()->boundary_element_pt(0,e));
556 
557  // Get Lagrangian coordinate
558  el_pt->interpolated_xi(s,xi);
559 
560  // Get Eulerian coordinate
561  el_pt->interpolated_x(s,x);
562 
563  // Get velocity
564  el_pt->interpolated_dxdt(s,1,dxdt);
565 
566  // Plot radial distance and displacement
567  some_file << xi[0] << " " << x[0]-xi[0] << " "
568  << dxdt[0] << std::endl;
569  }
570  }
571  some_file.close();
572  }
573 
574 
575  // Write trace file
576  Trace_file << time_pt()->time() << " ";
577  unsigned ntrace_node=Trace_node_pt.size();
578  for (unsigned j=0;j<ntrace_node;j++)
579  {
580  Trace_file << sqrt(pow(Trace_node_pt[j]->x(0),2)+
581  pow(Trace_node_pt[j]->x(1),2)) << " ";
582  }
583  Trace_file << std::endl;
584 
585 
586  // removed until Jacobi eigensolver is re-instated
587  // // Output principal stress vectors at the centre of all elements
588  // SolidHelpers::doc_2D_principal_stress<ELEMENT>(Doc_info,solid_mesh_pt());
589 
590 // // Write restart file
591 // sprintf(filename,"%s/restart%i.dat",Doc_info.directory().c_str(),
592 // Doc_info.number());
593 // some_file.open(filename);
594 // dump_it(some_file);
595 // some_file.close();
596 
597 
598  cout << "Doced solution for step "
599  << Doc_info.number()
600  << std::endl << std::endl << std::endl;
601 }
602 
603 
604 
605 
606 
607 
608 //==================================================================
609 /// Doc displacement and veloc in displ_and_veloc*.dat.
610 /// The int stage defaults to 0, in which case the '*' in the
611 /// filename is simply the step number specified by the Problem's
612 /// DocInfo object. If it's +/-1, the word "before" and "after"
613 /// get inserted. This allows checking of the veloc/displacment
614 /// interpolation during adaptive mesh refinement.
615 //==================================================================
616 template<class ELEMENT, class TIMESTEPPER>
618  const int& stage)
619 {
620 
621  ofstream some_file;
622  char filename[100];
623 
624  // Number of plot points
625  unsigned npts;
626  npts=5;
627 
628  // Open file
629  if (stage==-1)
630  {
631  sprintf(filename,"%s/displ_and_veloc_before%i.dat",
632  Doc_info.directory().c_str(),Doc_info.number());
633  }
634  else if (stage==1)
635  {
636  sprintf(filename,"%s/displ_and_veloc_after%i.dat",
637  Doc_info.directory().c_str(),Doc_info.number());
638  }
639  else
640  {
641  sprintf(filename,"%s/displ_and_veloc%i.dat",
642  Doc_info.directory().c_str(),Doc_info.number());
643  }
644  some_file.open(filename);
645 
646  Vector<double> s(2),x(2),dxdt(2),xi(2),displ(2);
647 
648  //Loop over solid elements
649  unsigned nel=solid_mesh_pt()->nelement();
650  for (unsigned e=0;e<nel;e++)
651  {
652  some_file << "ZONE I=" << npts << ", J=" << npts << std::endl;
653  for (unsigned i=0;i<npts;i++)
654  {
655  s[0]=-1.0+2.0*double(i)/double(npts-1);
656  for (unsigned j=0;j<npts;j++)
657  {
658  s[1]=-1.0+2.0*double(j)/double(npts-1);
659 
660  // Cast to full element type
661  ELEMENT* el_pt=dynamic_cast<ELEMENT*>(solid_mesh_pt()->
662  finite_element_pt(e));
663 
664  // Eulerian coordinate
665  el_pt->interpolated_x(s,x);
666 
667  // Lagrangian coordinate
668  el_pt->interpolated_xi(s,xi);
669 
670  // Displacement
671  displ[0]=x[0]-xi[0];
672  displ[1]=x[1]-xi[1];
673 
674  // Velocity (1st deriv)
675  el_pt->interpolated_dxdt(s,1,dxdt);
676 
677  some_file << x[0] << " " << x[1] << " "
678  << displ[0] << " " << displ[1] << " "
679  << dxdt[0] << " " << dxdt[1] << " "
680  << std::endl;
681  }
682  }
683  }
684  some_file.close();
685 
686 }
687 
688 
689 
690 //========================================================================
691 /// Dump the solution
692 //========================================================================
693 template<class ELEMENT, class TIMESTEPPER>
695 {
696  // Call generic dump()
697  Problem::dump(dump_file);
698 }
699 
700 
701 
702 //========================================================================
703 /// Read solution from disk
704 //========================================================================
705 template<class ELEMENT, class TIMESTEPPER>
707 {
708  // Read generic problem data
709  Problem::read(restart_file);
710 }
711 
712 
713 
714 //==================================================================
715 /// Run the problem; specify case_number to label output directory
716 //==================================================================
717 template<class ELEMENT, class TIMESTEPPER>
719  const unsigned& case_number)
720 {
721 
722  // If there's a command line argument, run the validation (i.e. do only
723  // 3 timesteps; otherwise do a few cycles
724  unsigned nstep=400;
725  if (CommandLineArgs::Argc!=1)
726  {
727  nstep=3;
728  }
729 
730  // Define output directory
731  char dirname[100];
732  sprintf(dirname,"RESLT%i",case_number);
733  Doc_info.set_directory(dirname);
734 
735  // Step number
736  Doc_info.number()=0;
737 
738  // Open trace file
739  char filename[100];
740  sprintf(filename,"%s/trace.dat",Doc_info.directory().c_str());
741  Trace_file.open(filename);
742 
743  // Set up trace nodes as the nodes on boundary 1 (=curved boundary) in
744  // the original mesh (they exist under any refinement!)
745  unsigned nnod0=solid_mesh_pt()->nboundary_node(0);
746  unsigned nnod1=solid_mesh_pt()->nboundary_node(1);
747  Trace_file << "VARIABLES=\"time\"";
748  for (unsigned j=0;j<nnod0;j++)
749  {
750  Trace_file << ", \"radial node " << j << "\" ";
751  }
752  for (unsigned j=0;j<nnod1;j++)
753  {
754  Trace_file << ", \"azimuthal node " << j << "\" ";
755  }
756  Trace_file << std::endl;
757 
758 
759 
760 // // Restart?
761 // //---------
762 
763 // // Pointer to restart file
764 // ifstream* restart_file_pt=0;
765 
766 // // No restart
767 // //-----------
768 // if (CommandLineArgs::Argc==1)
769 // {
770 // cout << "No restart" << std::endl;
771 // }
772 // // Restart
773 // //--------
774 // else if (CommandLineArgs::Argc==2)
775 // {
776 // // Open restart file
777 // restart_file_pt=new ifstream(CommandLineArgs::Argv[1],ios_base::in);
778 // if (restart_file_pt!=0)
779 // {
780 // cout << "Have opened " << CommandLineArgs::Argv[1] <<
781 // " for restart. " << std::endl;
782 // }
783 // else
784 // {
785 // cout << "ERROR while trying to open " << CommandLineArgs::Argv[1] <<
786 // " for restart." << std::endl;
787 // }
788 // // Do the actual restart
789 // pause("need to do the actual restart");
790 // //problem.restart(*restart_file_pt);
791 // }
792 // // More than one restart file specified?
793 // else
794 // {
795 // cout << "Can only specify one input file " << std::endl;
796 // cout << "You specified the following command line arguments: " << std::endl;
797 // CommandLineArgs::output();
798 // //assert(false);
799 // }
800 
801 
802  // Initial parameter values
804 
805  // Initialise time
806  double time0=0.0;
807  time_pt()->time()=time0;
808 
809  // Set initial timestep
810  double dt=0.01;
811 
812  // Impulsive start
813  assign_initial_values_impulsive(dt);
814 
815  // Doc initial state
816  doc_solution();
817  Doc_info.number()++;
818 
819  // First step without adaptivity
820  unsteady_newton_solve(dt);
821  doc_solution();
822  Doc_info.number()++;
823 
824  //Timestepping loop for subsequent steps with adaptivity
825  unsigned max_adapt=1;
826  for(unsigned i=1;i<nstep;i++)
827  {
828  unsteady_newton_solve(dt,max_adapt,false);
829  doc_solution();
830  Doc_info.number()++;
831  }
832 
833 }
834 
835 
836 
837 
838 
839 //======================================================================
840 /// Driver for simple elastic problem
841 //======================================================================
842 int main(int argc, char* argv[])
843 {
844 
845  // Store command line arguments
846  CommandLineArgs::setup(argc,argv);
847 
848  //Initialise physical parameters
849  Global_Physical_Variables::E = 1.0; // ADJUST
850  Global_Physical_Variables::Nu = 0.3; // ADJUST
851 
852  // "Big G" Linear constitutive equations:
854  new GeneralisedHookean(&Global_Physical_Variables::Nu,
856 
857  //Set up the problem:
858  unsigned case_number=0;
859 
860 
861  // Pure displacement formulation
862  {
863  cout << "Running case " << case_number
864  << ": Pure displacement formulation" << std::endl;
866  problem.run(case_number);
867  case_number++;
868  }
869 
870  // Pressure-displacement with Crouzeix Raviart-type pressure
871  {
872  cout << "Running case " << case_number
873  << ": Pressure/displacement with Crouzeix-Raviart pressure" << std::endl;
875  problem;
876  problem.run(case_number);
877  case_number++;
878  }
879 
880 
881  // Pressure-displacement with Taylor-Hood-type pressure
882  {
883  cout << "Running case " << case_number
884  << ": Pressure/displacement with Taylor-Hood pressure" << std::endl;
886  Newmark<1> > problem;
887  problem.run(case_number);
888  case_number++;
889  }
890 
891 
892  // Clean up
895 
896 }
897 
898 
899 
900 
901 
902 
903 
904 
void dump_it(ofstream &dump_file)
Dump problem-specific parameters values, then dump generic problem data.
Definition: shock_disk.cc:694
ofstream Trace_file
Trace file.
Definition: shock_disk.cc:265
ElasticRefineableQuarterCircleSectorMesh< ELEMENT > *& solid_mesh_pt()
Access function for the solid mesh.
Definition: shock_disk.cc:224
void run(const unsigned &case_number)
Run the problem; specify case_number to label output directory.
Definition: shock_disk.cc:718
double P
Uniform pressure.
Definition: shock_disk.cc:68
void actions_after_adapt()
Actions after adaption: Kill and then re-build the traction elements on boundary 1 and re-assign the ...
Definition: shock_disk.cc:440
void remake_traction_element_mesh(SolidMesh *&traction_mesh_pt)
Function to wipe and re-create mesh made of traction elements.
Definition: shock_disk.cc:169
void doc_displ_and_veloc(const int &stage=0)
Doc displacement and velocity: label file with before and after.
Definition: shock_disk.cc:617
void doc_solution()
Doc the solution.
Definition: shock_disk.cc:478
ConstitutiveLaw * Constitutive_law_pt
Pointer to constitutive law.
Definition: shock_disk.cc:59
DiskShockWaveProblem()
Constructor:
Definition: shock_disk.cc:286
SolidMesh *& traction_mesh_pt()
Access function for the mesh of surface traction elements.
Definition: shock_disk.cc:230
void constant_pressure(const Vector< double > &xi, const Vector< double > &x, const Vector< double > &n, Vector< double > &traction)
Constant pressure load.
Definition: shock_disk.cc:71
void make_traction_element_mesh(SolidMesh *&traction_mesh_pt)
Function to create mesh made of traction elements.
Definition: shock_disk.cc:144
ElasticRefineableQuarterCircleSectorMesh< ELEMENT > * Solid_mesh_pt
Pointer to solid mesh.
Definition: shock_disk.cc:271
void restart(ifstream &restart_file)
Read problem-specific parameter values, then recover generic problem data.
Definition: shock_disk.cc:706
SolidMesh * Traction_mesh_pt
Pointer to mesh of traction elements.
Definition: shock_disk.cc:274
Global variables.
Definition: shock_disk.cc:56
Vector< Node * > Trace_node_pt
Vector of pointers to nodes whose position we&#39;re tracing.
Definition: shock_disk.cc:268
int main(int argc, char *argv[])
Driver for simple elastic problem.
Definition: shock_disk.cc:842
void actions_after_newton_solve()
Update function (empty)
Definition: shock_disk.cc:239
void actions_before_newton_solve()
Update function (empty)
Definition: shock_disk.cc:242
double Nu
Poisson&#39;s ratio.
Definition: shock_disk.cc:65
double E
Elastic modulus.
Definition: shock_disk.cc:62