MFEM  v4.3.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
sbm_solver.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2021, Lawrence Livermore National Security, LLC. Produced
2 // at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3 // LICENSE and NOTICE for details. LLNL-CODE-806117.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability visit https://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the BSD-3 license. We welcome feedback and contributions, see file
10 // CONTRIBUTING.md for details.
11 
12 #ifndef MFEM_SBM_SOLVER_HPP
13 #define MFEM_SBM_SOLVER_HPP
14 
15 #include "mfem.hpp"
16 
17 namespace mfem
18 {
19 
20 /// ShiftedFunctionCoefficient, similar to FunctionCoefficient, but also takes
21 /// into account a displacement vector if specified.
23 {
24 protected:
25  std::function<double(const Vector &)> Function;
26 
27 public:
28  ShiftedFunctionCoefficient(std::function<double(const Vector &v)> F)
29  : Function(std::move(F)) { }
30 
31  virtual double Eval(ElementTransformation &T,
32  const IntegrationPoint &ip)
33  {
34  Vector D(1);
35  D = 0.;
36  return (this)->Eval(T, ip, D);
37  }
38 
39  /// Evaluate the coefficient at @a ip + @a D.
40  double Eval(ElementTransformation &T,
41  const IntegrationPoint &ip,
42  const Vector &D);
43 };
44 
45 /// BilinearFormIntegrator for the high-order extension of shifted boundary
46 /// method.
47 /// A(u, w) = -<nabla u.n, w>
48 /// -<u + nabla u.d + h.o.t, nabla w.n>
49 /// -<alpha h^{-1} (u + nabla u.d + h.o.t), w + nabla w.d + h.o.t>
50 /// where h.o.t include higher-order derivatives (nabla^k u) due to Taylor
51 /// expansion. Since this interior face integrator is applied to the surrogate
52 /// boundary (see marking.hpp for notes on how the surrogate faces are
53 /// determined and elements are marked), this integrator adds contribution to
54 /// only the element that is adjacent to that face (Trans.Elem1 or Trans.Elem2)
55 /// and is part of the surrogate domain.
57 {
58 protected:
59  double alpha;
60  VectorCoefficient *vD; // Distance function coefficient
61  Array<int> *elem_marker; // marker indicating whether element is inside,
62  //cut, or outside the domain.
63  bool include_cut_cell; // include element cut by true boundary
64  int nterms; // Number of terms in addition to the gradient
65  // term from Taylor expansion that should be included. (0 by default).
66  int NEproc; //Number of elements on the current MPI rank
68 
69  // these are not thread-safe!
72 
73 
74 public:
76  const double a,
77  VectorCoefficient &vD_,
78  Array<int> &elem_marker_,
79  bool include_cut_cell_ = false,
80  int nterms_ = 0)
81  : alpha(a), vD(&vD_),
82  elem_marker(&elem_marker_),
83  include_cut_cell(include_cut_cell_),
84  nterms(nterms_),
85  NEproc(pmesh->GetNE()),
87 
89  virtual void AssembleFaceMatrix(const FiniteElement &el1,
90  const FiniteElement &el2,
92  DenseMatrix &elmat);
93 
95 };
96 
97 /// LinearFormIntegrator for the high-order extension of shifted boundary
98 /// method.
99 /// (u, w) = -<u_D, nabla w.n >
100 /// -<alpha h^{-1} u_D, w + nabla w.d + h.o.t>
101 /// where h.o.t include higher-order derivatives (nabla^k u) due to Taylor
102 /// expansion. Since this interior face integrator is applied to the surrogate
103 /// boundary (see marking.hpp for notes on how the surrogate faces are
104 /// determined and elements are marked), this integrator adds contribution to
105 /// only the element that is adjacent to that face (Trans.Elem1 or Trans.Elem2)
106 /// and is part of the surrogate domain.
107 /// Note that u_D is evaluated at the true boundary using the distance function
108 /// and ShiftedFunctionCoefficient, i.e. u_D(x_true) = u_D(x_surrogate + D),
109 /// where x_surrogate is the location of the integration point on the surrogate
110 /// boundary and D is the distance vector from the surrogate boundary to the
111 /// true boundary.
113 {
114 protected:
116  double alpha; // Nitsche parameter
117  VectorCoefficient *vD; // Distance function coefficient
118  Array<int> *elem_marker; //marker indicating whether element is inside,
119  //cut, or outside the domain.
120  bool include_cut_cell; // include element cut by true boundary
121  int nterms; // Number of terms in addition to the gradient
122  // term from Taylor expansion that should be included. (0 by default).
123  int NEproc; //Number of elements on the current MPI rank
125 
126  // these are not thread-safe!
129 
130 public:
133  const double a,
134  VectorCoefficient &vD_,
135  Array<int> &elem_marker_,
136  bool include_cut_cell_ = false,
137  int nterms_ = 0)
138  : uD(&u), alpha(a), vD(&vD_),
139  elem_marker(&elem_marker_),
140  include_cut_cell(include_cut_cell_),
141  nterms(nterms_),
142  NEproc(pmesh->GetNE()),
143  par_shared_face_count(0) { }
144 
145  virtual void AssembleRHSElementVect(const FiniteElement &el,
147  Vector &elvect);
148  virtual void AssembleRHSElementVect(const FiniteElement &el,
150  Vector &elvect);
151  virtual void AssembleRHSElementVect(const FiniteElement &el1,
152  const FiniteElement &el2,
154  Vector &elvect);
155 };
156 
157 } // namespace mfem
158 
159 #endif
Abstract class for all finite elements.
Definition: fe.hpp:243
SBM2DirichletLFIntegrator(const ParMesh *pmesh, ShiftedFunctionCoefficient &u, const double a, VectorCoefficient &vD_, Array< int > &elem_marker_, bool include_cut_cell_=false, int nterms_=0)
Definition: sbm_solver.hpp:131
Base class for vector Coefficients that optionally depend on time and space.
VectorCoefficient * vD
Definition: sbm_solver.hpp:60
A specialized ElementTransformation class representing a face and its two neighboring elements...
Definition: eltrans.hpp:467
Data type dense matrix using column-major storage.
Definition: densemat.hpp:23
Abstract base class LinearFormIntegrator.
Definition: lininteg.hpp:22
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
Definition: sbm_solver.cpp:327
Abstract base class BilinearFormIntegrator.
Definition: bilininteg.hpp:34
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
Definition: coefficient.hpp:39
ShiftedFunctionCoefficient(std::function< double(const Vector &v)> F)
Definition: sbm_solver.hpp:28
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient in the element described by T at the point ip.
Definition: sbm_solver.hpp:31
std::function< double(const Vector &)> Function
Definition: sbm_solver.hpp:25
double a
Definition: lissajous.cpp:41
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
Definition: bilininteg.cpp:139
Class for integration point with weight.
Definition: intrules.hpp:25
SBM2DirichletIntegrator(const ParMesh *pmesh, const double a, VectorCoefficient &vD_, Array< int > &elem_marker_, bool include_cut_cell_=false, int nterms_=0)
Definition: sbm_solver.hpp:75
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
Definition: sbm_solver.cpp:33
Vector data type.
Definition: vector.hpp:60
double u(const Vector &xvec)
Definition: lor_mms.hpp:24
Class for parallel meshes.
Definition: pmesh.hpp:32
ShiftedFunctionCoefficient * uD
Definition: sbm_solver.hpp:115