Exemplo n.º 1
0
    if isinstance(obj, equation.EquationPtr):
        return advertiseEquation(obj)
    raise ooferror.ErrPyProgrammingError("Don't know what to do with %s!" %
                                         obj)


#=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=#

# Define a field.  This creates an object named 'Temperature' in the
# OOF namespace.
Temperature = advertise(field.ScalarField('Temperature'))
# Define a flux
Heat_Flux = advertise(flux.VectorFlux('Heat_Flux'))
# And equations
HeatBalanceEquation = advertise(
    equation.DivergenceEquation('Heat_Eqn', Heat_Flux, 1))

if config.dimension() == 2:
    HeatOutOfPlane = advertise(
        equation.PlaneFluxEquation('Plane_Heat_Flux', Heat_Flux, 1))

## this creates the Displacement, Stress, and Force Balance equations
if config.dimension() == 2:
    Displacement = advertise(field.TwoVectorField('Displacement'))
elif config.dimension() == 3:
    Displacement = advertise(field.ThreeVectorField('Displacement'))
Stress = advertise(flux.SymmetricTensorFlux('Stress'))

ForceBalanceEquation = advertise(
    equation.DivergenceEquation('Force_Balance', Stress, config.dimension()))
Exemplo n.º 2
0
# Define a new Flux.  The available classes are VectorFlux (eg,
# HeatFlux, ElectricCurrent) and SymmetricTensorFlux (eg Stress).

Jam = problem.advertise(flux.VectorFlux('Strawberry_Jam'))

# Define a new Divergence Equation.  The equation equates the
# divergence of a given flux with some external forcing terms.  The
# external forces are specified by Material Properties.  The
# relationships between the Fields and the Flux are also given by
# Material Properties (ie, they're not specified here!).

JamEqn = problem.advertise(
    equation.DivergenceEquation(
        'Jam_Eqn',
        Jam,
        1,  # the number of components of the divergence
    ))

# Define a new PlaneFluxEquation.  When this equation is active, it
# specifies that the out-of-plane components of flux are zero.  Note
# that, unlike DivergenceEquation, PlaneFluxEquation is a pure swigged
# class, and can't take python keyword arguments.  See the OOF2 manual
# for more about out-of-plane components.

OutOfPlaneJam = problem.advertise(
    equation.PlaneFluxEquation(
        'Plane_Jam_Eqn',  # name of the equation
        Jam,  # the flux it applies to
        1  # the number of out-of-plane components
    ))
Exemplo n.º 3
0
Strawberry = problem.advertise(field.ScalarField('Strawberry'))

# Define a new Flux.  The available classes are VectorFlux (eg,
# HeatFlux, ElectricCurrent) and SymmetricTensorFlux (eg Stress).

Jam = problem.advertise(flux.VectorFlux('Strawberry_Jam'))

# Define a new Divergence Equation.  The equation equates the
# divergence of a given flux with some external forcing terms.  The
# external forces are specified by Material Properties.  The
# relationships between the Fields and the Flux are also given by
# Material Properties (ie, they're not specified here!).

JamEqn = problem.advertise(equation.DivergenceEquation(
    'Jam_Eqn', 
    Jam,
    1,                      # the number of components of the divergence
    ))


# Define a new PlaneFluxEquation.  When this equation is active, it
# specifies that the out-of-plane components of flux are zero.  Note
# that, unlike DivergenceEquation, PlaneFluxEquation is a pure swigged
# class, and can't take python keyword arguments.  See the OOF2 manual
# for more about out-of-plane components.

OutOfPlaneJam = problem.advertise(equation.PlaneFluxEquation(
    'Plane_Jam_Eqn',                    # name of the equation
    Jam,                                # the flux it applies to
    1                                   # the number of out-of-plane components
    ))
Exemplo n.º 4
0
from ooflib.SWIG.engine import equation
from ooflib.SWIG.engine import field
from ooflib.SWIG.engine import fieldindex
from ooflib.SWIG.common import config
from ooflib.engine import conjugate

# Define a field.  This creates an object named 'Concentration' in the
# OOF namespace.
Concentration = problem.advertise(field.ScalarField('Concentration'))
# Define a flux
Atom_Flux = problem.advertise(flux.VectorFlux('Atom_Flux'))
Charge_Flux = problem.advertise(flux.VectorFlux('Charge_Flux'))

# And equations
AtomBalanceEquation = problem.advertise(
    equation.DivergenceEquation('Atom_Eqn', Atom_Flux, 1))

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
##