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

clsvof_advective[source]

proteus.BoundaryConditions.BoundaryCondition

Type

clsvof_advective

clsvof_diffusive[source]

proteus.BoundaryConditions.BoundaryCondition

Type

clsvof_diffusive

clsvof_dirichlet[source]

proteus.BoundaryConditions.BoundaryCondition

Type

clsvof_dirichlet

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

hx_dirichlet[source]

proteus.BoundaryConditions.BoundaryCondition

Type

hx_dirichlet

hy_dirichlet[source]

proteus.BoundaryConditions.BoundaryCondition

Type

hy_dirichlet

hz_dirichlet[source]

proteus.BoundaryConditions.BoundaryCondition

Type

hz_dirichlet

k_advective[source]

proteus.BoundaryConditions.BoundaryCondition

Type

k_advective

k_diffusive[source]

proteus.BoundaryConditions.BoundaryCondition

Type

k_diffusive

k_dirichlet[source]

proteus.BoundaryConditions.BoundaryCondition

Type

k_dirichlet

pAddedMass_dirichlet[source]

proteus.BoundaryConditions.BoundaryCondition

Type

pAddedMass_dirichlet

pInc_advective[source]

proteus.BoundaryConditions.BoundaryCondition

Type

pInc_advective

pInc_diffusive[source]

proteus.BoundaryConditions.BoundaryCondition

Type

pInc_diffusive

pInc_dirichlet[source]

proteus.BoundaryConditions.BoundaryCondition

Type

pInc_dirichlet

pInit_advective[source]

proteus.BoundaryConditions.BoundaryCondition

Type

pInit_advective

pInit_diffusive[source]

proteus.BoundaryConditions.BoundaryCondition

Type

pInit_diffusive

pInit_dirichlet[source]

proteus.BoundaryConditions.BoundaryCondition

Type

pInit_dirichlet

p_advective[source]

proteus.BoundaryConditions.BoundaryCondition

Type

p_advective

p_dirichlet[source]

proteus.BoundaryConditions.BoundaryCondition

Type

p_dirichlet

phi_dirichlet[source]

proteus.BoundaryConditions.BoundaryCondition

Type

phi_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.)

setChMoveMesh(self, body)[source]
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

setFixedNodes(self)[source]

For moving domains: fixes nodes/boundary

setFreeSlip(self)[source]

Sets free slip conditions at the boundary

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

setNoSlip(self)[source]

Sets no slip conditions at the boundary

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

setTank(self, b_or=None)[source]
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.

u_advective[source]

proteus.BoundaryConditions.BoundaryCondition

Type

u_advective

u_diffusive[source]

proteus.BoundaryConditions.BoundaryCondition

Type

u_diffusive

u_dirichlet[source]

proteus.BoundaryConditions.BoundaryCondition

Type

u_dirichlet

u_stress[source]

proteus.BoundaryConditions.BoundaryCondition

Type

u_stress

us_advective[source]

proteus.BoundaryConditions.BoundaryCondition

Type

us_advective

us_diffusive[source]

proteus.BoundaryConditions.BoundaryCondition

Type

us_diffusive

us_dirichlet[source]

proteus.BoundaryConditions.BoundaryCondition

Type

us_dirichlet

v_advective[source]

proteus.BoundaryConditions.BoundaryCondition

Type

v_advective

v_diffusive[source]

proteus.BoundaryConditions.BoundaryCondition

Type

v_diffusive

v_dirichlet[source]

proteus.BoundaryConditions.BoundaryCondition

Type

v_dirichlet

v_stress[source]

proteus.BoundaryConditions.BoundaryCondition

Type

v_stress

vof_advective[source]

proteus.BoundaryConditions.BoundaryCondition

Type

vof_advective

vof_dirichlet[source]

proteus.BoundaryConditions.BoundaryCondition

Type

vof_dirichlet

vos_advective[source]

proteus.BoundaryConditions.BoundaryCondition

Type

vos_advective

vos_dirichlet[source]

proteus.BoundaryConditions.BoundaryCondition

Type

vos_dirichlet

vs_advective[source]

proteus.BoundaryConditions.BoundaryCondition

Type

vs_advective

vs_diffusive[source]

proteus.BoundaryConditions.BoundaryCondition

Type

vs_diffusive

vs_dirichlet[source]

proteus.BoundaryConditions.BoundaryCondition

Type

vs_dirichlet

w_advective[source]

proteus.BoundaryConditions.BoundaryCondition

Type

w_advective

w_diffusive[source]

proteus.BoundaryConditions.BoundaryCondition

Type

w_diffusive

w_dirichlet[source]

proteus.BoundaryConditions.BoundaryCondition

Type

w_dirichlet

w_stress[source]

proteus.BoundaryConditions.BoundaryCondition

Type

w_stress

ws_advective[source]

proteus.BoundaryConditions.BoundaryCondition

Type

ws_advective

ws_diffusive[source]

proteus.BoundaryConditions.BoundaryCondition

Type

ws_diffusive

ws_dirichlet[source]

proteus.BoundaryConditions.BoundaryCondition

Type

ws_dirichlet

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)

Shape[source]

object

Type

Shape

calculate_init(self) void[source]
calculate_phi_python(self, x)[source]
calculate_vel_python(self, x, t, n=None)[source]
center[source]

]’

Type

center

Type

‘double[

dragAlpha[source]

‘double’

Type

dragAlpha

dragBeta[source]

‘double’

Type

dragBeta

epsFact_porous[source]

‘double’

Type

epsFact_porous

epsFact_solid[source]

‘double’

Type

epsFact_solid

orientation[source]

]’

Type

orientation

Type

‘double[

porosity[source]

‘double’

Type

porosity

vert_axis[source]

‘double’

Type

vert_axis

zone_type[source]

str

Type

zone_type

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
  • zones (dict) – dictionary with key as the region flag and values as a RelaxationZone class

  • nd (int) – number of dimensions of domain

ar[source]

object

Type

ar

attachAuxiliaryVariables(self, avDict)[source]
attachModel(self, model, ar)[source]
calculate(self) void[source]
calculate_init(self) void[source]
model[source]

object

Type

model

zones[source]

dict

Type

zones

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.

attachAuxiliaryVariables(self, avDict)[source]
attachModel(self, model, ar)[source]

Attaches model to auxiliary variable

calculate(self)[source]
calculate_init(self)[source]
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.

Parameters
  • xi – local coords in element

  • element (int) – element number (local to processor ‘rank’)

  • rank (int) – rank of processor owning the element

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).

get_dissipation_dirichlet(self, x, t, n)[source]
get_k_dirichlet(self, x, t, n)[source]
get_u_diffusive(self, x, t, n)[source]
get_u_dirichlet(self, x, t, n)[source]
get_v_diffusive(self, x, t, n)[source]
get_v_dirichlet(self, x, t, n)[source]
get_w_diffusive(self, x, t, n)[source]
get_w_dirichlet(self, x, t, n)[source]
setYplusNormalDirection(self, x, t, n, relax=1.0)[source]

Return the point at y+ distance in normal direction from the boundary.

tangentialVelocity(self, x, t, n, uInit=None)[source]

Given the velocity, calculates its tangential component to the wall.

Parameters

uInit (True/False.) – Switch for initializing the module. True only during the first time step.

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.

attachAuxiliaryVariables(self, avDict)[source]
attachModel(self, model, ar)[source]

Attaches model to auxiliary variable

calculate(self)[source]
calculate_init(self)[source]
getFluidKappaLocalCoords(self, xi, element, rank)[source]
Parameters
  • xi – local coords in element

  • element (int) – element number (local to processor ‘rank’)

  • rank (int) – rank of processor owning the element

getKappa(self, x, t, xi, element, rank)[source]
kappaNearWall(self, xi, element, rank, kInit=None)[source]