Exemple #1
0
def create_bcs(Lx, Ly, velocity_top, solutes, concentration_init,
               surface_charge, surface_potential, enable_NS, enable_PF,
               enable_EC, **namespace):
    """ The boundaries and boundary conditions are defined here. """
    boundaries = dict(top=[Top(Ly)], bottom=[Bottom()])

    bcs = dict()
    for boundary_name in boundaries.keys():
        bcs[boundary_name] = dict()

    # Apply pointwise BCs e.g. to pin pressure.
    bcs_pointwise = dict()

    u_top = Fixed((velocity_top, 0.))
    noslip = Fixed((0., 0.))

    if enable_NS:
        bcs["top"]["u"] = u_top
        bcs["bottom"]["u"] = noslip
        bcs_pointwise["p"] = (
            0., "x[0] < DOLFIN_EPS && x[1] > {Ly}-DOLFIN_EPS".format(Ly=Ly))

    if enable_EC:
        for solute in solutes:
            bcs["top"][solute[0]] = Fixed(concentration_init / abs(solute[1]))
        bcs["top"]["V"] = Fixed(0.)
        if surface_potential:
            bcs["bottom"]["V"] = Fixed(surface_charge)
        else:
            bcs["bottom"]["V"] = Charged(surface_charge)

    return boundaries, bcs, bcs_pointwise
Exemple #2
0
def create_bcs(Lx, Ly, solutes, surface_charge, enable_NS, enable_PF,
               enable_EC, **namespace):
    """ The boundaries and boundary conditions are defined here. """
    boundaries = dict(right=[Right(Lx)],
                      left=[Left(0)],
                      bottom=[Bottom(0)],
                      top=[Top(Ly)])
    c0 = [1.0, 1.0]
    noslip = Fixed((0., 0.))
    V_ground = Fixed(0.0)
    surfacecharge = Charged(surface_charge)

    bcs = dict()
    bcs_pointwise = dict()
    bcs["right"] = dict()
    bcs["left"] = dict()
    bcs["top"] = dict()
    bcs["bottom"] = dict()

    if enable_NS:
        bcs["right"]["u"] = noslip
        bcs["left"]["u"] = noslip
        bcs["top"]["u"] = noslip
        bcs_pointwise["p"] = (0., "x[0] < DOLFIN_EPS && x[1] < DOLFIN_EPS")

    if enable_EC:
        bcs["top"]["V"] = surfacecharge
        bcs["bottom"]["V"] = V_ground
        for ci, solute in zip(c0, solutes):
            bcs["bottom"][solute[0]] = Fixed(ci)

    # Apply pointwise BCs e.g. to pin pressure.

    return boundaries, bcs, bcs_pointwise
Exemple #3
0
def create_bcs(Lz, V_top, V_btm,
               enable_NS, enable_PF, enable_EC, **namespace):
    """ The boundaries and boundary conditions are defined here. """
    boundaries = dict(
        wall=[Wall(Lz)],
        top=[Top(Lz)],
        bottom=[Bottom()]
    )

    bcs = dict()
    bcs_pointwise = dict()
    bcs["wall"] = dict()
    bcs["top"] = dict()
    bcs["bottom"] = dict()

    noslip = Fixed((0., 0., 0.))
    if enable_NS:
        bcs["top"]["u"] = noslip
        bcs["bottom"]["u"] = noslip
        bcs["wall"]["u"] = noslip
        bcs_pointwise["p"] = (0.,
                              "x[0] < DOLFIN_EPS && "
                              "x[1] < DOLFIN_EPS && "
                              "x[2] < DOLFIN_EPS")

    if enable_EC:
        bcs["top"]["V"] = Fixed(V_top)
        bcs["bottom"]["V"] = Fixed(V_btm)

    return boundaries, bcs, bcs_pointwise
Exemple #4
0
def create_bcs(Lx, Ly, concentration_top, concentration_bottom, V_top,
               V_bottom, solutes, enable_NS, enable_PF, enable_EC,
               **namespace):
    """ The boundaries and boundary conditions are defined here. """
    boundaries = dict(top=[Top(Ly)], bottom=[Bottom()])

    bcs = dict()
    for boundary_name in boundaries.keys():
        bcs[boundary_name] = dict()

    # Apply pointwise BCs e.g. to pin pressure.
    bcs_pointwise = dict()

    noslip = Fixed((0., 0.))

    if enable_NS:
        bcs["top"]["u"] = noslip
        bcs["bottom"]["u"] = noslip
        bcs_pointwise["p"] = (0., "x[0] < DOLFIN_EPS && x[1] < DOLFIN_EPS")

    if enable_EC:
        for solute in solutes:
            bcs["top"][solute[0]] = Fixed(concentration_top)
            if solute[0] == "c_p":
                bcs["bottom"][solute[0]] = Fixed(concentration_bottom)
        bcs["top"]["V"] = Fixed(V_top)
        bcs["bottom"]["V"] = Fixed(V_bottom)
    return boundaries, bcs, bcs_pointwise
Exemple #5
0
def create_bcs(Lx, Ly, mesh, surface_charge, enable_NS, enable_EC,
               **namespace):
    """ The boundaries and boundary conditions are defined here. """
    boundaries = dict(right=[Right(Lx)],
                      left=[Left(Lx)],
                      bottom=[Bottom(Ly)],
                      top=[Top(Ly)])

    bcs = dict()
    for boundary_name in boundaries.keys():
        bcs[boundary_name] = dict()

    # Apply pointwise BCs e.g. to pin pressure.
    bcs_pointwise = dict()

    noslip = Fixed((0., 0.))

    if enable_NS:
        bcs["left"]["u"] = noslip
        bcs["right"]["u"] = noslip
        bcs["top"]["u"] = noslip
        bcs["bottom"]["u"] = noslip
        bcs_pointwise["p"] = (0., "x[0] < DOLFIN_EPS-{Lx}/2 && "
                              "x[1] < DOLFIN_EPS-{Ly}/2".format(Lx=Lx, Ly=Ly))

    if enable_EC:
        bcs["top"]["V"] = Fixed(0.)
        bcs["bottom"]["V"] = Charged(surface_charge)

    return boundaries, bcs, bcs_pointwise
Exemple #6
0
def create_bcs(field_to_subspace, Lx, Ly, solutes, V_left, V_right, enable_NS,
               enable_PF, enable_EC, **namespace):
    """ The boundary conditions are defined in terms of field. """

    boundaries = dict(wall=[Wall(Lx)], left=[Left()], right=[Right(Lx)])

    noslip = Fixed((0., 0.))

    bcs = dict()
    bcs_pointwise = dict()

    bcs["wall"] = dict()
    bcs["left"] = dict()
    bcs["right"] = dict()

    if enable_NS:
        bcs["wall"]["u"] = noslip
        bcs["left"]["u"] = noslip
        bcs["right"]["u"] = noslip
        bcs_pointwise["p"] = (0., "x[0] < DOLFIN_EPS && x[1] < DOLFIN_EPS")

    if enable_EC:
        bcs["left"]["V"] = Fixed(V_left)
        bcs["right"]["V"] = Fixed(V_right)

    return boundaries, bcs, bcs_pointwise
def create_bcs(Lx, Ly,inlet_velocity,
         enable_NS, enable_PF, enable_EC, **namespace):
    """ The boundaries and boundary conditions are defined here. """
    boundaries = dict(
        right=[Right(Lx)],
        left=[Left(0)]
    )

    # Alocating the boundary dicts
    bcs = dict()
    bcs_pointwise = dict()
    bcs["left"] = dict()
    bcs["right"] = dict()

    inletvelocity = Fixed((inlet_velocity, 0.))
    pressurein_out = Fixed(0.0)
    phi_inlet = Fixed(-1.0) 
    phi_outlet = Fixed(1.0) 

    if enable_NS: 
        bcs["left"]["u"] = inletvelocity
        bcs["right"]["p"] = pressurein_out
        bcs["left"]["p"] = pressurein_out

    if enable_PF:  
        bcs["left"]["phi"] = phi_inlet
        bcs["right"]["phi"] = phi_outlet

    return boundaries, bcs, bcs_pointwise
Exemple #8
0
def create_bcs(field_to_subspace, Lx, Ly,
               solutes,
               concentration_init_s,
               V_top, V_bottom,
               contact_angle,
               enable_NS, enable_PF, enable_EC,
               **namespace):
    """ The boundary conditions are defined in terms of field. """

    boundaries = dict(
        top=[Top(Ly)],
        bottom=[Bottom(Ly)],
        left=[Left()],
        right=[Right(Lx)]
    )

    noslip = NoSlip()
    freeslip_y = FreeSlip(0., 0)
    freeslip_x = FreeSlip(0., 1)
    slip_x = Slip(0.005, 1)

    bcs = dict()
    bcs_pointwise = dict()

    bcs["top"] = dict()
    bcs["bottom"] = dict()
    bcs["left"] = dict()
    bcs["right"] = dict()

    if enable_NS:
        bcs["top"]["u"] = slip_x
        bcs["bottom"]["u"] = noslip
        bcs["left"]["u"] = freeslip_y
        bcs["right"]["u"] = freeslip_y
        bcs_pointwise["p"] = (
            0.,
            ("x[0] > {Lx}- DOLFIN_EPS && "
             "x[1] > {Ly} - DOLFIN_EPS").format(Lx=Lx, Ly=Ly))

    if enable_EC:
        for solute in solutes[:2]:
            bcs["top"][solute[0]] = Fixed(concentration_init_s)
        for solute in solutes[2:]:
            bcs["top"][solute[0]] = Fixed(0.)
        bcs["top"]["V"] = Fixed(V_top)
        bcs["bottom"]["V"] = Fixed(V_bottom)

    if enable_PF:
        bcs["bottom"]["phi"] = ContactAngle(np.pi-contact_angle)

    return boundaries, bcs, bcs_pointwise
Exemple #9
0
def create_bcs(L, H, inlet_velocity, V_0, solutes, concentration_left,
               interface_thickness, enable_NS, enable_PF, enable_EC,
               **namespace):
    """ The boundaries and boundary conditions are defined here. """
    boundaries = dict(wall=[Wall(L, H)],
                      cylinder=[Cylinder(L, H)],
                      right=[Right(L, H)],
                      left=[Left(H)])

    # Alocating the boundary dicts
    bcs = dict()
    bcs_pointwise = dict()
    for boundary in boundaries:
        bcs[boundary] = dict()

    velocity_expr = velocity_init(L, H, inlet_velocity)
    velocity_in = Fixed(velocity_expr)
    pressure_out = Pressure(0.0)
    noslip = NoSlip()

    V_left = Fixed(V_0)
    V_right = Fixed(0.)

    if enable_NS:
        bcs["left"]["u"] = velocity_in
        bcs["right"]["p"] = pressure_out
        bcs["wall"]["u"] = noslip
        bcs["cylinder"]["u"] = noslip

    if enable_PF:
        phi_expr = df.Expression("tanh((abs(x[1]-H/2)-H/16)/(sqrt(2)*eps))",
                                 H=H,
                                 eps=interface_thickness,
                                 degree=2)
        phi_inlet = Fixed(phi_expr)
        bcs["left"]["phi"] = phi_inlet
        # bcs["right"]["phi"] = Fixed(df.Constant(1.))

    if enable_EC:
        bcs["left"]["V"] = V_left
        bcs["right"]["V"] = V_right
        for solute in solutes:
            c_expr = df.Expression("c0*exp(-pow(x[1]-H/2, 2)/(2*0.01*0.01))",
                                   H=H,
                                   c0=concentration_left,
                                   degree=2)
            bcs["left"][solute[0]] = Fixed(c_expr)

    return boundaries, bcs, bcs_pointwise
Exemple #10
0
def create_bcs(Lx, Ly, Lx_inner,
               solutes,
               concentration_init,
               mesh,
               surface_charge,
               enable_NS, enable_EC,
               **namespace):
    """ The boundaries and boundary conditions are defined here. """
    boundaries = dict(
        right=[Right(Lx, Ly, Lx_inner)],
        left=[Left(Lx, Ly, Lx_inner)],
        #inner_wall=[InnerWall(Lx, Ly, Lx_inner)],
        #outer_wall=[OuterWall(Lx, Ly, Lx_inner)]
        wall=[Wall(Lx, Ly, Lx_inner)]
    )

    bcs = dict()
    for boundary_name in boundaries.keys():
        bcs[boundary_name] = dict()

    # Apply pointwise BCs e.g. to pin pressure.
    bcs_pointwise = dict()

    noslip = Fixed((0., 0.))

    if enable_NS:
        bcs["left"]["p"] = Pressure(0.)
        bcs["right"]["p"] = Pressure(0.)
        #bcs["inner_wall"]["u"] = noslip
        #bcs["outer_wall"]["u"] = noslip
        bcs["wall"]["u"] = noslip

    if enable_EC:
        bcs["left"]["V"] = Fixed(0.)
        bcs["right"]["V"] = Charged(0.)
        #bcs["right"]["V"] = Fixed(0.)
        #bcs["outer_wall"]["V"] = Charged(0.)
        #bcs["inner_wall"]["V"] = Charged(surface_charge)
        bcs["wall"]["V"] = Charged(df.Expression(
            "0.5*sigma_e*(tanh((x[0]-0.5*(Lx-Lx_inner))/delta)-"
            "tanh((x[0]-0.5*(Lx+Lx_inner))/delta))",
            sigma_e=surface_charge, delta=2., Lx=Lx, Lx_inner=Lx_inner,
            degree=1))
        for solute in solutes:
            bcs["left"][solute[0]] = Fixed(concentration_init)
            bcs["right"][solute[0]] = Fixed(concentration_init)

    return boundaries, bcs, bcs_pointwise
Exemple #11
0
def create_bcs(Lx, Ly,
               grid_spacing, rad, num_obstacles,
               surface_charge, solutes, enable_NS, enable_EC,
               p_lagrange, V_lagrange,
               concentration_init, V_left,
               **namespace):
    """ The boundaries and boundary conditions are defined here. """
    data = np.loadtxt(
        "meshes/periodic_porous_Lx{}_Ly{}_rad{}_N{}_dx{}.dat".format(
            Lx, Ly, rad, num_obstacles, grid_spacing))
    centroids = data[:, :2]
    rad = data[:, 2]

    boundaries = dict(
        left=[Left(Lx, Ly)],
        right=[Right(Lx, Ly)],
        obstacles=[Obstacles(Lx, centroids, rad, grid_spacing)]
    )

    # Allocating the boundary dicts
    bcs = dict()
    bcs_pointwise = dict()
    for boundary in boundaries:
        bcs[boundary] = dict()

    noslip = Fixed((0., 0.))

    if enable_NS:
        bcs["left"]["p"] = Pressure(0.)
        bcs["right"]["p"] = Pressure(0.)
        bcs["obstacles"]["u"] = noslip

    if enable_EC:
        for solute in solutes:
            bcs["left"][solute[0]] = Fixed(concentration_init)
            bcs["right"][solute[0]] = Fixed(concentration_init)
        bcs["left"]["V"] = Fixed(V_left)
        bcs["right"]["V"] = Charged(0.)
        # bcs["right"]["V"] = Fixed(V_right)
        bcs["obstacles"]["V"] = Charged(surface_charge)

    return boundaries, bcs, bcs_pointwise
def create_bcs(Lx, Ly, mesh, grid_spacing, rad, num_obstacles, surface_charge,
               solutes, enable_NS, enable_EC, p_lagrange, V_lagrange,
               **namespace):
    """ The boundaries and boundary conditions are defined here. """
    data = np.loadtxt(
        "meshes/periodic_porous_Lx{}_Ly{}_rad{}_N{}_dx{}.dat".format(
            Lx, Ly, rad, num_obstacles, grid_spacing))
    centroids = data[:, :2]
    rad = data[:, 2]

    # Find a single node to pin pressure to
    x_loc = np.array(mesh.coordinates())
    x_proc = np.zeros((size, 2))
    ids_notboun = np.logical_and(
        x_loc[:, 0] > x_loc[:, 0].min() + df.DOLFIN_EPS,
        x_loc[:, 1] > x_loc[:, 1].min() + df.DOLFIN_EPS)
    x_loc = x_loc[ids_notboun, :]
    d2 = (x_loc[:, 0] + Lx / 2)**2 + (x_loc[:, 1] + Ly / 2)**2
    x_bottomleft = x_loc[d2 == d2.min()][0]
    x_proc[rank, :] = x_bottomleft
    x_pin = np.zeros_like(x_proc)
    comm.Allreduce(x_proc, x_pin, op=MPI.SUM)
    x_pin = x_pin[x_pin[:, 0] == x_pin[:, 0].min(), :][0]

    info("Pinning point: {}".format(x_pin))

    pin_code = ("x[0] < {x}+{eps} && "
                "x[0] > {x}-{eps} && "
                "x[1] > {y}-{eps} && "
                "x[1] < {y}+{eps}").format(x=x_pin[0], y=x_pin[1], eps=1e-3)

    boundaries = dict(obstacles=[Obstacles(Lx, centroids, rad, grid_spacing)])

    # Allocating the boundary dicts
    bcs = dict()
    bcs_pointwise = dict()
    for boundary in boundaries:
        bcs[boundary] = dict()

    noslip = Fixed((0., 0.))

    if enable_NS:
        bcs["obstacles"]["u"] = noslip

        if not p_lagrange:
            bcs_pointwise["p"] = (0., pin_code)

    if enable_EC:
        bcs["obstacles"]["V"] = Charged(surface_charge)

        if not V_lagrange:
            bcs_pointwise["V"] = (0., pin_code)

    return boundaries, bcs, bcs_pointwise
Exemple #13
0
def create_bcs(field_to_subspace, Lx, Ly, solutes, V_boundary, enable_NS,
               enable_PF, enable_EC, **namespace):
    """ The boundary conditions are defined in terms of field. """

    boundaries = dict(wall=[Wall()])

    bcs = dict(wall=dict())
    bcs_pointwise = dict()

    noslip = Fixed((0., 0.))

    # Navier-Stokes
    if enable_NS:
        bcs["wall"]["u"] = noslip
        bcs_pointwise["p"] = (0., "x[0] < DOLFIN_EPS && x[1] < DOLFIN_EPS")

    # Electrochemistry
    if enable_EC:
        bcs["wall"]["V"] = Fixed(V_boundary)

    return boundaries, bcs, bcs_pointwise
Exemple #14
0
def create_bcs(Lx, Ly, inlet_velocity, V_0, solutes, concentration_left,
               enable_NS, enable_PF, enable_EC, **namespace):
    """ The boundaries and boundary conditions are defined here. """
    boundaries = dict(right=[Right(Lx)], left=[Left(0)])

    # Alocating the boundary dicts
    bcs = dict()
    bcs_pointwise = dict()
    bcs["left"] = dict()
    bcs["right"] = dict()

    inlet_velocity = Fixed((inlet_velocity, 0.))
    #pressurein_out = Pressure(0.0)
    phi_inlet = Fixed(-1.0)
    phi_outlet = Fixed(1.0)
    V_left = Fixed(V_0)
    V_right = Fixed(0.)

    if enable_NS:
        bcs["left"]["u"] = inlet_velocity
        bcs["right"]["u"] = inlet_velocity
        # bcs["left"]["p"] = pressurein_out
        bcs_pointwise["p"] = (0., "x[0] < DOLFIN_EPS && x[1] < DOLFIN_EPS")

    if enable_PF:
        bcs["left"]["phi"] = phi_inlet
        bcs["right"]["phi"] = phi_outlet

    if enable_EC:
        bcs["left"]["V"] = V_left
        bcs["right"]["V"] = V_right
        for solute in solutes:
            bcs["left"][solute[0]] = Fixed(concentration_left)

    return boundaries, bcs, bcs_pointwise
Exemple #15
0
def create_bcs(
        Lx,
        Ly,
        grid_spacing,  # inlet_velocity,
        concentration_init,
        solutes,
        surface_charge,
        V_left,
        V_right,
        pressure_left,
        pressure_right,
        enable_NS,
        enable_PF,
        enable_EC,
        **namespace):
    """ The boundaries and boundary conditions are defined here. """

    data = np.loadtxt("meshes/periodic_porous_dx" + str(grid_spacing) + ".dat")
    centroids = data[:, :2]
    rad = data[:, 2]

    boundaries = dict(right=[Right(Lx)],
                      left=[Left(Lx)],
                      obstacles=[Obstacles(Lx, centroids, rad, grid_spacing)])

    # Allocating the boundary dicts
    bcs = dict()
    bcs_pointwise = dict()
    for boundary in boundaries:
        bcs[boundary] = dict()

    # u_inlet = Fixed((inlet_velocity, 0.))
    noslip = Fixed((0., 0.))

    p_inlet = Pressure(pressure_left)
    p_outlet = Pressure(pressure_right)
    phi_inlet = Fixed(-1.0)
    phi_outlet = Fixed(1.0)

    if enable_NS:
        # bcs["left"]["u"] = u_inlet
        bcs["obstacles"]["u"] = noslip
        bcs["right"]["p"] = p_outlet
        bcs["left"]["p"] = p_inlet
        # bcs_pointwise["p"] = (0., "x[0] < -{Lx}/2+DOLFIN_EPS && x[1] > {Ly}/2-DOLFIN_EPS".format(Lx=Lx, Ly=Ly))

    if enable_PF:
        bcs["left"]["phi"] = phi_inlet
        bcs["right"]["phi"] = phi_outlet

    if enable_EC:
        for solute in solutes:
            bcs["left"][solute[0]] = Fixed(concentration_init)
            # bcs["right"][solute[0]] = Fixed(0.)
        bcs["left"]["V"] = Fixed(V_left)
        bcs["right"]["V"] = Fixed(V_right)
        bcs["obstacles"]["V"] = Charged(surface_charge)

    return boundaries, bcs, bcs_pointwise
Exemple #16
0
def create_bcs(Lx, Ly, solutes, concentration_init, surface_charge,
               pressure_left, pressure_right, enable_NS, enable_PF, enable_EC,
               **namespace):
    """ The boundaries and boundary conditions are defined here. """
    boundaries = dict(
        inner=[Inner(Lx, Ly)],
        bottom=[Bottom()],
        top=[Top(Ly)],
        left=[Left()],
        right=[Right(Lx)],
    )

    bcs = dict()
    for boundary_name in boundaries.keys():
        bcs[boundary_name] = dict()

    # Apply pointwise BCs e.g. to pin pressure.
    bcs_pointwise = dict()

    noslip = Fixed((0., 0.))
    phi_inlet = Fixed(-1.0)
    p_inlet = Pressure(pressure_left)
    p_outlet = Pressure(pressure_right)

    if enable_NS:
        bcs["top"]["u"] = noslip
        bcs["bottom"]["u"] = noslip
        bcs["inner"]["u"] = noslip
        bcs["left"]["p"] = p_inlet
        bcs["right"]["p"] = p_outlet
        #bcs_pointwise["p"] = (0., "x[0] < DOLFIN_EPS && x[1] < DOLFIN_EPS")
        # bcs["outer"]["p"] = Pressure(0.)

    if enable_EC:
        for solute in solutes:
            bcs["left"][solute[0]] = Fixed(concentration_init)
            bcs["right"][solute[0]] = Fixed(concentration_init)
        bcs["top"]["V"] = Fixed(0.)
        bcs["bottom"]["V"] = Fixed(0.)
        bcs["left"]["V"] = Fixed(0.)
        bcs["right"]["V"] = Fixed(0.)
        bcs["inner"]["V"] = Charged(surface_charge)

    if enable_PF:
        bcs["left"]["phi"] = phi_inlet
        #bcs["right"]["phi"] = phi_inlet

    return boundaries, bcs, bcs_pointwise
Exemple #17
0
def create_bcs(Lx, Ly, R, velocity_top, solutes, concentration_init,
               surface_charge, enable_NS, enable_PF, enable_EC, **namespace):
    """ The boundaries and boundary conditions are defined here. """
    boundaries = dict(outer_narrowing=[Outer_Narrowing(Lx, R)],
                      inner_narrowing=[Inner_Narrowing(Lx, R)],
                      right=[Right(Lx)],
                      left=[Left(0)])

    bcs = dict()
    for boundary_name in boundaries.keys():
        bcs[boundary_name] = dict()

    # Apply pointwise BCs e.g. to pin pressure.
    bcs_pointwise = dict()
    ground = Fixed(0.)
    noslip = Fixed((0., 0.))
    phi_inlet = Fixed(-1.0)
    phi_outlet = Fixed(1.0)

    if enable_NS:
        bcs["inner_narrowing"]["u"] = noslip
        bcs["outer_narrowing"]["u"] = noslip
        bcs_pointwise["p"] = (
            0., "x[0] < DOLFIN_EPS && x[1] > {Ly}-DOLFIN_EPS".format(Ly=Ly))

    if enable_EC:
        for solute in solutes:
            bcs["left"][solute[0]] = Fixed(concentration_init)
        bcs["left"]["V"] = ground
        bcs["outer_narrowing"]["V"] = Charged(0.0)
        bcs["inner_narrowing"]["V"] = Charged(surface_charge)

    if enable_PF:
        bcs["left"]["phi"] = phi_inlet
        bcs["right"]["phi"] = phi_outlet
    return boundaries, bcs, bcs_pointwise
def create_bcs(t_0, Lx, Ly, concentration_init, concentration_init_dev,
               surface_tension, interface_thickness, pf_init,
               pf_mobility_coeff, solutes, density, permittivity, viscosity,
               p_lagrange, enable_NS, enable_PF, enable_EC, **namespace):
    """ The boundaries and boundary conditions are defined here. """
    boundaries = dict(wall=[Wall()])
    bcs = dict()
    for boundary_name in boundaries.keys():
        bcs[boundary_name] = dict()

    # Apply pointwise BCs e.g. to pin pressure.
    bcs_pointwise = dict()

    exprs = reference(t=t_0, **vars())

    for field, expr in exprs.items():
        if field != "p":
            bcs["wall"][field] = Fixed(expr)

    if enable_NS and not p_lagrange:
        bcs_pointwise["p"] = (0., ("x[0] < DOLFIN_EPS && x[1] < DOLFIN_EPS"))

    return boundaries, bcs, bcs_pointwise
Exemple #19
0
def create_bcs(Lx, Ly, surface_charge_top, surface_charge_bottom, enable_NS,
               enable_PF, enable_EC, **namespace):
    """ The boundaries and boundary conditions are defined here. """
    boundaries = dict(top=[Top(Ly)], bottom=[Bottom()])

    bcs = dict()
    for boundary_name in boundaries.keys():
        bcs[boundary_name] = dict()

    # Apply pointwise BCs e.g. to pin pressure.
    bcs_pointwise = dict()

    noslip = Fixed((0., 0.))

    if enable_NS:
        bcs["top"]["u"] = noslip
        bcs["bottom"]["u"] = noslip
        bcs_pointwise["p"] = (0., "x[0] < DOLFIN_EPS && x[1] < DOLFIN_EPS")

    if enable_EC:
        bcs["top"]["V"] = Charged(surface_charge_top)
        bcs["bottom"]["V"] = Charged(surface_charge_bottom)
        bcs_pointwise["V"] = (0., "x[0] < DOLFIN_EPS && x[1] < DOLFIN_EPS")
    return boundaries, bcs, bcs_pointwise