コード例 #1
0
def unitcube_geometry():

    N = 3
    mesh = UnitCubeMesh(mpi_comm_world(), N, N, N)

    ffun = dolfin.MeshFunction("size_t", mesh, 2)
    ffun.set_all(0)

    fixed.mark(ffun, fixed_marker)
    free.mark(ffun, free_marker)

    marker_functions = MarkerFunctions(ffun=ffun)

    # Fibers
    V_f = dolfin.VectorFunctionSpace(mesh, "CG", 1)

    f0 = interpolate(Expression(("1.0", "0.0", "0.0"), degree=1), V_f)
    s0 = interpolate(Expression(("0.0", "1.0", "0.0"), degree=1), V_f)
    n0 = interpolate(Expression(("0.0", "0.0", "1.0"), degree=1), V_f)

    microstructure = Microstructure(f0=f0, s0=s0, n0=n0)

    geometry = Geometry(
        mesh=mesh,
        marker_functions=marker_functions,
        microstructure=microstructure,
    )

    return geometry
コード例 #2
0
def unitcube_geometry():
    N = 2
    mesh = UnitCubeMesh(N, N, N)

    V_f = dolfin.VectorFunctionSpace(mesh, "CG", 1)

    l0 = interpolate(dolfin.Expression(("1.0", "0.0", "0.0"), degree=1), V_f)
    r0 = interpolate(dolfin.Expression(("0.0", "1.0", "0.0"), degree=1), V_f)
    c0 = interpolate(dolfin.Expression(("0.0", "0.0", "1.0"), degree=1), V_f)

    crl_basis = CRLBasis(l0=l0, r0=r0, c0=c0)

    cfun = strain_markers_3d(mesh, 2)

    ffun = dolfin.MeshFunction("size_t", mesh, 2)
    ffun.set_all(0)
    fixed.mark(ffun, fixed_marker)
    free.mark(ffun, free_marker)

    marker_functions = MarkerFunctions(ffun=ffun, cfun=cfun)

    # Fibers
    f0 = interpolate(dolfin.Expression(("1.0", "0.0", "0.0"), degree=1), V_f)
    s0 = interpolate(dolfin.Expression(("0.0", "1.0", "0.0"), degree=1), V_f)
    n0 = interpolate(dolfin.Expression(("0.0", "0.0", "1.0"), degree=1), V_f)

    microstructure = Microstructure(f0=f0, s0=s0, n0=n0)

    geometry = Geometry(
        mesh=mesh,
        marker_functions=marker_functions,
        microstructure=microstructure,
        crl_basis=crl_basis,
    )

    return geometry
コード例 #3
0
ファイル: unit_cube_demo.py プロジェクト: finsberg/pulse
        interpolate,
        Expression,
        UnitCubeMesh,
        Mesh,
    )


import pulse
from fenics_plotly import plot


pulse.iterate.logger.setLevel(10)

# Create mesh
N = 6
mesh = UnitCubeMesh(N, N, N)


# +
# Create subdomains
class Free(dolfin.SubDomain):
    def inside(self, x, on_boundary):
        return x[0] > (1.0 - dolfin.DOLFIN_EPS) and on_boundary


class Fixed(dolfin.SubDomain):
    def inside(self, x, on_boundary):
        return x[0] < dolfin.DOLFIN_EPS and on_boundary


# -
コード例 #4
0
except ImportError:
    from dolfin import (
        UnitCubeMesh,
        Expression,
        Constant,
        DirichletBC,
        interpolate,
        Mesh,
    )

import pulse
from fenics_plotly import plot

# Create mesh
N = 6
mesh = UnitCubeMesh(N, N, N)


# Create subdomains
class Free(dolfin.SubDomain):
    def inside(self, x, on_boundary):
        return x[0] > (1.0 - dolfin.DOLFIN_EPS) and on_boundary


class Fixed(dolfin.SubDomain):
    def inside(self, x, on_boundary):
        return x[0] < dolfin.DOLFIN_EPS and on_boundary


# Create a facet fuction in order to mark the subdomains
ffun = dolfin.MeshFunction("size_t", mesh, 2)