37 #include "meshes/rectangular_quadmesh.h" 41 using namespace oomph;
49 template <
class ELEMENT>
59 void output(std::ostream &outfile,
const unsigned &n_plot)
64 DenseMatrix<double> sigma(2,2);
67 outfile <<
"ZONE I=" << n_plot <<
", J=" << n_plot << std::endl;
70 for(
unsigned l2=0;l2<n_plot;l2++)
72 s[1] = -1.0 + l2*2.0/(n_plot-1);
73 for(
unsigned l1=0;l1<n_plot;l1++)
75 s[0] = -1.0 + l1*2.0/(n_plot-1);
78 this->interpolated_x(s,x);
79 this->interpolated_xi(s,xi);
80 this->get_stress(s,sigma);
83 for(
unsigned i=0;i<2;i++)
84 {outfile << x[i] <<
" ";}
88 for(
unsigned i=0;i<2;i++)
89 {outfile << x[i]-xi[i] <<
" ";}
92 outfile << sigma(0,0) <<
" " 137 const Vector<double> &xi,
151 template<
class ELEMENT>
169 void doc_solution(
const bool& incompress);
172 void run_it(
const int& i_case,
const bool& incompress);
192 template<
class ELEMENT>
194 const bool& incompress)
212 mesh_pt() =
new ElasticRectangularQuadMesh<ELEMENT>(n_x,n_y,l_x,l_y);
216 unsigned n_element=mesh_pt()->nelement();
217 for(
unsigned i=0;i<n_element;i++)
220 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(i));
223 el_pt->constitutive_law_pt() =
231 PVDEquationsWithPressure<2>* test_pt =
232 dynamic_cast<PVDEquationsWithPressure<2>*
>(mesh_pt()->element_pt(i));
239 test_pt->set_incompressible();
245 test_pt->set_compressible();
252 unsigned nnod=mesh_pt()->nnode();
253 Trace_node_pt=mesh_pt()->node_pt(nnod-1);
256 for (
unsigned b=1;b<4;b+=2)
258 unsigned nnod = mesh_pt()->nboundary_node(b);
259 for(
unsigned i=0;i<nnod;i++)
261 dynamic_cast<SolidNode*
>(
262 mesh_pt()->boundary_node_pt(b,i))->pin_position(0);
269 unsigned nnod= mesh_pt()->nboundary_node(b);
270 for(
unsigned i=0;i<nnod;i++)
272 dynamic_cast<SolidNode*
>(
273 mesh_pt()->boundary_node_pt(b,i))->pin_position(1);
278 assign_eqn_numbers();
287 template<
class ELEMENT>
297 sprintf(filename,
"%s/soln%i.dat",Doc_info.directory().c_str(),
299 some_file.open(filename);
300 mesh_pt()->output(some_file,n_plot);
305 << Trace_node_pt->x(0) <<
" " 306 << Trace_node_pt->x(1) <<
" " 312 sprintf(filename,
"%s/exact_soln%i.dat",Doc_info.directory().c_str(),
314 some_file.open(filename);
315 unsigned nelem=mesh_pt()->nelement();
318 DenseMatrix<double> sigma(2,2);
322 if (incompress) nu=0.5;
325 for (
unsigned e=0;e<nelem;e++)
328 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e));
331 some_file <<
"ZONE I=" << n_plot <<
", J=" << n_plot << std::endl;
334 for(
unsigned l2=0;l2<n_plot;l2++)
336 s[1] = -1.0 + l2*2.0/(n_plot-1);
337 for(
unsigned l1=0;l1<n_plot;l1++)
339 s[0] = -1.0 + l1*2.0/(n_plot-1);
342 el_pt->interpolated_x(s,x);
345 for(
unsigned i=0;i<2;i++)
346 {some_file << x[i] <<
" ";}
350 (1.0+nu)*(1.0-2*nu)/(1.0-nu)*(0.5*x[1]*x[1]-x[1]);
353 some_file <<
"0.0 " << v_exact <<
" ";
361 some_file << sigma(0,0) <<
" " 382 template<
class ELEMENT>
384 const bool& incompress)
389 sprintf(dirname,
"RESLT%i",i_case);
390 Doc_info.set_directory(dirname);
394 sprintf(filename,
"%s/trace.dat",Doc_info.directory().c_str());
395 Trace_file.open(filename);
399 doc_solution(incompress);
406 double g_increment=1.0e-2;
407 for(
unsigned i=0;i<nstep;i++)
416 doc_solution(incompress);
429 bool incompress=
false;
438 Vector<double> nu_value(3);
440 nu_value[1]=0.499999;
444 for (
unsigned i=0;i<3;i++)
449 std::cout <<
"===========================================\n";
452 std::cout <<
"===========================================\n";
465 <<
"Doing Generalised Hookean with displacement formulation: Case " 466 << case_number << std::endl;
474 problem.
run_it(case_number,incompress);
483 <<
"Doing Generalised Hookean with displacement/cont pressure " 484 <<
"formulation: Case " << case_number << std::endl;
489 QPVDElementWithContinuousPressure<2> > >
493 problem.run_it(case_number,incompress);
502 <<
"Doing Generalised Hookean with displacement/discont pressure " 503 <<
"formulation: Case " << case_number << std::endl;
507 QPVDElementWithPressure<2> > > problem(incompress);
510 problem.run_it(case_number,incompress);
522 <<
"Doing Generalised Hookean with displacement/cont pressure, " 523 <<
"incompressible formulation: Case " << case_number << std::endl;
528 QPVDElementWithContinuousPressure<2> > >
532 problem.run_it(case_number,incompress);
543 <<
"Doing Generalised Hookean with displacement/discont pressure, " 544 <<
"incompressible formulation: Case " << case_number << std::endl;
549 QPVDElementWithPressure<2> > > problem(incompress);
552 problem.run_it(case_number,incompress);
575 new IsotropicStrainEnergyFunctionConstitutiveLaw(
586 <<
"Doing Mooney Rivlin with cont pressure formulation: Case " 587 << case_number << std::endl;
592 QPVDElementWithContinuousPressure<2> > >
596 problem.run_it(case_number,incompress);
607 <<
"Doing Mooney Rivlin with discont pressure formulation: Case " 608 << case_number << std::endl;
613 QPVDElementWithPressure<2> > >
617 problem.run_it(case_number,incompress);
double Gravity
Non-dim gravity.
void actions_before_newton_solve()
Update function (empty)
Wrapper class for solid element to modify the output.
void doc_solution(const bool &incompress)
Doc the solution & exact (linear) solution for compressible or incompressible materials.
MySolidElement()
Constructor: Call constructor of underlying element.
ConstitutiveLaw * Constitutive_law_pt
Pointer to constitutive law.
Node * Trace_node_pt
Pointers to node whose position we're tracing.
void actions_after_newton_solve()
Update function (empty)
void gravity(const double &time, const Vector< double > &xi, Vector< double > &b)
Non-dimensional gravity as body force.
ofstream Trace_file
Trace file.
void output(std::ostream &outfile, const unsigned &n_plot)
Overload output function.
void run_it(const int &i_case, const bool &incompress)
Run the job – doc in RESLTi_case.
DocInfo Doc_info
DocInfo object for output.
int main()
Driver for compressed square.
CompressedSquareProblem(const bool &incompress)
Constructor: Pass flag that determines if we want to use a true incompressible formulation.
double C1
First "Mooney Rivlin" coefficient for generalised Mooney Rivlin law.
StrainEnergyFunction * Strain_energy_function_pt
Pointer to strain energy function.
double C2
Second "Mooney Rivlin" coefficient for generalised Mooney Rivlin law.
double Nu
Poisson's ratio for Hooke's law.