24template <
short_t d,
typename T>
27 public ModelParameters {
49 gsBoundaryConditions<T>
bc_;
55 std::array<gsFunctionExpr<T>, 2 * d>
bcFunc_;
72 u.setup(
bc_, gismo::dirichlet::l2Projection, 0);
76 assembler_.assemble(igrad(u, G) * igrad(u, G).tr() * meas(G)
82 typename gismo::gsSparseSolver<T>::CGDiagonal solver;
85 gsMatrix<T> solutionVector;
87 solutionVector = solver.solve(
assembler_.rhs());
99 const std::array<int64_t, d> ncoeffs,
100 const std::array<int64_t, d> npatches)
106 Aopt.addInt(
"DirichletStrategy",
107 "Method for enforcement of Dirichlet BCs [11..14]", 11);
108 Aopt.addInt(
"DirichletValues",
109 "Method for computation of Dirichlet DoF values [100..103]",
111 Aopt.addInt(
"InterfaceStrategy",
112 "Method of treatment of patch interfaces [0..3]", 1);
114 "bdA",
"Estimated nonzeros per column of the matrix: bdA*deg + bdB", 2);
116 "bdB",
"Estimated nonzeros per column of the matrix: bdA*deg + bdB", 1);
119 "Overhead of sparse mem. allocation: (1+bdO)(bdA*deg + bdB) [0..1]",
121 Aopt.addReal(
"quA",
"Number of quadrature points: quA*deg + quB", 1);
122 Aopt.addInt(
"quB",
"Number of quadrature points: quA*deg + quB", 1);
123 Aopt.addInt(
"quRule",
"Quadrature rule [1:GaussLegendre, 2:GaussLobatto]",
133 for (
short_t i = 0; i < 2 * d; ++i) {
134 if constexpr (d == 1)
135 bcFunc_[i] = gismo::give(gsFunctionExpr<T>(
"sin(pi*x)", 1));
136 else if constexpr (d == 2)
137 bcFunc_[i] = gismo::give(gsFunctionExpr<T>(
"sin(pi*x)*sin(pi*y)", 2));
138 else if constexpr (d == 3)
140 gismo::give(gsFunctionExpr<T>(
"sin(pi*x)*sin(pi*y)*sin(pi*z)", 3));
141 else if constexpr (d == 4)
143 gsFunctionExpr<T>(
"sin(pi*x)*sin(pi*y)*sin(pi*z)*sin(pi*t)", 4));
145 bc_.addCondition(i + 1, gismo::condition_type::dirichlet, &
bcFunc_[i]);
160 return "GismoKLShell" + std::to_string(d) +
"d";
165 return "G+Smo Kirchhoff-Love Shell model in " + std::to_string(d) +
173 "description" : "Solution of the Kirchhoff-Love shell model",
180 if constexpr (d == 1)
183 "description" : "Boundary condition at the east boundary",
189 "description" : "Boundary condition at the west boundary",
195 "description" : "Right-hand side function",
200 else if constexpr (d == 2)
203 "description" : "Boundary condition at the north boundary",
209 "description" : "Boundary condition at the east boundary",
215 "description" : "Boundary condition at the south boundary",
221 "description" : "Boundary condition at the west boundary",
227 "description" : "Right-hand side function",
232 else if constexpr (d == 3)
235 "description" : "Boundary condition at the north boundary",
241 "description" : "Boundary condition at the east boundary",
247 "description" : "Boundary condition at the south boundary",
253 "description" : "Boundary condition at the west boundary",
259 "description" : "Boundary condition at the front boundary",
265 "description" : "Boundary condition at the back boundary",
271 "description" : "Right-hand side function",
276 else if constexpr (d == 4)
279 "description" : "Boundary condition at the north boundary",
285 "description" : "Boundary condition at the east boundary",
291 "description" : "Boundary condition at the south boundary",
297 "description" : "Boundary condition at the west boundary",
303 "description" : "Boundary condition at the front boundary",
309 "description" : "Boundary condition at the back boundary",
315 "description" : "Boundary condition at the start-time boundary",
321 "description" : "Boundary condition at the end-time boundary",
327 "description" : "Right-hand side function",
333 return R
"({ INVALID REQUEST })"_json;
338 const std::string &attribute,
339 const nlohmann::json &json)
override {
341 nlohmann::json result = R
"({})"_json;
343 if (attribute ==
"bc_north") {
344 if (!json.contains(
"data"))
346 if (!json[
"data"].contains(
"bc_north"))
349 bcFunc_[gismo::boundary::north] =
350 gsFunctionExpr<T>(json[
"data"][
"bc_north"].get<std::string>(), d);
353 else if (attribute ==
"bc_east") {
354 if (!json.contains(
"data"))
356 if (!json[
"data"].contains(
"bc_east"))
359 bcFunc_[gismo::boundary::east] =
360 gsFunctionExpr<T>(json[
"data"][
"bc_east"].get<std::string>(), d);
363 else if (attribute ==
"bc_south") {
364 if (!json.contains(
"data"))
366 if (!json[
"data"].contains(
"bc_south"))
369 bcFunc_[gismo::boundary::south] =
370 gsFunctionExpr<T>(json[
"data"][
"bc_south"].get<std::string>(), d);
373 else if (attribute ==
"bc_west") {
374 if (!json.contains(
"data"))
376 if (!json[
"data"].contains(
"bc_west"))
379 bcFunc_[gismo::boundary::west] =
380 gsFunctionExpr<T>(json[
"data"][
"bc_west"].get<std::string>(), d);
383 else if (attribute ==
"bc_front") {
384 if (!json.contains(
"data"))
386 if (!json[
"data"].contains(
"bc_front"))
389 bcFunc_[gismo::boundary::front] =
390 gsFunctionExpr<T>(json[
"data"][
"bc_front"].get<std::string>(), d);
393 else if (attribute ==
"bc_back") {
394 if (!json.contains(
"data"))
396 if (!json[
"data"].contains(
"bc_back"))
399 bcFunc_[gismo::boundary::back] =
400 gsFunctionExpr<T>(json[
"data"][
"bc_back"].get<std::string>(), d);
403 else if (attribute ==
"bc_stime") {
404 if (!json.contains(
"data"))
406 if (!json[
"data"].contains(
"bc_stime"))
409 bcFunc_[gismo::boundary::stime] =
410 gsFunctionExpr<T>(json[
"data"][
"bc_stime"].get<std::string>(), d);
413 else if (attribute ==
"bc_etime") {
414 if (!json.contains(
"data"))
416 if (!json[
"data"].contains(
"bc_etime"))
419 bcFunc_[gismo::boundary::etime] =
420 gsFunctionExpr<T>(json[
"data"][
"bc_etime"].get<std::string>(), d);
423 else if (attribute ==
"rhs") {
424 if (!json.contains(
"data"))
426 if (!json[
"data"].contains(
"rhs"))
429 rhsFunc_ = gsFunctionExpr<T>(json[
"data"][
"rhs"].get<std::string>(), d);
442 nlohmann::json
eval(
const std::string &component,
443 const nlohmann::json &json)
const override {
446 gsMatrix<T> ab =
Base::geo_.patch(0).support();
447 gsVector<T> a = ab.col(0);
448 gsVector<T> b = ab.col(1);
453 if (json.contains(
"data"))
454 if (json[
"data"].contains(
"resolution")) {
455 auto res = json[
"data"][
"resolution"].get<std::array<int64_t, d>>();
457 for (std::size_t i = 0; i < d; ++i)
462 gsMatrix<T> pts = gsPointGrid(a, b, np);
469 void refine(
const nlohmann::json &json = NULL)
override {
477 int num = 1, dim = -1;
479 if (json.contains(
"data")) {
480 if (json[
"data"].contains(
"num"))
481 num = json[
"data"][
"num"].get<
int>();
483 if (json[
"data"].contains(
"dim"))
484 dim = json[
"data"][
"dim"].get<int>();
488 basis_.basis(0).uniformRefine(num, 1, dim);
Model evaluator.
Definition model.hpp:98
virtual nlohmann::json updateAttribute(const std::string &patch, const std::string &component, const std::string &attribute, const nlohmann::json &json)
Updates the attributes of the model.
Definition model.hpp:297
virtual void refine(const nlohmann::json &json)=0
Refines model.
gismo::gsMultiPatch< T > geo_
Multi-patch geometry.
Definition GismoGeometryModel.hpp:39
G+Smo Kirchhoff-Love shell model.
Definition GismoKLShellModel.hpp:27
gsMultiBasis< T > basis_
Multi-patch basis.
Definition GismoKLShellModel.hpp:46
nlohmann::json getParameters() const override
Returns the model's parameters.
Definition GismoKLShellModel.hpp:178
gsMultiPatch< T > solution_
Solution.
Definition GismoKLShellModel.hpp:61
void solve()
Solve the Poisson problem.
Definition GismoKLShellModel.hpp:64
GismoKLShellModel(const std::array< short_t, d > degrees, const std::array< int64_t, d > ncoeffs, const std::array< int64_t, d > npatches)
Constructor for equidistant knot vectors.
Definition GismoKLShellModel.hpp:98
typename gsExprAssembler< T >::space space_type
Type of the function space.
Definition GismoKLShellModel.hpp:40
gsBoundaryConditions< T > bc_
Boundary conditions.
Definition GismoKLShellModel.hpp:49
typename gsExprAssembler< T >::geometryMap geometryMap_type
Type of the geometry mapping.
Definition GismoKLShellModel.hpp:34
typename gsExprAssembler< T >::variable variable_type
Type of the variable.
Definition GismoKLShellModel.hpp:37
nlohmann::json eval(const std::string &component, const nlohmann::json &json) const override
Evaluates the model.
Definition GismoKLShellModel.hpp:442
~GismoKLShellModel()
Destructor.
Definition GismoKLShellModel.hpp:156
gsFunctionExpr< T > rhsFunc_
Right-hand side values.
Definition GismoKLShellModel.hpp:52
typename gsExprAssembler< T >::solution solution_type
Type of the solution.
Definition GismoKLShellModel.hpp:43
gsExprAssembler< T > assembler_
Expression assembler.
Definition GismoKLShellModel.hpp:58
std::string getDescription() const override
Returns the model's description.
Definition GismoKLShellModel.hpp:164
nlohmann::json updateAttribute(const std::string &component, const std::string &attribute, const nlohmann::json &json) override
Updates the attributes of the model.
Definition GismoKLShellModel.hpp:337
nlohmann::json getOutputs() const override
Returns the model's outputs.
Definition GismoKLShellModel.hpp:170
std::array< gsFunctionExpr< T >, 2 *d > bcFunc_
Boundary values.
Definition GismoKLShellModel.hpp:55
void refine(const nlohmann::json &json=NULL) override
Refines the model.
Definition GismoKLShellModel.hpp:469
std::string getName() const override
Returns the model's name.
Definition GismoKLShellModel.hpp:159
GismoKLShellModel()=delete
Default constructor.
G+Smo PDE model.
Definition GismoPdeModel.hpp:58
auto to_json(const torch::TensorAccessor< T, N > &accessor)
Converts a torch::TensorAccessor object to a JSON object.
Definition serialize.hpp:41
Definition boundary.hpp:22
short int short_t
Definition core.hpp:74
InvalidModelAttribute exception.
Definition model.hpp:42