37 #include "constitutive.h" 40 #include "meshes/tetgen_mesh.h" 44 using namespace oomph;
51 template<
class ELEMENT>
53 public virtual SolidMesh
60 const std::string& element_file_name,
61 const std::string& poly_file_name,
62 TimeStepper* time_stepper_pt=
63 &Mesh::Default_TimeStepper) :
64 TetgenMesh<ELEMENT>(node_file_name, element_file_name,
65 poly_file_name, time_stepper_pt)
68 set_lagrangian_nodal_coordinates();
75 unsigned n_node=this->nnode();
76 for (
unsigned j=0;j<n_node;j++)
78 Node* nod_pt=this->node_pt(j);
81 if (nod_pt->x(1)>2.99)
83 this->convert_to_boundary_node(nod_pt);
84 this->remove_boundary_node(0,nod_pt);
85 this->add_boundary_node(2,nod_pt);
89 if (nod_pt->x(2)>2.99)
91 this->convert_to_boundary_node(nod_pt);
92 this->remove_boundary_node(0,nod_pt);
93 this->add_boundary_node(3,nod_pt);
97 TetgenMesh<ELEMENT>::setup_boundary_element_info();
130 const Vector<double> &xi,
147 const Vector<double> &n, Vector<double> &traction)
149 unsigned dim = traction.size();
150 for(
unsigned i=0;i<dim;i++)
152 traction[i] = -P*n[i];
167 template<
class ELEMENT>
186 void doc_solution(DocInfo& doc_info);
203 template<
class ELEMENT>
209 string node_file_name=
"cube_hole.1.node";
210 string element_file_name=
"cube_hole.1.ele";
211 string face_file_name=
"cube_hole.1.face";
220 Traction_mesh_pt=
new SolidMesh;
223 unsigned n_element = Solid_mesh_pt->nboundary_element(b);
226 for(
unsigned e=0;e<n_element;e++)
229 ELEMENT* bulk_elem_pt =
dynamic_cast<ELEMENT*
>(
230 Solid_mesh_pt->boundary_element_pt(b,e));
233 int face_index = Solid_mesh_pt->face_index_at_boundary(b,e);
236 SolidTractionElement<ELEMENT> *el_pt =
237 new SolidTractionElement<ELEMENT>(bulk_elem_pt,face_index);
240 Traction_mesh_pt->add_element_pt(el_pt);
249 add_sub_mesh(Solid_mesh_pt);
250 add_sub_mesh(Traction_mesh_pt);
257 std::ofstream bc_file(
"pinned_nodes.dat");
261 unsigned num_nod= Solid_mesh_pt->nboundary_node(ibound);
262 for (
unsigned inod=0;inod<num_nod;inod++)
265 SolidNode* nod_pt=Solid_mesh_pt->boundary_node_pt(ibound,inod);
268 for (
unsigned i=0;i<3;i++)
270 nod_pt->pin_position(i);
273 bc_file << nod_pt->x(i) <<
" ";
276 bc_file << std::endl;
280 n_element = Solid_mesh_pt->nelement();
281 for(
unsigned i=0;i<n_element;i++)
284 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(Solid_mesh_pt->element_pt(i));
287 el_pt->constitutive_law_pt() =
296 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
305 template<
class ELEMENT>
318 sprintf(filename,
"%s/boundaries%i.dat",doc_info.directory().c_str(),
320 some_file.open(filename);
321 Solid_mesh_pt->output_boundaries(some_file);
327 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
329 some_file.open(filename);
330 Solid_mesh_pt->output(some_file,npts);
336 sprintf(filename,
"%s/traction%i.dat",doc_info.directory().c_str(),
338 some_file.open(filename);
339 Traction_mesh_pt->output(some_file,npts);
358 doc_info.set_directory(
"RESLT");
374 double pressure_increment=-8.0e-3;
377 for (
unsigned istep=0;istep<nstep;istep++)
380 problem.newton_solve();
double Gravity
Non-dim gravity.
void doc_solution(DocInfo &doc_info)
Doc the solution.
Unstructured solid problem.
ConstitutiveLaw * Constitutive_law_pt
Pointer to constitutive law.
UnstructuredSolidProblem()
Constructor:
double P
Uniform pressure.
virtual ~ElasticTetMesh()
Empty Destructor.
int main()
Demonstrate how to solve an unstructured solid problem.
ElasticTetMesh< ELEMENT > * Solid_mesh_pt
Bulk mesh.
void actions_after_newton_solve()
Update the problem specs before solve: empty.
Triangle-based mesh upgraded to become a solid mesh.
void gravity(const double &time, const Vector< double > &xi, Vector< double > &b)
Non-dimensional gravity as body force.
ElasticTetMesh(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:
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...
~UnstructuredSolidProblem()
Destructor (empty)
SolidMesh * Traction_mesh_pt
Pointer to mesh of traction elements.
double Nu
Poisson's ratio.
void actions_before_newton_solve()
Update the problem specs before solve: empty.