Bilinear Form and Integrators

BilinearForm

有限元分析的一个关键是双线性泛函积分(u,v)计算,BilinearForm class 生成全局、稀疏的系数矩阵,glb_mat,通过在外循环(单元)上调用 BilinearFormIntegrator class 生成稠密、局部单元刚度矩阵,loc_mat,内部嵌套循环(高斯点、形函数)。伪代码如下

To put this another way, the BilinearForm class builds a global, sparse, finite element matrix, glb_mat, by performing the outer loop in the following pseudocode snippet whereas the BilinearFormIntegrator class performs the nested inner loops to compute the dense local element matrix, loc_mat.

for each elem in elements
   loc_mat = 0.0
   for each pt in quadrature_points
      for each u_j in elem
         for each v_i in elem
            loc_mat(i,j) += w(pt) * u_j(pt) v_i(pt)
         end
      end
   end
   glb_mat += loc_mat
end

重点BilinearForm classes 生成的全局刚度矩阵由局部单元刚度矩阵组成,如果需要自己定义MFEM中不包括的单元,仅需修改 BilinearFormIntegrator classes,理解为 BilinearForm负责组装?

The BilinearFormIntegrator classes allow MFEM to produce a wide variety of local element matrices without modifying the BilinearForm class. For more information on integration and developing custom BilinearFormIntegrator classes see Integration.

各种积分器所求的积分也即下边所示的内积\((\cdot,\cdot)\)

The integrals performed by the various integrators listed below are shown using inner product notation, (⋅,⋅), defined as follows.

\[(\lambda u,v) = \int_{\Omega} \lambda u v \\ (\lambda \vec{u},\vec{v}) = \int_{\Omega} \lambda \vec{u} \cdot \vec{v} \]

BilinearFormIntegrator 子类代码分析

/** Integrator for the linear elasticity form:
    a(u,v) = (lambda div(u), div(v)) + (2 mu e(u), e(v)),
    where e(v) = (1/2) (grad(v) + grad(v)^T).
    This is a 'Vector' integrator, i.e. defined for FE spaces
    using multiple copies of a scalar FE space. */

class ElasticityIntegrator : public BilinearFormIntegrator
{
protected:
  double q_lambda, q_mu;
  Coefficient *lambda, *mu;

private:
#ifndef MFEM_THREAD_SAFE
  Vector shape;
  DenseMatrix dshape, gshape, pelmat;
  Vector divshape;
#endif

public:
  ElasticityIntegrator(Coefficient &l, Coefficient &m)
  { lambda = &l; mu = &m; }
   /** With this constructor lambda = q_l * m and mu = q_m * m;
       if dim * q_l + 2 * q_m = 0 then trace(sigma) = 0. */

  ElasticityIntegrator(Coefficient &m, double q_l, double q_m)
  { lambda = NULL; mu = &m; q_lambda = q_l; q_mu = q_m; }

  virtual void AssembleElementMatrix(const FiniteElement &,
                  ElementTransformation &,
                  DenseMatrix &);

  /** Compute the stress corresponding to the local displacement @a u and
       interpolate it at the nodes of the given @a fluxelem. Only the symmetric
       part of the stress is stored, so that the size of @a flux is equal to
       the number of DOFs in @a fluxelem times dim*(dim+1)/2. In 2D, the order
       of the stress components is: s_xx, s_yy, s_xy. In 3D, it is: s_xx, s_yy,
       s_zz, s_xy, s_xz, s_yz. In other words, @a flux is the local vector for
       a FE space with dim*(dim+1)/2 vector components, based on the finite
       element @a fluxelem. The integration rule is taken from @a fluxelem.
       @a ir exists to specific an alternative integration rule. */

  virtual void ComputeElementFlux(const FiniteElement &el,
                 ElementTransformation &Trans,
                 Vector &u,
                 const FiniteElement &fluxelem,
                 Vector &flux, bool with_coef = true,
                 const IntegrationRule *ir = NULL);

  /** Compute the element energy (integral of the strain energy density)
       corresponding to the stress represented by @a flux which is a vector of
       coefficients multiplying the basis functions defined by @a fluxelem. In
       other words, @a flux is the local vector for a FE space with
       dim*(dim+1)/2 vector components, based on the finite element @a fluxelem.
       The number of components, dim*(dim+1)/2 is such that it represents the
       symmetric part of the (symmetric) stress tensor. The order of the
       components is: s_xx, s_yy, s_xy in 2D, and s_xx, s_yy, s_zz, s_xy, s_xz,
       s_yz in 3D. */

  virtual double ComputeFluxEnergy(const FiniteElement &fluxelem,
                 ElementTransformation &Trans,
                 Vector &flux, Vector *d_energy = NULL);
};

我的其他相关博文

  1. MFEM库中NURBS网格文件格式记录



最后更新于 2022年4月21日 --- 最初发表于 2022年4月21日
原创作者:LitBro
关于作者:又是一天... 打卡
本文链接: [https://www.cnblogs.com/LitBro/p/16175760.html]
版权声明:本文采用 BY-NC-SA协议,转载或引用请注明出处!
关于后续:碍于学业不精,如有描述不当,还请见谅并非常感谢指出

posted @ 2022-04-21 19:51  LitBro  阅读(110)  评论(0编辑  收藏  举报