sympde.topology package

Submodules

sympde.topology.analytical_mapping module

class sympde.topology.analytical_mapping.AffineMapping(name, dim=None, **kwargs)[source]

Bases: Mapping

Represents a 1D/2D/3D Affine Mapping object.

Examples

default_assumptions = {'commutative': True}
is_commutative = True
class sympde.topology.analytical_mapping.CollelaMapping2D(name, dim=None, **kwargs)[source]

Bases: Mapping

Represents a Collela 2D Mapping object.

default_assumptions = {'commutative': True}
is_commutative = True
class sympde.topology.analytical_mapping.CzarnyMapping(name, dim=None, **kwargs)[source]

Bases: Mapping

Represents a Czarny 2D Mapping object.

Examples

default_assumptions = {'commutative': True}
is_commutative = True
class sympde.topology.analytical_mapping.IdentityMapping(name, dim=None, **kwargs)[source]

Bases: Mapping

Represents an identity 1D/2D/3D Mapping object.

Examples

default_assumptions = {'commutative': True}
is_commutative = True
class sympde.topology.analytical_mapping.PolarMapping(name, dim=None, **kwargs)[source]

Bases: Mapping

Represents a Polar 2D Mapping object (Annulus).

Examples

default_assumptions = {'commutative': True}
is_commutative = True
class sympde.topology.analytical_mapping.SphericalMapping(name, dim=None, **kwargs)[source]

Bases: Mapping

Parametrization of a sphere (or a portion of it) using spherical coordinates (x1, x2, x3) = (r, theta, phi), where:

  • radius r >= 0

  • inclination 0 <= theta <= pi

  • azimuth 0 <= phi < 2 pi

default_assumptions = {'commutative': True}
is_commutative = True
class sympde.topology.analytical_mapping.TargetMapping(name, dim=None, **kwargs)[source]

Bases: Mapping

Represents a Target 2D Mapping object.

Examples

default_assumptions = {'commutative': True}
is_commutative = True
class sympde.topology.analytical_mapping.TorusMapping(name, dim=None, **kwargs)[source]

Bases: Mapping

Parametrization of a torus (or a portion of it) of major radius R0, using toroidal coordinates (x1, x2, x3) = (r, theta, phi), where:

  • minor radius 0 <= r < R0

  • poloidal angle 0 <= theta < 2 pi

  • toroidal angle 0 <= phi < 2 pi

default_assumptions = {'commutative': True}
is_commutative = True
class sympde.topology.analytical_mapping.TorusSurfaceMapping(name, dim=None, **kwargs)[source]

Bases: Mapping

3D surface obtained by “slicing” the torus above at r = a. The parametrization uses the coordinates (x1, x2) = (theta, phi), where:

  • poloidal angle 0 <= theta < 2 pi

  • toroidal angle 0 <= phi < 2 pi

default_assumptions = {'commutative': True}
is_commutative = True
class sympde.topology.analytical_mapping.TwistedTargetMapping(name, dim=None, **kwargs)[source]

Bases: Mapping

3D volume obtained by “extruding” the TwistedTargetSurfaceMapping along z.

default_assumptions = {'commutative': True}
is_commutative = True
class sympde.topology.analytical_mapping.TwistedTargetSurfaceMapping(name, dim=None, **kwargs)[source]

Bases: Mapping

3D surface obtained by “twisting” the TargetMapping out of the (x, y) plane

default_assumptions = {'commutative': True}
is_commutative = True

sympde.topology.basic module

class sympde.topology.basic.BasicDomain(*args)[source]

Bases: Basic

property coordinates
default_assumptions = {}
property dim
property name
class sympde.topology.basic.Boundary(name, domain, axis=None, ext=None, mapping=None, logical_domain=None)[source]

Bases: BasicDomain

Represents an undefined boundary over a domain.

Examples

property adjacent_boundaries
property axis
default_assumptions = {}
property dim
property domain
property ext
join(boundary, ornt=None)[source]
property logical_domain
property mapping
property name
rotate(*directions)[source]
todict()[source]
class sympde.topology.basic.Connectivity(data=None)[source]

Bases: Mapping

property interfaces
property patches
todict()[source]
class sympde.topology.basic.CornerBoundary(*boundaries)[source]

Bases: BasicDomain

Represents an undefined corner over a domain in 2D.

property boundaries
property coordinates
default_assumptions = {}
property domain
property logical_domain
class sympde.topology.basic.CornerInterface(*corners)[source]

Bases: BasicDomain

Represents a shared corner over multiple patches in 2D.

property corners
default_assumptions = {}
property logical_domain
class sympde.topology.basic.Edge(name)[source]

Bases: object

property name
class sympde.topology.basic.Interface(name, bnd_minus, bnd_plus, *, mapping=None, logical_domain=None, ornt=None)[source]

Bases: BasicDomain

Represents an interface between two subdomains through two boundaries.

Parameters

namestr

Name of the interface.

bnd_minusBoundary

Boundary on the “minus” side of the interface.

bnd_plusBoundary

Boundary on the “plus” side of the interface.

mappingMapping, optional

Mapping from the logical domain to the physical domain, if available.

logical_domainBasicDomain, optional

Logical domain associated with the interface, if available. It should be consistent with the mapping if provided.

orntint | Iterable[int], optional

Orientation of the interface. For 1D interfaces, this is not needed and should be set to None. For 2D interfaces, this should be either -1 or 1. For 3D interfaces, this should be a tuple of three integers, each being either -1 or 1.

Notes

The orientations are specified in the same manner as in GeoPDES, see e.g. <https://github.com/rafavzqz/geopdes/blob/master/geopdes/doc/geo_specs_mp_v21.txt#L193-L237> and T. Dokken, E. Quak, V. Skytt. Requirements from Isogeometric Analysis for changes in product design ontologies, 2010.

property axis
default_assumptions = {}
property dim
property logical_domain
property mapping
property minus
property name
property ornt
property plus
class sympde.topology.basic.InteriorDomain(name, dim=None, dtype=None, mapping=None, logical_domain=None)[source]

Bases: BasicDomain

Represents an undefined interior domain.

Examples

default_assumptions = {}
property dim
property dtype
property logical_domain
property mapping
property name
property target
todict()[source]
class sympde.topology.basic.Interval(name=None, coordinate=None, bounds=None)[source]

Bases: InteriorDomain

Represents a 1D interval.

Examples

property bounds
default_assumptions = {}
property name
class sympde.topology.basic.ProductDomain(*args, name=None)[source]

Bases: BasicDomain

default_assumptions = {}
property domains
class sympde.topology.basic.Union(*args)[source]

Bases: BasicDomain

as_tuple()[source]
complement(arg)[source]
property coordinates
default_assumptions = {}
property dim
todict()[source]

sympde.topology.callable_mapping module

class sympde.topology.callable_mapping.CallableMapping(mapping, **kwargs)[source]

Bases: BasicCallableMapping

jacobian(*eta)[source]

Compute Jacobian matrix at location eta.

jacobian_inv(*eta)[source]

Compute the inverse Jacobian matrix, if possible.

property ldim

Number of logical/parametric dimensions in mapping (= number of eta components).

metric(*eta)[source]

Compute components of metric tensor at location eta.

metric_det(*eta)[source]

Compute determinant of metric tensor at location eta.

property params
property pdim

Number of physical dimensions in mapping (= number of x components).

property symbolic_mapping

sympde.topology.datatype module

class sympde.topology.datatype.H1RegularityType[source]

Bases: RegularityType

default_assumptions = {}
class sympde.topology.datatype.H1SpaceType[source]

Bases: SpaceType

default_assumptions = {}
name = 'h1'
class sympde.topology.datatype.HcurlRegularityType[source]

Bases: RegularityType

default_assumptions = {}
class sympde.topology.datatype.HcurlSpaceType[source]

Bases: SpaceType

default_assumptions = {}
name = 'hcurl'
class sympde.topology.datatype.HdivRegularityType[source]

Bases: RegularityType

default_assumptions = {}
class sympde.topology.datatype.HdivSpaceType[source]

Bases: SpaceType

default_assumptions = {}
name = 'hdiv'
class sympde.topology.datatype.L2RegularityType[source]

Bases: RegularityType

default_assumptions = {}
class sympde.topology.datatype.L2SpaceType[source]

Bases: SpaceType

default_assumptions = {}
name = 'l2'
class sympde.topology.datatype.RegularityType[source]

Bases: Basic

Base class representing the regularity of a space of functions

default_assumptions = {}
property index
property name
class sympde.topology.datatype.SpaceType[source]

Bases: Basic

Base class representing function space types

default_assumptions = {}
class sympde.topology.datatype.UndefinedSpaceType[source]

Bases: SpaceType

default_assumptions = {}
name = 'undefined'

sympde.topology.derivatives module

class sympde.topology.derivatives.BracketBasic(*args)[source]

Bases: CalculusFunction

default_assumptions = {}
class sympde.topology.derivatives.Bracket_2d(*_args)[source]

Bases: BracketBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
name = 'Bracket'
nargs = Naturals0
class sympde.topology.derivatives.CrossBasic(*args)[source]

Bases: CalculusFunction

default_assumptions = {}
name = 'Cross'
nargs = Naturals0
class sympde.topology.derivatives.Cross_2d(*_args)[source]

Bases: CrossBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.Cross_3d(*_args)[source]

Bases: CrossBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.CurlBasic(*args)[source]

Bases: CalculusFunction

default_assumptions = {}
name = 'Curl'
nargs = Naturals0
class sympde.topology.derivatives.Curl_2d(*_args)[source]

Bases: CurlBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.Curl_3d(*_args)[source]

Bases: CurlBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.DifferentialOperator(expr)[source]

Bases: LinearOperator

This class is a linear operator that applies the Leibniz formula

Parameters

exprExpr

expr represents a Sympy expression

coordinate = None
default_assumptions = {'commutative': True}
classmethod eval(expr)[source]

.

is_commutative = True
logical = None
class sympde.topology.derivatives.DivBasic(*args)[source]

Bases: CalculusFunction

default_assumptions = {}
name = 'Div'
nargs = Naturals0
class sympde.topology.derivatives.Div_1d(*_args)[source]

Bases: DivBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.Div_2d(*_args)[source]

Bases: DivBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.Div_3d(*_args)[source]

Bases: DivBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.DotBasic(*args)[source]

Bases: CalculusFunction

default_assumptions = {}
name = 'Dot'
nargs = Naturals0
class sympde.topology.derivatives.Dot_1d(*_args)[source]

Bases: DotBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.Dot_2d(*_args)[source]

Bases: DotBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.Dot_3d(*_args)[source]

Bases: DotBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.GradBasic(*args)[source]

Bases: CalculusFunction

default_assumptions = {}
name = 'Grad'
nargs = Naturals0
class sympde.topology.derivatives.Grad_1d(*_args)[source]

Bases: GradBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.Grad_2d(*_args)[source]

Bases: GradBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.Grad_3d(*_args)[source]

Bases: GradBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.HessianBasic(*args)[source]

Bases: CalculusFunction

default_assumptions = {}
name = 'Hessian'
nargs = Naturals0
class sympde.topology.derivatives.Hessian_1d(*_args)[source]

Bases: HessianBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.Hessian_2d(*_args)[source]

Bases: HessianBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.Hessian_3d(*_args)[source]

Bases: HessianBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.LaplaceBasic(*args)[source]

Bases: CalculusFunction

default_assumptions = {}
name = 'Laplace'
nargs = Naturals0
class sympde.topology.derivatives.Laplace_1d(*_args)[source]

Bases: LaplaceBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.Laplace_2d(*_args)[source]

Bases: LaplaceBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.Laplace_3d(*_args)[source]

Bases: LaplaceBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.LogicalBracket_2d(*_args)[source]

Bases: BracketBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
name = 'Bracket'
nargs = Naturals0
class sympde.topology.derivatives.LogicalCurl_2d(*_args)[source]

Bases: CurlBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.LogicalCurl_3d(*_args)[source]

Bases: CurlBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.LogicalDiv_1d(*_args)[source]

Bases: DivBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.LogicalDiv_2d(*_args)[source]

Bases: DivBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.LogicalDiv_3d(*_args)[source]

Bases: DivBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.LogicalGrad_1d(*_args)[source]

Bases: GradBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.LogicalGrad_2d(*_args)[source]

Bases: GradBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.LogicalGrad_3d(*_args)[source]

Bases: GradBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.LogicalHessian_1d(*_args)[source]

Bases: HessianBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.LogicalHessian_2d(*_args)[source]

Bases: HessianBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.LogicalHessian_3d(*_args)[source]

Bases: HessianBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.LogicalLaplace_1d(*_args)[source]

Bases: LaplaceBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.LogicalLaplace_2d(*_args)[source]

Bases: LaplaceBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.LogicalLaplace_3d(*_args)[source]

Bases: LaplaceBasic

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
class sympde.topology.derivatives.LogicalRot_2d(*_args)[source]

Bases: CalculusFunction

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
name = 'Grad'
nargs = Naturals0
class sympde.topology.derivatives.Rot_2d(*_args)[source]

Bases: CalculusFunction

default_assumptions = {}
classmethod eval(*_args)[source]

Returns a canonical form of cls applied to arguments args.

Explanation

The eval() method is called when the class cls is about to be instantiated and it should return either some simplified instance (possible of some other class), or if the class cls should be unmodified, return None.

Examples of eval() for the function “sign”

@classmethod
def eval(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg.is_zero: return S.Zero
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, Mul):
        coeff, terms = arg.as_coeff_Mul(rational=True)
        if coeff is not S.One:
            return cls(coeff) * cls(terms)
name = 'Grad'
nargs = Naturals0
class sympde.topology.derivatives.dx(expr)[source]

Bases: DifferentialOperator

coordinate = 'x'
default_assumptions = {'commutative': True}
grad_index = 0
is_commutative = True
class sympde.topology.derivatives.dx1(expr)[source]

Bases: DifferentialOperator

coordinate = 'x1'
default_assumptions = {'commutative': True}
grad_index = 0
is_commutative = True
logical = True
class sympde.topology.derivatives.dx2(expr)[source]

Bases: DifferentialOperator

coordinate = 'x2'
default_assumptions = {'commutative': True}
grad_index = 1
is_commutative = True
logical = True
class sympde.topology.derivatives.dx3(expr)[source]

Bases: DifferentialOperator

coordinate = 'x3'
default_assumptions = {'commutative': True}
grad_index = 2
is_commutative = True
logical = True
class sympde.topology.derivatives.dy(expr)[source]

Bases: DifferentialOperator

coordinate = 'y'
default_assumptions = {'commutative': True}
grad_index = 1
is_commutative = True
class sympde.topology.derivatives.dz(expr)[source]

Bases: DifferentialOperator

coordinate = 'z'
default_assumptions = {'commutative': True}
grad_index = 2
is_commutative = True
sympde.topology.derivatives.find_partial_derivatives(expr)[source]

returns all partial derivative expressions

sympde.topology.derivatives.get_atom_derivatives(expr)[source]
sympde.topology.derivatives.get_atom_logical_derivatives(expr)[source]
sympde.topology.derivatives.get_index_derivatives(expr)[source]
sympde.topology.derivatives.get_index_derivatives_atom(expr, atom, verbose=False)[source]

This function return a dictionary of partial derivative indices for a given atom. it must be called after atomizing the expression.

sympde.topology.derivatives.get_index_logical_derivatives(expr)[source]
sympde.topology.derivatives.get_index_logical_derivatives_atom(expr, atom, verbose=False)[source]

This function return a dictionary of partial derivative indices for a given atom. it must be called after atomizing the expression.

sympde.topology.derivatives.get_max_logical_partial_derivatives(expr, F=None)[source]
sympde.topology.derivatives.get_max_partial_derivatives(expr, F=None)[source]
sympde.topology.derivatives.get_number_derivatives(expr)[source]

returns the number of partial derivatives in expr. this is still an experimental version, and it assumes that expr is of the form d(a) where a is a single atom.

sympde.topology.derivatives.sort_partial_derivatives(expr)[source]

returns the partial derivatives of an expression, sorted.

sympde.topology.domain module

class sympde.topology.domain.Area(*args)[source]

Bases: BasicGeometryOperator

default_assumptions = {}
classmethod eval(*args)[source]

.

class sympde.topology.domain.BasicArea(domain)[source]

Bases: AtomicExpr

default_assumptions = {}
property domain
class sympde.topology.domain.BasicGeometryOperator(*args)[source]

Bases: CalculusFunction

default_assumptions = {}
class sympde.topology.domain.BoundaryVector(label, shape=None, *, offset=0, strides=None, **kw_args)[source]

Bases: IndexedBase

default_assumptions = {'algebraic': False, 'commutative': False, 'complex': False, 'composite': False, 'even': False, 'extended_negative': False, 'extended_nonnegative': False, 'extended_nonpositive': False, 'extended_nonzero': False, 'extended_positive': False, 'extended_real': False, 'imaginary': False, 'integer': False, 'irrational': False, 'negative': False, 'noninteger': False, 'nonnegative': False, 'nonpositive': False, 'nonzero': False, 'odd': False, 'positive': False, 'prime': False, 'rational': False, 'real': False, 'transcendental': False, 'zero': False}
is_algebraic = False
is_commutative = False
is_complex = False
is_composite = False
is_even = False
is_extended_negative = False
is_extended_nonnegative = False
is_extended_nonpositive = False
is_extended_nonzero = False
is_extended_positive = False
is_extended_real = False
is_imaginary = False
is_integer = False
is_irrational = False
is_negative = False
is_noninteger = False
is_nonnegative = False
is_nonpositive = False
is_nonzero = False
is_odd = False
is_positive = False
is_prime = False
is_rational = False
is_real = False
is_transcendental = False
is_zero = False
class sympde.topology.domain.Cube(name='Cube', bounds1=(0, 1), bounds2=(0, 1), bounds3=(0, 1))[source]

Bases: NCube

property bounds1
property bounds2
property bounds3
default_assumptions = {}
class sympde.topology.domain.Domain(name: str, *, interiors: TypeUnion[Iterable[InteriorDomain], InteriorDomain, None] = None, boundaries: TypeUnion[Iterable[Boundary], Boundary, None] = None, dim: int | None = None, connectivity: Connectivity | None = None, mapping: Mapping | None = None, logical_domain: Domain | None = None)[source]

Bases: BasicDomain

Represents an undefined domain. A domain is defined by at least one interior domain and possible boundaries. A domain without a boundary is either infinite or periodic. A domain can also be constructed from a connectivity, in which case, only the name and connectivity need to be passed.

property boundary: Union | Boundary

Either a Union object containing the boundaries or just a boundary if there is only one

property connectivity: Connectivity

Contains information about the interfaces

property corners
default_assumptions = {}
property dim: int

Dimension of the space

property dtype: dict

Dictionary containing information about domain

export(filename)[source]
classmethod from_file(filename)[source]

Read the “topology.yml” portion of an HDF5 geometry file and create a (mapped) multipatch domain using the information therein.

Parameters

filenamestr

Name of the HDF5 geometry file to be read.

Returns

Domain

Multipatch domain.

get_boundary(axis, ext)[source]

Return the domain boundary at the given extremity of the required axis.

Parameters

axisint | None

Index of the coordinate (0 <= axis < ndim) which has constant value at the boundary. In 1D passing axis=None is accepted, in which case it is interpreted as 0.

ext{-1, +1}
Extremity identifier:
  • If -1, the boundary is at the minimum value of $x_{axis}$

  • If +1, the boundary is at the maximum value of $x_{axis}$

Returns

Boundary (from sympde.topology.basic)

The domain boundary of interest.

get_interface(domain1, domain2)[source]
get_interior(name)[source]

return interior by name.

get_shared_corners()[source]

Compute the corners shared by multiple patches in 2D

get_subdomain(names)[source]

Returns an individual patch or a Union of patches of a multipatch domain.

Parameters

namestuple of str or str

Names of the patches to join. If a string is given, the corresponding patch will be returned. If a tuple of strings is given, the Union of the corresponding subdomains will be returned.

Notes

The subdomain is returned as it was before being joined, which means that its boundary includes the boundaries that are part of an interface in the multipatch domain.

property interfaces: Union | Interface | None

Union of the interfaces

The Union constructor is applied to the interfaces. If there is only one interface it returns the interface object and None if there is no interface.

property interior: Union | InteriorDomain

Either a Union object containing the interiors or just the interior domain if there is only one

property interior_names: List[str]
classmethod join(patches, connectivity, name)[source]

Create a multipatch domain by joining patches in 2D or 3D.

Parameters

patchessequence of Domain

Atomic patches in the joined domain.

connectivitysequence of tuple

Interface descriptions of the form (minus, plus, orientation). Each side is (patch, axis, ext), where patch is a patch object or its index in patches and ext is -1 or 1. A 2D orientation is -1 or 1. A 3D orientation is a tuple of three values, each equal to -1 or 1.

namestr

Name of the domain.

Returns

Domain

Multipatch domain.

Notes

The orientations are specified in the same manner as in GeoPDES, see e.g. <https://github.com/rafavzqz/geopdes/blob/master/geopdes/doc/geo_specs_mp_v21.txt#L193-L237> and T. Dokken, E. Quak, V. Skytt. Requirements from Isogeometric Analysis for changes in product design ontologies, 2010.

Example

# list of patches (mapped domains)
Omega_0 = F0(A)
Omega_1 = F1(A)
Omega_2 = F2(A)
Omega_3 = F3(A)

patches = [Omega_0, Omega_1, Omega_2, Omega_3]

# integers representing the axes
axis_0 = 0
axis_1 = 1
axis_2 = 2

# integers representing the extremities: left (-1) or right (+1)
ext_0 = -1
ext_1 = +1

# A connectivity list in 2D
connectivity = [((Omega_0, axis_0, ext_0), (Omega_1, axis_0, ext_1),  1),
                ((Omega_1, axis_1, ext_0), (Omega_3, axis_1, ext_1), -1),
                ((Omega_0, axis_1, ext_0), (Omega_2, axis_1, ext_1),  1),
                ((Omega_2, axis_0, ext_0), (Omega_3, axis_0, ext_1), -1)]

# alternative option (passing interface patches by their indices in the patches list):
connectivity = [((0, axis_0, ext_0), (1, axis_0, ext_1),  1),
                ((1, axis_1, ext_0), (3, axis_1, ext_1), -1),
                ((0, axis_1, ext_0), (2, axis_1, ext_1),  1),
                ((2, axis_0, ext_0), (3, axis_0, ext_1), -1)]

# A connectivity list in 3D
connectivity = [((Omega_0, axis_0, ext_1), (Omega_1, axis_0, ext_0), ( 1,  1,  1)),
                ((Omega_0, axis_1, ext_1), (Omega_2, axis_1, ext_0), ( 1, -1,  1)),
                ((Omega_1, axis_1, ext_1), (Omega_3, axis_1, ext_0), (-1,  1, -1)),
                ((Omega_2, axis_0, ext_1), (Omega_3, axis_0, ext_0), (-1,  1,  1))]

# alternative option (passing interface patches by their indices in the patches list):
connectivity = [((0, axis_0, ext_1), (1, axis_0, ext_0), ( 1,  1,  1)),
                ((0, axis_1, ext_1), (2, axis_1, ext_0), ( 1, -1,  1)),
                ((1, axis_1, ext_1), (3, axis_1, ext_0), (-1,  1, -1)),
                ((2, axis_0, ext_1), (3, axis_0, ext_0), (-1,  1,  1))]

# the multi-patch domain
Omega = Domain.join(patches=patches, connectivity=connectivity, name='Omega')
property logical_domain: Domain

The domain is the image of the logical_domain under the mapping

property mapping: Mapping | None

The mapping that maps the logical domain to the physical domain

property mappings: OrderedDict
property name: str
set_interfaces(*interfaces)[source]
property subdomains: tuple

returns subdomains as tuple of Domains

todict()[source]
class sympde.topology.domain.DomainArea(domain)[source]

Bases: BasicArea

default_assumptions = {}
class sympde.topology.domain.ElementArea(domain)[source]

Bases: BasicArea

default_assumptions = {}
class sympde.topology.domain.ElementDomain[source]

Bases: Basic

default_assumptions = {}
class sympde.topology.domain.Line(name='Line', bounds=(0, 1))[source]

Bases: NCube

property bounds
default_assumptions = {}
class sympde.topology.domain.MinusNormalVector(label, shape=None, *, offset=0, strides=None, **kw_args)[source]

Bases: NormalVector

default_assumptions = {'algebraic': False, 'commutative': False, 'complex': False, 'composite': False, 'even': False, 'extended_negative': False, 'extended_nonnegative': False, 'extended_nonpositive': False, 'extended_nonzero': False, 'extended_positive': False, 'extended_real': False, 'imaginary': False, 'integer': False, 'irrational': False, 'negative': False, 'noninteger': False, 'nonnegative': False, 'nonpositive': False, 'nonzero': False, 'odd': False, 'positive': False, 'prime': False, 'rational': False, 'real': False, 'transcendental': False, 'zero': False}
is_algebraic = False
is_commutative = False
is_complex = False
is_composite = False
is_even = False
is_extended_negative = False
is_extended_nonnegative = False
is_extended_nonpositive = False
is_extended_nonzero = False
is_extended_positive = False
is_extended_real = False
is_imaginary = False
is_integer = False
is_irrational = False
is_negative = False
is_noninteger = False
is_nonnegative = False
is_nonpositive = False
is_nonzero = False
is_odd = False
is_positive = False
is_prime = False
is_rational = False
is_real = False
is_transcendental = False
is_zero = False
class sympde.topology.domain.NCube(name, dim, min_coords, max_coords)[source]

Bases: Domain

default_assumptions = {}
classmethod from_file(filename)[source]

Read the “topology.yml” portion of an HDF5 geometry file and create a (mapped) multipatch domain using the information therein.

Parameters

filenamestr

Name of the HDF5 geometry file to be read.

Returns

Domain

Multipatch domain.

property max_coords
property min_coords
class sympde.topology.domain.NCubeInterior(name, dim=None, dtype=None, min_coords=None, max_coords=None, mapping=None, logical_domain=None)[source]

Bases: InteriorDomain

property boundary
default_assumptions = {}
get_boundary(axis=None, ext=None)[source]

return boundary by (axis, ext).

property max_coords
property min_coords
class sympde.topology.domain.NormalVector(label, shape=None, *, offset=0, strides=None, **kw_args)[source]

Bases: BoundaryVector

default_assumptions = {'algebraic': False, 'commutative': False, 'complex': False, 'composite': False, 'even': False, 'extended_negative': False, 'extended_nonnegative': False, 'extended_nonpositive': False, 'extended_nonzero': False, 'extended_positive': False, 'extended_real': False, 'imaginary': False, 'integer': False, 'irrational': False, 'negative': False, 'noninteger': False, 'nonnegative': False, 'nonpositive': False, 'nonzero': False, 'odd': False, 'positive': False, 'prime': False, 'rational': False, 'real': False, 'transcendental': False, 'zero': False}
is_algebraic = False
is_commutative = False
is_complex = False
is_composite = False
is_even = False
is_extended_negative = False
is_extended_nonnegative = False
is_extended_nonpositive = False
is_extended_nonzero = False
is_extended_positive = False
is_extended_real = False
is_imaginary = False
is_integer = False
is_irrational = False
is_negative = False
is_noninteger = False
is_nonnegative = False
is_nonpositive = False
is_nonzero = False
is_odd = False
is_positive = False
is_prime = False
is_rational = False
is_real = False
is_transcendental = False
is_zero = False
class sympde.topology.domain.PeriodicDomain(*args)[source]

Bases: BasicDomain

property boundary
property coordinates
default_assumptions = {}
property dim
property domain
property periods
class sympde.topology.domain.PlusNormalVector(label, shape=None, *, offset=0, strides=None, **kw_args)[source]

Bases: NormalVector

default_assumptions = {'algebraic': False, 'commutative': False, 'complex': False, 'composite': False, 'even': False, 'extended_negative': False, 'extended_nonnegative': False, 'extended_nonpositive': False, 'extended_nonzero': False, 'extended_positive': False, 'extended_real': False, 'imaginary': False, 'integer': False, 'irrational': False, 'negative': False, 'noninteger': False, 'nonnegative': False, 'nonpositive': False, 'nonzero': False, 'odd': False, 'positive': False, 'prime': False, 'rational': False, 'real': False, 'transcendental': False, 'zero': False}
is_algebraic = False
is_commutative = False
is_complex = False
is_composite = False
is_even = False
is_extended_negative = False
is_extended_nonnegative = False
is_extended_nonpositive = False
is_extended_nonzero = False
is_extended_positive = False
is_extended_real = False
is_imaginary = False
is_integer = False
is_irrational = False
is_negative = False
is_noninteger = False
is_nonnegative = False
is_nonpositive = False
is_nonzero = False
is_odd = False
is_positive = False
is_prime = False
is_rational = False
is_real = False
is_transcendental = False
is_zero = False
class sympde.topology.domain.Square(name='Square', bounds1=(0, 1), bounds2=(0, 1))[source]

Bases: NCube

property bounds1
property bounds2
default_assumptions = {}
class sympde.topology.domain.TangentVector(label, shape=None, *, offset=0, strides=None, **kw_args)[source]

Bases: BoundaryVector

default_assumptions = {'algebraic': False, 'commutative': False, 'complex': False, 'composite': False, 'even': False, 'extended_negative': False, 'extended_nonnegative': False, 'extended_nonpositive': False, 'extended_nonzero': False, 'extended_positive': False, 'extended_real': False, 'imaginary': False, 'integer': False, 'irrational': False, 'negative': False, 'noninteger': False, 'nonnegative': False, 'nonpositive': False, 'nonzero': False, 'odd': False, 'positive': False, 'prime': False, 'rational': False, 'real': False, 'transcendental': False, 'zero': False}
is_algebraic = False
is_commutative = False
is_complex = False
is_composite = False
is_even = False
is_extended_negative = False
is_extended_nonnegative = False
is_extended_nonpositive = False
is_extended_nonzero = False
is_extended_positive = False
is_extended_real = False
is_imaginary = False
is_integer = False
is_irrational = False
is_negative = False
is_noninteger = False
is_nonnegative = False
is_nonpositive = False
is_nonzero = False
is_odd = False
is_positive = False
is_prime = False
is_rational = False
is_real = False
is_transcendental = False
is_zero = False
sympde.topology.domain.split(domain, value)[source]

sympde.topology.mapping module

class sympde.topology.mapping.BasicCallableMapping[source]

Bases: ABC

Transformation of coordinates, which can be evaluated.

F: R^l -> R^p F(eta) = x

with l <= p

abstract jacobian(*eta)[source]

Compute Jacobian matrix at location eta.

abstract jacobian_inv(*eta)[source]

Compute inverse Jacobian matrix at location eta. An exception should be raised if the matrix is singular.

abstract property ldim

Number of logical/parametric dimensions in mapping (= number of eta components).

abstract metric(*eta)[source]

Compute components of metric tensor at location eta.

abstract metric_det(*eta)[source]

Compute determinant of metric tensor at location eta.

abstract property pdim

Number of physical dimensions in mapping (= number of x components).

class sympde.topology.mapping.Contravariant(F, v)[source]

Bases: MappingApplication

Examples

default_assumptions = {}
classmethod eval(F, v)[source]

This class methods computes the contravariant transformation

Parameters

F: Mapping

mapping object

v: <tuple|list|Tuple|ImmutableDenseMatrix|Matrix>

the basis function

Returns

exprTuple

the contravariant transformation

class sympde.topology.mapping.Covariant(F, v)[source]

Bases: MappingApplication

Examples

default_assumptions = {}
classmethod eval(F, v)[source]

This class methods computes the covariant transformation

Parameters

F: Mapping

mapping object

v: <tuple|list|Tuple|ImmutableDenseMatrix|Matrix>

the basis function

Returns

exprTuple

the covariant transformation

class sympde.topology.mapping.InterfaceMapping(minus, plus)[source]

Bases: Mapping

InterfaceMapping is used to represent a mapping in the interface.

Attributes

minusMapping

the mapping on the negative direction of the interface

plusMapping

the mapping on the positive direction of the interface

default_assumptions = {'commutative': True}
property is_analytical
is_commutative = True
property minus
property plus
class sympde.topology.mapping.InverseMapping(mapping)[source]

Bases: Mapping

default_assumptions = {'commutative': True}
is_commutative = True
class sympde.topology.mapping.Jacobian(F)[source]

Bases: MappingApplication

This class calculates the Jacobian of a mapping F where [J_{F}]_{i,j} = frac{partial F_{i}}{partial x_{j}} or simply J_{F} = (nabla F)^T

default_assumptions = {}
classmethod eval(F)[source]

this class methods computes the jacobian of a mapping

Parameters

F: Mapping

mapping object

Returns

exprImmutableDenseMatrix

the jacobian matrix

class sympde.topology.mapping.JacobianInverseSymbol(mapping, axis=None)[source]

Bases: MatrixSymbolicExpr

property axis
default_assumptions = {'algebraic': False, 'commutative': False, 'complex': False, 'composite': False, 'even': False, 'extended_negative': False, 'extended_nonnegative': False, 'extended_nonpositive': False, 'extended_nonzero': False, 'extended_positive': False, 'extended_real': False, 'imaginary': False, 'integer': False, 'irrational': False, 'negative': False, 'noninteger': False, 'nonnegative': False, 'nonpositive': False, 'nonzero': False, 'odd': False, 'positive': False, 'prime': False, 'rational': False, 'real': False, 'transcendental': False, 'zero': False}
is_Matrix = False
is_algebraic = False
is_commutative = False
is_complex = False
is_composite = False
is_even = False
is_extended_negative = False
is_extended_nonnegative = False
is_extended_nonpositive = False
is_extended_nonzero = False
is_extended_positive = False
is_extended_real = False
is_imaginary = False
is_integer = False
is_irrational = False
is_negative = False
is_noninteger = False
is_nonnegative = False
is_nonpositive = False
is_nonzero = False
is_odd = False
is_positive = False
is_prime = False
is_rational = False
is_real = False
is_transcendental = False
is_zero = False
property mapping
class sympde.topology.mapping.JacobianSymbol(mapping, axis=None)[source]

Bases: MatrixSymbolicExpr

property axis
default_assumptions = {'algebraic': False, 'commutative': False, 'complex': False, 'composite': False, 'even': False, 'extended_negative': False, 'extended_nonnegative': False, 'extended_nonpositive': False, 'extended_nonzero': False, 'extended_positive': False, 'extended_real': False, 'imaginary': False, 'integer': False, 'irrational': False, 'negative': False, 'noninteger': False, 'nonnegative': False, 'nonpositive': False, 'nonzero': False, 'odd': False, 'positive': False, 'prime': False, 'rational': False, 'real': False, 'transcendental': False, 'zero': False}
inv()[source]
is_algebraic = False
is_commutative = False
is_complex = False
is_composite = False
is_even = False
is_extended_negative = False
is_extended_nonnegative = False
is_extended_nonpositive = False
is_extended_nonzero = False
is_extended_positive = False
is_extended_real = False
is_imaginary = False
is_integer = False
is_irrational = False
is_negative = False
is_noninteger = False
is_nonnegative = False
is_nonpositive = False
is_nonzero = False
is_odd = False
is_positive = False
is_prime = False
is_rational = False
is_real = False
is_transcendental = False
is_zero = False
property mapping
class sympde.topology.mapping.LogicalExpr(expr, domain, **options)[source]

Bases: CalculusFunction

default_assumptions = {}
property domain
classmethod eval(expr, domain, **options)[source]

.

property expr
class sympde.topology.mapping.MappedDomain(mapping, logical_domain)[source]

Bases: BasicDomain

.

default_assumptions = {}
class sympde.topology.mapping.Mapping(name, dim=None, **kwargs)[source]

Bases: BasicMapping

Represents a Mapping object.

Examples

property constants
property coordinates
copy()[source]
default_assumptions = {'commutative': True}
property det_jacobian
property expressions
get_callable_mapping()[source]
property is_analytical
is_commutative = True
property is_minus
property is_plus
property jacobian
property jacobian_expr
property jacobian_inv_expr
property ldim
property logical_coordinates
property metric_det_expr
property metric_expr
property name
property pdim
set_callable_mapping(F)[source]
set_plus_minus(**kwargs)[source]
class sympde.topology.mapping.MappingApplication(*args)[source]

Bases: Function

default_assumptions = {}
nargs = Naturals0
class sympde.topology.mapping.MultiPatchMapping(dic)[source]

Bases: Mapping

default_assumptions = {'commutative': True}
property is_analytical
is_commutative = True
property ldim
property mappings
property pdim
class sympde.topology.mapping.PullBack(u, mapping=None)[source]

Bases: Expr

default_assumptions = {'algebraic': False, 'commutative': False, 'complex': False, 'composite': False, 'even': False, 'extended_negative': False, 'extended_nonnegative': False, 'extended_nonpositive': False, 'extended_nonzero': False, 'extended_positive': False, 'extended_real': False, 'imaginary': False, 'integer': False, 'irrational': False, 'negative': False, 'noninteger': False, 'nonnegative': False, 'nonpositive': False, 'nonzero': False, 'odd': False, 'positive': False, 'prime': False, 'rational': False, 'real': False, 'transcendental': False, 'zero': False}
property expr
is_algebraic = False
is_commutative = False
is_complex = False
is_composite = False
is_even = False
is_extended_negative = False
is_extended_nonnegative = False
is_extended_nonpositive = False
is_extended_nonzero = False
is_extended_positive = False
is_extended_real = False
is_imaginary = False
is_integer = False
is_irrational = False
is_negative = False
is_noninteger = False
is_nonnegative = False
is_nonpositive = False
is_nonzero = False
is_odd = False
is_positive = False
is_prime = False
is_rational = False
is_real = False
is_transcendental = False
is_zero = False
property kind

Default kind for all SymPy object. If the kind is not defined for the object, or if the object cannot infer the kind from its arguments, this will be returned.

Examples

>>> from sympy import Expr
>>> Expr().kind
UndefinedKind
property test
class sympde.topology.mapping.SymbolicExpr(*_args, **kwargs)[source]

Bases: CalculusFunction

returns a sympy expression where partial derivatives are converted into sympy Symbols.

default_assumptions = {}
classmethod eval(*_args, **kwargs)[source]

.

class sympde.topology.mapping.SymbolicWeightedVolume(*args)[source]

Bases: Expr

This class represents the symbolic weighted volume of a quadrature rule

default_assumptions = {}
sympde.topology.mapping.get_logical_test_function(u)[source]

sympde.topology.measure module

class sympde.topology.measure.BasicMeasure(*args)[source]

Bases: Basic

default_assumptions = {}
class sympde.topology.measure.CanonicalMeasure(ldim)[source]

Bases: BasicMeasure

Represents a canonical measure.

Examples

property args

Returns a tuple of arguments of ‘self’.

Examples

>>> from sympy import cot
>>> from sympy.abc import x, y
>>> cot(x).args
(x,)
>>> cot(x).args[0]
x
>>> (x*y).args
(x, y)
>>> (x*y).args[1]
y

Notes

Never use self._args, always use self.args. Only use _args in __new__ when creating a new function. Don’t override .args() from Basic (so that it’s easy to change the interface in the future if needed).

default_assumptions = {}
class sympde.topology.measure.CartesianMeasure(ldim)[source]

Bases: BasicMeasure

Represents a cartesian measure.

Examples

property args

Returns a tuple of arguments of ‘self’.

Examples

>>> from sympy import cot
>>> from sympy.abc import x, y
>>> cot(x).args
(x,)
>>> cot(x).args[0]
x
>>> (x*y).args
(x, y)
>>> (x*y).args[1]
y

Notes

Never use self._args, always use self.args. Only use _args in __new__ when creating a new function. Don’t override .args() from Basic (so that it’s easy to change the interface in the future if needed).

default_assumptions = {}
class sympde.topology.measure.Measure(coordinates)[source]

Bases: BasicMeasure

Represents a measure from coordinates.

Examples

property args

Returns a tuple of arguments of ‘self’.

Examples

>>> from sympy import cot
>>> from sympy.abc import x, y
>>> cot(x).args
(x,)
>>> cot(x).args[0]
x
>>> (x*y).args
(x, y)
>>> (x*y).args[1]
y

Notes

Never use self._args, always use self.args. Only use _args in __new__ when creating a new function. Don’t override .args() from Basic (so that it’s easy to change the interface in the future if needed).

default_assumptions = {}

sympde.topology.space module

class sympde.topology.space.BasicFunctionSpace(name, domain, shape, kind)[source]

Bases: Basic

Represents a basic continuous Function space.

Examples

property coordinates
default_assumptions = {}
property domain
property is_broken
property kind

Default kind for all SymPy object. If the kind is not defined for the object, or if the object cannot infer the kind from its arguments, this will be returned.

Examples

>>> from sympy import Expr
>>> Expr().kind
UndefinedKind
property ldim
property name
property regularity
property shape
class sympde.topology.space.Derham(domain, sequence=None)[source]

Bases: object

.

property V0
property V1
property V2
property V3
property domain
property shape
property spaces
class sympde.topology.space.IndexedVectorFunction(base, *args, **kw_args)[source]

Bases: Indexed

Represents a mathematical object with indices.

default_assumptions = {'commutative': True}
property free_symbols

Return from the atoms of self those which are free symbols.

For most expressions, all symbols are free symbols. For some classes this is not true. e.g. Integrals use Symbols for the dummy variables which are bound variables, so Integral has a method to return all symbols except those. Derivative keeps track of symbols with respect to which it will perform a derivative; those are bound variables, too, so it has its own free_symbols method.

Any other method that uses bound variables should implement a free_symbols method.

is_Atom = True
is_Indexed = True
is_commutative = True
is_symbol = True
property ldim
property space
class sympde.topology.space.ProductSpace(*spaces)[source]

Bases: BasicFunctionSpace

Represents a product of continuous Sobolev spaces.

Examples

default_assumptions = {}
property domain
element(name)[source]
property ldim
property name
property shape
property spaces
class sympde.topology.space.Projection(projector, expr)[source]

Bases: AtomicExpr

Represents a projection

Examples

default_assumptions = {}
property expr
property projector
class sympde.topology.space.Projector(space, kind=None)[source]

Bases: Basic

Represents a Projector over a function space.

Examples

default_assumptions = {}
property kind

Default kind for all SymPy object. If the kind is not defined for the object, or if the object cannot infer the kind from its arguments, this will be returned.

Examples

>>> from sympy import Expr
>>> Expr().kind
UndefinedKind
property space
class sympde.topology.space.ScalarFunction(space, name)[source]

Bases: Symbol

Represents a test function as an element of a fem space.

Examples

>>> from sympde.codegen.core import SplineFemSpace
>>> from sympde.codegen.core import ScalarFunction
>>> V = SplineFemSpace('V')
>>> phi = ScalarFunction(V, 'phi')
default_assumptions = {'commutative': True}
duplicate(name)[source]
is_commutative = True
property ldim
name
property projection_of
set_as_projection(expr)[source]
property space
class sympde.topology.space.ScalarFunctionSpace(name, domain, kind=None)[source]

Bases: BasicFunctionSpace

Represents a basic continuous scalar Function space.

default_assumptions = {}
element(name)[source]
class sympde.topology.space.Trace(expr, boundary, order=0, **options)[source]

Bases: AtomicExpr

Represents the trace over a boundary and a space function

property boundary
default_assumptions = {'commutative': None}
classmethod eval(expr, boundary, order)[source]
property expr
is_commutative = None
property order
class sympde.topology.space.VectorFunction(space, name)[source]

Bases: Symbol, IndexedBase

Represents a vector test function as an element of a fem space.

Examples

default_assumptions = {'algebraic': False, 'commutative': False, 'complex': False, 'composite': False, 'even': False, 'extended_negative': False, 'extended_nonnegative': False, 'extended_nonpositive': False, 'extended_nonzero': False, 'extended_positive': False, 'extended_real': False, 'imaginary': False, 'integer': False, 'irrational': False, 'negative': False, 'noninteger': False, 'nonnegative': False, 'nonpositive': False, 'nonzero': False, 'odd': False, 'positive': False, 'prime': False, 'rational': False, 'real': False, 'transcendental': False, 'zero': False}
duplicate(name)[source]
is_algebraic = False
is_commutative = False
is_complex = False
is_composite = False
is_even = False
is_extended_negative = False
is_extended_nonnegative = False
is_extended_nonpositive = False
is_extended_nonzero = False
is_extended_positive = False
is_extended_real = False
is_imaginary = False
is_integer = False
is_irrational = False
is_negative = False
is_noninteger = False
is_nonnegative = False
is_nonpositive = False
is_nonzero = False
is_odd = False
is_positive = False
is_prime = False
is_rational = False
is_real = False
is_transcendental = False
is_zero = False
property ldim
name
property projection_of
set_as_projection(expr)[source]
property shape

Returns the shape of the IndexedBase object.

Examples

>>> from sympy import IndexedBase, Idx
>>> from sympy.abc import x, y
>>> IndexedBase('A', shape=(x, y)).shape
(x, y)

Note: If the shape of the IndexedBase is specified, it will override any shape information given by the indices.

>>> A = IndexedBase('A', shape=(x, y))
>>> B = IndexedBase('B')
>>> i = Idx('i', 2)
>>> j = Idx('j', 1)
>>> A[i, j].shape
(x, y)
>>> B[i, j].shape
(2, 1)
property space
class sympde.topology.space.VectorFunctionSpace(name, domain, kind=None)[source]

Bases: BasicFunctionSpace

Represents a basic continuous vector Function space.

default_assumptions = {}
element(name)[source]
sympde.topology.space.element_of(space, name)[source]

Create a single element of a given space (possibly a ProductSpace).

Parameters

spaceScalarFunctionSpace | VectorFunctionSpace | ProductSpace

Function space from which a single element should be created.

namestr | iterable

If space is ProductSpace, ‘name’ must either be an explicit list of function names, or a single pattern string that will be expanded into such a list. Otherwise, ‘name’ must be a simple string.

Results

resScalarFunction | VectorFunction | iterable

Single element taken from the given space. If space is ProductSpace, an element is a list of functions; otherwise, it is a single function.

sympde.topology.space.elements_of(space, names)[source]

Create multiple elements of same space (possibly a ProductSpace).

Parameters

space : ScalarFunctionSpace | VectorFunctionSpace | ProductSpace

namesstr | iterable

Pattern or list of patterns from which a list of function names is produced.

Results

resiterable

Multiple elements taken from the given space. If space is ProductSpace, each element is a list of functions; otherwise, each element is a single function.

sympde.topology.space.trace_0(x, B)
sympde.topology.space.trace_1(x, B)

Module contents