Module pytop.physics.utils
Functions
def inner_e(x, y, restrict_to_one_side=False, quadrature_degree=1)-
The inner product of the tangential component of a vector field on all of the facets of the mesh (Measure objects dS and ds). By default, restrict_to_one_side is False. In this case, the function will return an integral that is restricted to both sides ('+') and ('-') of a shared facet between elements. You should use this in the case that you want to use the 'projected' version of DuranLibermanSpace. If restrict_to_one_side is True, then this will return an integral that is restricted ('+') to one side of a shared facet between elements. You should use this in the case that you want to use the
multipliersversion of DuranLibermanSpace.Args
x- DOLFIN or UFL Function of rank (2,) (vector).
y- DOLFIN or UFL Function of rank (2,) (vector).
- restrict_to_one_side (Optional[bool]: Default is False.
quadrature_degree:Optional[int]- Default is 1.
Returns
UFL Form.
def isoparametric_2D(z: fenics_adjoint.types.function.Function, e: fenics_adjoint.types.function.Function, u: fenics_adjoint.types.function.Function, v: fenics_adjoint.types.function.Function) ‑> fenics_adjoint.types.function.Function-
Apply 2D isoparametric projection onto orientation vector.
Args
z:dolfin_adjoint.Function- 0-component of the orientation vector (on natural setting).
e:dolfin_adjoint.Function- 1-component of the orientation vector (on natural setting)
u:dolfin_adjoint.Function- 0-component of the orientation vector (on real setting).
v:dolfin_adjoint.Function- 1-component of the orientation vector (on real setting).
Returns
dolfin_adjoint.Vector- Orientation vector with unit circle boundary condition on real setting.
def isoparametric_2D_box_to_circle(z: fenics_adjoint.types.function.Function, e: fenics_adjoint.types.function.Function) ‑> fenics_adjoint.types.function.Function-
Apply 2D isoparametric projection onto orientation vector.
Args
z:dolfin_adjoint.Function- 0-component of the orientation vector (on natural setting).
e:dolfin_adjoint.Function- 1-component of the orientation vector (on natural setting)
Returns
dolfin_adjoint.Vector- Orientation vector with unit circle boundary condition on real setting.
def isoparametric_2D_box_to_triangle(z: fenics_adjoint.types.function.Function, e: fenics_adjoint.types.function.Function, tolerance=1e-06) ‑> fenics_adjoint.types.function.Function-
Apply 2D isoparametric projection onto orientation vector.
Args
z:dolfin_adjoint.Function- 0-component of the orientation vector (on natural setting).
e:dolfin_adjoint.Function- 1-component of the orientation vector (on natural setting).
tolerance:float- tolerance value. This is used to avoid square root of negative values.
Returns
dolfin_adjoint.Vector- Orientation vector with unit circle boundary condition on real setting.
def penalized_weight(rho, p=3, eps=0.001)-
Penalized weight function.
Args: (float, float) rho: density. p: penalization parameter. eps: penalization parameter.
Returns: (float) penalized weight.
def sgn(x, k=10)
Classes
class Custom_nonlinear_problem (J, F, bcs)-
Custom nonlinear problem class for FEniCS.
init(self: dolfin.cpp.nls.NonlinearProblem) -> None
Expand source code
class Custom_nonlinear_problem(NonlinearProblem): """Custom nonlinear problem class for FEniCS. """ def __init__(self, J, F, bcs): self.bilinear_form = J self.linear_form = F self.bcs = bcs NonlinearProblem.__init__(self) def F(self, b, x): assemble(self.linear_form, tensor=b) for bc in self.bcs: bc.apply(b, x) def J(self, A, x): assemble(self.bilinear_form, tensor=A) for bc in self.bcs: bc.apply(A)Ancestors
- dolfin.cpp.nls.NonlinearProblem
- pybind11_builtins.pybind11_object
Methods
def F(self, b, x)-
F(self: dolfin.cpp.nls.NonlinearProblem, arg0: dolfin.cpp.la.GenericVector, arg1: dolfin.cpp.la.GenericVector) -> None
def J(self, A, x)-
J(self: dolfin.cpp.nls.NonlinearProblem, arg0: dolfin.cpp.la.GenericMatrix, arg1: dolfin.cpp.la.GenericVector) -> None