Stokes

Steady Stokes

class flatiron_tk.physics.steady_stokes.Continuity(mesh, tag='u', q_degree=4, **kwargs)[source]

Bases: PhysicsProblem

flux()[source]
get_residual()[source]
set_weak_form()[source]
class flatiron_tk.physics.steady_stokes.Momentum(mesh, tag='u', q_degree=4, **kwargs)[source]

Bases: PhysicsProblem

flux()[source]
get_residual()[source]
set_weak_form()[source]
class flatiron_tk.physics.steady_stokes.OnPoint(point_location, eps)[source]

Bases: object

A class to define a point in space for applying boundary conditions.

class flatiron_tk.physics.steady_stokes.SteadyStokes(mesh)[source]

Bases: MultiphysicsProblem

A class to represent the steady Stokes equations. Supers MultiphysicsProblem.

Parameters:

mesh: The mesh to use for the problem.

add_stab()[source]

Add stabilization terms to the weak form for the Stokes problem.

build_function_space()[source]

Build the function space for the Stokes problem.

flux(h)[source]

Computes the flux of the Stokes problem.

Parameters:

h: The flux vector. physics_tag: The tag to identify the physics problem.

Returns:

The flux form.

get_kinematic_viscosity()[source]

Get the kinematic viscosity for the Stokes problem.

Returns:

The kinematic viscosity value or function.

get_stabilization_constant()[source]

Compute the stabilization constant for the Stokes problem.

Returns:

The stabilization constant.

set_bcs(multiphysics_bc_dict)[source]

Overload the set_bcs from the multphysics problem to set the boundary conditions for the Stokes problem. The boundary conditions on pressure must be handled separately.

Parameters:

multiphysics_bc_dict: A dictionary containing the boundary conditions for each physics problem.

set_body_force(body_force)[source]

Set the body force for the Stokes problem.

Parameters:

body_force: The body force value or function.

set_element(u_family, u_degree, p_family, p_degree)[source]

Set the element for the Stokes problem.

Parameters:

u_family: The family of the velocity element. u_degree: The degree of the velocity element. p_family: The family of the pressure element. p_degree: The degree of the pressure element. mesh: The mesh to use.

set_kinematic_viscosity(nu)[source]

Set the kinematic viscosity for the Stokes problem.

Parameters:

nu: The kinematic viscosity value or function.

set_weak_form(stab=False)[source]

Set the weak form for the Stokes problem. This includes the momentum and continuity equations.

Parameters:

stab: A boolean indicating whether to include stabilization terms in the weak form.

This class solves the Stokes flow problem which is the linearized form of the Navier-Stokes equation

Strong formulation

Momentum equation

\[\nabla p = \nu \nabla^2 \textbf{u} + \textbf{b}\]

Continuity

\[\nabla \cdot \textbf{u} = 0\]

where \(\textbf{u}\) and p are the velocity and pressure field respectively with the constants \(\nu\) is the kinematic viscosity. Note that pressure here is the scaled pressure. True pressure \(p_{true} = p/\rho\) where \(\rho\) is the density. \(\textbf{b}\) is the external body force

Boundary conditions

Fixed value boundary condition

\[\textbf{u} = \textbf{u}_D \;\forall \textbf{x} \in \Gamma_D\]

(pseudo) Traction boundary condition

\[-p\textbf{n} + \nu(\textbf{n} \cdot \nabla)\textbf{u} = \textbf{t} \;\;\forall \textbf{x} \in \Gamma_N\]

Weak formulation

The weak formulation is stated as follows:

For the velocity trial function

\[\mathcal{U} := \{\textbf{U} \in H^1(\Omega) | \textbf{u} = \textbf{u}_D \;\text{on}\; \Gamma_D\}\]

and the corresponding test function

\[\mathcal{W} := \{\textbf{w} \in H^1(\Omega) | \textbf{w} = 0 \;\text{on}\; \Gamma_D\}\]

And the pressure space

\[\mathcal{Q} := \mathcal{L}_2(\Omega)\]

for external body force \(\textbf{b}\) and surface traction \(\textbf{t}\), find \(\textbf{u} \in \mathcal{U}\) and \(p \in \mathcal{Q}\) with the corresponding test functions \(\textbf{w} \in \mathcal{W}\) and \(q \in \mathcal{Q}\) such that

\[0 = \left(\nabla\textbf{w}, \nu\nabla\textbf{u}\right)_\Omega - \left( \nabla \cdot \textbf{w}, p \right)_\Omega - \left(\textbf{w}, \textbf{b}\right)_\Omega - \left(q, \nabla \cdot \textbf{u}\right)_\Omega + (\textbf{w}, \textbf{t})_{\Gamma_N} + \sum_{\Omega_e} \int_{\Omega_e} \tau \nabla q \cdot \nabla p d\Omega\]