37 #include "meshes/simple_cubic_mesh.template.h"
41 using namespace oomph;
51 template<
class ELEMENT>
53 public virtual SolidMesh
60 const double &a,
const double &b,
const double &c,
61 TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper) :
62 SimpleCubicMesh<ELEMENT>(nx,ny,nz,-a,a,-b,b,-c,c,time_stepper_pt)
65 set_lagrangian_nodal_coordinates();
127 template<
class ELEMENT>
140 void run(
const std::string &dirname);
163 apply_boundary_conditions();
164 bool update_all_solid_nodes=
true;
165 mesh_pt()->node_update(update_all_solid_nodes);
172 unsigned num_nod=mesh_pt()->nboundary_node(ibound);
173 for (
unsigned inod=0;inod<num_nod;inod++)
175 SolidNode *solid_nod_pt =
static_cast<SolidNode*
>(
176 mesh_pt()->boundary_node_pt(ibound,inod));
178 solid_nod_pt->x(0) = solid_nod_pt->xi(0) + Shear*
188 template<
class ELEMENT>
192 double a = 1.0, b = 1.0, c = 1.0;
193 unsigned nx = 5, ny = 5, nz = 5;
199 for(
unsigned b=0;b<6;b++)
202 unsigned n_node =
mesh_pt()->nboundary_node(b);
203 for(
unsigned n=0;n<n_node;n++)
206 for(
unsigned i=1;i<3;i++)
208 mesh_pt()->boundary_node_pt(b,n)->pin_position(i);
213 mesh_pt()->boundary_node_pt(b,n)->pin_position(0);
219 unsigned n_element =
mesh_pt()->nelement();
220 for(
unsigned i=0;i<n_element;i++)
223 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(
mesh_pt()->element_pt(i));
226 el_pt->constitutive_law_pt() =
240 cout << assign_eqn_numbers() << std::endl;
247 template<
class ELEMENT>
258 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
260 some_file.open(filename);
261 mesh_pt()->output(some_file,npts);
264 sprintf(filename,
"%s/stress%i.dat", doc_info.directory().c_str(),
266 some_file.open(filename);
268 Vector<double> s(3,0.0);
270 DenseMatrix<double> sigma(3,3);
272 unsigned n_element = mesh_pt()->nelement();
273 for(
unsigned e=0;e<n_element;e++)
275 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e));
276 el_pt->interpolated_x(s,x);
277 el_pt->get_stress(s,sigma);
280 for(
unsigned i=0;i<3;i++)
282 some_file << x[i] <<
" ";
284 for(
unsigned i=0;i<3;i++)
286 for(
unsigned j=0;j<3;j++)
288 some_file << sigma(i,j) <<
" ";
291 some_file << std::endl;
301 template<
class ELEMENT>
309 doc_info.set_directory(dirname);
321 for(
unsigned i=0;i<nstep;i++)
328 doc_solution(doc_info);
338 QPVDElement<3,3> *el_pt,
const bool &incompressible)
346 QPVDElementWithPressure<3> *el_pt,
const bool &incompressible)
349 else {el_pt->set_compressible();}
355 QPVDElementWithContinuousPressure<3> *el_pt,
const bool &incompressible)
358 else {el_pt->set_compressible();}
372 for (
unsigned i=0;i<2;i++)
383 new IsotropicStrainEnergyFunctionConstitutiveLaw(
389 problem.
run(
"RESLT");
396 problem.
run(
"RESLT_pres");
409 problem.
run(
"RESLT_cont_pres");
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
virtual ~ElasticCubicMesh()
Empty Destructor.
ElasticCubicMesh(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 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_newton_solve()
Update function (empty)
void run(const std::string &dirname)
Run simulation.
SimpleShearProblem(const bool &incompressible)
Constructor:
ElasticCubicMesh< ELEMENT > * mesh_pt()
Access function for the mesh.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
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.