Beispiel #1
0
# PropertyRegistration specification (see below) and it has to be the
# same for all Property classes that play the same physical role (eg, all
# elasticity classes have type "Elasticity").

# If the conjugatePair information is omitted, OOF2 will still run
# properly, but it will not use the more efficient symmetric matrix
# solvers because it will not know how to symmetrize the matrix.

from ooflib.engine import conjugate
from ooflib.SWIG.engine import fieldindex

# Field and Equation components are both specified by instances of
# FieldIndex classes.  A ScalarFieldIndex has only one value.  It's
# only purpose is to make it possible to treat scalar fields the same
# way as other more complicated fields.
fx = fieldindex.ScalarFieldIndex()

conjugate.conjugatePair(
    "Frivolous",                        # the property type
    JamEqn, fx,                         # the equation, and its component
    Strawberry, fx)                     # the field, and its component

fz = fieldindex.OutOfPlaneVectorFieldIndex(2)
conjugate.conjugatePair("Frivolous",
                        OutOfPlaneJam, fz,
                        Strawberry.out_of_plane(), fz)


# A material Property is what connects a Field to a Flux.  Properties
# are almost always defined in C++ code, but their Registrations are
# in Python.
Beispiel #2
0
                            [sigma_zz, sigma_xz, sigma_yz],
                            Displacement.out_of_plane(), [u_zz, u_xz, u_yz])

elif config.dimension() == 3:
    w = fieldindex.VectorFieldIndex(2)
    fz = fieldindex.VectorFieldIndex(2)
    conjugate.conjugatePair("Elasticity", ForceBalanceEquation, [fx, fy, fz],
                            Displacement, [u, v, w])

###############################################################
##
## Heat flux equation
##
## In-plane components, T
##
T = fieldindex.ScalarFieldIndex()
DivJ = fieldindex.ScalarFieldIndex()

conjugate.conjugatePair("ThermalConductivity", HeatBalanceEquation, DivJ,
                        Temperature, T)
## $\nabla \cdot \vec{J}$ is conjugate to T

## out-of-plane components, $\frac{\partial T}{\partial z}$
if config.dimension() == 2:
    T_z = fieldindex.OutOfPlaneVectorFieldIndex(2)
    J_z = fieldindex.OutOfPlaneVectorFieldIndex(2)

    conjugate.conjugatePair("ThermalConductivity", HeatOutOfPlane, J_z,
                            Temperature.out_of_plane(), T_z)
##  $J_{z}$ is conjugate to $\frac{\partial T}{\partial z}$
Beispiel #3
0
ChargeBalanceEquation = problem.advertise(
    equation.DivergenceEquation('Charge_Eqn', Charge_Flux, 1))

if config.dimension() == 2:
    AtomOutOfPlane = problem.advertise(
        equation.PlaneFluxEquation('Plane_Atom_Flux', Atom_Flux, 1))
    ChargeOutOfPlane = problem.advertise(
        equation.PlaneFluxEquation('Plane_Charge_Flux', Charge_Flux, 1))

##
## Atom flux equation
##
## In-plane components, C
##
C = fieldindex.ScalarFieldIndex()
DivJd = fieldindex.ScalarFieldIndex()

conjugate.conjugatePair("Diffusivity", AtomBalanceEquation, DivJd,
                        Concentration, C)

conjugate.conjugatePair("Current", ChargeBalanceEquation, DivJd,
                        problem.Voltage, C)

## $\nabla \cdot \vec{Jd}$ is conjugate to C

## out-of-plane components, $\frac{\partial C}{\partial z}$
if config.dimension() == 2:
    C_z = fieldindex.OutOfPlaneVectorFieldIndex(2)
    Jd_z = fieldindex.OutOfPlaneVectorFieldIndex(2)