Ejemplo n.º 1
0
 def setFixedNodes(self):
     """
     For moving domains: fixes nodes/boundary
     """
     self.hx_dirichlet = constantBC(0.)
     self.hy_dirichlet = constantBC(0.)
     self.hz_dirichlet = constantBC(0.)
     self.u_stress = None
     self.v_stress = None
     self.w_stress = None
Ejemplo n.º 2
0
 def setTank(self):
     b_or = self._b_or[self._b_i]
     if b_or[0] == 1 or b_or[0] == -1:
         self.hx_dirichlet = constantBC(0.)
         self.u_stress = None
     elif b_or[1] == 1 or b_or[1] == -1:
         self.hy_dirichlet = constantBC(0.)
         self.v_stress = None
     elif len(b_or) > 2 and (b_or[2] == 1 or b_or[2] == -1):
         self.hz_dirichlet = constantBC(0.)
         self.w_stress = None
Ejemplo n.º 3
0
 def setNonMaterial(self):
     """
     For non-material boundaries.
     Sets diffusive flux and advective vof to zero
     """
     self.reset()
     self.BC_type = 'NonMaterial'
     self.vof_advective = constantBC(0.)
     self.u_diffusive = constantBC(0.)
     self.v_diffusive = constantBC(0.)
     self.w_diffusive = constantBC(0.)
Ejemplo n.º 4
0
 def setFreeSlip(self):
     """
     sets free slip conditions at the boundary
     """
     self.reset()
     self.BC_type = 'FreeSlip'
     self.p_advective = constantBC(0.)
     self.u_advective = constantBC(0.)
     self.v_advective = constantBC(0.)
     self.w_advective = constantBC(0.)
     self.vof_advective = constantBC(0.)
     self.k_dirichlet = constantBC(0.)
     self.u_diffusive = constantBC(0.)
     self.v_diffusive = constantBC(0.)
     self.w_diffusive = constantBC(0.)
     self.dissipation_diffusive = constantBC(0.)
Ejemplo n.º 5
0
    def setOpenAir(self, orientation=None):
        """
        sets open boundary conditions (water can come out)
        """
        self.BC_type = 'OpenAir'

        def get_ux_dirichlet(i):
            if b_or[i] == 1. or b_or[i] == -1.:
                return None
            else:
                return constantBC(0.)

        if orientation is None and self._b_or[self._b_i] is not None:
            b_or = self._b_or[self._b_i]
        elif orientation is not None:
            b_or = orientation
        else:
            print('Boundary orientation needs to be defined')
        self.reset()
        self.p_dirichlet = constantBC(0.)
        self.u_dirichlet = get_ux_dirichlet(0)
        self.v_dirichlet = get_ux_dirichlet(1)
        if len(b_or) > 2:
            self.w_dirichlet = get_ux_dirichlet(2)
        self.vof_dirichlet = constantBC(1.)  # air
        self.u_diffusive = constantBC(0.)
        self.v_diffusive = constantBC(0.)
        self.w_diffusive = constantBC(0.)
        self.k_diffusive = constantBC(0.)
        self.dissipation_diffusive = constantBC(0.)
Ejemplo n.º 6
0
 def test_constantBC(self):
     t_list = get_time_array()
     constant = 4
     constants = []
     values = []
     BC_func = constantBC(constant)
     for t in t_list:
         x = get_random_x()
         constants += [constant]
         values += [BC_func(x, t)]
     npt.assert_equal(values, constants)
Ejemplo n.º 7
0
    def setHydrostaticPressureOutlet(self, rho, g, refLevel, vof, pRef=0.0,
                                     vert_axis=-1):
        self.reset()
        a0 = pRef - rho*g[vert_axis]*refLevel
        a1 = rho*g[vert_axis]
        # This is the normal velocity, based on the boundary orientation

        def get_outlet_ux_dirichlet(i):
            def ux_dirichlet(x, t):
                b_or = self._b_or[self._b_i]
                if b_or[i] == 0:
                    return 0.
            return ux_dirichlet
        self.u_dirichlet = get_outlet_ux_dirichlet(0)
        self.v_dirichlet = get_outlet_ux_dirichlet(1)
        if len(g) == 3:
            self.w_dirichlet = get_outlet_ux_dirichlet(2)
        self.p_dirichlet = linearBC(a0, a1, vert_axis)
        self.vof_dirichlet = constantBC(vof)
        self.u_diffusive = constantBC(0.)
        self.v_diffusive = constantBC(0.)
        self.w_diffusive = constantBC(0.)
Ejemplo n.º 8
0
 def get_ux_dirichlet(i):
     if b_or[i] == 1. or b_or[i] == -1.:
         return None
     else:
         return constantBC(0.)