# sfepy.terms.terms_diffusion module

class sfepy.terms.terms_diffusion.AdvectDivFreeTerm(name, arg_str, integral, region, **kwargs)

  Advection of a scalar quantity p with the advection velocity \ul{y} given as a material parameter (a known function of space and time).

  The advection velocity has to be divergence-free!

  Definition:

  \int_{\Omega} \nabla \cdot (\ul{y} p) q = \int_{\Omega} (\underbrace{(\nabla \cdot \ul{y})}_{\equiv 0} + \ul{y} \cdot \nabla) p) q

  Call signature:

  dw_advect_div_free | `(material, virtual, state)`

  Arguments:

    - material : \ul{y}

    - virtual : q

    - state : p

  arg_shapes = {'material': 'D, 1', 'state': '1', 'virtual': ('1', 'state')}
  arg_types = ('material', 'virtual', 'state')
  mode = 'grad_state'
  name = 'dw_advect_div_free'

class sfepy.terms.terms_diffusion.ConvectVGradSTerm(name, arg_str, integral, region, **kwargs)

  Scalar gradient term with convective velocity.

  Definition:

  \int_{\Omega} q (\ul{u} \cdot \nabla p)

  Call signature:

  dw_convect_v_grad_s | `(virtual, state_v, state_s)`

  Arguments:

    - virtual : q

    - state_v : \ul{u}

    - state_s : p

  arg_shapes = [{'state_s': 1, 'state_v': 'D', 'virtual': (1, 'state_s')}]
  arg_types = ('virtual', 'state_v', 'state_s')
  static function(out, val_v, grad_s, cmap_v, cmap_s, is_diff)
  get_fargs(virtual, state_v, state_s, mode=None, term_mode=None, diff_var=None, **kwargs)
  name = 'dw_convect_v_grad_s'

class sfepy.terms.terms_diffusion.DiffusionCoupling(name, arg_str, integral, region, **kwargs)

  Diffusion copupling term with material parameter K_{j}.

  Definition:

  \int_{\Omega} p K_{j} \nabla_j q \mbox{ , } \int_{\Omega} q K_{j} \nabla_j p

  Call signature:

  dw_diffusion_coupling | `(material, virtual, state)`
  | `(material, state, virtual)`
  | `(material, parameter_1, parameter_2)`

  Arguments:

    - material : K_{j}

    - virtual : q

    - state : p

  arg_shapes = {'material': 'D, 1', 'parameter_1': 1, 'parameter_2': 1, 'state': 1, 'virtual': (1, 'state')}
  arg_types = (('material', 'virtual', 'state'), ('material', 'state', 'virtual'), ('material', 'parameter_1', 'parameter_2'))
  static d_fun(out, mat, val, grad, vg)
  static dw_fun(out, val, mat, bf, vg, fmode)
  get_eval_shape(mat, virtual, state, mode=None, term_mode=None, diff_var=None, **kwargs)
  get_fargs(mat, virtual, state, mode=None, term_mode=None, diff_var=None, **kwargs)
  modes = ('weak0', 'weak1', 'eval')
  name = 'dw_diffusion_coupling'
  set_arg_types()

class sfepy.terms.terms_diffusion.DiffusionRTerm(name, arg_str, integral, region, **kwargs)

  Diffusion-like term with material parameter K_{j} (to use on the right-hand side).

  Definition:

  \int_{\Omega} K_{j} \nabla_j q

  Call signature:

  dw_diffusion_r | `(material, virtual)`

  Arguments:

    - material : K_j

    - virtual : q

  arg_shapes = {'material': 'D, 1', 'virtual': (1, None)}
  arg_types = ('material', 'virtual')
  static function(out, mtx_d, cmap)
  get_fargs(mat, virtual, mode=None, term_mode=None, diff_var=None, **kwargs)
  name = 'dw_diffusion_r'

class sfepy.terms.terms_diffusion.DiffusionTerm(name, arg_str, integral, region, **kwargs)

  General diffusion term with permeability K_{ij}. Can be evaluated. Can use derivatives.

  Definition:

  \int_{\Omega} K_{ij} \nabla_i q \nabla_j p

  Call signature:

  dw_diffusion | `(material, virtual, state)`
  | `(material, parameter_1, parameter_2)`

  Arguments:

    - material: K_{ij}

    - virtual/parameter_1: q

    - state/parameter_2: p

  arg_shapes = {'material': 'D, D', 'parameter_1': 1, 'parameter_2': 1, 'state': 1, 'virtual': (1, 'state')}
  arg_types = (('material', 'virtual', 'state'), ('material', 'parameter_1', 'parameter_2'))
  get_eval_shape(mat, virtual, state, mode=None, term_mode=None, diff_var=None, **kwargs)
  get_fargs(mat, virtual, state, mode=None, term_mode=None, diff_var=None, **kwargs)
  modes = ('weak', 'eval')
  name = 'dw_diffusion'
  set_arg_types()
  symbolic = {'expression': 'div( K * grad( u ) )', 'map': {'K': 'material', 'u': 'state'}}

class sfepy.terms.terms_diffusion.DiffusionVelocityTerm(name, arg_str, integral, region, **kwargs)

  Evaluate diffusion velocity.

  Supports ‘eval’, ‘el_avg’ and ‘qp’ evaluation modes.

  Definition:

  - \int_{\cal{D}} K_{ij} \nabla_j p

  Call signature:

  ev_diffusion_velocity | `(material, parameter)`

  Arguments:

    - material : K_{ij}

    - parameter : p

  arg_shapes = {'material': 'D, D', 'parameter': 1}
  arg_types = ('material', 'parameter')
  static function(out, grad, mat, vg, fmode)
  get_eval_shape(mat, parameter, mode=None, term_mode=None, diff_var=None, **kwargs)
  get_fargs(mat, parameter, mode=None, term_mode=None, diff_var=None, **kwargs)
  integration = ('cell', 'facet_extra')
  name = 'ev_diffusion_velocity'

class sfepy.terms.terms_diffusion.LaplaceTerm(name, arg_str, integral, region, **kwargs)

  Laplace term with c coefficient. Can be evaluated. Can use derivatives.

  Definition:

  \int_{\Omega} c \nabla q \cdot \nabla p

  Call signature:

  dw_laplace | `(opt_material, virtual, state)`
  | `(opt_material, parameter_1, parameter_2)`

  Arguments 1:

    - material: c

    - virtual/parameter_1: q

    - state/parameter_2: p

  arg_shapes = [{'opt_material': '1, 1', 'parameter_1': 1, 'parameter_2': 1, 'state': 1, 'virtual': (1, 'state')}, {'opt_material': None}]
  arg_types = (('opt_material', 'virtual', 'state'), ('opt_material', 'parameter_1', 'parameter_2'))
  modes = ('weak', 'eval')
  name = 'dw_laplace'
  set_arg_types()
  symbolic = {'expression': 'c * div( grad( u ) )', 'map': {'c': 'opt_material', 'u': 'state'}}

class sfepy.terms.terms_diffusion.NonlinearDiffusionTerm(name, arg_str, integral, region, **kwargs)

  The diffusion term with a scalar coefficient given by a user supplied function of the state variable.

  Definition:

  \int_{\Omega} \nabla q \cdot \nabla p f(p)

  Call signature:

  dw_nl_diffusion | `(fun, dfun, virtual, state)`

  Arguments:

    - fun : f(p)

    - dfun : \partial f(p) / \partial p

    - virtual : q

    - state : p

  arg_shapes = {'dfun': <function NonlinearDiffusionTerm.<lambda>>, 'fun': <function NonlinearDiffusionTerm.<lambda>>, 'state': 1, 'virtual': (1, 'state')}
  arg_types = ('fun', 'dfun', 'virtual', 'state')
  static function(out, out_qp, geo)
  get_fargs(fun, dfun, var1, var2, mode=None, term_mode=None, diff_var=None, **kwargs)
  name = 'dw_nl_diffusion'

class sfepy.terms.terms_diffusion.SDDiffusionTerm(name, arg_str, integral, region, **kwargs)

  Diffusion sensitivity analysis term.

  Definition:

  \int_{\Omega} \hat{K}_{ij} \nabla_i q\, \nabla_j p

  \hat{K}_{ij} = K_{ij}\left( \delta_{ik}\delta_{jl} \nabla \cdot \ul{\Vcal} - \delta_{ik}{\partial \Vcal_j \over \partial x_l} - \delta_{jl}{\partial \Vcal_i \over \partial x_k}\right)

  Call signature:

  ev_sd_diffusion | `(material, parameter_q, parameter_p, parameter_mv)`

  Arguments:

    - material: K_{ij}

    - parameter_q: q

    - parameter_p: p

    - parameter_mv: \ul{\Vcal}

  arg_shapes = {'material': 'D, D', 'parameter_mv': 'D', 'parameter_p': 1, 'parameter_q': 1}
  arg_types = ('material', 'parameter_q', 'parameter_p', 'parameter_mv')
  static function(out, grad_q, grad_p, grad_w, div_w, mtx_d, cmap)
  get_eval_shape(mat, parameter_q, parameter_p, parameter_mv, mode=None, term_mode=None, diff_var=None, **kwargs)
  get_fargs(mat, parameter_q, parameter_p, parameter_mv, mode=None, term_mode=None, diff_var=None, **kwargs)
  name = 'ev_sd_diffusion'

class sfepy.terms.terms_diffusion.SurfaceFluxOperatorTerm(name, arg_str, integral, region, **kwargs)

  Surface flux operator term.

  Definition:

  \int_{\Gamma} q \ul{n} \cdot \ull{K} \cdot \nabla p

  Call signature:

  dw_surface_flux | `(opt_material, virtual, state)`

  Arguments:

    - material : \ull{K}

    - virtual : q

    - state : p

  arg_shapes = [{'opt_material': 'D, D', 'state': 1, 'virtual': (1, 'state')}, {'opt_material': None}]
  arg_types = ('opt_material', 'virtual', 'state')
  static function(out, grad, mat, bf, cmap, fis, mode)
  get_fargs(mat, virtual, state, mode=None, term_mode=None, diff_var=None, **kwargs)
  integration = 'facet_extra'
  name = 'dw_surface_flux'

class sfepy.terms.terms_diffusion.SurfaceFluxTerm(name, arg_str, integral, region, **kwargs)

  Surface flux term.

  Supports ‘eval’, ‘el_eval’ and ‘el_avg’ evaluation modes.

  Definition:

  \int_{\Gamma} \ul{n} \cdot K_{ij} \nabla_j p

  Call signature:

  ev_surface_flux | `(material, parameter)`

  Arguments:

    - material: \ul{K}

    - parameter: p,

  arg_shapes = {'material': 'D, D', 'parameter': 1}
  arg_types = ('material', 'parameter')
  static function(out, grad, mtx_d, cmap, mode)
  get_eval_shape(mat, parameter, mode=None, term_mode=None, diff_var=None, **kwargs)
  get_fargs(mat, parameter, mode=None, term_mode=None, diff_var=None, **kwargs)
  integration = 'facet_extra'
  name = 'ev_surface_flux'