30gsALE<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)
44 bcInfo.addCondition(it->patch,it->side(),condition_type::dirichlet,0,d);
45 gsConstantFunction<T> rhs(gsVector<>::Zero(geometry.parDim()),geometry.parDim());
48 if (methodALE == ale_method::TINE || methodALE == ale_method::TINE_StVK || methodALE == ale_method::ILE || methodALE == ale_method::LE)
50 assembler =
typename gsBaseAssembler<T>::uPtr(
new gsElasticityAssembler<T>(geometry,basis,bcInfo,rhs));
51 if (methodALE == ale_method::TINE || methodALE == ale_method::TINE_StVK)
53 assembler->options().setSwitch(
"Check",
false);
54 solverNL =
typename gsIterative<T>::uPtr(
new gsIterative<T>(*assembler,
55 gsMatrix<>::Zero(assembler->numDofs(),1),
56 assembler->allFixedDofs()));
57 solverNL->options().setInt(
"Verbosity",solver_verbosity::none);
58 solverNL->options().setInt(
"Solver",linear_solver::LDLT);
60 if (methodALE == ale_method::TINE)
61 assembler->options().setInt(
"MaterialLaw",material_law::neo_hooke_ln);
62 if (methodALE == ale_method::TINE_StVK)
63 assembler->options().setInt(
"MaterialLaw",material_law::saint_venant_kirchhoff);
65 assembler->constructSolution(gsMatrix<T>::Zero(assembler->numDofs(),1),assembler->allFixedDofs(),ALEdisp);
67 else if (methodALE == ale_method::HE || methodALE == ale_method::IHE)
69 assembler =
typename gsBaseAssembler<T>::uPtr(
new gsElPoissonAssembler<T>(geometry,basis,bcInfo,rhs));
70 assembler->constructSolution(gsMatrix<T>::Zero(assembler->numDofs(),geometry.parDim()),assembler->allFixedDofs(),ALEdisp);
72 else if (methodALE == ale_method::BHE || methodALE == ale_method::IBHE)
74 gsBoundaryConditions<T> bcInfoBHE;
75 for (gsMultiPatch<>::const_biterator it = geometry.bBegin(); it != geometry.bEnd(); ++it)
76 bcInfoBHE.addCondition(it->patch,it->side(),condition_type::dirichlet,0);
77 assembler =
typename gsBaseAssembler<T>::uPtr(
new gsBiharmonicAssembler<T>(geometry,basis,bcInfoBHE,rhs));
78 assembler->constructSolution(gsMatrix<T>::Zero(assembler->numDofs(),geometry.parDim()),assembler->allFixedDofs(),ALEdisp);
81 for (
size_t p = 0; p < geometry.nPatches(); ++p)
83 ALEdisp.addPatch(geometry.patch(p).clone());
84 ALEdisp.patch(p).coefs() *= 0.;
89gsOptionList 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);
101void gsALE<T>::constructSolution(gsMultiPatch<T> & solution)
const
104 for (
size_t p = 0; p < ALEdisp.nPatches(); ++p)
105 solution.addPatch(ALEdisp.patch(p).clone());
109void gsALE<T>::initialize()
111 assembler->options().setReal(
"LocalStiff",m_options.getReal(
"LocalStiff"));
112 if (methodALE == ale_method::LE || methodALE == ale_method::ILE || methodALE == ale_method::TINE || methodALE == ale_method::TINE_StVK)
113 assembler->options().setReal(
"PoissonsRatio",m_options.getReal(
"PoissonsRatio"));
114 if (methodALE == ale_method::LE || methodALE == ale_method::HE || methodALE == ale_method::BHE)
115 assembler->assemble(
true);
116 if (methodALE == ale_method::TINE || methodALE == ale_method::TINE_StVK)
117 solverNL->options().setInt(
"MaxIters",m_options.getInt(
"NumIter"));
130 case ale_method::HE:
return linearMethod();
break;
131 case ale_method::IHE:
return linearIncrementalMethod();
break;
132 case ale_method::LE:
return linearMethod();
break;
133 case ale_method::ILE:
return linearIncrementalMethod();
break;
134 case ale_method::TINE:
return nonlinearMethod();
break;
135 case ale_method::TINE_StVK:
return nonlinearMethod();
break;
136 case ale_method::BHE:
return linearMethod();
break;
137 case ale_method::IBHE:
return linearIncrementalMethod();
break;
143index_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(),
150 methodALE == ale_method::LE ?
false : true);
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"))
169index_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(),
176 methodALE == ale_method::ILE ?
false : true);
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"))
201index_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"))
218void gsALE<T>::saveState()
220 if (methodALE == ale_method::TINE || methodALE == ale_method::TINE_StVK)
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;
229void gsALE<T>::recoverState()
232 if (methodALE == ale_method::TINE || methodALE == ale_method::TINE_StVK)
233 solverNL->recoverState();
234 if (methodALE == ale_method::IHE || methodALE == ale_method::ILE || methodALE == ale_method::IBHE)
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();
Implementation of mesh deformation method for partitioned FSI solver.
#define index_t
Definition gsConfig.h:32
Provides declaration of ConstantFunction class.
#define GISMO_ENSURE(cond, message)
Definition gsDebug.h:102
Provides stiffness matrix for Poisson's equations.
Provides linear and nonlinear elasticity systems for 2D plain strain and 3D continua.
Provides isogeometric meshing and modelling routines.
A class providing an iterative solver for nonlinear problems.
The G+Smo namespace, containing all definitions for the library.
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
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
Provides stiffness matrix for bi-harmonic equation in the mixed formulation.
method
Definition gsBaseUtils.h:29