GetFEM  5.4.2
getfem_error_estimate.h
Go to the documentation of this file.
1 /* -*- c++ -*- (enables emacs c++ mode) */
2 /*===========================================================================
3 
4  Copyright (C) 1999-2020 Yves Renard, Julien Pommier
5 
6  This file is a part of GetFEM
7 
8  GetFEM is free software; you can redistribute it and/or modify it
9  under the terms of the GNU Lesser General Public License as published
10  by the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version along with the GCC Runtime Library
12  Exception either version 3.1 or (at your option) any later version.
13  This program is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16  License and GCC Runtime Library Exception for more details.
17  You should have received a copy of the GNU Lesser General Public License
18  along with this program; if not, write to the Free Software Foundation,
19  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20 
21  As a special exception, you may use this file as it is a part of a free
22  software library without restriction. Specifically, if other files
23  instantiate templates or use macros or inline functions from this file,
24  or you compile this file and link it with other files to produce an
25  executable, this file does not by itself cause the resulting executable
26  to be covered by the GNU Lesser General Public License. This exception
27  does not however invalidate any other reasons why the executable file
28  might be covered by the GNU Lesser General Public License.
29 
30 ===========================================================================*/
31 
32 
33 /**
34  @file getfem_error_estimate.h
35  @author Yves Renard <Yves.Renard@insa-lyon.fr>
36  @author Julien Pommier <Julien.Pommier@insa-toulouse.fr>
37  @date February 10, 2006.
38  @brief Definition of a posteriori error estimates.
39 */
40 
41 #ifndef GETFEM_ERROR_ESTIMATE
42 #define GETFEM_ERROR_ESTIMATE
43 
44 #include "getfem_mesh_im.h"
45 #include "getfem_mesh_fem.h"
47 
48 namespace getfem {
49 
50  template <typename VECT1, typename VECT2>
51  void error_estimate(const mesh_im &mim, const mesh_fem &mf,
52  const VECT1 &UU, VECT2 &err,
53  mesh_region rg = mesh_region::all_convexes()) {
54 
55  const mesh &m = mim.linked_mesh();
56  rg.from_mesh(m);
57  GMM_ASSERT3(&m == &mf.linked_mesh() &&
58  gmm::vect_size(err) >= m.nb_allocated_convex(), "");
59 
60  const mesh_fem &mf0 = classical_mesh_fem(m, 0);
61 
62  getfem::ga_workspace workspace;
63  mesh_region inner_faces = inner_faces_of_mesh(m, rg);
64  getfem::size_type nbdof = mf0.nb_dof();
65  getfem::base_vector Z(nbdof);
66  getfem::base_vector U(gmm::vect_size(UU));
67  gmm::copy(UU, U);
68  workspace.add_fem_constant("u", mf, U);
69  workspace.add_fem_variable("z", mf0, gmm::sub_interval(0, nbdof), Z);
70  workspace.add_expression
71  ("element_size"
72  "*Norm_sqr(Grad_u.Normal-Interpolate(Grad_u,neighbor_element).Normal)"
73  "*(Test_z+Interpolate(Test_z,neighbor_element))", mim, inner_faces);
74  workspace.set_assembled_vector(Z);
75  workspace.assembly(1);
76  gmm::clear(err);
77 
78  for (mr_visitor cv1(rg); !cv1.finished(); ++cv1)
79  err[cv1.cv()] = Z[mf0.ind_basic_dof_of_element(cv1.cv())[0]];
80  }
81 
82 #ifdef EXPERIMENTAL_PURPOSE_ONLY
83 
84 
85  void error_estimate_nitsche(const mesh_im & mim,
86  const mesh_fem &mf_u,
87  const base_vector &U,
88  int GAMMAC,
89  int GAMMAN,
90  scalar_type lambda,
91  scalar_type mu,
92  scalar_type gamma0,
93  scalar_type f_coeff,
94  scalar_type vertical_force,
95  base_vector &ERR);
96 
97 
98 
99 #endif
100 
101 
102 }
103 
104 #endif
105 
bgeot::size_type
size_t size_type
used as the common size type in the library
Definition: bgeot_poly.h:49
gmm::clear
void clear(L &l)
clear (fill with zeros) a vector or matrix.
Definition: gmm_blas.h:59
getfem::inner_faces_of_mesh
mesh_region APIDECL inner_faces_of_mesh(const mesh &m, const mesh_region &mr=mesh_region::all_convexes())
Select all the faces sharing at least two element of the given mesh region.
Definition: getfem_mesh.cc:877
getfem::mesh_region::all_convexes
static mesh_region all_convexes()
provide a default value for the mesh_region parameters of assembly procedures etc.
Definition: getfem_mesh_region.h:142
getfem
GEneric Tool for Finite Element Methods.
Definition: getfem_accumulated_distro.h:46
getfem_mesh_im.h
Define the getfem::mesh_im class (integration of getfem::mesh_fem).
getfem_mesh_fem.h
Define the getfem::mesh_fem class.
getfem_generic_assembly.h
A language for generic assembly of pde boundary value problems.
getfem::classical_mesh_fem
const mesh_fem & classical_mesh_fem(const mesh &mesh, dim_type degree, dim_type qdim=1, bool complete=false)
Gives the descriptor of a classical finite element method of degree K on mesh.
Definition: getfem_mesh_fem.cc:862

Rabisu Mirror Service We provide mirrors to support Open source communities. Our mirror server is located in Istanbul/Turkey region.

Please do not hesitate to contact mirror@rabisu.com for new open source mirror submissions.