Steady Navier-Stokes
- class flatiron_tk.physics.steady_navier_stokes.SteadyNavierStokes(mesh)[source]
Bases:
SteadyStokesA class to represent the steady Navier-Stokes equations. This class extends the SteadyStokes class to include the convective term in the momentum equation.
- get_residual(u, p)[source]
Compute the residual for the steady Navier-Stokes problem.
Parameters:
u: The velocity field. p: The pressure field.
Returns:
The residual of the steady Navier-Stokes equations.
- get_stab_constant(u, h, alpha, beta)[source]
Compute the stabilization constants for the steady Navier-Stokes problem.
Parameters:
u: The velocity field. h: The cell diameter. alpha: The SUPG stabilization parameter. beta: The PSPG stabilization parameter.
Returns:
A tuple containing the SUPG and PSPG stabilization constants.
- set_density(rho)[source]
Set the density for the Navier-Stokes problem.
Parameters:
rho: The density value.
- set_dynamic_viscosity(mu)[source]
Set the dynamic viscosity for the Navier-Stokes problem.
Parameters:
mu: The dynamic viscosity value.
- set_initial_guess(initial_guess_u=None, initial_guess_p=None)[source]
Set the initial guess for the steady Navier-Stokes problem.
Parameters:
initial_guess_u: A user-defined initial guess for the velocity field. If None, a zero initial guess is used. initial_guess_p: A user-defined initial guess for the pressure field. If None, a zero initial guess is used.
Returns:
None
This class solves the steady Navier Stokes problem. In this case, the solver uses the Cauchy stress formulation of the problem
Strong formulation
Define the Cauchy stress for incompressible flow as
Momentum equation
Continuity
where \(\textbf{u}\) and p are the velocity and pressure field respectively with the constants \(\rho\) and \(\mu\) are the fluid density and dynamic viscosity respectively.
Boundary conditions
Fixed value boundary condition
Traction boundary condition
Weak formulation
The weak formulation is stated as follows:
For the same test/trial function spaces as Stokes, the weak formulation for the Navier-Stokes problem is
Where the stabilization terms are defined as
where \(\textbf{R}\) is the residue of the strong form
Stabilization parameters
For linear element, the stabilization is defined as
In this case, we use the same stabilization parameter for both SUPG and PSPG
Transient Navier-Stokes
- class flatiron_tk.physics.transient_navier_stokes.TransientNavierStokes(mesh, dt=0.01, theta=0.5, *args, **kwargs)[source]
Bases:
SteadyNavierStokesTransient scalar transport problem. Supers SteadyNavierStokes.
- Parameters:
mesh (flatiron_tk.mesh) – The mesh on which to solve the problem.
dt (float) – The time step size.
theta (float, optional) – The theta parameter for the implicit-explicit scheme. Default is 0.5.
- add_stab()[source]
Add stabilization terms to the weak form for the steady Navier-Stokes problem. This method computes the SUPG and PSPG stabilization terms and adds them to the weak form.
- get_residual()[source]
Compute the residual for the transient Navier-Stokes problem.
Returns:
The residual expression for the transient Navier-Stokes equations.
- set_initial_conditions(u_init, p_init)[source]
Set the initial conditions for the transient Navier-Stokes problem.
Parameters:
- u_init: dolfinx.fem.Function or dolfinx.fem.Expression
Initial velocity field
- p_init: dolfinx.fem.Function or dolfinx.fem.Expression
Initial pressure field
- set_midpoint_theta(theta)[source]
Set the theta parameter for the implicit-explicit scheme.
Parameters:
theta: The theta parameter.
- set_time_step_size(dt)[source]
Set the time step size for the transient Navier-Stokes problem.
Parameters:
dt: The time step size.
This class solves the transient Navier Stokes problem.
Strong formulation
Momentum equation
Continuity
where \(\textbf{u}\) and p are the velocity and pressure field respectively with the constants \(\rho\) and \(\mu\) are the fluid density and dynamic viscosity respectively.
Boundary conditions
Fixed value boundary condition
Traction boundary condition
Weak formulation
In this implementation, we the mid-point method for time integration. Let \(\mathcal{L}(u, p)\) be the weak formulation obtained in the above steady forumation, the weak formulation for the transient problem is
Stabilization parameters
Stabilization parameter now has time dependence and is defined as
In this case, we use the same stabilization parameter for both SUPG and PSPG