Ejemplo n.º 1
0
    'pressure': PerturbedSurface_p(),
    'vel_u': AtRest(),
    'vel_v': AtRest()
}

#  _   _                           _
# | \ | |_   _ _ __ ___   ___ _ __(_) ___ ___
# |  \| | | | | '_ ` _ \ / _ \ '__| |/ __/ __|
# | |\  | |_| | | | | | |  __/ |  | | (__\__ \
# |_| \_|\__,_|_| |_| |_|\___|_|  |_|\___|___/
# Numerics

outputStepping = tpf.OutputStepping(
    final_time=0.002,
    dt_init=0.001,
    dt_output=0.001,
    nDTout=None,
    dt_fixed=0.001,
)

myTpFlowProblem = tpf.TwoPhaseFlowProblem(
    ns_model=None,
    ls_model=None,
    nd=domain.nd,
    cfl=0.4,
    outputStepping=outputStepping,
    structured=False,
    he=he,
    nnx=None,
    nny=None,
    nnz=None,
Ejemplo n.º 2
0
                    return min((phi_x**2 + phi_y**2)**0.5, phi_y_outflow)


class VF_IC:
    def __init__(self):
        self.phi = PHI_IC()

    def uOfXT(self, x, t):
        from proteus.ctransportCoefficients import smoothedHeaviside
        return smoothedHeaviside(1.5 * opts.he, self.phi.uOfXT(x, t))


############################################
# ***** Create myTwoPhaseFlowProblem ***** #
############################################
outputStepping = TpFlow.OutputStepping(opts.final_time,
                                       dt_output=opts.dt_output)
initialConditions = {
    'pressure': zero(),
    'pressure_increment': zero(),
    'vel_u': zero(),
    'vel_v': zero(),
    'vof': VF_IC(),
    'ncls': PHI_IC(),
    'rdls': PHI_IC(),
    'clsvof': clsvof_init_cond()
}

myTpFlowProblem = TpFlow.TwoPhaseFlowProblem(
    ns_model=0,
    ls_model=0,
    nd=2,
Ejemplo n.º 3
0
mesh_fileprefix = 'mesh'
domain.MeshOptions.setOutputFiles(mesh_fileprefix)

st.assembleDomain(domain)

#  _   _                           _
# | \ | |_   _ _ __ ___   ___ _ __(_) ___ ___
# |  \| | | | | '_ ` _ \ / _ \ '__| |/ __/ __|
# | |\  | |_| | | | | | |  __/ |  | | (__\__ \
# |_| \_|\__,_|_| |_| |_|\___|_|  |_|\___|___/
# Numerics

outputStepping = TpFlow.OutputStepping(
    final_time=T,
    dt_init=dt_init,
    # cfl=opts.cfl,
    dt_output=sampleRate,
    nDTout=None,
    dt_fixed=None,
)

myTpFlowProblem = TpFlow.TwoPhaseFlowProblem(
    ns_model=None,
    ls_model=None,
    nd=domain.nd,
    cfl=cfl,
    outputStepping=outputStepping,
    structured=False,
    he=he,
    domain=domain,
    initialConditions=initialConditions,
)
Ejemplo n.º 4
0
levelset_output=ga.PointGauges(gauges=((('phi',),PG),
                                 ),
                          activeTime = (0., T),
                          sampleRate=0.,
                          fileName='levelset_gauges.csv')
"""

################################        Numerics      ################################

Duration = opts.Tend / opts.fract
dt_output = opts.Tt[1] / opts.Np

outputStepping = TpFlow.OutputStepping(
    final_time=Duration,
    dt_init=opts.dt_init,
    # cfl=cfl,
    dt_output=dt_output,
    nDTout=None,
    dt_fixed=None)

myTpFlowProblem = TpFlow.TwoPhaseFlowProblem(
    ns_model=None,
    ls_model=None,
    nd=domain.nd,
    cfl=opts.cfl,
    outputStepping=outputStepping,
    structured=False,
    he=he,
    nnx=None,
    nny=None,
    nnz=None,
Ejemplo n.º 5
0
class PHI_IC:
    def uOfXT(self, x, t):
        return signedDistance(x)


# ******************************* #
# ***** BOUNDARY CONDITIONS ***** #
# ******************************* #

# ADVECTIVE FLUX BOUNDARY CONDITIONS #

############################################
# ***** Create myTwoPhaseFlowProblem ***** #
############################################
outputStepping = TpFlow.OutputStepping(opts.final_time,
                                       dt_output=opts.dt_output)
initialConditions = {
    'pressure': zero(),
    'pressure_increment': zero(),
    'vel_u': zero(),
    'vel_v': zero(),
    'vel_w': zero(),
    'vof': VF_IC(),
    'ncls': PHI_IC(),
    'rdls': PHI_IC(),
}

myTpFlowProblem = TpFlow.TwoPhaseFlowProblem(
    ns_model=0,
    ls_model=0,
    nd=3,
Ejemplo n.º 6
0
def signedDistance(x, t):
    #d=abs(x[1] - water_depth  - water_amplitude * cos(x[0]))
    d = x[1] - (water_depth + eta(x[0], t))
    #d = x[1]-water_depth
    return d


#  _   _                           _
# | \ | |_   _ _ __ ___   ___ _ __(_) ___ ___
# |  \| | | | | '_ ` _ \ / _ \ '__| |/ __/ __|
# | |\  | |_| | | | | | |  __/ |  | | (__\__ \
# |_| \_|\__,_|_| |_| |_|\___|_|  |_|\___|___/
# Numerics

myTpFlowProblem = TpFlow.TwoPhaseFlowProblem()
myTpFlowProblem.outputStepping.final_time = 0.1
myTpFlowProblem.outputStepping.dt_init = 0.01
myTpFlowProblem.outputStepping.dt_output = 0.1
myTpFlowProblem.outputStepping.dt_fixed = 0.01
myTpFlowProblem.outputStepping.archiveAllSteps = opts.archiveAllSteps

myTpFlowProblem.domain = domain

myTpFlowProblem.SystemNumerics.useSuperlu = opts.useSuperlu
myTpFlowProblem.SystemNumerics.cfl = opts.cfl

myTpFlowProblem.SystemPhysics.setDefaults()
myTpFlowProblem.SystemPhysics.useDefaultModels()

myTpFlowProblem.SystemPhysics.movingDomain = opts.movingDomain
Ejemplo n.º 7
0
initialConditions = {
    'pressure': P_IC(),
    'vel_u': AtRest(),
    'vel_v': AtRest(),
    'vel_w': AtRest(),
    'vof': VOF_IC(),
    'ncls': LS_IC(),
    'rdls': LS_IC(),
}

# Two Phase Flow
dt_output = opts.Tp / opts.Np

outputStepping = TpFlow.OutputStepping(final_time=Duration,
                                       dt_init=opts.dt_init,
                                       dt_output=dt_output,
                                       nDTout=None,
                                       dt_fixed=None)

myTpFlowProblem = TpFlow.TwoPhaseFlowProblem(
    ns_model=0,
    ls_model=0,
    nd=domain.nd,
    cfl=opts.cfl,
    outputStepping=outputStepping,
    he=he,
    domain=domain,
    initialConditions=initialConditions,
)

params = myTpFlowProblem.Parameters
Ejemplo n.º 8
0
    else:
        return lambda x, t: 0.0


def ncls_AFBC(x, flag):
    return None


def rdls_AFBC(x, flag):
    return None


############################################
# ***** Create myTwoPhaseFlowProblem ***** #
############################################
outputStepping = TpFlow.OutputStepping(opts.final_time,
                                       dt_output=opts.dt_output)
initialConditions = {
    'pressure': zero(),
    'vel_u': zero(),
    'vel_v': zero(),
    'vof': VF_IC(),
    'ncls': PHI_IC(),
    'rdls': PHI_IC()
}

boundaryConditions = {
    # DIRICHLET BCs #
    'pressure_DBC': pressure_DBC,
    'vel_u_DBC': vel_u_DBC,
    'vel_v_DBC': vel_v_DBC,
    'vof_DBC': vof_DBC,
Ejemplo n.º 9
0
domain.geofile = mesh_fileprefix

domain.BCbyFlag[0].u_diffusive.uOfXT = lambda x, t: 0.
domain.BCbyFlag[0].v_diffusive.uOfXT = lambda x, t: 0.

#  _   _                           _
# | \ | |_   _ _ __ ___   ___ _ __(_) ___ ___
# |  \| | | | | '_ ` _ \ / _ \ '__| |/ __/ __|
# | |\  | |_| | | | | | |  __/ |  | | (__\__ \
# |_| \_|\__,_|_| |_| |_|\___|_|  |_|\___|___/
# Numerics

outputStepping = TpFlow.OutputStepping(
    final_time=opts.T,
    dt_init=opts.dt_init,
    dt_output=opts.dt_output,
    nDTout=None,
    dt_fixed=opts.dt_fixed,
)

myTpFlowProblem = TpFlow.TwoPhaseFlowProblem(
    ns_model=None,
    ls_model=None,
    nd=domain.nd,
    cfl=opts.cfl,
    outputStepping=outputStepping,
    structured=False,
    he=he,
    nnx=None,
    nny=None,
    nnz=None,
Ejemplo n.º 10
0
    if not (flag==boundaryTags['bottom'] or flag==boundaryTags['top']):
        return lambda x,t: 0.0

# DIFFUSIVE FLUX #
def vel_u_DFBC(x,flag):
    if not (flag==boundaryTags['bottom'] or flag==boundaryTags['top']):
        return lambda x,t: 0.0

def vel_v_DFBC(x,flag):
    if not (flag==boundaryTags['bottom'] or flag==boundaryTags['top']):
        return lambda x,t: 0.0

############################################
# ***** Create myTwoPhaseFlowProblem ***** #
############################################
outputStepping = TpFlow.OutputStepping(opts.final_time,dt_output=opts.dt_output)
initialConditions = {'pressure': zero(),
                     'pressure_increment': zero(),
                     'vel_u': zero(),
                     'vel_v': zero(),
                     'vel_w': zero(),
                     'clsvof': clsvof_init_cond()}
boundaryConditions = {
    # DIRICHLET BCs #
    'pressure_DBC': lambda x, flag: None,
    'pressure_increment_DBC': lambda x, flag: None,
    'vel_u_DBC': vel_u_DBC,
    'vel_v_DBC': vel_v_DBC,
    'clsvof_DBC': lambda x, flag: None,
    # ADVECTIVE FLUX BCs #
    'pressure_AFBC': lambda x, flag: lambda x, t: 0.0,
# CLSVOF #
##########
def clsvof_DBC(x,flag):
    if flag == boundaryTags['top'] and openTop:
        return lambda x,t: 1.0 # let only air in
#
def clsvof_AFBC(x,flag):
    if flag == boundaryTags['top'] and openTop:
        return None
    else:
        return lambda x,t: 0.0
#
############################################
# ***** Create myTwoPhaseFlowProblem ***** #
############################################
outputStepping = TpFlow.OutputStepping(final_time,dt_output=dt_output)
initialConditions = {'pressure': zero(),
                     'pressure_increment': zero(),
                     'vel_u': vel_x_init_cond(),
                     'vel_v': vel_y_init_cond(),
                     'clsvof': clsvof_init_cond()}
boundaryConditions = {
    # DIRICHLET BCs #
    'pressure_DBC': pressure_DBC, 
    'pressure_increment_DBC': pressure_increment_DBC, 
    'vel_u_DBC': vel_u_DBC,
    'vel_v_DBC': vel_v_DBC,
    'clsvof_DBC': clsvof_DBC, 
    # ADVECTIVE FLUX BCs #
    'pressure_AFBC': pressure_AFBC, 
    'pressure_increment_AFBC': pressure_increment_AFBC, 
Ejemplo n.º 12
0
        return lambda x, t: 1.0  # let only air in


#
def clsvof_AFBC(x, flag):
    if flag == boundaryTags['top'] and openTop:
        return None
    else:
        return lambda x, t: 0.0


#
############################################
# ***** Create myTwoPhaseFlowProblem ***** #
############################################
outputStepping = TpFlow.OutputStepping(opts.final_time,
                                       dt_output=opts.dt_output)
initialConditions = {
    'pressure': zero(),
    'pressure_increment': zero(),
    'vel_u': zero(),
    'vel_v': zero(),
    'vel_w': zero(),
    'clsvof': clsvof_init_cond()
}
boundaryConditions = {
    # DIRICHLET BCs #
    'pressure_DBC': pressure_DBC,
    'pressure_increment_DBC': pressure_increment_DBC,
    'vel_u_DBC': vel_u_DBC,
    'vel_v_DBC': vel_v_DBC,
    'vel_w_DBC': vel_w_DBC,
Ejemplo n.º 13
0
            if phi_y < 0.0:
                return max(phi_x, phi_y)
            else:
                return phi_y
        else:
            if phi_y < 0.0:
                return phi_x
            else:
                return (phi_x ** 2 + phi_y ** 2)**0.5

        
        
############################################
# ***** Create myTwoPhaseFlowProblem ***** #
############################################
outputStepping = TpFlow.OutputStepping(opts.final_time,dt_output=opts.dt_output)
initialConditions = {'pressure': zero(),
                     'vel_u': zero(),
                     'vel_v': zero(),
                     'vof': VF_IC(),
                     'ncls': PHI_IC(),
                     'rdls': PHI_IC(),
}

auxVariables={'vof': [height_gauges1, height_gauges2],
              'pressure': [pressure_gauges]}

myTpFlowProblem = TpFlow.TwoPhaseFlowProblem(ns_model=0,
                                             ls_model=0,
                                             nd=2,
                                             cfl=opts.cfl,
Ejemplo n.º 14
0
#########################
# ***** Numerics ****** #
#########################
#for structured
nny = int(tank_dim[1] / opts.he) + 1
nnx = int(tank_dim[0] / opts.he) + 1
#for unstructured
domain.MeshOptions.he = opts.he
st.assembleDomain(domain)
domain.MeshOptions.triangleOptions = "VApq30Dena%8.8f" % ((opts.he**2) / 2.0, )

############################################
# ***** Create myTwoPhaseFlowProblem ***** #
############################################
outputStepping = TpFlow.OutputStepping(opts.final_time,
                                       dt_output=opts.dt_output,
                                       dt_init=0.0001)
initialConditions = {
    'pressure': zero(),
    'pressure_increment': zero(),
    'vel_u': zero(),
    'vel_v': zero(),
    'vof': VF_IC(),
    'ncls': PHI_IC(),
    'rdls': PHI_IC()
}

myTpFlowProblem = TpFlow.TwoPhaseFlowProblem(
    ns_model=0,
    ls_model=0,
    nd=2,
Ejemplo n.º 15
0
class AtRest:
    def __init__(self):
        pass

    def uOfXT(self, x, t):
        return 0.0


#  _   _                           _
# | \ | |_   _ _ __ ___   ___ _ __(_) ___ ___
# |  \| | | | | '_ ` _ \ / _ \ '__| |/ __/ __|
# | |\  | |_| | | | | | |  __/ |  | | (__\__ \
# |_| \_|\__,_|_| |_| |_|\___|_|  |_|\___|___/
# Numerics

myTpFlowProblem = tpf.TwoPhaseFlowProblem()
myTpFlowProblem.domain = domain

myTpFlowProblem.outputStepping.final_time = 0.002
myTpFlowProblem.outputStepping.dt_init = 0.001
myTpFlowProblem.outputStepping.dt_output = 0.001
myTpFlowProblem.outputStepping.dt_fixed = 0.001

myTpFlowProblem.SystemPhysics.setDefaults()

myTpFlowProblem.SystemNumerics.cfl = 0.4

myTpFlowProblem.SystemNumerics.useSuperlu = False
myTpFlowProblem.SystemPhysics.movingDomain = False

params = myTpFlowProblem.SystemPhysics