Ejemplo n.º 1
0
from ooflib.SWIG.engine import equation
from ooflib.SWIG.engine import field
from ooflib.SWIG.engine import flux

# Define a new Field.  The available field classes are ScalarField
# (for scalars like Temperature) and TwoVectorField (for vectors like
# Displacement.  The 'Two' in 'TwoVectorField' refers to the number of
# in-plane components.  When OOF gets a third dimension, all
# VectorFields will have three components.)

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
Ejemplo n.º 2
0
        return advertiseField(obj)
    if isinstance(obj, flux.FluxPtr):
        return advertiseFlux(obj)
    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'))
Ejemplo n.º 3
0
# versions of this software, you first contact the authors at
# [email protected].

from ooflib.engine import problem
from ooflib.SWIG.engine import flux
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))