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)
    70       F[N-1]=-vertical_force; 
    72     GMM_ASSERT1(!mf_u.is_reduced(), 
"To be adapted");
    74     for (dal::bv_visitor cv(m.convex_index()); !cv.finished(); ++cv) {
    77       getfem::papprox_integration pai1 = 
    78       get_approx_im_or_fail(mim.int_method_of_element(cv));
    80       scalar_type radius = m.convex_radius_estimate(cv);
    81       m.points_of_convex(cv, G1);
    82       coeff1.resize(mf_u.nb_basic_dof_of_element(cv));
    83       gmm::copy(gmm::sub_vector(U, gmm::sub_index(mf_u.ind_basic_dof_of_element(cv))), coeff1);
    88       for (
unsigned ii=0; ii < pai1->nb_points_on_convex(); ++ii) {
    89         base_small_vector res(N); 
    90         ctx1.set_xref(pai1->point(ii));
    91         pf1->interpolation_hess(ctx1, coeff1, hess1, dim_type(qdim));
    95             res[i] += (lambda + mu) * hess1(j, i*N+j) + mu * hess1(i, j*N+j)+F[i];
   106         for (
short_type f1=0; f1 < m.structure_of_convex(cv)->nb_faces(); ++f1) {
   108         size_type cvn = m.neighbour_of_convex(cv, f1);
   113         m.points_of_convex(cvn, G2);
   114         coeff2.resize(mf_u.nb_basic_dof_of_element(cvn));
   115         gmm::copy(gmm::sub_vector(U, gmm::sub_index(mf_u.ind_basic_dof_of_element(cvn))), coeff2);
   117         gic.init(m.points_of_convex(cvn), pgt2);
   118         for (
unsigned ii=0; ii < pai1->nb_points_on_face(f1); ++ii) {
   120           ctx1.set_xref(pai1->point_on_face(f1, ii));
   121           gmm::mult(ctx1.B(), pgt1->normals()[f1], up);
   124           scalar_type coefficient = pai1->coeff_on_face(f1, ii) * ctx1.J() * norm; 
   125           pf1->interpolation_grad(ctx1, coeff1, grad1, dim_type(qdim));
   126           gmm::copy(grad1, E); gmm::add(gmm::transposed(grad1), E);
   129           gmm::copy(gmm::identity_matrix(), S1);
   130           gmm::scale(S1, lambda * trace);
   131           gmm::add(gmm::scaled(E, 2*mu), S1);
   133           gic.
invert(ctx1.xreal(), xref2, converged);
   134           GMM_ASSERT1(converged, 
"geometric transformation not well inverted ... !");
   135           ctx2.set_xref(xref2);
   136           pf2->interpolation_grad(ctx2, coeff2, grad2, dim_type(qdim));
   137           gmm::copy(grad2, E); gmm::add(gmm::transposed(grad2), E);
   140           gmm::copy(gmm::identity_matrix(), S2);
   141           gmm::scale(S2, lambda * trace);
   142           gmm::add(gmm::scaled(E, 2*mu), S2);
   143           gmm::mult(S1, up, jump);
   167         getfem::papprox_integration pai1 = 
   168         get_approx_im_or_fail(mim.int_method_of_element(v.cv()));
   170         scalar_type radius = m.convex_radius_estimate(v.cv());
   172         m.points_of_convex(v.cv(), G1);
   174         coeff1.resize(mf_u.nb_basic_dof_of_element(v.cv()));
   175         gmm::copy(gmm::sub_vector(U, gmm::sub_index(mf_u.ind_basic_dof_of_element(v.cv()))), coeff1);
   181         for (
unsigned ii=0; ii < pai1->nb_points_on_face(f); ++ii) {
   183           ctx1.set_xref(pai1->point_on_face(f, ii));
   184           gmm::mult(ctx1.B(), pgt1->normals()[f], up);
   187           scalar_type coefficient = pai1->coeff_on_face(f, ii) * ctx1.J() * norm;
   188           pf1->interpolation_grad(ctx1, coeff1, grad1, dim_type(qdim));
   189           gmm::copy(grad1, E); gmm::add(gmm::transposed(grad1), E);
   192           gmm::copy(gmm::identity_matrix(), S1);
   193           gmm::scale(S1, lambda * trace);
   194           gmm::add(gmm::scaled(E, 2*mu), S1);    
   195           gmm::mult(S1, up, jump);
   217         getfem::papprox_integration pai1 = 
   218         get_approx_im_or_fail(mim.int_method_of_element(v.cv()));
   221         m.points_of_convex(v.cv(), G1);
   223         coeff1.resize(mf_u.nb_basic_dof_of_element(v.cv()));
   224         gmm::copy(gmm::sub_vector(U, gmm::sub_index(mf_u.ind_basic_dof_of_element(v.cv()))), coeff1);
   233         scalar_type radius = m.convex_radius_estimate(v.cv());
   234         scalar_type gamma=radius*gamma0;
   236         for (
unsigned ii=0; ii < pai1->nb_points_on_face(f); ++ii) {
   238           ctx1.set_xref(pai1->point_on_face(f, ii));
   239           gmm::mult(ctx1.B(), pgt1->normals()[f], up);
   242           scalar_type coefficient = pai1->coeff_on_face(f, ii) * ctx1.J() * norm;
   243           pf1->interpolation_grad(ctx1, coeff1, grad1, dim_type(qdim));
   244           pf1->interpolation(ctx1, coeff1, U1, dim_type(qdim));
   245           gmm::copy(grad1, E); gmm::add(gmm::transposed(grad1), E);
   248           gmm::copy(gmm::identity_matrix(), S1);
   249           gmm::scale(S1, lambda * trace);
   250           gmm::add(gmm::scaled(E, 2*mu), S1);  
   251           gmm::mult(S1, up, sig); 
   252           sign = gmm::vect_sp(sig,up);
   253           Un = gmm::vect_sp(U1,up);
   254           scal = Un-gamma*sign;
   258           Pr = (scal/gamma + sign);
   259           ERR[v.cv()] += coefficient*radius*Pr*Pr; 
   260           eta4 +=  coefficient*radius* Pr*Pr;
   263           gmm::scale(sigt, - sign);
   277     cout << 
"eta1, eta2, eta3, eta4 = " << endl;  
   278     cout <<  sqrt(eta1) << endl;  
   279     cout <<  sqrt(eta2) << endl;  
   280     cout <<  sqrt(eta3) << endl;  
   281     cout <<  sqrt(eta4) << endl;
   282     cout <<  sqrt(eta1+eta2+eta3+eta4) << endl;
 structure used to hold a set of convexes and/or convex faces. 
 
number_traits< typename linalg_traits< V >::value_type >::magnitude_type vect_norm2_sqr(const V &v)
squared Euclidean norm of a vector. 
 
does the inversion of the geometric transformation for a given convex 
 
Definition of a posteriori error estimates. 
 
number_traits< typename linalg_traits< V >::value_type >::magnitude_type vect_norm2(const V &v)
Euclidean norm of a vector. 
 
size_t size_type
used as the common size type in the library 
 
bool invert(const base_node &n, base_node &n_ref, scalar_type IN_EPS=1e-12)
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. 
 
GEneric Tool for Finite Element Methods. 
 
std::shared_ptr< const getfem::virtual_fem > pfem
type of pointer on a fem description 
 
void clear(L &l)
clear (fill with zeros) a vector or matrix. 
 
gmm::uint16_type short_type
used as the common short type integer in the library 
 
linalg_traits< M >::value_type mat_trace(const M &m)
Trace of a matrix. 
 
void mult_add(const L1 &l1, const L2 &l2, L3 &l3)
*/ 
 
std::shared_ptr< const bgeot::geometric_trans > pgeometric_trans
pointer type for a geometric transformation