Beispiel #1
0
import numpy as np
from proteus import Domain, Context
from proteus.mprans import SpatialTools as st
import proteus.TwoPhaseFlow.TwoPhaseFlowProblem as TpFlow
from proteus import WaveTools as wt

# dependencies for FSI
from proteus.mbd import CouplingFSI as fsi
import pychrono

opts = Context.Options([
    ("final_time", 10.0, "Final time for simulation"),
    ("dt_output", 0.1, "Time interval to output solution"),
    ("cfl", 0.5, "Desired CFL restriction"),
    ("he", 0.05, "he relative to Length of domain in x"),
])

# general options
# sim time
T = opts.final_time
# initial step
dt_init = 0.001
# CFL value
cfl = 0.5
# mesh size
he = 0.05
# rate at which values are recorded
sampleRate = 0.05
# for ALE formulation
movingDomain = True
# for added mass stabilization
Beispiel #2
0
Rising bubble test
"""
from __future__ import division
from past.utils import old_div
import numpy as np
from proteus import (Domain, Context)
from proteus.Profiling import logEvent
import proteus.TwoPhaseFlow.TwoPhaseFlowProblem as TpFlow

# *************************** #
# ***** GENERAL OPTIONS ***** #
# *************************** #
opts= Context.Options([
    ('ns_model',1,"ns_model = {rans2p,rans3p}"),
    ("final_time",5.0,"Final time for simulation"),
    ("dt_output",0.1,"Time interval to output solution"),
    ("cfl",0.2,"Desired CFL restriction"),
    ("he", 0.5, "Maximum mesh element diameter"),
    ("ARTIFICIAL_VISCOSITY",3,"artificial viscosity")
    ])

assert opts.ns_model==1, "Surface tension is only implemented with rans3p. use ns_model=1"

# ****************** #
# ***** GAUGES ***** #
# ****************** #
# None

# *************************** #
# ***** DOMAIN AND MESH ***** #
# ****************** #******* #
L      = [3.22,1.0,1.0]
    ("dt_fixed", 0.5, "Value of maximum time step"),
    ("archiveAllSteps", False, "archive every steps"),
    ("dt_output", 1., "number of saves per second"),
    ("cfl", 0.9 , "Target CFL value"),
    ]
# mesh options
context_options += [
    ("he", 1. , "Characteristic element size"),
    ]
# other options
context_options += [
    ("radius", 0.5, "Radius of cylinder"),
    ("use_ball_as_particle", 0., "use ball method"),
    ]

opts = Context.Options(context_options)
he = opts.he
radius = opts.radius

#  ____                        _
# |  _ \  ___  _ __ ___   __ _(_)_ __
# | | | |/ _ \| '_ ` _ \ / _` | | '_ \
# | |_| | (_) | | | | | | (_| | | | | |
# |____/ \___/|_| |_| |_|\__,_|_|_| |_|
# Domain
# All geometrical options go here (but not mesh options)

domain = Domain.PlanarStraightLineGraphDomain()

# ----- SHAPES ----- #
Beispiel #4
0
opts=Context.Options([
    # Geometry and sed parameters
    ("waterLine_x", 10.00, "Width of free surface from left to right"),
    ("waterLine_z", 2., "Heigth of free surface above bottom"),
    ("sediment_level", 1.75, "Height of the sediment column"),
    ("sediment_bottom", -1.25, "Height of the sediment column"),
    ("Lx", 1.50, "Length of the numerical domain"),
    ("Ly", 3., "Heigth of the numerical domain"),
    ("dtout", 0.05, "Time interval for output"),
    #fluid parameters
    ("rho_0", 998.2, "water density"),
    ("rho_1", 1.205, "air density"),
    ("nu_0", 1e-6, "water kin viscosity"),
    ("nu_1", 1.5e-5, "air kin viscosity"),
    ('g',np.array([0.0, -9.8, 0.0]),'Gravitational acceleration'),    
    # sediment parameters
    ('cSed', 0.55,'Initial sediment concentration'),
    ('rho_s',2600 ,'sediment material density'),
    ('alphaSed', 150.,'laminar drag coefficient'),
    ('betaSed', 1.72,'turbulent drag coefficient'),
    ('grain',0.0025, 'Grain size'),
    ('packFraction',0.2,'threshold for loose / packed sediment'),
    ('packMargin',0.01,'transition margin for loose / packed sediment'),
    ('maxFraction',0.635,'fraction at max  sediment packing'),
    ('frFraction',0.57,'fraction where contact stresses kick in'),
    ('sigmaC',0.57,'Schmidt coefficient for turbulent diffusion'),
    ('C3e',1.2,'Dissipation coefficient '),
    ('C4e',1.2,'Dissipation coefficient'),
    ('eR', 0.8, 'Collision stress coefficient (module not functional)'),
    ('fContact', 0.05,'Contact stress coefficient'),
    ('mContact', 3.0,'Contact stress coefficient'),
    ('nContact', 5.0,'Contact stress coefficient'),
    ('angFriction', pi/6., 'Angle of friction'),
    ('vos_limiter', 0.62, 'Weak limiter for vos'),
    ('mu_fr_limiter', 1e-3,'Hard limiter for contact stress friction coeff'),
     # numerical options
    ("refinement", 25.,"L[0]/refinement"),
    ("sedimentDynamics", True, "Enable sediment dynamics module"),
    ("cfl", 0.25 ,"Target cfl"),
    ("duration", 10.0 ,"Duration of the simulation"),
    ("PSTAB", 1.0, "Affects subgrid error"),
    ("res", 1.0e-8, "Residual tolerance"),
    ("epsFact_density", 3.0, "Control width of water/air transition zone"),
    ("epsFact_consrv_diffusion", 1.0, "Affects smoothing diffusion in mass conservation"),
    ("useRANS", 0, "Switch ON turbulence models: 0-None, 1-K-Epsilon, 2-K-Omega1998, 3-K-Omega1988"),
    # ns_closure: 1-classic smagorinsky, 2-dynamic smagorinsky, 3-k-epsilon, 4-k-omega
    ("sigma_k", 1.0, "sigma_k coefficient for the turbulence model"),
    ("sigma_e", 1.0, "sigma_e coefficient for the turbulence model"),
    ("Cmu", 0.09, "Cmu coefficient for the turbulence model"),
    ])
Beispiel #5
0
from proteus.Gauges import PointGauges
import proteus.SWFlows.SWFlowProblem as SWFlowProblem

"""
This is the problem of a solitary wave overtopping a conical island.
This experiment was done at (insert ref here). There were several gauges
places in the tank measuring the water height (location can be see in bottom)
"""

# *************************** #
# ***** GENERAL OPTIONS ***** #
# *************************** #
opts = Context.Options([
    ('sw_model', 1, "sw_model = {0,1} for {SWEs,DSWEs}"),
    ("final_time", 10.0, "Final time for simulation"),
    ("dt_output", 0.1, "Time interval to output solution"),
    ("cfl", 0.25, "Desired CFL restriction"),
    ("refinement", 4, "Refinement level"),
    ("reflecting_BCs", False, "Use reflecting BCs")
])

###################
# DOMAIN AND MESH #
###################
L = (48.8, 26.5)  # this is length in x direction and y direction
refinement = opts.refinement
domain = RectangularDomain(L=L, x=[0, -13.25, 0])

# CREATE REFINEMENT #
nnx0 = 6
nnx = (nnx0 - 1) * (2**refinement) + 1
nny = old_div((nnx - 1), 2) + 1
Beispiel #6
0
from __future__ import absolute_import
from __future__ import division
from builtins import range
from past.utils import old_div
from math import *
import proteus.MeshTools
from proteus import Domain
from proteus.default_n import *
from proteus import Context
'''
flow around a 2D cylinder  benchmark problem.
'''

opts = Context.Options(
    [("T", 4.0, "Time interval [0, T]"), ("he", 0.2, "maximum size of edges"),
     ("backwardEuler", False, "use backward Euler or not"),
     ("onlySaveFinalSolution", False, "Only save the final solution")],
    mutable=True)

nd = 2
spaceOrder = 1
useHex = False
DX = opts.he
usePETSc = False  #True

parallelPartitioningType = MeshParallelPartitioningTypes.node
nLayersOfOverlapForParallel = 1

L = 2.2
H = 0.41
Um = 1.5
from past.utils import old_div
import numpy as np
from proteus import (Domain, Context, LinearSolvers)
from proteus.Profiling import logEvent
from proteus.mprans.SpatialTools import Tank2D
from proteus.mprans import SpatialTools as st
import proteus.TwoPhaseFlow.TwoPhaseFlowProblem as TpFlow
from proteus.Gauges import PointGauges, LineIntegralGauges, LineGauges

# *************************** #
# ***** GENERAL OPTIONS ***** #
# *************************** #
opts= Context.Options([
    ("final_time",3.0,"Final time for simulation"),
    ("dt_output",0.01,"Time interval to output solution"),
    ("cfl",0.25,"Desired CFL restriction"),
    ("he",0.01,"he relative to Length of domain in x"),
    ("refinement",3,"level of refinement")
    ])

# ****************** #
# ***** GAUGES ***** #
# ****************** #
height_gauges1 = LineGauges(gauges=((("phi",),
                                        (((2.724, 0.0, 0.0),
                                          (2.724, 1.8, 0.0)), # We consider this one in our paper
                                         ((2.228, 0.0, 0.0),
                                          (2.228, 1.8, 0.0)), # We consider this one in our paper
                                         ((1.732, 0.0, 0.0),
                                          (1.732, 1.8, 0.0)),
                                         ((0.582, 0.0, 0.0),
Beispiel #8
0
from proteus.ctransportCoefficients import smoothedHeaviside
from proteus.ctransportCoefficients import smoothedHeaviside_integral
from proteus import Gauges
from proteus.Gauges import PointGauges, LineGauges, LineIntegralGauges
from proteus import WaveTools as WT
import vegZoneVelocityInterp as vegZoneInterp

from proteus import Context

opts = Context.Options([
    ("wave_type", 'linear',
     "type of waves generated: 'linear', 'Nonlinear', 'single-peaked', 'double-peaked'"
     ),
    ("depth", 0.457,
     "water depth at leading edge of vegetation (not at wave generator)[m]"),
    ("wave_height", 0.192, "wave height at leading edget of vegetation [m]"),
    ("peak_period", 2.0, "Peak period [s]"),
    ("peak_period2", 1.5,
     "Second peak period (only used in double-peaked case)[s]"),
    ("peak_wavelength", 3.91, "Peak wavelength in [m]"),
    ("parallel", False, "Run in parallel"), ("gauges", True, "Enable gauges"),
    ("tank_height", 1.0, "height of wave tank")
])

#wave generator
windVelocity = (0.0, 0.0, 0.0)
veg_platform_height = 17.2 / 44.0 + 6.1 / 20.0
depth = opts.depth  #veg_platform_height + opts.depth
inflowHeightMean = depth
inflowVelocityMean = (0.0, 0.0, 0.0)
period = opts.peak_period
omega = 2.0 * math.pi / period
Beispiel #9
0
ct = Context.Options(
    [
        # General parameters #
        ("T", 0.1, "Final time"),
        ("nDTout", 1, "Number of time steps to archive"),
        ("refinement", 0, "Level of refinement"),
        ("unstructured", False,
         "Use unstructured mesh. Set to false for periodic BCs"),
        ("SSPOrder", 2, "SSP method of order 1, 2 or 3"),
        ("cfl", 0.5, "Target cfl"),
        # PARAMETERS FOR NCLS #
        ("level_set_function", 1,
         "0: distance function, 1: saturated distance function"),
        ("STABILIZATION_TYPE_ncls", 1,
         "0: SUPG, 1: EV, 2: smoothness based indicator"),
        ("SATURATED_LEVEL_SET", True,
         "Saturate the distance function or not?"),
        ("ENTROPY_TYPE_ncls", 2, "1: parabolic, 2: logarithmic"),
        ("COUPEZ", True,
         "Flag to turn on/off the penalization term in Coupez approach"),
        ("DO_REDISTANCING", True,
         "Solve Eikonal type equation after transport?"),
        ("cE_ncls", 1.0, "Entropy viscosity constant"),
        # PARAMETERS FOR VOF #
        ("STABILIZATION_TYPE_vof", 1,
         "0: SUPG, 1: TG, 2: edge based EV, 3: edge based smoothness ind."),
        ("ENTROPY_TYPE_vof", 1, "0: quadratic, 1: logarithmic"),
        ("FCT", True, "Use Flux Corrected Transport"),
        ("cE_vof", 0.1, "Entropy viscosity constant"),
        ("cK", 1.0, "Artificial compression constant")
    ],
    mutable=True)
Beispiel #10
0
from proteus import (Domain, TimeIntegration, StepControl, FemTools,
                     Quadrature, NonlinearSolvers, LinearAlgebraTools,
                     LinearSolvers, MeshTools, Context, AnalyticalSolutions)
from proteus.default_so import *
from proteus.mprans import RANS2P
import os

opts = Context.Options([
    ("nd", 2, "Number of space dimensions"),
    ("grid", True, "Use a regular grid"),
    ("triangles", True, "Use triangular or tetrahedral elements"),
    ("spaceOrder", 1, "Use (bi-)linear or (bi-)quadratic spaces"),
    ("useTaylorHood", False, "Use Taylor-Hood element"),
    ("timeOrder", 1, "Use bdf1 or bdf2"),
    ("periodic", False, "Use periodic boundary conditions"),
    ("weak", True, "Use weak boundary conditions"),
    ("coord", False, "Use coordinates for setting boundary conditions"),
    ("Re", 1.0, "Reynolds number for non-periodic problem"),
    #("nnx", 21, "Number of grid nodes in x-direction"),
    ("nnx", 11, "Number of grid nodes in x-direction"),
    ("pc_type", 'LU', "Specify preconditioner type"),
    ("A_block_AMG", False,
     "Specify whether a block-AMG should be used to solve A-block")
])

#########
#Physics#
#########
p = Physics_base(nd=opts.nd, name="duct_physics")

p.L = (4.0, 1.0, 1.0)
Beispiel #11
0
from proteus import Gauges as ga
from proteus.mprans import BoundaryConditions as bc

opts = Context.Options([
    # Geometry
    ('Lx', 4., 'Domain length'),
    ('Ly', 0.4, 'Domain height'),
    # Flow
    ('U', [0.2, 0.0, 0.0], 'Set inlet velocity'),
    ('ramp', 1., "ramp time"),
    ('nu', 1e-6, 'Kinematic viscosity'),
    ('rho', 1000., 'Density'),
    ('g', np.array([0, -9.81, 0]), "gravitational acceleration"),
    # Turbulence and parameters
    ("useRANS", 1,
     "Switch ON turbulence models: 0-None, 1-K-Epsilon, 2-K-Omega1998, 3-K-Omega1988"
     ),  # ns_closure: 1-classic smagorinsky, 2-dynamic smagorinsky, 3-k-epsilon, 4-k-omega
    ("sigma_k", 1.0, "sigma_k coefficient for the turbulence model"),
    ("K", 0.41, "von Karman coefficient for the turbulence model"),
    ("B", 5.57, "Wall coefficient for the turbulence model"),
    ("Cmu", 0.09, "Cmu coefficient for the turbulence model"),
    # simulation options
    ('duration', 10., 'Simulation duration'),
    ('dt_init', 0.001, 'Initial timestep'),
    ('dt_output', 0.1, 'time output interval'),
    ("he", 0.03, "Mesh size"),
    ("cfl", 0.5, "Target cfl")
])

#########################################
#domain
Beispiel #12
0
opts = Context.Options([

    # Geometry
    ("tank_height", 0.8, "Vertical Dimention of the tank"),
    ("Lback", 4.0, "Horizontal Dimention of overtopping collection tank"),
    ("pipe_0", 0.5, "lower level of the drainage pipe"),
    ("pipe_1", 0.4, "upper level of the drainage pipe"),
    ("tube", 0.1, "tube dimension"),
    ("waterline_x", 10000, "used in levelset"),

    # Physical Properties
    ("rho_0", 998.2, "Water density"),
    ("nu_0", 1.004e-6, "Water viscosity"),
    ("rho_1", 1.205, "Air density"),
    ("nu_1", 1.5e-5, "Air viscosity"),
    ("sigma_01", 0., "surface tension"),
    ("g", np.array([0., -9.805, 0.]), "gravity"),

    # Waves
    ("Tstart", 0, "Start time"),
    ("fract", 1, "fraction of duration"),
    ("Ntotalwaves", 500, "totalnumber of waves"),
    ("x0", np.array([0., 0., 0.]), "Position vector for the tinme series"),
    ("Tp", 3.5, "Peak wave period"),
    ("Hs", 0.096, "Significant wave height"),
    ("mwl", 0.4, "Mean Water level"),
    ("depth", 0.4, "Water depth"),
    ("waveDir", np.array([1., 0., 0.]), "Direction of the waves"),
    ("N", 2000, "Number of frequency components"),
    ("bandFactor", 2.0, "Spectal Band Factor"),
    ("spectName", "JONSWAP", "Name of Spectral Distribution"),
    ("spectral_params", {
        "gamma": 3.3,
        "TMA": False,
        "depth": 0.4
    }, "Spectral Distribution Characteristics"),
    ("seed", 420, "Seed for random phases"),
    ("Lgen", None, "Length of the generation zone"),
    ("Nwaves", 15, "Number of waves per window"),
    ("Nfreq", 32, "Number of fourier components per window"),

    # gauges
    ("dx", 0.01, "vertical spacing in probes [m] "),

    # Numerical Options
    ("refinement_level", 200., "he=wavelength/refinement_level"),
    ("cfl", 0.5, "Target cfl"),
    ("ecH", 1.5, "Smoothing Coefficient"),
    ("Np", 5., " Output points per period Tp/Np"),
    ("dt_init", 0.001, "initial time step"),

    # Obstacle Dimensions
    ("structure_slope", 4, "1/slope"),
    ("structureCrestLevel", 0.5,
     "elevation of structure crest. Equal to Water depth + Rc (crest freeboard)"
     )
])
Beispiel #13
0
Multiphase Flow Test
"""
import numpy as np
from proteus import (Domain, Context)
import proteus.TwoPhaseFlow.TwoPhaseFlowProblem as TpFlow
import math
from proteus.ctransportCoefficients import smoothedHeaviside
from proteus import WaveTools as wt
from proteus.mprans import SpatialTools as st

# *************************** #
# ***** GENERAL OPTIONS ***** #
# *************************** #
opts = Context.Options([('ns_model', 1, "ns_model={0,1} for {rans2p,rans3p}"),
                        ("final_time", 10.0, "Final time for simulation"),
                        ("dt_output", 0.1, "Time interval to output solution"),
                        ("gauges", True, "Collect data for validation"),
                        ("cfl", 0.9, "Desired CFL restriction"),
                        ("he", 0.08, "Max mesh element diameter")])

waterLevel = 0.9
pro_wl = 0.5
g = np.array([0., -9.81, 0.0])
he = opts.he
# ****************** #
# ***** GAUGES ***** #
# ****************** #

# *************************** #
# ***** DOMAIN AND MESH ***** #
# *************************** #
domain = Domain.PlanarStraightLineGraphDomain()
import proteus.TwoPhaseFlow.TwoPhaseFlowProblem as TpFlow
from proteus.Gauges import PointGauges, LineIntegralGauges, LineGauges
from proteus import WaveTools as wt
from proteus.ctransportCoefficients import smoothedHeaviside
import math
# *************************** #
# ***** GENERAL OPTIONS ***** #
# *************************** #
opts = Context.Options([
    ("final_time", 10.0, "Final time for simulation"),
    ("dt_output", 0.01, "Time interval to output solution"),
    ("cfl", 0.25, "Desired CFL restriction"),
    ("he", 0.1, "he relative to Length of domain in x"),
    ("refinement", 3, "level of refinement"),
    ("slope", (1 / 19.85), "Beta, slope of incline (y/x)"),
    ("slope_length", 50.0, "right extent of domain x(m)"),
    ("wl", 1.0, "water level"),
    ("waves", True, "wave on/off"),
    ("wave_height", 0.28, "Height of the waves in s"),
    ("wave_dir", (1., 0., 0.), "Direction of the waves (from left boundary)"),
    ("wave_type", 'solitaryWave', "type of wave"),
    ("fast", False, "switch for fast cosh calculations in WaveTools"),
    ("g", [0, -9.81, 0], "Gravity vector in m/s^2"),
])

toe = (-opts.wl / opts.slope) + 35  #shifted
structured = False
slope = opts.slope
slope_x = opts.slope_length - toe
slope_y = slope * slope_x
top = (slope_y) * 1.35
he = opts.he
Beispiel #15
0
from proteus.mprans import VOF
import numpy as np
import math

ct = Context.Options(
    [
        # General parameters #
        ("problem", 0,
         "0: 1D problem with periodic BCs. 1: 2D rotation of zalesak disk"),
        ("T", 0.1, "Final time"),
        ("nDTout", 1, "Number of time steps to archive"),
        ("refinement", 0, "Level of refinement"),
        ("unstructured", False,
         "Use unstructured mesh. Set to false for periodic BCs"),
        # Choice of numerical method #
        ("STABILIZATION_TYPE", 1,
         "0: SUPG, 1: EV, 2: smoothness based indicator"),
        ("LUMPED_MASS_MATRIX", False, "Flag to lumped the mass matrix"),
        ("ENTROPY_TYPE", 1, "1: quadratic, 2: logarithmic"),
        ("FCT", True, "Use Flux Corrected Transport"),
        # Numerical parameters #
        ("cE", 0.1, "Entropy viscosity constant"),
        ("cK", 1.0, "Artificial compression constant"),
        ("cfl", 0.5, "Target cfl"),
        ("SSPOrder", 2, "SSP method of order 1, 2 or 3")
    ],
    mutable=True)

assert ct.problem == 0 or ct.problem == 1, "problem must be set to 0 or 1"
# SHOCK CAPTURING PARAMETERS #
shockCapturingFactor_vof = 0.2
Beispiel #16
0
from __future__ import print_function
from __future__ import division
from past.utils import old_div
from math import *
import proteus.MeshTools
from proteus import Domain
from proteus.default_n import *
from proteus.default_so import *
from proteus import defaults
defaults.reset_default_n()
defaults.reset_default_so()
from proteus import Context

opts = Context.Options([
    ("he", 0.2, "max element diameter"),
    ("schur_solver", 'two_phase_PCD', "preconditioner type"),
])

nd = 2
spaceOrder = 1
Refinement = 1
useHex = False
useVF = 0.0
#points_on_grain = 2
DX = opts.he  #2 #0.02 #0.08, 0.04, 0.02
usePETSc = True
useOnlyVF = True
useMetrics = True
useOldPETSc = False
useSuperlu = False
timeDiscretization = 'be'
Beispiel #17
0
ct = Context.Options(
    [
        # General parameters #
        ("problem", 0, "0: 1D advection with PBCs. 1: 2D rotation of disk"),
        ("level_set_function", 1,
         "0: distance function, 1: saturated distance function"),
        ("T", 0.1, "Final time"),
        ("nDTout", 1, "Number of time steps to archive"),
        ("refinement", 0, "Level of refinement"),
        ("unstructured", False,
         "Use unstructured mesh. Set to false for periodic BCs"),
        # Choice of numerical method #
        ("STABILIZATION_TYPE", 1,
         "0: SUPG, 1: EV, 2: smoothness based indicator"),
        ("SATURATED_LEVEL_SET", True,
         "Saturate the distance function or not?"),
        ("ENTROPY_TYPE", 2, "1: parabolic, 2: logarithmic"),
        ("COUPEZ", True,
         "Flag to turn on/off the penalization term in Coupez approach"),
        ("DO_REDISTANCING", True,
         "Solve Eikonal type equation after transport?"),
        # Numerical parameters #
        ("pure_redistancing", False,
         "To test pure redistancing; i.e., no advection"),
        ("cE", 1.0, "Entropy viscosity constant"),
        ("cfl", 0.5, "Target cfl"),
        ("SSPOrder", 2, "SSP method of order 1, 2 or 3")
    ],
    mutable=True)
Beispiel #18
0
Experiments were reported in 'The runup of solitary waves' [Synolakas, 1987].
"""

# *************************** #
# ***** GENERAL OPTIONS ***** #
# *************************** #

# Note that the final time should correspond to the experimental data time
# Tstar = {10,15,20,...,65} for the final time. We redefine the final time
# in the problem set up at the bottom of the file
opts = Context.Options([
    ('sw_model', 1, "sw_model = {0,1} for {SWEs, Disperisve SWEs}"),
    ("final_time", 30.0, "Final time for simulation"),
    ("dt_output", 0.1, "Time interval to output solution"),
    ("cfl", 0.25, "Desired CFL restriction"),
    ("refinement", 4, "Refinement level"),
    ("reflecting_BCs", False, "Use reflecting BCs"),
    ("structured", True, "Structured or unstructured mesh"),
    ("he", 0.5, "Mesh size for unstructured mesh"),
    ("mannings", 0.016, "Mannings roughness coefficient")
])

###################
# DOMAIN AND MESH #
###################
L = (50.0, 1.0)
refinement = opts.refinement
rectangle = RectangularDomain(L=L, x=[-35.0, 0, 0])  # x is origin

# CREATE REFINEMENT #
nnx0 = 6
from proteus.Gauges import PointGauges, LineIntegralGauges, LineGauges
from proteus.Profiling import logEvent
from proteus.mprans.SpatialTools import Tank2D
from proteus.mprans import SpatialTools as st
import proteus.TwoPhaseFlow.TwoPhaseFlowProblem as TpFlow

# *************************** #
# ***** GENERAL OPTIONS ***** #
# *************************** #
opts= Context.Options([
    # About time #
    ("final_time",10.0,"Final time for simulation"),
    ("dt_output",0.1,"Time interval to output solution"),
    # About the domain #
    ("Lx",20,"Length of the domain in x"),
    ("bA",0.5,"Location of the bathymetry"),
    # Initial condition #
    ("mwl",0.75,"mean water level"),
    ("A",0.05,"amplitude"),
    ("sig2",2.0,"variance"),
    # About the mesh #
    ("he",0.01,"level of refinement"),
    ("structured",True,"Use structured mesh")],)

# Navier-Stokes model
ns_model=1 #0: rans2p, 1: rans3p

# General parameters
final_time=opts.final_time
dt_output=opts.dt_output

# About the domain
Beispiel #20
0
from proteus.Profiling import logEvent
from proteus.Gauges import PointGauges, LineGauges, LineIntegralGauges

from proteus import Context

ct = Context.Options(
    [
        ("T", 3.0, "Time interval [0, T]"),
        ("onlySaveFinalSolution", False, "Only save the final solution"),
        ("parallel", False, "Use parallel or not"),
        ("dt_fixed", 0.005, "fixed time step"),
        ##################################
        ("Refinement", 3, "refinement"),
        ("StrongDirichlet", True, "weak or strong"),
        ("use_sbm", 0, "use sbm instead of imb"),
        ("spaceOrder", 1, "FE space for velocity"),
        ("timeOrder", 2,
         "1=be or 2=vbdf"),  #both works, but 2 gives better cd-cl
        ("use_supg", 1, "Use supg or not"),
        ("nonconservative", 1, "0=conservative"),
        ("forceStrongDirichlet", False, "strong or weak"),
        ##################################
        ("use_ball_as_particle", 1, "1 or 0 == use ball or particle"),
        ("isHotStart", False, "Use hotStart or not"),
    ],
    mutable=True)

#===============================================================================
# supg
#===============================================================================
use_supg = ct.use_supg  ##########
opts=Context.Options([
    # predefined test cases
    ("water_level", 0.86, "Height of free surface above seabed"),
    # tank
    ("tank_dim", (58., 3.), "Dimensions of the tank"),
    ("generation", True, "Generate waves at the left boundary (True/False)"),
    ("absorption", True, "Absorb waves at the right boundary (True/False)"),
    ("tank_sponge", (5., 5.), "Length of relaxation zones zones (left, right)"),
    ("free_slip", True, "Should tank walls have free slip conditions "
                        "(otherwise, no slip conditions will be applied)."),
    # waves
    ("waves", True, "Generate waves (True/False)"),
    ("wave_period", 2.02, "Period of the waves"),
    ("wave_height", 0.02, "Height of the waves"),
    ("wave_depth", 0.86, "Wave depth"),
    ("wave_dir", (1.,0.,0.), "Direction of the waves (from left boundary)"),
    ("wave_wavelength", 5.037, "Direction of the waves (from left boundary)"), #calculated by FFT
    ("wave_type", 'Fenton', "type of wave"),
    ("Bcoeff", np.array([0.01402408, 0.00008097, 0.00000013, 0.00000000, 0.00000000,
                          0.00000000, 0.00000000, 0.00000000]), "Bcoeffs"),
    ("Ycoeff", np.array([0.01246994, 0.00018698, 0.00000300, 0.00000006, 0.00000000,
                          0.00000000, 0.00000000, 0.00000000]), "Ycoeffs"),
    ("fast", True, "switch for fast cosh calculations in WaveTools"),
    # mesh refinement
    ("refinement", False, "Gradual refinement"),
    ("he", 0.04, "Set characteristic element size"),
    ("he_max", 10, "Set maximum characteristic element size"),
    ("he_max_water", 10, "Set maximum characteristic in water phase"),
    ("refinement_freesurface", 0.1,"Set area of constant refinement around free surface (+/- value)"),
    ("refinement_caisson", 0.,"Set area of constant refinement (Box) around caisson (+/- value)"),
    ("refinement_grading", np.sqrt(1.1*4./np.sqrt(3.))/np.sqrt(1.*4./np.sqrt(3)), "Grading of refinement/coarsening (default: 10% volume)"),
    # numerical options
    ("gen_mesh", True, "True: generate new mesh every time. False: do not generate mesh if file exists"),
    ("use_gmsh", True, "True: use Gmsh. False: use Triangle/Tetgen"),
    ("movingDomain", False, "True/False"),
    ("T", 30.0, "Simulation time"),
    ("dt_init", 0.001, "Initial time step"),
    ("dt_fixed", None, "Fixed (maximum) time step"),
    ("timeIntegration", "backwardEuler", "Time integration scheme (backwardEuler/VBDF)"),
    ("cfl", 0.5 , "Target cfl"),
    ("nsave",  5, "Number of time steps to save per second"),
    ("useRANS", 0, "RANS model"),
    ])
Beispiel #22
0
from proteus.default_p import *
from proteus.mprans import SW2D
from proteus.mprans import SW2DCV
from proteus.mprans import GN_SW2DCV
from proteus.Domain import RectangularDomain
import numpy as np
from proteus import (Domain, Context, MeshTools as mt)
from proteus.Profiling import logEvent
import proteus.SWFlow.SWFlowProblem as SWFlowProblem

# *************************** #
# ***** GENERAL OPTIONS ***** #
# *************************** #
opts = Context.Options([('sw_model', 0, "sw_model = {0,1} for {SWEs,DSWEs}"),
                        ("final_time", 1000.0, "Final time for simulation"),
                        ("dt_output", 10.0,
                         "Time interval to output solution"),
                        ("cfl", 0.33, "Desired CFL restriction")])

###################
# DOMAIN AND MESH #
###################
L = (10000.0, 10000.0)
refinement = 3
domain = RectangularDomain(L=L, x=[0, 0, 0])

# CREATE REFINEMENT #
nnx0 = 6
nnx = nny = (nnx0 - 1) * (2**refinement) + 1
he = old_div(L[0], float(nnx - 1))
triangleOptions = "pAq30Dena%f" % (0.5 * he**2, )
Beispiel #23
0
"""
from __future__ import division
from past.utils import old_div
import numpy as np
from proteus import (Domain, Context, MeshTools as mt)
from proteus.Profiling import logEvent
import proteus.TwoPhaseFlow.TwoPhaseFlowProblem as TpFlow
import os

# *************************** #
# ***** GENERAL OPTIONS ***** #
# *************************** #
opts = Context.Options([("test_case", 1, "1: Guermond's, 2: physical"),
                        ('ns_model', 1, "ns_model = {rans2p,rans3p}"),
                        ("final_time", 5.0, "Final time for simulation"),
                        ("dt_output", 0.2, "Time interval to output solution"),
                        ("cfl", 0.2, "Desired CFL restriction"),
                        ("refinement", 3, "level of refinement"),
                        ("he", 1E-2, "he value"),
                        ("ARTIFICIAL_VISCOSITY", 3, "artificial viscosity")])

# ****************** #
# ***** GAUGES ***** #
# ****************** #
# None

# *************************** #
# ***** DOMAIN AND MESH ***** #
# ****************** #******* #
tank_dim = (0.4, 0.4)
# MESH
refinement = opts.refinement
Beispiel #24
0
from proteus import (Domain, Context, Gauges, MeshTools as mt)
from proteus.Gauges import PointGauges, LineIntegralGauges, LineGauges
from proteus.Profiling import logEvent
from proteus.mprans.SpatialTools import Tank2D
from proteus.mprans import SpatialTools as st
import proteus.TwoPhaseFlow.TwoPhaseFlowProblem as TpFlow

# *************************** #
# ***** GENERAL OPTIONS ***** #
# *************************** #
opts = Context.Options([
    ("final_time", 8.0, "Final time for simulation"),
    ("dt_output", 0.1, "Time interval to output solution"),
    ("A", 0.35, "amplitude"), ("sig2", 4.0, "variance"),
    ("Lx", 20, "Length of the domain in x"),
    ("Ly", 0.3, "Length of the domain in y"),
    ("Lz", 1.25, "Length of the domain in y"), ("bA", 0.0, "bathymetry A"),
    ("bB", 0.5, "bathymetry B"),
    ("slipOnBottom", False, "Slip Boundary condition on bottom?"),
    ("he", 0.01, "Max mesh element diameter")
])

# Navier-Stokes model
ns_model = 1  #0: rans2p, 1: rans3p

# General parameters
final_time = opts.final_time
dt_output = opts.dt_output

# About the domain
Lx = opts.Lx
from __future__ import division
from past.utils import old_div
import numpy as np
from proteus import (Domain, Context)
from proteus.Profiling import logEvent
from proteus.mprans.SpatialTools import Tank2D
from proteus.mprans import SpatialTools as st
import proteus.TwoPhaseFlow.TwoPhaseFlowProblem as TpFlow

# *************************** #
# ***** GENERAL OPTIONS ***** #
# *************************** #
opts = Context.Options([("test_case", 1, "Rising bubble test cases: 1,2"),
                        ('ns_model', 1, "ns_model = {rans2p,rans3p}"),
                        ("final_time", 3.0, "Final time for simulation"),
                        ("dt_output", 0.1, "Time interval to output solution"),
                        ("cfl", 0.2, "Desired CFL restriction"),
                        ("refinement", 3, "level of refinement"),
                        ("ARTIFICIAL_VISCOSITY", 3, "artificial viscosity")])

assert opts.ns_model == 1, "Surface tension is only implemented with rans3p. use ns_model=1"
assert opts.test_case == 1 or opts.test_case == 2, "test_case must be 1 or 2"

# ****************** #
# ***** GAUGES ***** #
# ****************** #
# None

# *************************** #
# ***** DOMAIN AND MESH ***** #
# ****************** #******* #
Beispiel #26
0
from proteus.mprans import SW2D
from proteus.mprans import SW2DCV
from proteus.Domain import RectangularDomain
import numpy as np
from proteus import (Domain, Context,
                     MeshTools as mt)
from proteus.Profiling import logEvent
import proteus.SWFlows.SWFlowProblem as SWFlowProblem 

# *************************** #
# ***** GENERAL OPTIONS ***** #
# *************************** #
opts= Context.Options([
    ('sw_model',0,"sw_model = {0,1} for {SWEs,DSWEs}"),
    ("final_time",3.0,"Final time for simulation"),
    ("dt_output",1.0,"Time interval to output solution"),
    ("refinement",2,"Level of refinement"),
    ("cfl",0.33,"Desired CFL restriction"),
    ("reflecting_BCs",True,"Use reflecting BCs")
    ])

###################
# DOMAIN AND MESH #
###################
L=(75.0,30.0)
refinement = opts.refinement
domain = RectangularDomain(L=L)

# CREATE REFINEMENT #
nnx0=6
nnx = (nnx0-1)*(2**refinement)+1
nny = old_div((nnx-1),2)+1
Beispiel #27
0
opts = Context.Options([
    # predefined test cases
    ("water_level", 0.425, "Height of free surface above bottom"
     ),  # Choose waterLevels=[0.425, 0.463]
    # waves
    ('waveType', 'Fenton', 'Wavetype for regular waves, Linear or Fenton'),
    ("wave_period", 0.5, "Period of the waves"
     ),  # Choose periods=[0.5, 0.8, 1.1, 1.5, 2.8, 3.9, 4.0]
    (
        "wave_height", 0.025, "Height of the waves"
    ),  # # Choose for d=0.425-->[0.025, 0.075, 0.125, 0.234]. Choose for d=0.463-->[0.025, 0.075, 0.125, 0.254].
    (
        'wavelength', 0.4, 'Wavelength only if Fenton is activated'
    ),  # Choose for d=0.425-->[0.4, 1.0, 1.8, 2.9]. Choose for d=0.463-->[0.4, 1.0, 1.8, 2.9, 3.0, 5.7, 5.9, 8.8, 9.4].
    ('Ycoeff', [
        0.19167938, 0.01943414, 0.00299676, 0.00055096, 0.00011165, 0.00002413,
        0.00000571, 0.00000251
    ], 'Ycoeff only if Fenton is activated'),
    ('Bcoeff', [
        0.19063009, 0.00072851, 0.00002905, 0.00000131, 0.00000006, 0.00000000,
        0.00000000, 0.00000000
    ], 'Bcoeff only if Fenton is activated'),
    # Geometry of the tank - left lower boundary at (0.,0.,0.)
    ("Ls", 2.0,
     "Distance of the front toe of the structure end from generation zone in wavelengths"
     ),
    ("Lend", 2.0,
     "Distance of the back toe of the structure end from absorption zone in wavelengths"
     ),
    ("Lgen", 1., "Length of generation zone in wavelegths"),
    ("Labs", 2., "Length of absorption zone in wavelegths"),
    ("h", 1.0, "Height of domain in meters"),
    # breakwater
    ("hs", 0.075, "Height of the breakwater"),
    ("slope", 1. / 2., "Slope of the breakwater"),
    ('porosity', 0.4, "Porosity of the medium"),
    ('d50', None, "Mean diameter of the medium"),
    ('d15', 0.038, "15% grading curve diameter of the medium"),
    # caisson
    ("caisson", True, "Switch on/off caisson"),
    ('dimx', 0.44, 'X-dimension of the caisson'),  # Choose dimx=[0.44]
    ('dimy', 0.4, 'Y-dimension of the caisson'),
    ("rotation", not True, "Initial position for free oscillation"),
    ("friction", not True, "Switch on/off friction module"),
    ("m_static", 0.0,
     "Static friction factor between caisson and rubble mound"),
    ("m_dynamic", 0.0,
     "Dynamic friction factor between caisson and rubble mound"),
    # numerical options
    ("refinement_level", 200., "he=walength/refinement_level"),
    ("cfl", 0.9, "Target cfl"),
    ("freezeLevelSet", True, "No motion to the levelset"),
    ("useVF", 0.0, "For density and viscosity smoothing"),
    ('movingDomain', not True, "Moving domain and mesh option"),
    ('conservativeFlux', not True,
     'Fix post-processing velocity bug for porous interface'),
])
Beispiel #28
0
opts = Context.Options([
    # predefined test cases
    ("water_level", 0.325, "Height of free surface above bottom"),
    # Geometry
    ('Lgen', 1.0, 'Genaration zone in terms of wave lengths'),
    ('Labs', 1.0, 'Absorption zone in terms of wave lengths'),
    ('Ls', 1.0,
     'Length of domain from genZone to the front toe of rubble mound in terms of wave lengths'
     ),
    ('Lend', 1.0,
     'Length of domain from absZone to the back toe of rubble mound in terms of wave lengths'
     ),
    # waves
    ('wave', True, 'Enable wave generation'),
    ('waveType', 'Fenton', 'Wavetype for regular waves, Linear or Fenton'),
    ("wave_period", 1.30, "Period of the waves"),
    ("wave_height", 0.167, "Height of the waves"),
    ('wavelength', 2.121, 'Wavelength only if Fenton is activated'),
    ('Ycoeff', [
        0.21107604, 0.07318902, 0.02782228, 0.01234846, 0.00618291, 0.00346483,
        0.00227917, 0.00194241
    ], 'Ycoeff only if Fenton is activated'),
    ('Bcoeff', [
        0.23112932, 0.03504843, 0.00431442, 0.00036993, 0.00004245, 0.00001877,
        0.00000776, 0.00000196
    ], 'Bcoeff only if Fenton is activated'),
    ('Nf', 8, 'Number of frequency components for fenton waves'),
    ('meanVelocity', [0., 0., 0.], 'Velocity used for currents'),
    ('phi0', 0.0, 'Initial phase for waves'),
    ('Uwind', [0.0, 0.0, 0.0], 'Set air velocity'),
    ('fast', True, 'Switches ON fast cosh approximation'),
    # rubble mound
    ('porousMedia', True, 'Enable porus media region'),
    ("hs", 0.175, "Height of the breakwater"),
    ("slope1", 1. / 3., "Slope1 of the breakwater"),
    ("slope2", 1. / 2., "Slope2 of the breakwater"),
    ('porosity', 0.4, "Porosity of the medium"),
    ('d50', 0.030, "Mean diameter of the medium"),
    ('d15', None, "15% grading curve diameter of the medium"),
    ('Resistance', 'Shih', 'Ergun or Engelund or Shih'),
    # soil foundation
    ("springs", True, "Switch on/off soil module"),
    ("Kx", 541553.2, "Horizontal stiffness in Pa"),
    ("Ky", 582633.7, "Vertical stiffness in Pa"),
    ("Krot", 16246.6, "Rotational stiffness in N"),
    ("Cx", 1694.2, "Damping factor in Pa s "),
    ("Cy", 1757.32, "Damping factor in Pa s "),
    ("Crot", 69.61, "Rotational damping factor in N s "),
    # caisson
    ("caisson2D", True, "Switch on/off caisson2D"),
    ('dimx', 0.300, 'X-dimension of the caisson2D'),
    ('dimy', 0.385, 'Y-dimension of the caisson2D'),
    ('width', 1.0, 'Z-dimension of the caisson2D'),
    ('mass', 64.8 / 0.4, 'Mass of the caisson2D [kg]'),
    ('caissonBC', 'FreeSlip', 'caisson2D boundaries: NoSlip or FreeSlip'),
    ("rotation", False, "Initial position for free oscillation"),
    ("friction", True, "Switch on/off friction module for sliding"),
    ("overturning", True, "Switch on/off overturning module"),
    ("m_static", 0.500,
     "Static friction factor between caisson2D and rubble mound"),
    ("m_dynamic", 0.500,
     "Dynamic friction factor between caisson2D and rubble mound"),
    ('scheme', 'Runge_Kutta',
     'Numerical scheme applied to solve motion calculation (Runge_Kutta or Central_Difference)'
     ),
    # numerical options
    ("GenZone", True, 'Turn on generation zone at left side'),
    ("AbsZone", True, 'Turn on absorption zone at right side'),
    ("refinement_level", 0.0, "he=walength/refinement_level"),
    ("he", 0.05, "he=walength/refinement_level"),
    ("cfl", 0.450, "Target cfl"),
    ("duration", 20., "Durarion of the simulation"),
    ("freezeLevelSet", True, "No motion to the levelset"),
    ("useVF", 1.0, "For density and viscosity smoothing"),
    ('movingDomain', True, "Moving domain and mesh option"),
    ('conservativeFlux', True,
     'Fix post-processing velocity bug for porous interface'),
])
Beispiel #29
0
from proteus import Context

##############
# PARAMETERS #
##############
ct=Context.Options([
    ("nd",2,"Number of dimensions"),
    ("pDegree",2,"Order of the polynomial approximation"),
    ("refinement",0,"Mesh refinement"),
    ("useHex",True,"Use quads?"),
    ("useBernstein",True,"Use Bernstein polynomials"),
    ("unstructured",False,"Use unstructured triangular mesh"),
    ("genMesh", False, "Generate a new mesh?")
],mutable=True)

Beispiel #30
0
from proteus import *
from proteus.default_p import *
from proteus.mprans import SW2D
from proteus.mprans import SW2DCV
from proteus.Domain import RectangularDomain
import numpy as np
from proteus import (Domain, Context, MeshTools as mt)
from proteus.Profiling import logEvent
import proteus.SWFlows.SWFlowProblem as SWFlowProblem

# *************************** #
# ***** GENERAL OPTIONS ***** #
# *************************** #
opts = Context.Options([('start_at_t0', False, "Consider dambreak from t=0?"),
                        ('refinement', 3, "Refinement level"),
                        ('sw_model', 0, "sw_model = {0,1} for {SWEs,DSWEs}"),
                        ("final_time", 5.0, "Final time for simulation"),
                        ("dt_output", 0.1, "Time interval to output solution"),
                        ("cfl", 0.33, "Desired CFL restriction")])

###################
# DOMAIN AND MESH #
###################
L = (10.0, 1.0)
refinement = opts.refinement
domain = RectangularDomain(L=L, x=[0, 0, 0])

# CREATE REFINEMENT #
nnx0 = 6
nnx = (nnx0 - 1) * (2**refinement) + 1
nny = old_div((nnx - 1), 10) + 1