33 #include "constitutive.h"
36 #include "meshes/tetgen_mesh.h"
39 using namespace oomph;
46 template<
class ELEMENT>
48 public virtual SolidMesh
55 const std::string& element_file_name,
56 const std::string& face_file_name,
57 TimeStepper* time_stepper_pt=
58 &Mesh::Default_TimeStepper) :
59 TetgenMesh<ELEMENT>(node_file_name, element_file_name,
60 face_file_name, time_stepper_pt)
63 set_lagrangian_nodal_coordinates();
66 setup_boundary_element_info();
98 const Vector<double> &xi,
115 const Vector<double> &n, Vector<double> &traction)
117 unsigned dim = traction.size();
118 for(
unsigned i=0;i<dim;i++)
120 traction[i] = -
P*n[i];
135 template<
class ELEMENT>
148 void doc_solution(DocInfo& doc_info);
153 void create_traction_elements();
174 template<
class ELEMENT>
179 string node_file_name=
"fsi_bifurcation_solid.1.node";
180 string element_file_name=
"fsi_bifurcation_solid.1.ele";
181 string face_file_name=
"fsi_bifurcation_solid.1.face";
190 Pinned_solid_boundary_id.resize(3);
191 Pinned_solid_boundary_id[0]=0;
192 Pinned_solid_boundary_id[1]=1;
193 Pinned_solid_boundary_id[2]=2;
196 Solid_traction_boundary_id.resize(12);
197 for (
unsigned i=0;i<12;i++)
199 Solid_traction_boundary_id[i]=i+3;
207 std::ofstream bc_file(
"RESLT/pinned_solid_nodes.dat");
210 unsigned n=Pinned_solid_boundary_id.size();
211 for (
unsigned i=0;i<n;i++)
214 unsigned b=Pinned_solid_boundary_id[i];
215 unsigned num_nod= Solid_mesh_pt->nboundary_node(b);
216 for (
unsigned inod=0;inod<num_nod;inod++)
219 SolidNode* nod_pt=Solid_mesh_pt->boundary_node_pt(b,inod);
222 for (
unsigned i=0;i<3;i++)
224 nod_pt->pin_position(i);
227 bc_file << nod_pt->x(i) <<
" ";
230 bc_file << std::endl;
239 unsigned n_element = Solid_mesh_pt->nelement();
240 for(
unsigned i=0;i<n_element;i++)
243 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(
244 Solid_mesh_pt->element_pt(i));
247 el_pt->constitutive_law_pt() =
259 n=Solid_traction_boundary_id.size();
260 Solid_traction_mesh_pt.resize(n);
261 for (
unsigned i=0;i<n;i++)
263 Solid_traction_mesh_pt[i]=
new SolidMesh;
267 create_traction_elements();
274 add_sub_mesh(Solid_mesh_pt);
277 n=Solid_traction_boundary_id.size();
278 for (
unsigned i=0;i<n;i++)
280 add_sub_mesh(Solid_traction_mesh_pt[i]);
287 std::cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
296 template<
class ELEMENT>
301 unsigned n=Solid_traction_boundary_id.size();
302 for (
unsigned i=0;i<n;i++)
305 unsigned b=Solid_traction_boundary_id[i];
308 unsigned n_element = Solid_mesh_pt->nboundary_element(b);
311 for(
unsigned e=0;e<n_element;e++)
314 ELEMENT* bulk_elem_pt =
dynamic_cast<ELEMENT*
>(
315 Solid_mesh_pt->boundary_element_pt(b,e));
318 int face_index = Solid_mesh_pt->face_index_at_boundary(b,e);
321 SolidTractionElement<ELEMENT>* el_pt=
322 new SolidTractionElement<ELEMENT>(bulk_elem_pt,face_index);
325 Solid_traction_mesh_pt[i]->add_element_pt(el_pt);
339 template<
class ELEMENT>
352 sprintf(filename,
"%s/solid_soln%i.dat",doc_info.directory().c_str(),
354 some_file.open(filename);
355 Solid_mesh_pt->output(some_file,npts);
361 sprintf(filename,
"%s/traction%i.dat",doc_info.directory().c_str(),
363 some_file.open(filename);
364 unsigned n=Solid_traction_boundary_id.size();
365 for (
unsigned i=0;i<n;i++)
367 Solid_traction_mesh_pt[i]->output(some_file,npts);
380 int main(
int argc,
char **argv)
383 CommandLineArgs::setup(argc,argv);
389 doc_info.set_directory(
"RESLT");
400 double g_increment=1.0e-3;
401 double p_increment=1.0e-2;
404 if (CommandLineArgs::Argc!=1)
406 std::cout <<
"Validation -- only doing two steps" << std::endl;
411 for (
unsigned istep=0;istep<nstep;istep++)
414 problem.newton_solve();
Tetgen-based mesh upgraded to become a solid mesh.
MySolidTetgenMesh(const std::string &node_file_name, const std::string &element_file_name, const std::string &face_file_name, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor:
virtual ~MySolidTetgenMesh()
Empty Destructor.
Unstructured solid problem.
UnstructuredSolidProblem()
Constructor:
~UnstructuredSolidProblem()
Destructor (empty)
Vector< SolidMesh * > Solid_traction_mesh_pt
Meshes of traction elements.
Vector< unsigned > Solid_traction_boundary_id
IDs of solid mesh boundaries which make up the traction interface.
Vector< unsigned > Pinned_solid_boundary_id
IDs of solid mesh boundaries where displacements are pinned.
void create_traction_elements()
Create traction elements.
void doc_solution(DocInfo &doc_info)
Doc the solution.
MySolidTetgenMesh< ELEMENT > * Solid_mesh_pt
Bulk solid mesh.
/////////////////////////////////////////////////////////////// /////////////////////////////////////...
void gravity(const double &time, const Vector< double > &xi, Vector< double > &b)
Non-dimensional gravity as body force.
double Nu
Poisson's ratio.
double P
Uniform pressure.
double Gravity
Non-dim gravity.
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...
ConstitutiveLaw * Constitutive_law_pt
Create constitutive law.
int main(int argc, char **argv)
Demonstrate how to solve an unstructured 3D solid problem.