# sfepy.terms.terms_surface module

class sfepy.terms.terms_surface.ContactPlaneTerm(*args, **kwargs)

  Small deformation elastic contact plane term with penetration penalty.

  The plane is given by an anchor point \ul{A} and a normal \ul{n}. The contact occurs in points that orthogonally project onto the plane into a polygon given by orthogonal projections of boundary points \{\ul{B}_i\}, i = 1, \dots, N_B on the plane. In such points, a penetration distance d(\ul{u}) = (\ul{X} + \ul{u} - \ul{A}, \ul{n}) is computed, and a force f(d(\ul{u})) \ul{n} is applied. The force depends on the non-negative parameters k (stiffness) and f_0 (force at zero penetration):

  - If f_0 = 0:

    f(d) = 0 \mbox{ for } d \leq 0 \;, \\ f(d) = k d \mbox{ for } d > 0 \;.

  - If f_0 > 0:

    f(d) = 0 \mbox{ for } d \leq -\frac{2 r_0}{k} \;, \\ f(d) = \frac{k^2}{4 r_0} d^2 + k d + r_0 \mbox{ for } -\frac{2 r_0}{k} < d \leq 0 \;, \\ f(d) = k d + f_0 \mbox{ for } d > 0 \;.

    In this case the dependence f(d) is smooth, and a (small) force is applied even for (small) negative penetrations: -\frac{2 r_0}{k} < d \leq 0.

  Definition:

  \int_{\Gamma} \ul{v} \cdot f(d(\ul{u})) \ul{n}

  Call signature:

  dw_contact_plane | `(material_f, material_n, material_a, material_b, virtual, state)`

  Arguments:

    - material_f : [k, f_0]

    - material_n : \ul{n} (special)

    - material_a : \ul{A} (special)

    - material_b : \{\ul{B}_i\}, i = 1, \dots, N_B (special)

    - virtual : \ul{v}

    - state : \ul{u}

  arg_shapes = {'material_a': '.: D', 'material_b': '.: N, D', 'material_f': '1, 2', 'material_n': '.: D', 'state': 'D', 'virtual': ('D', 'state')}
  arg_types = ('material_f', 'material_n', 'material_a', 'material_b', 'virtual', 'state')
  static function(out, force, normal, geo, fmode)
  geometries = ['3_4', '3_8']
  get_fargs(force_pars, normal, anchor, bounds, virtual, state, mode=None, term_mode=None, diff_var=None, **kwargs)
  integration = 'facet'
  name = 'dw_contact_plane'
  static smooth_f(d, k, f0, a, eps, diff)

class sfepy.terms.terms_surface.ContactSphereTerm(*args, **kwargs)

  Small deformation elastic contact sphere term with penetration penalty.

  The sphere is given by a centre point \ul{C} and a radius R. The contact occurs in points that are closer to \ul{C} than R. In such points, a penetration distance d(\ul{u}) = R - ||\ul{X} + \ul{u} - \ul{C}|| is computed, and a force f(d(\ul{u})) \ul{n}(\ul{u}) is applied, where \ul{n}(\ul{u}) = (\ul{X} + \ul{u} - \ul{C}) / ||\ul{X} + \ul{u} - \ul{C}||. The force depends on the non-negative parameters k (stiffness) and f_0 (force at zero penetration):

  - If f_0 = 0:

    f(d) = 0 \mbox{ for } d \leq 0 \;, \\ f(d) = k d \mbox{ for } d > 0 \;.

  - If f_0 > 0:

    f(d) = 0 \mbox{ for } d \leq -\frac{2 r_0}{k} \;, \\ f(d) = \frac{k^2}{4 r_0} d^2 + k d + r_0 \mbox{ for } -\frac{2 r_0}{k} < d \leq 0 \;, \\ f(d) = k d + f_0 \mbox{ for } d > 0 \;.

    In this case the dependence f(d) is smooth, and a (small) force is applied even for (small) negative penetrations: -\frac{2 r_0}{k} < d \leq 0.

  Definition:

  \int_{\Gamma} \ul{v} \cdot f(d(\ul{u})) \ul{n}(\ul{u})

  Call signature:

  dw_contact_sphere | `(material_f, material_c, material_r, virtual, state)`

  Arguments:

    - material_f : [k, f_0]

    - material_c : \ul{C} (special)

    - material_r : R (special)

    - virtual : \ul{v}

    - state : \ul{u}

  arg_shapes = {'material_c': '.: D', 'material_f': '1, 2', 'material_r': '.: 1', 'state': 'D', 'virtual': ('D', 'state')}
  arg_types = ('material_f', 'material_c', 'material_r', 'virtual', 'state')
  static function(out, force, normals, fd, geo, fmode)
  geometries = ['3_4', '3_8']
  get_fargs(force_pars, centre, radius, virtual, state, mode=None, term_mode=None, diff_var=None, **kwargs)
  integration = 'facet'
  name = 'dw_contact_sphere'

class sfepy.terms.terms_surface.LinearTractionTerm(name, arg_str, integral, region, **kwargs)

  Linear traction forces, where, depending on dimension of ‘material’ argument, \ull{\sigma} \cdot \ul{n} is \bar{p} \ull{I} \cdot \ul{n} for a given scalar pressure, \ul{f} for a traction vector, and itself for a stress tensor.

  The material parameter can have one of the following shapes: 1 or (1, 1), (D, 1), (S, 1) in all modes, or (D, D) in the eval mode only. The symmetric tensor storage (S, 1) is as follows: in 3D S = 6 and the indices ordered as [11, 22, 33, 12, 13, 23], in 2D S = 3 and the indices ordered as [11, 22, 12].

  Definition:

  \int_{\Gamma} \ul{v} \cdot \ull{\sigma} \cdot \ul{n}, \int_{\Gamma} \ul{v} \cdot \ul{n},

  Call signature:

  dw_surface_ltr | `(opt_material, virtual)`
  | `(opt_material, parameter)`

  Arguments:

    - material : \ull{\sigma}

    - virtual : \ul{v}

  arg_shapes = [{'opt_material': 'S, 1', 'parameter': 'D', 'virtual': ('D', None)}, {'opt_material': 'D, 1'}, {'opt_material': '1, 1'}, {'opt_material': 'D, D'}, {'opt_material': None}]
  arg_types = (('opt_material', 'virtual'), ('opt_material', 'parameter'))
  static d_fun(out, traction, val, sg)
  get_eval_shape(traction, virtual, mode=None, term_mode=None, diff_var=None, **kwargs)
  get_fargs(traction, virtual, mode=None, term_mode=None, diff_var=None, **kwargs)
  integration = 'facet'
  modes = ('weak', 'eval')
  name = 'dw_surface_ltr'
  set_arg_types()

class sfepy.terms.terms_surface.SDLinearTractionTerm(name, arg_str, integral, region, **kwargs)

  Sensitivity of the linear traction term.

  Definition:

  \int_{\Gamma} \ul{v} \cdot (\ull{\sigma}\, \ul{n}), \int_{\Gamma} \ul{v} \cdot \ul{n},

  Call signature:

  ev_sd_surface_ltr | `(opt_material, parameter, parameter_mv)`

  Arguments:

    - material : \ull{\sigma}

    - parameter : \ul{v}

  arg_shapes = [{'opt_material': 'S, 1', 'parameter': 'D', 'parameter_mv': 'D'}, {'opt_material': '1, 1'}, {'opt_material': 'D, 1'}, {'opt_material': 'D, D'}, {'opt_material': None}]
  arg_types = ('opt_material', 'parameter', 'parameter_mv')
  static d_fun(out, traction, val, grad_mv, div_mv, sg)
  get_eval_shape(traction, par_u, par_mv, mode=None, term_mode=None, diff_var=None, **kwargs)
  get_fargs(traction, par_u, par_mv, mode=None, term_mode=None, diff_var=None, **kwargs)
  integration = 'facet'
  name = 'ev_sd_surface_ltr'
  set_arg_types()

class sfepy.terms.terms_surface.SDSufaceIntegrateTerm(name, arg_str, integral, region, **kwargs)

  Sensitivity of scalar traction.

  Definition:

  \int_{\Gamma} p \nabla \cdot \ul{\Vcal}

  Call signature:

  ev_sd_surface_integrate | `(parameter, parameter_mv)`

  Arguments:

    - parameter : p

    - parameter_mv : \ul{\Vcal}

  arg_shapes = {'parameter': 1, 'parameter_mv': 'D'}
  arg_types = ('parameter', 'parameter_mv')
  static function(out, val_p, div_v, sg)
  get_eval_shape(par, par_v, mode=None, term_mode=None, diff_var=None, **kwargs)
  get_fargs(par, par_v, mode=None, term_mode=None, diff_var=None, **kwargs)
  integration = 'facet'
  name = 'ev_sd_surface_integrate'

class sfepy.terms.terms_surface.SufaceNormalDotTerm(name, arg_str, integral, region, **kwargs)

  “Scalar traction” term, (weak form).

  Definition:

  \int_{\Gamma} q \ul{c} \cdot \ul{n}

  Call signature:

  dw_surface_ndot | `(material, virtual)`
  | `(material, parameter)`

  Arguments:

    - material : \ul{c}

    - virtual : q

  arg_shapes = {'material': 'D, 1', 'parameter': 1, 'virtual': (1, None)}
  arg_types = (('material', 'virtual'), ('material', 'parameter'))
  static d_fun(out, material, val, sg)
  static dw_fun(out, material, bf, sg)
  get_eval_shape(mat, virtual, mode=None, term_mode=None, diff_var=None, **kwargs)
  get_fargs(mat, virtual, mode=None, term_mode=None, diff_var=None, **kwargs)
  integration = 'facet'
  modes = ('weak', 'eval')
  name = 'dw_surface_ndot'
  set_arg_types()

class sfepy.terms.terms_surface.SurfaceJumpTerm(name, arg_str, integral, region, **kwargs)

  Interface jump condition.

  Definition:

  \int_{\Gamma} c\, q (p_1 - p_2)

  Call signature:

  dw_jump | `(opt_material, virtual, state_1, state_2)`

  Arguments:

    - material : c

    - virtual : q

    - state_1 : p_1

    - state_2 : p_2

  arg_shapes = [{'opt_material': '1, 1', 'state_1': 1, 'state_2': 1, 'virtual': (1, None)}, {'opt_material': None}]
  arg_types = ('opt_material', 'virtual', 'state_1', 'state_2')
  static function(out, jump, mul, bf1, bf2, sg, fmode)
  get_fargs(coef, virtual, state1, state2, mode=None, term_mode=None, diff_var=None, **kwargs)
  integration = 'facet'
  name = 'dw_jump'