Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 36 additions & 51 deletions 2d/benchmarks/dambreak/dambreak.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
# Mesh
domain.MeshOptions.he = opts.he

#Assemble domain
st.assembleDomain(domain)

# Initial conditions
def signedDistance(x):
Expand Down Expand Up @@ -106,55 +108,38 @@ class LS_IC:
def uOfXT(self,x,t):
return signedDistance(x)

initialConditions = {'pressure': P_IC(),
'vel_u': AtRest(),
'vel_v': AtRest(),
'vel_w': AtRest()}

initialConditions['vof'] = VOF_IC()
initialConditions['ncls'] = LS_IC()
initialConditions['rdls'] = LS_IC()


outputStepping = TpFlow.OutputStepping(final_time=opts.duration,
dt_init=opts.dt_init,
# cfl=cfl,
dt_output=opts.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=opts.he,
nnx=None,
nny=None,
nnz=None,
domain=domain,
initialConditions=initialConditions,
boundaryConditions=None, # set with SpatialTools,
)

params = myTpFlowProblem.Parameters

myTpFlowProblem.useSuperLu=False#True
params.physical.densityA = opts.rho_0 # water
params.physical.densityB = opts.rho_1 # air
params.physical.kinematicViscosityA = opts.nu_0 # water
params.physical.kinematicViscosityB = opts.nu_1 # air
params.physical.surf_tension_coeff = opts.sigma

# index in order of
m = params.Models
m.rans2p.index = 0
m.vof.index = 1
m.ncls.index = 2
m.rdls.index = 3
m.mcorr.index = 4
myTpFlowProblem = TpFlow.TwoPhaseFlowProblem()
myTpFlowProblem.domain=domain

#Assemble domain
st.assembleDomain(domain)
myTpFlowProblem.Parameters.Models.rans2p.auxiliaryVariables += domain.auxiliaryVariables['twp']
myTpFlowProblem.outputStepping.final_time = opts.duration
myTpFlowProblem.outputStepping.dt_output = opts.dt_output
myTpFlowProblem.outputStepping.dt_init = opts.dt_init

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

myTpFlowProblem.SystemPhysics.setDefaults()
myTpFlowProblem.SystemPhysics.useDefaultModels(flowModel=0,interfaceModel=0)

myTpFlowProblem.SystemPhysics.modelDict['flow'].p.initialConditions['p']=P_IC()
myTpFlowProblem.SystemPhysics.modelDict['flow'].p.initialConditions['u']=AtRest()
myTpFlowProblem.SystemPhysics.modelDict['flow'].p.initialConditions['v']=AtRest()
myTpFlowProblem.SystemPhysics.modelDict['vof'].p.initialConditions['vof'] = VOF_IC()
myTpFlowProblem.SystemPhysics.modelDict['ncls'].p.initialConditions['phi'] = LS_IC()
myTpFlowProblem.SystemPhysics.modelDict['rdls'].p.initialConditions['phid'] = LS_IC()
myTpFlowProblem.SystemPhysics.modelDict['mcorr'].p.initialConditions['phiCorr'] = AtRest()

params = myTpFlowProblem.SystemPhysics

params['rho_0'] = opts.rho_0 # water
params['rho_1'] = opts.rho_1 # air
params['nu_0'] = opts.nu_0 # water
params['nu_1'] = opts.nu_1 # air
params['surf_tension_coeff'] = opts.sigma

m = params.modelDict
m['rdls'].p.coefficients.epsFact=0.75
#m.rans2p.p.CoefficientsOptions.useVF=0.


m['flow'].auxiliaryVariables += domain.auxiliaryVariables['twp']
91 changes: 39 additions & 52 deletions 2d/benchmarks/dambreak_with_obstacle/dambreak_with_obstacle.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,57 +119,44 @@ class LS_IC:
def uOfXT(self,x,t):
return signedDistance(x)

initialConditions = {'pressure': P_IC(),
'vel_u': AtRest(),
'vel_v': AtRest(),
'vel_w': AtRest()}

initialConditions['vof'] = VOF_IC()
initialConditions['ncls'] = LS_IC()
initialConditions['rdls'] = LS_IC()


outputStepping = TpFlow.OutputStepping(final_time=opts.duration,
dt_init=opts.dt_init,
# cfl=cfl,
dt_output=opts.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=opts.he,
nnx=None,
nny=None,
nnz=None,
domain=domain,
initialConditions=initialConditions,
boundaryConditions=None, # set with SpatialTools,
)

params = myTpFlowProblem.Parameters

myTpFlowProblem.useSuperLu=False#True
params.physical.densityA = opts.rho_0 # water
params.physical.densityB = opts.rho_1 # air
params.physical.kinematicViscosityA = opts.nu_0 # water
params.physical.kinematicViscosityB = opts.nu_1 # air
params.physical.surf_tension_coeff = opts.sigma

# index in order of
m = params.Models
m.rans2p.index = 0
m.vof.index = 1
m.ncls.index = 2
m.rdls.index = 3
m.mcorr.index = 4
m.rdls.p.coefficients.epsFact=0.75
#m.rans2p.p.CoefficientsOptions.useVF=0.

#Assemble domain
st.assembleDomain(domain)
myTpFlowProblem.Parameters.Models.rans2p.auxiliaryVariables += domain.auxiliaryVariables['twp']

myTpFlowProblem = TpFlow.TwoPhaseFlowProblem()
myTpFlowProblem.domain=domain

myTpFlowProblem.outputStepping.final_time = opts.duration
myTpFlowProblem.outputStepping.dt_output = opts.dt_output
myTpFlowProblem.outputStepping.dt_init = opts.dt_init

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

myTpFlowProblem.SystemPhysics.setDefaults()
myTpFlowProblem.SystemPhysics.useDefaultModels(flowModel=0,interfaceModel=0)

myTpFlowProblem.SystemPhysics.modelDict['flow'].p.initialConditions['p']=P_IC()
myTpFlowProblem.SystemPhysics.modelDict['flow'].p.initialConditions['u']=AtRest()
myTpFlowProblem.SystemPhysics.modelDict['flow'].p.initialConditions['v']=AtRest()
myTpFlowProblem.SystemPhysics.modelDict['vof'].p.initialConditions['vof'] = VOF_IC()
myTpFlowProblem.SystemPhysics.modelDict['ncls'].p.initialConditions['phi'] = LS_IC()
myTpFlowProblem.SystemPhysics.modelDict['rdls'].p.initialConditions['phid'] = LS_IC()
myTpFlowProblem.SystemPhysics.modelDict['mcorr'].p.initialConditions['phiCorr'] = AtRest()

#myTpFlowProblem.SystemPhysics.useBoundaryConditionsModule=False
#myTpFlowProblem.SystemPhysics.gravity = np.array([0.0,-9.8,0.0])

params = myTpFlowProblem.SystemPhysics

params['rho_0'] = opts.rho_0 # water
params['rho_1'] = opts.rho_1 # air
params['nu_0'] = opts.nu_0 # water
params['nu_1'] = opts.nu_1 # air
params['surf_tension_coeff'] = opts.sigma

m = params.modelDict
m['rdls'].p.coefficients.epsFact=0.75
#m.rans2p.p.CoefficientsOptions.useVF=0.


m['flow'].auxiliaryVariables += domain.auxiliaryVariables['twp']
8 changes: 4 additions & 4 deletions 2d/benchmarks/flatPlate_wallFunctions/flat_plate.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@


# Attached to 'kappa' in auxiliary variables
kWallTop = bc.kWall(Y=Y_, Yplus=Yplus, b_or=boundaryOrientations['y+'], nu=opts.nu)
kWallBottom = bc.kWall(Y=Y_, Yplus=Yplus, b_or=boundaryOrientations['y-'], nu=opts.nu)
kWallTop = bc.kWall(Y=Y_, Yplus=Yplus, nu=opts.nu)
kWallBottom = bc.kWall(Y=Y_, Yplus=Yplus, nu=opts.nu)
kWalls = [kWallTop, kWallBottom]
# Attached to 'twp' in auxiliary variables
wallTop = bc.WallFunctions(turbModel=model, kWall=kWallTop, b_or=boundaryOrientations['y+'], Y=Y_, Yplus=Yplus, U0=opts.U, nu=opts.nu, Cmu=opts.Cmu, K=opts.K, B=opts.B)
wallBottom = bc.WallFunctions(turbModel=model, kWall=kWallBottom, b_or=boundaryOrientations['y-'], Y=Y_, Yplus=Yplus, U0=opts.U, nu=opts.nu, Cmu=opts.Cmu, K=opts.K, B=opts.B)
wallTop = bc.WallFunctions(turbModel=model, kWall=kWallTop, Y=Y_, Yplus=Yplus, U0=opts.U, nu=opts.nu, Cmu=opts.Cmu, K=opts.K, B=opts.B)
wallBottom = bc.WallFunctions(turbModel=model, kWall=kWallBottom, Y=Y_, Yplus=Yplus, U0=opts.U, nu=opts.nu, Cmu=opts.Cmu, K=opts.K, B=opts.B)
walls = [wallTop, wallBottom]


Expand Down
117 changes: 48 additions & 69 deletions 2d/benchmarks/wavesloshing/wavesloshing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from proteus.Profiling import logEvent
from proteus.mprans.SpatialTools import Tank2D
import proteus.TwoPhaseFlow.TwoPhaseFlowProblem as TpFlow
import proteus.TwoPhaseFlow.utils.Parameters as Parameters



Expand Down Expand Up @@ -78,6 +79,19 @@
tank.facets = np.array([[[0, 1, 2, 3]]])
tank.facetFlags = np.array([1])

# Mesh Construction

he = opts.he
domain.MeshOptions.he = he
domain.MeshOptions.genMesh = opts.genMesh
st.assembleDomain(domain)

if opts.useHex:
domain.MeshOptions.nnx = 4 * refinement + 1
domain.MeshOptions.nny = 2*refinement+1
elif opts.structured:
domain.MeshOptions.nnx = 4 * refinement
domain.MeshOptions.nny = 2 * refinement


# Boundary Conditions
Expand Down Expand Up @@ -147,15 +161,6 @@ def uOfXT(self,x,t):
return 0.0


# Instanciating the classes for *_p.py files
initialConditions = {'pressure': PerturbedSurface_p(water_depth,
opts.amplitude),
'vel_u': AtRest(),
'vel_v': AtRest(),
'vof': PerturbedSurface_H(),
'ncls': PerturbedSurface_phi(),
'rdls': PerturbedSurface_phi()}

# Solution

def eta0(x, t):
Expand Down Expand Up @@ -279,68 +284,42 @@ def signedDistance(x, t):
d = x[1]-(water_depth+eta(x[0], t))
return d

# Numerics

outputStepping = TpFlow.OutputStepping(
final_time=opts.T,
dt_init=opts.dt_init,
# cfl=opts.cfl,
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=opts.he,
nnx=None,
nny=None,
nnz=None,
domain=domain,
initialConditions=initialConditions,
boundaryConditions=None, # set with SpatialTools,
useSuperlu=opts.useSuperlu,
)
myTpFlowProblem.movingDomain = opts.movingDomain

params = myTpFlowProblem.Parameters

# Mesh Parameters

m = params.Models

params.mesh.genMesh = opts.genMesh
params.mesh.he = opts.he
if opts.useHex:
params.mesh.nnx = 4 * refinement + 1
params.mesh.nny = 2*refinement+1
elif opts.structured:
params.mesh.nnx = 4 * refinement
params.mesh.nny = 2 * refinement
myTpFlowProblem = TpFlow.TwoPhaseFlowProblem()
myTpFlowProblem.domain=domain

params.physical.densityA = opts.rho_0 # water
params.physical.densityB = opts.rho_1 # air
params.physical.kinematicViscosityA = opts.nu_0 # water
params.physical.kinematicViscosityB = opts.nu_1 # air
params.physical.surf_tension_coeff = opts.sigma_01
# --- Timestepping for output
myTpFlowProblem.outputStepping.final_time = opts.T
myTpFlowProblem.outputStepping.dt_output = opts.dt_output
myTpFlowProblem.outputStepping.dt_init = opts.dt_init
myTpFlowProblem.outputStepping.dt_fixed = opts.dt_fixed

# index in order of
m = params.Models
m.moveMeshElastic.index=0
m.rans2p.index = 1
m.vof.index = 2
m.ncls.index = 3
m.rdls.index = 4
m.mcorr.index = 5
myTpFlowProblem.SystemNumerics.cfl=opts.cfl
myTpFlowProblem.SystemNumerics.useSuperlu=opts.useSuperlu

myTpFlowProblem.SystemPhysics.setDefaults()
myTpFlowProblem.SystemPhysics.movingDomain = opts.movingDomain

# Mesh Construction
myTpFlowProblem.SystemPhysics.addModel(Parameters.ParametersModelMoveMeshElastic,'move')
myTpFlowProblem.SystemPhysics.useDefaultModels(flowModel=0,interfaceModel=0)

he = opts.he
domain.MeshOptions.he = he
st.assembleDomain(domain)
myTpFlowProblem.SystemPhysics.modelDict['move'].p.initialConditions['hx']=AtRest()
myTpFlowProblem.SystemPhysics.modelDict['move'].p.initialConditions['hy']=AtRest()
myTpFlowProblem.SystemPhysics.modelDict['flow'].p.initialConditions['p']=PerturbedSurface_p(water_depth, opts.amplitude)
myTpFlowProblem.SystemPhysics.modelDict['flow'].p.initialConditions['u']=AtRest()
myTpFlowProblem.SystemPhysics.modelDict['flow'].p.initialConditions['v']=AtRest()
myTpFlowProblem.SystemPhysics.modelDict['vof'].p.initialConditions['vof'] = PerturbedSurface_H()
myTpFlowProblem.SystemPhysics.modelDict['ncls'].p.initialConditions['phi'] = PerturbedSurface_phi()
myTpFlowProblem.SystemPhysics.modelDict['rdls'].p.initialConditions['phid'] = PerturbedSurface_phi()
myTpFlowProblem.SystemPhysics.modelDict['mcorr'].p.initialConditions['phiCorr'] = AtRest()

params = myTpFlowProblem.SystemPhysics

params['rho_0'] = opts.rho_0 # water
params['rho_1'] = opts.rho_1 # air
params['nu_0'] = opts.nu_0 # water
params['nu_1'] = opts.nu_1 # air
params['surf_tension_coeff'] = opts.sigma_01

m = params.modelDict

m['flow'].auxiliaryVariables += domain.auxiliaryVariables['twp']
8 changes: 4 additions & 4 deletions 2d/caissonBreakwater/sliding/tank.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,13 @@

# Waves and Generation zone
if opts.GenZone and opts.wave:
tank.setGenerationZones(flags=1, epsFact_solid=float(L_leftSpo/2.),
tank.setGenerationZones(flags=1, epsFact_porous=float(L_leftSpo/2.),
orientation=[1., 0.], center=(float(L_leftSpo/2.), 0., 0.),
waves=waveinput, smoothing=3.0*he, dragAlpha=10.*omega/nu_0)

# Only Generation zone
elif opts.GenZone:
tank.setAbsorptionZones(flags=1, epsFact_solid=float(L_leftSpo/2.),
tank.setAbsorptionZones(flags=1, epsFact_porous=float(L_leftSpo/2.),
orientation=[1., 0.], center=(float(L_leftSpo/2.), 0., 0.),
dragAlpha=10.*omega/nu_0)

Expand All @@ -501,11 +501,11 @@
# Absorption zone
if opts.AbsZone:
if opts.caisson2D:
tank.setAbsorptionZones(flags=4, epsFact_solid=float(L_rightSpo/2.),
tank.setAbsorptionZones(flags=4, epsFact_porous=float(L_rightSpo/2.),
orientation=[-1., 0.], center=(float(tank_dim[0]-L_rightSpo/2.), 0., 0.),
dragAlpha=10.*omega/nu_0)
else:
tank.setAbsorptionZones(flags=3, epsFact_solid=float(L_rightSpo/2.),
tank.setAbsorptionZones(flags=3, epsFact_porous=float(L_rightSpo/2.),
orientation=[-1., 0.], center=(float(tank_dim[0]-L_rightSpo/2.), 0., 0.),
dragAlpha=10.*omega/nu_0)

Expand Down
Loading