33 #include "constitutive.h"
37 #include "meshes/triangle_mesh.h"
40 using namespace oomph;
46 template<
class ELEMENT>
48 public virtual SolidMesh
55 const std::string& element_file_name,
56 const std::string& poly_file_name,
57 TimeStepper* time_stepper_pt=
58 &Mesh::Default_TimeStepper) :
59 TriangleMesh<ELEMENT>(node_file_name,element_file_name,
60 poly_file_name, time_stepper_pt)
63 set_lagrangian_nodal_coordinates();
68 unsigned n_node=this->nnode();
69 for (
unsigned j=0;j<n_node;j++)
71 Node* nod_pt=this->node_pt(j);
74 if (nod_pt->x(1)<0.15)
76 this->remove_boundary_node(0,nod_pt);
77 this->add_boundary_node(1,nod_pt);
81 if (nod_pt->x(1)>2.69)
83 this->remove_boundary_node(0,nod_pt);
84 this->add_boundary_node(2,nod_pt);
88 std::cout <<
"About to setup the boundary elements" << std::endl;
90 TriangleMesh<ELEMENT>::setup_boundary_element_info();
120 void gravity(
const double& time,
121 const Vector<double> &xi,
137 const Vector<double> &n, Vector<double> &traction)
139 unsigned dim = traction.size();
140 for(
unsigned i=0;i<dim;i++)
142 traction[i] = -
P*n[i];
156 template<
class ELEMENT>
177 SolidMesh* Traction_mesh_pt;
186 template<
class ELEMENT>
191 string node_file_name=
"solid.fig.1.node";
192 string element_file_name=
"solid.fig.1.ele";
193 string poly_file_name=
"solid.fig.1.poly";
202 Traction_mesh_pt=
new SolidMesh;
205 unsigned n_element = Solid_mesh_pt->nboundary_element(b);
208 for(
unsigned e=0;e<n_element;e++)
211 ELEMENT* bulk_elem_pt =
dynamic_cast<ELEMENT*
>(
212 Solid_mesh_pt->boundary_element_pt(b,e));
215 int face_index = Solid_mesh_pt->face_index_at_boundary(b,e);
218 SolidTractionElement<ELEMENT> *el_pt =
219 new SolidTractionElement<ELEMENT>(bulk_elem_pt,face_index);
222 Traction_mesh_pt->add_element_pt(el_pt);
229 add_sub_mesh(Solid_mesh_pt);
230 add_sub_mesh(Traction_mesh_pt);
236 std::ofstream bc_file(
"pinned_nodes.dat");
240 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
241 for (
unsigned inod=0;inod<num_nod;inod++)
245 SolidNode* nod_pt=Solid_mesh_pt->boundary_node_pt(ibound,inod);
248 for (
unsigned i=0;i<2;i++)
250 nod_pt->pin_position(i);
253 bc_file << nod_pt->x(i) <<
" ";
256 bc_file << std::endl;
262 n_element = Solid_mesh_pt->nelement();
263 for(
unsigned i=0;i<n_element;i++)
266 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(Solid_mesh_pt->element_pt(i));
269 el_pt->constitutive_law_pt() =
277 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
285 template<
class ELEMENT>
298 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
300 some_file.open(filename);
301 Solid_mesh_pt->output(some_file,npts);
306 sprintf(filename,
"%s/traction%i.dat",doc_info.directory().c_str(),
308 some_file.open(filename);
309 Traction_mesh_pt->output(some_file,npts);
314 sprintf(filename,
"%s/boundaries.dat",doc_info.directory().c_str());
315 some_file.open(filename);
316 Solid_mesh_pt->output_boundaries(some_file);
334 doc_info.set_directory(
"RESLT");
341 std::cout <<
"Running with pure displacement formulation\n";
353 double pressure_increment=-1.0e-4;
356 for (
unsigned istep=0;istep<nstep;istep++)
359 problem.newton_solve();
372 std::cout <<
"Running with pressure/displacement formulation\n";
375 doc_info.set_directory(
"RESLT_pres_disp");
377 doc_info.number() = 0;
389 double pressure_increment=-1.0e-4;
392 for (
unsigned istep=0;istep<nstep;istep++)
395 problem.newton_solve();
411 "Running with pressure/displacement formulation (incompressible) \n";
414 doc_info.set_directory(
"RESLT_pres_disp_incomp");
416 doc_info.number() = 0;
423 const unsigned n_element = problem.mesh_pt()->nelement();
424 for(
unsigned e=0;e<n_element;e++)
427 PVDEquationsWithPressure<2> *cast_el_pt =
428 dynamic_cast<PVDEquationsWithPressure<2>*
>(
429 problem.mesh_pt()->element_pt(e));
433 if(cast_el_pt) {cast_el_pt->set_incompressible();}
445 double pressure_increment=-1.0e-4;
448 for (
unsigned istep=0;istep<nstep;istep++)
451 problem.newton_solve();
Triangle-based mesh upgraded to become a solid mesh.
ElasticTriangleMesh(const std::string &node_file_name, const std::string &element_file_name, const std::string &poly_file_name, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor:
virtual ~ElasticTriangleMesh()
Empty Destructor.
Unstructured solid problem.
UnstructuredSolidProblem()
Constructor:
~UnstructuredSolidProblem()
Destructor (empty)
ElasticTriangleMesh< ELEMENT > * Solid_mesh_pt
Bulk mesh.
void doc_solution(DocInfo &doc_info)
Doc the solution.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
void gravity(const double &time, const Vector< double > &xi, Vector< double > &b)
Non-dimensional gravity as body force.
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 P
Uniform pressure.
double Nu
Poisson's ratio.
ConstitutiveLaw * Constitutive_law_pt
Pointer to constitutive law.
double Gravity
Non-dim gravity.
int main()
Demonstrate how to solve an unstructured solid problem.