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