39 #include "meshes/simple_cubic_mesh.template.h"
43 using namespace oomph;
53 template<
class ELEMENT>
55 public virtual RefineableBrickMesh<ELEMENT>,
56 public virtual SolidMesh
64 const double &a,
const double &b,
66 TimeStepper* time_stepper_pt =
67 &Mesh::Default_TimeStepper) :
68 SimpleCubicMesh<ELEMENT>(nx,ny,nz,-a,a,-b,b,-c,c,time_stepper_pt),
69 RefineableBrickMesh<ELEMENT>(), SolidMesh()
72 this->setup_octree_forest();
74 set_lagrangian_nodal_coordinates();
136 template<
class ELEMENT>
141 void set_incompressible(ELEMENT *el_pt,
const bool &incompressible);
149 void run(
const std::string &dirname);
154 (Problem::mesh_pt());}
157 void doc_solution(DocInfo& doc_info);
165 for(
unsigned b=0;b<6;b++)
168 unsigned n_node = mesh_pt()->nboundary_node(b);
169 for(
unsigned n=0;n<n_node;n++)
172 for(
unsigned i=1;i<3;i++)
174 mesh_pt()->boundary_node_pt(b,n)->pin_position(i);
179 mesh_pt()->boundary_node_pt(b,n)->pin_position(0);
185 PVDEquationsBase<3>::pin_redundant_nodal_solid_pressures(
186 mesh_pt()->element_pt());
199 PVDEquationsBase<3>::pin_redundant_nodal_solid_pressures(
200 mesh_pt()->element_pt());
214 apply_boundary_conditions();
215 bool update_all_solid_nodes=
true;
216 mesh_pt()->node_update(update_all_solid_nodes);
223 unsigned num_nod=mesh_pt()->nboundary_node(ibound);
224 for (
unsigned inod=0;inod<num_nod;inod++)
226 SolidNode *solid_nod_pt =
static_cast<SolidNode*
>(
227 mesh_pt()->boundary_node_pt(ibound,inod));
229 solid_nod_pt->x(0) = solid_nod_pt->xi(0) + Shear*
239 template<
class ELEMENT>
243 double a = 1.0, b = 1.0, c = 1.0;
244 unsigned nx = 2, ny = 2, nz = 2;
250 mesh_pt()->spatial_error_estimator_pt() =
new Z2ErrorEstimator;
254 unsigned n_element =
mesh_pt()->nelement();
255 for(
unsigned i=0;i<n_element;i++)
258 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(
mesh_pt()->element_pt(i));
261 el_pt->constitutive_law_pt() =
273 cout << assign_eqn_numbers() << std::endl;
280 template<
class ELEMENT>
291 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
293 some_file.open(filename);
294 mesh_pt()->output(some_file,npts);
297 sprintf(filename,
"%s/stress%i.dat", doc_info.directory().c_str(),
299 some_file.open(filename);
301 Vector<double> s(3,0.0);
303 DenseMatrix<double> sigma(3,3);
305 unsigned n_element = mesh_pt()->nelement();
306 for(
unsigned e=0;e<n_element;e++)
308 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e));
309 el_pt->interpolated_x(s,x);
310 el_pt->get_stress(s,sigma);
313 for(
unsigned i=0;i<3;i++)
315 some_file << x[i] <<
" ";
317 for(
unsigned i=0;i<3;i++)
319 for(
unsigned j=0;j<3;j++)
321 some_file << sigma(i,j) <<
" ";
324 some_file << std::endl;
334 template<
class ELEMENT>
342 doc_info.set_directory(dirname);
356 for(
unsigned i=0;i<nstep;i++)
363 Vector<unsigned> refine_pattern(2);
364 refine_pattern[0] = 0; refine_pattern[1] = 7;
365 refine_selected_elements(refine_pattern);
370 doc_solution(doc_info);
378 template<
class ELEMENT>
380 ELEMENT *el_pt,
const bool &incompressible)
388 QPVDElementWithPressure<3> *el_pt,
const bool &incompressible)
391 else {el_pt->set_compressible();}
397 QPVDElementWithContinuousPressure<3> *el_pt,
const bool &incompressible)
400 else {el_pt->set_compressible();}
424 new IsotropicStrainEnergyFunctionConstitutiveLaw(
430 problem.
run(
"RESLT_ref");
436 problem.
run(
"RESLT_pres_ref");
443 problem.
run(
"RESLT_cont_pres_ref");
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
virtual ~RefineableElasticCubicMesh()
Empty Destructor.
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 apply_boundary_conditions()
Shear the top.
void setup_boundary_conditions()
void doc_solution(DocInfo &doc_info)
Doc the solution.
void actions_before_newton_solve()
Update before solve: We're dealing with a static problem so the nodal positions before the next solve...
RefineableElasticCubicMesh< ELEMENT > * mesh_pt()
Access function for the mesh.
void set_incompressible(ELEMENT *el_pt, const bool &incompressible)
void actions_after_adapt()
Need to pin the redundent solid pressures after adaptation.
void actions_after_newton_solve()
Update function (empty)
void run(const std::string &dirname)
Run simulation.
SimpleShearProblem(const bool &incompressible)
Constructor:
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
void body_force(const Vector< double > &xi, const double &t, Vector< double > &b)
Body force vector: Vertically downwards with magnitude Gravity.
double Nu
Poisson's ratio.
ConstitutiveLaw * Constitutive_law_pt
Pointer to constitutive law.
double C1
"Mooney Rivlin" coefficient for generalised Mooney Rivlin law
double Gravity
Body force.
StrainEnergyFunction * Strain_energy_function_pt
Pointer to strain energy function.
int main()
Driver for simple elastic problem.