37 #include "constitutive.h"    40 #include "meshes/tetgen_mesh.h"    43 using namespace oomph;
    50 template<
class ELEMENT>
    52                        public virtual SolidMesh 
    59                 const std::string& element_file_name,
    60                 const std::string& face_file_name,
    61                 TimeStepper* time_stepper_pt=
    62                 &Mesh::Default_TimeStepper) : 
    63   TetgenMesh<ELEMENT>(node_file_name, element_file_name,
    64                       face_file_name, time_stepper_pt)
    67    set_lagrangian_nodal_coordinates();
    70    setup_boundary_element_info();
   102               const Vector<double> &xi,
   119                         const Vector<double> &n, Vector<double> &traction)
   121   unsigned dim = traction.size();
   122   for(
unsigned i=0;i<dim;i++)
   124     traction[i] = -P*n[i];
   139 template<
class ELEMENT>
   152  void doc_solution(DocInfo& doc_info);
   157  void create_traction_elements();
   178 template<
class ELEMENT>
   183  string node_file_name=
"fsi_bifurcation_solid.1.node";
   184  string element_file_name=
"fsi_bifurcation_solid.1.ele";
   185  string face_file_name=
"fsi_bifurcation_solid.1.face";
   194  Pinned_solid_boundary_id.resize(3);
   195  Pinned_solid_boundary_id[0]=0;
   196  Pinned_solid_boundary_id[1]=1;
   197  Pinned_solid_boundary_id[2]=2;
   200  Solid_traction_boundary_id.resize(12);
   201  for (
unsigned i=0;i<12;i++)
   203    Solid_traction_boundary_id[i]=i+3;
   211  std::ofstream bc_file(
"RESLT/pinned_solid_nodes.dat");
   214  unsigned n=Pinned_solid_boundary_id.size();
   215  for (
unsigned i=0;i<n;i++)
   218    unsigned b=Pinned_solid_boundary_id[i];
   219    unsigned num_nod= Solid_mesh_pt->nboundary_node(b);  
   220    for (
unsigned inod=0;inod<num_nod;inod++)
   223      SolidNode* nod_pt=Solid_mesh_pt->boundary_node_pt(b,inod);
   226      for (
unsigned i=0;i<3;i++)
   228        nod_pt->pin_position(i);
   231        bc_file << nod_pt->x(i) << 
" ";
   234      bc_file << std::endl;
   243  unsigned n_element = Solid_mesh_pt->nelement();
   244  for(
unsigned i=0;i<n_element;i++)
   247    ELEMENT *el_pt = 
dynamic_cast<ELEMENT*
>(
   248     Solid_mesh_pt->element_pt(i));
   251    el_pt->constitutive_law_pt() =
   263  n=Solid_traction_boundary_id.size();
   264  Solid_traction_mesh_pt.resize(n);
   265  for (
unsigned i=0;i<n;i++)
   267    Solid_traction_mesh_pt[i]=
new SolidMesh;
   271  create_traction_elements();
   278  add_sub_mesh(Solid_mesh_pt);
   281  n=Solid_traction_boundary_id.size();
   282  for (
unsigned i=0;i<n;i++)
   284    add_sub_mesh(Solid_traction_mesh_pt[i]);
   291  std::cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl; 
   300 template<
class ELEMENT>
   305  unsigned n=Solid_traction_boundary_id.size();
   306  for (
unsigned i=0;i<n;i++)
   309    unsigned b=Solid_traction_boundary_id[i];
   312    unsigned n_element = Solid_mesh_pt->nboundary_element(b);
   315    for(
unsigned e=0;e<n_element;e++)
   318      ELEMENT* bulk_elem_pt = 
dynamic_cast<ELEMENT*
>(
   319       Solid_mesh_pt->boundary_element_pt(b,e));
   322      int face_index = Solid_mesh_pt->face_index_at_boundary(b,e);
   325      SolidTractionElement<ELEMENT>* el_pt=
   326       new SolidTractionElement<ELEMENT>(bulk_elem_pt,face_index);
   329      Solid_traction_mesh_pt[i]->add_element_pt(el_pt);
   343 template<
class ELEMENT>
   356  sprintf(filename,
"%s/solid_soln%i.dat",doc_info.directory().c_str(),
   358  some_file.open(filename);
   359  Solid_mesh_pt->output(some_file,npts);
   365  sprintf(filename,
"%s/traction%i.dat",doc_info.directory().c_str(),
   367  some_file.open(filename);
   368  unsigned n=Solid_traction_boundary_id.size();
   369  for (
unsigned i=0;i<n;i++)
   371    Solid_traction_mesh_pt[i]->output(some_file,npts);
   384 int main(
int argc, 
char **argv)
   387  CommandLineArgs::setup(argc,argv);
   393  doc_info.set_directory(
"RESLT");
   404  double g_increment=1.0e-3; 
   405  double p_increment=1.0e-2; 
   408  if (CommandLineArgs::Argc!=1)
   410    std::cout << 
"Validation -- only doing two steps" << std::endl;
   415  for (
unsigned istep=0;istep<nstep;istep++)
   418    problem.newton_solve();
 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...
 
void doc_solution(DocInfo &doc_info)
Doc the solution. 
 
Unstructured solid problem. 
 
Vector< unsigned > Solid_traction_boundary_id
IDs of solid mesh boundaries which make up the traction interface. 
 
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: 
 
void create_traction_elements()
Create traction elements. 
 
virtual ~MySolidTetgenMesh()
Empty Destructor. 
 
MySolidTetgenMesh< ELEMENT > * Solid_mesh_pt
Bulk solid mesh. 
 
UnstructuredSolidProblem()
Constructor: 
 
double Gravity
Non-dim gravity. 
 
Vector< SolidMesh * > Solid_traction_mesh_pt
Meshes of traction elements. 
 
double Nu
Poisson's ratio. 
 
Vector< unsigned > Pinned_solid_boundary_id
IDs of solid mesh boundaries where displacements are pinned. 
 
void gravity(const double &time, const Vector< double > &xi, Vector< double > &b)
Non-dimensional gravity as body force. 
 
Tetgen-based mesh upgraded to become a solid mesh. 
 
int main(int argc, char **argv)
Demonstrate how to solve an unstructured 3D solid problem. 
 
double P
Uniform pressure. 
 
ConstitutiveLaw * Constitutive_law_pt
Create constitutive law. 
 
~UnstructuredSolidProblem()
Destructor (empty)