28 #ifdef EXPERIMENTAL_PURPOSE_ONLY
31 void error_estimate_nitsche(
const mesh_im & mim,
40 scalar_type vertical_force,
47 const mesh &m = mf_u.linked_mesh();
51 std::vector<scalar_type> coeff1, coeff2;
52 base_matrix grad1(qdim, N), grad2(qdim, N), E(N, N), S1(N, N), S2(N, N);
53 base_matrix hess1(qdim, N*N);
57 base_small_vector up(N), jump(N), U1(N), sig(N), sigt(N);
59 scalar_type Pr, scal, sign, Un ;
60 scalar_type eta1 = 0, eta2 = 0, eta3 = 0, eta4 = 0;
61 scalar_type force_coeff= f_coeff;
66 base_small_vector F(N);
67 for (
unsigned ii=0; ii < N-1; ++ii) F[ii]=0;
68 F[N-1]=-vertical_force;
70 GMM_ASSERT1(!mf_u.is_reduced(),
"To be adapted");
72 for (dal::bv_visitor cv(m.convex_index()); !cv.finished(); ++cv) {
75 getfem::papprox_integration pai1 =
76 get_approx_im_or_fail(mim.int_method_of_element(cv));
78 scalar_type radius = m.convex_radius_estimate(cv);
79 m.points_of_convex(cv, G1);
80 coeff1.resize(mf_u.nb_basic_dof_of_element(cv));
81 gmm::copy(gmm::sub_vector(U, gmm::sub_index(mf_u.ind_basic_dof_of_element(cv))), coeff1);
86 for (
unsigned ii=0; ii < pai1->nb_points_on_convex(); ++ii) {
87 base_small_vector res(N);
88 ctx1.set_xref(pai1->point(ii));
89 pf1->interpolation_hess(ctx1, coeff1, hess1, dim_type(qdim));
93 res[i] += (lambda + mu) * hess1(j, i*N+j) + mu * hess1(i, j*N+j)+F[i];
104 for (
short_type f1=0; f1 < m.structure_of_convex(cv)->nb_faces(); ++f1) {
106 size_type cvn = m.neighbor_of_convex(cv, f1);
111 m.points_of_convex(cvn, G2);
112 coeff2.resize(mf_u.nb_basic_dof_of_element(cvn));
113 gmm::copy(gmm::sub_vector(U, gmm::sub_index(mf_u.ind_basic_dof_of_element(cvn))), coeff2);
115 gic.init(m.points_of_convex(cvn), pgt2);
116 for (
unsigned ii=0; ii < pai1->nb_points_on_face(f1); ++ii) {
118 ctx1.set_xref(pai1->point_on_face(f1, ii));
119 gmm::mult(ctx1.B(), pgt1->normals()[f1], up);
122 scalar_type coefficient = pai1->coeff_on_face(f1, ii) * ctx1.J() * norm;
123 pf1->interpolation_grad(ctx1, coeff1, grad1, dim_type(qdim));
128 gmm::scale(S1, lambda * trace);
131 gic.
invert(ctx1.xreal(), xref2, converged);
132 GMM_ASSERT1(converged,
"geometric transformation not well inverted ... !");
133 ctx2.set_xref(xref2);
134 pf2->interpolation_grad(ctx2, coeff2, grad2, dim_type(qdim));
139 gmm::scale(S2, lambda * trace);
165 getfem::papprox_integration pai1 =
166 get_approx_im_or_fail(mim.int_method_of_element(v.cv()));
168 scalar_type radius = m.convex_radius_estimate(v.cv());
170 m.points_of_convex(v.cv(), G1);
172 coeff1.resize(mf_u.nb_basic_dof_of_element(v.cv()));
173 gmm::copy(gmm::sub_vector(U, gmm::sub_index(mf_u.ind_basic_dof_of_element(v.cv()))), coeff1);
179 for (
unsigned ii=0; ii < pai1->nb_points_on_face(f); ++ii) {
181 ctx1.set_xref(pai1->point_on_face(f, ii));
182 gmm::mult(ctx1.B(), pgt1->normals()[f], up);
185 scalar_type coefficient = pai1->coeff_on_face(f, ii) * ctx1.J() * norm;
186 pf1->interpolation_grad(ctx1, coeff1, grad1, dim_type(qdim));
191 gmm::scale(S1, lambda * trace);
215 getfem::papprox_integration pai1 =
216 get_approx_im_or_fail(mim.int_method_of_element(v.cv()));
219 m.points_of_convex(v.cv(), G1);
221 coeff1.resize(mf_u.nb_basic_dof_of_element(v.cv()));
222 gmm::copy(gmm::sub_vector(U, gmm::sub_index(mf_u.ind_basic_dof_of_element(v.cv()))), coeff1);
231 scalar_type radius = m.convex_radius_estimate(v.cv());
232 scalar_type gamma=radius*gamma0;
234 for (
unsigned ii=0; ii < pai1->nb_points_on_face(f); ++ii) {
236 ctx1.set_xref(pai1->point_on_face(f, ii));
237 gmm::mult(ctx1.B(), pgt1->normals()[f], up);
240 scalar_type coefficient = pai1->coeff_on_face(f, ii) * ctx1.J() * norm;
241 pf1->interpolation_grad(ctx1, coeff1, grad1, dim_type(qdim));
242 pf1->interpolation(ctx1, coeff1, U1, dim_type(qdim));
247 gmm::scale(S1, lambda * trace);
252 scal = Un-gamma*sign;
256 Pr = (scal/gamma + sign);
257 ERR[v.cv()] += coefficient*radius*Pr*Pr;
258 eta4 += coefficient*radius* Pr*Pr;
261 gmm::scale(sigt, - sign);
275 cout <<
"eta1, eta2, eta3, eta4 = " << endl;
276 cout << sqrt(eta1) << endl;
277 cout << sqrt(eta2) << endl;
278 cout << sqrt(eta3) << endl;
279 cout << sqrt(eta4) << endl;
280 cout << sqrt(eta1+eta2+eta3+eta4) << endl;
does the inversion of the geometric transformation for a given convex
bool invert(const base_node &n, base_node &n_ref, scalar_type IN_EPS=1e-12, bool project_into_element=false)
given the node on the real element, returns the node on the reference element (even if it is outside ...
structure passed as the argument of fem interpolation functions.
"iterator" class for regions.
structure used to hold a set of convexes and/or convex faces.
Definition of a posteriori error estimates.
void mult_add(const L1 &l1, const L2 &l2, L3 &l3)
*/
void copy(const L1 &l1, L2 &l2)
*/
number_traits< typename linalg_traits< V >::value_type >::magnitude_type vect_norm2(const V &v)
Euclidean norm of a vector.
linalg_traits< M >::value_type mat_trace(const M &m)
Trace of a matrix.
number_traits< typename linalg_traits< V >::value_type >::magnitude_type vect_norm2_sqr(const V &v)
squared Euclidean norm of a vector.
void clear(L &l)
clear (fill with zeros) a vector or matrix.
void mult(const L1 &l1, const L2 &l2, L3 &l3)
*/
strongest_value_type< V1, V2 >::value_type vect_sp(const V1 &v1, const V2 &v2)
*/
void add(const L1 &l1, L2 &l2)
*/
std::shared_ptr< const getfem::virtual_fem > pfem
type of pointer on a fem description
gmm::uint16_type short_type
used as the common short type integer in the library
size_t size_type
used as the common size type in the library
std::shared_ptr< const bgeot::geometric_trans > pgeometric_trans
pointer type for a geometric transformation
GEneric Tool for Finite Element Methods.