예제 #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
예제 #2
0
def setup2D(**params):
    global z0
    globals().update(params)
    if z0 is not None:
        z0 = round(z0, 4)
    geop = geo_params(z0)
    physp = phys_params(bV, Qmol, dnaqsdamp)

    generate_mesh(h, geo_name, **geop)
    geo = geo_from_name(geo_name, **geop)

    if z0 is not None:
        molec = Circle(R=geo.params["rMolecule"], center=geo.params["x0"][::2])
        geo.curved = dict(moleculeb=molec.snap)

    phys = Physics(phys_name, geo, **physp)
    #phys.permittivity = {"default": phys.permittivity["water"]}
    return geo, phys
예제 #3
0
def setup2D(mesh=None, **params):
    # pass mesh argument to prevent mesh regeneration
    global z0
    global geo  # to prevent garbage collection of mesh
    globals().update(params)
    if z0 is not None:
        z0 = round(z0, 4)
    geop = geo_params(z0, rMolecule, Rx, Ry)
    physp = phys_params(bV, Qmol, dnaqsdamp, rMolecule, bulkcon)

    if mesh is None:
        generate_mesh(h, geo_name, **geop)
        geo = geo_from_name(geo_name, **geop)
    else:
        geo = geo_from_name(geo_name, mesh=mesh, **geop)

    if z0 is not None:
        molec = Circle(R=geo.params["rMolecule"], center=geo.params["x0"][::2])
        geo.curved = dict(moleculeb=molec.snap)

    phys = Physics(phys_name, geo, **physp)
    #phys.permittivity = {"default": phys.permittivity["water"]}
    return geo, phys
예제 #4
0
    Qmol=-1. * qq,
    bulkcon=3e2,
    dnaqsdamp=1.,
    bV=bV,
    exactMqv=not adaptq,
    adaptMqv=adaptq,
)

set_log_level(100)
Felref = 1.1424041805
Fdragref = -7.69122891958

# 2D geometry
generate_mesh(h2D, "H_geo", **geo_params2D)
geo2D = geo_from_name("H_geo", **geo_params)
molec2D = Circle(R=geo2D.params["rMolecule"], center=geo2D.params["x0"][::2])
geo2D.curved = dict(moleculeb=molec2D.snap)
mesh2D = geo2D.mesh

phys2D = Physics("howorka", geo2D, **phys_params)

IllposedLinearSolver.stab = 1e0
IllposedNonlinearSolver.newtondamp = 1.
PNPSAxisym.tolnewton = 1e-4

# solve 2D
print "\n---- SOLVE 2D PROBLEM ----"
pb2D, pnps2D = adaptive_pbpnps(geo2D,
                               phys2D,
                               cyl=True,
                               frac=frac,
예제 #5
0
from nanopores.geometries.curved import Cylinder, Circle, Boundary, snap_to_boundary

# Define rectangular domain
h = .4

domain = Box([0., 0.], [1., 1.])

domain.addsubdomains(main=domain)
domain.addboundaries(boundary=domain.boundary(), )

geo = domain.create_geometry(lc=h)
#boundaries = geo.boundaries
mesh = geo.mesh

# introduce circle
circ = Circle(R=.4, center=(.5, .5), frac=0.9)
subdomains = MeshFunction("size_t", mesh, mesh.topology().dim())
subdomains.set_all(0)
circ.mark(subdomains, 1)
plot(subdomains)
submesh = SubMesh(mesh, subdomains, 0)

#plot(mesh, title="initial")
plot(submesh, title="initial")
#plot(boundaries, title="initial")

submesh.snap_boundary(circ, True)
#plot(mesh, title="after snapping")
#plot(submesh, title="after snapping")

# mark circle boundary in geo.boundaries