#=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=# # 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())) if config.dimension() == 2: ForcesOutOfPlane = \ advertise(equation.PlaneFluxEquation('Plane_Stress', Stress, 3))
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 )) # Sometimes the finite element stiffness matrix can be made symmetric # by putting the rows (equations) in the same order as the columns # (degrees of freedom). To do this, a correspondence has to be # established between equation components and field components. The # conjugatePair class sets up this correspondence. Each conjugatePair # object specifies that a particular equation component corresponds to # a particular Field component when coupled by a particular *type* of # Property. The Property type is just a string. It appears in the # 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").
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 )) # Sometimes the finite element stiffness matrix can be made symmetric # by putting the rows (equations) in the same order as the columns # (degrees of freedom). To do this, a correspondence has to be # established between equation components and field components. The # conjugatePair class sets up this correspondence. Each conjugatePair # object specifies that a particular equation component corresponds to # a particular Field component when coupled by a particular *type* of # Property. The Property type is just a string. It appears in the # 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").
# 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 ## C = fieldindex.ScalarFieldIndex() DivJd = fieldindex.ScalarFieldIndex() conjugate.conjugatePair("Diffusivity", AtomBalanceEquation, DivJd, Concentration, C) conjugate.conjugatePair("Current", ChargeBalanceEquation, DivJd,