## ## The 3D displacement vector is (u, v, w), ## where ## u lies along the x-direction, ## v, along the y-direction, ## and w, out-of-the-plane, or along ## the z-direction u = fieldindex.VectorFieldIndex(0) v = fieldindex.VectorFieldIndex(1) fx = fieldindex.VectorFieldIndex(0) fy = fieldindex.VectorFieldIndex(1) if config.dimension() == 2: # fx is conjugate to u and fy is conjugate to v for Elasticity conjugate.conjugatePair("Elasticity", ForceBalanceEquation, [fx, fy], Displacement, [u, v]) ## out-of-plane compoments ## The available out-of-plane components of stress are $\sigma_{zz}, ## \sigma_{zy}, \sigma_{zx}$, in *that* order, (0, 1, 2). The ## out-of-plane displacement is (\frac{\partial u}{\partial z}, ## \frac{\partial v}{partial z}, \frac{\partial w}{\partial z}. u_xz = fieldindex.VectorFieldIndex(0) u_yz = fieldindex.VectorFieldIndex(1) u_zz = fieldindex.VectorFieldIndex(2) sigma_xz = fieldindex.OutOfPlaneSymTensorIndex(2, 0) sigma_yz = fieldindex.OutOfPlaneSymTensorIndex(2, 1) sigma_zz = fieldindex.OutOfPlaneSymTensorIndex(2, 2)
# 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. # Load the module containing the Property subclass code. import fruitSWIG.fruitproperty
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) conjugate.conjugatePair("Diffusivity", AtomOutOfPlane, Jd_z, Concentration.out_of_plane(), C_z) conjugate.conjugatePair("Current", ChargeOutOfPlane, Jd_z, problem.Voltage.out_of_plane(), C_z)
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) conjugate.conjugatePair("Diffusivity", AtomOutOfPlane, Jd_z, Concentration.out_of_plane(), C_z) conjugate.conjugatePair("Current", ChargeOutOfPlane, Jd_z, problem.Voltage.out_of_plane(), C_z)
## ## The 3D displacement vector is (u, v, w), ## where ## u lies along the x-direction, ## v, along the y-direction, ## and w, out-of-the-plane, or along ## the z-direction u = fieldindex.VectorFieldIndex(0) v = fieldindex.VectorFieldIndex(1) fx = fieldindex.VectorFieldIndex(0) fy = fieldindex.VectorFieldIndex(1) if config.dimension() == 2: # fx is conjugate to u and fy is conjugate to v for Elasticity conjugate.conjugatePair("Elasticity", ForceBalanceEquation, [fx, fy], Displacement, [u, v]) ## out-of-plane compoments ## The available out-of-plane components of stress are $\sigma_{zz}, ## \sigma_{zy}, \sigma_{zx}$, in *that* order, (0, 1, 2). The ## out-of-plane displacement is (\frac{\partial u}{\partial z}, ## \frac{\partial v}{partial z}, \frac{\partial w}{\partial z}. u_xz = fieldindex.VectorFieldIndex(0) u_yz = fieldindex.VectorFieldIndex(1) u_zz = fieldindex.VectorFieldIndex(2) sigma_xz = fieldindex.OutOfPlaneSymTensorIndex(2,0) sigma_yz = fieldindex.OutOfPlaneSymTensorIndex(2,1) sigma_zz = fieldindex.OutOfPlaneSymTensorIndex(2,2)