42 #include "meshes/quarter_circle_sector_mesh.h" 46 using namespace oomph;
72 const Vector<double> &n, Vector<double> &traction)
74 unsigned dim = traction.size();
75 for(
unsigned i=0;i<dim;i++)
77 traction[i] = -P*n[i];
103 template <
class ELEMENT>
105 public virtual RefineableQuarterCircleSectorMesh<ELEMENT>,
106 public virtual SolidMesh
116 const double& fract_mid,
118 TimeStepper* time_stepper_pt=
119 &Mesh::Default_TimeStepper) :
120 RefineableQuarterCircleSectorMesh<ELEMENT>(wall_pt,xi_lo,fract_mid,xi_hi,
125 SolidFiniteElement* el_pt=
dynamic_cast<SolidFiniteElement*
> 126 (finite_element_pt(0));
130 "Element needs to be derived from SolidFiniteElement\n",
131 OOMPH_CURRENT_FUNCTION,
132 OOMPH_EXCEPTION_LOCATION);
139 set_lagrangian_nodal_coordinates();
148 traction_mesh_pt=
new SolidMesh;
152 unsigned n_element = this->nboundary_element(b);
153 for (
unsigned e=0;e<n_element;e++)
156 FiniteElement* fe_pt = this->boundary_element_pt(b,e);
159 int face_index = this->face_index_at_boundary(b,e);
162 traction_mesh_pt->add_element_pt(
new SolidTractionElement<ELEMENT>
174 traction_mesh_pt->flush_element_and_node_storage();
178 unsigned n_element = this->nboundary_element(b);
179 for (
unsigned e=0;e<n_element;e++)
182 FiniteElement* fe_pt = this->boundary_element_pt(b,e);
185 int face_index = this->face_index_at_boundary(b,e);
188 traction_mesh_pt->add_element_pt(
new SolidTractionElement<ELEMENT>
210 template<
class ELEMENT,
class TIMESTEPPER>
221 void run(
const unsigned& case_number);
226 return Solid_mesh_pt;
232 return Traction_mesh_pt;
246 void actions_after_adapt();
249 void doc_displ_and_veloc(
const int& stage=0);
253 void dump_it(ofstream& dump_file);
257 void restart(ifstream& restart_file);
285 template<
class ELEMENT,
class TIMESTEPPER>
291 add_time_stepper_pt(
new TIMESTEPPER);
301 GeomObject* curved_boundary_pt=
new Circle(x_c,y_c,r,time_stepper_pt());
306 double xi_hi=2.0*atan(1.0);
310 double fract_mid=0.5;
314 curved_boundary_pt,xi_lo,fract_mid,xi_hi,time_stepper_pt());
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++)
323 Trace_node_pt[j]=solid_mesh_pt()->boundary_node_pt(0,j);
325 for (
unsigned j=0;j<nnod1;j++)
327 Trace_node_pt[j+nnod0]=solid_mesh_pt()->boundary_node_pt(1,j);
334 add_sub_mesh(solid_mesh_pt());
337 add_sub_mesh(traction_mesh_pt());
344 solid_mesh_pt()->spatial_error_estimator_pt()=
new Z2ErrorEstimator;
347 solid_mesh_pt()->max_permitted_error()=0.006;
348 solid_mesh_pt()->min_permitted_error()=0.0006;
349 solid_mesh_pt()->doc_adaptivity_targets(cout);
352 unsigned n_bottom = solid_mesh_pt()->nboundary_node(0);
355 for(
unsigned i=0;i<n_bottom;i++)
357 solid_mesh_pt()->boundary_node_pt(0,i)->pin_position(1);
361 unsigned n_side = solid_mesh_pt()->nboundary_node(2);
363 for(
unsigned i=0;i<n_side;i++)
365 solid_mesh_pt()->boundary_node_pt(2,i)->pin_position(0);
369 unsigned n_element =solid_mesh_pt()->nelement();
372 for(
unsigned i=0;i<n_element;i++)
375 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(i));
378 el_pt->constitutive_law_pt() =
382 el_pt->enable_inertia();
386 PVDEquationsBase<2>::pin_redundant_nodal_solid_pressures(
387 solid_mesh_pt()->element_pt());
390 n_element=traction_mesh_pt()->nelement();
393 for(
unsigned i=0;i<n_element;i++)
396 SolidTractionElement<ELEMENT> *el_pt =
397 dynamic_cast<SolidTractionElement<ELEMENT>*
> 398 (traction_mesh_pt()->element_pt(i));
405 cout << assign_eqn_numbers() << std::endl;
422 bool update_all_solid_nodes=
true;
423 solid_mesh_pt()->node_update(update_all_solid_nodes);
426 solid_mesh_pt()->set_lagrangian_nodal_coordinates();
439 template<
class ELEMENT,
class TIMESTEPPER>
443 solid_mesh_pt()->remake_traction_element_mesh(traction_mesh_pt());
446 rebuild_global_mesh();
449 unsigned n_element=traction_mesh_pt()->nelement();
452 for(
unsigned i=0;i<n_element;i++)
455 SolidTractionElement<ELEMENT> *el_pt =
456 dynamic_cast<SolidTractionElement<ELEMENT>*
> 457 (traction_mesh_pt()->element_pt(i));
464 PVDEquationsBase<2>::pin_redundant_nodal_solid_pressures(
465 solid_mesh_pt()->element_pt());
469 cout << assign_eqn_numbers() << std::endl;
477 template<
class ELEMENT,
class TIMESTEPPER>
487 sprintf(filename,
"%s/soln%i.dat",Doc_info.directory().c_str(),
489 some_file.open(filename);
490 solid_mesh_pt()->output(some_file,npts);
495 unsigned nel=traction_mesh_pt()->nelement();
496 sprintf(filename,
"%s/traction%i.dat",Doc_info.directory().c_str(),
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++)
505 some_file <<
"ZONE " << std::endl;
506 for (
unsigned i=0;i<npts;i++)
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] <<
" " 523 doc_displ_and_veloc();
530 unsigned nelem=solid_mesh_pt()->nboundary_element(0);
533 sprintf(filename,
"%s/displ%i.dat",Doc_info.directory().c_str(),
535 some_file.open(filename);
539 Vector<double> dxdt(2);
540 Vector<double> xi(2);
541 Vector<double> r_exact(2);
542 Vector<double> v_exact(2);
544 for (
unsigned e=0;e<nelem;e++)
546 some_file <<
"ZONE " << std::endl;
547 for (
unsigned i=0;i<npts;i++)
550 s[0]=-1.0+2.0*double(i)/double(npts-1);
554 SolidFiniteElement* el_pt=
dynamic_cast<SolidFiniteElement*
> 555 (solid_mesh_pt()->boundary_element_pt(0,e));
558 el_pt->interpolated_xi(s,xi);
561 el_pt->interpolated_x(s,x);
564 el_pt->interpolated_dxdt(s,1,dxdt);
567 some_file << xi[0] <<
" " << x[0]-xi[0] <<
" " 568 << dxdt[0] << std::endl;
576 Trace_file << time_pt()->time() <<
" ";
577 unsigned ntrace_node=Trace_node_pt.size();
578 for (
unsigned j=0;j<ntrace_node;j++)
580 Trace_file << sqrt(pow(Trace_node_pt[j]->x(0),2)+
581 pow(Trace_node_pt[j]->x(1),2)) <<
" ";
583 Trace_file << std::endl;
598 cout <<
"Doced solution for step " 600 << std::endl << std::endl << std::endl;
616 template<
class ELEMENT,
class TIMESTEPPER>
631 sprintf(filename,
"%s/displ_and_veloc_before%i.dat",
632 Doc_info.directory().c_str(),Doc_info.number());
636 sprintf(filename,
"%s/displ_and_veloc_after%i.dat",
637 Doc_info.directory().c_str(),Doc_info.number());
641 sprintf(filename,
"%s/displ_and_veloc%i.dat",
642 Doc_info.directory().c_str(),Doc_info.number());
644 some_file.open(filename);
646 Vector<double> s(2),x(2),dxdt(2),xi(2),displ(2);
649 unsigned nel=solid_mesh_pt()->nelement();
650 for (
unsigned e=0;e<nel;e++)
652 some_file <<
"ZONE I=" << npts <<
", J=" << npts << std::endl;
653 for (
unsigned i=0;i<npts;i++)
655 s[0]=-1.0+2.0*double(i)/double(npts-1);
656 for (
unsigned j=0;j<npts;j++)
658 s[1]=-1.0+2.0*double(j)/double(npts-1);
661 ELEMENT* el_pt=
dynamic_cast<ELEMENT*
>(solid_mesh_pt()->
662 finite_element_pt(e));
665 el_pt->interpolated_x(s,x);
668 el_pt->interpolated_xi(s,xi);
675 el_pt->interpolated_dxdt(s,1,dxdt);
677 some_file << x[0] <<
" " << x[1] <<
" " 678 << displ[0] <<
" " << displ[1] <<
" " 679 << dxdt[0] <<
" " << dxdt[1] <<
" " 693 template<
class ELEMENT,
class TIMESTEPPER>
697 Problem::dump(dump_file);
705 template<
class ELEMENT,
class TIMESTEPPER>
709 Problem::read(restart_file);
717 template<
class ELEMENT,
class TIMESTEPPER>
719 const unsigned& case_number)
725 if (CommandLineArgs::Argc!=1)
732 sprintf(dirname,
"RESLT%i",case_number);
733 Doc_info.set_directory(dirname);
740 sprintf(filename,
"%s/trace.dat",Doc_info.directory().c_str());
741 Trace_file.open(filename);
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++)
750 Trace_file <<
", \"radial node " << j <<
"\" ";
752 for (
unsigned j=0;j<nnod1;j++)
754 Trace_file <<
", \"azimuthal node " << j <<
"\" ";
756 Trace_file << std::endl;
807 time_pt()->time()=time0;
813 assign_initial_values_impulsive(dt);
820 unsteady_newton_solve(dt);
825 unsigned max_adapt=1;
826 for(
unsigned i=1;i<nstep;i++)
828 unsteady_newton_solve(dt,max_adapt,
false);
842 int main(
int argc,
char* argv[])
846 CommandLineArgs::setup(argc,argv);
858 unsigned case_number=0;
863 cout <<
"Running case " << case_number
864 <<
": Pure displacement formulation" << std::endl;
866 problem.
run(case_number);
872 cout <<
"Running case " << case_number
873 <<
": Pressure/displacement with Crouzeix-Raviart pressure" << std::endl;
876 problem.
run(case_number);
883 cout <<
"Running case " << case_number
884 <<
": Pressure/displacement with Taylor-Hood pressure" << std::endl;
886 Newmark<1> > problem;
887 problem.
run(case_number);
void dump_it(ofstream &dump_file)
Dump problem-specific parameters values, then dump generic problem data.
ofstream Trace_file
Trace file.
ElasticRefineableQuarterCircleSectorMesh< ELEMENT > *& solid_mesh_pt()
Access function for the solid mesh.
void run(const unsigned &case_number)
Run the problem; specify case_number to label output directory.
double P
Uniform pressure.
void actions_after_adapt()
Actions after adaption: Kill and then re-build the traction elements on boundary 1 and re-assign the ...
void remake_traction_element_mesh(SolidMesh *&traction_mesh_pt)
Function to wipe and re-create mesh made of traction elements.
void doc_displ_and_veloc(const int &stage=0)
Doc displacement and velocity: label file with before and after.
void doc_solution()
Doc the solution.
ConstitutiveLaw * Constitutive_law_pt
Pointer to constitutive law.
DiskShockWaveProblem()
Constructor:
SolidMesh *& traction_mesh_pt()
Access function for the mesh of surface traction elements.
void constant_pressure(const Vector< double > &xi, const Vector< double > &x, const Vector< double > &n, Vector< double > &traction)
Constant pressure load.
void make_traction_element_mesh(SolidMesh *&traction_mesh_pt)
Function to create mesh made of traction elements.
ElasticRefineableQuarterCircleSectorMesh< ELEMENT > * Solid_mesh_pt
Pointer to solid mesh.
void restart(ifstream &restart_file)
Read problem-specific parameter values, then recover generic problem data.
SolidMesh * Traction_mesh_pt
Pointer to mesh of traction elements.
Vector< Node * > Trace_node_pt
Vector of pointers to nodes whose position we're tracing.
int main(int argc, char *argv[])
Driver for simple elastic problem.
void actions_after_newton_solve()
Update function (empty)
void actions_before_newton_solve()
Update function (empty)
double Nu
Poisson's ratio.