Module pytop.toolkit.dehomogenization
Functions
def sh_stripe(mesh: fenics_adjoint.types.mesh.Mesh, source_vector: fenics_adjoint.types.function.Function, source_density: fenics_adjoint.types.function.Function, band_width: float, alpha=0.9, eps_0=1.0, g_0=0.0, absolute_tol=0.01, max_iter=1000) ‑> fenics_adjoint.types.function.Function-
Solve the steady state Swift-Hohenberg equation with stripe pattern. see: https://doi.org/10.1038/s41598-023-41316-w https://doi.org/10.1016/j.compositesb.2022.109626
Args
mesh- the mesh
source_vector- the source vector
source_density- the source density
width- the width of the stripe
alpha- the coefficient of the source term
eps_0- the coefficient of the linear term
g_0- the coefficient of the cubic term
absolute_tol- the absolute tolerance
max_iter- the maximum iterations
Returns
stripe- the stripe pattern
def sh_stripe_tensor(mesh: fenics_adjoint.types.mesh.Mesh, source_tensor: fenics_adjoint.types.function.Function, source_density: fenics_adjoint.types.function.Function, band_width: float, perpendicular=True, alpha=0.9, eps_0=1.0, g_0=0.0, absolute_tol=0.01, max_iter=1000) ‑> fenics_adjoint.types.function.Function-
Solve the steady state Swift-Hohenberg equation with stripe pattern. see: https://doi.org/10.1038/s41598-023-41316-w https://doi.org/10.1016/j.compositesb.2022.109626
Args
mesh- the mesh
source_tensor- the source tensor (Assuming 3-dim vector function. 1. a11, 2. a22, and 3. a12)
source_density- the source density
band_width- the width of the stripe
perpendicular- If True, the stripe is perpendicular to the source vector. Otherwise, the stripe is parallel to the source vector.
alpha- the coefficient of the source term
eps_0- the coefficient of the linear term
g_0- the coefficient of the cubic term
absolute_tol- the absolute tolerance
max_iter- the maximum iterations
Returns
stripe- the stripe pattern
Classes
class GaussianRandomField_2D (*args, **kwargs)-
Base class for OverloadedType types.
The purpose of each OverloadedType is to extend a type such that it can be referenced by blocks as well as overload basic mathematical operations such as mul, add, where they are needed.
Expand source code
class GaussianRandomField_2D(UserExpression): def eval(self, val, x): val[0] = 10*np.random.randn() val[1] = 10*np.random.randn() def value_shape(self): return (2,)Ancestors
- fenics_adjoint.types.expression.UserExpression
- fenics_adjoint.types.expression.BaseExpression
- pyadjoint.overloaded_type.FloatingType
- pyadjoint.overloaded_type.OverloadedType
- dolfin.function.expression.UserExpression
- dolfin.function.expression.BaseExpression
- ufl.coefficient.Coefficient
- ufl.core.terminal.FormArgument
- ufl.core.terminal.Terminal
- ufl.core.expr.Expr
Methods
def eval(self, val, x)def value_shape(self)
class Problem (a, L)-
init(self: dolfin.cpp.nls.NonlinearProblem) -> None
Expand source code
class Problem(NonlinearProblem): def __init__(self, a, L): NonlinearProblem.__init__(self) self.L = L self.a = a def F(self, b, x): assemble(self.L, tensor=b) def J(self, A, x): assemble(self.a, tensor=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