proteus.mprans.BoundaryConditions module
- class proteus.mprans.BoundaryConditions.BC_RANS(shape=None, name=None, b_or=None, b_i=0., nd=None)[source]
Bases:
BoundaryConditions.BC_Base
Class regrouping boundary conditions for two-phase flows
- dissipation_advective[source]
proteus.BoundaryConditions.BoundaryCondition
- Type
dissipation_advective
- dissipation_diffusive[source]
proteus.BoundaryConditions.BoundaryCondition
- Type
dissipation_diffusive
- dissipation_dirichlet[source]
proteus.BoundaryConditions.BoundaryCondition
- Type
dissipation_dirichlet
- pAddedMass_dirichlet[source]
proteus.BoundaryConditions.BoundaryCondition
- Type
pAddedMass_dirichlet
- reset(self)[source]
Resets all BoundaryCondtion functions to None, apart from the BCs affecting: moving mesh
- setAtmosphere(self, orientation=None, vof_air=1., kInflow=None, dInflow=None)[source]
Sets atmosphere boundary conditions (water can come out) (!) pressure dirichlet set to 0 for this BC :param orientation: orientation of the boundary. Optional if orientation was already
passed when creating the BC_RANS class instance.
- Parameters
vof_air (Optional[float]) – VOF value of air (default is 1.)
- setConstantInletVelocity(self, U, ramp, kk, dd, b_or)[source]
Sets constant velocity in each inlet face with ramping up and turbulence properties
- setConstantOutletPressure(self, p, rho, g, kk, dd, b_or)[source]
Sets constant pressure in each outlet face for single phase flows
- setHydrostaticPressureOutletWithDepth(self, seaLevel, rhoUp, rhoDown, g, refLevel, smoothing, orientation=None, U=None, Uwind=None, pRef=0.0, vert_axis=None, air=1.0, water=0.0, kInflow=None, dissipationInflow=None, kInflowAir=None, dissipationInflowAir=None)[source]
Returns the pressure and vof profile based on the known depth. If the boundary is aligned with one of the main axes, sets the tangential velocity components to zero as well. (!) This condition is best used for boundaries and gravity aligned with
one of the main axes.
- Parameters
rhoUp (Phase density of the upper part.) –
rhoDown (Phase density of the lower part.) –
g (Gravitational acceleration vector.) –
refLevel (Level at which pressure = pRef.) –
pRef (Reference value for the pressure at x[vert_axis]=refLevel, by default set to 0.) –
vert_axis (index of vertical in position vector, must always be aligned with gravity, by default set to 1.) –
- setMoveMesh(self, last_pos, h=(0., 0., 0.), rot_matrix=None)[source]
Sets boundary conditions for moving the mesh with a rigid body
- Parameters
last_pos (array_like) – last position of rigig body
h (array_like) – displacement of the body
rot_matrix – rotation matrix describing displament due to rotation between last position and new position (3x3 array)
manually ((!) if set) – without loosing their memory address
externally (the input arrays should be updated) – without loosing their memory address
- setNonMaterial(self)[source]
Sets non-material boundary conditions (diffusive flux and advective vof to 0.).
- setRigidBodyMoveMesh(self, body)[source]
Sets boundary conditions for moving the mesh with a rigid body
- Parameters
last_pos (array_like) – last position of rigig body
h (array_like) – displacement of the body
rot_matrix – rotation matrix describing displament due to rotation between last position and new position (3x3 array)
manually ((!) if set) – without loosing their memory address
externally (the input arrays should be updated) – without loosing their memory address
- setTurbulentDirichlet(self, kVal, dissipationVal)[source]
Sets only dirichlet conditions for turbulence at the boundary. It’s a rough approximation for evalueting the near wall turbulence based on empirical assumptions. More sophisticated wall functions are recommended to be used.
- Parameters
kVal (float.) – constant value applied on k.
dissipationVal (float.) – constant value applied on dissipation.
- setTurbulentZeroGradient(self)[source]
Sets only zero-gradient conditions for turbulence at the boundary. More sophisticated wall functions are recommended to be used.
- setTwoPhaseVelocityInlet(self, U, waterLevel, smoothing, Uwind=None, vert_axis=None, air=1., water=0., kInflow=None, dissipationInflow=None, kInflowAir=None, dissipationInflowAir=None)[source]
Imposes a velocity profile lower than the sea level and an open boundary for higher than the sealevel. :param U: Velocity vector at the global system. :type U: list. :param Uwind: Air velocity vector at the global system. :type Uwind: list. :param waterLevel: water level at global coordinate system. :type waterLevel: float. :param smoothing: range within smoothing function is valid.
[3.0 times mesh element size can be a good value]
- Parameters
vert_axis (optional.) – index of vertical in position vector, must always be aligned with gravity, by default set to 1].
air (optional.) – Volume fraction for air (1.0 by default).
water (optional.) – Volume fraction for water (0.0 by default).
kInflow (float (optional).) – K inflow value for turbulent model imposed at the boundary.
dissipationInflow (float (optional).) – Dissipation inflow value for turbulent model imposed at the boundary.
kInflowAir (float (optional).) – Air K inflow value for turbulent model imposed at the boundary.
dissipationInflowAir (float (optional).) – Air dissipation inflow value for turbulent model imposed at the boundary.
level (Above the sea water) –
and (the condition returns the _dirichlet) –
velocity. (p_advective condition according to the inflow) –
level –
zero (the condition returns the gravity as) –
:param : :param and sets _dirichlet condition to zero: :param only if there is a zero inflow: :param velocity component.: :param (!) This condition is best used for boundaries and gravity aligned with: one of the main axes.
- setUnsteadyTwoPhaseVelocityInlet(self, wave, smoothing, vert_axis=None, orientation=None, wind_speed=None, vof_air=1., vof_water=0., kInflow=1e-30, dInflow=1e-10)[source]
Imposes a velocity profile on the fluid with input wave and wind conditions.
- Parameters
wave (proteus.WaveTools) – class describing a wave (from proteus.WaveTools)
smoothing (float) – smoothing distance (typically 3.*he)
vert_axis (Optional[int]) – index of vertical position vector (x:0, y:1, z:2), must always be aligned with gravity. If not set, will be 1 in 2D (y), 2 in 3D (z).
wind_speed (Optional[array_like]) – speed of air phase
vof_air (Optional[float]) – VOF value of air (default is 1.)
vof_water (Optional[float]) – VOF value of water (default is 0.)
level (Above the sea water) –
level –
smoothing). ((with) –
- setWallFunction(self, wall, shearStress=False)[source]
Sets turbulent boundaries for wall treatment. Calculation made on nodes outside the viscous sublayer and based on assumption on the velocity profile close to the wall in order to impose the wall shear stress.
- Parameters
wall (wall object.) – BoundaryConditions class to be attached for setting up all the turbulent parameters.
shearStress (True/False.) –
At the moment version with shearStress=False is the only one that returns good results. Keep it False at the moment! - When True, the wall function prescribes diffusive boundaries
for velocity and kappa. It’s like imposing the shear stress.
If False, the wall function prescribes dirichlet conditions.
- class proteus.mprans.BoundaryConditions.RelaxationZone[source]
Bases:
object
Holds information about a relaxation zone (wave generation/absorption or porous zone)
- Parameters
zone_type (string) – type of zone, can be set to ‘absorption’, ‘generation’, or ‘porous’
center (array_like) – coordinates of center of the zone
orientation (array_like) – orientation for absorption/generation zones: from boundary to tank
epsFact_porous (float) – half the zone length
waves (Optional[proteus.WaveTools]) – class instance of a wave from proteus.WaveTools (must be set for generation zone)
shape (Optional[proteus.SpatialTools.Shape]) – shape class instance containing region
dragAlpha (Optional[float]) – parameter for porous zones (default: 0.5/1.005e-6)
dragBeta (Optional[float]) – parameter for porous zones (default: 0.)
porosity (Optional[float]) – parameter for porous zone (default: 1.)
vert_axis (Optional[int]) – index of vertical position vector (x:0, y:1, z:2), must always be aligned with gravity. If not set, will be 1 in 2D (y), 2 in 3D (z).
smoothing (Optional[float]) – smoothing distance from the free surface (usually 3*he)
vof_water (Optional[int]) – VOF value of water (default: 0)
vof_air (Optional[int]) – VOF value of air (default: 1)
- class proteus.mprans.BoundaryConditions.RelaxationZoneWaveGenerator(zones, nd)[source]
Bases:
object
Prescribe a velocity penalty scaling in a material zone via a Darcy-Forchheimer penalty
- Parameters
- class proteus.mprans.BoundaryConditions.WallFunctions(self, turbModel, kWall, Y, Yplus, U0, nu=1.004e-6, Cmu=0.09, K=0.41, B=5.57)[source]
Bases:
proteus.AuxiliaryVariables.AV_base
Auxiliary variable used to calculate attributes of an associated shape class instance acting as a wall.
Sets turbulent boundaries for wall treatment. Calculation made on nodes outside the viscous sublayer and based on assumption on the velocity profile close to the wall in order to impose the wall shear stress.
k is assumed to be constant in the fully turbulent region close to the wall,
in this way kv = kp. - dissipation is calculated.
- Parameters
turbModel (string.) – ‘ke’ or ‘kw’, for switching between k-epsilon or k-omega models.
kWall (object.) – Class kWall object for extracting kappa from the model.
Y (float.) – size of the nearest element to the boundary.
Yplus (float.) – size of the nearest element to the boundary in terms of wall unit.
U0 (array_like.) – stream velocity.
nu (float.) – fluid viscosity.
Cmu (float.) – turbulent viscosity constant.
K (float.) – von Karman coefficient.
B (float.) – roughness coefficient for walls.
- extractVelocity(self, x, t, n)[source]
Extraction of the velocity at y+ distance from the boundary.
- findElementContainingCoords(self, coords)[source]
Given global coordinates of a point, returns local coordinates and the owner of the point.
- Parameters
coords (array_like) – global coordinates to look for
- Returns
xi – local coordinates
eN (int) – (local) element number
rank (int) – processor rank containing element
- getFluidVelocityLocalCoords(self, xi, element, rank)[source]
Given local details, returns velocity field at those coordinates.
- getLocalElement(self, femSpace, coords, node)[source]
Given coordinates and its nearest node, determine if it is on a local element. :param femSpace: finite element space :type femSpace: object :param coords: coordinates from which to element :type coords: array_like :param node: nearest node index :type node: int
- Returns
eN – local index of element (None if not found)
- Return type
int or None
- getLocalNearestNode(self, coords, kdtree)[source]
Finds nearest node to coordinates (local) :param coords: coordinates from which to find nearest node :type coords: array_like :param kdtree: instance of scipy kdtree :type kdtree: scipy.spatial.cKDTree
- Returns
node (int) – nearest node index
distance (float) – distance to nearest node
- getVariables(self, x, t)[source]
Calculates velocity, gradient of the velocity and kappa according with wall functions theory (see S. B. Pope pg 442-443).
- class proteus.mprans.BoundaryConditions.kWall(self, Y, Yplus, nu=1.004e-6, Cmu=0.09)[source]
Bases:
proteus.AuxiliaryVariables.AV_base
Auxiliary variable used to calculate attributes of an associated shape class instance acting as a wall for the k variable.
Sets turbulent boundaries for wall treatment.