'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,
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,
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, )
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,
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,
# 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,
domain.MeshOptions.setOutputFiles(mesh_fileprefix) st.assembleDomain(domain) domain.use_gmsh = False domain.geofile = mesh_fileprefix # _ _ _ # | \ | |_ _ _ __ ___ ___ _ __(_) ___ ___ # | \| | | | | '_ ` _ \ / _ \ '__| |/ __/ __| # | |\ | |_| | | | | | | __/ | | | (__\__ \ # |_| \_|\__,_|_| |_| |_|\___|_| |_|\___|___/ # Numerics outputStepping = TpFlow.OutputStepping( final_time=0.1, dt_init=0.01, dt_output=0.1, nDTout=None, dt_fixed=0.01, ) myTpFlowProblem = TpFlow.TwoPhaseFlowProblem( ns_model=None, ls_model=None, nd=domain.nd, cfl=0.9, outputStepping=outputStepping, structured=False, he=he, nnx=None, nny=None, nnz=None,
######################### # ***** 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,
def ncls_AFBC(x,flag): return None def rdls_AFBC(x,flag): return None # DIFFUSIVE FLUX BCs # def pressure_increment_DFBC(x,flag): if not (flag == boundaryTags['top'] and openTop): return lambda x,t: 0.0 ############################################ # ***** Create myTwoPhaseFlowProblem ***** # ############################################ outputStepping = TpFlow.OutputStepping(opts.T,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()} boundaryConditions = { # DIRICHLET BCs # 'pressure_DBC': pressure_DBC, 'vel_u_DBC': vel_u_DBC, 'vel_v_DBC': vel_v_DBC, 'vof_DBC': vof_DBC, 'ncls_DBC': ncls_DBC,