43 #include "meshes/simple_cubic_mesh.template.h" 47 using namespace oomph;
57 template<
class ELEMENT>
59 public virtual RefineableBrickMesh<ELEMENT>,
60 public virtual SolidMesh
68 const double &a,
const double &b,
70 TimeStepper* time_stepper_pt =
71 &Mesh::Default_TimeStepper) :
72 SimpleCubicMesh<ELEMENT>(nx,ny,nz,-a,a,-b,b,-c,c,time_stepper_pt),
73 RefineableBrickMesh<ELEMENT>(), SolidMesh()
76 this->setup_octree_forest();
78 set_lagrangian_nodal_coordinates();
140 template<
class ELEMENT>
145 void set_incompressible(ELEMENT *el_pt,
const bool &incompressible);
153 void run(
const std::string &dirname);
158 (Problem::mesh_pt());}
161 void doc_solution(DocInfo& doc_info);
169 for(
unsigned b=0;b<6;b++)
172 unsigned n_node = mesh_pt()->nboundary_node(b);
173 for(
unsigned n=0;n<n_node;n++)
176 for(
unsigned i=1;i<3;i++)
178 mesh_pt()->boundary_node_pt(b,n)->pin_position(i);
183 mesh_pt()->boundary_node_pt(b,n)->pin_position(0);
189 PVDEquationsBase<3>::pin_redundant_nodal_solid_pressures(
190 mesh_pt()->element_pt());
203 PVDEquationsBase<3>::pin_redundant_nodal_solid_pressures(
204 mesh_pt()->element_pt());
218 apply_boundary_conditions();
219 bool update_all_solid_nodes=
true;
220 mesh_pt()->node_update(update_all_solid_nodes);
227 unsigned num_nod=mesh_pt()->nboundary_node(ibound);
228 for (
unsigned inod=0;inod<num_nod;inod++)
230 SolidNode *solid_nod_pt =
static_cast<SolidNode*
>(
231 mesh_pt()->boundary_node_pt(ibound,inod));
233 solid_nod_pt->x(0) = solid_nod_pt->xi(0) + Shear*
243 template<
class ELEMENT>
247 double a = 1.0, b = 1.0, c = 1.0;
248 unsigned nx = 2, ny = 2, nz = 2;
254 mesh_pt()->spatial_error_estimator_pt() =
new Z2ErrorEstimator;
258 unsigned n_element =
mesh_pt()->nelement();
259 for(
unsigned i=0;i<n_element;i++)
262 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(
mesh_pt()->element_pt(i));
265 el_pt->constitutive_law_pt() =
277 cout << assign_eqn_numbers() << std::endl;
284 template<
class ELEMENT>
295 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
297 some_file.open(filename);
298 mesh_pt()->output(some_file,npts);
301 sprintf(filename,
"%s/stress%i.dat", doc_info.directory().c_str(),
303 some_file.open(filename);
305 Vector<double> s(3,0.0);
307 DenseMatrix<double> sigma(3,3);
309 unsigned n_element =
mesh_pt()->nelement();
310 for(
unsigned e=0;e<n_element;e++)
312 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(
mesh_pt()->element_pt(e));
313 el_pt->interpolated_x(s,x);
314 el_pt->get_stress(s,sigma);
317 for(
unsigned i=0;i<3;i++)
319 some_file << x[i] <<
" ";
321 for(
unsigned i=0;i<3;i++)
323 for(
unsigned j=0;j<3;j++)
325 some_file << sigma(i,j) <<
" ";
328 some_file << std::endl;
338 template<
class ELEMENT>
346 doc_info.set_directory(dirname);
360 for(
unsigned i=0;i<nstep;i++)
367 Vector<unsigned> refine_pattern(2);
368 refine_pattern[0] = 0; refine_pattern[1] = 7;
369 refine_selected_elements(refine_pattern);
382 template<
class ELEMENT>
384 ELEMENT *el_pt,
const bool &incompressible)
392 QPVDElementWithPressure<3> *el_pt,
const bool &incompressible)
394 if(incompressible) {el_pt->set_incompressible();}
395 else {el_pt->set_compressible();}
401 QPVDElementWithContinuousPressure<3> *el_pt,
const bool &incompressible)
403 if(incompressible) {el_pt->set_incompressible();}
404 else {el_pt->set_compressible();}
428 new IsotropicStrainEnergyFunctionConstitutiveLaw(
434 problem.
run(
"RESLT_ref");
440 problem.
run(
"RESLT_pres_ref");
447 problem.
run(
"RESLT_cont_pres_ref");
double Gravity
Body force.
void actions_before_newton_solve()
Update before solve: We're dealing with a static problem so the nodal positions before the next solve...
SimpleShearProblem(const bool &incompressible)
Constructor:
void apply_boundary_conditions()
Shear the top.
void body_force(const Vector< double > &xi, const double &t, Vector< double > &b)
Body force vector: Vertically downwards with magnitude Gravity.
Simple cubic mesh upgraded to become a solid mesh.
ConstitutiveLaw * Constitutive_law_pt
Pointer to constitutive law.
void actions_after_adapt()
Need to pin the redundent solid pressures after adaptation.
int main()
Driver for simple elastic problem.
virtual ~RefineableElasticCubicMesh()
Empty Destructor.
void doc_solution(DocInfo &doc_info)
Doc the solution.
StrainEnergyFunction * Strain_energy_function_pt
Pointer to strain energy function.
RefineableElasticCubicMesh(const unsigned &nx, const unsigned &ny, const unsigned &nz, const double &a, const double &b, const double &c, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor:
void set_incompressible(ELEMENT *el_pt, const bool &incompressible)
void actions_after_newton_solve()
Update function (empty)
Boundary-driven elastic deformation of fish-shaped domain.
void setup_boundary_conditions()
double C1
"Mooney Rivlin" coefficient for generalised Mooney Rivlin law
void run(const std::string &dirname)
Run simulation.
RefineableElasticCubicMesh< ELEMENT > * mesh_pt()
Access function for the mesh.
double Nu
Poisson's ratio.