41 template <
unsigned DIM>
53 template<
unsigned DIM>
58 if ((strain.
ncol()!=DIM)||(strain.
nrow()!=DIM))
60 std::ostringstream error_message;
61 error_message <<
"Strain matrix is " << strain.
ncol() <<
" x " 62 << strain.
nrow() <<
", but dimension of the equations is " 65 OOMPH_CURRENT_FUNCTION,
66 OOMPH_EXCEPTION_LOCATION);
71 const unsigned n_node = nnode();
74 const unsigned n_position_type = this->nnodal_position_type();
77 Shape psi(n_node,n_position_type);
78 DShape dpsidxi(n_node,n_position_type,DIM);
81 (void) dshape_lagrangian(s,psi,dpsidxi);
87 for(
unsigned i=0;
i<DIM;
i++)
89 for(
unsigned j=0;j<DIM;j++) {interpolated_G(
i,j) = 0.0;}
96 for(
unsigned l=0;l<n_node;l++)
99 for(
unsigned k=0;k<n_position_type;k++)
102 for(
unsigned i=0;
i<DIM;
i++)
105 interpolated_xi[
i] += this->lagrangian_position_gen(l,k,
i)*psi(l,k);
108 for(
unsigned j=0;j<DIM;j++)
110 interpolated_G(j,
i) +=
111 this->nodal_position_gen(l,k,
i)*dpsidxi(l,k,j);
121 get_isotropic_growth(ipt,s,interpolated_xi,gamma);
126 double diag_entry=pow(gamma,2.0/
double(DIM));
128 for(
unsigned i=0;
i<DIM;
i++)
130 for(
unsigned j=0;j<DIM;j++)
132 if(
i==j) {g(
i,j) = diag_entry;}
else {g(
i,j) = 0.0;}
142 for(
unsigned i=0;
i<DIM;
i++)
145 for(
unsigned j=
i;j<DIM;j++)
150 for(
unsigned k=0;k<DIM;k++)
152 G(
i,j) += interpolated_G(
i,k)*interpolated_G(j,k);
156 for(
unsigned j=0;j<
i;j++)
163 for(
unsigned i=0;
i<DIM;
i++)
165 for(
unsigned j=0;j<DIM;j++) {strain(
i,j)= 0.5*(G(
i,j) - g(
i,j));}
174 template <
unsigned DIM>
178 const unsigned& flag)
187 "PVDEquations cannot be used with incompressible constitutive laws.",
188 OOMPH_CURRENT_FUNCTION,
189 OOMPH_EXCEPTION_LOCATION);
194 if (this->Solid_ic_pt!=0)
196 this->fill_in_residuals_for_solid_ic(residuals);
201 const unsigned n_node = this->nnode();
204 const unsigned n_position_type = this->nnodal_position_type();
207 Shape psi(n_node,n_position_type);
208 DShape dpsidxi(n_node,n_position_type,DIM);
211 const unsigned n_intpt = this->integral_pt()->nweight();
217 double lambda_sq = this->lambda_sq();
220 double time_factor=0.0;
223 time_factor=this->node_pt(0)->position_time_stepper_pt()->weight(2,0);
230 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
233 for(
unsigned i=0;
i<DIM;++
i) {s[
i] = this->integral_pt()->knot(ipt,
i);}
236 double w = this->integral_pt()->weight(ipt);
239 double J = this->dshape_lagrangian_at_knot(ipt,psi,dpsidxi);
249 for(
unsigned i=0;
i<DIM;
i++)
253 for(
unsigned j=0;j<DIM;j++)
255 interpolated_G(
i,j) = 0.0;
263 for(
unsigned l=0;l<n_node;l++)
266 for(
unsigned k=0;k<n_position_type;k++)
268 double psi_ = psi(l,k);
270 for(
unsigned i=0;
i<DIM;
i++)
273 interpolated_xi[
i] += this->lagrangian_position_gen(l,k,
i)*psi_;
276 if ((lambda_sq>0.0)&&(this->Unsteady))
278 accel[
i] += this->dnodal_position_gen_dt(2,l,k,
i)*psi_;
282 for(
unsigned j=0;j<DIM;j++)
284 interpolated_G(j,
i) +=
285 this->nodal_position_gen(l,k,
i)*dpsidxi(l,k,j);
293 this->get_isotropic_growth(ipt,s,interpolated_xi,gamma);
298 this->body_force(interpolated_xi,b);
303 double diag_entry=pow(gamma,2.0/
double(DIM));
305 for(
unsigned i=0;
i<DIM;
i++)
307 for(
unsigned j=0;j<DIM;j++)
309 if(
i==j) {g(
i,j) = diag_entry;}
316 double W = gamma*w*J;
322 for(
unsigned i=0;
i<DIM;
i++)
325 for(
unsigned j=
i;j<DIM;j++)
330 for(
unsigned k=0;k<DIM;k++)
332 G(
i,j) += interpolated_G(
i,k)*interpolated_G(j,k);
336 for(
unsigned j=0;j<
i;j++)
344 get_stress(g,G,sigma);
347 for(
unsigned i=0;
i<DIM;
i++)
349 for(
unsigned j=0;j<DIM;j++)
351 sigma(
i,j) += this->prestress(
i,j,interpolated_xi);
371 for (
unsigned ll=0;ll<n_node;ll++)
373 for (
unsigned kk=0;kk<n_position_type;kk++)
375 for (
unsigned ii=0;ii<DIM;ii++)
377 for (
unsigned aa=0;aa<DIM;aa++)
379 for (
unsigned bb=aa;bb<DIM;bb++)
381 d_G_dX(ll,kk,ii,aa,bb)=
382 interpolated_G(aa,ii)*dpsidxi(ll,kk,bb)+
383 interpolated_G(bb,ii)*dpsidxi(ll,kk,aa);
392 this->get_d_stress_dG_upper(g,G,sigma,d_stress_dG);
398 for(
unsigned l=0;l<n_node;l++)
401 for(
unsigned k=0;k<n_position_type;k++)
404 const unsigned offset5=dpsidxi.
offset(l ,k);
407 for(
unsigned i=0;
i<DIM;
i++)
410 local_eqn = this->position_local_eqn(l,k,
i);
419 sum+=(lambda_sq*accel[
i]-b[
i])*psi(l,k);
422 for(
unsigned a=0;a<DIM;a++)
424 unsigned count=offset5;
425 for(
unsigned b=0;b<DIM;b++)
428 sum+=sigma(a,b)*interpolated_G(a,
i)*
433 residuals[local_eqn] += W*sum;
439 const unsigned offset1=d_G_dX.
offset( l, k,
i);
442 for(
unsigned ll=0;ll<n_node;ll++)
445 for(
unsigned kk=0;kk<n_position_type;kk++)
448 for(
unsigned ii=0;ii<DIM;ii++)
451 int local_unknown = this->position_local_eqn(ll,kk,ii);
454 if(local_unknown >= 0)
457 const unsigned offset2=d_G_dX.
offset( ll, kk, ii);
458 const unsigned offset4=dpsidxi.
offset(ll, kk);
463 unsigned count1=offset1;
464 for(
unsigned a=0;a<DIM;a++)
469 for(
unsigned b=a;b<DIM;b++)
472 if (a==b) factor*=0.5;
475 unsigned offset3=d_stress_dG.
offset(a,b);
476 unsigned count2=offset2;
477 unsigned count3=offset3;
479 for(
unsigned aa=0;aa<DIM;aa++)
487 for(
unsigned bb=aa;bb<DIM;bb++)
503 jacobian(local_eqn,local_unknown)+=sum*
W;
507 if((
i==ii) && (local_unknown >= local_eqn))
513 sum+=lambda_sq*time_factor*psi(ll,kk)*psi(l,k);
516 unsigned count4=offset4;
517 for(
unsigned a=0;a<DIM;a++)
524 unsigned count5=offset5;
525 for(
unsigned b=0;b<DIM;b++)
527 sum+=sigma(a,b)*factor*
533 jacobian(local_eqn,local_unknown) += sum*
W;
535 if(local_eqn != local_unknown)
537 jacobian(local_unknown,local_eqn) += sum*
W;
559 template <
unsigned DIM>
568 outfile << this->tecplot_zone_string(n_plot);
571 unsigned num_plot_points=this->nplot_points(n_plot);
572 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
575 this->get_s_plot(iplot,n_plot,s);
578 this->interpolated_x(s,x);
579 this->interpolated_xi(s,xi);
585 this->get_isotropic_growth(ipt,s,xi,gamma);
588 for(
unsigned i=0;
i<DIM;
i++)
589 {outfile << x[
i] <<
" ";}
592 for(
unsigned i=0;
i<DIM;
i++)
593 {outfile << xi[
i] <<
" ";}
597 outfile << std::endl;
602 this->write_tecplot_zone_footer(outfile,n_plot);
603 outfile << std::endl;
612 template <
unsigned DIM>
627 fprintf(file_pt,
"ZONE I=%i, J=%i\n",n_plot,n_plot);
630 for(
unsigned l2=0;l2<n_plot;l2++)
632 s[1] = -1.0 + l2*2.0/(n_plot-1);
633 for(
unsigned l1=0;l1<n_plot;l1++)
635 s[0] = -1.0 + l1*2.0/(n_plot-1);
638 this->interpolated_x(s,x);
639 this->interpolated_xi(s,xi);
645 this->get_isotropic_growth(ipt,s,xi,gamma);
648 for(
unsigned i=0;
i<DIM;
i++)
651 fprintf(file_pt,
"%g ",x[
i]);
654 for(
unsigned i=0;
i<DIM;
i++)
657 fprintf(file_pt,
"%g ",xi[
i]);
662 fprintf(file_pt,
"%g \n",gamma);
666 fprintf(file_pt,
"\n");
674 fprintf(file_pt,
"ZONE I=%i, J=%i, K=%i \n",n_plot,n_plot,n_plot);
677 for(
unsigned l3=0;l3<n_plot;l3++)
679 s[2] = -1.0 + l3*2.0/(n_plot-1);
680 for(
unsigned l2=0;l2<n_plot;l2++)
682 s[1] = -1.0 + l2*2.0/(n_plot-1);
683 for(
unsigned l1=0;l1<n_plot;l1++)
685 s[0] = -1.0 + l1*2.0/(n_plot-1);
688 this->interpolated_x(s,x);
689 this->interpolated_xi(s,xi);
695 this->get_isotropic_growth(ipt,s,xi,gamma);
698 for(
unsigned i=0;
i<DIM;
i++)
701 fprintf(file_pt,
"%g ",x[
i]);
704 for(
unsigned i=0;
i<DIM;
i++)
707 fprintf(file_pt,
"%g ",xi[
i]);
712 fprintf(file_pt,
"%g \n",gamma);
717 fprintf(file_pt,
"\n");
722 std::ostringstream error_message;
723 error_message <<
"No output routine for PVDEquations<" <<
724 DIM <<
"> elements -- write it yourself!" << std::endl;
726 OOMPH_CURRENT_FUNCTION,
727 OOMPH_EXCEPTION_LOCATION);
735 template <
unsigned DIM>
737 const unsigned &n_plot)
746 outfile << this->tecplot_zone_string(n_plot);
749 unsigned num_plot_points=this->nplot_points(n_plot);
750 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
753 this->get_s_plot(iplot,n_plot,s);
756 this->interpolated_x(s,x);
757 this->interpolated_xi(s,xi);
763 this->get_isotropic_growth(ipt,s,xi,gamma);
766 for(
unsigned i=0;
i<DIM;
i++)
767 {outfile << x[
i] <<
" ";}
770 for(
unsigned i=0;
i<DIM;
i++)
771 {outfile << xi[
i] <<
" ";}
774 outfile << gamma <<
" ";
777 this->get_strain(s,stress_or_strain);
778 for(
unsigned i=0;
i<DIM;
i++)
780 for(
unsigned j=0;j<=
i;j++)
782 outfile << stress_or_strain(j,
i) <<
" " ;
787 this->get_stress(s,stress_or_strain);
788 for(
unsigned i=0;
i<DIM;
i++)
790 for(
unsigned j=0;j<=
i;j++)
792 outfile << stress_or_strain(j,
i) <<
" " ;
797 outfile << std::endl;
802 this->write_tecplot_zone_footer(outfile,n_plot);
803 outfile << std::endl;
810 template <
unsigned DIM>
818 unsigned n_intpt = this->integral_pt()->nweight();
824 const unsigned n_node = this->nnode();
827 const unsigned n_position_type = this->nnodal_position_type();
830 Shape psi(n_node,n_position_type);
831 DShape dpsidxi(n_node,n_position_type,DIM);
834 double lambda_sq = this->lambda_sq();
837 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
840 for(
unsigned i=0;
i<DIM;
i++) { s[
i] = this->integral_pt()->knot(ipt,
i); }
843 double w = this->integral_pt()->weight(ipt);
846 double J = this->dshape_lagrangian_at_knot(ipt,psi,dpsidxi);
853 for(
unsigned l=0;l<n_node;l++)
856 for(
unsigned k=0;k<n_position_type;k++)
859 for(
unsigned i=0;
i<DIM;
i++)
862 interpolated_xi[
i] += this->lagrangian_position_gen(l,k,
i)*psi(l,k);
867 veloc[
i] += this->dnodal_position_gen_dt(l,k,
i)*psi(l,k);
875 this->get_isotropic_growth(ipt,s,interpolated_xi,gamma);
879 double W = gamma*w*J;
885 this->get_stress(s,sigma);
888 for(
unsigned i=0;
i<DIM;
i++)
890 for(
unsigned j=0;j<DIM;j++)
892 sigma(
i,j) += prestress(
i,j,interpolated_xi);
897 this->get_strain(s,strain);
900 double local_pot_en=0;
904 for(
unsigned i=0;
i<DIM;
i++)
906 for(
unsigned j=0;j<DIM;j++)
908 local_pot_en+=sigma(
i,j)*strain(
i,j);
910 veloc_sq += veloc[
i]*veloc[
i];
913 pot_en+=0.5*local_pot_en*
W;
914 kin_en+=lambda_sq*0.5*veloc_sq*
W;
929 template <
unsigned DIM>
934 unsigned n_node = this->nnode();
937 unsigned n_position_type = this->nnodal_position_type();
940 Shape psi(n_node,n_position_type);
941 DShape dpsidxi(n_node,n_position_type,DIM);
944 (void) this->dshape_lagrangian(s,psi,dpsidxi);
948 this->interpolated_xi(s,xi);
954 this->get_isotropic_growth(ipt,s,xi,gamma);
959 double diag_entry=pow(gamma,2.0/
double(DIM));
961 for(
unsigned i=0;
i<DIM;
i++)
963 for(
unsigned j=0;j<DIM;j++)
965 if(
i==j) {g(
i,j) = diag_entry;}
976 for(
unsigned i=0;
i<DIM;
i++)
977 {
for(
unsigned j=0;j<DIM;j++) {interpolated_G(
i,j) = 0.0;}}
980 for(
unsigned l=0;l<n_node;l++)
983 for(
unsigned k=0;k<n_position_type;k++)
986 for(
unsigned i=0;
i<DIM;
i++)
989 for(
unsigned j=0;j<DIM;j++)
991 interpolated_G(j,
i) +=
992 this->nodal_position_gen(l,k,
i)*dpsidxi(l,k,j);
1001 for(
unsigned i=0;
i<DIM;
i++)
1006 for(
int j=(DIM-1);j>=
static_cast<int>(
i);j--)
1011 for(
unsigned k=0;k<DIM;k++)
1013 G(
i,j) += interpolated_G(
i,k)*interpolated_G(j,k);
1017 for(
int j=(
i-1);j>=0;j--)
1024 get_stress(g,G,sigma);
1041 template <
unsigned DIM>
1048 get_stress(s,sigma);
1052 this->interpolated_xi(s,xi);
1055 for(
unsigned i=0;
i<DIM;
i++)
1057 for(
unsigned j=0;j<DIM;j++)
1059 sigma(
i,j) += this->prestress(
i,j,xi);
1065 get_deformed_covariant_basis_vectors(s,lower_deformed_basis);
1069 for (
unsigned i=0;
i<DIM;
i++)
1071 for (
unsigned j=0;j<DIM;j++)
1073 lower_metric(
i,j)=0.0;
1074 for (
unsigned k=0;k<DIM;k++)
1077 lower_deformed_basis(
i,k)*lower_deformed_basis(j,k);
1088 for (
unsigned k=0;k<DIM;k++)
1091 for (
unsigned l=0;l<DIM;l++)
1093 rhs[l] = lower_deformed_basis(l,k);
1096 lower_metric.
solve(rhs,aux);
1098 for (
unsigned l=0;l<DIM;l++)
1100 upper_deformed_basis(l,k) = aux[l];
1117 for(
unsigned i=0;
i<DIM;
i++)
1120 for(
unsigned j=0;j<DIM;j++) {principal_stress_vector(j,
i)=0.0;}
1123 for(
unsigned j=0;j<DIM;j++)
1125 for(
unsigned k=0;k<DIM;k++)
1127 principal_stress_vector(j,
i) += upper_deformed_basis(k,
i)*ev(j,k);
1134 for (
unsigned i=0;
i<DIM;
i++)
1137 for (
unsigned j=0;j<DIM;j++)
1139 norm[
i] += pow(principal_stress_vector(
i,j),2);
1141 norm[
i] = sqrt(norm[
i]);
1147 for(
unsigned i=0;
i<DIM;
i++)
1149 for (
unsigned j=0;j<DIM;j++)
1151 principal_stress_vector(j,
i) = ev(j,
i)/norm[j]*principal_stress[j];
1164 template <
unsigned DIM>
1170 unsigned n_node = nnode();
1173 unsigned n_position_type = this->nnodal_position_type();
1176 Shape psi(n_node,n_position_type);
1177 DShape dpsidxi(n_node,n_position_type,DIM);
1181 (void) dshape_lagrangian(s,psi,dpsidxi);
1185 for(
unsigned i=0;
i<DIM;
i++)
1186 {
for(
unsigned j=0;j<DIM;j++) {def_covariant_basis(
i,j) = 0.0;}}
1189 for(
unsigned l=0;l<n_node;l++)
1192 for(
unsigned k=0;k<n_position_type;k++)
1195 for(
unsigned i=0;
i<DIM;
i++)
1198 for(
unsigned j=0;j<DIM;j++)
1200 def_covariant_basis(j,
i) +=
1201 nodal_position_gen(l,k,
i)*dpsidxi(l,k,j);
1218 template<
unsigned DIM>
1237 template <
unsigned DIM>
1251 "The constitutive law requires the use of the incompressible formulation by setting the element's member function set_incompressible()",
1252 OOMPH_CURRENT_FUNCTION,
1253 OOMPH_EXCEPTION_LOCATION);
1259 if (this->Solid_ic_pt!=0)
1261 this->get_residuals_for_solid_ic(residuals);
1266 const unsigned n_node = this->nnode();
1269 const unsigned n_position_type = this->nnodal_position_type();
1272 const unsigned n_solid_pres = this->npres_solid();
1275 Shape psi(n_node,n_position_type);
1276 DShape dpsidxi(n_node,n_position_type,DIM);
1279 Shape psisp(n_solid_pres);
1282 const unsigned n_intpt = this->integral_pt()->nweight();
1288 double lambda_sq = this->lambda_sq();
1291 double time_factor=0.0;
1294 time_factor=this->node_pt(0)->position_time_stepper_pt()->weight(2,0);
1298 int local_eqn=0, local_unknown=0;
1301 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
1304 for(
unsigned i=0;
i<DIM;++
i)
1306 s[
i] = this->integral_pt()->knot(ipt,
i);
1310 double w = this->integral_pt()->weight(ipt);
1313 double J = this->dshape_lagrangian_at_knot(ipt,psi,dpsidxi);
1316 solid_pshape_at_knot(ipt,psisp);
1328 for(
unsigned i=0;
i<DIM;
i++)
1332 for(
unsigned j=0;j<DIM;j++)
1334 interpolated_G(
i,j) = 0.0;
1339 for(
unsigned l=0;l<n_node;l++)
1342 for(
unsigned k=0;k<n_position_type;k++)
1345 for(
unsigned i=0;
i<DIM;
i++)
1348 interpolated_xi[
i] += this->lagrangian_position_gen(l,k,
i)*psi(l,k);
1353 if ((lambda_sq>0.0)&&(this->Unsteady))
1355 accel[
i] += this->dnodal_position_gen_dt(2,l,k,
i)*psi(l,k);
1359 for(
unsigned j=0;j<DIM;j++)
1361 interpolated_G(j,
i) +=
1362 this->nodal_position_gen(l,k,
i)*dpsidxi(l,k,j);
1370 this->get_isotropic_growth(ipt,s,interpolated_xi,gamma);
1374 this->body_force(interpolated_xi,b);
1379 double diag_entry=pow(gamma,2.0/
double(DIM));
1381 for(
unsigned i=0;
i<DIM;
i++)
1383 for(
unsigned j=0;j<DIM;j++)
1385 if(
i==j) {g(
i,j) = diag_entry;}
1386 else {g(
i,j) = 0.0;}
1392 double W = gamma*w*J;
1395 double interpolated_solid_p=0.0;
1396 for(
unsigned l=0;l<n_solid_pres;l++)
1398 interpolated_solid_p += solid_p(l)*psisp[l];
1406 for(
unsigned i=0;
i<DIM;
i++)
1409 for(
unsigned j=
i;j<DIM;j++)
1414 for(
unsigned k=0;k<DIM;k++)
1416 G(
i,j) += interpolated_G(
i,k)*interpolated_G(j,k);
1420 for(
unsigned j=0;j<
i;j++)
1431 double inv_kappa=0.0;
1444 if ((flag==1) || (flag==3))
1451 for (
unsigned ll=0;ll<n_node;ll++)
1453 for (
unsigned kk=0;kk<n_position_type;kk++)
1455 for (
unsigned ii=0;ii<DIM;ii++)
1457 for (
unsigned aa=0;aa<DIM;aa++)
1459 for (
unsigned bb=aa;bb<DIM;bb++)
1461 d_G_dX(ll,kk,ii,aa,bb)=
1462 interpolated_G(aa,ii)*dpsidxi(ll,kk,bb)+
1463 interpolated_G(bb,ii)*dpsidxi(ll,kk,aa);
1477 get_stress(g,G,sigma_dev,Gup,detG);
1480 for (
unsigned a=0;a<DIM;a++)
1482 for (
unsigned b=0;b<DIM;b++)
1484 sigma(a,b)=sigma_dev(a,b)-interpolated_solid_p*Gup(a,b);
1489 if ((flag==1) || (flag==3))
1494 get_d_stress_dG_upper(g,G,sigma,detG,interpolated_solid_p,
1495 d_stress_dG,d_detG_dG);
1503 get_stress(g,G,sigma_dev,Gup,gen_dil,inv_kappa);
1506 for (
unsigned a=0;a<DIM;a++)
1508 for (
unsigned b=0;b<DIM;b++)
1510 sigma(a,b)=sigma_dev(a,b)-interpolated_solid_p*Gup(a,b);
1515 if ((flag==1) || (flag==3))
1519 this->get_d_stress_dG_upper(g,G,sigma,gen_dil,inv_kappa,
1520 interpolated_solid_p,
1521 d_stress_dG,d_gen_dil_dG);
1526 for(
unsigned i=0;
i<DIM;
i++)
1528 for(
unsigned j=0;j<DIM;j++)
1530 sigma(
i,j) += this->prestress(
i,j,interpolated_xi);
1537 for(
unsigned l=0;l<n_node;l++)
1540 for(
unsigned k=0;k<n_position_type;k++)
1543 const unsigned offset5=dpsidxi.
offset(l ,k);
1546 for(
unsigned i=0;
i<DIM;
i++)
1549 local_eqn = this->position_local_eqn(l,k,
i);
1558 sum+=(lambda_sq*accel[
i]-b[
i])*psi(l,k);
1561 for(
unsigned a=0;a<DIM;a++)
1563 unsigned count=offset5;
1564 for(
unsigned b=0;b<DIM;b++)
1567 sum+=sigma(a,b)*interpolated_G(a,
i)*
1572 residuals[local_eqn] += W*sum;
1578 for(
unsigned ll=0;ll<n_node;ll++)
1581 for(
unsigned kk=0;kk<n_position_type;kk++)
1584 int local_unknown = this->position_local_eqn(ll,kk,
i);
1587 if(local_unknown >= 0)
1589 mass_matrix(local_eqn,local_unknown) +=
1590 lambda_sq*psi(l,k)*psi(ll,kk)*
W;
1597 if((flag==1) || (flag==3))
1600 const unsigned offset1=d_G_dX.
offset( l, k,
i);
1603 for(
unsigned ll=0;ll<n_node;ll++)
1606 for(
unsigned kk=0;kk<n_position_type;kk++)
1609 for(
unsigned ii=0;ii<DIM;ii++)
1612 int local_unknown = this->position_local_eqn(ll,kk,ii);
1615 if(local_unknown >= 0)
1619 const unsigned offset2=d_G_dX.
offset( ll, kk, ii);
1620 const unsigned offset4=dpsidxi.
offset(ll, kk);
1625 unsigned count1=offset1;
1626 for(
unsigned a=0;a<DIM;a++)
1631 for(
unsigned b=a;b<DIM;b++)
1634 if (a==b) factor*=0.5;
1637 unsigned offset3=d_stress_dG.
offset(a,b);
1638 unsigned count2=offset2;
1639 unsigned count3=offset3;
1641 for(
unsigned aa=0;aa<DIM;aa++)
1649 for(
unsigned bb=aa;bb<DIM;bb++)
1665 jacobian(local_eqn,local_unknown)+=sum*
W;
1669 if((
i==ii) && (local_unknown >= local_eqn))
1675 sum+=lambda_sq*time_factor*psi(ll,kk)*psi(l,k);
1678 unsigned count4=offset4;
1679 for(
unsigned a=0;a<DIM;a++)
1682 const double factor=
1686 unsigned count5=offset5;
1687 for(
unsigned b=0;b<DIM;b++)
1689 sum+=sigma(a,b)*factor*
1696 jacobian(local_eqn,local_unknown) += sum*
W;
1698 if(local_eqn!=local_unknown)
1700 jacobian(local_unknown,local_eqn) += sum*
W;
1713 for(
unsigned l2=0;l2<n_solid_pres;l2++)
1715 local_unknown = this->solid_p_local_eqn(l2);
1718 if(local_unknown >= 0)
1722 for(
unsigned a=0;a<DIM;a++)
1724 for(
unsigned b=0;b<DIM;b++)
1726 jacobian(local_eqn,local_unknown) -=
1728 interpolated_G(a,
i)*dpsidxi(l,k,b)*
W;
1743 for(
unsigned l=0;l<n_solid_pres;l++)
1745 local_eqn = this->solid_p_local_eqn(l);
1756 residuals[local_eqn] += (detG - gamma)*psisp[l]*W;
1760 if ((flag==1) || (flag==3))
1763 for(
unsigned ll=0;ll<n_node;ll++)
1766 for(
unsigned kk=0;kk<n_position_type;kk++)
1769 for(
unsigned ii=0;ii<DIM;ii++)
1772 int local_unknown = this->position_local_eqn(ll,kk,ii);
1775 if(local_unknown >= 0)
1779 const unsigned offset=d_G_dX.
offset( ll, kk, ii);
1783 unsigned count=offset;
1784 for(
unsigned aa=0;aa<DIM;aa++)
1791 for(
unsigned bb=aa;bb<DIM;bb++)
1793 sum+=d_detG_dG(aa,bb)*
1798 jacobian(local_eqn,local_unknown)+=sum*
W;
1812 residuals[local_eqn] +=
1813 (inv_kappa*interpolated_solid_p + gen_dil)*psisp[l]*W;
1816 if ((flag==1) || (flag==3))
1819 for(
unsigned ll=0;ll<n_node;ll++)
1822 for(
unsigned kk=0;kk<n_position_type;kk++)
1825 for(
unsigned ii=0;ii<DIM;ii++)
1828 int local_unknown = this->position_local_eqn(ll,kk,ii);
1831 if(local_unknown >= 0)
1834 const unsigned offset=d_G_dX.
offset( ll, kk, ii);
1838 unsigned count=offset;
1839 for(
unsigned aa=0;aa<DIM;aa++)
1846 for(
unsigned bb=aa;bb<DIM;bb++)
1848 sum+=d_gen_dil_dG(aa,bb)*
1853 jacobian(local_eqn,local_unknown)+=sum*
W;
1864 for(
unsigned l2=0;l2<n_solid_pres;l2++)
1866 local_unknown = this->solid_p_local_eqn(l2);
1868 if(local_unknown >= 0)
1870 jacobian(local_eqn,local_unknown)
1871 += inv_kappa*psisp[l2]*psisp[l]*
W;
1889 template <
unsigned DIM>
1891 const unsigned &n_plot)
1899 outfile << this->tecplot_zone_string(n_plot);
1902 unsigned num_plot_points=this->nplot_points(n_plot);
1903 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
1906 this->get_s_plot(iplot,n_plot,s);
1909 this->interpolated_x(s,x);
1910 this->interpolated_xi(s,xi);
1916 this->get_isotropic_growth(ipt,s,xi,gamma);
1919 for(
unsigned i=0;
i<DIM;
i++)
1920 {outfile << x[
i] <<
" ";}
1923 for(
unsigned i=0;
i<DIM;
i++)
1924 {outfile << xi[
i] <<
" ";}
1927 outfile << gamma <<
" ";
1929 outfile << interpolated_solid_p(s) <<
" ";
1934 this->write_tecplot_zone_footer(outfile,n_plot);
1943 template <
unsigned DIM>
1945 const unsigned &n_plot)
1957 fprintf(file_pt,
"ZONE I=%i, J=%i\n",n_plot,n_plot);
1960 for(
unsigned l2=0;l2<n_plot;l2++)
1962 s[1] = -1.0 + l2*2.0/(n_plot-1);
1963 for(
unsigned l1=0;l1<n_plot;l1++)
1965 s[0] = -1.0 + l1*2.0/(n_plot-1);
1968 this->interpolated_x(s,x);
1969 this->interpolated_xi(s,xi);
1975 this->get_isotropic_growth(ipt,s,xi,gamma);
1978 for(
unsigned i=0;
i<DIM;
i++)
1981 fprintf(file_pt,
"%g ",x[
i]);
1984 for(
unsigned i=0;
i<DIM;
i++)
1987 fprintf(file_pt,
"%g ",xi[
i]);
1991 fprintf(file_pt,
"%g ",gamma);
1996 fprintf(file_pt,
"%g \n",interpolated_solid_p(s));
2008 fprintf(file_pt,
"ZONE I=%i, J=%i, K=%i \n",n_plot,n_plot,n_plot);
2011 for(
unsigned l3=0;l3<n_plot;l3++)
2013 s[2] = -1.0 + l3*2.0/(n_plot-1);
2014 for(
unsigned l2=0;l2<n_plot;l2++)
2016 s[1] = -1.0 + l2*2.0/(n_plot-1);
2017 for(
unsigned l1=0;l1<n_plot;l1++)
2019 s[0] = -1.0 + l1*2.0/(n_plot-1);
2022 this->interpolated_x(s,x);
2023 this->interpolated_xi(s,xi);
2029 this->get_isotropic_growth(ipt,s,xi,gamma);
2032 for(
unsigned i=0;
i<DIM;
i++)
2035 fprintf(file_pt,
"%g ",x[
i]);
2038 for(
unsigned i=0;
i<DIM;
i++)
2041 fprintf(file_pt,
"%g ",xi[
i]);
2045 fprintf(file_pt,
"%g ",gamma);
2050 fprintf(file_pt,
"%g \n",interpolated_solid_p(s));
2057 std::ostringstream error_message;
2058 error_message <<
"No output routine for PVDEquationsWithPressure<" <<
2059 DIM <<
"> elements. Write it yourself!" << std::endl;
2061 OOMPH_CURRENT_FUNCTION,
2062 OOMPH_EXCEPTION_LOCATION);
2070 template <
unsigned DIM>
2072 const unsigned &n_plot)
2081 outfile << this->tecplot_zone_string(n_plot);
2084 unsigned num_plot_points=this->nplot_points(n_plot);
2085 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
2088 this->get_s_plot(iplot,n_plot,s);
2091 this->interpolated_x(s,x);
2092 this->interpolated_xi(s,xi);
2098 this->get_isotropic_growth(ipt,s,xi,gamma);
2101 for(
unsigned i=0;
i<DIM;
i++)
2102 {outfile << x[
i] <<
" ";}
2105 for(
unsigned i=0;
i<DIM;
i++)
2106 {outfile << xi[
i] <<
" ";}
2109 outfile << gamma <<
" ";
2112 outfile << interpolated_solid_p(s) <<
" ";
2115 this->get_strain(s,stress_or_strain);
2116 for(
unsigned i=0;
i<DIM;
i++)
2118 for(
unsigned j=0;j<=
i;j++)
2120 outfile << stress_or_strain(j,
i) <<
" " ;
2125 this->get_stress(s,stress_or_strain);
2126 for(
unsigned i=0;
i<DIM;
i++)
2128 for(
unsigned j=0;j<=
i;j++)
2130 outfile << stress_or_strain(j,
i) <<
" " ;
2135 outfile << std::endl;
2140 this->write_tecplot_zone_footer(outfile,n_plot);
2141 outfile << std::endl;
2149 template <
unsigned DIM>
2154 mass_diag.assign(this->ndof(),0.0);
2157 unsigned n_node = this->nnode();
2160 const unsigned n_position_type = this->nnodal_position_type();
2163 Shape psi(n_node,n_position_type);
2164 DShape dpsidxi(n_node,n_position_type,DIM);
2167 unsigned n_intpt = this->integral_pt()->nweight();
2173 for(
unsigned ipt=0; ipt<n_intpt; ipt++)
2176 double w = this->integral_pt()->weight(ipt);
2179 double J = this->dshape_lagrangian_at_knot(ipt,psi,dpsidxi);
2185 for(
unsigned l=0; l<n_node; l++)
2188 for(
unsigned k=0;k<n_position_type;k++)
2191 for(
unsigned i=0;
i<DIM;
i++)
2194 local_eqn = this->position_local_eqn(l,k,
i);
2200 mass_diag[local_eqn] += pow(psi(l,k),2) *
W;
2221 template <
unsigned DIM>
2226 unsigned n_node = this->nnode();
2229 unsigned n_position_type = this->nnodal_position_type();
2232 unsigned n_solid_pres = this->npres_solid();
2235 Shape psi(n_node,n_position_type);
2236 DShape dpsidxi(n_node,n_position_type,DIM);
2239 Shape psisp(n_solid_pres);
2242 solid_pshape(s,psisp);
2245 (void) this->dshape_lagrangian(s,psi,dpsidxi);
2249 this->interpolated_xi(s,xi);
2255 this->get_isotropic_growth(ipt,s,xi,gamma);
2260 double diag_entry=pow(gamma,2.0/
double(DIM));
2262 for(
unsigned i=0;
i<DIM;
i++)
2264 for(
unsigned j=0;j<DIM;j++)
2266 if(
i==j) {g(
i,j) = diag_entry;}
2267 else {g(
i,j) = 0.0;}
2277 for(
unsigned i=0;
i<DIM;
i++)
2278 {
for(
unsigned j=0;j<DIM;j++) {interpolated_G(
i,j) = 0.0;}}
2281 for(
unsigned l=0;l<n_node;l++)
2284 for(
unsigned k=0;k<n_position_type;k++)
2287 for(
unsigned i=0;
i<DIM;
i++)
2290 for(
unsigned j=0;j<DIM;j++)
2292 interpolated_G(j,
i) += this->nodal_position_gen(l,k,
i)*dpsidxi(l,k,j);
2302 for(
unsigned i=0;
i<DIM;
i++)
2307 for(
int j=(DIM-1);j>=
static_cast<int>(
i);j--)
2312 for(
unsigned k=0;k<DIM;k++)
2314 G(
i,j) += interpolated_G(
i,k)*interpolated_G(j,k);
2318 for(
int j=(
i-1);j>=0;j--)
2326 double interpolated_solid_p=0.0;
2327 for(
unsigned l=0;l<n_solid_pres;l++)
2329 interpolated_solid_p += solid_p(l)*psisp[l];
2337 double inv_kappa=0.0;
2345 get_stress(g,G,sigma_dev,Gup,detG);
2352 get_stress(g,G,sigma_dev,Gup,gen_dil,inv_kappa);
2356 for (
unsigned i=0;
i<DIM;
i++)
2358 for (
unsigned j=0;j<DIM;j++)
2360 sigma(
i,j)=-interpolated_solid_p*Gup(
i,j)+sigma_dev(
i,j);
2378 {1,0,1,0,0,0,1,0,1};
2392 {1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1};
2399 {0,2,6,8,18,20,24,26};
2411 Initial_Nvalue[6]={1,1,1,0,0,0};
2424 ={1,1,1,1,0,0,0,0,0,0};
Class of matrices containing doubles, and stored as a DenseMatrix<double>, but with solving functiona...
unsigned long nrow() const
Return the number of rows of the matrix.
void get_energy(double &pot_en, double &kin_en)
Get potential (strain) and kinetic energy.
virtual void fill_in_generic_contribution_to_residuals_pvd(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag)
Compute element residual Vector only (if flag=and/or element Jacobian matrix.
void get_strain(const Vector< double > &s, DenseMatrix< double > &strain) const
Return the strain tensor.
unsigned long ncol() const
Return the number of columns of the matrix.
static double Default_lambda_sq_value
Static default value for timescale ratio (1.0 – for natural scaling)
double & raw_direct_access(const unsigned long &i)
Direct access to internal storage of data in flat-packed C-style column-major format. WARNING: Only for experienced users. Only use this if raw speed is of the essence, as in the solid mechanics problems.
virtual void fill_in_generic_residual_contribution_pvd_with_pressure(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, const unsigned &flag)
Returns the residuals for the discretised principle of virtual displacements, formulated in the incom...
void solve(DoubleVector &rhs)
Complete LU solve (replaces matrix by its LU decomposition and overwrites RHS with solution)...
T & raw_direct_access(const unsigned long &i)
Direct access to internal storage of data in flat-packed C-style column-major format. WARNING: Only for experienced users. Only use this if raw speed is of the essence, as in the solid mechanics problems.
T & raw_direct_access(const unsigned long &i)
Direct access to internal storage of data in flat-packed C-style column-major format. WARNING: Only for experienced users. Only use this if raw speed is of the essence, as in the solid mechanics problems.
unsigned offset(const unsigned long &i, const unsigned long &j) const
Caculate the offset in flat-packed C-style, column-major format, required for a given i...
void get_stress(const Vector< double > &s, DenseMatrix< double > &sigma)
Return the 2nd Piola Kirchoff stress tensor, as calculated from the constitutive law at specified loc...
void extended_output(std::ostream &outfile, const unsigned &n_plot)
Output: x,y,[z],xi0,xi1,[xi2],gamma and the strain and stress components.
void get_deformed_covariant_basis_vectors(const Vector< double > &s, DenseMatrix< double > &def_covariant_basis)
Return the deformed covariant basis vectors at specified local coordinate: def_covariant_basis(i,j) is the j-th component of the i-th basis vector.
void extended_output(std::ostream &outfile, const unsigned &n_plot)
Output: x,y,[z],xi0,xi1,[xi2],gamma and the strain and stress.
unsigned offset(const unsigned long &i, const unsigned long &j) const
Caculate the offset in flat-packed C-style, column-major format, required for a given i...
void get_stress(const Vector< double > &s, DenseMatrix< double > &sigma)
Return the 2nd Piola Kirchoff stress tensor, as calculated from the constitutive law at specified loc...
void get_mass_matrix_diagonal(Vector< double > &mass_diag)
Compute the diagonal of the displacement mass matrix for LSC preconditioner.
void output(std::ostream &outfile)
Output: x,y,[z],xi0,xi1,[xi2],gamma.
void eigenvalues_by_jacobi(Vector< double > &eigen_val, DenseMatrix< double > &eigen_vect) const
Determine eigenvalues and eigenvectors, using Jacobi rotations. Only for symmetric matrices...
void output(std::ostream &outfile)
Output: x,y,[z],xi0,xi1,[xi2],p,gamma.
ConstitutiveLaw * Constitutive_law_pt
Create constitutive law (for smoothing by nonlinear elasticity)
virtual bool requires_incompressibility_constraint()=0
Pure virtual function in which the user must declare if the constitutive equation requires an incompr...
unsigned offset(const unsigned long &i, const unsigned long &j, const unsigned long &k) const
Caculate the offset in flat-packed Cy-style, column-major format, required for a given i...
void get_principal_stress(const Vector< double > &s, DenseMatrix< double > &principal_stress_vector, Vector< double > &principal_stress)
Compute principal stress vectors and (scalar) principal stresses at specified local coordinate...