36 #include "meshes/one_d_mesh.h" 37 #include "meshes/simple_rectangular_tri_mesh.h" 38 #include "meshes/simple_rectangular_quadmesh.h" 39 #include "generic/geom_objects.h" 40 #include "meshes/triangle_mesh.h" 44 using namespace oomph;
53 #ifndef OOMPH_LINEAR_SHELL_ELEMENTS_HEADER 54 #define OOMPH_LINEAR_SHELL_ELEMENTS_HEADER 64 template <
unsigned DIM,
unsigned NNODE_1D>
72 typedef void (*SourceFctPt)(
const Vector<double>& x,
const Vector<double>& unit_n, Vector<double>& f);
77 typedef void (*SourceFctGradientPt)(
const Vector<double>& x,
78 Vector<double>& gradient);
88 BrokenCopy::broken_copy(
"MyShellEquations");
96 virtual inline unsigned u_index_shell()
const {
return this->required_nvalue(0);}
101 const unsigned n_plot=5;
102 output(outfile,n_plot);
107 void output(std::ostream &outfile,
const unsigned &n_plot);
112 const unsigned n_plot=5;
113 output(file_pt,n_plot);
118 void output(FILE* file_pt,
const unsigned &n_plot);
121 void output_fct(std::ostream &outfile,
const unsigned &n_plot,
122 FiniteElement::SteadyExactSolutionFctPt exact_soln_pt);
127 virtual void output_fct(std::ostream &outfile,
const unsigned &n_plot,
129 FiniteElement::UnsteadyExactSolutionFctPt
133 "There is no time-dependent output_fct() for shell elements ",
134 "MyShellEquations<DIM>::output_fct()",
135 OOMPH_EXCEPTION_LOCATION);
140 void compute_error(std::ostream &outfile,
141 FiniteElement::SteadyExactSolutionFctPt exact_soln_pt,
142 double& error,
double& norm);
147 FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt,
148 const double& time,
double& error,
double& norm)
151 "There is no time-dependent compute_error() for shell elements",
152 "MyShellEquations<DIM>::compute_error()",
153 OOMPH_EXCEPTION_LOCATION);
164 {
return Source_fct_gradient_pt;}
168 {
return Source_fct_gradient_pt;}
178 const Vector<double>& x,
179 const Vector<double>& unit_n,
180 Vector<double>& source)
const 185 for(
unsigned i=0;i<(u_index_shell())/2;i++)
193 (*Source_fct_pt)(x,unit_n,source);
202 fill_in_generic_residual_contribution_shell(
203 residuals,GeneralisedElement::Dummy_matrix,0);
223 const unsigned n_node = this->nnode();
226 const unsigned n_dim = Undeformed_midplane_pt->ndim();
229 const unsigned n_lagrangian = Undeformed_midplane_pt->nlagrangian();
232 const unsigned n_position_type = this->nnodal_position_type();
235 const unsigned u_nodal_index = u_index_shell();
238 Shape psi1(3,n_position_type),psi(n_node);
239 DShape dpsidxi1(3,n_position_type,DIM);
240 DShape d2psidxi1(3,n_position_type,3);
242 Vector<double> interpolated_xi(DIM,0.0);
245 Vector<double> interpolated_u(u_nodal_index,0.0);
248 this->basis_c0(s,psi);
251 for(
unsigned l=0;l<n_node;l++)
253 interpolated_u[0] += this->nodal_value(l,0)*psi[l];
254 interpolated_u[1] += this->nodal_value(l,1)*psi[l];
258 this->d2basis_local(s,psi1,dpsidxi1,d2psidxi1);
261 for(
unsigned l=0;l<3;l++)
263 for(
unsigned k=0;k<n_position_type;k++)
265 interpolated_u[2] += this->nodal_value(l,2+k)*psi1(l,k);
266 interpolated_u[3] += this->nodal_value(l,2+k)*dpsidxi1(l,k,0);
267 interpolated_u[4] += this->nodal_value(l,2+k)*dpsidxi1(l,k,1);
268 interpolated_u[5] += this->nodal_value(l,2+k)*d2psidxi1(l,k,0);
269 interpolated_u[6] += this->nodal_value(l,2+k)*d2psidxi1(l,k,1);
270 interpolated_u[7] += this->nodal_value(l,2+k)*d2psidxi1(l,k,2);
276 Vector<double> r(n_dim);
277 DenseMatrix<double> a(n_lagrangian,n_dim);
278 RankThreeTensor<double> dadxi(n_lagrangian,n_lagrangian,n_dim);
280 this->my_interpolated_x(s,interpolated_xi) ;
283 Undeformed_midplane_pt->d2position(interpolated_xi,r,a,dadxi);
286 double tensor_a[2][2];
288 for(
unsigned i=0;i<2;i++)
290 for(
unsigned j=0;j<2;j++)
294 for(
unsigned k=0;k<n_dim;k++)
296 tensor_a[i][j] += a(i,k)*a(j,k);
303 double adet = tensor_a[0][0]*tensor_a[1][1] - tensor_a[0][1]*tensor_a[1][0];
306 Vector<double> unit_n(n_dim);
307 unit_n[0] = 1.0/sqrt(adet)*(a(0,1)*a(1,2) - a(0,2)*a(1,1));
308 unit_n[1] = 1.0/sqrt(adet)*(a(0,2)*a(1,0) - a(0,0)*a(1,2));
309 unit_n[2] = 1.0/sqrt(adet)*(a(0,0)*a(1,1) - a(0,1)*a(1,0));
312 DenseMatrix<double> t(n_lagrangian,n_dim);
313 for(
unsigned i=0;i<n_lagrangian;i++)
315 for(
unsigned j=0;j<n_dim;j++)
327 x_dir = interpolated_u[0]*t(0,0) + interpolated_u[1]*t(1,0) + interpolated_u[2]*unit_n[0];
328 y_dir = interpolated_u[0]*t(0,1) + interpolated_u[1]*t(1,1) + interpolated_u[2]*unit_n[1];
329 z_dir = interpolated_u[0]*t(0,2) + interpolated_u[1]*t(1,2) + interpolated_u[2]*unit_n[2];
331 interpolated_u[0] = x_dir;
332 interpolated_u[1] = y_dir;
333 interpolated_u[2] = z_dir;
335 return(interpolated_u);
339 unsigned self_test();
346 virtual double d2shape_and_d2test_eulerian_shell(
const Vector<double> &s,
348 DShape &dpsidx, DShape &d2psidx, Shape &test,
349 DShape &dtestdx, DShape &d2testdx)
const=0;
350 virtual double dshape_and_dtest_eulerian_shell(
const Vector<double> &s,
352 DShape &dpsidx, Shape &test,
353 DShape &dtestdx)
const=0;
357 virtual double d2shape_and_d2test_eulerian_at_knot_shell(
const unsigned &ipt,
366 virtual double dshape_and_dtest_eulerian_at_knot_shell(
const unsigned &ipt,
375 virtual void fill_in_generic_residual_contribution_shell(
376 Vector<double> &residuals, DenseMatrix<double> &jacobian,
377 const unsigned& flag);
406 template <
unsigned DIM,
unsigned NNODE_1D>
427 BrokenCopy::broken_copy(
"BellShellElement");
434 {
return Initial_Nvalue;}
444 void output(std::ostream &outfile,
const unsigned &n_plot)
456 void output(FILE* file_pt,
const unsigned &n_plot)
462 void output_fct(std::ostream &outfile,
const unsigned &n_plot,
463 FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
471 void output_fct(std::ostream &outfile,
const unsigned &n_plot,
473 FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
480 inline double d2shape_and_d2test_eulerian_shell(
481 const Vector<double> &s, Shape &psi, DShape &dpsidx, DShape &d2psidx,
482 Shape &test, DShape &dtestdx, DShape &d2testdx)
const;
484 inline double dshape_and_dtest_eulerian_shell(
485 const Vector<double> &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx)
const;
490 inline double d2shape_and_d2test_eulerian_at_knot_shell(
const unsigned& ipt,
499 inline double dshape_and_dtest_eulerian_at_knot_shell(
const unsigned &ipt,
520 template<
unsigned DIM,
unsigned NNODE_1D>
522 public virtual TElement<DIM-1,NNODE_1D>
543 template<
unsigned DIM,
unsigned NNODE_1D>
545 const Vector<double> &s,
549 DShape &dtestdx)
const 551 const double J = this->dshape_eulerian(s,psi,dpsidx);
557 template<
unsigned DIM,
unsigned NNODE_1D>
559 const Vector<double> &s,
565 DShape &d2testdx)
const 568 const double J = this->d2shape_eulerian(s,psi,dpsidx,d2psidx);
587 template<
unsigned DIM,
unsigned NNODE_1D>
594 DShape &dtestdx)
const 596 const double J = this->dshape_and_dtest_eulerian_at_knot(ipt,psi,dpsidx,test,dtestdx);
601 template<
unsigned DIM,
unsigned NNODE_1D>
610 DShape &d2testdx)
const 613 const double J = this->d2shape_and_d2test_eulerian_at_knot(ipt,psi,dpsidx,d2psidx,test,dtestdx,d2testdx);
636 template<
unsigned DIM,
unsigned NNODE_1D>
640 template <
unsigned DIM,
unsigned NNODE_1D>
643 DenseMatrix<double> &jacobian,
644 const unsigned& flag)
647 const unsigned n_node = this->nnode();
650 unsigned n_position_type = this->nnodal_position_type();
653 unsigned n_dim = Undeformed_midplane_pt->ndim();
656 unsigned n_lagrangian = Undeformed_midplane_pt->nlagrangian();
659 Shape psi1(3,n_position_type), test1(3,n_position_type), test(n_node), psi(n_node);
660 DShape dpsidxi1(3,n_position_type,DIM), dtestdxi1(3,n_position_type,DIM), dtestdxi(n_node,DIM), dpsidxi(n_node,DIM);
661 DShape d2psidxi1(3,n_position_type,3), d2testdxi1(3,n_position_type,3), d2testdxi(n_node,3), d2psidxi(n_node,3);
664 const unsigned n_intpt = this->integral_pt()->nweight();
670 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
673 double w = this->integral_pt()->weight(ipt);
677 double J = dshape_and_dtest_eulerian_at_knot_shell(ipt,psi,dpsidxi,test,dtestdxi);
680 double J1 = d2shape_and_d2test_eulerian_at_knot_shell(ipt,psi1,dpsidxi1,d2psidxi1,test,dtestdxi,d2testdxi);
689 Vector<double> u_value(n_position_type,0.0);
690 Vector<double> interpolated_u(3,0.0);
691 DenseMatrix<double> interpolated_dudxi(3,DIM,0.0);
692 DenseMatrix<double> interpolated_d2udxi(3,3,0.0);
693 Vector<double> interpolated_xi(DIM,0.0);
696 s[0] = this->integral_pt()->knot(ipt,0);
697 s[1] = this->integral_pt()->knot(ipt,1);
698 this->my_interpolated_x(s,interpolated_xi);
704 for(
unsigned i=0;i<2;i++)
707 for(
unsigned l=0;l<n_node;l++)
710 u_value[i] = this->raw_nodal_value(l,i);
711 interpolated_u[i] += u_value[i]*psi[l];
714 for(
unsigned j=0;j<n_lagrangian;j++)
716 interpolated_dudxi(i,j) += u_value[i]*dpsidxi(l,j);
720 for(
unsigned j=0;j<3;j++)
722 interpolated_d2udxi(i,j) += u_value[i]*d2psidxi(l,j);
728 for(
unsigned l=0;l<3;l++)
730 for(
unsigned k=0;k<n_position_type;k++)
733 u_value[k] = this->raw_nodal_value(l,2+k);
734 interpolated_u[2] += u_value[k]*psi1(l,k);
737 for(
unsigned j=0;j<n_lagrangian;j++)
739 interpolated_dudxi(2,j) += u_value[k]*dpsidxi1(l,k,j);
743 for(
unsigned j=0;j<3;j++)
745 interpolated_d2udxi(2,j) += u_value[k]*d2psidxi1(l,k,j);
752 Vector<double> r(n_dim);
753 DenseMatrix<double> a(n_lagrangian,n_dim), a_tn(n_lagrangian,n_dim);
754 RankThreeTensor<double> dadxi(n_lagrangian,n_lagrangian,n_dim);
757 Undeformed_midplane_pt->d2position(interpolated_xi,r,a,dadxi);
760 double tensor_a[2][2], aup[2][2];
762 for(
unsigned i=0;i<2;i++)
764 for(
unsigned j=0;j<2;j++)
768 for(
unsigned k=0;k<n_dim;k++)
770 tensor_a[i][j] += a(i,k)*a(j,k);
776 double adet = tensor_a[0][0]*tensor_a[1][1] - tensor_a[0][1]*tensor_a[1][0];
779 aup[0][0] = tensor_a[1][1]/adet;
780 aup[0][1] = -1*tensor_a[0][1]/adet;
781 aup[1][0] = -1*tensor_a[1][0]/adet;
782 aup[1][1] = tensor_a[0][0]/adet;
785 Vector<double> unit_n(n_dim),n(n_dim);
787 n[0] = (a(0,1)*a(1,2) - a(0,2)*a(1,1));
788 n[1] = (a(0,2)*a(1,0) - a(0,0)*a(1,2));
789 n[2] = (a(0,0)*a(1,1) - a(0,1)*a(1,0));
790 magnitude_n = sqrt(n[0]*n[0] + n[1]*n[1] + n[2]*n[2]);
791 unit_n[0] = n[0]/magnitude_n;
792 unit_n[1] = n[1]/magnitude_n;
793 unit_n[2] = n[2]/magnitude_n;
796 DenseMatrix<double> t(3,n_dim,0.0),t_tn(3,n_dim,0.0);
797 for(
unsigned i=0;i<3;i++)
799 for(
unsigned j=0;j<n_dim;j++)
813 DenseMatrix<double> dndxi(n_lagrangian,n_dim);
814 Vector<double> vec(3);
816 for(
unsigned i=0;i<n_lagrangian;i++)
818 vec[0] = (dadxi(0,i,1)*t(1,2) - dadxi(0,i,2)*t(1,1)) - (dadxi(1,i,1)*t(0,2) - dadxi(1,i,2)*t(0,1));
819 vec[1] = (dadxi(0,i,2)*t(1,0) - dadxi(0,i,0)*t(1,2)) - (dadxi(1,i,2)*t(0,0) - dadxi(1,i,0)*t(0,2));
820 vec[2] = (dadxi(0,i,0)*t(1,1) - dadxi(0,i,1)*t(1,0)) - (dadxi(1,i,0)*t(0,1) - dadxi(1,i,1)*t(0,0));
822 dndxi(i,0) = vec[0]/magnitude_n ;
823 dndxi(i,1) = vec[1]/magnitude_n ;
824 dndxi(i,2) = vec[2]/magnitude_n ;
830 RankThreeTensor<double> dtdxi(n_dim,n_lagrangian,n_dim);
833 for(
unsigned i=0;i<n_dim;i++)
835 for(
unsigned j=0;j<n_lagrangian;j++)
837 for(
unsigned m=0;m<n_dim;m++)
845 for(
unsigned i=0;i<n_lagrangian;i++)
847 for(
unsigned j=0;j<n_lagrangian;j++)
849 for(
unsigned m=0;m<n_dim;m++)
851 for(
unsigned k=0;k<n_dim;k++)
853 dtdxi(i,j,m) += dadxi(i,j,k)*t(m,k);
859 for(
unsigned i=0;i<n_lagrangian;i++)
861 for(
unsigned m=0;m<n_dim;m++)
863 for(
unsigned k=0;k<n_dim;k++)
865 dtdxi(2,i,m) += dndxi(i,k)*t(m,k);
872 DenseMatrix<double> interpolated_dudxi_tn(n_dim,n_lagrangian,0.0);
874 for(
unsigned i=0;i<n_lagrangian;i++)
876 for(
unsigned k=0;k<n_dim;k++)
878 interpolated_dudxi_tn(k,i) = interpolated_dudxi(k,i);
879 for(
unsigned j=0;j<n_dim;j++)
881 interpolated_dudxi_tn(k,i) += interpolated_u[j]*dtdxi(j,i,k);
890 for(
unsigned al=0;al<2;al++)
892 for(
unsigned be=0;be<2;be++)
898 for(
unsigned al=0;al<2;al++)
900 for(
unsigned be=0;be<2;be++)
902 gamma[al][be] = ( interpolated_dudxi_tn(al,be) + interpolated_dudxi_tn(be,al))/2.0;
908 DenseMatrix<double> interpolated_d2udxi_tn(n_dim,3,0.0);
912 for(
unsigned c=0;c<3;c++)
931 for(
unsigned k=0;k<n_dim;k++)
933 interpolated_d2udxi_tn(k,c) = interpolated_d2udxi(k,c);
935 for(
unsigned j=0;j<n_dim;j++)
937 interpolated_d2udxi_tn(k,c) += interpolated_dudxi_tn(j,al)*dtdxi(j,be,k);
939 for(
unsigned i=0;i<n_dim;i++)
941 interpolated_d2udxi_tn(k,c) += interpolated_dudxi(i,be)*dtdxi(i,al,k);
947 Vector<double> L(n_dim,0.0),temp(n_dim,0.0);
949 L[0] = tensor_a[0][1]*interpolated_dudxi_tn(2,1) - tensor_a[1][1]*interpolated_dudxi_tn(2,0);
950 L[1] = -1.0*tensor_a[0][0]*interpolated_dudxi_tn(2,1) + tensor_a[1][0]*interpolated_dudxi_tn(2,0);
951 L[2] = tensor_a[0][0]*interpolated_dudxi_tn(1,1) - tensor_a[0][1]*interpolated_dudxi_tn(0,1)
952 + tensor_a[1][1]*interpolated_dudxi_tn(0,0) - tensor_a[1][0]*interpolated_dudxi_tn(1,0);
958 for(
unsigned al=0;al<2;al++)
960 for(
unsigned be=0;be<2;be++)
967 for(
unsigned al=0;al<2;al++)
969 for(
unsigned be=0;be<2;be++)
971 if(al==0 && be==0) {c=0;}
972 else if(al==1 && be==1) {c=1;}
973 else if(al!=be) {c=2;}
975 for(
unsigned k=0;k<n_dim;k++)
977 kappa[al][be] -= 1.0/adet*(dtdxi(al,be,k)*L[k]);
980 kappa[al][be] += 1.0/adet/adet*L[2]*dtdxi(al,be,2);
981 kappa[al][be] -= interpolated_d2udxi_tn(2,c);
986 double Et[2][2][2][2];
989 double C1 = 0.5*(1.0-Nu);
993 for(
unsigned i=0;i<2;i++)
995 for(
unsigned j=0;j<2;j++)
997 for(
unsigned k=0;k<2;k++)
999 for(
unsigned l=0;l<2;l++)
1001 Et[i][j][k][l] = C1*(aup[i][k]*aup[j][l] + aup[i][l]*aup[j][k]) + C2*aup[i][j]*aup[k][l];
1008 Vector<double> source(n_dim),f(n_dim);
1009 get_source_function(ipt,interpolated_xi,unit_n,source);
1011 f[0] = source[0]*t(0,0) + source[1]*t(0,1) + source[2]*t(0,2);
1012 f[1] = source[0]*t(1,0) + source[1]*t(1,1) + source[2]*t(1,2);
1013 f[2] = source[0]*t(2,0) + source[1]*t(2,1) + source[2]*t(2,2);
1020 for(
unsigned i=0;i<n_dim;i++)
1026 for(
unsigned l=0;l<3;l++)
1028 for(
unsigned p=0;p<n_position_type;p++)
1031 DenseMatrix<double> delta_kappa(2,2,0.0);
1032 DenseMatrix<double> delta_gamma(2,2,0.0);
1033 for(
unsigned al=0;al<2;al++)
1035 for(
unsigned be=0;be<2;be++)
1038 delta_gamma(al,be) = (dtdxi(2,be,al) + dtdxi(2,al,be))/2.0*psi1(l,p);
1041 if((al==0) & (be==0)) {c=0;}
1042 else if((al==1) & (be==1)) {c=1;}
1043 else if(al!=be) {c=2;}
1045 delta_kappa(al,be) -= d2psidxi1(l,p,c);
1047 delta_kappa(al,be) += -1.0/adet*dtdxi(al,be,0)*( dtdxi(2,1,2)*tensor_a[0][1]*psi1(l,p)-dtdxi(2,0,2)*tensor_a[1][1]*psi1(l,p) );
1049 delta_kappa(al,be) += -1.0/adet*dtdxi(al,be,1)*( -1*dtdxi(2,1,2)*tensor_a[0][0]*psi1(l,p) + dtdxi(2,0,2)*tensor_a[1][0]*psi1(l,p) );
1051 delta_kappa(al,be) += -1.0/adet*dtdxi(al,be,2)*( dtdxi(2,1,1)*tensor_a[0][0]*psi1(l,p)-dtdxi(2,1,0)*tensor_a[0][1]*psi1(l,p)
1052 + dtdxi(2,0,0)*tensor_a[1][1]*psi1(l,p)-dtdxi(2,0,1)*tensor_a[1][0]*psi1(l,p) );
1054 delta_kappa(al,be) += dtdxi(al,be,2)/adet/adet*( dtdxi(2,1,1)*tensor_a[0][0]*psi1(l,p)-dtdxi(2,1,0)*tensor_a[0][1]*psi1(l,p)
1055 + dtdxi(2,0,0)*tensor_a[1][1]*psi1(l,p)-dtdxi(2,0,1)*tensor_a[1][0]*psi1(l,p) );
1057 delta_kappa(al,be) += -1.0/adet*dtdxi(al,be,0)*( tensor_a[0][1]*dpsidxi1(l,p,1) - tensor_a[1][1]*dpsidxi1(l,p,0));
1059 delta_kappa(al,be) += -1.0/adet*dtdxi(al,be,1)*( -1*tensor_a[0][0]*dpsidxi1(l,p,1) + tensor_a[1][0]*dpsidxi1(l,p,0) );
1063 for(
unsigned k=0;k<n_dim;k++)
1065 delta_kappa(al,be) -= (dtdxi(2,al,k)*dtdxi(k,be,2))*psi1(l,p);
1069 delta_kappa(al,be) -= (dtdxi(2,be,2))*dpsidxi1(l,p,al);
1072 delta_kappa(al,be) -= (dtdxi(2,al,2))*dpsidxi1(l,p,be);
1076 local_eqn = this->nodal_local_eqn(l,2+p);
1080 residuals[local_eqn] -= (1.0/H)*source[i]*psi1(l,p)*W1*sqrt(adet);
1082 for(
unsigned al=0;al<2;al++)
1084 for(
unsigned be=0;be<2;be++)
1086 for(
unsigned ga=0;ga<2;ga++)
1088 for(
unsigned de=0;de<2;de++)
1090 residuals[local_eqn] += Et[al][be][ga][de]*(gamma[al][be]*delta_gamma(ga,de) + 1.0/12.0*H*H*kappa[al][be]*delta_kappa(ga,de))*W1*sqrt(adet);
1103 for(
unsigned l=0;l<n_node;l++)
1106 DenseMatrix<double> delta_kappa(2,2,0.0);
1107 DenseMatrix<double> delta_gamma(2,2,0.0);
1112 delta_gamma(0,0) = dpsidxi(l,0) + dtdxi(i,0,0)*psi[l];
1113 delta_gamma(0,1) = dpsidxi(l,1)/2.0 + (dtdxi(i,1,0) + dtdxi(i,0,1))/2.0*psi[l];
1114 delta_gamma(1,0) = dpsidxi(l,1)/2.0 + (dtdxi(i,1,0) + dtdxi(i,0,1))/2.0*psi[l];
1115 delta_gamma(1,1) = dtdxi(i,1,1)*psi[l];
1119 delta_gamma(0,0) = dtdxi(i,0,0)*psi[l];
1120 delta_gamma(0,1) = dpsidxi(l,0)/2.0 + (dtdxi(i,1,0) + dtdxi(i,0,1))/2.0*psi[l];
1121 delta_gamma(1,0) = dpsidxi(l,0)/2.0 + (dtdxi(i,1,0) + dtdxi(i,0,1))/2.0*psi[l];
1122 delta_gamma(1,1) = dpsidxi(l,1) + dtdxi(i,1,1)*psi[l];
1126 for(
unsigned al=0;al<2;al++)
1128 for(
unsigned be=0;be<2;be++)
1131 if((al==0) & (be==0)) {c=0;}
1132 else if((al==1) & (be==1)) {c=1;}
1133 else if(al!=be) {c=2;}
1137 delta_kappa(al,be) += -1.0/adet*dtdxi(al,be,0)*( dtdxi(0,1,2)*tensor_a[0][1]*psi[l]-dtdxi(0,0,2)*tensor_a[1][1]*psi[l] );
1139 delta_kappa(al,be) += -1.0/adet*dtdxi(al,be,1)*( -1*dtdxi(0,1,2)*tensor_a[0][0]*psi[l] + dtdxi(0,0,2)*tensor_a[1][0]*psi[l] );
1141 delta_kappa(al,be) += -1.0/adet*dtdxi(al,be,2)*( dtdxi(0,1,1)*tensor_a[0][0]*psi[l]-dtdxi(0,1,0)*tensor_a[0][1]*psi[l]
1142 + dtdxi(0,0,0)*tensor_a[1][1]*psi[l]-dtdxi(0,0,1)*tensor_a[1][0]*psi[l] );
1144 delta_kappa(al,be) += dtdxi(al,be,2)/adet/adet*( dtdxi(0,1,1)*tensor_a[0][0]*psi[l]-dtdxi(0,1,0)*tensor_a[0][1]*psi[l]
1145 + dtdxi(0,0,0)*tensor_a[1][1]*psi[l]-dtdxi(0,0,1)*tensor_a[1][0]*psi[l] );
1147 delta_kappa(al,be) += -1.0/adet*dtdxi(al,be,2)*( -1*tensor_a[0][1]*dpsidxi(l,1) + tensor_a[1][1]*dpsidxi(l,0));
1149 delta_kappa(al,be) += dtdxi(al,be,2)/adet/adet*( -1*tensor_a[0][1]*dpsidxi(l,1) + tensor_a[1][1]*dpsidxi(l,0) );
1154 delta_kappa(al,be) += -1.0/adet*dtdxi(al,be,0)*( dtdxi(1,1,2)*tensor_a[0][1]*psi[l]-dtdxi(1,0,2)*tensor_a[1][1]*psi[l] );
1156 delta_kappa(al,be) += -1.0/adet*dtdxi(al,be,1)*( -1*dtdxi(1,1,2)*tensor_a[0][0]*psi[l] + dtdxi(1,0,2)*tensor_a[1][0]*psi[l] );
1158 delta_kappa(al,be) += -1.0/adet*dtdxi(al,be,2)*( dtdxi(1,1,1)*tensor_a[0][0]*psi[l]-dtdxi(1,1,0)*tensor_a[0][1]*psi[l]
1159 + dtdxi(1,0,0)*tensor_a[1][1]*psi[l]-dtdxi(1,0,1)*tensor_a[1][0]*psi[l] );
1161 delta_kappa(al,be) += dtdxi(al,be,2)/adet/adet*( dtdxi(1,1,1)*tensor_a[0][0]*psi[l]-dtdxi(1,1,0)*tensor_a[0][1]*psi[l]
1162 + dtdxi(1,0,0)*tensor_a[1][1]*psi[l]-dtdxi(1,0,1)*tensor_a[1][0]*psi[l] );
1164 delta_kappa(al,be) += -1.0/adet*dtdxi(al,be,2)*( tensor_a[0][0]*dpsidxi(l,1) - tensor_a[1][0]*dpsidxi(l,0));
1166 delta_kappa(al,be) += dtdxi(al,be,2)/adet/adet*( tensor_a[0][0]*dpsidxi(l,1) - tensor_a[1][0]*dpsidxi(l,0) );
1171 for(
unsigned k=0;k<n_dim;k++)
1173 delta_kappa(al,be) -= (dtdxi(i,al,k)*dtdxi(k,be,2))*psi[l];
1177 delta_kappa(al,be) -= (dtdxi(i,be,2))*dpsidxi(l,al);
1180 delta_kappa(al,be) -= (dtdxi(i,al,2))*dpsidxi(l,be);
1185 local_eqn = this->nodal_local_eqn(l,i);
1190 residuals[local_eqn] -= (1.0/H)*source[i]*psi[l]*W*sqrt(adet);
1192 for(
unsigned al=0;al<2;al++)
1195 for(
unsigned be=0;be<2;be++)
1197 for(
unsigned ga=0;ga<2;ga++)
1199 for(
unsigned de=0;de<2;de++)
1201 residuals[local_eqn] += Et[al][be][ga][de]*(gamma[al][be]*delta_gamma(ga,de) + 1.0/12.0*H*H*kappa[al][be]*delta_kappa(ga,de))*W1*sqrt(adet);
1216 template <
unsigned DIM,
unsigned NNODE_1D>
1223 if (FiniteElement::self_test()!=0)
1249 template <
unsigned DIM,
unsigned NNODE_1D>
1251 const unsigned &nplot)
1255 Vector<double> s(DIM),x(DIM);
1261 Vector<double> u(this->required_nvalue(0),0.0);
1262 unsigned num_plot_points=this->nplot_points(nplot);
1263 Vector<double> r(3);
1264 Vector<double> interpolated_xi(DIM,0.0);
1266 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
1270 this->get_s_plot(iplot,nplot,s);
1271 u = interpolated_u_shell(s);
1273 this->my_interpolated_x(s,x);
1275 for(
unsigned i=0;i<DIM;i++)
1277 outfile << x[i] <<
" ";
1281 for(
unsigned j=0;j<this->required_nvalue(0);j++)
1283 outfile << u[j] <<
" " ;
1286 outfile << std::endl;
1302 template <
unsigned DIM,
unsigned NNODE_1D>
1304 const unsigned &nplot)
1307 Vector<double> s(DIM);
1310 fprintf(file_pt,
"%s",this->tecplot_zone_string(nplot).c_str());
1313 Vector<double> u(this->required_nvalue(0),0.0);
1314 unsigned num_plot_points=this->nplot_points(nplot);
1315 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
1318 this->get_s_plot(iplot,nplot,s);
1320 for(
unsigned i=0;i<DIM;i++)
1322 fprintf(file_pt,
"%g ",this->interpolated_x(s,i));
1324 u = interpolated_u_shell(s);
1325 fprintf(file_pt,
"%g \n",u[0]);
1342 template <
unsigned DIM,
unsigned NNODE_1D>
1344 const unsigned &nplot,
1345 FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
1348 Vector<double> s(DIM);
1351 Vector<double> x(DIM);
1354 outfile << this->tecplot_zone_string(nplot);
1357 Vector<double> exact_soln(this->required_nvalue(0));
1360 unsigned num_plot_points=this->nplot_points(nplot);
1361 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
1365 this->get_s_plot(iplot,nplot,s);
1368 this->my_interpolated_x(s,x);
1371 (*exact_soln_pt)(x,exact_soln);
1374 for(
unsigned i=0;i<DIM;i++)
1376 outfile << x[i] <<
" ";
1379 for(
unsigned j=0;j<this->required_nvalue(0);j++)
1381 outfile << exact_soln[j] <<
"\t";
1383 outfile << std::endl;
1400 template <
unsigned DIM,
unsigned NNODE_1D>
1402 FiniteElement::SteadyExactSolutionFctPt exact_soln_pt,
1403 double& error,
double& norm)
1410 Vector<double> s(DIM);
1413 Vector<double> x(DIM);
1416 unsigned n_intpt = this->integral_pt()->nweight();
1422 Vector<double> exact_soln(this->required_nvalue(0));
1425 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
1429 for(
unsigned i=0;i<DIM;i++)
1431 s[i] = this->integral_pt()->knot(ipt,i);
1435 double w = this->integral_pt()->weight(ipt);
1438 double J=this->J_eulerian(s);
1444 this->my_interpolated_x(s,x);
1447 Vector<double> u_fe(this->required_nvalue(0),0.0);
1448 u_fe =interpolated_u_shell(s);
1451 (*exact_soln_pt)(x,exact_soln);
1454 for(
unsigned i=0;i<DIM;i++)
1456 outfile << x[i] <<
" ";
1458 for(
unsigned ii=0;ii<this->required_nvalue(0);ii++)
1460 outfile << exact_soln[ii] <<
" " << exact_soln[ii]-u_fe[ii] <<
" ";
1462 outfile << std::endl;
1465 double tmp1 = 0.0, tmp2 =0.0;
1466 for(
unsigned ii=0;ii<1;ii++)
1469 tmp1 = (exact_soln[ii]*exact_soln[ii]*W);
1470 tmp2 = ((exact_soln[ii]-u_fe[ii])*(exact_soln[ii]-u_fe[ii])*W);
1513 void source_function(
const Vector<double>& x,
const Vector<double>& unit_n, Vector<double>& source)
1515 for(
unsigned i=0;i<3;i++)
1517 source[i] = 1.0*epsilon*P_ext*unit_n[i];
1525 template<
class ELEMENT,
unsigned DIM,
unsigned NNODE_1D>
1533 const string& node_file_name,
1534 const string& element_file_name,
1535 const string& poly_file_name);
1544 void actions_before_newton_solve();
1551 void doc_solution(DocInfo& doc_info);
1553 void parameter_study();
1569 template<
class ELEMENT,
unsigned DIM,
unsigned NNODE_1D>
1572 const string& node_file_name,
const string& element_file_name,
1573 const string& poly_file_name) :
1574 Source_fct_pt(source_fct_pt)
1577 Problem::mesh_pt() =
new TriangleMesh<ELEMENT>(node_file_name,element_file_name,poly_file_name);
1580 Undef_midplane_pt =
new EllipticalTube(1.0,1.0);
1582 unsigned n_node = this->mesh_pt()->nnode();
1583 cout <<
"\n\nNumber of nodes in the mesh = " << n_node << endl;
1586 unsigned n_element = mesh_pt()->nelement();
1587 cout <<
"Number of nelements in the mesh = " << n_element << endl;
1590 for(
unsigned n=0;n<n_element;n++)
1593 ELEMENT *elem_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(n));
1595 unsigned nnode = elem_pt->nnode();
1596 for(
unsigned i=0;i<nnode;i++)
1598 if((i==0) || (i==1) || (i==2))
1603 elem_pt->node_pt(i)->pin(2);
1604 elem_pt->node_pt(i)->pin(3);
1605 elem_pt->node_pt(i)->pin(4);
1606 elem_pt->node_pt(i)->pin(5);
1607 elem_pt->node_pt(i)->pin(6);
1608 elem_pt->node_pt(i)->pin(7);
1617 unsigned n_side0 = mesh_pt()->nboundary_node(0);
1618 unsigned n_side1 = mesh_pt()->nboundary_node(1);
1619 unsigned n_side2 = mesh_pt()->nboundary_node(2);
1620 unsigned n_side3 = mesh_pt()->nboundary_node(3);
1626 for(
unsigned i=0;i<n_side0;i++)
1629 mesh_pt()->boundary_node_pt(0,i)->pin(1);
1632 mesh_pt()->boundary_node_pt(0,i)->pin(4);
1633 mesh_pt()->boundary_node_pt(0,i)->pin(5);
1634 mesh_pt()->boundary_node_pt(0,i)->pin(6);
1635 mesh_pt()->boundary_node_pt(0,i)->pin(7);
1639 for(
unsigned i=0;i<n_side1;i++)
1641 mesh_pt()->boundary_node_pt(1,i)->pin(0);
1642 mesh_pt()->boundary_node_pt(1,i)->pin(1);
1643 mesh_pt()->boundary_node_pt(1,i)->pin(2);
1644 mesh_pt()->boundary_node_pt(1,i)->pin(3);
1645 mesh_pt()->boundary_node_pt(1,i)->pin(4);
1646 mesh_pt()->boundary_node_pt(1,i)->pin(5);
1647 mesh_pt()->boundary_node_pt(1,i)->pin(6);
1648 mesh_pt()->boundary_node_pt(1,i)->pin(7);
1652 for(
unsigned i=0;i<n_side2;i++)
1655 mesh_pt()->boundary_node_pt(2,i)->pin(1);
1658 mesh_pt()->boundary_node_pt(2,i)->pin(4);
1659 mesh_pt()->boundary_node_pt(2,i)->pin(5);
1660 mesh_pt()->boundary_node_pt(2,i)->pin(6);
1661 mesh_pt()->boundary_node_pt(2,i)->pin(7);
1665 for(
unsigned i=0;i<n_side3;i++)
1667 mesh_pt()->boundary_node_pt(3,i)->pin(0);
1668 mesh_pt()->boundary_node_pt(3,i)->pin(1);
1669 mesh_pt()->boundary_node_pt(3,i)->pin(2);
1670 mesh_pt()->boundary_node_pt(3,i)->pin(3);
1671 mesh_pt()->boundary_node_pt(3,i)->pin(4);
1672 mesh_pt()->boundary_node_pt(3,i)->pin(5);
1673 mesh_pt()->boundary_node_pt(3,i)->pin(6);
1674 mesh_pt()->boundary_node_pt(3,i)->pin(7);
1678 for(
unsigned i=0;i<n_element;i++)
1681 ELEMENT *elem_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(i));
1684 elem_pt->source_fct_pt() = Source_fct_pt;
1687 elem_pt->undeformed_midplane_pt() = Undef_midplane_pt;
1691 assign_eqn_numbers();
1699 template<
class ELEMENT,
unsigned DIM,
unsigned NNODE_1D>
1704 for(
unsigned n=0;n<mesh_pt()->nboundary();n++)
1707 unsigned n_side = mesh_pt()->nboundary_node(n);
1709 for(
unsigned j=0;j<n_side;j++)
1712 Node* left_node_pt=mesh_pt()->boundary_node_pt(n,j);
1716 Vector<double> u((e.required_nvalue(0)));
1717 for(
unsigned i=0;i<(e.required_nvalue(0));i++)
1721 Vector<double> x(2);
1722 x[0]=left_node_pt->x(0);
1723 x[1]=left_node_pt->x(1);
1729 left_node_pt->set_value(i,u[i]);
1739 template<
class ELEMENT,
unsigned DIM,
unsigned NNODE_1D>
1751 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
1753 some_file.open(filename);
1754 some_file.precision(20);
1755 mesh_pt()->output(some_file,npts);
1763 template<
class ELEMENT,
unsigned DIM,
unsigned NNODE_1D>
1767 Problem::Max_residuals = 1.0e10;
1772 double pext_increment = 1.0;
1778 doc_info.set_directory(
"RESLT_unstructured_curved_shell");
1781 for(
unsigned i=0;i<nstep;i++)
1789 doc_info.number() = i;
1790 doc_solution(doc_info);
1805 CommandLineArgs::setup(argc,argv);
1810 std::string error_message =
1811 "Wrong number of command line arguments.\n";
1813 "Must specify the following file names \n";
1815 "filename.node then filename.ele then filename.poly\n";
1817 throw OomphLibError(error_message,
1819 OOMPH_EXCEPTION_LOCATION);
1822 string node_file_name(argv[1]);
1823 string element_file_name(argv[2]);
1824 string poly_file_name(argv[3]);
1832 cout <<
"\n\n\nProblem self-test ";
1833 if (problem.self_test()==0)
1835 cout <<
"passed: Problem can be solved." << std::endl;
1839 throw OomphLibError(
"failed!",
"main()",OOMPH_EXCEPTION_LOCATION);
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector (wrapper)
void actions_before_newton_solve()
Update the problem specs before solve: (Re)set boundary conditions.
void output(std::ostream &outfile, const unsigned &n_plot)
Output function: x,y,u or x,y,z,u at n_plot^DIM plot points.
static const unsigned Initial_Nvalue
Static int that holds the number of variables at nodes: always the same.
SourceFctPt source_fct_pt() const
Access function: Pointer to source function. Const version.
void actions_after_newton_solve()
Update the problem specs after solve (empty)
~MyLinearisedShellProblem()
Destructor (empty)
Namespace for the solution of 2D linear shell equation.
double P_ext
Pressure load.
BellShellElement(const BellShellElement< DIM, NNODE_1D > &dummy)
Broken copy constructor.
BellShellElement elements are with subparametric interpolation for the function.
virtual void get_source_function(const unsigned &ipt, const Vector< double > &x, const Vector< double > &unit_n, Vector< double > &source) const
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional TElement. ...
void output(std::ostream &outfile)
Output function: x,y,u or x,y,z,u.
double * Lambda_sq_pt
Pointer to Timescale ratio.
MyShellEquations()
Constructor (must initialise the Source_fct_pt to null)
void compute_error(std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
Dummy, time dependent error checker.
void source_function(const Vector< double > &x, const Vector< double > &unit_n, Vector< double > &source)
Source function applied in the normal vector.
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output function for an exact solution: x,y,u_exact or x,y,z,u_exact at n_plot^DIM plot points...
GeomObject * Undeformed_midplane_pt
Pointer to undeformed beam:
Vector< double > interpolated_u_shell(const Vector< double > &s) const
Return FE representation of unknown value u(s) at local coordinate s.
SourceFctGradientPt Source_fct_gradient_pt
Pointer to gradient of source function.
void output(std::ostream &outfile)
Output with default number of plot points.
BellShellElement()
Constructor: Call constructors for BellElement and Shell equations.
virtual void output_fct(std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Output exact soln: x,y,u_exact or x,y,z,u_exact at n_plot^DIM plot points (dummy time-dependent versi...
int main(int argc, char *argv[])
Driver for 2D linearised shell problem.
void parameter_study()
Solver loop to perform parameter study.
void output_fct(std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Output function for a time-dependent exact solution. x,y,u_exact or x,y,z,u_exact at n_plot^DIM plot ...
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function: x,y,u or x,y,z,u at n_plot^DIM plot points.
SourceFctGradientPt & source_fct_gradient_pt()
Access function: Pointer to gradient of source function.
double * Sigma0_pt
Pointer to axial prestress.
SourceFctGradientPt source_fct_gradient_pt() const
Access function: Pointer to gradient source function. Const version.
GeomObject * Undef_midplane_pt
Pointer to geometric object that represents the shell's undeformed shape.
SourceFctPt & source_fct_pt()
Access function: Pointer to source function.
void output(FILE *file_pt)
C_style output with default number of plot points.
unsigned required_nvalue(const unsigned &n) const
Required # of `values' (pinned or dofs) at node n.
void get_exact_u(const Vector< double > &x, Vector< double > &u)
void output(FILE *file_pt)
C-style output function: x,y,u or x,y,z,u.
MyShellEquations(const MyShellEquations &dummy)
Broken copy constructor.
virtual unsigned u_index_shell() const
Return the index at which the unknown value is stored. In derived multi-physics elements, this function should be overloaded to reflect the chosen storage scheme. Note that these equations require that the unknown is always stored at the same index at each node.
GeomObject *& undeformed_midplane_pt()
Access function: Undeformed shell.
SourceFctPt Source_fct_pt
Pointer to source function:
void doc_solution(DocInfo &doc_info)
Doc the solution, pass the number of the case considered, so that output files can be distinguished...
2D linearised shell problem.
double * H_pt
Pointer to wall thickness.
MyShellEquations< DIM, NNODE_1D >::SourceFctPt Source_fct_pt
Pointer to source function.
MyLinearisedShellProblem(typename MyShellEquations< DIM, NNODE_1D >::SourceFctPt source_fct_pt, const string &node_file_name, const string &element_file_name, const string &poly_file_name)
Constructor: Pass number of elements and pointer to source function.