v0.14.0
Loading...
Searching...
No Matches
RunAdaptivity.hpp
Go to the documentation of this file.
1/** \file RunAdaptivity.hpp
2 * \ingroup solid_shell_prism_element
3 * \brief Implementation of solid shell prism element
4 *
5 */
6
7/*
8 * This file is part of MoFEM.
9 * MoFEM is free software: you can redistribute it and/or modify it under
10 * the terms of the GNU Lesser General Public License as published by the
11 * Free Software Foundation, either version 3 of the License, or (at your
12 * option) any later version.
13 *
14 * MoFEM is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17 * License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>. */
21
22#ifndef __RUNADAPTIVITY_HPP__
23#define __RUNADAPTIVITY_HPP__
24
25namespace SolidShellModule {
26
28
30 DM dM;
32
37
39
42 FEMethod &shell_lhs, FEMethod &shell_error,
43 FEMethod &dirichlet_bc, FEMethod &fix_ents)
44 : mField(m_field), dM(dm), commonData(common_data), shellLhs(shell_lhs),
45 shellError(shell_error), dirichletBc(dirichlet_bc), fixEnts(fix_ents),
47
49
50 vector<IS> isLevels;
51 vector<IS> mgLevels;
52 vector<Vec> solutionAtLevel;
53
54 KSP sOlver;
55 PC pC;
56
57 /**
58 * Multi grid pre-conditioner
59 */
61 vector<IS> &mgLevels;
62 AO aO;
63 ShellPCMGSetUpViaApproxOrdersCtx(DM dm, Mat a, vector<IS> &mg_levels)
64 : PCMGSetUpViaApproxOrdersCtx(dm, a, false), mgLevels(mg_levels) {}
65
66 PetscErrorCode createIsAtLevel(int kk, IS *is);
67
68 PetscErrorCode destroyIsAtLevel(int kk, IS *is);
69
70 PetscErrorCode getOptions();
71
72 PetscErrorCode buildProlongationOperator(PC pc, int verb = 0);
73 };
74
75 /**
76 * \brief Set order on entities
77 */
78 struct SetOrderToEntities : public FEMethod {
81
82 SetOrderToEntities(MoFEM::Interface &m_field, Tag th_order)
83 : mField(m_field), thOrder(th_order) {}
84
85 PetscErrorCode preProcess();
86
87 PetscErrorCode postProcess();
88
89 /**
90 * Set order on element tags
91 * @return error code
92 */
93 PetscErrorCode operator()();
94 };
95
96 /**
97 * \brief Set order of finite element
98 */
99 struct SetOrderToElement : public FEMethod {
102 int sEt, uP;
103 double eRror;
105 SetOrderToElement(MoFEM::Interface &m_field, Tag th_order, int set, int up,
106 double error, int max_order)
107 : mField(m_field), thOrder(th_order), sEt(set), uP(up), eRror(error),
108 maxOrder(max_order) {}
109
111
112 PetscErrorCode preProcess();
113
114 PetscErrorCode postProcess();
115
116 /**
117 * Set order on element tags
118 * @return error code
119 */
120 PetscErrorCode operator()();
121 };
122
123 /**
124 * \brief Set approximation order to entities
125 * @param set set value, if 0 not set
126 * @param up increase order by value
127 * @param error increase order base on error estimator
128 * @param max_order maximal allowed order
129 * @return error code
130 */
131 PetscErrorCode setOrder(int set, int up, double error, int max_order,
132 int verb = 0);
133
134 vector<int> vecOrderDofs;
135 PetscErrorCode createIS(IS *is);
136
137 PetscErrorCode runKsp(DM dm, Mat Aij, Vec F, Vec D);
138
139 PetscErrorCode runKspAtLevel(DM dm, Mat Aij, Vec F, Vec D, bool add_level);
140
141 double procentErrorMax; ///< max value at given precent
142
143 PetscErrorCode sortErrorVector(const double procent = 0.33);
144
145 /**
146 * \brief Solve linear problem with p-adaptivity
147 * @param Aij Matrix
148 * @param F The right hand side vector
149 * @param D Unknown vector
150 * @param nb_ref_cycles Nb. of refinement cycles. Default 2*(order-2)
151 * @param max_order maximal allowed order
152 * @param procent set precent of refined elements, def 33%
153 * @param verbose level maximal allowed order
154 * @return [description]
155 */
156 PetscErrorCode solveProblem(DM dm, Mat Aij, Vec F, Vec D, int nb_ref_cycles,
157 int max_order, double procent = 0.33,
158 int verb = 0);
159
160 /**
161 * \brief Set up operators for post-processing shell elements
162 * @return error code
163 */
164 PetscErrorCode setUpOperators();
165
166 /**
167 * \brief Save post-processed data
168 * @param name file name
169 * @return error code
170 */
171 PetscErrorCode postProcFatPrims(const string &name);
172
173 /**
174 * \brief Print displacements at selected points
175 *
176 * List of points for printing is in RESULTS block set
177 *
178 * @return error code
179 */
180 PetscErrorCode printDisplacements();
181};
182
183} // namespace SolidShellModule
184
185#endif // __RUNADAPTIVITY_HPP__
constexpr double a
@ F
double D
Deprecated interface functions.
Set data structures of MG pre-conditioner via approximation orders.
Postprocess on prism.
SetOrderToElement(MoFEM::Interface &m_field, Tag th_order, int set, int up, double error, int max_order)
SetOrderToEntities(MoFEM::Interface &m_field, Tag th_order)
PetscErrorCode getOptions()
get options from line command
PetscErrorCode createIsAtLevel(int kk, IS *is)
Set IS for levels.
PetscErrorCode destroyIsAtLevel(int kk, IS *is)
Destroy IS if internally created.
ShellPCMGSetUpViaApproxOrdersCtx(DM dm, Mat a, vector< IS > &mg_levels)
PetscErrorCode sortErrorVector(const double procent=0.33)
PetscErrorCode postProcFatPrims(const string &name)
Save post-processed data.
PetscErrorCode setOrder(int set, int up, double error, int max_order, int verb=0)
Set approximation order to entities.
PetscErrorCode printDisplacements()
Print displacements at selected points.
PetscErrorCode runKspAtLevel(DM dm, Mat Aij, Vec F, Vec D, bool add_level)
PetscErrorCode createIS(IS *is)
SolidShellPrismElement::CommonData & commonData
PostProcFatPrismOnRefinedMesh postProcFatPrism
double procentErrorMax
max value at given precent
PetscErrorCode setUpOperators()
Set up operators for post-processing shell elements.
RunAdaptivity(MoFEM::Interface &m_field, DM dm, SolidShellPrismElement::CommonData &common_data, FEMethod &shell_lhs, FEMethod &shell_error, FEMethod &dirichlet_bc, FEMethod &fix_ents)
PetscErrorCode runKsp(DM dm, Mat Aij, Vec F, Vec D)
PetscErrorCode solveProblem(DM dm, Mat Aij, Vec F, Vec D, int nb_ref_cycles, int max_order, double procent=0.33, int verb=0)
Solve linear problem with p-adaptivity.