29 #ifdef EXPERIMENTAL_PURPOSE_ONLY
32 void error_estimate_nitsche(
const mesh_im & mim,
41 scalar_type vertical_force,
48 const mesh &m = mf_u.linked_mesh();
52 std::vector<scalar_type> coeff1, coeff2;
53 base_matrix grad1(qdim, N), grad2(qdim, N), E(N, N), S1(N, N), S2(N, N);
54 base_matrix hess1(qdim, N*N);
58 base_small_vector up(N), jump(N), U1(N), sig(N), sigt(N);
60 scalar_type Pr, scal, sign, Un ;
61 scalar_type eta1 = 0, eta2 = 0, eta3 = 0, eta4 = 0;
62 scalar_type force_coeff= f_coeff;
67 base_small_vector F(N);
68 for (
unsigned ii=0; ii < N-1; ++ii) F[ii]=0;
69 F[N-1]=-vertical_force;
71 GMM_ASSERT1(!mf_u.is_reduced(),
"To be adapted");
73 for (dal::bv_visitor cv(m.convex_index()); !cv.finished(); ++cv) {
76 getfem::papprox_integration pai1 =
77 get_approx_im_or_fail(mim.int_method_of_element(cv));
79 scalar_type radius = m.convex_radius_estimate(cv);
80 m.points_of_convex(cv, G1);
81 coeff1.resize(mf_u.nb_basic_dof_of_element(cv));
82 gmm::copy(gmm::sub_vector(U, gmm::sub_index(mf_u.ind_basic_dof_of_element(cv))), coeff1);
87 for (
unsigned ii=0; ii < pai1->nb_points_on_convex(); ++ii) {
88 base_small_vector res(N);
89 ctx1.set_xref(pai1->point(ii));
90 pf1->interpolation_hess(ctx1, coeff1, hess1, dim_type(qdim));
94 res[i] += (lambda + mu) * hess1(j, i*N+j) + mu * hess1(i, j*N+j)+F[i];
105 for (
short_type f1=0; f1 < m.structure_of_convex(cv)->nb_faces(); ++f1) {
107 size_type cvn = m.neighbor_of_convex(cv, f1);
112 m.points_of_convex(cvn, G2);
113 coeff2.resize(mf_u.nb_basic_dof_of_element(cvn));
114 gmm::copy(gmm::sub_vector(U, gmm::sub_index(mf_u.ind_basic_dof_of_element(cvn))), coeff2);
116 gic.init(m.points_of_convex(cvn), pgt2);
117 for (
unsigned ii=0; ii < pai1->nb_points_on_face(f1); ++ii) {
119 ctx1.set_xref(pai1->point_on_face(f1, ii));
120 gmm::mult(ctx1.B(), pgt1->normals()[f1], up);
123 scalar_type coefficient = pai1->coeff_on_face(f1, ii) * ctx1.J() * norm;
124 pf1->interpolation_grad(ctx1, coeff1, grad1, dim_type(qdim));
125 gmm::copy(grad1, E); gmm::add(gmm::transposed(grad1), E);
128 gmm::copy(gmm::identity_matrix(), S1);
129 gmm::scale(S1, lambda * trace);
130 gmm::add(gmm::scaled(E, 2*mu), S1);
132 gic.
invert(ctx1.xreal(), xref2, converged);
133 GMM_ASSERT1(converged,
"geometric transformation not well inverted ... !");
134 ctx2.set_xref(xref2);
135 pf2->interpolation_grad(ctx2, coeff2, grad2, dim_type(qdim));
136 gmm::copy(grad2, E); gmm::add(gmm::transposed(grad2), E);
139 gmm::copy(gmm::identity_matrix(), S2);
140 gmm::scale(S2, lambda * trace);
141 gmm::add(gmm::scaled(E, 2*mu), S2);
142 gmm::mult(S1, up, jump);
166 getfem::papprox_integration pai1 =
167 get_approx_im_or_fail(mim.int_method_of_element(v.cv()));
169 scalar_type radius = m.convex_radius_estimate(v.cv());
171 m.points_of_convex(v.cv(), G1);
173 coeff1.resize(mf_u.nb_basic_dof_of_element(v.cv()));
174 gmm::copy(gmm::sub_vector(U, gmm::sub_index(mf_u.ind_basic_dof_of_element(v.cv()))), coeff1);
180 for (
unsigned ii=0; ii < pai1->nb_points_on_face(f); ++ii) {
182 ctx1.set_xref(pai1->point_on_face(f, ii));
183 gmm::mult(ctx1.B(), pgt1->normals()[f], up);
186 scalar_type coefficient = pai1->coeff_on_face(f, ii) * ctx1.J() * norm;
187 pf1->interpolation_grad(ctx1, coeff1, grad1, dim_type(qdim));
188 gmm::copy(grad1, E); gmm::add(gmm::transposed(grad1), E);
191 gmm::copy(gmm::identity_matrix(), S1);
192 gmm::scale(S1, lambda * trace);
193 gmm::add(gmm::scaled(E, 2*mu), S1);
194 gmm::mult(S1, up, jump);
216 getfem::papprox_integration pai1 =
217 get_approx_im_or_fail(mim.int_method_of_element(v.cv()));
220 m.points_of_convex(v.cv(), G1);
222 coeff1.resize(mf_u.nb_basic_dof_of_element(v.cv()));
223 gmm::copy(gmm::sub_vector(U, gmm::sub_index(mf_u.ind_basic_dof_of_element(v.cv()))), coeff1);
232 scalar_type radius = m.convex_radius_estimate(v.cv());
233 scalar_type gamma=radius*gamma0;
235 for (
unsigned ii=0; ii < pai1->nb_points_on_face(f); ++ii) {
237 ctx1.set_xref(pai1->point_on_face(f, ii));
238 gmm::mult(ctx1.B(), pgt1->normals()[f], up);
241 scalar_type coefficient = pai1->coeff_on_face(f, ii) * ctx1.J() * norm;
242 pf1->interpolation_grad(ctx1, coeff1, grad1, dim_type(qdim));
243 pf1->interpolation(ctx1, coeff1, U1, dim_type(qdim));
244 gmm::copy(grad1, E); gmm::add(gmm::transposed(grad1), E);
247 gmm::copy(gmm::identity_matrix(), S1);
248 gmm::scale(S1, lambda * trace);
249 gmm::add(gmm::scaled(E, 2*mu), S1);
250 gmm::mult(S1, up, sig);
251 sign = gmm::vect_sp(sig,up);
252 Un = gmm::vect_sp(U1,up);
253 scal = Un-gamma*sign;
257 Pr = (scal/gamma + sign);
258 ERR[v.cv()] += coefficient*radius*Pr*Pr;
259 eta4 += coefficient*radius* Pr*Pr;
262 gmm::scale(sigt, - sign);
276 cout <<
"eta1, eta2, eta3, eta4 = " << endl;
277 cout << sqrt(eta1) << endl;
278 cout << sqrt(eta2) << endl;
279 cout << sqrt(eta3) << endl;
280 cout << sqrt(eta4) << endl;
281 cout << sqrt(eta1+eta2+eta3+eta4) << endl;