Scalar-Transport
Steady Scalar-Transport
- class flatiron_tk.physics.steady_scalar_transport.SteadyScalarTransport(mesh, tag='u', q_degree=4, **kwargs)[source]
Bases:
PhysicsProblemA class to represent the steady scalar transport equations. This class extends the PhysicsProblem class to include advection, diffusion, and reaction terms.
- add_edge_stab(gamma)[source]
Adds edge stabilization to the weak form.
- Parameters:
gamma (The edge stabilization parameter.)
- add_stab(tau_type='shakib')[source]
Adds the stabilization term to the weak form.
- Parameters:
tau_type (The type of stabilization constant to use. Options are 'shakib','su', or 'codina'.)
- build_function_space(*args, **kwargs)[source]
Build the function space for the steady scalar transport problem.
- Parameters:
*args (Arguments to be passed to the parent class method.)
**kwargs (Keyword arguments to be passed to the parent class method.)
- flux(q)[source]
Computes the flux of the problem.
- Parameters:
q (The flux vector)
Advection_Matrix + Diffusion_Matrix - Reaction_Matrix - Flux_Term = 0 => we subtract the form
- get_advection_velocity()[source]
Get the advection velocity for the steady scalar transport problem.
Returns:
The advection velocity function.
- get_diffusivity()[source]
Get the diffusivity for the steady scalar transport problem.
Returns:
The diffusivity function.
- get_edge_stab(gamma, c)[source]
Computes the edge stabilization term.
- Parameters:
gamma (The edge stabilization parameter.)
c (The solution function.)
Returns:
J: The edge stabilization term.
- get_reaction()[source]
Get the reaction for the steady scalar transport problem.
Returns:
The reaction function.
- get_residual()[source]
Computes the residual of the problem.
Returns:
residual: The residual of the problem as a fenicsx form
- set_advection_velocity(u)[source]
Set the advection velocity for the steady scalar transport problem.
- Parameters:
u (The advection velocity function.)
- set_diffusivity(D)[source]
Set the diffusivity for the steady scalar transport problem.
- Parameters:
D (The diffusivity function.)
- set_reaction(R)[source]
Set the reaction for the steady scalar transport problem.
- Parameters:
R (The reaction function.)
This class defines the scalar transport problem, the so-called Advection-Diffusion-Reaction problem
Strong formulation
Define a total computational domian as \(\Omega\) and the Dirichlet and Neumann boundaries \(\Gamma_D\) and \(\Gamma_N\) where \(\Gamma_D \cup \Gamma_D = \partial\Omega\) and \(\Gamma_D \cap \Gamma_D = 0\). Let the trial function space be defined s
where \(c\) is the concentration field, \(\textbf{u}\) is the velocity, \(D\) is diffusivity, and \(R\) is the reaction.
Boundary conditions
Fixed value boundary condition
Diffusive flux boundary condition
where \(\hat{n}\) is the unit normal to \(\Gamma_N\)
Weak formulation
The weak formulation is stated as follows:
and the corresponding test function
The weak formulation, for \(c \in C\) and \(w \in W\)
where ther residue \(\mathcal{R}\) is
where \(\mathcal{S}\) is the stabilization term for advection dominated problem. There are three types of \(\tau\) that the code provides. These are the shakib, su, codina type. For given a cell diameter \(h\), a cell Peclet number \(Pe_h=\frac{\lvert \textbf{u} \rvert h}{2D}\)
Stabilization parameters
Stabilization parameters \(\tau\) are predefined values via the get_stab_constant(tau_type) method. The tau_type
parameter can be either shakib, su, or codina, and are defined as
Transient Scalar-Transport
- class flatiron_tk.physics.transient_scalar_transport.TransientScalarTransport(mesh, dt=0.01, theta=0.5, *args, **kwargs)[source]
Bases:
SteadyScalarTransport- build_function_space()[source]
Build the function space for the transient scalar transport problem.
- get_residual()[source]
Compute the residual for the transient scalar transport problem.
Returns:
The residual expression for the transient scalar transport equations.
- set_advection_velocity(u0, un)[source]
Set the advection velocity for the transient scalar transport problem.
Parameters:
u0: The advection velocity at the previous time step. un: The advection velocity at the current time step.
- set_diffusivity(D0, Dn)[source]
Set the diffusivity for the transient scalar transport problem.
Parameters:
D0: The diffusivity at the previous time step. Dn: The diffusivity at the current time step.
- set_initial_condition(u0)[source]
Set the initial condition for the problem.
- Parameters:
u0 (dolfinx.fem.Function) – The initial condition function.
- set_midpoint_theta(theta)[source]
Set the theta parameter for the implicit-explicit scheme.
Parameters:
theta: The theta parameter.
- set_reaction(R0, Rn)[source]
Set the reaction term for the transient scalar transport problem.
Parameters:
R0: The reaction term at the previous time step. Rn: The reaction term at the current time step.
- set_time_step_size(dt)[source]
Set the time step size for the transient scalar transport problem.
Parameters:
dt: The time step size.
This class defines the transient version of the scalar transport problem
Strong formulation
The strong form of this now the time-dependent version of the TransientScalarTransport problem
Initial and Boundary conditions
The boundary conditions are the same as the ones defined in the TransientScalarTransport class.
Here, the initial condition can be set through the set_initial_condition method.
Time discretization
In this module, the default time discretization is the midpoint \(\theta\) method defined as follows:
Let subscript \(()_0\) denote the variable in the previous time step and \(()_n\) define the variable at the current time step
Find \(c_n \in C\) and \(w \in W\) such that
where
where \(\mathcal{S}\) is the stabilization term for advection dominated problem. There are three types of \(\tau\) that the code provides. These are the shakib, su, codina type. For given a cell diameter \(h\), a cell Peclet number \(Pe_h=\frac{\lvert \textbf{u} \rvert h}{2D}\).
Stabilization parameters
Here, we only provide one stabilization constant for the SUPG stabilization based on the cordina stabilization parameter
Class definition
- class flatiron_tk.physics.TransientScalarTransport(mesh, dt=0.01, theta=0.5, *args, **kwargs)[source]
-
- build_function_space()[source]
Build the function space for the transient scalar transport problem.
- get_residual()[source]
Compute the residual for the transient scalar transport problem.
Returns:
The residual expression for the transient scalar transport equations.
- set_advection_velocity(u0, un)[source]
Set the advection velocity for the transient scalar transport problem.
Parameters:
u0: The advection velocity at the previous time step. un: The advection velocity at the current time step.
- set_diffusivity(D0, Dn)[source]
Set the diffusivity for the transient scalar transport problem.
Parameters:
D0: The diffusivity at the previous time step. Dn: The diffusivity at the current time step.
- set_initial_condition(u0)[source]
Set the initial condition for the problem.
- Parameters:
u0 (dolfinx.fem.Function) – The initial condition function.
- set_midpoint_theta(theta)[source]
Set the theta parameter for the implicit-explicit scheme.
Parameters:
theta: The theta parameter.
- set_reaction(R0, Rn)[source]
Set the reaction term for the transient scalar transport problem.
Parameters:
R0: The reaction term at the previous time step. Rn: The reaction term at the current time step.
- set_time_step_size(dt)[source]
Set the time step size for the transient scalar transport problem.
Parameters:
dt: The time step size.