33 #include "constitutive.h"
36 #include "meshes/tetgen_mesh.h"
40 using namespace oomph;
47 template<
class ELEMENT>
49 public virtual SolidMesh
56 const std::string& element_file_name,
57 const std::string& poly_file_name,
58 TimeStepper* time_stepper_pt=
59 &Mesh::Default_TimeStepper) :
60 TetgenMesh<ELEMENT>(node_file_name, element_file_name,
61 poly_file_name, time_stepper_pt)
64 set_lagrangian_nodal_coordinates();
71 unsigned n_node=this->nnode();
72 for (
unsigned j=0;j<n_node;j++)
74 Node* nod_pt=this->node_pt(j);
77 if (nod_pt->x(1)>2.99)
79 this->convert_to_boundary_node(nod_pt);
80 this->remove_boundary_node(0,nod_pt);
81 this->add_boundary_node(2,nod_pt);
85 if (nod_pt->x(2)>2.99)
87 this->convert_to_boundary_node(nod_pt);
88 this->remove_boundary_node(0,nod_pt);
89 this->add_boundary_node(3,nod_pt);
93 TetgenMesh<ELEMENT>::setup_boundary_element_info();
126 const Vector<double> &xi,
143 const Vector<double> &n, Vector<double> &traction)
145 unsigned dim = traction.size();
146 for(
unsigned i=0;i<dim;i++)
148 traction[i] = -
P*n[i];
163 template<
class ELEMENT>
182 void doc_solution(DocInfo& doc_info);
199 template<
class ELEMENT>
205 string node_file_name=
"cube_hole.1.node";
206 string element_file_name=
"cube_hole.1.ele";
207 string face_file_name=
"cube_hole.1.face";
216 Traction_mesh_pt=
new SolidMesh;
219 unsigned n_element = Solid_mesh_pt->nboundary_element(b);
222 for(
unsigned e=0;e<n_element;e++)
225 ELEMENT* bulk_elem_pt =
dynamic_cast<ELEMENT*
>(
226 Solid_mesh_pt->boundary_element_pt(b,e));
229 int face_index = Solid_mesh_pt->face_index_at_boundary(b,e);
232 SolidTractionElement<ELEMENT> *el_pt =
233 new SolidTractionElement<ELEMENT>(bulk_elem_pt,face_index);
236 Traction_mesh_pt->add_element_pt(el_pt);
245 add_sub_mesh(Solid_mesh_pt);
246 add_sub_mesh(Traction_mesh_pt);
253 std::ofstream bc_file(
"pinned_nodes.dat");
257 unsigned num_nod= Solid_mesh_pt->nboundary_node(ibound);
258 for (
unsigned inod=0;inod<num_nod;inod++)
261 SolidNode* nod_pt=Solid_mesh_pt->boundary_node_pt(ibound,inod);
264 for (
unsigned i=0;i<3;i++)
266 nod_pt->pin_position(i);
269 bc_file << nod_pt->x(i) <<
" ";
272 bc_file << std::endl;
276 n_element = Solid_mesh_pt->nelement();
277 for(
unsigned i=0;i<n_element;i++)
280 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(Solid_mesh_pt->element_pt(i));
283 el_pt->constitutive_law_pt() =
292 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
301 template<
class ELEMENT>
314 sprintf(filename,
"%s/boundaries%i.dat",doc_info.directory().c_str(),
316 some_file.open(filename);
317 Solid_mesh_pt->output_boundaries(some_file);
323 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
325 some_file.open(filename);
326 Solid_mesh_pt->output(some_file,npts);
332 sprintf(filename,
"%s/traction%i.dat",doc_info.directory().c_str(),
334 some_file.open(filename);
335 Traction_mesh_pt->output(some_file,npts);
354 doc_info.set_directory(
"RESLT");
370 double pressure_increment=-8.0e-3;
373 for (
unsigned istep=0;istep<nstep;istep++)
376 problem.newton_solve();
Triangle-based mesh upgraded to become a solid mesh.
virtual ~ElasticTetMesh()
Empty Destructor.
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:
Unstructured solid problem.
ElasticTetMesh< ELEMENT > * Solid_mesh_pt
Bulk mesh.
UnstructuredSolidProblem()
Constructor:
~UnstructuredSolidProblem()
Destructor (empty)
void actions_after_newton_solve()
Update the problem specs before solve: empty.
void doc_solution(DocInfo &doc_info)
Doc the solution.
SolidMesh * Traction_mesh_pt
Pointer to mesh of traction elements.
void actions_before_newton_solve()
Update the problem specs before solve: empty.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
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.