33 #include "meshes/rectangular_quadmesh.h"
37 using namespace oomph;
45 template <
class ELEMENT>
55 void output(std::ostream &outfile,
const unsigned &n_plot)
60 DenseMatrix<double> sigma(2,2);
63 outfile <<
"ZONE I=" << n_plot <<
", J=" << n_plot << std::endl;
66 for(
unsigned l2=0;l2<n_plot;l2++)
68 s[1] = -1.0 + l2*2.0/(n_plot-1);
69 for(
unsigned l1=0;l1<n_plot;l1++)
71 s[0] = -1.0 + l1*2.0/(n_plot-1);
74 this->interpolated_x(s,x);
75 this->interpolated_xi(s,xi);
76 this->get_stress(s,sigma);
79 for(
unsigned i=0;i<2;i++)
80 {outfile << x[i] <<
" ";}
84 for(
unsigned i=0;i<2;i++)
85 {outfile << x[i]-xi[i] <<
" ";}
88 outfile << sigma(0,0) <<
" "
133 const Vector<double> &xi,
147 template<
class ELEMENT>
165 void doc_solution(
const bool& incompress);
168 void run_it(
const int& i_case,
const bool& incompress);
188 template<
class ELEMENT>
190 const bool& incompress)
208 mesh_pt() =
new ElasticRectangularQuadMesh<ELEMENT>(n_x,n_y,l_x,l_y);
212 unsigned n_element=mesh_pt()->nelement();
213 for(
unsigned i=0;i<n_element;i++)
216 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(i));
219 el_pt->constitutive_law_pt() =
227 PVDEquationsWithPressure<2>* test_pt =
228 dynamic_cast<PVDEquationsWithPressure<2>*
>(mesh_pt()->element_pt(i));
235 test_pt->set_incompressible();
241 test_pt->set_compressible();
248 unsigned nnod=mesh_pt()->nnode();
249 Trace_node_pt=mesh_pt()->node_pt(nnod-1);
252 for (
unsigned b=1;b<4;b+=2)
254 unsigned nnod = mesh_pt()->nboundary_node(b);
255 for(
unsigned i=0;i<nnod;i++)
257 dynamic_cast<SolidNode*
>(
258 mesh_pt()->boundary_node_pt(b,i))->pin_position(0);
265 unsigned nnod= mesh_pt()->nboundary_node(b);
266 for(
unsigned i=0;i<nnod;i++)
268 dynamic_cast<SolidNode*
>(
269 mesh_pt()->boundary_node_pt(b,i))->pin_position(1);
274 assign_eqn_numbers();
283 template<
class ELEMENT>
293 sprintf(filename,
"%s/soln%i.dat",Doc_info.directory().c_str(),
295 some_file.open(filename);
296 mesh_pt()->output(some_file,n_plot);
301 << Trace_node_pt->x(0) <<
" "
302 << Trace_node_pt->x(1) <<
" "
308 sprintf(filename,
"%s/exact_soln%i.dat",Doc_info.directory().c_str(),
310 some_file.open(filename);
311 unsigned nelem=mesh_pt()->nelement();
314 DenseMatrix<double> sigma(2,2);
318 if (incompress) nu=0.5;
321 for (
unsigned e=0;e<nelem;e++)
324 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e));
327 some_file <<
"ZONE I=" << n_plot <<
", J=" << n_plot << std::endl;
330 for(
unsigned l2=0;l2<n_plot;l2++)
332 s[1] = -1.0 + l2*2.0/(n_plot-1);
333 for(
unsigned l1=0;l1<n_plot;l1++)
335 s[0] = -1.0 + l1*2.0/(n_plot-1);
338 el_pt->interpolated_x(s,x);
341 for(
unsigned i=0;i<2;i++)
342 {some_file << x[i] <<
" ";}
346 (1.0+nu)*(1.0-2*nu)/(1.0-nu)*(0.5*x[1]*x[1]-x[1]);
349 some_file <<
"0.0 " << v_exact <<
" ";
357 some_file << sigma(0,0) <<
" "
378 template<
class ELEMENT>
380 const bool& incompress)
385 sprintf(dirname,
"RESLT%i",i_case);
386 Doc_info.set_directory(dirname);
390 sprintf(filename,
"%s/trace.dat",Doc_info.directory().c_str());
391 Trace_file.open(filename);
395 doc_solution(incompress);
402 double g_increment=1.0e-2;
403 for(
unsigned i=0;i<nstep;i++)
412 doc_solution(incompress);
425 bool incompress=
false;
434 Vector<double> nu_value(3);
436 nu_value[1]=0.499999;
440 for (
unsigned i=0;i<3;i++)
445 std::cout <<
"===========================================\n";
448 std::cout <<
"===========================================\n";
461 <<
"Doing Generalised Hookean with displacement formulation: Case "
462 << case_number << std::endl;
470 problem.
run_it(case_number,incompress);
479 <<
"Doing Generalised Hookean with displacement/cont pressure "
480 <<
"formulation: Case " << case_number << std::endl;
485 QPVDElementWithContinuousPressure<2> > >
489 problem.run_it(case_number,incompress);
498 <<
"Doing Generalised Hookean with displacement/discont pressure "
499 <<
"formulation: Case " << case_number << std::endl;
503 QPVDElementWithPressure<2> > > problem(incompress);
506 problem.run_it(case_number,incompress);
518 <<
"Doing Generalised Hookean with displacement/cont pressure, "
519 <<
"incompressible formulation: Case " << case_number << std::endl;
524 QPVDElementWithContinuousPressure<2> > >
528 problem.run_it(case_number,incompress);
539 <<
"Doing Generalised Hookean with displacement/discont pressure, "
540 <<
"incompressible formulation: Case " << case_number << std::endl;
545 QPVDElementWithPressure<2> > > problem(incompress);
548 problem.run_it(case_number,incompress);
571 new IsotropicStrainEnergyFunctionConstitutiveLaw(
582 <<
"Doing Mooney Rivlin with cont pressure formulation: Case "
583 << case_number << std::endl;
588 QPVDElementWithContinuousPressure<2> > >
592 problem.run_it(case_number,incompress);
603 <<
"Doing Mooney Rivlin with discont pressure formulation: Case "
604 << case_number << std::endl;
609 QPVDElementWithPressure<2> > >
613 problem.run_it(case_number,incompress);
Node * Trace_node_pt
Pointers to node whose position we're tracing.
void run_it(const int &i_case, const bool &incompress)
Run the job – doc in RESLTi_case.
DocInfo Doc_info
DocInfo object for output.
void doc_solution(const bool &incompress)
Doc the solution & exact (linear) solution for compressible or incompressible materials.
void actions_before_newton_solve()
Update function (empty)
CompressedSquareProblem(const bool &incompress)
Constructor: Pass flag that determines if we want to use a true incompressible formulation.
ofstream Trace_file
Trace file.
void actions_after_newton_solve()
Update function (empty)
Wrapper class for solid element to modify the output.
void output(std::ostream &outfile, const unsigned &n_plot)
Overload output function.
MySolidElement()
Constructor: Call constructor of underlying element.
int main()
Driver for compressed square.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
void gravity(const double &time, const Vector< double > &xi, Vector< double > &b)
Non-dimensional gravity as body force.
ConstitutiveLaw * Constitutive_law_pt
Pointer to constitutive law.
double Nu
Poisson's ratio for Hooke's law.
StrainEnergyFunction * Strain_energy_function_pt
Pointer to strain energy function.
double C1
First "Mooney Rivlin" coefficient for generalised Mooney Rivlin law.
double Gravity
Non-dim gravity.
double C2
Second "Mooney Rivlin" coefficient for generalised Mooney Rivlin law.