30 template <
short_t d,
class T,
bool bending>
31 gsThinShellAssemblerDWR<d, T, bending>::gsThinShellAssemblerDWR(
32 const gsMultiPatch<T> & patches,
33 const gsMultiBasis<T> & basisL,
34 const gsMultiBasis<T> & basisH,
35 const gsBoundaryConditions<T> & bconditions,
36 const gsFunction<T> & surface_force,
37 gsMaterialMatrixBase<T> * materialmatrix
40 Base(patches,basisL,bconditions,surface_force,materialmatrix),
43 m_assemblerL =
new gsThinShellAssembler<d,T,bending>(patches,basisL,bconditions,surface_force,materialmatrix);
44 m_assemblerH =
new gsThinShellAssembler<d,T,bending>(patches,basisH,bconditions,surface_force,materialmatrix);
46 m_dL = gsVector<T>::Zero(m_assemblerL->numDofs());
47 m_dH = gsVector<T>::Zero(m_assemblerH->numDofs());
50 template <
short_t d,
class T,
bool bending>
51 ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleMass(gsThinShellAssemblerBase<T> * assembler, gsSparseMatrix<T> & result,
bool lumped)
54 result = assembler->matrix();
112 template <
short_t d,
class T,
bool bending>
115 std::pair<gsSparseMatrix<T>,gsVector<T>> result;
117 m_matrixL = result.first;
118 m_pL = result.second;
123 template <
short_t d,
class T,
bool bending>
126 std::pair<gsSparseMatrix<T>,gsVector<T>> result;
128 m_matrixH = result.first;
129 m_pH = result.second;
133 template <
short_t d,
class T,
bool bending>
134 ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assemble(gsThinShellAssemblerBase<T> * assembler, std::pair<gsSparseMatrix<T>,gsVector<T>> & result)
137 result = std::make_pair(assembler->matrix(),assembler->rhs());
142 template <
short_t d,
class T,
bool bending>
143 ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleMatrix(gsThinShellAssemblerBase<T> * assembler, gsSparseMatrix<T> & result)
146 result = assembler->matrix();
151 template <
short_t d,
class T,
bool bending>
152 ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleMatrix(gsThinShellAssemblerBase<T> * assembler,
const gsMultiPatch<T> & deformed, gsSparseMatrix<T> & result)
155 result = assembler->matrix();
160 template <
short_t d,
class T,
bool bending>
161 ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assemblePrimal(gsThinShellAssemblerBase<T> * assembler,
const gsMultiPatch<T> & deformed, gsVector<T> & result)
164 result = assembler->rhs();
169 template <
short_t d,
class T,
bool bending>
170 ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assemblePrimal(gsThinShellAssemblerBase<T> * assembler, gsVector<T> & result)
174 result = assembler->rhs();
178 template <
short_t d,
class T,
bool bending>
179 ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(gsThinShellAssemblerBase<T> * assembler,
const gsMultiPatch<T> & primal,
const gsMultiPatch<T> & deformed, gsVector<T> & result)
181 GISMO_ASSERT(m_component < d || m_component==9,
"Component is out of bounds");
189 gsExprAssembler<T> exprAssembler = assembler->assembler();
190 exprAssembler.cleanUp();
191 GISMO_ENSURE(assembler->options().hasGroup(
"ExprAssembler"),
"The option list does not contain options with the label 'ExprAssembler'!");
192 exprAssembler.setOptions(assembler->options().getGroup(
"ExprAssembler"));
195 geometryMap Gori = exprAssembler.getMap(m_patches);
196 geometryMap Gdef = exprAssembler.getMap(deformed);
199 exprAssembler.initSystem();
200 exprAssembler.initVector(1);
203 space space = exprAssembler.trialSpace(0);
205 space.setup(m_bcs, dirichlet::homogeneous, 0);
208 auto usol = exprAssembler.getCoeff(primal);
211 gsMaterialMatrixEval<T,MaterialOutput::StretchTransform> Tstretchf(assembler->materials(),&deformed,Z);
212 gsMaterialMatrixEval<T,MaterialOutput::PStressTransform> Tpstressf(assembler->materials(),&deformed,Z);
213 auto Tstretch = exprAssembler.getCoeff(Tstretchf);
214 auto Tpstress = exprAssembler.getCoeff(Tpstressf);
217 gsMaterialMatrixEval<T,MaterialOutput::MatrixA> mmAf(assembler->materials(),&deformed,Z);
218 gsMaterialMatrixEval<T,MaterialOutput::MatrixD> mmDf(assembler->materials(),&deformed,Z);
219 auto mmA = exprAssembler.getCoeff(mmAf);
220 auto mmD = exprAssembler.getCoeff(mmDf);
223 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixA> mmAfi(assembler->materials(),&deformed);
224 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixB> mmBfi(assembler->materials(),&deformed);
225 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixC> mmCfi(assembler->materials(),&deformed);
226 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixD> mmDfi(assembler->materials(),&deformed);
227 auto mmAi = exprAssembler.getCoeff(mmAfi);
228 auto mmBi = exprAssembler.getCoeff(mmBfi);
229 auto mmCi = exprAssembler.getCoeff(mmCfi);
230 auto mmDi = exprAssembler.getCoeff(mmDfi);
233 gsMaterialMatrixEval<T,MaterialOutput::VectorN> S0f(assembler->materials(),&deformed,Z);
234 gsMaterialMatrixEval<T,MaterialOutput::VectorM> S1f(assembler->materials(),&deformed,Z);
235 auto S0 = exprAssembler.getCoeff(S0f);
236 auto S1 = exprAssembler.getCoeff(S1f);
239 gsMaterialMatrixEval<T,MaterialOutput::PStress> P0f(assembler->materials(),&deformed,Z);
240 auto P0 = exprAssembler.getCoeff(P0f);
243 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorN> Nf(assembler->materials(),&deformed);
244 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorM> Mf(assembler->materials(),&deformed);
245 auto N = exprAssembler.getCoeff(Nf);
246 auto M = exprAssembler.getCoeff(Mf);
249 gsFunctionExpr<T> mult2t(
"1",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"2",2);
250 auto m2 = exprAssembler.getCoeff(mult2t);
254 gsFunctionExpr<T> mult12t(
"1",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"0.5",2);
255 auto m12 = exprAssembler.getCoeff(mult12t);
261 auto lambda = Cm *
reshape(Tstretch,3,3).tr();
262 auto lambda_der = Cm_der *
reshape(Tstretch,3,3).tr();
266 auto Em_der =
flat(
jac(Gdef).tr() *
jac(space) ) ;
270 auto Emp_der= (Em_der *
reshape(m12,3,3)) *
reshape(Tstretch,3,3).tr();
273 auto Ef = ( deriv2(Gori,sn(Gori).normalized().tr()) - deriv2(Gdef,sn(Gdef).normalized().tr()) ) *
reshape(m2,3,3) ;
274 auto Ef_der = -( deriv2(space,sn(Gdef).normalized().tr() ) + deriv2(Gdef,var1(space,Gdef) ) ) *
reshape(m2,3,3);
277 auto Sm_der = Em_der *
reshape(mmA,3,3);
280 auto Smp_der = Sm_der *
reshape(Tpstress,3,3).tr();
283 auto Sf_der = Ef_der *
reshape(mmD,3,3);
286 auto N_der = Em_der *
reshape(mmAi,3,3) + Ef_der *
reshape(mmBi,3,3);
287 auto M_der = Em_der *
reshape(mmCi,3,3) + Ef_der *
reshape(mmDi,3,3);
289 if (m_goalFunction == GoalFunction::Displacement)
293 auto expr = 2 * space * usol *
meas(Gori);
296 exprAssembler.assemble(expr);
297 result = exprAssembler.rhs();
302 exprAssembler.cleanUp();
308 auto expr = space * gismo::expr::uv(m_component,3) *
meas(Gori);
311 exprAssembler.assemble(expr);
312 result = exprAssembler.rhs();
317 exprAssembler.cleanUp();
322 else if (m_goalFunction == GoalFunction::Stretch)
326 auto expr = 2 * lambda_der * lambda.tr() *
meas(Gori);
329 exprAssembler.assemble(expr);
330 result = exprAssembler.rhs();
335 exprAssembler.cleanUp();
341 auto expr = lambda_der * gismo::expr::uv(m_component,3) *
meas(Gori);
344 exprAssembler.assemble(expr);
345 result = exprAssembler.rhs();
350 exprAssembler.cleanUp();
355 else if (m_goalFunction == GoalFunction::PStrain)
359 auto expr = 2 * Emp_der * Emp.tr() *
meas(Gori);
362 exprAssembler.assemble(expr);
363 result = exprAssembler.rhs();
368 exprAssembler.cleanUp();
374 auto expr = Emp_der * gismo::expr::uv(m_component,3) *
meas(Gori);
377 exprAssembler.assemble(expr);
378 result = exprAssembler.rhs();
383 exprAssembler.cleanUp();
388 else if (m_goalFunction == GoalFunction::PStress)
391 gsMatrix<T> convMat(3,2);
393 convMat(0,0) = convMat(1,1) = 1;
394 gsConstantFunction<T> convFun(convMat.reshape(6,1),2);
395 auto conv = exprAssembler.getCoeff(convFun);
398 auto expr = 2 * Smp_der *
reshape(conv,3,2) * P0 *
meas(Gori);
401 exprAssembler.assemble(expr);
402 result = exprAssembler.rhs();
407 exprAssembler.cleanUp();
413 GISMO_ASSERT(m_component < 2,
"Can only select principle stress component 0 or 1, but "<<m_component<<
" selected.");
414 auto expr = Smp_der *
reshape(conv,3,2) * gismo::expr::uv(m_component,2) *
meas(Gori);
417 exprAssembler.assemble(expr);
418 result = exprAssembler.rhs();
423 exprAssembler.cleanUp();
428 else if (m_goalFunction == GoalFunction::MembraneStrain)
432 auto expr = 2 * Em_der * Em.tr() *
meas(Gori);
435 exprAssembler.assemble(expr);
436 result = exprAssembler.rhs();
441 exprAssembler.cleanUp();
447 auto expr = Em_der * gismo::expr::uv(m_component,3) *
meas(Gori);
450 exprAssembler.assemble(expr);
451 result = exprAssembler.rhs();
456 exprAssembler.cleanUp();
461 else if (m_goalFunction == GoalFunction::MembraneStress)
465 auto expr = 2 * Sm_der * S0 *
meas(Gori);
468 exprAssembler.assemble(expr);
469 result = exprAssembler.rhs();
474 exprAssembler.cleanUp();
480 auto expr = Sm_der * gismo::expr::uv(m_component,3) *
meas(Gori);
483 exprAssembler.assemble(expr);
484 result = exprAssembler.rhs();
489 exprAssembler.cleanUp();
494 else if (m_goalFunction == GoalFunction::MembraneForce)
498 auto expr = 2 * N_der * N *
meas(Gori);
501 exprAssembler.assemble(expr);
502 result = exprAssembler.rhs();
507 exprAssembler.cleanUp();
513 auto expr = N_der * gismo::expr::uv(m_component,3) *
meas(Gori);
516 exprAssembler.assemble(expr);
517 result = exprAssembler.rhs();
522 exprAssembler.cleanUp();
527 else if (m_goalFunction == GoalFunction::FlexuralStrain)
531 auto expr = 2 * Ef_der * Ef.tr() *
meas(Gori);
534 exprAssembler.assemble(expr);
535 result = exprAssembler.rhs();
540 exprAssembler.cleanUp();
546 auto expr = Ef_der * gismo::expr::uv(m_component,3) *
meas(Gori);
549 exprAssembler.assemble(expr);
550 result = exprAssembler.rhs();
555 exprAssembler.cleanUp();
560 else if (m_goalFunction == GoalFunction::FlexuralStress)
564 auto expr = 2 * Sf_der * S1 *
meas(Gori);
567 exprAssembler.assemble(expr);
568 result = exprAssembler.rhs();
573 exprAssembler.cleanUp();
579 auto expr = Sf_der * gismo::expr::uv(m_component,3) *
meas(Gori);
582 exprAssembler.assemble(expr);
583 result = exprAssembler.rhs();
588 exprAssembler.cleanUp();
593 else if (m_goalFunction == GoalFunction::FlexuralMoment)
597 auto expr = 2 * M_der * M *
meas(Gori);
600 exprAssembler.assemble(expr);
601 result = exprAssembler.rhs();
606 exprAssembler.cleanUp();
612 auto expr = M_der * gismo::expr::uv(m_component,3) *
meas(Gori);
615 exprAssembler.assemble(expr);
616 result = exprAssembler.rhs();
621 exprAssembler.cleanUp();
630 template <
short_t d,
class T,
bool bending>
631 ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(
const bContainer & bnds, gsThinShellAssemblerBase<T> * assembler,
const gsMultiPatch<T> & primal,
const gsMultiPatch<T> & deformed, gsVector<T> & result)
633 GISMO_ASSERT(m_component < d || m_component==9,
"Component is out of bounds");
641 gsExprAssembler<T> exprAssembler = assembler->assembler();
642 exprAssembler.cleanUp();
643 GISMO_ENSURE(assembler->options().hasGroup(
"ExprAssembler"),
"The option list does not contain options with the label 'ExprAssembler'!");
644 exprAssembler.setOptions(assembler->options().getGroup(
"ExprAssembler"));
647 geometryMap Gori = exprAssembler.getMap(m_patches);
648 geometryMap Gdef = exprAssembler.getMap(deformed);
651 exprAssembler.initSystem();
652 exprAssembler.initVector(1);
655 result = exprAssembler.rhs();
660 space space = exprAssembler.trialSpace(0);
662 space.setup(m_bcs, dirichlet::homogeneous, 0);
665 auto usol = exprAssembler.getCoeff(primal);
668 gsMaterialMatrixEval<T,MaterialOutput::StretchTransform> Tstretchf(assembler->materials(),&deformed,Z);
669 gsMaterialMatrixEval<T,MaterialOutput::PStressTransform> Tpstressf(assembler->materials(),&deformed,Z);
670 auto Tstretch = exprAssembler.getCoeff(Tstretchf);
671 auto Tpstress = exprAssembler.getCoeff(Tpstressf);
674 gsMaterialMatrixEval<T,MaterialOutput::MatrixA> mmAf(assembler->materials(),&deformed,Z);
675 gsMaterialMatrixEval<T,MaterialOutput::MatrixD> mmDf(assembler->materials(),&deformed,Z);
676 auto mmA = exprAssembler.getCoeff(mmAf);
677 auto mmD = exprAssembler.getCoeff(mmDf);
680 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixA> mmAfi(assembler->materials(),&deformed);
681 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixB> mmBfi(assembler->materials(),&deformed);
682 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixC> mmCfi(assembler->materials(),&deformed);
683 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixD> mmDfi(assembler->materials(),&deformed);
684 auto mmAi = exprAssembler.getCoeff(mmAfi);
685 auto mmBi = exprAssembler.getCoeff(mmBfi);
686 auto mmCi = exprAssembler.getCoeff(mmCfi);
687 auto mmDi = exprAssembler.getCoeff(mmDfi);
690 gsMaterialMatrixEval<T,MaterialOutput::VectorN> S0f(assembler->materials(),&deformed,Z);
691 gsMaterialMatrixEval<T,MaterialOutput::VectorM> S1f(assembler->materials(),&deformed,Z);
692 auto S0 = exprAssembler.getCoeff(S0f);
693 auto S1 = exprAssembler.getCoeff(S1f);
696 gsMaterialMatrixEval<T,MaterialOutput::PStress> P0f(assembler->materials(),&deformed,Z);
697 auto P0 = exprAssembler.getCoeff(P0f);
700 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorN> Nf(assembler->materials(),&deformed);
701 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorM> Mf(assembler->materials(),&deformed);
702 auto N = exprAssembler.getCoeff(Nf);
703 auto M = exprAssembler.getCoeff(Mf);
706 gsFunctionExpr<T> mult2t(
"1",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"2",2);
707 auto m2 = exprAssembler.getCoeff(mult2t);
711 gsFunctionExpr<T> mult12t(
"1",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"0.5",2);
712 auto m12 = exprAssembler.getCoeff(mult12t);
718 auto lambda = Cm *
reshape(Tstretch,3,3).tr();
719 auto lambda_der = Cm_der *
reshape(Tstretch,3,3).tr();
723 auto Em_der =
flat(
jac(Gdef).tr() *
jac(space) ) ;
727 auto Emp_der= (Em_der *
reshape(m12,3,3)) *
reshape(Tstretch,3,3).tr();
730 auto Ef = ( deriv2(Gori,sn(Gori).normalized().tr()) - deriv2(Gdef,sn(Gdef).normalized().tr()) ) *
reshape(m2,3,3) ;
731 auto Ef_der = -( deriv2(space,sn(Gdef).normalized().tr() ) + deriv2(Gdef,var1(space,Gdef) ) ) *
reshape(m2,3,3);
734 auto Sm_der = Em_der *
reshape(mmA,3,3);
737 auto Smp_der = Sm_der *
reshape(Tpstress,3,3).tr();
740 auto Sf_der = Ef_der *
reshape(mmD,3,3);
743 auto N_der = Em_der *
reshape(mmAi,3,3) + Ef_der *
reshape(mmBi,3,3);
744 auto M_der = Em_der *
reshape(mmCi,3,3) + Ef_der *
reshape(mmDi,3,3);
746 if (m_goalFunction == GoalFunction::Displacement)
750 auto expr = 2 * space * usol *
meas(Gori);
753 exprAssembler.assembleBdr(bnds,expr);
754 result = exprAssembler.rhs();
759 exprAssembler.cleanUp();
765 auto expr = space * gismo::expr::uv(m_component,3) *
meas(Gori);
768 exprAssembler.assembleBdr(bnds,expr);
769 result = exprAssembler.rhs();
774 exprAssembler.cleanUp();
779 else if (m_goalFunction == GoalFunction::Stretch)
783 auto expr = 2 * lambda_der * lambda.tr() *
meas(Gori);
786 exprAssembler.assembleBdr(bnds,expr);
787 result = exprAssembler.rhs();
792 exprAssembler.cleanUp();
798 auto expr = lambda_der * gismo::expr::uv(m_component,3) *
meas(Gori);
801 exprAssembler.assembleBdr(bnds,expr);
802 result = exprAssembler.rhs();
807 exprAssembler.cleanUp();
812 else if (m_goalFunction == GoalFunction::PStrain)
816 auto expr = 2 * Emp_der * Emp.tr() *
meas(Gori);
819 exprAssembler.assembleBdr(bnds,expr);
820 result = exprAssembler.rhs();
825 exprAssembler.cleanUp();
831 auto expr = Emp_der * gismo::expr::uv(m_component,3) *
meas(Gori);
834 exprAssembler.assembleBdr(bnds,expr);
835 result = exprAssembler.rhs();
840 exprAssembler.cleanUp();
845 else if (m_goalFunction == GoalFunction::PStress)
848 gsMatrix<T> convMat(3,2);
850 convMat(0,0) = convMat(1,1) = 1;
851 gsConstantFunction<T> convFun(convMat.reshape(6,1),2);
852 auto conv = exprAssembler.getCoeff(convFun);
855 auto expr = 2 * Smp_der *
reshape(conv,3,2) * P0 *
meas(Gori);
858 exprAssembler.assembleBdr(bnds,expr);
859 result = exprAssembler.rhs();
864 exprAssembler.cleanUp();
870 GISMO_ASSERT(m_component < 2,
"Can only select principle stress component 0 or 1, but "<<m_component<<
" selected.");
871 auto expr = Smp_der *
reshape(conv,3,2) * gismo::expr::uv(m_component,2) *
meas(Gori);
874 exprAssembler.assembleBdr(bnds,expr);
875 result = exprAssembler.rhs();
880 exprAssembler.cleanUp();
885 else if (m_goalFunction == GoalFunction::MembraneStrain)
889 auto expr = 2 * Em_der * Em.tr() *
meas(Gori);
892 exprAssembler.assembleBdr(bnds,expr);
893 result = exprAssembler.rhs();
898 exprAssembler.cleanUp();
904 auto expr = Em_der * gismo::expr::uv(m_component,3) *
meas(Gori);
907 exprAssembler.assembleBdr(bnds,expr);
908 result = exprAssembler.rhs();
913 exprAssembler.cleanUp();
918 else if (m_goalFunction == GoalFunction::MembraneStress)
922 auto expr = 2 * Sm_der * S0 *
meas(Gori);
925 exprAssembler.assembleBdr(bnds,expr);
926 result = exprAssembler.rhs();
931 exprAssembler.cleanUp();
937 auto expr = Sm_der * gismo::expr::uv(m_component,3) *
meas(Gori);
940 exprAssembler.assembleBdr(bnds,expr);
941 result = exprAssembler.rhs();
946 exprAssembler.cleanUp();
951 else if (m_goalFunction == GoalFunction::MembraneForce)
955 auto expr = 2 * N_der * N *
meas(Gori);
958 exprAssembler.assembleBdr(bnds,expr);
959 result = exprAssembler.rhs();
964 exprAssembler.cleanUp();
970 auto expr = N.tr() * gismo::expr::uv(m_component,3) *
meas(Gori);
973 exprAssembler.assembleBdr(bnds,expr);
974 result = exprAssembler.rhs();
979 exprAssembler.cleanUp();
984 else if (m_goalFunction == GoalFunction::FlexuralStrain)
988 gsFunctionExpr<T> mult110t(
"1",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"0",2);
989 auto m110 = exprAssembler.getCoeff(mult2t);
990 auto expr = 2*Ef_der *
reshape(m110,3,3) * Ef.tr() *
meas(Gori);
993 exprAssembler.assembleBdr(bnds,expr);
994 result = exprAssembler.rhs();
999 exprAssembler.cleanUp();
1005 auto expr = Ef_der * gismo::expr::uv(m_component,3) *
meas(Gori);
1008 exprAssembler.assembleBdr(bnds,expr);
1009 result = exprAssembler.rhs();
1014 exprAssembler.cleanUp();
1019 else if (m_goalFunction == GoalFunction::FlexuralStress)
1023 auto expr = 2 * Sf_der * S1 *
meas(Gori);
1026 exprAssembler.assembleBdr(bnds,expr);
1027 result = exprAssembler.rhs();
1032 exprAssembler.cleanUp();
1038 auto expr = Sf_der * gismo::expr::uv(m_component,3) *
meas(Gori);
1041 exprAssembler.assembleBdr(bnds,expr);
1042 result = exprAssembler.rhs();
1047 exprAssembler.cleanUp();
1052 else if (m_goalFunction == GoalFunction::FlexuralMoment)
1056 auto expr = 2 * M_der * M *
meas(Gori);
1059 exprAssembler.assembleBdr(bnds,expr);
1060 result = exprAssembler.rhs();
1065 exprAssembler.cleanUp();
1071 auto expr = M_der * gismo::expr::uv(m_component,3) *
meas(Gori);
1074 exprAssembler.assembleBdr(bnds,expr);
1075 result = exprAssembler.rhs();
1080 exprAssembler.cleanUp();
1090 template <
short_t d,
class T,
bool bending>
1091 ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(
const gsMatrix<T> & points, gsThinShellAssemblerBase<T> * assembler,
const gsMultiPatch<T> & primal,
const gsMultiPatch<T> & deformed, gsVector<T> & result)
1096 gsMatrix<index_t> actives, globalActives;
1098 GISMO_ASSERT(m_component < d || m_component==9,
"Component is out of bounds");
1106 gsExprAssembler<T> exprAssembler = assembler->assembler();
1107 exprAssembler.cleanUp();
1108 GISMO_ENSURE(assembler->options().hasGroup(
"ExprAssembler"),
"The option list does not contain options with the label 'ExprAssembler'!");
1109 exprAssembler.setOptions(assembler->options().getGroup(
"ExprAssembler"));
1112 geometryMap Gori = exprAssembler.getMap(m_patches);
1113 geometryMap Gdef = exprAssembler.getMap(deformed);
1116 exprAssembler.initSystem();
1117 exprAssembler.initVector(1);
1118 if (points.cols()==0)
1120 result = exprAssembler.rhs();
1125 space space = exprAssembler.trialSpace(0);
1127 space.setup(m_bcs, dirichlet::homogeneous, 0);
1130 auto usol = exprAssembler.getCoeff(primal);
1133 gsMaterialMatrixEval<T,MaterialOutput::StretchTransform> Tstretchf(assembler->materials(),&deformed,Z);
1134 gsMaterialMatrixEval<T,MaterialOutput::PStressTransform> Tpstressf(assembler->materials(),&deformed,Z);
1135 auto Tstretch = exprAssembler.getCoeff(Tstretchf);
1136 auto Tpstress = exprAssembler.getCoeff(Tpstressf);
1139 gsMaterialMatrixEval<T,MaterialOutput::MatrixA> mmAf(assembler->materials(),&deformed,Z);
1140 gsMaterialMatrixEval<T,MaterialOutput::MatrixD> mmDf(assembler->materials(),&deformed,Z);
1141 auto mmA = exprAssembler.getCoeff(mmAf);
1142 auto mmD = exprAssembler.getCoeff(mmDf);
1145 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixA> mmAfi(assembler->materials(),&deformed);
1146 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixB> mmBfi(assembler->materials(),&deformed);
1147 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixC> mmCfi(assembler->materials(),&deformed);
1148 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixD> mmDfi(assembler->materials(),&deformed);
1149 auto mmAi = exprAssembler.getCoeff(mmAfi);
1150 auto mmBi = exprAssembler.getCoeff(mmBfi);
1151 auto mmCi = exprAssembler.getCoeff(mmCfi);
1152 auto mmDi = exprAssembler.getCoeff(mmDfi);
1155 gsMaterialMatrixEval<T,MaterialOutput::VectorN> S0f(assembler->materials(),&deformed,Z);
1156 gsMaterialMatrixEval<T,MaterialOutput::VectorM> S1f(assembler->materials(),&deformed,Z);
1157 auto S0 = exprAssembler.getCoeff(S0f);
1158 auto S1 = exprAssembler.getCoeff(S1f);
1161 gsMaterialMatrixEval<T,MaterialOutput::PStress> P0f(assembler->materials(),&deformed,Z);
1162 auto P0 = exprAssembler.getCoeff(P0f);
1165 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorN> Nf(assembler->materials(),&deformed);
1166 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorM> Mf(assembler->materials(),&deformed);
1167 auto N = exprAssembler.getCoeff(Nf);
1168 auto M = exprAssembler.getCoeff(Mf);
1171 gsFunctionExpr<T> mult2t(
"1",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"2",2);
1172 auto m2 = exprAssembler.getCoeff(mult2t);
1176 gsFunctionExpr<T> mult12t(
"1",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"0.5",2);
1177 auto m12 = exprAssembler.getCoeff(mult12t);
1183 auto lambda = Cm *
reshape(Tstretch,3,3).tr();
1184 auto lambda_der = Cm_der *
reshape(Tstretch,3,3).tr();
1188 auto Em_der =
flat(
jac(Gdef).tr() *
jac(space) ) ;
1192 auto Emp_der= (Em_der *
reshape(m12,3,3)) *
reshape(Tstretch,3,3).tr();
1195 auto Ef = ( deriv2(Gori,sn(Gori).normalized().tr()) - deriv2(Gdef,sn(Gdef).normalized().tr()) ) *
reshape(m2,3,3) ;
1196 auto Ef_der = -( deriv2(space,sn(Gdef).normalized().tr() ) + deriv2(Gdef,var1(space,Gdef) ) ) *
reshape(m2,3,3);
1199 auto Sm_der = Em_der *
reshape(mmA,3,3);
1202 auto Smp_der = Sm_der *
reshape(Tpstress,3,3).tr();
1205 auto Sf_der = Ef_der *
reshape(mmD,3,3);
1208 auto N_der = Em_der *
reshape(mmAi,3,3) + Ef_der *
reshape(mmBi,3,3);
1209 auto M_der = Em_der *
reshape(mmCi,3,3) + Ef_der *
reshape(mmDi,3,3);
1212 gsExprEvaluator<T> ev(exprAssembler);
1213 result.resize(exprAssembler.numDofs());
1215 if (m_goalFunction == GoalFunction::Displacement)
1219 auto expr = 2 * space * usol *
meas(Gori);
1220 for (
index_t k = 0; k!=points.cols(); k++)
1222 tmp = ev.eval(expr,points.col(k));
1223 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1224 for (
index_t j = 0; j< space.dim(); ++j)
1226 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1227 for (
index_t i=0; i < globalActives.rows(); ++i)
1228 if (space.mapper().is_free_index(globalActives(i,0)))
1229 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1235 auto expr = space * gismo::expr::uv(m_component,3) *
meas(Gori);
1236 for (
index_t k = 0; k!=points.cols(); k++)
1238 tmp = ev.eval(expr,points.col(k));
1239 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1240 for (
index_t j = 0; j< space.dim(); ++j)
1242 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1243 for (
index_t i=0; i < globalActives.rows(); ++i)
1244 if (space.mapper().is_free_index(globalActives(i,0)))
1245 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1250 else if (m_goalFunction == GoalFunction::Stretch)
1254 auto expr = 2* lambda_der * lambda.tr() *
meas(Gori);
1255 for (
index_t k = 0; k!=points.cols(); k++)
1257 tmp = ev.eval(expr,points.col(k));
1258 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1259 for (
index_t j = 0; j< space.dim(); ++j)
1261 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1262 for (
index_t i=0; i < globalActives.rows(); ++i)
1263 if (space.mapper().is_free_index(globalActives(i,0)))
1264 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1270 auto expr = lambda_der * gismo::expr::uv(m_component,3) *
meas(Gori);
1271 for (
index_t k = 0; k!=points.cols(); k++)
1273 tmp = ev.eval(expr,points.col(k));
1274 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1275 for (
index_t j = 0; j< space.dim(); ++j)
1277 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1278 for (
index_t i=0; i < globalActives.rows(); ++i)
1279 if (space.mapper().is_free_index(globalActives(i,0)))
1280 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1285 else if (m_goalFunction == GoalFunction::PStrain)
1289 auto expr = 2 * Emp_der * Emp.tr() *
meas(Gori);
1290 for (
index_t k = 0; k!=points.cols(); k++)
1292 tmp = ev.eval(expr,points.col(k));
1293 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1294 for (
index_t j = 0; j< space.dim(); ++j)
1296 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1297 for (
index_t i=0; i < globalActives.rows(); ++i)
1298 if (space.mapper().is_free_index(globalActives(i,0)))
1299 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1305 auto expr = Emp_der * gismo::expr::uv(m_component,3) *
meas(Gori);
1306 for (
index_t k = 0; k!=points.cols(); k++)
1308 tmp = ev.eval(expr,points.col(k));
1309 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1310 for (
index_t j = 0; j< space.dim(); ++j)
1312 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1313 for (
index_t i=0; i < globalActives.rows(); ++i)
1314 if (space.mapper().is_free_index(globalActives(i,0)))
1315 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1320 else if (m_goalFunction == GoalFunction::PStress)
1324 auto expr = 2 * Smp_der * P0 *
meas(Gori);
1325 for (
index_t k = 0; k!=points.cols(); k++)
1327 tmp = ev.eval(expr,points.col(k));
1328 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1329 for (
index_t j = 0; j< space.dim(); ++j)
1331 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1332 for (
index_t i=0; i < globalActives.rows(); ++i)
1333 if (space.mapper().is_free_index(globalActives(i,0)))
1334 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1340 auto expr = Smp_der * gismo::expr::uv(m_component,3) *
meas(Gori);
1341 for (
index_t k = 0; k!=points.cols(); k++)
1343 tmp = ev.eval(expr,points.col(k));
1344 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1345 for (
index_t j = 0; j< space.dim(); ++j)
1347 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1348 for (
index_t i=0; i < globalActives.rows(); ++i)
1349 if (space.mapper().is_free_index(globalActives(i,0)))
1350 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1355 else if (m_goalFunction == GoalFunction::MembraneStrain)
1359 auto expr = 2 * Em_der * Em.tr() *
meas(Gori);
1360 for (
index_t k = 0; k!=points.cols(); k++)
1362 tmp = ev.eval(expr,points.col(k));
1363 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1364 for (
index_t j = 0; j< space.dim(); ++j)
1366 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1367 for (
index_t i=0; i < globalActives.rows(); ++i)
1368 if (space.mapper().is_free_index(globalActives(i,0)))
1369 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1375 auto expr = Em_der * gismo::expr::uv(m_component,3) *
meas(Gori);
1376 for (
index_t k = 0; k!=points.cols(); k++)
1378 tmp = ev.eval(expr,points.col(k));
1379 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1380 for (
index_t j = 0; j< space.dim(); ++j)
1382 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1383 for (
index_t i=0; i < globalActives.rows(); ++i)
1384 if (space.mapper().is_free_index(globalActives(i,0)))
1385 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1390 else if (m_goalFunction == GoalFunction::MembraneStress)
1394 auto expr = 2 * Sm_der * S0 *
meas(Gori);
1395 for (
index_t k = 0; k!=points.cols(); k++)
1397 tmp = ev.eval(expr,points.col(k));
1398 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1399 for (
index_t j = 0; j< space.dim(); ++j)
1401 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1402 for (
index_t i=0; i < globalActives.rows(); ++i)
1403 if (space.mapper().is_free_index(globalActives(i,0)))
1404 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1410 auto expr = Sm_der * gismo::expr::uv(m_component,3) *
meas(Gori);
1411 for (
index_t k = 0; k!=points.cols(); k++)
1413 tmp = ev.eval(expr,points.col(k));
1414 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1415 for (
index_t j = 0; j< space.dim(); ++j)
1417 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1418 for (
index_t i=0; i < globalActives.rows(); ++i)
1419 if (space.mapper().is_free_index(globalActives(i,0)))
1420 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1425 else if (m_goalFunction == GoalFunction::MembraneForce)
1429 auto expr = 2 * N_der * N *
meas(Gori);
1430 for (
index_t k = 0; k!=points.cols(); k++)
1432 tmp = ev.eval(expr,points.col(k));
1433 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1434 for (
index_t j = 0; j< space.dim(); ++j)
1436 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1437 for (
index_t i=0; i < globalActives.rows(); ++i)
1438 if (space.mapper().is_free_index(globalActives(i,0)))
1439 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1446 auto expr = N.tr() * gismo::expr::uv(m_component,3) *
meas(Gori);
1447 for (
index_t k = 0; k!=points.cols(); k++)
1449 tmp = ev.eval(expr,points.col(k));
1450 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1451 for (
index_t j = 0; j< space.dim(); ++j)
1453 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1454 for (
index_t i=0; i < globalActives.rows(); ++i)
1455 if (space.mapper().is_free_index(globalActives(i,0)))
1456 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1461 else if (m_goalFunction == GoalFunction::FlexuralStrain)
1465 auto expr = 2 * Ef_der * Ef.tr() *
meas(Gori);
1466 for (
index_t k = 0; k!=points.cols(); k++)
1468 tmp = ev.eval(expr,points.col(k));
1469 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1470 for (
index_t j = 0; j< space.dim(); ++j)
1472 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1473 for (
index_t i=0; i < globalActives.rows(); ++i)
1474 if (space.mapper().is_free_index(globalActives(i,0)))
1475 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1481 auto expr = Ef_der * gismo::expr::uv(m_component,3) *
meas(Gori);
1482 for (
index_t k = 0; k!=points.cols(); k++)
1484 tmp = ev.eval(expr,points.col(k));
1485 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1486 for (
index_t j = 0; j< space.dim(); ++j)
1488 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1489 for (
index_t i=0; i < globalActives.rows(); ++i)
1490 if (space.mapper().is_free_index(globalActives(i,0)))
1491 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1496 else if (m_goalFunction == GoalFunction::FlexuralStress)
1500 auto expr = 2 * Sf_der * S1 *
meas(Gori);
1501 for (
index_t k = 0; k!=points.cols(); k++)
1503 tmp = ev.eval(expr,points.col(k));
1504 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1505 for (
index_t j = 0; j< space.dim(); ++j)
1507 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1508 for (
index_t i=0; i < globalActives.rows(); ++i)
1509 if (space.mapper().is_free_index(globalActives(i,0)))
1510 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1516 auto expr = Sf_der * gismo::expr::uv(m_component,3) *
meas(Gori);
1517 for (
index_t k = 0; k!=points.cols(); k++)
1519 tmp = ev.eval(expr,points.col(k));
1520 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1521 for (
index_t j = 0; j< space.dim(); ++j)
1523 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1524 for (
index_t i=0; i < globalActives.rows(); ++i)
1525 if (space.mapper().is_free_index(globalActives(i,0)))
1526 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1531 else if (m_goalFunction == GoalFunction::FlexuralMoment)
1535 auto expr = 2 * M_der * M *
meas(Gori);
1536 for (
index_t k = 0; k!=points.cols(); k++)
1538 tmp = ev.eval(expr,points.col(k));
1539 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1540 for (
index_t j = 0; j< space.dim(); ++j)
1542 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1543 for (
index_t i=0; i < globalActives.rows(); ++i)
1544 if (space.mapper().is_free_index(globalActives(i,0)))
1545 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1552 auto expr = M_der * gismo::expr::uv(m_component,3) *
meas(Gori);
1553 for (
index_t k = 0; k!=points.cols(); k++)
1555 tmp = ev.eval(expr,points.col(k));
1556 exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1557 for (
index_t j = 0; j< space.dim(); ++j)
1559 space.mapper().localToGlobal(actives, pIndex, globalActives,j);
1560 for (
index_t i=0; i < globalActives.rows(); ++i)
1561 if (space.mapper().is_free_index(globalActives(i,0)))
1562 result.at(globalActives(i,0)) += tmp(i+j*actives.rows(),0);
1604 template <
short_t d,
class T,
bool bending>
1605 void gsThinShellAssemblerDWR<d, T, bending>::updateMultiPatchL(
const gsMatrix<T> & solVector, gsMultiPatch<T> & result)
1607 m_assemblerL->updateMultiPatch(solVector,result);
1610 template <
short_t d,
class T,
bool bending>
1611 void gsThinShellAssemblerDWR<d, T, bending>::updateMultiPatchH(
const gsMatrix<T> & solVector, gsMultiPatch<T> & result)
1613 m_assemblerH->updateMultiPatch(solVector,result);
1616 template <
short_t d,
class T,
bool bending>
1617 void gsThinShellAssemblerDWR<d, T, bending>::constructMultiPatchL(
const gsMatrix<T> & solVector, gsMultiPatch<T> & result)
1619 result = m_assemblerL->constructMultiPatch(solVector);
1622 template <
short_t d,
class T,
bool bending>
1623 void gsThinShellAssemblerDWR<d, T, bending>::constructMultiPatchH(
const gsMatrix<T> & solVector, gsMultiPatch<T> & result)
1625 result = m_assemblerH->constructMultiPatch(solVector);
1628 template <
short_t d,
class T,
bool bending>
1629 void gsThinShellAssemblerDWR<d, T, bending>::constructSolutionL(
const gsMatrix<T> & solVector, gsMultiPatch<T> & deformed)
1631 m_assemblerL->constructSolution(solVector,deformed);
1634 template <
short_t d,
class T,
bool bending>
1635 void gsThinShellAssemblerDWR<d, T, bending>::constructSolutionH(
const gsMatrix<T> & solVector, gsMultiPatch<T> & deformed)
1637 m_assemblerH->constructSolution(solVector,deformed);
1640 template <
short_t d,
class T,
bool bending>
1641 gsMultiPatch<T> gsThinShellAssemblerDWR<d, T, bending>::constructSolutionL(
const gsMatrix<T> & solVector)
1643 return m_assemblerL->constructSolution(solVector);
1646 template <
short_t d,
class T,
bool bending>
1647 gsMultiPatch<T> gsThinShellAssemblerDWR<d, T, bending>::constructSolutionH(
const gsMatrix<T> & solVector)
1649 return m_assemblerH->constructSolution(solVector);
1652 template <
short_t d,
class T,
bool bending>
1653 gsMultiPatch<T> gsThinShellAssemblerDWR<d, T, bending>::constructDisplacementL(
const gsMatrix<T> & solVector)
1655 return m_assemblerL->constructDisplacement(solVector);
1658 template <
short_t d,
class T,
bool bending>
1659 gsMultiPatch<T> gsThinShellAssemblerDWR<d, T, bending>::constructDisplacementH(
const gsMatrix<T> & solVector)
1661 return m_assemblerH->constructDisplacement(solVector);
1664 template <
short_t d,
class T,
bool bending>
1665 gsVector<T> gsThinShellAssemblerDWR<d, T, bending>::constructSolutionVectorL(
const gsMultiPatch<T> & deformed)
1667 return m_assemblerL->constructSolutionVector(deformed);
1670 template <
short_t d,
class T,
bool bending>
1671 gsVector<T> gsThinShellAssemblerDWR<d, T, bending>::constructSolutionVectorH(
const gsMultiPatch<T> & deformed)
1673 return m_assemblerH->constructSolutionVector(deformed);
1676 template <
short_t d,
class T,
bool bending>
1677 gsMatrix<T> gsThinShellAssemblerDWR<d, T, bending>::projectL2_L(
const gsFunction<T> &fun)
1679 return m_assemblerL->projectL2(fun);
1682 template <
short_t d,
class T,
bool bending>
1683 gsMatrix<T> gsThinShellAssemblerDWR<d, T, bending>::projectL2_H(
const gsFunction<T> &fun)
1685 return m_assemblerH->projectL2(fun);
1689 template <
short_t d,
class T,
bool bending>
1690 T gsThinShellAssemblerDWR<d, T, bending>::computeError(
const gsMultiPatch<T> & dualL,
const gsMultiPatch<T> & dualH,
bool withLoads,
1691 std::string filename,
unsigned np,
bool parametric,
bool mesh)
1693 computeError_impl<0>(dualL,dualH,withLoads,filename,np,parametric,mesh);
1697 template <
short_t d,
class T,
bool bending>
1698 std::vector<T> gsThinShellAssemblerDWR<d, T, bending>::computeErrorElements(
const gsMultiPatch<T> & dualL,
const gsMultiPatch<T> & dualH,
bool withLoads,
1699 std::string filename,
unsigned np,
bool parametric,
bool mesh)
1701 computeError_impl<1>(dualL,dualH,withLoads,filename,np,parametric,mesh);
1705 template <
short_t d,
class T,
bool bending>
1706 std::vector<T> gsThinShellAssemblerDWR<d, T, bending>::computeErrorDofs(
const gsMultiPatch<T> & dualL,
const gsMultiPatch<T> & dualH,
bool withLoads,
1707 std::string filename,
unsigned np,
bool parametric,
bool mesh)
1709 computeError_impl<2>(dualL,dualH,withLoads,filename,np,parametric,mesh);
1713 template <
short_t d,
class T,
bool bending>
1714 template <index_t _elWise>
1715 void gsThinShellAssemblerDWR<d, T, bending>::computeError_impl(
const gsMultiPatch<T> & dualL,
1716 const gsMultiPatch<T> & dualH,
1718 std::string filename,
1723 gsExprAssembler<T> exprAssembler = m_assemblerH->assembler();
1724 exprAssembler.cleanUp();
1725 GISMO_ENSURE(m_assemblerH->options().hasGroup(
"ExprAssembler"),
"The option list does not contain options with the label 'ExprAssembler'!");
1726 exprAssembler.setOptions(m_assemblerH->options().getGroup(
"ExprAssembler"));
1729 geometryMap Gori = exprAssembler.getMap(m_patches);
1731 auto F = exprAssembler.getCoeff(*m_forceFun, Gori);
1732 auto zsolL = exprAssembler.getCoeff(dualL);
1733 auto zsolH = exprAssembler.getCoeff(dualH);
1735 auto g_N = exprAssembler.getBdrFunction(Gori);
1737 auto expr = (zsolH-zsolL).tr() * F;
1738 auto bexpr= (zsolH-zsolL).tr() * g_N;
1740 gsExprEvaluator<T> ev(exprAssembler);
1742 T integral, bintegral;
1745 integral = ev.integral(expr *
meas(Gori));
1746 bintegral = ev.integralBdrBc( m_bcs.get(
"Neumann"), bexpr *
tv(Gori).norm());
1747 if (m_pLoads.numLoads()!=0 && withLoads)
1748 _applyLoadsToError(dualL,dualH,integral);
1750 m_error = integral+bintegral;
1752 else if (_elWise == 1)
1754 m_error = ev.integralElWise(expr *
meas(Gori));
1755 if (m_pLoads.numLoads()!=0 && withLoads)
1756 _applyLoadsToError(dualL,dualH,m_error);
1757 m_errors = ev.elementwise();
1758 if (m_pLoads.numLoads()!=0 && withLoads)
1759 _applyLoadsToElWiseError(dualL,dualH,m_errors);
1761 else if (_elWise == 2)
1768 if (!filename.empty())
1770 ev.options().setSwitch(
"plot.elements",mesh);
1771 ev.options().setInt(
"plot.npts",np);
1775 ev.writeParaview(expr,Gori,filename);
1779 template <
short_t d,
class T,
bool bending>
1780 T gsThinShellAssemblerDWR<d, T, bending>::computeError(
const gsMultiPatch<T> & dualL,
const gsMultiPatch<T> & dualH,
const gsMultiPatch<T> & deformed,
bool withLoads,
1781 std::string filename,
unsigned np,
bool parametric,
bool mesh)
1783 computeError_impl<d,bending,0>(dualL,dualH,deformed,withLoads,filename,np,parametric,mesh);
1787 template <
short_t d,
class T,
bool bending>
1788 std::vector<T> gsThinShellAssemblerDWR<d, T, bending>::computeErrorElements(
const gsMultiPatch<T> & dualL,
const gsMultiPatch<T> & dualH,
const gsMultiPatch<T> & deformed,
bool withLoads,
1789 std::string filename,
unsigned np,
bool parametric,
bool mesh)
1791 computeError_impl<d,bending,1>(dualL,dualH,deformed,withLoads,filename,np,parametric,mesh);
1795 template <
short_t d,
class T,
bool bending>
1796 std::vector<T> gsThinShellAssemblerDWR<d, T, bending>::computeErrorDofs(
const gsMultiPatch<T> & dualL,
const gsMultiPatch<T> & dualH,
const gsMultiPatch<T> & deformed,
bool withLoads,
1797 std::string filename,
unsigned np,
bool parametric,
bool mesh)
1799 computeError_impl<d,bending,2>(dualL,dualH,deformed,withLoads,filename,np,parametric,mesh);
1803 template <
short_t d,
class T,
bool bending>
1804 template<
short_t _d,
bool _bending, index_t _elWise>
1805 typename std::enable_if<(_d==3) && _bending, void>::type
1806 gsThinShellAssemblerDWR<d, T, bending>::computeError_impl(
const gsMultiPatch<T> & dualL,
const gsMultiPatch<T> & dualH,
const gsMultiPatch<T> & deformed,
bool withLoads,
1808 std::string filename,
unsigned np,
bool parametric,
bool mesh)
1811 gsExprAssembler<T> exprAssembler = m_assemblerH->assembler();
1812 exprAssembler.cleanUp();
1813 GISMO_ENSURE(m_assemblerH->options().hasGroup(
"ExprAssembler"),
"The option list does not contain options with the label 'ExprAssembler'!");
1814 exprAssembler.setOptions(m_assemblerH->options().getGroup(
"ExprAssembler"));
1817 geometryMap Gori = exprAssembler.getMap(m_patches);
1818 geometryMap Gdef = exprAssembler.getMap(deformed);
1820 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorN> S0f(m_assemblerH->materials(),&deformed);
1821 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorM> S1f(m_assemblerH->materials(),&deformed);
1822 auto S0 = exprAssembler.getCoeff(S0f);
1823 auto S1 = exprAssembler.getCoeff(S1f);
1825 gsFunctionExpr<T> mult2t(
"1",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"2",2);
1826 auto m2 = exprAssembler.getCoeff(mult2t);
1828 auto F = exprAssembler.getCoeff(*m_forceFun, Gori);
1829 auto zsolL = exprAssembler.getCoeff(dualL);
1830 auto zsolH = exprAssembler.getCoeff(dualH);
1833 Base::homogenizeDirichlet();
1837 auto Em_der =
flat(
jac(Gdef).tr() * (
jac(zsolH) -
jac(zsolL)) ) ;
1841 auto Ef_der = -( deriv2(zsolH,sn(Gdef).normalized().tr() )
1842 - deriv2(zsolL,sn(Gdef).normalized().tr() ) + deriv2(Gdef,var1(zsolH,Gdef) )
1843 - deriv2(Gdef,var1(zsolL,Gdef) ) ) *
reshape(m2,3,3);
1845 auto Fext = (zsolH-zsolL).tr() * F;
1846 auto Fint = ( N * Em_der.tr() + M * Ef_der.tr() );
1848 auto g_N = exprAssembler.getBdrFunction(Gori);
1850 auto expr = ( Fext - Fint );
1851 auto bexpr= (zsolH-zsolL).tr() * g_N;
1853 gsExprEvaluator<T> ev(exprAssembler);
1855 T integral, bintegral = 0;
1859 bintegral = ev.integralBdrBc( m_bcs.get(
"Neumann"), bexpr *
tv(Gori).norm());
1860 integral = ev.integral(expr *
meas(Gori));
1861 if (m_pLoads.numLoads()!=0 && withLoads)
1862 _applyLoadsToError(dualL,dualH,integral);
1864 m_error = integral+bintegral;
1866 else if (_elWise == 1)
1868 m_error = ev.integralElWise(expr *
meas(Gori));
1869 if (m_pLoads.numLoads()!=0 && withLoads)
1870 _applyLoadsToError(dualL,dualH,m_error);
1871 m_errors = ev.elementwise();
1872 if (m_pLoads.numLoads()!=0 && withLoads)
1873 _applyLoadsToElWiseError(dualL,dualH,m_errors);
1875 else if (_elWise == 2)
1897 if (!filename.empty())
1899 ev.options().setSwitch(
"plot.elements",mesh);
1900 ev.options().setInt(
"plot.npts",np);
1904 ev.writeParaview(expr,Gori,filename);
1908 template <
short_t d,
class T,
bool bending>
1909 template<
short_t _d,
bool _bending, index_t _elWise>
1910 typename std::enable_if<!(_d==3 && _bending), void>::type
1911 gsThinShellAssemblerDWR<d, T, bending>::computeError_impl(
const gsMultiPatch<T> & dualL,
1912 const gsMultiPatch<T> & dualH,
1913 const gsMultiPatch<T> & deformed,
1915 std::string filename,
1920 gsExprAssembler<T> exprAssembler = m_assemblerH->assembler();
1921 exprAssembler.cleanUp();
1922 GISMO_ENSURE(m_assemblerH->options().hasGroup(
"ExprAssembler"),
"The option list does not contain options with the label 'ExprAssembler'!");
1923 exprAssembler.setOptions(m_assemblerH->options().getGroup(
"ExprAssembler"));
1926 geometryMap Gori = exprAssembler.getMap(m_patches);
1927 geometryMap Gdef = exprAssembler.getMap(deformed);
1929 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorN> S0f(m_assemblerH->materials(),&deformed);
1930 auto S0 = exprAssembler.getCoeff(S0f);
1932 auto F = exprAssembler.getCoeff(*m_forceFun, Gori);
1934 auto zsolL = exprAssembler.getCoeff(dualL);
1935 auto zsolH = exprAssembler.getCoeff(dualH);
1940 auto Em_der =
flat(
jac(Gdef).tr() * (
jac(zsolH) -
jac(zsolL)) ) ;
1942 auto Fext = (zsolH-zsolL).tr() * F;
1943 auto Fint = ( N * Em_der.tr() );
1945 auto g_N = exprAssembler.getBdrFunction(Gori);
1947 auto expr = ( Fext - Fint );
1948 auto bexpr= (zsolH-zsolL).tr() * g_N;
1950 gsExprEvaluator<T> ev(exprAssembler);
1952 T integral, bintegral;
1955 bintegral = ev.integralBdrBc( m_bcs.get(
"Neumann"), bexpr *
tv(Gori).norm());
1956 integral = ev.integral(expr *
meas(Gori));
1957 m_error = bintegral+integral;
1958 if (m_pLoads.numLoads()!=0 && withLoads)
1959 _applyLoadsToError(dualL,dualH,m_error);
1961 else if (_elWise == 1)
1963 m_error = ev.integralElWise(expr *
meas(Gori));
1964 if (m_pLoads.numLoads()!=0 && withLoads)
1965 _applyLoadsToError(dualL,dualH,m_error);
1966 m_errors = ev.elementwise();
1967 if (m_pLoads.numLoads()!=0 && withLoads)
1968 _applyLoadsToElWiseError(dualL,dualH,m_errors);
1970 else if (_elWise == 2)
1991 if (!filename.empty())
1993 ev.options().setSwitch(
"plot.elements",mesh);
1994 ev.options().setInt(
"plot.npts",np);
1998 ev.writeParaview(expr,Gori,filename);
2002 template <
short_t d,
class T,
bool bending>
2003 T gsThinShellAssemblerDWR<d, T, bending>::computeSquaredError(
const gsMultiPatch<T> & dualL,
const gsMultiPatch<T> & dualH,
bool withLoads,
2004 std::string filename,
unsigned np,
bool parametric,
bool mesh)
2006 computeSquaredError_impl<0>(dualL,dualH,withLoads,filename,np,parametric,mesh);
2010 template <
short_t d,
class T,
bool bending>
2011 std::vector<T> gsThinShellAssemblerDWR<d, T, bending>::computeSquaredErrorElements(
const gsMultiPatch<T> & dualL,
const gsMultiPatch<T> & dualH,
bool withLoads,
2012 std::string filename,
unsigned np,
bool parametric,
bool mesh)
2014 computeSquaredError_impl<1>(dualL,dualH,withLoads,filename,np,parametric,mesh);
2018 template <
short_t d,
class T,
bool bending>
2019 std::vector<T> gsThinShellAssemblerDWR<d, T, bending>::computeSquaredErrorDofs(
const gsMultiPatch<T> & dualL,
const gsMultiPatch<T> & dualH,
bool withLoads,
2020 std::string filename,
unsigned np,
bool parametric,
bool mesh)
2022 computeSquaredError_impl<2>(dualL,dualH,withLoads,filename,np,parametric,mesh);
2026 template <
short_t d,
class T,
bool bending>
2027 template <index_t _elWise>
2028 void gsThinShellAssemblerDWR<d, T, bending>::computeSquaredError_impl(
const gsMultiPatch<T> & dualL,
2029 const gsMultiPatch<T> & dualH,
2031 std::string filename,
2036 gsExprAssembler<T> exprAssembler = m_assemblerH->assembler();
2037 exprAssembler.cleanUp();
2038 GISMO_ENSURE(m_assemblerH->options().hasGroup(
"ExprAssembler"),
"The option list does not contain options with the label 'ExprAssembler'!");
2039 exprAssembler.setOptions(m_assemblerH->options().getGroup(
"ExprAssembler"));
2042 geometryMap Gori = exprAssembler.getMap(m_patches);
2044 auto F = exprAssembler.getCoeff(*m_forceFun, Gori);
2045 auto zsolL = exprAssembler.getCoeff(dualL);
2046 auto zsolH = exprAssembler.getCoeff(dualH);
2048 auto g_N = exprAssembler.getBdrFunction(Gori);
2050 auto expr = ((zsolH-zsolL).tr() * F).sqNorm();
2051 auto bexpr= (zsolH-zsolL).tr() * g_N;
2053 gsExprEvaluator<T> ev(exprAssembler);
2055 T integral, bintegral;
2058 integral = ev.integral(expr *
meas(Gori));
2059 bintegral = ev.integralBdrBc( m_bcs.get(
"Neumann"), bexpr *
tv(Gori).norm());
2060 if (m_pLoads.numLoads()!=0 && withLoads)
2061 _applyLoadsToError(dualL,dualH,integral);
2063 m_error = integral+bintegral;
2065 else if (_elWise == 1)
2067 m_error = ev.integralElWise(expr *
meas(Gori));
2068 if (m_pLoads.numLoads()!=0 && withLoads)
2069 _applyLoadsToError(dualL,dualH,m_error);
2070 m_errors = ev.elementwise();
2071 if (m_pLoads.numLoads()!=0 && withLoads)
2072 _applyLoadsToElWiseError(dualL,dualH,m_errors);
2074 else if (_elWise == 2)
2081 if (!filename.empty())
2083 ev.options().setSwitch(
"plot.elements",mesh);
2084 ev.options().setInt(
"plot.npts",np);
2088 ev.writeParaview(expr,Gori,filename);
2092 template <
short_t d,
class T,
bool bending>
2093 T gsThinShellAssemblerDWR<d, T, bending>::computeSquaredError(
const gsMultiPatch<T> & dualL,
const gsMultiPatch<T> & dualH,
const gsMultiPatch<T> & deformed,
bool withLoads,
2094 std::string filename,
unsigned np,
bool parametric,
bool mesh)
2096 computeSquaredError_impl<d,bending,0>(dualL,dualH,deformed,withLoads,filename,np,parametric,mesh);
2100 template <
short_t d,
class T,
bool bending>
2101 std::vector<T> gsThinShellAssemblerDWR<d, T, bending>::computeSquaredErrorElements(
const gsMultiPatch<T> & dualL,
const gsMultiPatch<T> & dualH,
const gsMultiPatch<T> & deformed,
bool withLoads,
2102 std::string filename,
unsigned np,
bool parametric,
bool mesh)
2104 computeSquaredError_impl<d,bending,1>(dualL,dualH,deformed,withLoads,filename,np,parametric,mesh);
2108 template <
short_t d,
class T,
bool bending>
2109 std::vector<T> gsThinShellAssemblerDWR<d, T, bending>::computeSquaredErrorDofs(
const gsMultiPatch<T> & dualL,
const gsMultiPatch<T> & dualH,
const gsMultiPatch<T> & deformed,
bool withLoads,
2110 std::string filename,
unsigned np,
bool parametric,
bool mesh)
2112 computeSquaredError_impl<d,bending,2>(dualL,dualH,deformed,withLoads,filename,np,parametric,mesh);
2116 template <
short_t d,
class T,
bool bending>
2117 template<
short_t _d,
bool _bending, index_t _elWise>
2118 typename std::enable_if<(_d==3) && _bending, void>::type
2119 gsThinShellAssemblerDWR<d, T, bending>::computeSquaredError_impl(
const gsMultiPatch<T> & dualL,
const gsMultiPatch<T> & dualH,
const gsMultiPatch<T> & deformed,
bool withLoads,
2121 std::string filename,
unsigned np,
bool parametric,
bool mesh)
2124 gsExprAssembler<T> exprAssembler = m_assemblerH->assembler();
2125 exprAssembler.cleanUp();
2126 GISMO_ENSURE(m_assemblerH->options().hasGroup(
"ExprAssembler"),
"The option list does not contain options with the label 'ExprAssembler'!");
2127 exprAssembler.setOptions(m_assemblerH->options().getGroup(
"ExprAssembler"));
2130 geometryMap Gori = exprAssembler.getMap(m_patches);
2131 geometryMap Gdef = exprAssembler.getMap(deformed);
2133 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorN> S0f(m_assemblerH->materials(),&deformed);
2134 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorM> S1f(m_assemblerH->materials(),&deformed);
2135 auto S0 = exprAssembler.getCoeff(S0f);
2136 auto S1 = exprAssembler.getCoeff(S1f);
2138 gsFunctionExpr<T> mult2t(
"1",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"2",2);
2139 auto m2 = exprAssembler.getCoeff(mult2t);
2141 auto F = exprAssembler.getCoeff(*m_forceFun, Gori);
2142 auto zsolL = exprAssembler.getCoeff(dualL);
2143 auto zsolH = exprAssembler.getCoeff(dualH);
2146 Base::homogenizeDirichlet();
2150 auto Em_der =
flat(
jac(Gdef).tr() * (
jac(zsolH) -
jac(zsolL)) ) ;
2154 auto Ef_der = -( deriv2(zsolH,sn(Gdef).normalized().tr() )
2155 - deriv2(zsolL,sn(Gdef).normalized().tr() ) + deriv2(Gdef,var1(zsolH,Gdef) )
2156 - deriv2(Gdef,var1(zsolL,Gdef) ) ) *
reshape(m2,3,3);
2158 auto Fext = (zsolH-zsolL).tr() * F;
2159 auto Fint = ( N * Em_der.tr() + M * Ef_der.tr() );
2161 auto g_N = exprAssembler.getBdrFunction(Gori);
2163 auto expr = ( Fext - Fint ).sqNorm();
2164 auto bexpr= (zsolH-zsolL).tr() * g_N;
2166 gsExprEvaluator<T> ev(exprAssembler);
2168 T integral, bintegral;
2171 bintegral = ev.integralBdrBc( m_bcs.get(
"Neumann"), bexpr *
tv(Gori).norm());
2172 integral = ev.integral(expr *
meas(Gori));
2173 if (m_pLoads.numLoads()!=0 && withLoads)
2174 _applyLoadsToError(dualL,dualH,integral);
2176 m_error = integral+bintegral;
2178 else if (_elWise == 1)
2180 m_error = ev.integralElWise(expr *
meas(Gori));
2181 if (m_pLoads.numLoads()!=0 && withLoads)
2182 _applyLoadsToError(dualL,dualH,m_error);
2183 m_errors = ev.elementwise();
2184 if (m_pLoads.numLoads()!=0 && withLoads)
2185 _applyLoadsToElWiseError(dualL,dualH,m_errors);
2187 else if (_elWise == 2)
2209 if (!filename.empty())
2211 ev.options().setSwitch(
"plot.elements",mesh);
2212 ev.options().setInt(
"plot.npts",np);
2216 ev.writeParaview(expr,Gori,filename);
2220 template <
short_t d,
class T,
bool bending>
2221 template<
short_t _d,
bool _bending, index_t _elWise>
2222 typename std::enable_if<!(_d==3 && _bending), void>::type
2223 gsThinShellAssemblerDWR<d, T, bending>::computeSquaredError_impl(
const gsMultiPatch<T> & dualL,
2224 const gsMultiPatch<T> & dualH,
2225 const gsMultiPatch<T> & deformed,
2227 std::string filename,
2232 gsExprAssembler<T> exprAssembler = m_assemblerH->assembler();
2233 exprAssembler.cleanUp();
2234 GISMO_ENSURE(m_assemblerH->options().hasGroup(
"ExprAssembler"),
"The option list does not contain options with the label 'ExprAssembler'!");
2235 exprAssembler.setOptions(m_assemblerH->options().getGroup(
"ExprAssembler"));
2238 geometryMap Gori = exprAssembler.getMap(m_patches);
2239 geometryMap Gdef = exprAssembler.getMap(deformed);
2241 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorN> S0f(m_assemblerH->materials(),&deformed);
2242 auto S0 = exprAssembler.getCoeff(S0f);
2244 auto F = exprAssembler.getCoeff(*m_forceFun, Gori);
2246 auto zsolL = exprAssembler.getCoeff(dualL);
2247 auto zsolH = exprAssembler.getCoeff(dualH);
2252 auto Em_der =
flat(
jac(Gdef).tr() * (
jac(zsolH) -
jac(zsolL)) ) ;
2254 auto Fext = (zsolH-zsolL).tr() * F;
2255 auto Fint = ( N * Em_der.tr() );
2257 auto g_N = exprAssembler.getBdrFunction(Gori);
2259 auto expr = ( Fext - Fint ).sqNorm();
2260 auto bexpr= (zsolH-zsolL).tr() * g_N;
2262 gsExprEvaluator<T> ev(exprAssembler);
2264 T integral, bintegral;
2267 bintegral = ev.integralBdrBc( m_bcs.get(
"Neumann"), bexpr *
tv(Gori).norm());
2268 integral = ev.integral(expr *
meas(Gori));
2269 m_error = bintegral+integral;
2270 if (m_pLoads.numLoads()!=0 && withLoads)
2271 _applyLoadsToError(dualL,dualH,m_error);
2273 else if (_elWise == 1)
2275 m_error = ev.integralElWise(expr *
meas(Gori));
2276 if (m_pLoads.numLoads()!=0 && withLoads)
2277 _applyLoadsToError(dualL,dualH,m_error);
2278 m_errors = ev.elementwise();
2279 if (m_pLoads.numLoads()!=0 && withLoads)
2280 _applyLoadsToElWiseError(dualL,dualH,m_errors);
2282 else if (_elWise == 2)
2303 if (!filename.empty())
2305 ev.options().setSwitch(
"plot.elements",mesh);
2306 ev.options().setInt(
"plot.npts",np);
2310 ev.writeParaview(expr,Gori,filename);
2332 template <
short_t d,
class T,
bool bending>
2333 T gsThinShellAssemblerDWR<d, T, bending>::computeErrorEig(
const T evPrimalL,
2336 const gsMultiPatch<T> & dualL,
2337 const gsMultiPatch<T> & dualH,
2338 const gsMultiPatch<T> & primal,
2339 const gsMultiPatch<T> & deformed,
2340 std::string filename,
unsigned np,
bool parametric,
bool mesh)
2342 computeErrorEig_impl<0>(evPrimalL, evDualL, evDualH, dualL, dualH, primal, deformed,filename,np,parametric,mesh);
2346 template <
short_t d,
class T,
bool bending>
2347 std::vector<T> gsThinShellAssemblerDWR<d, T, bending>::computeErrorEigElements(
const T evPrimalL,
2350 const gsMultiPatch<T> & dualL,
2351 const gsMultiPatch<T> & dualH,
2352 const gsMultiPatch<T> & primal,
2353 const gsMultiPatch<T> & deformed,
2354 std::string filename,
unsigned np,
bool parametric,
bool mesh)
2356 computeErrorEig_impl<1>(evPrimalL, evDualL, evDualH, dualL, dualH, primal, deformed,filename,np,parametric,mesh);
2360 template <
short_t d,
class T,
bool bending>
2361 std::vector<T> gsThinShellAssemblerDWR<d, T, bending>::computeErrorEigDofs(
const T evPrimalL,
2364 const gsMultiPatch<T> & dualL,
2365 const gsMultiPatch<T> & dualH,
2366 const gsMultiPatch<T> & primal,
2367 const gsMultiPatch<T> & deformed,
2368 std::string filename,
unsigned np,
bool parametric,
bool mesh)
2370 computeErrorEig_impl<2>(evPrimalL, evDualL, evDualH, dualL, dualH, primal, deformed,filename,np,parametric,mesh);
2375 template <
short_t d,
class T,
bool bending>
2376 template <index_t _elWise>
2377 void gsThinShellAssemblerDWR<d, T, bending>::computeErrorEig_impl(
const T evPrimalL,
2380 const gsMultiPatch<T> & dualL,
2381 const gsMultiPatch<T> & dualH,
2382 const gsMultiPatch<T> & primal,
2383 const gsMultiPatch<T> & deformed,
2384 std::string filename,
2390 gsExprAssembler<T> exprAssembler = m_assemblerH->assembler();
2391 exprAssembler.cleanUp();
2392 GISMO_ENSURE(m_assemblerH->options().hasGroup(
"ExprAssembler"),
"The option list does not contain options with the label 'ExprAssembler'!");
2393 exprAssembler.setOptions(m_assemblerH->options().getGroup(
"ExprAssembler"));
2396 geometryMap Gori = exprAssembler.getMap(m_patches);
2397 geometryMap Gdef = exprAssembler.getMap(deformed);
2400 exprAssembler.initSystem();
2401 exprAssembler.initVector(1);
2403 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixA> mmAf_L(m_assemblerH->materials(),&m_patches);
2404 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixB> mmBf_L(m_assemblerH->materials(),&m_patches);
2405 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixC> mmCf_L(m_assemblerH->materials(),&m_patches);
2406 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixD> mmDf_L(m_assemblerH->materials(),&m_patches);
2407 auto mmA_L = exprAssembler.getCoeff(mmAf_L);
2408 auto mmB_L = exprAssembler.getCoeff(mmBf_L);
2409 auto mmC_L = exprAssembler.getCoeff(mmCf_L);
2410 auto mmD_L = exprAssembler.getCoeff(mmDf_L);
2412 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixA> mmAf_NL(m_assemblerH->materials(),&deformed);
2413 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixB> mmBf_NL(m_assemblerH->materials(),&deformed);
2414 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixC> mmCf_NL(m_assemblerH->materials(),&deformed);
2415 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixD> mmDf_NL(m_assemblerH->materials(),&deformed);
2416 auto mmA_NL = exprAssembler.getCoeff(mmAf_NL);
2417 auto mmB_NL = exprAssembler.getCoeff(mmBf_NL);
2418 auto mmC_NL = exprAssembler.getCoeff(mmCf_NL);
2419 auto mmD_NL = exprAssembler.getCoeff(mmDf_NL);
2421 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorN> S0f(m_assemblerH->materials(),&deformed);
2422 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorM> S1f(m_assemblerH->materials(),&deformed);
2424 auto S0 = exprAssembler.getCoeff(S0f);
2425 auto S1 = exprAssembler.getCoeff(S1f);
2428 gsFunctionExpr<T> mult2t(
"1",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"2",2);
2429 auto m2 = exprAssembler.getCoeff(mult2t);
2431 auto usol = exprAssembler.getCoeff(primal);
2432 auto zsolL = exprAssembler.getCoeff(dualL);
2433 auto zsolH = exprAssembler.getCoeff(dualH);
2463 auto Em_der_L =
flat(
jac(Gori).tr() * (
jac(usol ) ) ) ;
2464 auto Em_derd_L =
flat(
jac(Gori).tr() * (
jac(zsolH) -
jac(zsolL) ) ) ;
2467 auto Ef_der_L = -( deriv2(usol , sn(Gori).normalized().tr() ) - deriv2(Gori, var1(usol , Gori) ) ) *
reshape(m2, 3, 3);
2469 deriv2(zsolH, sn(Gori).normalized().tr() ) - deriv2(Gori, var1(zsolH, Gori) )
2470 -deriv2(zsolL, sn(Gori).normalized().tr() ) - deriv2(Gori, var1(zsolL, Gori) )
2473 auto N_der_L = Em_der_L *
reshape(mmA_L,3,3) + Ef_der_L *
reshape(mmB_L,3,3);
2474 auto M_der_L = Em_der_L *
reshape(mmC_L,3,3) + Ef_der_L *
reshape(mmD_L,3,3);
2476 auto N_derd_L = Em_derd_L *
reshape(mmA_L,3,3) + Ef_derd_L *
reshape(mmB_L,3,3);
2477 auto M_derd_L = Em_derd_L *
reshape(mmC_L,3,3) + Ef_derd_L *
reshape(mmD_L,3,3);
2479 auto Fint_L = ( N_derd_L * Em_derd_L.tr() + M_derd_L * Ef_derd_L.tr() );
2481 auto N_NL = S0.tr();
2482 auto Em_der_NL =
flat(
jac(Gdef).tr() * (
jac(usol ) ) ) ;
2483 auto Em_derd_NL =
flat(
jac(Gdef).tr() * (
jac(zsolH) -
jac(zsolL) ) ) ;
2485 auto Em_der2 =
flat(
jac(usol).tr() * (
jac(usol) ) ) * N_NL.tr();
2486 auto Emd_der2 =
flat(
jac(usol).tr() * (
jac(zsolH) -
jac(zsolL) ) ) * N_NL.tr();
2488 auto M_NL = S1.tr();
2489 auto Ef_der_NL = -( deriv2(usol , sn(Gdef).normalized().tr() ) - deriv2(Gdef, var1(usol , Gdef) ) ) *
reshape(m2, 3, 3);
2490 auto Ef_derd_NL = -(
2491 deriv2(zsolH, sn(Gdef).normalized().tr() ) - deriv2(Gdef, var1(zsolH, Gdef) )
2492 -deriv2(zsolL, sn(Gdef).normalized().tr() ) - deriv2(Gdef, var1(zsolL, Gdef) )
2496 ( ( deriv2(usol ) ) * ( var1(usol ,Gdef) ).tr() ).tr() *
reshape(m2, 3, 3)
2497 + ( ( deriv2(usol ) ) * ( var1(usol ,Gdef) ).tr() ).tr() *
reshape(m2, 3, 3)
2498 + ( deriv2(Gdef) * ( var2(usol ,usol ,Gdef) ) ).tr() *
reshape(m2, 3, 3)
2502 ( ( deriv2(usol ) ) * ( var1(zsolH,Gdef) - var1(zsolL,Gdef) ).tr() ).tr() *
reshape(m2, 3, 3)
2503 + ( ( deriv2(zsolH) - deriv2(zsolL) ) * ( var1(usol ,Gdef) ).tr() ).tr() *
reshape(m2, 3, 3)
2504 + ( deriv2(Gdef) * ( var2(usol ,zsolH,Gdef) - var2(usol ,zsolL,Gdef) ) ).tr() *
reshape(m2, 3, 3)
2508 auto N_der_NL = Em_der_NL *
reshape(mmA_NL,3,3) + Ef_der_NL *
reshape(mmB_NL,3,3);
2509 auto M_der_NL = Em_der_NL *
reshape(mmC_NL,3,3) + Ef_der_NL *
reshape(mmD_NL,3,3);
2511 auto N_derd_NL = Em_derd_NL *
reshape(mmA_NL,3,3) + Ef_derd_NL *
reshape(mmB_NL,3,3);
2512 auto M_derd_NL = Em_derd_NL *
reshape(mmC_NL,3,3) + Ef_derd_NL *
reshape(mmD_NL,3,3);
2514 auto K_L = ( N_der_L * Em_der_L.tr() + M_der_L * Ef_der_L.tr() );
2515 auto Kd_L = ( N_derd_L * Em_der_L.tr() + M_derd_L * Ef_der_L.tr() );
2516 auto K_NL = ( N_der_NL * Em_der_NL.tr() + M_der_NL * Ef_der_NL.tr() + Em_der2 + Ef_der2 );
2517 auto Kd_NL = ( N_derd_NL * Em_der_NL.tr() + M_derd_NL * Ef_der_NL.tr() + Emd_der2 + Efd_der2 );
2520 auto Bdiff = Kd_NL - Kd_L;
2521 auto Bprimal = K_NL - K_L ;
2523 auto expr = A - evPrimalL * Bdiff + (evDualH - evDualL) * Bprimal;
2525 gsExprEvaluator<T> ev(exprAssembler);
2528 m_error = ev.integral(expr *
meas(Gori)) - (evDualH - evDualL);
2530 else if (_elWise == 1)
2532 m_error = ev.integralElWise(expr *
meas(Gori)) - (evDualH - evDualL);
2533 m_errors = ev.elementwise();
2535 else if (_elWise == 2)
2542 if (!filename.empty())
2544 ev.options().setSwitch(
"plot.elements",mesh);
2545 ev.options().setInt(
"plot.npts",np);
2549 ev.writeParaview(expr,Gori,filename);
2589 template <
short_t d,
class T,
bool bending>
2590 T gsThinShellAssemblerDWR<d, T, bending>::computeErrorEig(
const T evPrimalL,
2593 const gsMultiPatch<T> & dualL,
2594 const gsMultiPatch<T> & dualH,
2595 const gsMultiPatch<T> & primal,
2596 std::string filename,
unsigned np,
bool parametric,
bool mesh)
2598 computeErrorEig_impl<0>(evPrimalL, evDualL, evDualH, dualL, dualH, primal,filename,np,parametric,mesh);
2602 template <
short_t d,
class T,
bool bending>
2603 std::vector<T> gsThinShellAssemblerDWR<d, T, bending>::computeErrorEigElements(
const T evPrimalL,
2606 const gsMultiPatch<T> & dualL,
2607 const gsMultiPatch<T> & dualH,
2608 const gsMultiPatch<T> & primal,
2609 std::string filename,
unsigned np,
bool parametric,
bool mesh)
2611 computeErrorEig_impl<1>(evPrimalL, evDualL, evDualH, dualL, dualH, primal,filename,np,parametric,mesh);
2615 template <
short_t d,
class T,
bool bending>
2616 std::vector<T> gsThinShellAssemblerDWR<d, T, bending>::computeErrorEigDofs(
const T evPrimalL,
2619 const gsMultiPatch<T> & dualL,
2620 const gsMultiPatch<T> & dualH,
2621 const gsMultiPatch<T> & primal,
2622 std::string filename,
unsigned np,
bool parametric,
bool mesh)
2624 computeErrorEig_impl<2>(evPrimalL, evDualL, evDualH, dualL, dualH, primal,filename,np,parametric,mesh);
2628 template <
short_t d,
class T,
bool bending>
2629 template <index_t _elWise>
2630 void gsThinShellAssemblerDWR<d, T, bending>::computeErrorEig_impl(
const T evPrimalL,
2633 const gsMultiPatch<T> & dualL,
2634 const gsMultiPatch<T> & dualH,
2635 const gsMultiPatch<T> & primal,
2636 std::string filename,
2642 gsExprAssembler<T> exprAssembler = m_assemblerH->assembler();
2643 exprAssembler.cleanUp();
2644 GISMO_ENSURE(m_assemblerH->options().hasGroup(
"ExprAssembler"),
"The option list does not contain options with the label 'ExprAssembler'!");
2645 exprAssembler.setOptions(m_assemblerH->options().getGroup(
"ExprAssembler"));
2647 gsMultiPatch<T> deformed = m_patches;
2648 for (
size_t k =0; k!=primal.nPatches(); ++k)
2649 deformed.patch(k).coefs() += primal.patch(k).coefs();
2652 geometryMap Gori = exprAssembler.getMap(m_patches);
2655 exprAssembler.initSystem();
2656 exprAssembler.initVector(1);
2658 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixA> mmAf(m_assemblerH->materials(),&m_patches);
2659 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixB> mmBf(m_assemblerH->materials(),&m_patches);
2660 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixC> mmCf(m_assemblerH->materials(),&m_patches);
2661 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixD> mmDf(m_assemblerH->materials(),&m_patches);
2662 auto mmA = exprAssembler.getCoeff(mmAf);
2663 auto mmB = exprAssembler.getCoeff(mmBf);
2664 auto mmC = exprAssembler.getCoeff(mmCf);
2665 auto mmD = exprAssembler.getCoeff(mmDf);
2667 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorN> S0f(m_assemblerH->materials(),&m_patches);
2668 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorM> S1f(m_assemblerH->materials(),&m_patches);
2669 gsMaterialMatrixIntegrate<T,MaterialOutput::Density> rhof(m_assemblerH->materials(),&m_patches);
2670 auto S0 = exprAssembler.getCoeff(S0f);
2671 auto S1 = exprAssembler.getCoeff(S1f);
2672 auto rho = exprAssembler.getCoeff(rhof);
2674 gsFunctionExpr<T> mult2t(
"1",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"2",2);
2675 auto m2 = exprAssembler.getCoeff(mult2t);
2677 auto usol = exprAssembler.getCoeff(primal);
2678 auto zsolL = exprAssembler.getCoeff(dualL);
2679 auto zsolH = exprAssembler.getCoeff(dualH);
2682 auto Em_derd=
flat(
jac(Gori).tr() * (
jac(zsolH) -
jac(zsolL)) ) ;
2683 auto Em_der =
flat(
jac(Gori).tr() * (
jac(usol) ) ) ;
2685 auto Em_derdw=
flat(
jac(Gori).tr() * (
jac(zsolH) -
jac(zsolL)) ) ;
2689 auto Ef_derd= -( deriv2(zsolH, sn(Gori).normalized().tr() )
2690 - deriv2(zsolL, sn(Gori).normalized().tr() ) + deriv2(Gori, var1(zsolH, Gori) )
2691 - deriv2(Gori, var1(zsolL, Gori) ) ) *
reshape(m2, 3, 3);
2692 auto Ef_der = -( deriv2(usol, sn(Gori).normalized().tr() ) + deriv2(Gori, var1(usol, Gori)) ) *
reshape(m2, 3, 3);
2694 auto N_der = Em_derd *
reshape(mmA,3,3) + Ef_derd *
reshape(mmB,3,3);
2695 auto M_der = Em_derd *
reshape(mmC,3,3) + Ef_derd *
reshape(mmD,3,3);
2697 auto Fint = ( N_der * Em_der.tr() + M_der * Ef_der.tr() );
2699 gsExprEvaluator<T> ev(exprAssembler);
2702 auto Bdiff = rho.val() * usol.tr() * (zsolH - zsolL);
2703 auto Bprimal= rho.val() * usol.tr() * usol;
2704 auto expr = A - evPrimalL * Bdiff + (evDualH - evDualL) * Bprimal;
2707 m_error = ev.integral(expr *
meas(Gori)) - (evDualH - evDualL);
2708 else if (_elWise == 1)
2710 m_error = ev.integralElWise(expr *
meas(Gori) ) - (evDualH - evDualL);
2711 m_errors = ev.elementwise();
2713 else if (_elWise == 2)
2718 if (!filename.empty())
2720 ev.options().setSwitch(
"plot.elements",mesh);
2721 ev.options().setInt(
"plot.npts",np);
2725 ev.writeParaview(expr,Gori,filename);
2730 template <
short_t d,
class T,
bool bending>
2731 T gsThinShellAssemblerDWR<d, T, bending>::computeGoal(
const gsMultiPatch<T> & deformed)
2736 gsExprAssembler<T> exprAssembler = m_assemblerH->assembler();
2737 exprAssembler.cleanUp();
2738 GISMO_ENSURE(m_assemblerH->options().hasGroup(
"ExprAssembler"),
"The option list does not contain options with the label 'ExprAssembler'!");
2739 exprAssembler.setOptions(m_assemblerH->options().getGroup(
"ExprAssembler"));
2742 exprAssembler.initSystem();
2743 exprAssembler.initVector(1);
2746 geometryMap Gori = exprAssembler.getMap(m_patches);
2747 geometryMap Gdef = exprAssembler.getMap(deformed);
2750 gsMaterialMatrixEval<T,MaterialOutput::StretchTransform> Tstretchf(m_assemblerH->materials(),&deformed,Z);
2751 auto Tstretch = exprAssembler.getCoeff(Tstretchf);
2754 gsMaterialMatrixEval<T,MaterialOutput::VectorN> S0f(m_assemblerH->materials(),&deformed,Z);
2755 gsMaterialMatrixEval<T,MaterialOutput::VectorM> S1f(m_assemblerH->materials(),&deformed,Z);
2756 auto S0 = exprAssembler.getCoeff(S0f);
2757 auto S1 = exprAssembler.getCoeff(S1f);
2760 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorN> Nf(m_assemblerH->materials(),&deformed);
2761 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorM> Mf(m_assemblerH->materials(),&deformed);
2762 auto N = exprAssembler.getCoeff(Nf);
2763 auto M = exprAssembler.getCoeff(Mf);
2777 gsMaterialMatrixEval<T,MaterialOutput::PStress> P0f(m_assemblerH->materials(),&deformed,Z);
2778 auto P0 = exprAssembler.getCoeff(P0f);
2781 gsFunctionExpr<T> mult2t(
"1",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"2",2);
2782 auto m2 = exprAssembler.getCoeff(mult2t);
2786 gsFunctionExpr<T> mult12t(
"1",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"0.5",2);
2787 auto m12 = exprAssembler.getCoeff(mult12t);
2792 auto lambda =
reshape(Tstretch,3,3) * Cm.tr();
2801 auto Ef = ( deriv2(Gori,sn(Gori).normalized().tr()) - deriv2(Gdef,sn(Gdef).normalized().tr()) ) *
reshape(m2,3,3) ;
2807 gsExprEvaluator<T> ev(exprAssembler);
2808 if (m_goalFunction == GoalFunction::Displacement)
2812 auto expr = (Gdef - Gori).tr() * (Gdef - Gori) *
meas(Gori);
2813 return ev.integral( expr );
2817 auto expr = (Gdef - Gori).tr() * gismo::expr::uv(m_component,3)*
meas(Gori);
2818 return ev.integral( expr );
2821 else if (m_goalFunction == GoalFunction::Stretch)
2832 auto expr = lambda.tr() * lambda *
meas(Gori);
2833 return ev.integral( expr );
2837 auto expr = lambda.tr() * gismo::expr::uv(m_component,3)*
meas(Gori);
2838 return ev.integral( expr );
2841 else if (m_goalFunction == GoalFunction::PStrain)
2845 auto expr = Emp * Emp.tr() *
meas(Gori);
2846 return ev.integral( expr );
2850 auto expr = Emp * gismo::expr::uv(m_component,3) *
meas(Gori);
2851 return ev.integral( expr );
2854 else if (m_goalFunction == GoalFunction::PStress)
2858 auto expr = P0.tr() * P0 *
meas(Gori);
2859 return ev.integral( expr );
2863 GISMO_ASSERT(m_component < 2,
"Can only select principle stress component 0 or 1, but "<<m_component<<
" selected.");
2864 auto expr = P0.tr() * gismo::expr::uv(m_component,2) *
meas(Gori);
2865 return ev.integral( expr );
2869 else if (m_goalFunction == GoalFunction::MembraneStrain)
2874 auto expr = Em.sqNorm() *
meas(Gori);
2875 return ev.integral( expr );
2879 auto expr = Em * gismo::expr::uv(m_component,3) *
meas(Gori);
2880 return ev.integral( expr );
2883 else if (m_goalFunction == GoalFunction::MembraneStress)
2887 auto expr = S0.tr() * S0 *
meas(Gori);
2888 return ev.integral( expr );
2892 auto expr = S0.tr() * gismo::expr::uv(m_component,3) *
meas(Gori);
2893 return ev.integral( expr );
2896 else if (m_goalFunction == GoalFunction::MembraneForce)
2900 auto expr = N.tr() * N *
meas(Gori);
2901 return ev.integral( expr );
2905 auto expr = N.tr() * gismo::expr::uv(m_component,3) *
meas(Gori);
2906 return ev.integral( expr );
2909 else if (m_goalFunction == GoalFunction::FlexuralStrain)
2913 auto expr = Ef * Ef.tr() *
meas(Gori);
2914 return ev.integral( expr );
2918 auto expr = Ef * gismo::expr::uv(m_component,3) *
meas(Gori);
2919 return ev.integral( expr );
2922 else if (m_goalFunction == GoalFunction::FlexuralStress)
2926 auto expr = S1.tr() * S1 *
meas(Gori);
2927 return ev.integral( expr );
2931 auto expr = S1.tr() * gismo::expr::uv(m_component,3) *
meas(Gori);
2932 return ev.integral( expr );
2935 else if (m_goalFunction == GoalFunction::FlexuralMoment)
2939 auto expr = M.tr() * M *
meas(Gori);
2940 return ev.integral( expr );
2944 auto expr = M.tr() * gismo::expr::uv(m_component,3) *
meas(Gori);
2945 return ev.integral( expr );
2952 template <
short_t d,
class T,
bool bending>
2953 T gsThinShellAssemblerDWR<d, T, bending>::computeGoal(
const bContainer & bnds,
const gsMultiPatch<T> & deformed)
2955 if (bnds.size()==0)
return 0;
2960 gsExprAssembler<T> exprAssembler = m_assemblerH->assembler();
2961 exprAssembler.cleanUp();
2962 GISMO_ENSURE(m_assemblerH->options().hasGroup(
"ExprAssembler"),
"The option list does not contain options with the label 'ExprAssembler'!");
2963 exprAssembler.setOptions(m_assemblerH->options().getGroup(
"ExprAssembler"));
2966 exprAssembler.initSystem();
2967 exprAssembler.initVector(1);
2970 geometryMap Gori = exprAssembler.getMap(m_patches);
2971 geometryMap Gdef = exprAssembler.getMap(deformed);
2974 gsMaterialMatrixEval<T,MaterialOutput::StretchTransform> Tstretchf(m_assemblerH->materials(),&deformed,Z);
2975 auto Tstretch = exprAssembler.getCoeff(Tstretchf);
2978 gsMaterialMatrixEval<T,MaterialOutput::VectorN> S0f(m_assemblerH->materials(),&deformed,Z);
2979 gsMaterialMatrixEval<T,MaterialOutput::VectorM> S1f(m_assemblerH->materials(),&deformed,Z);
2980 auto S0 = exprAssembler.getCoeff(S0f);
2981 auto S1 = exprAssembler.getCoeff(S1f);
2984 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorN> Nf(m_assemblerH->materials(),&deformed);
2985 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorM> Mf(m_assemblerH->materials(),&deformed);
2986 auto N = exprAssembler.getCoeff(Nf);
2987 auto M = exprAssembler.getCoeff(Mf);
3001 gsMaterialMatrixEval<T,MaterialOutput::PStress> P0f(m_assemblerH->materials(),&deformed,Z);
3002 auto P0 = exprAssembler.getCoeff(P0f);
3005 gsFunctionExpr<T> mult2t(
"1",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"2",2);
3006 auto m2 = exprAssembler.getCoeff(mult2t);
3010 gsFunctionExpr<T> mult12t(
"1",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"0.5",2);
3011 auto m12 = exprAssembler.getCoeff(mult12t);
3016 auto lambda =
reshape(Tstretch,3,3) * Cm.tr();
3025 auto Ef = ( deriv2(Gori,sn(Gori).normalized().tr()) - deriv2(Gdef,sn(Gdef).normalized().tr()) ) *
reshape(m2,3,3) ;
3031 gsExprEvaluator<T> ev(exprAssembler);
3032 if (m_goalFunction == GoalFunction::Displacement)
3036 auto expr = (Gdef - Gori).tr() * (Gdef - Gori) *
meas(Gori);
3037 return ev.integralBdr( expr,bnds );
3041 auto expr = (Gdef - Gori).tr() * gismo::expr::uv(m_component,3)*
meas(Gori);
3042 return ev.integralBdr( expr,bnds );
3045 else if (m_goalFunction == GoalFunction::Stretch)
3056 auto expr = lambda.tr() * lambda *
meas(Gori);
3057 return ev.integralBdr( expr,bnds );
3061 auto expr = lambda.tr() * gismo::expr::uv(m_component,3)*
meas(Gori);
3062 return ev.integralBdr( expr,bnds );
3065 else if (m_goalFunction == GoalFunction::PStrain)
3069 auto expr = Emp * Emp.tr() *
meas(Gori);
3070 return ev.integralBdr( expr,bnds );
3074 auto expr = Emp * gismo::expr::uv(m_component,3) *
meas(Gori);
3075 return ev.integralBdr( expr,bnds );
3078 else if (m_goalFunction == GoalFunction::PStress)
3082 auto expr = P0.tr() * P0 *
meas(Gori);
3083 return ev.integralBdr( expr,bnds );
3087 GISMO_ASSERT(m_component < 2,
"Can only select principle stress component 0 or 1, but "<<m_component<<
" selected.");
3088 auto expr = P0.tr() * gismo::expr::uv(m_component,2) *
meas(Gori);
3089 return ev.integralBdr( expr,bnds );
3092 else if (m_goalFunction == GoalFunction::MembraneStrain)
3097 auto expr = Em.sqNorm() *
meas(Gori);
3098 return ev.integralBdr( expr,bnds );
3102 auto expr = Em * gismo::expr::uv(m_component,3) *
meas(Gori);
3103 return ev.integralBdr( expr,bnds );
3106 else if (m_goalFunction == GoalFunction::MembraneStress)
3110 auto expr = S0.tr() * S0 *
meas(Gori);
3111 return ev.integralBdr( expr,bnds );
3115 auto expr = S0.tr() * gismo::expr::uv(m_component,3) *
meas(Gori);
3116 return ev.integralBdr( expr,bnds );
3119 else if (m_goalFunction == GoalFunction::MembraneForce)
3123 auto expr = N.tr() * N *
meas(Gori);
3124 return ev.integralBdr( expr,bnds );
3128 auto expr = N.tr() * gismo::expr::uv(m_component,3) *
meas(Gori);
3129 return ev.integralBdr( expr,bnds );
3132 else if (m_goalFunction == GoalFunction::FlexuralStrain)
3136 auto expr = Ef * Ef.tr() *
meas(Gori);
3137 return ev.integralBdr( expr,bnds );
3141 auto expr = Ef * gismo::expr::uv(m_component,3) *
meas(Gori);
3142 return ev.integralBdr( expr,bnds );
3145 else if (m_goalFunction == GoalFunction::FlexuralStress)
3149 auto expr = S1.tr() * S1 *
meas(Gori);
3150 return ev.integralBdr( expr,bnds );
3154 auto expr = S1.tr() * gismo::expr::uv(m_component,3) *
meas(Gori);
3155 return ev.integralBdr( expr,bnds );
3158 else if (m_goalFunction == GoalFunction::FlexuralMoment)
3162 auto expr = M.tr() * M *
meas(Gori);
3163 return ev.integralBdr( expr,bnds );
3167 auto expr = M.tr() * gismo::expr::uv(m_component,3) *
meas(Gori);
3168 return ev.integralBdr( expr,bnds );
3175 template <
short_t d,
class T,
bool bending>
3176 T gsThinShellAssemblerDWR<d, T, bending>::computeGoal(
const gsMatrix<T> & points,
const gsMultiPatch<T> & deformed)
3178 if (points.cols()==0)
return 0;
3183 gsExprAssembler<T> exprAssembler = m_assemblerH->assembler();
3184 exprAssembler.cleanUp();
3185 GISMO_ENSURE(m_assemblerH->options().hasGroup(
"ExprAssembler"),
"The option list does not contain options with the label 'ExprAssembler'!");
3186 exprAssembler.setOptions(m_assemblerH->options().getGroup(
"ExprAssembler"));
3190 exprAssembler.initSystem();
3191 exprAssembler.initVector(1);
3194 geometryMap Gori = exprAssembler.getMap(m_patches);
3195 geometryMap Gdef = exprAssembler.getMap(deformed);
3198 gsMaterialMatrixEval<T,MaterialOutput::StretchTransform> Tstretchf(m_assemblerH->materials(),&deformed,Z);
3199 auto Tstretch = exprAssembler.getCoeff(Tstretchf);
3203 gsMaterialMatrixEval<T,MaterialOutput::VectorN> S0f(m_assemblerH->materials(),&deformed,Z);
3204 gsMaterialMatrixEval<T,MaterialOutput::VectorM> S1f(m_assemblerH->materials(),&deformed,Z);
3205 auto S0 = exprAssembler.getCoeff(S0f);
3206 auto S1 = exprAssembler.getCoeff(S1f);
3209 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorN> Nf(m_assemblerH->materials(),&deformed);
3210 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorM> Mf(m_assemblerH->materials(),&deformed);
3211 auto N = exprAssembler.getCoeff(Nf);
3212 auto M = exprAssembler.getCoeff(Mf);
3215 gsMaterialMatrixEval<T,MaterialOutput::PStress> P0f(m_assemblerH->materials(),&deformed,Z);
3216 auto P0 = exprAssembler.getCoeff(P0f);
3219 gsFunctionExpr<T> mult2t(
"1",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"2",2);
3220 auto m2 = exprAssembler.getCoeff(mult2t);
3224 gsFunctionExpr<T> mult12t(
"1",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"0.5",2);
3225 auto m12 = exprAssembler.getCoeff(mult12t);
3230 auto lambda =
reshape(Tstretch,3,3).tr() * Cm.tr();
3239 auto Ef = ( deriv2(Gori,sn(Gori).normalized().tr()) - deriv2(Gdef,sn(Gdef).normalized().tr()) ) *
reshape(m2,3,3) ;
3244 gsExprEvaluator<T> ev(exprAssembler);
3247 if (m_goalFunction == GoalFunction::Displacement)
3251 auto expr = (Gdef - Gori).tr() * (Gdef - Gori) *
meas(Gori);
3252 for (
index_t k = 0; k!=points.cols(); k++)
3254 tmp = ev.eval( expr, points.col(k));
3255 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3262 auto expr = (Gdef - Gori).tr() * gismo::expr::uv(m_component,3)*
meas(Gori);
3263 for (
index_t k = 0; k!=points.cols(); k++)
3265 tmp = ev.eval( expr, points.col(k));
3266 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3272 else if (m_goalFunction == GoalFunction::Stretch)
3283 auto expr = lambda.tr() * lambda *
meas(Gori);
3284 for (
index_t k = 0; k!=points.cols(); k++)
3286 tmp = ev.eval( expr, points.col(k));
3287 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3294 auto expr = (Gdef - Gori).tr() * gismo::expr::uv(m_component,3)*
meas(Gori);
3295 for (
index_t k = 0; k!=points.cols(); k++)
3297 tmp = ev.eval( expr, points.col(k));
3298 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3304 else if (m_goalFunction == GoalFunction::PStrain)
3308 auto expr = Emp * Emp.tr() *
meas(Gori);
3309 for (
index_t k = 0; k!=points.cols(); k++)
3311 tmp = ev.eval( expr, points.col(k));
3312 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3319 auto expr = Emp * gismo::expr::uv(m_component,3) *
meas(Gori);
3320 for (
index_t k = 0; k!=points.cols(); k++)
3322 tmp = ev.eval( expr, points.col(k));
3323 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3329 else if (m_goalFunction == GoalFunction::PStress)
3333 auto expr = P0.tr() * P0 *
meas(Gori);
3334 for (
index_t k = 0; k!=points.cols(); k++)
3336 tmp = ev.eval( expr, points.col(k));
3337 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3344 GISMO_ASSERT(m_component < 2,
"Can only select principle stress component 0 or 1, but "<<m_component<<
" selected.");
3345 auto expr = P0.tr() * gismo::expr::uv(m_component,2) *
meas(Gori);
3346 for (
index_t k = 0; k!=points.cols(); k++)
3348 tmp = ev.eval( expr, points.col(k));
3349 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3355 else if (m_goalFunction == GoalFunction::MembraneStrain)
3359 auto expr = Em * Em.tr() *
meas(Gori);
3360 for (
index_t k = 0; k!=points.cols(); k++)
3362 tmp = ev.eval( expr, points.col(k));
3363 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3370 auto expr = Em * gismo::expr::uv(m_component,3) *
meas(Gori);
3371 for (
index_t k = 0; k!=points.cols(); k++)
3373 tmp = ev.eval( expr, points.col(k));
3374 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3380 else if (m_goalFunction == GoalFunction::MembraneStress)
3384 auto expr = S0.tr() * S0 *
meas(Gori);
3385 for (
index_t k = 0; k!=points.cols(); k++)
3387 tmp = ev.eval( expr, points.col(k));
3388 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3395 auto expr = S0.tr() * gismo::expr::uv(m_component,3) *
meas(Gori);
3396 for (
index_t k = 0; k!=points.cols(); k++)
3398 tmp = ev.eval( expr, points.col(k));
3399 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3405 else if (m_goalFunction == GoalFunction::MembraneForce)
3409 auto expr = N.tr() * N *
meas(Gori);
3410 for (
index_t k = 0; k!=points.cols(); k++)
3412 tmp = ev.eval( expr, points.col(k));
3413 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3420 auto expr = N.tr() * gismo::expr::uv(m_component,3) *
meas(Gori);
3421 for (
index_t k = 0; k!=points.cols(); k++)
3423 tmp = ev.eval( expr, points.col(k));
3424 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3430 else if (m_goalFunction == GoalFunction::FlexuralStrain)
3434 auto expr = Ef * Ef.tr() *
meas(Gori);
3435 for (
index_t k = 0; k!=points.cols(); k++)
3437 tmp = ev.eval( expr, points.col(k));
3438 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3445 auto expr = Ef * gismo::expr::uv(m_component,3) *
meas(Gori);
3446 for (
index_t k = 0; k!=points.cols(); k++)
3448 tmp = ev.eval( expr, points.col(k));
3449 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3455 else if (m_goalFunction == GoalFunction::FlexuralStress)
3459 auto expr = S1.tr() * S1 *
meas(Gori);
3460 for (
index_t k = 0; k!=points.cols(); k++)
3462 tmp = ev.eval( expr, points.col(k));
3463 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3470 auto expr = S1.tr() * gismo::expr::uv(m_component,3) *
meas(Gori);
3471 for (
index_t k = 0; k!=points.cols(); k++)
3473 tmp = ev.eval( expr, points.col(k));
3474 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3480 else if (m_goalFunction == GoalFunction::FlexuralMoment)
3484 auto expr = M.tr() * M *
meas(Gori);
3485 for (
index_t k = 0; k!=points.cols(); k++)
3487 tmp = ev.eval( expr, points.col(k));
3488 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3495 auto expr = M.tr() * gismo::expr::uv(m_component,3) *
meas(Gori);
3496 for (
index_t k = 0; k!=points.cols(); k++)
3498 tmp = ev.eval( expr, points.col(k));
3499 GISMO_ASSERT(tmp.cols()==tmp.rows() && tmp.cols()==1,
"Goal function must be scalar!");
3510 template <
short_t d,
class T,
bool bending>
3511 T gsThinShellAssemblerDWR<d, T, bending>::matrixNorm(
const gsMultiPatch<T> &primal,
const gsMultiPatch<T> &other)
const
3513 GISMO_ASSERT(m_goalFunction==GoalFunction::Modal,
"Only available for modal goal function");
3515 gsExprAssembler<T> exprAssembler = m_assemblerH->assembler();
3516 exprAssembler.cleanUp();
3517 GISMO_ENSURE(m_assemblerH->options().hasGroup(
"ExprAssembler"),
"The option list does not contain options with the label 'ExprAssembler'!");
3518 exprAssembler.setOptions(m_assemblerH->options().getGroup(
"ExprAssembler"));
3521 geometryMap Gori = exprAssembler.getMap(m_patches);
3524 exprAssembler.initSystem();
3525 exprAssembler.initVector(1);
3527 gsMaterialMatrixIntegrate<T,MaterialOutput::Density> rhof(m_assemblerH->materials(),&m_patches);
3528 auto rho = exprAssembler.getCoeff(rhof);
3530 auto usol = exprAssembler.getCoeff(primal);
3531 auto zsol = exprAssembler.getCoeff(other);
3533 gsExprEvaluator<T> ev(exprAssembler);
3534 return ev.integral(rho.val() * usol.tr() * zsol *
meas(Gori));
3537 template <
short_t d,
class T,
bool bending>
3538 T gsThinShellAssemblerDWR<d, T, bending>::matrixNorm(
const gsMultiPatch<T> &primal,
const gsMultiPatch<T> &other,
const gsMultiPatch<T> &deformed)
const
3540 GISMO_ASSERT(m_goalFunction==GoalFunction::Buckling,
"Only available for buckling goal function");
3541 gsExprAssembler<T> exprAssembler = m_assemblerH->assembler();
3542 exprAssembler.cleanUp();
3543 GISMO_ENSURE(m_assemblerH->options().hasGroup(
"ExprAssembler"),
"The option list does not contain options with the label 'ExprAssembler'!");
3544 exprAssembler.setOptions(m_assemblerH->options().getGroup(
"ExprAssembler"));
3546 gsMultiPatch<T> defpatches = deformed;
3549 geometryMap Gori = exprAssembler.getMap(m_patches);
3550 geometryMap Gdef = exprAssembler.getMap(defpatches);
3553 exprAssembler.initSystem();
3554 exprAssembler.initVector(1);
3556 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixA> mmAf_L(m_assemblerH->materials(),&m_patches);
3557 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixB> mmBf_L(m_assemblerH->materials(),&m_patches);
3558 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixC> mmCf_L(m_assemblerH->materials(),&m_patches);
3559 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixD> mmDf_L(m_assemblerH->materials(),&m_patches);
3560 auto mmA_L = exprAssembler.getCoeff(mmAf_L);
3561 auto mmB_L = exprAssembler.getCoeff(mmBf_L);
3562 auto mmC_L = exprAssembler.getCoeff(mmCf_L);
3563 auto mmD_L = exprAssembler.getCoeff(mmDf_L);
3565 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixA> mmAf_NL(m_assemblerH->materials(),&deformed);
3566 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixB> mmBf_NL(m_assemblerH->materials(),&deformed);
3567 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixC> mmCf_NL(m_assemblerH->materials(),&deformed);
3568 gsMaterialMatrixIntegrate<T,MaterialOutput::MatrixD> mmDf_NL(m_assemblerH->materials(),&deformed);
3569 auto mmA_NL = exprAssembler.getCoeff(mmAf_NL);
3570 auto mmB_NL = exprAssembler.getCoeff(mmBf_NL);
3571 auto mmC_NL = exprAssembler.getCoeff(mmCf_NL);
3572 auto mmD_NL = exprAssembler.getCoeff(mmDf_NL);
3574 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorN> S0f(m_assemblerH->materials(),&defpatches);
3575 gsMaterialMatrixIntegrate<T,MaterialOutput::VectorM> S1f(m_assemblerH->materials(),&defpatches);
3576 auto S0 = exprAssembler.getCoeff(S0f);
3577 auto S1 = exprAssembler.getCoeff(S1f);
3579 gsFunctionExpr<T> mult2t(
"1",
"0",
"0",
"0",
"1",
"0",
"0",
"0",
"2",2);
3580 auto m2 = exprAssembler.getCoeff(mult2t);
3582 auto usol = exprAssembler.getCoeff(primal);
3583 auto zsol = exprAssembler.getCoeff(other);
3585 auto Em_der_L =
flat(
jac(Gori).tr() * (
jac(usol ) ) ) ;
3586 auto Ef_der_L = -( deriv2(usol , sn(Gori).normalized().tr() ) - deriv2(Gori, var1(usol , Gori) ) ) *
reshape(m2, 3, 3);
3588 auto Em_derd_L =
flat(
jac(Gori).tr() * (
jac(zsol ) ) ) ;
3589 auto Ef_derd_L = -( deriv2(zsol , sn(Gori).normalized().tr() ) - deriv2(Gori, var1(zsol , Gori) ) ) *
reshape(m2, 3, 3);
3592 auto N_der_L = Em_derd_L *
reshape(mmA_L,3,3) + Ef_derd_L *
reshape(mmB_L,3,3);
3593 auto M_der_L = Em_derd_L *
reshape(mmC_L,3,3) + Ef_derd_L *
reshape(mmD_L,3,3);
3595 auto N_NL = S0.tr();
3596 auto Em_der_NL =
flat(
jac(Gdef).tr() * (
jac(usol ) ) ) ;
3597 auto Ef_der_NL = -( deriv2(usol , sn(Gdef).normalized().tr() ) - deriv2(Gdef, var1(usol , Gdef) ) ) *
reshape(m2, 3, 3);
3599 auto Em_derd_NL =
flat(
jac(Gdef).tr() * (
jac(zsol ) ) ) ;
3600 auto Ef_derd_NL = -( deriv2(zsol , sn(Gdef).normalized().tr() ) - deriv2(Gdef, var1(zsol , Gdef) ) ) *
reshape(m2, 3, 3);
3602 auto Em_der2 =
flat(
jac(usol).tr() * (
jac(zsol ) ) ) * N_NL.tr();
3604 auto M_NL = S1.tr();
3606 ( ( deriv2(zsol ) ) * ( var1(usol ,Gdef) ).tr() ).tr() *
reshape(m2, 3, 3)
3607 + ( ( deriv2(usol ) ) * ( var1(zsol ,Gdef) ).tr() ).tr() *
reshape(m2, 3, 3)
3608 + ( deriv2(Gdef) * ( var2(usol ,zsol ,Gdef) ) ).tr() *
reshape(m2, 3, 3)
3611 auto N_der_NL = Em_derd_NL *
reshape(mmA_NL,3,3) + Ef_derd_NL *
reshape(mmB_NL,3,3);
3612 auto M_der_NL = Em_derd_NL *
reshape(mmC_NL,3,3) + Ef_derd_NL *
reshape(mmD_NL,3,3);
3614 auto K_L = ( N_der_L * Em_der_L.tr() + M_der_L * Ef_der_L.tr() );
3615 auto K_NL = ( N_der_NL * Em_der_NL.tr() + M_der_NL * Ef_der_NL.tr() + Em_der2 + Ef_der2 );
3617 auto Bprimal = K_NL - K_L ;
3619 auto expr = ( Bprimal ) *
meas(Gori);
3621 gsExprEvaluator<T> ev(exprAssembler);
3622 T integral = ev.integral(expr);
3626 auto foundation = exprAssembler.getCoeff(*m_foundFun, Gori);
3627 GISMO_ASSERT(m_foundFun->targetDim()==3,
"Foundation function has dimension "<<m_foundFun->targetDim()<<
", but expected 3");
3629 integral += ev.integral( zsol * foundation.asDiag() * (Gdef - Gori) *
meas(Gori) );
3633 auto pressure = exprAssembler.getCoeff(*m_pressFun, Gori);
3634 GISMO_ASSERT(m_pressFun->targetDim()==1,
"Pressure function has dimension "<<m_pressFun->targetDim()<<
", but expected 1");
3636 integral += ev.integral( pressure.val() * zsol * sn(Gdef).normalized() *
meas(Gori) );
3642 template <
short_t d,
class T,
bool bending>
3643 void gsThinShellAssemblerDWR<d, T, bending>::_applyLoadsToElWiseError(
const gsMultiPatch<T> &dualL,
const gsMultiPatch<T> &dualH, std::vector<T> & errors)
const
3646 for (
size_t i = 0; i<m_pLoads.numLoads(); ++i )
3648 if (m_pLoads[i].value.size()!=d)
3649 gsWarn<<
"Point load has wrong dimension "<<m_pLoads[i].value.size()<<
" instead of "<<d<<
"\n";
3651 gsMatrix<T> forcePoint;
3652 if ( m_pLoads[i].parametric )
3653 forcePoint = m_pLoads[i].point;
3655 m_patches.patch(m_pLoads[i].patch).invertPoints(m_pLoads[i].point,forcePoint);
3657 std::vector<index_t> elements;
3659 #pragma omp parallel
3661 std::vector<index_t> elements_private;
3663 const int tid = omp_get_thread_num();
3664 const int nt = omp_get_num_threads();
3669 for (
unsigned patchInd=0; patchInd < m_assemblerH->getBasis().nBases(); ++patchInd)
3672 typename gsBasis<T>::domainIter domIt =
3673 m_assemblerH->getBasis().piece(patchInd).makeDomainIterator();
3676 c = patch_cnt + tid;
3677 patch_cnt += domIt->numElements();
3678 for ( domIt->next(tid); domIt->good(); domIt->next(nt) )
3680 for (; domIt->good(); domIt->next() )
3683 bool test = !(((((forcePoint - domIt->lowerCorner()).array() >= 0) &&
3684 (domIt->upperCorner() - forcePoint).array() >= 0) ).array() == 0).any();
3686 elements_private.push_back(c);
3693 #pragma omp critical
3694 elements.insert(elements.end(), elements_private.begin(), elements_private.end());
3699 gsMatrix<T> Lres, Hres;
3700 dualL.patch(m_pLoads[i].patch).eval_into(forcePoint,Lres);
3701 dualH.patch(m_pLoads[i].patch).eval_into(forcePoint,Hres);
3702 gsMatrix<T> result = (Hres-Lres).transpose() * m_pLoads[i].value;
3704 GISMO_ASSERT(result.rows()==result.cols() && result.rows()==1,
"Result must be scalar");
3705 for (
size_t k=0; k!=elements.size(); k++)
3706 errors.at(elements.at(k)) += result(0,0)/elements.size();
3710 template <
short_t d,
class T,
bool bending>
3711 void gsThinShellAssemblerDWR<d, T, bending>::_applyLoadsToError(
const gsMultiPatch<T> &dualL,
const gsMultiPatch<T> &dualH, T & error)
const
3714 for (
size_t i = 0; i< m_pLoads.numLoads(); ++i )
3716 if (m_pLoads[i].value.size()!=d)
3717 gsWarn<<
"Point load has wrong dimension "<<m_pLoads[i].value.size()<<
" instead of "<<d<<
"\n";
3719 gsMatrix<T> forcePoint;
3720 if ( m_pLoads[i].parametric )
3721 forcePoint = m_pLoads[i].point;
3723 m_patches.patch(m_pLoads[i].patch).invertPoints(m_pLoads[i].point,forcePoint);
3726 gsMatrix<T> Lres, Hres;
3727 dualL.patch(m_pLoads[i].patch).eval_into(forcePoint,Lres);
3728 dualH.patch(m_pLoads[i].patch).eval_into(forcePoint,Hres);
3729 gsMatrix<T> result = (Hres-Lres).transpose() * m_pLoads[i].value;
3731 error += result(0,0);
Provides an evaluator for material matrices for thin shells.
ThinShellAssemblerStatus
Definition: gsThinShellAssembler.h:53
Provides declaration of FunctionExpr class.
EIGEN_STRONG_INLINE tangent_expr< T > tv(const gsGeometryMap< T > &u)
The tangent boundary vector of a geometry map in 2D.
Definition: gsExpressions.h:4513
Assembly failed due to an error in the expression (e.g. overflow)
#define index_t
Definition: gsConfig.h:32
#define GISMO_ENSURE(cond, message)
Definition: gsDebug.h:102
Provides DWR assembly routines for the Kirchhoff-Love shell.
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
Generic expressions evaluator.
Provides an evaluator for material matrices for thin shells.
#define gsWarn
Definition: gsDebug.h:50
Provides hyperelastic material matrices.
EIGEN_STRONG_INLINE reshape_expr< E > const reshape(E const &u, index_t n, index_t m)
Reshape an expression.
Definition: gsExpressions.h:1925
EIGEN_STRONG_INLINE flat_expr< E > const flat(E const &u)
Make a matrix 2x2 expression "flat".
Definition: gsExpressions.h:2031
Provides a base class for material matrices.
#define GISMO_ERROR(message)
Definition: gsDebug.h:118
EIGEN_STRONG_INLINE meas_expr< T > meas(const gsGeometryMap< T > &G)
The measure of a geometry map.
Definition: gsExpressions.h:4555
EIGEN_STRONG_INLINE jac_expr< E > jac(const symbol_expr< E > &u)
The Jacobian matrix of a FE variable.
Definition: gsExpressions.h:4528