FVAdvectedUpwind
Overview
This object provides first-order upwind interpolation for an advected quantity on a finite-volume face. The upwind state is selected using the sign of the face mass flux (), yielding a monotone, Total Variation Diminishing (TVD) discretization that is robust near discontinuities at the cost of increased numerical diffusion (Moukalled et al. (2016), Harten (1997)).
Let and denote the cell-centered values on the element and neighbor sides of a face. Define the upwind value
Then the interpolated face value is simply
In matrix form this corresponds to weights chosen by the mass flux sign, so no gradients are required. This is a common baseline scheme for advection and is often used as the low-order component in higher-order schemes with limiting or deferred correction (see Limiters).
Example Syntax
Declare the interpolation method in [FVInterpolationMethods]:
[FVInterpolationMethods<<<{"href": "../../syntax/FVInterpolationMethods/index.html"}>>>]
[upwind]
type = FVAdvectedUpwind<<<{"description": "Upwind interpolation for advected quantities using the face mass flux sign.", "href": "FVAdvectedUpwind.html"}>>>
[]
[](test/tests/linearfvkernels/advection/advection-1d.i)Use it in a linear FV advection kernel via "advected_interp_method_name":
[LinearFVKernels<<<{"href": "../../syntax/LinearFVKernels/index.html"}>>>]
[advection]
type = LinearFVAdvection<<<{"description": "Represents the matrix and right hand side contributions of an advection term in a partial differential equation.", "href": "../linearfvkernels/LinearFVAdvection.html"}>>>
variable<<<{"description": "The name of the variable whose linear system this object contributes to"}>>> = u
velocity<<<{"description": "Constant advection velocity"}>>> = "0.5 0 0"
advected_interp_method_name<<<{"description": "Name of the FVInterpolationMethod to use for the advected quantity."}>>> = upwind
[]
[](test/tests/linearfvkernels/advection/advection-1d.i)Input Parameters
- control_tagsAdds user-defined labels for accessing object parameters via control logic.
C++ Type:std::vector<std::string>
Controllable:No
Description:Adds user-defined labels for accessing object parameters via control logic.
- enableTrueSet the enabled status of the MooseObject.
Default:True
C++ Type:bool
Controllable:No
Description:Set the enabled status of the MooseObject.
Input Files
- (test/tests/postprocessors/linearfv_flux_integral/linearfv_flux_integral.i)
- (test/tests/linearfvkernels/advection/advection-1d.i)
- (test/tests/linearfvkernels/advection/diagonal-step-2d-delaunay.i)
- (test/tests/linearfvkernels/advection/diagonal-step-2d.i)
- (test/tests/linearfvkernels/advection/advection-2d.i)
- (test/tests/linearfvkernels/advection/advection-2d-rz.i)
References
- Ami Harten.
High resolution schemes for hyperbolic conservation laws.
Journal of computational physics, 135(2):260–278, 1997.[BibTeX]
@article{harten1997, author = "Harten, Ami", title = "High resolution schemes for hyperbolic conservation laws", journal = "Journal of computational physics", volume = "135", number = "2", pages = "260--278", year = "1997", publisher = "Elsevier" } - Fadl Moukalled, L Mangani, Marwan Darwish, and others.
The finite volume method in computational fluid dynamics.
Volume 6.
Springer, 2016.[BibTeX]
@book{moukalled2016finite, author = "Moukalled, Fadl and Mangani, L and Darwish, Marwan and others", title = "The finite volume method in computational fluid dynamics", volume = "6", year = "2016", publisher = "Springer" }
(test/tests/linearfvkernels/advection/advection-1d.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 1
nx = 2
[]
[]
[Problem]
linear_sys_names = 'u_sys'
[]
[Variables]
[u]
type = MooseLinearVariableFVReal
solver_sys = 'u_sys'
initial_condition = 1.0
[]
[]
[FVInterpolationMethods]
[upwind]
type = FVAdvectedUpwind
[]
[average]
type = FVGeometricAverage
[]
[muscl_venkat]
type = FVAdvectedVenkatakrishnanDeferredCorrection
deferred_correction_factor = 1.0
[]
[nvd_vanleer]
type = FVAdvectedVanLeerWeightBased
blending_factor = 1.0
[]
[nvd_minmod]
type = FVAdvectedMinmodWeightBased
blending_factor = 1.0
[]
[]
[LinearFVKernels]
[advection]
type = LinearFVAdvection
variable = u
velocity = "0.5 0 0"
advected_interp_method_name = upwind
[]
[source]
type = LinearFVSource
variable = u
source_density = source_func
[]
[]
[LinearFVBCs]
[inflow]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = u
boundary = "left"
functor = analytic_solution
[]
[outflow]
type = LinearFVAdvectionDiffusionOutflowBC
variable = u
boundary = "right"
use_two_term_expansion = false
[]
[]
[Functions]
[source_func]
type = ParsedFunction
expression = '0.5*x'
[]
[analytic_solution]
type = ParsedFunction
expression = '0.5+0.5*x*x'
[]
[]
[Postprocessors]
[error]
type = ElementL2FunctorError
approximate = u
exact = analytic_solution
execute_on = FINAL
[]
[h]
type = AverageElementSize
execute_on = FINAL
[]
[]
[Convergence]
[linear]
type = IterationCountConvergence
max_iterations = 1
converge_at_max_iterations = true
[]
[]
[Executioner]
type = Steady
system_names = u_sys
l_tol = 1e-10
multi_system_fixed_point=true
multi_system_fixed_point_convergence=linear
multi_system_fixed_point_relaxation_factor = 1.0
petsc_options_iname = '-pc_type -pc_factor_shift_type -pc_factor_shift_amount -pc_factor_mat_solver_type -mat_mumps_icntl_14'
petsc_options_value = 'lu NONZERO 1e-12 mumps 50'
[]
[Outputs]
[csv]
type = CSV
execute_on = FINAL
[]
[]
advected_interp_method_name
C++ Type:InterpolationMethodName
Controllable:No
Description:Name of the FVInterpolationMethod to use for the advected quantity.
(test/tests/linearfvkernels/advection/advection-1d.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 1
nx = 2
[]
[]
[Problem]
linear_sys_names = 'u_sys'
[]
[Variables]
[u]
type = MooseLinearVariableFVReal
solver_sys = 'u_sys'
initial_condition = 1.0
[]
[]
[FVInterpolationMethods]
[upwind]
type = FVAdvectedUpwind
[]
[average]
type = FVGeometricAverage
[]
[muscl_venkat]
type = FVAdvectedVenkatakrishnanDeferredCorrection
deferred_correction_factor = 1.0
[]
[nvd_vanleer]
type = FVAdvectedVanLeerWeightBased
blending_factor = 1.0
[]
[nvd_minmod]
type = FVAdvectedMinmodWeightBased
blending_factor = 1.0
[]
[]
[LinearFVKernels]
[advection]
type = LinearFVAdvection
variable = u
velocity = "0.5 0 0"
advected_interp_method_name = upwind
[]
[source]
type = LinearFVSource
variable = u
source_density = source_func
[]
[]
[LinearFVBCs]
[inflow]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = u
boundary = "left"
functor = analytic_solution
[]
[outflow]
type = LinearFVAdvectionDiffusionOutflowBC
variable = u
boundary = "right"
use_two_term_expansion = false
[]
[]
[Functions]
[source_func]
type = ParsedFunction
expression = '0.5*x'
[]
[analytic_solution]
type = ParsedFunction
expression = '0.5+0.5*x*x'
[]
[]
[Postprocessors]
[error]
type = ElementL2FunctorError
approximate = u
exact = analytic_solution
execute_on = FINAL
[]
[h]
type = AverageElementSize
execute_on = FINAL
[]
[]
[Convergence]
[linear]
type = IterationCountConvergence
max_iterations = 1
converge_at_max_iterations = true
[]
[]
[Executioner]
type = Steady
system_names = u_sys
l_tol = 1e-10
multi_system_fixed_point=true
multi_system_fixed_point_convergence=linear
multi_system_fixed_point_relaxation_factor = 1.0
petsc_options_iname = '-pc_type -pc_factor_shift_type -pc_factor_shift_amount -pc_factor_mat_solver_type -mat_mumps_icntl_14'
petsc_options_value = 'lu NONZERO 1e-12 mumps 50'
[]
[Outputs]
[csv]
type = CSV
execute_on = FINAL
[]
[]
(test/tests/postprocessors/linearfv_flux_integral/linearfv_flux_integral.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 1
nx = 100
[]
[]
[Problem]
linear_sys_names = 'u_sys'
[]
[Variables]
[u]
type = MooseLinearVariableFVReal
solver_sys = 'u_sys'
initial_condition = 0.25
[]
[]
[FVInterpolationMethods]
[upwind]
type = FVAdvectedUpwind
[]
[]
[LinearFVKernels]
[diffusion]
type = LinearFVDiffusion
variable = u
diffusion_coeff = 0.5
use_nonorthogonal_correction = false
[]
[advection]
type = LinearFVAdvection
variable = u
velocity = '0.5 0 0'
advected_interp_method_name = upwind
[]
[]
[LinearFVBCs]
[left]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = u
boundary = left
functor = 1
[]
[right]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = u
boundary = right
functor = 0
[]
[]
[Postprocessors]
[flux_left_total]
type = BoundaryLinearFVFluxIntegral
boundary = left
linearfvkernels = 'diffusion advection'
[]
[flux_left_diff]
type = BoundaryLinearFVFluxIntegral
boundary = left
linearfvkernels = 'diffusion'
[]
[flux_left_adv]
type = BoundaryLinearFVFluxIntegral
boundary = left
linearfvkernels = 'advection'
[]
[flux_right_total]
type = BoundaryLinearFVFluxIntegral
boundary = right
linearfvkernels = 'diffusion advection'
[]
[flux_right_diff]
type = BoundaryLinearFVFluxIntegral
boundary = right
linearfvkernels = 'diffusion'
[]
[flux_right_adv]
type = BoundaryLinearFVFluxIntegral
boundary = right
linearfvkernels = 'advection'
[]
[flux_left_sum_error]
type = ParsedPostprocessor
expression = 'f_total - f_diff - f_adv'
pp_names = 'flux_left_total flux_left_diff flux_left_adv'
pp_symbols = 'f_total f_diff f_adv'
[]
[flux_right_sum_error]
type = ParsedPostprocessor
expression = 'f_total - f_diff - f_adv'
pp_names = 'flux_right_total flux_right_diff flux_right_adv'
pp_symbols = 'f_total f_diff f_adv'
[]
[flux_balance]
type = ParsedPostprocessor
expression = 'f_left + f_right'
pp_names = 'flux_left_total flux_right_total'
pp_symbols = 'f_left f_right'
[]
# These are the analytic solutions, when we refine we get closer and closer
[analytic_flux_left_adv]
type = ParsedPostprocessor
expression = '-v'
constant_names = 'v'
constant_expressions = '0.5'
[]
[analytic_flux_left_diff]
type = ParsedPostprocessor
expression = '-v / (exp(v / k * L) - 1)'
constant_names = 'v k L'
constant_expressions = '0.5 0.5 1'
[]
[analytic_flux_right_adv]
type = ParsedPostprocessor
expression = '0'
[]
[analytic_flux_right_diff]
type = ParsedPostprocessor
expression = 'v * exp(v / k * L) / (exp(v / k * L) - 1)'
constant_names = 'v k L'
constant_expressions = '0.5 0.5 1'
[]
[]
[Executioner]
type = Steady
system_names = u_sys
l_tol = 1e-12
l_abs_tol = 1e-12
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[Outputs]
csv = true
execute_on = timestep_end
[]
(test/tests/linearfvkernels/advection/advection-1d.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 1
nx = 2
[]
[]
[Problem]
linear_sys_names = 'u_sys'
[]
[Variables]
[u]
type = MooseLinearVariableFVReal
solver_sys = 'u_sys'
initial_condition = 1.0
[]
[]
[FVInterpolationMethods]
[upwind]
type = FVAdvectedUpwind
[]
[average]
type = FVGeometricAverage
[]
[muscl_venkat]
type = FVAdvectedVenkatakrishnanDeferredCorrection
deferred_correction_factor = 1.0
[]
[nvd_vanleer]
type = FVAdvectedVanLeerWeightBased
blending_factor = 1.0
[]
[nvd_minmod]
type = FVAdvectedMinmodWeightBased
blending_factor = 1.0
[]
[]
[LinearFVKernels]
[advection]
type = LinearFVAdvection
variable = u
velocity = "0.5 0 0"
advected_interp_method_name = upwind
[]
[source]
type = LinearFVSource
variable = u
source_density = source_func
[]
[]
[LinearFVBCs]
[inflow]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = u
boundary = "left"
functor = analytic_solution
[]
[outflow]
type = LinearFVAdvectionDiffusionOutflowBC
variable = u
boundary = "right"
use_two_term_expansion = false
[]
[]
[Functions]
[source_func]
type = ParsedFunction
expression = '0.5*x'
[]
[analytic_solution]
type = ParsedFunction
expression = '0.5+0.5*x*x'
[]
[]
[Postprocessors]
[error]
type = ElementL2FunctorError
approximate = u
exact = analytic_solution
execute_on = FINAL
[]
[h]
type = AverageElementSize
execute_on = FINAL
[]
[]
[Convergence]
[linear]
type = IterationCountConvergence
max_iterations = 1
converge_at_max_iterations = true
[]
[]
[Executioner]
type = Steady
system_names = u_sys
l_tol = 1e-10
multi_system_fixed_point=true
multi_system_fixed_point_convergence=linear
multi_system_fixed_point_relaxation_factor = 1.0
petsc_options_iname = '-pc_type -pc_factor_shift_type -pc_factor_shift_amount -pc_factor_mat_solver_type -mat_mumps_icntl_14'
petsc_options_value = 'lu NONZERO 1e-12 mumps 50'
[]
[Outputs]
[csv]
type = CSV
execute_on = FINAL
[]
[]
(test/tests/linearfvkernels/advection/diagonal-step-2d-delaunay.i)
[Mesh]
[file_mesh]
type = FileMeshGenerator
file = diagonal-step-2d-delaunay_in.e
[]
# Prevent test diffing on distributed parallel element numbering
allow_renumbering = false
[]
[Problem]
linear_sys_names = 'u_sys'
[]
[Variables]
[u]
type = MooseLinearVariableFVReal
solver_sys = 'u_sys'
initial_condition = 0.5
[]
[]
[FVInterpolationMethods]
[upwind]
type = FVAdvectedUpwind
[]
[average]
type = FVGeometricAverage
[]
[muscl_venkat]
type = FVAdvectedVenkatakrishnanDeferredCorrection
deferred_correction_factor = 1.0
[]
[nvd_vanleer]
type = FVAdvectedVanLeerWeightBased
blending_factor = 0.75
[]
[nvd_minmod]
type = FVAdvectedMinmodWeightBased
blending_factor = 0.75
[]
[]
[LinearFVKernels]
[advection]
type = LinearFVAdvection
variable = u
velocity = "1 1 0"
advected_interp_method_name = muscl_venkat
[]
[]
[LinearFVBCs]
[left_inflow]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = u
boundary = left
functor = 0.5
[]
[bottom_inflow]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = u
boundary = bottom
functor = 1
[]
[outflow]
type = LinearFVAdvectionDiffusionOutflowBC
variable = u
boundary = 'right top'
use_two_term_expansion = false
[]
[]
[VectorPostprocessors]
[diag_sample]
type = LineValueSampler
variable = u
start_point = '1.0 0 0'
end_point = '0 1.0 0'
num_points = 101
sort_by = id
warn_discontinuous_face_values = false
execute_on = TIMESTEP_END
[]
[]
[Convergence]
[linear]
type = IterationCountConvergence
max_iterations = 200
converge_at_max_iterations = true
[]
[]
[Executioner]
type = Steady
system_names = u_sys
l_tol = 1e-12
multi_system_fixed_point = true
multi_system_fixed_point_convergence = linear
multi_system_fixed_point_relaxation_factor = 0.3
petsc_options_iname = '-pc_type -pc_factor_shift_type -pc_factor_shift_amount -pc_factor_mat_solver_type -mat_mumps_icntl_14'
petsc_options_value = 'lu NONZERO 1e-12 mumps 50'
[]
[Outputs]
csv = true
exodus = true
execute_on = TIMESTEP_END
[]
(test/tests/linearfvkernels/advection/diagonal-step-2d.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 51
ny = 51
[]
# Prevent test diffing on distributed parallel element numbering
allow_renumbering = false
[]
[Problem]
linear_sys_names = 'u_sys'
[]
[Variables]
[u]
type = MooseLinearVariableFVReal
solver_sys = 'u_sys'
initial_condition = 0.5
[]
[]
[FVInterpolationMethods]
[upwind]
type = FVAdvectedUpwind
[]
[average]
type = FVGeometricAverage
[]
[muscl_venkat]
type = FVAdvectedVenkatakrishnanDeferredCorrection
deferred_correction_factor = 1.0
[]
[nvd_vanleer]
type = FVAdvectedVanLeerWeightBased
blending_factor = 0.75
[]
[nvd_minmod]
type = FVAdvectedMinmodWeightBased
blending_factor = 0.75
[]
[]
[LinearFVKernels]
[advection]
type = LinearFVAdvection
variable = u
velocity = "1 1 0"
advected_interp_method_name = nvd_minmod
[]
[]
[LinearFVBCs]
[left_inflow]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = u
boundary = left
functor = 0.5
[]
[bottom_inflow]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = u
boundary = bottom
functor = 1
[]
[outflow]
type = LinearFVAdvectionDiffusionOutflowBC
variable = u
boundary = 'right top'
use_two_term_expansion = true
[]
[]
[VectorPostprocessors]
[diag_sample]
type = LineValueSampler
variable = u
start_point = '1.0 0 0'
end_point = '0 1.0 0'
num_points = 101
sort_by = id
warn_discontinuous_face_values = false
execute_on = TIMESTEP_END
[]
[]
[Convergence]
[linear]
type = IterationCountConvergence
max_iterations = 50
converge_at_max_iterations = true
[]
[]
[Executioner]
type = Steady
system_names = u_sys
l_tol = 1e-12
multi_system_fixed_point = true
multi_system_fixed_point_convergence = linear
multi_system_fixed_point_relaxation_factor = 0.3
petsc_options_iname = '-pc_type -pc_factor_shift_type -pc_factor_shift_amount -pc_factor_mat_solver_type -mat_mumps_icntl_14'
petsc_options_value = 'lu NONZERO 1e-12 mumps 50'
[]
[Outputs]
csv = true
exodus = true
execute_on = TIMESTEP_END
[]
(test/tests/linearfvkernels/advection/advection-2d.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 2
ny= 1
ymax = 0.5
[]
[]
[Problem]
linear_sys_names = 'u_sys'
[]
[Variables]
[u]
type = MooseLinearVariableFVReal
solver_sys = 'u_sys'
initial_condition = 1.0
[]
[]
[FVInterpolationMethods]
[upwind]
type = FVAdvectedUpwind
[]
[average]
type = FVGeometricAverage
[]
[muscl_venkat]
type = FVAdvectedVenkatakrishnanDeferredCorrection
deferred_correction_factor = 1.0
[]
[nvd_vanleer]
type = FVAdvectedVanLeerWeightBased
blending_factor = 1.0
[]
[nvd_minmod]
type = FVAdvectedMinmodWeightBased
blending_factor = 1.0
[]
[]
[LinearFVKernels]
[advection]
type = LinearFVAdvection
variable = u
velocity = "0.5 0 0"
advected_interp_method_name = upwind
[]
[source]
type = LinearFVSource
variable = u
source_density = source_func
[]
[]
[LinearFVBCs]
[inflow]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = u
boundary = "left top bottom"
functor = analytic_solution
[]
[outflow]
type = LinearFVAdvectionDiffusionOutflowBC
variable = u
boundary = "right"
use_two_term_expansion = false
[]
[]
[Functions]
[source_func]
type = ParsedFunction
expression = '0.5*pi*sin(2*y*pi)*cos(x*pi)'
[]
[analytic_solution]
type = ParsedFunction
expression = 'sin(x*pi)*sin(2*y*pi) + 1.5'
[]
[]
[Postprocessors]
[error]
type = ElementL2FunctorError
approximate = u
exact = analytic_solution
execute_on = FINAL
[]
[h]
type = AverageElementSize
execute_on = FINAL
[]
[]
[Convergence]
[linear]
type = IterationCountConvergence
max_iterations = 1
converge_at_max_iterations = true
[]
[]
[Executioner]
type = Steady
system_names = u_sys
l_tol = 1e-10
multi_system_fixed_point=true
multi_system_fixed_point_convergence=linear
petsc_options_iname = '-pc_type -pc_factor_shift_type -pc_factor_shift_amount -pc_factor_mat_solver_type -mat_mumps_icntl_14'
petsc_options_value = 'lu NONZERO 1e-12 mumps 50'
[]
[Outputs]
[csv]
type = CSV
execute_on = FINAL
[]
[]
(test/tests/linearfvkernels/advection/advection-2d-rz.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 2
ny= 1
ymax = 0.5
[]
coord_type = RZ
rz_coord_axis = Y
[]
[Problem]
linear_sys_names = 'u_sys'
[]
[Variables]
[u]
type = MooseLinearVariableFVReal
solver_sys = 'u_sys'
initial_condition = 1.0
[]
[]
[FVInterpolationMethods]
[upwind]
type = FVAdvectedUpwind
[]
[average]
type = FVGeometricAverage
[]
[]
[LinearFVKernels]
[advection]
type = LinearFVAdvection
variable = u
velocity = "0.0 0.5 0"
advected_interp_method_name = average
[]
[source]
type = LinearFVSource
variable = u
source_density = source_func
[]
[]
[LinearFVBCs]
[inflow]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = u
boundary = "left right bottom"
functor = analytic_solution
[]
[outflow]
type = LinearFVAdvectionDiffusionOutflowBC
variable = u
boundary = "top"
use_two_term_expansion = true
[]
[]
[Functions]
[source_func]
type = ParsedFunction
expression = '1.0*pi*sin(x*pi)*cos(2*y*pi)'
[]
[analytic_solution]
type = ParsedFunction
expression = 'sin(x*pi)*sin(2*y*pi) + 1.5'
[]
[]
[Postprocessors]
[error]
type = ElementL2FunctorError
approximate = u
exact = analytic_solution
execute_on = FINAL
[]
[h]
type = AverageElementSize
execute_on = FINAL
[]
[]
[Convergence]
[linear]
type = IterationCountConvergence
max_iterations = 10
converge_at_max_iterations = true
[]
[]
[Executioner]
type = Steady
system_names = u_sys
l_tol = 1e-10
multi_system_fixed_point=true
multi_system_fixed_point_convergence=linear
petsc_options_iname = '-pc_type -pc_factor_shift_type -pc_factor_shift_amount'
petsc_options_value = 'lu NONZERO 1e-10'
[]
[Outputs]
[csv]
type = CSV
execute_on = FINAL
[]
[]