21 #include <gsElasticity/gsBiharmonicAssembler.h>
30 gsALE<T>::gsALE(gsMultiPatch<T> & geometry,
const gsMultiPatch<T> & displacement,
33 m_interface(interfaceS2M),
35 m_options(defaultOptions()),
40 gsMultiBasis<T> basis(geometry);
41 gsBoundaryConditions<T> bcInfo;
42 for (gsMultiPatch<>::const_biterator it = geometry.bBegin(); it != geometry.bEnd(); ++it)
43 for (
index_t d = 0; d < geometry.parDim(); ++d)
45 gsConstantFunction<T> rhs(gsVector<>::Zero(geometry.parDim()),geometry.parDim());
50 assembler =
typename gsBaseAssembler<T>::uPtr(
new gsElasticityAssembler<T>(geometry,basis,bcInfo,rhs));
53 assembler->options().setSwitch(
"Check",
false);
54 solverNL =
typename gsIterative<T>::uPtr(
new gsIterative<T>(*
assembler,
57 solverNL->options().setInt(
"Verbosity",solver_verbosity::none);
69 assembler =
typename gsBaseAssembler<T>::uPtr(
new gsElPoissonAssembler<T>(geometry,basis,bcInfo,rhs));
74 gsBoundaryConditions<T> bcInfoBHE;
75 for (gsMultiPatch<>::const_biterator it = geometry.bBegin(); it != geometry.bEnd(); ++it)
77 assembler =
typename gsBaseAssembler<T>::uPtr(
new gsBiharmonicAssembler<T>(geometry,basis,bcInfoBHE,rhs));
81 for (
size_t p = 0; p < geometry.nPatches(); ++p)
83 ALEdisp.addPatch(geometry.patch(p).clone());
84 ALEdisp.patch(p).coefs() *= 0.;
89 gsOptionList gsALE<T>::defaultOptions()
92 opt.addReal(
"PoissonsRatio",
"Poisson's ratio of the material (only for elasticity-based methods)",0.4);
93 opt.addReal(
"LocalStiff",
"Stiffening degree for the Jacobian-based local stiffening",0.);
94 opt.addSwitch(
"Check",
"Check bijectivity of the resulting ALE displacement field",
true);
95 opt.addInt(
"NumIter",
"Number of iterations for nonlinear methods",1);
101 void gsALE<T>::constructSolution(gsMultiPatch<T> & solution)
const
104 for (
size_t p = 0; p < ALEdisp.nPatches(); ++p)
105 solution.addPatch(ALEdisp.patch(p).clone());
109 void gsALE<T>::initialize()
111 assembler->options().setReal(
"LocalStiff",m_options.getReal(
"LocalStiff"));
113 assembler->options().setReal(
"PoissonsRatio",m_options.getReal(
"PoissonsRatio"));
115 assembler->assemble(
true);
117 solverNL->options().setInt(
"MaxIters",m_options.getInt(
"NumIter"));
130 case ale_method::HE:
return linearMethod();
break;
143 index_t gsALE<T>::linearMethod()
146 for (
size_t i = 0; i < m_interface.sidesA.size(); ++i)
147 assembler->setFixedDofs(m_interface.sidesB[i].patch,
148 m_interface.sidesB[i].side(),
149 disp.patch(m_interface.sidesA[i].patch).boundary(m_interface.sidesA[i].side())->coefs(),
151 assembler->eliminateFixedDofs();
153 #ifdef GISMO_WITH_PARDISO
154 gsSparseSolver<>::PardisoLDLT solver(assembler->matrix());
155 gsMatrix<> solVector = solver.solve(assembler->rhs());
157 gsSparseSolver<>::SimplicialLDLT solver(assembler->matrix());
158 gsMatrix<> solVector = solver.solve(assembler->rhs());
161 assembler->constructSolution(solVector,assembler->allFixedDofs(),ALEdisp);
162 if (m_options.getSwitch(
"Check"))
169 index_t gsALE<T>::linearIncrementalMethod()
171 for (
size_t i = 0; i < m_interface.sidesA.size(); ++i)
172 assembler->setFixedDofs(m_interface.sidesB[i].patch,
173 m_interface.sidesB[i].side(),
174 disp.patch(m_interface.sidesA[i].patch).boundary(m_interface.sidesA[i].side())->coefs() -
175 ALEdisp.patch(m_interface.sidesB[i].patch).boundary(m_interface.sidesB[i].side())->coefs(),
177 assembler->assemble();
179 #ifdef GISMO_WITH_PARDISO
180 gsSparseSolver<>::PardisoLDLT solver(assembler->matrix());
181 gsMatrix<> solVector = solver.solve(assembler->rhs());
183 gsSparseSolver<>::SimplicialLDLT solver(assembler->matrix());
184 gsMatrix<> solVector = solver.solve(assembler->rhs());
187 gsMultiPatch<T> ALEupdate;
188 assembler->constructSolution(solVector,assembler->allFixedDofs(),ALEupdate);
189 for (
size_t p = 0; p < ALEupdate.nPatches(); ++p)
191 ALEdisp.patch(p).coefs() += ALEupdate.patch(p).coefs();
192 assembler->patches().patch(p).coefs() += ALEupdate.patch(p).coefs();
194 if (m_options.getSwitch(
"Check"))
201 index_t gsALE<T>::nonlinearMethod()
203 for (
size_t i = 0; i < m_interface.sidesA.size(); ++i)
204 assembler->setFixedDofs(m_interface.sidesB[i].patch,
205 m_interface.sidesB[i].side(),
206 disp.patch(m_interface.sidesA[i].patch).boundary(m_interface.sidesA[i].side())->coefs() -
207 ALEdisp.patch(m_interface.sidesB[i].patch).boundary(m_interface.sidesB[i].side())->coefs());
210 assembler->constructSolution(solverNL->solution(),solverNL->allFixedDofs(),ALEdisp);
211 if (m_options.getSwitch(
"Check"))
218 void gsALE<T>::saveState()
221 solverNL->saveState();
222 ALEdispSaved.clear();
223 for (
size_t p = 0; p < ALEdisp.nPatches(); ++p)
224 ALEdispSaved.addPatch(ALEdisp.patch(p).clone());
225 hasSavedState =
true;
229 void gsALE<T>::recoverState()
233 solverNL->recoverState();
235 for (
size_t p = 0; p < ALEdisp.nPatches(); ++p)
236 assembler->patches().patch(p).coefs() += ALEdispSaved.patch(p).coefs() - ALEdisp.patch(p).coefs();
237 for (
size_t p = 0; p < ALEdisp.nPatches(); ++p)
238 ALEdisp.patch(p).coefs() = ALEdispSaved.patch(p).coefs();
method
Definition: gsBaseUtils.h:28
Dirichlet type.
Definition: gsBoundaryConditions.h:31
Provides declaration of ConstantFunction class.
#define index_t
Definition: gsConfig.h:32
#define GISMO_ENSURE(cond, message)
Definition: gsDebug.h:102
sigma = 2*mu*eps + lambda*tr(eps)*I
Definition: gsBaseUtils.h:132
Provides isogeometric meshing and modelling routines.
tangential incremental nonlinear elasticity (with the St.Venant-Kirchhoff law)
Definition: gsBaseUtils.h:36
Implementation of mesh deformation method for partitioned FSI solver.
harmonic extension
Definition: gsBaseUtils.h:31
Provides linear and nonlinear elasticity systems for 2D plain strain and 3D continua.
incremental linear elasticity
Definition: gsBaseUtils.h:34
tangential incremental nonlinear elasticity (with the neo-Hookean law)
Definition: gsBaseUtils.h:35
incremental harmonic extension
Definition: gsBaseUtils.h:32
bi-harmonic extension
Definition: gsBaseUtils.h:37
index_t checkDisplacement(gsMultiPatch< T > const &domain, gsMultiPatch< T > const &displacement)
Checks whether the deformed configuration is bijective, i.e. det(Jac(geo+disp)) > 0; returns -1 if ye...
Definition: gsGeoUtils.hpp:245
LU decomposition: direct, no matrix requirements, robust but a bit slow, Eigen and Pardiso available...
Definition: gsBaseUtils.h:70
Provides stiffness matrix for Poisson's equations.
S = 2*mu*E + lambda*tr(E)*I.
Definition: gsBaseUtils.h:133
linear elasticity
Definition: gsBaseUtils.h:33
index_t checkGeometry(gsMultiPatch< T > const &domain)
Checks whether configuration is bijective, i.e. det(Jac(geo)) > 0; returns -1 if yes or the number of...
Definition: gsGeoUtils.hpp:200
A class providing an iterative solver for nonlinear problems.
gsBaseAssembler< T > & assembler
assembler object that generates the linear system
Definition: gsIterative.h:106