38 #include "meshes/quarter_circle_sector_mesh.h"
42 using namespace oomph;
68 const Vector<double> &n, Vector<double> &traction)
70 unsigned dim = traction.size();
71 for(
unsigned i=0;i<dim;i++)
73 traction[i] = -
P*n[i];
99 template <
class ELEMENT>
101 public virtual RefineableQuarterCircleSectorMesh<ELEMENT>,
102 public virtual SolidMesh
112 const double& fract_mid,
114 TimeStepper* time_stepper_pt=
115 &Mesh::Default_TimeStepper) :
116 RefineableQuarterCircleSectorMesh<ELEMENT>(wall_pt,xi_lo,fract_mid,xi_hi,
121 SolidFiniteElement* el_pt=
dynamic_cast<SolidFiniteElement*
>
122 (finite_element_pt(0));
126 "Element needs to be derived from SolidFiniteElement\n",
127 OOMPH_CURRENT_FUNCTION,
128 OOMPH_EXCEPTION_LOCATION);
135 set_lagrangian_nodal_coordinates();
144 traction_mesh_pt=
new SolidMesh;
148 unsigned n_element = this->nboundary_element(b);
149 for (
unsigned e=0;e<n_element;e++)
152 FiniteElement* fe_pt = this->boundary_element_pt(b,e);
155 int face_index = this->face_index_at_boundary(b,e);
158 traction_mesh_pt->add_element_pt(
new SolidTractionElement<ELEMENT>
170 traction_mesh_pt->flush_element_and_node_storage();
174 unsigned n_element = this->nboundary_element(b);
175 for (
unsigned e=0;e<n_element;e++)
178 FiniteElement* fe_pt = this->boundary_element_pt(b,e);
181 int face_index = this->face_index_at_boundary(b,e);
184 traction_mesh_pt->add_element_pt(
new SolidTractionElement<ELEMENT>
206 template<
class ELEMENT,
class TIMESTEPPER>
217 void run(
const unsigned& case_number);
222 return Solid_mesh_pt;
228 return Traction_mesh_pt;
242 void actions_after_adapt();
245 void doc_displ_and_veloc(
const int& stage=0);
249 void dump_it(ofstream& dump_file);
253 void restart(ifstream& restart_file);
281 template<
class ELEMENT,
class TIMESTEPPER>
287 add_time_stepper_pt(
new TIMESTEPPER);
297 GeomObject* curved_boundary_pt=
new Circle(x_c,y_c,r,time_stepper_pt());
302 double xi_hi=2.0*atan(1.0);
306 double fract_mid=0.5;
310 curved_boundary_pt,xi_lo,fract_mid,xi_hi,time_stepper_pt());
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++)
319 Trace_node_pt[j]=solid_mesh_pt()->boundary_node_pt(0,j);
321 for (
unsigned j=0;j<nnod1;j++)
323 Trace_node_pt[j+nnod0]=solid_mesh_pt()->boundary_node_pt(1,j);
327 solid_mesh_pt()->make_traction_element_mesh(traction_mesh_pt());
330 add_sub_mesh(solid_mesh_pt());
333 add_sub_mesh(traction_mesh_pt());
340 solid_mesh_pt()->spatial_error_estimator_pt()=
new Z2ErrorEstimator;
343 solid_mesh_pt()->max_permitted_error()=0.006;
344 solid_mesh_pt()->min_permitted_error()=0.0006;
345 solid_mesh_pt()->doc_adaptivity_targets(cout);
348 unsigned n_bottom = solid_mesh_pt()->nboundary_node(0);
351 for(
unsigned i=0;i<n_bottom;i++)
353 solid_mesh_pt()->boundary_node_pt(0,i)->pin_position(1);
357 unsigned n_side = solid_mesh_pt()->nboundary_node(2);
359 for(
unsigned i=0;i<n_side;i++)
361 solid_mesh_pt()->boundary_node_pt(2,i)->pin_position(0);
365 unsigned n_element =solid_mesh_pt()->nelement();
368 for(
unsigned i=0;i<n_element;i++)
371 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(i));
374 el_pt->constitutive_law_pt() =
378 el_pt->enable_inertia();
382 PVDEquationsBase<2>::pin_redundant_nodal_solid_pressures(
383 solid_mesh_pt()->element_pt());
386 n_element=traction_mesh_pt()->nelement();
389 for(
unsigned i=0;i<n_element;i++)
392 SolidTractionElement<ELEMENT> *el_pt =
393 dynamic_cast<SolidTractionElement<ELEMENT>*
>
394 (traction_mesh_pt()->element_pt(i));
401 cout << assign_eqn_numbers() << std::endl;
418 bool update_all_solid_nodes=
true;
419 solid_mesh_pt()->node_update(update_all_solid_nodes);
422 solid_mesh_pt()->set_lagrangian_nodal_coordinates();
435 template<
class ELEMENT,
class TIMESTEPPER>
439 solid_mesh_pt()->remake_traction_element_mesh(traction_mesh_pt());
442 rebuild_global_mesh();
445 unsigned n_element=traction_mesh_pt()->nelement();
448 for(
unsigned i=0;i<n_element;i++)
451 SolidTractionElement<ELEMENT> *el_pt =
452 dynamic_cast<SolidTractionElement<ELEMENT>*
>
453 (traction_mesh_pt()->element_pt(i));
460 PVDEquationsBase<2>::pin_redundant_nodal_solid_pressures(
461 solid_mesh_pt()->element_pt());
465 cout << assign_eqn_numbers() << std::endl;
473 template<
class ELEMENT,
class TIMESTEPPER>
483 sprintf(filename,
"%s/soln%i.dat",Doc_info.directory().c_str(),
485 some_file.open(filename);
486 solid_mesh_pt()->output(some_file,npts);
491 unsigned nel=traction_mesh_pt()->nelement();
492 sprintf(filename,
"%s/traction%i.dat",Doc_info.directory().c_str(),
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++)
501 some_file <<
"ZONE " << std::endl;
502 for (
unsigned i=0;i<npts;i++)
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] <<
" "
519 doc_displ_and_veloc();
526 unsigned nelem=solid_mesh_pt()->nboundary_element(0);
529 sprintf(filename,
"%s/displ%i.dat",Doc_info.directory().c_str(),
531 some_file.open(filename);
535 Vector<double> dxdt(2);
536 Vector<double> xi(2);
537 Vector<double> r_exact(2);
538 Vector<double> v_exact(2);
540 for (
unsigned e=0;e<nelem;e++)
542 some_file <<
"ZONE " << std::endl;
543 for (
unsigned i=0;i<npts;i++)
546 s[0]=-1.0+2.0*double(i)/double(npts-1);
550 SolidFiniteElement* el_pt=
dynamic_cast<SolidFiniteElement*
>
551 (solid_mesh_pt()->boundary_element_pt(0,e));
554 el_pt->interpolated_xi(s,xi);
557 el_pt->interpolated_x(s,x);
560 el_pt->interpolated_dxdt(s,1,dxdt);
563 some_file << xi[0] <<
" " << x[0]-xi[0] <<
" "
564 << dxdt[0] << std::endl;
572 Trace_file << time_pt()->time() <<
" ";
573 unsigned ntrace_node=Trace_node_pt.size();
574 for (
unsigned j=0;j<ntrace_node;j++)
576 Trace_file << sqrt(pow(Trace_node_pt[j]->x(0),2)+
577 pow(Trace_node_pt[j]->x(1),2)) <<
" ";
579 Trace_file << std::endl;
594 cout <<
"Doced solution for step "
596 << std::endl << std::endl << std::endl;
612 template<
class ELEMENT,
class TIMESTEPPER>
627 sprintf(filename,
"%s/displ_and_veloc_before%i.dat",
628 Doc_info.directory().c_str(),Doc_info.number());
632 sprintf(filename,
"%s/displ_and_veloc_after%i.dat",
633 Doc_info.directory().c_str(),Doc_info.number());
637 sprintf(filename,
"%s/displ_and_veloc%i.dat",
638 Doc_info.directory().c_str(),Doc_info.number());
640 some_file.open(filename);
642 Vector<double> s(2),x(2),dxdt(2),xi(2),displ(2);
645 unsigned nel=solid_mesh_pt()->nelement();
646 for (
unsigned e=0;e<nel;e++)
648 some_file <<
"ZONE I=" << npts <<
", J=" << npts << std::endl;
649 for (
unsigned i=0;i<npts;i++)
651 s[0]=-1.0+2.0*double(i)/double(npts-1);
652 for (
unsigned j=0;j<npts;j++)
654 s[1]=-1.0+2.0*double(j)/double(npts-1);
657 ELEMENT* el_pt=
dynamic_cast<ELEMENT*
>(solid_mesh_pt()->
658 finite_element_pt(e));
661 el_pt->interpolated_x(s,x);
664 el_pt->interpolated_xi(s,xi);
671 el_pt->interpolated_dxdt(s,1,dxdt);
673 some_file << x[0] <<
" " << x[1] <<
" "
674 << displ[0] <<
" " << displ[1] <<
" "
675 << dxdt[0] <<
" " << dxdt[1] <<
" "
689 template<
class ELEMENT,
class TIMESTEPPER>
693 Problem::dump(dump_file);
701 template<
class ELEMENT,
class TIMESTEPPER>
705 Problem::read(restart_file);
713 template<
class ELEMENT,
class TIMESTEPPER>
715 const unsigned& case_number)
721 if (CommandLineArgs::Argc!=1)
728 sprintf(dirname,
"RESLT%i",case_number);
729 Doc_info.set_directory(dirname);
736 sprintf(filename,
"%s/trace.dat",Doc_info.directory().c_str());
737 Trace_file.open(filename);
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++)
746 Trace_file <<
", \"radial node " << j <<
"\" ";
748 for (
unsigned j=0;j<nnod1;j++)
750 Trace_file <<
", \"azimuthal node " << j <<
"\" ";
752 Trace_file << std::endl;
803 time_pt()->time()=time0;
809 assign_initial_values_impulsive(dt);
816 unsteady_newton_solve(dt);
821 unsigned max_adapt=1;
822 for(
unsigned i=1;i<nstep;i++)
824 unsteady_newton_solve(dt,max_adapt,
false);
838 int main(
int argc,
char* argv[])
842 CommandLineArgs::setup(argc,argv);
854 unsigned case_number=0;
859 cout <<
"Running case " << case_number
860 <<
": Pure displacement formulation" << std::endl;
862 problem.
run(case_number);
868 cout <<
"Running case " << case_number
869 <<
": Pressure/displacement with Crouzeix-Raviart pressure" << std::endl;
872 problem.
run(case_number);
879 cout <<
"Running case " << case_number
880 <<
": Pressure/displacement with Taylor-Hood pressure" << std::endl;
882 Newmark<1> > problem;
883 problem.
run(case_number);
////////////////////////////////////////////////////////////////////// //////////////////////////////...
SolidMesh * Traction_mesh_pt
Pointer to mesh of traction elements.
void dump_it(ofstream &dump_file)
Dump problem-specific parameters values, then dump generic problem data.
void actions_after_newton_solve()
Update function (empty)
void actions_before_newton_solve()
Update function (empty)
ElasticRefineableQuarterCircleSectorMesh< ELEMENT > *& solid_mesh_pt()
Access function for the solid mesh.
ElasticRefineableQuarterCircleSectorMesh< ELEMENT > * Solid_mesh_pt
Pointer to solid mesh.
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.
Vector< Node * > Trace_node_pt
Vector of pointers to nodes whose position we're tracing.
ofstream Trace_file
Trace file.
SolidMesh *& traction_mesh_pt()
Access function for the mesh of surface traction elements.
void actions_after_adapt()
Actions after adaption: Kill and then re-build the traction elements on boundary 1 and re-assign the ...
DiskShockWaveProblem()
Constructor:
void restart(ifstream &restart_file)
Read problem-specific parameter values, then recover generic problem data.
void run(const unsigned &case_number)
Run the problem; specify case_number to label output directory.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
void remake_traction_element_mesh(SolidMesh *&traction_mesh_pt)
Function to wipe and re-create mesh made of traction elements.
void make_traction_element_mesh(SolidMesh *&traction_mesh_pt)
Function to create mesh made of traction elements.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
void constant_pressure(const Vector< double > &xi, const Vector< double > &x, const Vector< double > &n, Vector< double > &traction)
Constant pressure load.
double P
Uniform pressure.
ConstitutiveLaw * Constitutive_law_pt
Pointer to constitutive law.
double Nu
Poisson's ratio.
int main(int argc, char *argv[])
Driver for simple elastic problem.