Ejemplo n.º 1
0
    def init_geo(self):
        if self.geop.dim == 3:
            generate_mesh(self.solverp.h, geo_name3D, **self.geop)
            geo = geo_from_name(geo_name3D, **self.geop)

            # define cylinders for DNA and side boundaries
            innerdna = Cylinder(R=geo.params["r0"], L=geo.params["l0"])
            outerdna = Cylinder(R=geo.params["r1"], L=geo.params["l0"])
            side = Cylinder(R=geo.params["R"], L=2. * geo.params["Rz"])
            geo.curved = dict(
                innerdnab=innerdna.snap,
                outerdnab=outerdna.snap,
                membranednab=outerdna.snap,
                sideb=side.snap,
                outermembraneb=side.snap,
            )
            # define sphere for molecule
            if self.geop.x0 is not None:
                molec = Sphere(R=geo.params["rMolecule"],
                               center=geo.params["x0"])
                geo.curved.update(moleculeb=molec.snap)

        if self.geop.dim == 2:
            generate_mesh(self.solverp.h, geo_name, **self.geop)
            geo = geo_from_name(geo_name, **self.geop)
            #dolfin.plot(geo.boundaries)
            #dolfin.interactive()
            if self.geop.x0 is not None:
                molec = Circle(geo.params["rMolecule"], geo.params["x0"][::2])
                geo.curved = dict(moleculeb=molec.snap)
        # compatibility with new style physics current
        geo.params["lpore"] = geo.params["l0"]
        self.geo = geo
Ejemplo n.º 2
0
def setup3D(mesh=None, **params):
    # pass mesh argument to prevent mesh regeneration
    global x0
    global geo3D  # to prevent garbage collection of mesh
    globals().update(params)
    if x0 is not None:
        x0 = [round(t, 4) for t in x0]
    geop = geo_params3D(x0, rMolecule, Rx, Ry, lcpore)
    physp = phys_params(bV, Qmol, dnaqsdamp, rMolecule, bulkcon)

    if mesh is None:
        generate_mesh(h3D, geo_name3D, **geop)
        geo = geo_from_name(geo_name3D, **geop)
    else:
        geo = geo_from_name(geo_name3D, mesh=mesh, **geop)

    # define cylinders for inner and outer DNA boundary and side boundary
    innerdna = Cylinder(R=geo.params["r0"], L=geo.params["l0"])
    outerdna = Cylinder(R=geo.params["r1"], L=geo.params["l0"])
    side = Cylinder(R=geo.params["R"], L=2. * geo.params["Rz"])
    # this causes geo to automatically snap boundaries when adapting
    geo.curved = dict(
        innerdnab=innerdna.snap,
        outerdnab=outerdna.snap,
        membranednab=outerdna.snap,
        sideb=side.snap,
        outermembraneb=side.snap,
    )
    # define sphere for molecule
    if x0 is not None:
        molec = Sphere(R=geo.params["rMolecule"], center=geo.params["x0"])
        geo.curved.update(moleculeb=molec.snap)

    phys = Physics(phys_name, geo, **physp)
    #phys.permittivity = {"default": phys.permittivity["water"]}
    return geo, phys
Ejemplo n.º 3
0
w0 = w3D(u=u, p=p)

# 1D visualization
#Rz = geo2D.params["Rz"]
#r0 = geo2D.params["r0"]
#plot1D({"phi (2D)": pb2D.solution}, (-Rz, Rz, 101), "y", dim=2, origin=(r0, 0.))
#plot1D({"phi (2D)": pb2D.solution}, (-Rz, Rz, 101), "y", dim=2, origin=(0., 0.))

# 3D geometry
meshgen_dict = generate_mesh(h, geo_name, **geo_params)
geo = geo_from_name(geo_name, **geo_params)

# define sphere for molecule
molec = Sphere(R=geo.params["rMolecule"], center=geo.params["x0"])
# define cylinders for inner and outer DNA boundary and side boundary
innerdna = Cylinder(R=geo.params["r0"], L=geo.params["l0"])
outerdna = Cylinder(R=geo.params["r1"], L=geo.params["l0"])
side = Cylinder(R=geo.params["R"], L=2. * geo.params["Rz"])
# this causes geo to automatically snap boundaries when adapting
geo.curved = dict(
    moleculeb=molec.snap,
    innerdnab=innerdna.snap,
    outerdnab=outerdna.snap,
    membranednab=outerdna.snap,
    sideb=side.snap,
    outermembraneb=side.snap,
)

phys = Physics("howorka", geo, **phys_params)

IllposedLinearSolver.stab = 1e9
Ejemplo n.º 4
0
    bulk = {"upperb", "lowerb"},
    #nocbc = {"lowerb"},
)

geo2D = domain2D.create_geometry(lc=h2D)
print "Number of cells (2D):", geo2D.mesh.num_cells()
#domain2D.plot()

# --- create 3D geometry by rotating ---
domain3D = rotate_z(domain2D)
geo3D = domain3D.create_geometry(lc=h3D)
print "Number of cells (3D):", geo3D.mesh.num_cells()
#domain3D.plot()

# define cylinder
cyl = Cylinder(R=R, L=2.*Rz)
# this causes geo to automatically snap boundaries when adapting
geo3D.curved = dict(wall = cyl.snap)

# --- create geometry for 1D crossection ---
# TODO: it would be cool if the 1D domain could be extracted from the 2D one
# (should be pretty easy)
domain1D = Interval(0., R)
domain1D.addsubdomain(domain1D, "fluid")
domain1D.addboundaries(
    wall = domain1D.boundary("right"),
    center = domain1D.boundary("left")
)
domain1D.params["lscale"] = 1e9
domain1D.synonymes = dict(
    pore = "fluid",