- variableThe name of the variable whose linear system this object contributes to
C++ Type:LinearVariableName
Unit:(no unit assumed)
Controllable:No
Description:The name of the variable whose linear system this object contributes to
LinearFVReaction
Description
This kernel contributes to the system matrix of a system which is solved for a linear finite volume variable MooseVariableLinearFVReal. The contribution for each cell is the numerical integral of the reaction coefficient () times the field quantity () in the following form:
where , and denote the cell centroid values of and and the volume, respectively. This means that the diagonal entry of the system matrix corresponding to cell will be increased by .
The reaction coefficient parameter ("coeff") accepts anything that supports functor-based evaluations. For more information on functors in MOOSE, see Functor system.
Example Syntax
The case below demonstrates the use of LinearFVReaction where the reaction coefficient is supplied based upon a function form:
[LinearFVKernels<<<{"href": "../../syntax/LinearFVKernels/index.html"}>>>]
[reaction]
type = LinearFVReaction<<<{"description": "Represents the matrix and right hand side contributions of a reaction term ($c u$) in a partial differential equation.", "href": "LinearFVReaction.html"}>>>
variable<<<{"description": "The name of the variable whose linear system this object contributes to"}>>> = u
coeff<<<{"description": "The reaction coefficient. A functor is any of the following: a variable, a functor material property, a function, a postprocessor or a number."}>>> = coeff_func
[]
[source]
type = LinearFVSource<<<{"description": "Represents the matrix and right hand side contributions of a solution-independent source term in a partial differential equation.", "href": "LinearFVSource.html"}>>>
variable<<<{"description": "The name of the variable whose linear system this object contributes to"}>>> = u
source_density<<<{"description": "The source density. A functor is any of the following: a variable, a functor material property, a function, a postprocessor or a number."}>>> = source_func
[]
[](test/tests/linearfvkernels/reaction/reaction-1d.i)Input Parameters
- blockThe list of blocks (ids or names) that this object will be applied
C++ Type:std::vector<SubdomainName>
Controllable:No
Description:The list of blocks (ids or names) that this object will be applied
- coeff1The reaction coefficient. A functor is any of the following: a variable, a functor material property, a function, a postprocessor or a number.
Default:1
C++ Type:MooseFunctorName
Unit:(no unit assumed)
Controllable:No
Description:The reaction coefficient. A functor is any of the following: a variable, a functor material property, a function, a postprocessor or a number.
Optional Parameters
- absolute_value_vector_tagsThe tags for the vectors this residual object should fill with the absolute value of the residual contribution
C++ Type:std::vector<TagName>
Controllable:No
Description:The tags for the vectors this residual object should fill with the absolute value of the residual contribution
- extra_matrix_tagsThe extra tags for the matrices this Kernel should fill
C++ Type:std::vector<TagName>
Controllable:No
Description:The extra tags for the matrices this Kernel should fill
- extra_vector_tagsThe extra tags for the vectors this Kernel should fill
C++ Type:std::vector<TagName>
Controllable:No
Description:The extra tags for the vectors this Kernel should fill
- matrix_onlyFalseWhether this object is only doing assembly to matrices (no vectors)
Default:False
C++ Type:bool
Controllable:No
Description:Whether this object is only doing assembly to matrices (no vectors)
- matrix_tagssystemThe tag for the matrices this Kernel should fill
Default:system
C++ Type:MultiMooseEnum
Options:nontime, system
Controllable:No
Description:The tag for the matrices this Kernel should fill
- vector_tagsrhsThe tag for the vectors this Kernel should fill
Default:rhs
C++ Type:MultiMooseEnum
Options:rhs, time
Controllable:No
Description:The tag for the vectors this Kernel should fill
Contribution To Tagged Field Data 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:Yes
Description:Set the enabled status of the MooseObject.
- implicitTrueDetermines whether this object is calculated using an implicit or explicit form
Default:True
C++ Type:bool
Controllable:No
Description:Determines whether this object is calculated using an implicit or explicit form
- seed0The seed for the master random number generator
Default:0
C++ Type:unsigned int
Controllable:No
Description:The seed for the master random number generator
- use_displaced_meshFalseWhether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.
Default:False
C++ Type:bool
Controllable:No
Description:Whether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.
Advanced Parameters
- ghost_layers1The number of layers of elements to ghost.
Default:1
C++ Type:unsigned short
Controllable:No
Description:The number of layers of elements to ghost.
- use_point_neighborsFalseWhether to use point neighbors, which introduces additional ghosting to that used for simple face neighbors.
Default:False
C++ Type:bool
Controllable:No
Description:Whether to use point neighbors, which introduces additional ghosting to that used for simple face neighbors.
Parallel Ghosting Parameters
Input Files
- (modules/navier_stokes/test/tests/finite_volume/pins/mms/linear-segregated/smooth-properties/smooth-properties.i)
- (modules/navier_stokes/test/tests/finite_volume/pins/mms/linear-segregated/interface-reconstruction/interface-reconstruction.i)
- (test/tests/linearfvkernels/block-restriction/block-restricted-diffusion-react.i)
- (test/tests/linearfvkernels/block-restriction/block-restricted-adr.i)
- (test/tests/tag/tag-linearfv.i)
- (test/tests/linearfvkernels/reaction/reaction-1d.i)
- (test/tests/outputs/debug/show_execution_linear_fv_elemental.i)
- (modules/navier_stokes/test/tests/finite_volume/two_phase/mixture_model/segregated/channel-drift-flux.i)
- (test/tests/linearfvkernels/diffusion-reaction-advection/advection-diffusion-reaction-2d.i)
- (modules/navier_stokes/examples/solidification/gallium_melting_linear.i)
- (test/tests/linearfvkernels/diffusion-reaction-advection/advection-diffusion-reaction-1d.i)
- (modules/navier_stokes/test/tests/finite_volume/pins/mms/linear-segregated/hydrostatic-jump/hydrostatic-jump.i)
coeff
Default:1
C++ Type:MooseFunctorName
Unit:(no unit assumed)
Controllable:No
Description:The reaction coefficient. A functor is any of the following: a variable, a functor material property, a function, a postprocessor or a number.
(test/tests/linearfvkernels/reaction/reaction-1d.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 1
nx = 10
[]
[]
[Problem]
linear_sys_names = 'u_sys'
[]
[Variables]
[u]
type = MooseLinearVariableFVReal
solver_sys = 'u_sys'
initial_condition = 1.0
[]
[]
[LinearFVKernels]
[reaction]
type = LinearFVReaction
variable = u
coeff = coeff_func
[]
[source]
type = LinearFVSource
variable = u
source_density = source_func
[]
[]
[Functions]
[coeff_func]
type = ParsedFunction
expression = '1+sin(x)'
[]
[source_func]
type = ParsedFunction
expression = '(1+sin(x))*(1+cos(x))'
[]
[analytic_solution]
type = ParsedFunction
expression = '1+cos(x)'
[]
[]
[Postprocessors]
[l2error]
type = ElementL2FunctorError
approximate = u
exact = analytic_solution
execute_on = TIMESTEP_END
[]
[]
[Executioner]
type = Steady
system_names = u_sys
l_tol = 1e-10
[]
[Outputs]
[exodus]
type = Exodus
execute_on = TIMESTEP_END
[]
[]
(modules/navier_stokes/test/tests/finite_volume/pins/mms/linear-segregated/smooth-properties/smooth-properties.i)
# Manufactured solution with continuously varying density and viscosity, optionally crossed by a
# pressure baffle with a porosity jump. In coordinates normal (xn) and tangent (xt) to the line
# x - skew * y = 0.5:
# - rho = 1 + xn/2 + xt/4 + xn xt/5 and mu = mu0 (m0 + 4 xn^2)(1 + xt^2) are smooth. With m0 = 0.05
# the viscosity varies by a factor of 40 across the domain and by a factor of several between
# neighboring cells on the coarse meshes.
# - rho U = curl(psi), psi = xt/2 + xt^2/10 + eps (xn (xt/10 - 3/10) + xn^2/5), so the mass flux is
# divergence-free. U.n is continuous across xn = 0 and U_t jumps with eps, while the interstitial
# tangential velocity U_t / eps is continuous.
# - The pressure is smooth on each side. With a baffle, the right side adds the
# BernoulliFormLossPressureJump evaluated with the interface density and normal velocity.
# The forcing contains the porous advection div(rho U U / eps), the full stress
# div(mu (grad U + grad U^T - 2/3 div U I)) of superficial velocity, eps grad p, and a reaction k U.
# Without a baffle (baffle = 0), eps_left = eps_right must hold.
# The expressions were generated with sympy.
eps_left = 1
eps_right = 1
form_loss = 0
mu0 = 0.01
m0 = 0.05
reaction = 1
skew = 0
nx = 8
ny = 8
# Set baffle = 1 together with UserObjects/rc/pressure_jump_models=pressure_jump to make the
# interface a pressure baffle; otherwise it is an ordinary internal face.
baffle = 0
deviatoric = true
# Porosity of the side whose interstitial velocity is the form-loss reference: the lower one, the
# BernoulliFormLossPressureJump default.
eps_ref = '${fparse min(eps_left, eps_right)}'
[Problem]
linear_sys_names = 'u_system v_system pressure_system'
previous_nl_solution_required = true
[]
[Mesh]
[generated]
type = GeneratedMeshGenerator
dim = 2
nx = ${nx}
ny = ${ny}
[]
[right]
type = ParsedSubdomainMeshGenerator
input = generated
combinatorial_geometry = 'x > 0.5'
block_id = 2
block_name = right
[]
[left]
type = ParsedSubdomainMeshGenerator
input = right
combinatorial_geometry = 'x < 0.5'
block_id = 1
block_name = left
[]
[skew]
type = ParsedNodeTransformGenerator
input = left
x_function = 'x + ${skew} * y'
[]
[baffle]
type = SideSetsBetweenSubdomainsGenerator
input = skew
primary_block = left
paired_block = right
new_boundary = baffle
[]
[]
[FVGradientMethods]
[jump_aware]
type = FVPressureJumpGreenGaussGradient
[]
[velocity_jump_aware]
type = FVVelocityJumpGreenGaussGradient
[]
# The reconstructed pressure gradient keeps the cell pressure gradient consistent with the face
# fluxes and suppresses odd-even pressure modes.
[reconstructed]
type = FVReconstructedPressureGradient
base_gradient_method = jump_aware
gradient_relaxation = 1
[]
[]
[FVInterpolationMethods]
[average]
type = FVGeometricAverage
[]
[]
[UserObjects]
[pressure_jump]
type = BernoulliFormLossPressureJump
boundary = baffle
porosity = porosity
density = density
form_loss = ${form_loss}
[]
[rc]
type = PorousRhieChowMassFlux
u = superficial_u
v = superficial_v
pressure = pressure
rho = density
porosity = porosity
p_diffusion_kernel = p_diffusion
pressure_projection_method = consistent
[]
[]
[Variables]
[superficial_u]
type = MooseLinearVariableFVReal
solver_sys = u_system
initial_condition = 0
gradient_method = velocity_jump_aware
[]
[superficial_v]
type = MooseLinearVariableFVReal
solver_sys = v_system
initial_condition = 0
gradient_method = velocity_jump_aware
[]
[pressure]
type = MooseLinearVariableFVReal
solver_sys = pressure_system
initial_condition = 0
gradient_method = jump_aware
[]
[]
[LinearFVKernels]
[u_advection_stress]
type = LinearPWCNSFVMomentumFlux
variable = superficial_u
advected_interp_method_name = average
mu = viscosity
u = superficial_u
v = superficial_v
momentum_component = x
rhie_chow_user_object = rc
use_nonorthogonal_correction = true
use_deviatoric_terms = ${deviatoric}
[]
[v_advection_stress]
type = LinearPWCNSFVMomentumFlux
variable = superficial_v
advected_interp_method_name = average
mu = viscosity
u = superficial_u
v = superficial_v
momentum_component = y
rhie_chow_user_object = rc
use_nonorthogonal_correction = true
use_deviatoric_terms = ${deviatoric}
[]
[u_pressure]
type = LinearPWCNSFVMomentumPressure
variable = superficial_u
pressure = pressure
porosity = porosity
momentum_component = x
gradient_method = reconstructed
[]
[v_pressure]
type = LinearPWCNSFVMomentumPressure
variable = superficial_v
pressure = pressure
porosity = porosity
momentum_component = y
gradient_method = reconstructed
[]
[u_source]
type = LinearFVSource
variable = superficial_u
source_density = forcing_u
[]
[v_source]
type = LinearFVSource
variable = superficial_v
source_density = forcing_v
[]
[u_reaction]
type = LinearFVReaction
variable = superficial_u
coeff = ${reaction}
[]
[v_reaction]
type = LinearFVReaction
variable = superficial_v
coeff = ${reaction}
[]
[p_diffusion]
type = LinearFVPressureCorrectionDiffusionJump
variable = pressure
rhie_chow_user_object = rc
use_nonorthogonal_correction = true
[]
[HbyA_divergence]
type = LinearFVDivergence
variable = pressure
face_flux = HbyA
force_boundary_execution = true
[]
[]
[LinearFVBCs]
[velocity_x]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
boundary = 'left right top bottom'
variable = superficial_u
functor = exact_u
[]
[velocity_y]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
boundary = 'left right top bottom'
variable = superficial_v
functor = exact_v
[]
[pressure_flux]
type = LinearFVPressureFluxBC
boundary = 'left right top bottom'
variable = pressure
HbyA_flux = HbyA
Ainv = Ainv
rho = density
u = superficial_u
v = superficial_v
# The two-term boundary pressure expansion is inaccurate on this nonorthogonal mesh.
use_two_term_expansion = false
[]
[]
[FunctorMaterials]
[density]
type = ParsedFunctorMaterial
property_name = density
functor_names = 'xn xt'
expression = '1+xn/2+xt/4+xn*xt/5'
[]
[viscosity]
type = ParsedFunctorMaterial
property_name = viscosity
functor_names = 'xn xt'
expression = '${mu0}*(${m0}+4*xn^2)*(1+xt^2)'
[]
[porosity]
type = ParsedFunctorMaterial
property_name = porosity
functor_names = 'exact_porosity'
expression = 'exact_porosity'
[]
[pressure_error]
type = ParsedFunctorMaterial
property_name = pressure_error
functor_names = 'pressure exact_pressure'
expression = 'pressure-exact_pressure'
[]
[u_error]
type = ParsedFunctorMaterial
property_name = u_error
functor_names = 'superficial_u exact_u'
expression = 'superficial_u-exact_u'
[]
[v_error]
type = ParsedFunctorMaterial
property_name = v_error
functor_names = 'superficial_v exact_v'
expression = 'superficial_v-exact_v'
[]
[]
[Functions]
[xn]
type = ParsedFunction
expression = '(x-${skew}*y-0.5)/sqrt(1+${skew}^2)'
[]
[xt]
type = ParsedFunction
expression = '(${skew}*x+y)/sqrt(1+${skew}^2)'
[]
# Side indicator: 1 on the right of the interface when it is a baffle, otherwise 0.
[rs]
type = ParsedFunction
expression = 'if(x-${skew}*y>0.5,${baffle},0)'
[]
[exact_porosity]
type = ParsedFunction
expression = 'if(x-${skew}*y<0.5,${eps_left},${eps_right})'
[]
[exact_normal_velocity]
type = ParsedFunction
symbol_names = 'xn xt eps'
symbol_values = 'xn xt exact_porosity'
expression = '2*(eps*xn + 2*xt + 5)/(4*xn*xt + 10*xn + 5*xt + 20)'
[]
[exact_tangential_velocity]
type = ParsedFunction
symbol_names = 'xn xt eps'
symbol_values = 'xn xt exact_porosity'
expression = '2*eps*(-4*xn - xt + 3)/(4*xn*xt + 10*xn + 5*xt + 20)'
[]
[exact_pressure]
type = ParsedFunction
symbol_names = 'xn xt rs el er eref K'
symbol_values = 'xn xt rs ${eps_left} ${eps_right} ${eps_ref} ${form_loss}'
expression = '(el^2*er^2*eref^2*(xt + 4)*((4*xn + 1)^2 + 2*(4*xn + 1)*(2*xt - 1) + 4*(2*xt - 1)^2)/160 - '
'rs*(2*xt + 5)^2*(K*el^2*er^2 + eref^2*(el^2 - er^2))/50)/(el^2*er^2*eref^2*(xt + 4))'
[]
[forcing_normal]
type = ParsedFunction
symbol_names = 'xn xt eps mu0 m0 k'
symbol_values = 'xn xt exact_porosity ${mu0} ${m0} ${reaction}'
expression = '(3*eps^2*(2*xn + xt)*(4*xn*xt + 10*xn + 5*xt + 20)^3 + 60*eps*k*(eps*xn + 2*xt + '
'5)*(4*xn*xt + 10*xn + 5*xt + 20)^2 + 320*eps*mu0*xn*(xt^2 + 1)*(eps*(4*xn + 5)*(4*xn + xt '
'- 3) - 2*(2*xt + 5)*(eps*xn + 2*xt + 5))*(4*xn*xt + 10*xn + 5*xt + 20) + 40*eps*mu0*(m0 + '
'4*xn^2)*(xt^2 + 1)*(2*eps*(16*xn - 1)*(4*xn*xt + 10*xn + 5*xt + 20) - 3*(4*xn + '
'5)*(-2*eps*(2*xt + 5)*(4*xn + xt - 3) + (4*xn + 5)*(eps*xn + 2*xt + 5)) + 12*(2*xt + '
'5)*(eps*(4*xn*xt + 10*xn + 5*xt + 20) - 2*(2*xt + 5)*(eps*xn + 2*xt + 5)) + 4*(2*xt + '
'5)*(-eps*(4*xn + 5)*(4*xn + xt - 3) + 2*(2*xt + 5)*(eps*xn + 2*xt + 5)) - 3*(4*xn*xt + '
'10*xn + 5*xt + 20)*(2*eps*(4*xn + 5) + eps*(2*xt + 5) + 2*eps*(4*xn + xt - 3) - 8*xn - '
'10)) - 120*eps*mu0*(8*xn*(xt^2 + 1)*(eps*(4*xn*xt + 10*xn + 5*xt + 20) - 2*(2*xt + '
'5)*(eps*xn + 2*xt + 5)) + xt*(m0 + 4*xn^2)*(2*eps*(2*xt + 5)*(4*xn + xt - 3) + 2*(1 - '
'2*eps)*(4*xn*xt + 10*xn + 5*xt + 20) - (4*xn + 5)*(eps*xn + 2*xt + 5)))*(4*xn*xt + 10*xn + '
'5*xt + 20) + 6*(eps*(eps*xn - 8*xn + 11)*(4*xn*xt + 10*xn + 5*xt + 20) + (eps*(4*xn + '
'5)*(4*xn + xt - 3) - 2*(2*xt + 5)*(eps*xn + 2*xt + 5))*(eps*xn + 2*xt + 5))*(4*xn*xt + '
'10*xn + 5*xt + 20))/(30*eps*(4*xn*xt + 10*xn + 5*xt + 20)^3)'
[]
[forcing_tangential]
type = ParsedFunction
symbol_names = 'xn xt eps rs el er eref K mu0 m0 k'
symbol_values = 'xn xt exact_porosity rs ${eps_left} ${eps_right} ${eps_ref} ${form_loss} ${mu0} ${m0} ${reaction}'
expression = '(-1200*el^2*eps*er^2*eref^2*k*(xt + 4)^2*(4*xn + xt - 3)*(4*xn*xt + 10*xn + 5*xt + 20)^2 + '
'1600*el^2*er^2*eref^2*mu0*xt*(m0 + 4*xn^2)*(xt + 4)^2*(eps*(4*xn + 5)*(4*xn + xt - 3) - '
'2*(2*xt + 5)*(eps*xn + 2*xt + 5))*(4*xn*xt + 10*xn + 5*xt + 20) + '
'400*el^2*er^2*eref^2*mu0*(m0 + 4*xn^2)*(xt + 4)^2*(xt^2 + 1)*(12*eps*(4*xn + 5)*(-4*xn*xt '
'- 10*xn - 5*xt + (4*xn + 5)*(4*xn + xt - 3) - 20) - 4*(4*xn + 5)*(eps*(4*xn + 5)*(4*xn + '
'xt - 3) - 2*(2*xt + 5)*(eps*xn + 2*xt + 5)) + 12*(2*xt + 5)*(2*eps*(2*xt + 5)*(4*xn + xt - '
'3) - (4*xn + 5)*(eps*xn + 2*xt + 5)) - 2*(4*eps*xn - eps*(4*xn + 5) + 16*xt + 40)*(4*xn*xt '
'+ 10*xn + 5*xt + 20) + 3*(4*xn*xt + 10*xn + 5*xt + 20)*(4*eps*xn + eps*(4*xn + 5) - '
'16*eps*(2*xt + 5) + 16*xt + 40)) - 4800*el^2*er^2*eref^2*mu0*(xt + 4)^2*(eps*xt*(m0 + '
'4*xn^2)*(-4*xn*xt - 10*xn - 5*xt + (4*xn + 5)*(4*xn + xt - 3) - 20) + 2*xn*(xt^2 + '
'1)*(2*eps*(2*xt + 5)*(4*xn + xt - 3) + 2*(1 - 2*eps)*(4*xn*xt + 10*xn + 5*xt + 20) - (4*xn '
'+ 5)*(eps*xn + 2*xt + 5)))*(4*xn*xt + 10*xn + 5*xt + 20) + 120*el^2*er^2*eref^2*(xt + '
'4)^2*(-(eps*(4*xn + 5)*(4*xn + xt - 3) - 2*(2*xt + 5)*(eps*xn + 2*xt + 5))*(4*xn + xt - 3) '
'+ (-4*eps*xn + eps*(4*xn + xt - 3) - 8*xt - 20)*(4*xn*xt + 10*xn + 5*xt + 20))*(4*xn*xt + '
'10*xn + 5*xt + 20) - 3*eps*(5*el^2*er^2*eref^2*(xt + 4)^2*(-4*xn - 8*xt + 3) + 4*rs*(2*xt '
'+ 5)*(4*K*el^2*er^2*(xt + 4) - K*el^2*er^2*(2*xt + 5) + eref^2*(-el^2 + er^2)*(2*xt + 5) + '
'4*eref^2*(el^2 - er^2)*(xt + 4)))*(4*xn*xt + 10*xn + 5*xt + '
'20)^3)/(600*el^2*er^2*eref^2*(xt + 4)^2*(4*xn*xt + 10*xn + 5*xt + 20)^3)'
[]
[exact_u]
type = ParsedFunction
expression = '(un+${skew}*ut)/sqrt(1+${skew}^2)'
symbol_names = 'un ut'
symbol_values = 'exact_normal_velocity exact_tangential_velocity'
[]
[exact_v]
type = ParsedFunction
expression = '(-${skew}*un+ut)/sqrt(1+${skew}^2)'
symbol_names = 'un ut'
symbol_values = 'exact_normal_velocity exact_tangential_velocity'
[]
[forcing_u]
type = ParsedFunction
expression = '(fn+${skew}*ft)/sqrt(1+${skew}^2)'
symbol_names = 'fn ft'
symbol_values = 'forcing_normal forcing_tangential'
[]
[forcing_v]
type = ParsedFunction
expression = '(-${skew}*fn+ft)/sqrt(1+${skew}^2)'
symbol_names = 'fn ft'
symbol_values = 'forcing_normal forcing_tangential'
[]
[]
[Executioner]
type = SIMPLE
momentum_l_abs_tol = 1e-12
pressure_l_abs_tol = 1e-12
momentum_l_tol = 0
pressure_l_tol = 0
momentum_l_max_its = 100
pressure_l_max_its = 100
rhie_chow_user_object = rc
momentum_systems = 'u_system v_system'
pressure_system = pressure_system
momentum_equation_relaxation = 0.5
pressure_variable_relaxation = 0.2
num_iterations = 3000
pressure_absolute_tolerance = 1e-9
momentum_absolute_tolerance = 1e-9
momentum_petsc_options_iname = '-pc_type -pc_hypre_type'
momentum_petsc_options_value = 'hypre boomeramg'
pressure_petsc_options_iname = '-pc_type -pc_hypre_type'
pressure_petsc_options_value = 'hypre boomeramg'
print_fields = false
# The exact pressure is zero at (xn, xt) = (-1/4, 1/2), on the left side.
pin_pressure = true
pressure_pin_value = 0
pressure_pin_point = '${fparse 0.5 + (-0.25 + skew * (0.5 - 0.5 * skew / sqrt(1 + skew^2))) / sqrt(1 + skew^2)} '
'${fparse (0.25 * skew + 0.5 - 0.5 * skew / sqrt(1 + skew^2)) / sqrt(1 + skew^2)} 0'
[]
[Outputs]
[csv]
type = CSV
execute_on = FINAL
[]
[]
[Postprocessors]
[h]
type = AverageElementSize
execute_on = FINAL
[]
[L2u]
type = ElementL2FunctorError
approximate = superficial_u
exact = exact_u
execute_on = FINAL
[]
[L2v]
type = ElementL2FunctorError
approximate = superficial_v
exact = exact_v
execute_on = FINAL
[]
[L2p]
type = ElementL2FunctorError
approximate = pressure
exact = exact_pressure
execute_on = FINAL
[]
# The maximum pointwise errors detect cell-to-cell oscillations that the L2 norms average out.
[max_u_error]
type = ElementExtremeFunctorValue
functor = u_error
value_type = max_abs
execute_on = FINAL
[]
[max_v_error]
type = ElementExtremeFunctorValue
functor = v_error
value_type = max_abs
execute_on = FINAL
[]
[max_p_error]
type = ElementExtremeFunctorValue
functor = pressure_error
value_type = max_abs
execute_on = FINAL
[]
[]
(modules/navier_stokes/test/tests/finite_volume/pins/mms/linear-segregated/interface-reconstruction/interface-reconstruction.i)
# Manufactured pressure-baffle problem whose superficial velocity is linear on each side of the
# baffle. In coordinates normal (r) and tangent (t) to the interface:
# - rho * U_r = mass_flux, so mass is conserved;
# - U_t = eps_s * tangential_velocity + tangential_slope_s * r, so the interstitial tangential
# velocity U_t / eps is continuous at r = 0 while the one-sided slopes may differ.
# The forcing balances advection and reaction exactly, so the pressure is constant on each side.
# Its jump is the BernoulliFormLossPressureJump with side velocities mass_flux / (rho eps_s):
# p_right - p_left = mass_flux^2 / (2 rho) * (1 / eps_left^2 - 1 / eps_right^2).
# With viscosity, the baffle transmits only a shear traction, and only from a clear side (unit
# porosity). Between two clear sides it is continuous, so the slopes must be equal. Two porous
# sides transmit none, so viscous cases with porosity below one on both sides need zero slopes. A
# clear side shears against the superficial velocity of a porous side at the interface, so with
# the clear side on the left the traction balance on both rows requires equal slopes and a
# continuous superficial tangential velocity, eps_left * tangential_velocity =
# eps_right * tangential_velocity, which with a porosity jump means tangential_velocity = 0.
# The normal velocity is constant and carries no viscous stress. A consistent scheme reproduces
# this piecewise-linear solution to round-off on uniform meshes.
rho = 1
eps_left = 1
eps_right = 1
mass_flux = 0.02
mu = 0
reaction = 10
tangential_velocity = 0.1
tangential_slope_left = 0.2
tangential_slope_right = 0.2
interface = 0.5
skew = 0
nx = 8
ny = 8
pressure_gradient_method = reconstructed
nonorthogonal = false
[Problem]
linear_sys_names = 'u_system v_system pressure_system'
previous_nl_solution_required = true
[]
[Mesh]
[generated]
type = GeneratedMeshGenerator
dim = 2
nx = ${nx}
ny = ${ny}
[]
[right]
type = ParsedSubdomainMeshGenerator
input = generated
combinatorial_geometry = 'x > ${interface}'
block_id = 2
block_name = right
[]
[left]
type = ParsedSubdomainMeshGenerator
input = right
combinatorial_geometry = 'x < ${interface}'
block_id = 1
block_name = left
[]
[skew]
type = ParsedNodeTransformGenerator
input = left
x_function = 'x + ${skew} * y'
[]
[baffle]
type = SideSetsBetweenSubdomainsGenerator
input = skew
primary_block = left
paired_block = right
new_boundary = baffle
[]
[]
[FVGradientMethods]
[jump_aware]
type = FVPressureJumpGreenGaussGradient
[]
[velocity_jump_aware]
type = FVVelocityJumpGreenGaussGradient
[]
[reconstructed]
type = FVReconstructedPressureGradient
base_gradient_method = jump_aware
gradient_relaxation = 1
[]
[]
[FVInterpolationMethods]
[average]
type = FVGeometricAverage
[]
[]
[UserObjects]
[pressure_jump]
type = BernoulliFormLossPressureJump
boundary = baffle
porosity = porosity
density = density
[]
[rc]
type = PorousRhieChowMassFlux
u = superficial_u
v = superficial_v
pressure = pressure
rho = density
porosity = porosity
p_diffusion_kernel = p_diffusion
pressure_jump_models = pressure_jump
pressure_projection_method = consistent
[]
[]
[Variables]
[superficial_u]
type = MooseLinearVariableFVReal
solver_sys = u_system
initial_condition = ${mass_flux}
gradient_method = velocity_jump_aware
[]
[superficial_v]
type = MooseLinearVariableFVReal
solver_sys = v_system
initial_condition = ${tangential_velocity}
gradient_method = velocity_jump_aware
[]
[pressure]
type = MooseLinearVariableFVReal
solver_sys = pressure_system
initial_condition = 0
gradient_method = jump_aware
[]
[]
[LinearFVKernels]
[u_advection]
type = LinearPWCNSFVMomentumFlux
variable = superficial_u
advected_interp_method_name = average
mu = viscosity
u = superficial_u
v = superficial_v
momentum_component = x
rhie_chow_user_object = rc
use_nonorthogonal_correction = ${nonorthogonal}
[]
[v_advection]
type = LinearPWCNSFVMomentumFlux
variable = superficial_v
advected_interp_method_name = average
mu = viscosity
u = superficial_u
v = superficial_v
momentum_component = y
rhie_chow_user_object = rc
use_nonorthogonal_correction = ${nonorthogonal}
[]
[u_pressure]
type = LinearPWCNSFVMomentumPressure
variable = superficial_u
pressure = pressure
porosity = porosity
momentum_component = x
gradient_method = ${pressure_gradient_method}
[]
[v_pressure]
type = LinearPWCNSFVMomentumPressure
variable = superficial_v
pressure = pressure
porosity = porosity
momentum_component = y
gradient_method = ${pressure_gradient_method}
[]
[u_source]
type = LinearFVSource
variable = superficial_u
source_density = forcing_u
[]
[u_reaction]
type = LinearFVReaction
variable = superficial_u
coeff = ${reaction}
[]
[v_source]
type = LinearFVSource
variable = superficial_v
source_density = forcing_v
[]
[v_reaction]
type = LinearFVReaction
variable = superficial_v
coeff = ${reaction}
[]
[p_diffusion]
type = LinearFVPressureCorrectionDiffusionJump
variable = pressure
rhie_chow_user_object = rc
use_nonorthogonal_correction = ${nonorthogonal}
[]
[HbyA_divergence]
type = LinearFVDivergence
variable = pressure
face_flux = HbyA
force_boundary_execution = true
[]
[]
[LinearFVBCs]
[velocity_x]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
boundary = 'left right top bottom'
variable = superficial_u
functor = exact_u
[]
[velocity_y]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
boundary = 'left right top bottom'
variable = superficial_v
functor = exact_v
[]
[pressure_flux]
type = LinearFVPressureFluxBC
boundary = 'left right top bottom'
variable = pressure
HbyA_flux = HbyA
Ainv = Ainv
rho = density
u = superficial_u
v = superficial_v
[]
[]
[FunctorMaterials]
[density]
type = ParsedFunctorMaterial
property_name = density
expression = '${rho}'
[]
[porosity]
type = ParsedFunctorMaterial
property_name = porosity
expression = 'if(x-${skew}*y<${interface},${eps_left},${eps_right})'
[]
[viscosity]
type = ParsedFunctorMaterial
property_name = viscosity
expression = '${mu}'
[]
[pressure_error]
type = ParsedFunctorMaterial
property_name = pressure_error
functor_names = 'pressure exact_pressure'
expression = 'pressure-exact_pressure'
[]
[]
[AuxVariables]
[reconstructed_grad_p]
family = MONOMIAL_VEC
order = CONSTANT
[]
[]
[AuxKernels]
[reconstructed_grad_p]
type = LinearFVGradientAux
variable = reconstructed_grad_p
linear_fv_variable = pressure
gradient_method = reconstructed
execute_on = FINAL
[]
[]
[Functions]
[normal_coordinate]
type = ParsedFunction
expression = '(x-skew*y-interface)/sqrt(1+skew^2)'
symbol_names = 'skew interface'
symbol_values = '${skew} ${interface}'
[]
[exact_normal_velocity]
type = ParsedFunction
expression = '${mass_flux}/${rho}'
[]
[exact_tangential_velocity]
type = ParsedFunction
expression = 'velocity*porosity+if(x-skew*y<interface,slope_left,slope_right)*r'
symbol_names = 'skew interface velocity porosity slope_left slope_right r'
symbol_values = '${skew} ${interface} ${tangential_velocity} exact_porosity ${tangential_slope_left} ${tangential_slope_right} normal_coordinate'
[]
[exact_pressure]
type = ParsedFunction
expression = 'if(x-skew*y<interface,0,mass_flux^2/(2*rho)*(1/eps_left^2-1/eps_right^2))'
symbol_names = 'skew interface mass_flux rho eps_left eps_right'
symbol_values = '${skew} ${interface} ${mass_flux} ${rho} ${eps_left} ${eps_right}'
[]
[exact_u]
type = ParsedFunction
expression = '(normal+skew*tangential)/sqrt(1+skew^2)'
symbol_names = 'skew normal tangential'
symbol_values = '${skew} exact_normal_velocity exact_tangential_velocity'
[]
[exact_v]
type = ParsedFunction
expression = '(-skew*normal+tangential)/sqrt(1+skew^2)'
symbol_names = 'skew normal tangential'
symbol_values = '${skew} exact_normal_velocity exact_tangential_velocity'
[]
[forcing_u]
type = ParsedFunction
expression = 'skew*mass_flux*slope/(porosity*sqrt(1+skew^2))+reaction*u'
symbol_names = 'skew interface mass_flux slope porosity reaction u'
symbol_values = '${skew} ${interface} ${mass_flux} tangential_slope exact_porosity ${reaction} exact_u'
[]
[forcing_v]
type = ParsedFunction
expression = 'mass_flux*slope/(porosity*sqrt(1+skew^2))+reaction*v'
symbol_names = 'skew interface mass_flux slope porosity reaction v'
symbol_values = '${skew} ${interface} ${mass_flux} tangential_slope exact_porosity ${reaction} exact_v'
[]
[tangential_slope]
type = ParsedFunction
expression = 'if(x-skew*y<interface,slope_left,slope_right)'
symbol_names = 'skew interface slope_left slope_right'
symbol_values = '${skew} ${interface} ${tangential_slope_left} ${tangential_slope_right}'
[]
[exact_porosity]
type = ParsedFunction
expression = 'if(x-skew*y<interface,eps_left,eps_right)'
symbol_names = 'skew interface eps_left eps_right'
symbol_values = '${skew} ${interface} ${eps_left} ${eps_right}'
[]
[]
[Executioner]
type = SIMPLE
momentum_l_abs_tol = 1e-12
pressure_l_abs_tol = 1e-12
momentum_l_tol = 0
pressure_l_tol = 0
momentum_l_max_its = 100
pressure_l_max_its = 100
rhie_chow_user_object = rc
momentum_systems = 'u_system v_system'
pressure_system = pressure_system
momentum_equation_relaxation = 0.7
pressure_variable_relaxation = 0.5
# A solution that is exact to round-off stalls the normalized residuals near 1e-6 instead of
# meeting the absolute tolerances, so run a fixed number of iterations instead.
num_iterations = 200
continue_on_max_its = true
pressure_absolute_tolerance = 1e-11
momentum_absolute_tolerance = 1e-11
momentum_petsc_options_iname = '-pc_type -pc_hypre_type'
momentum_petsc_options_value = 'hypre boomeramg'
pressure_petsc_options_iname = '-pc_type -pc_hypre_type'
pressure_petsc_options_value = 'hypre boomeramg'
print_fields = false
pin_pressure = true
pressure_pin_value = 0
pressure_pin_point = '0.25 0.5 0'
[]
[Postprocessors]
[h]
type = AverageElementSize
execute_on = FINAL
[]
[L2u]
type = ElementL2FunctorError
approximate = superficial_u
exact = exact_u
execute_on = FINAL
[]
[L2v]
type = ElementL2FunctorError
approximate = superficial_v
exact = exact_v
execute_on = FINAL
[]
[L2p]
type = ElementL2FunctorError
approximate = pressure
exact = exact_pressure
execute_on = FINAL
[]
[L2gradp]
type = ElementVectorL2Error
variable = reconstructed_grad_p
function_x = 0
function_y = 0
execute_on = FINAL
[]
[boundary_mass_balance]
type = VolumetricFlowRate
boundary = 'left right top bottom'
vel_x = superficial_u
vel_y = superficial_v
advected_quantity = density
rhie_chow_user_object = rc
execute_on = FINAL
[]
[max_pressure_error]
type = ElementExtremeFunctorValue
functor = pressure_error
value_type = max_abs
execute_on = FINAL
[]
[]
[Outputs]
exodus = false
[csv]
type = CSV
execute_on = FINAL
[]
[]
(test/tests/linearfvkernels/block-restriction/block-restricted-diffusion-react.i)
source=1
diff_coeff=2
reac_coeff=3
[Mesh]
[cmg]
type = CartesianMeshGenerator
dim = 1
dx = '0.5 0.5'
ix = '20 20'
subdomain_id = '1 2'
[]
[]
[Problem]
linear_sys_names = 'u_sys'
[]
[Variables]
[u]
type = MooseLinearVariableFVReal
solver_sys = 'u_sys'
initial_condition = 1.0
[]
[]
[LinearFVKernels]
[diffusion]
type = LinearFVDiffusion
variable = u
diffusion_coeff = ${diff_coeff}
use_nonorthogonal_correction = false
block = 1
[]
[reaction]
type = LinearFVReaction
variable = u
coeff = ${reac_coeff}
block = 2
[]
[source]
type = LinearFVSource
variable = u
source_density = ${source}
[]
[]
[LinearFVBCs]
[dir]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = u
boundary = "left"
functor = 0
[]
[]
[Functions]
[analytic_solution]
type = ParsedFunction
expression = 'if(x<0.5, -x*x*S/2/D+(S/C+0.5*0.5/2/D*S)/0.5*x, S/C)'
symbol_names = 'S D C'
symbol_values = '${source} ${diff_coeff} ${reac_coeff}'
[]
[]
[Postprocessors]
[h]
type = AverageElementSize
execute_on = TIMESTEP_END
block = 2
[]
[error]
type = ElementL2FunctorError
approximate = u
exact = analytic_solution
execute_on = TIMESTEP_END
block = 2
[]
[]
[Convergence]
[linear]
type = IterationCountConvergence
max_iterations = 1
converge_at_max_iterations = true
[]
[]
[Executioner]
type = Steady
system_names = u_sys
multi_system_fixed_point=true
multi_system_fixed_point_convergence=linear
petsc_options_iname = '-pc_type -pc_hypre_type -ksp_rtol'
petsc_options_value = 'hypre boomeramg 1e-10'
[]
[Outputs]
[csv]
type = CSV
execute_on = TIMESTEP_END
[]
[]
(test/tests/linearfvkernels/block-restriction/block-restricted-adr.i)
[Mesh]
[cmg]
type = CartesianMeshGenerator
dim = 2
dx = '0.1 1 0.1'
dy = '0.1 0.5 0.1'
ix = '1 2 1'
iy = '1 1 1'
subdomain_id = '1 1 1 1 2 3 1 1 1'
[]
[transform]
type = TransformGenerator
input = cmg
transform = TRANSLATE
vector_value = '-0.1 -0.1 0.0'
[]
[create_sides]
type = SideSetsBetweenSubdomainsGenerator
input = transform
new_boundary = sides
primary_block = 2
paired_block = 1
[]
[create_outlet]
type = SideSetsBetweenSubdomainsGenerator
input = create_sides
new_boundary = outlet
primary_block = 2
paired_block = 3
[]
[]
[Problem]
linear_sys_names = 'u_sys'
[]
[Variables]
[u]
type = MooseLinearVariableFVReal
solver_sys = 'u_sys'
initial_condition = 1.0
block = 2
[]
[]
[FVInterpolationMethods]
[average]
type = FVGeometricAverage
[]
[]
[LinearFVKernels]
[diffusion]
type = LinearFVDiffusion
variable = u
diffusion_coeff = diff_coeff_func
use_nonorthogonal_correction = false
[]
[advection]
type = LinearFVAdvection
variable = u
velocity = "0.5 0 0"
advected_interp_method_name = average
[]
[reaction]
type = LinearFVReaction
variable = u
coeff = coeff_func
[]
[source]
type = LinearFVSource
variable = u
source_density = source_func
[]
[]
[LinearFVBCs]
inactive = "outflow"
[dir]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = u
boundary = "sides outlet"
functor = analytic_solution
[]
[outflow]
type = LinearFVAdvectionDiffusionOutflowBC
variable = u
boundary = "right"
use_two_term_expansion = true
[]
[]
[Functions]
[diff_coeff_func]
type = ParsedFunction
expression = '1.0+0.5*x*y'
[]
[coeff_func]
type = ParsedFunction
expression = '1.0+1.0/(1+x*y)'
[]
[source_func]
type = ParsedFunction
expression = '-1.0*x*pi*sin((1/2)*x*pi)*cos(2*y*pi) - 0.25*y*pi*sin(2*y*pi)*cos((1/2)*x*pi) + (1.0 + 1.0/(x*y + 1))*(sin((1/2)*x*pi)*sin(2*y*pi) + 1.5) + (17/4)*pi^2*(0.5*x*y + 1.0)*sin((1/2)*x*pi)*sin(2*y*pi) + 0.25*pi*sin(2*y*pi)*cos((1/2)*x*pi)'
[]
[analytic_solution]
type = ParsedFunction
expression = 'sin((1/2)*x*pi)*sin(2*y*pi) + 1.5'
[]
[]
[Postprocessors]
[h]
type = AverageElementSize
execute_on = FINAL
block = 2
[]
[error]
type = ElementL2FunctorError
approximate = u
exact = analytic_solution
execute_on = FINAL
block = 2
[]
[]
[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_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Outputs]
[csv]
type = CSV
execute_on = FINAL
[]
[]
(test/tests/tag/tag-linearfv.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 1
nx = 3
[]
[]
[Problem]
linear_sys_names = 'u_sys v_sys'
extra_tag_matrices = 'mat_tag_u; mat_tag_v'
extra_tag_vectors = 'vec_tag_u; vec_tag_v'
[]
[Variables]
[u]
type = MooseLinearVariableFVReal
initial_condition = 1.0
solver_sys = u_sys
[]
[v]
type = MooseLinearVariableFVReal
initial_condition = 0.5
solver_sys = v_sys
[]
[]
[LinearFVKernels]
[diffusion]
type = LinearFVDiffusion
variable = u
diffusion_coeff = 2.0
[]
[reaction]
type = LinearFVReaction
variable = u
coeff = 3.0
matrix_tags = 'system mat_tag_u'
[]
[source]
type = LinearFVSource
variable = u
source_density = 60.0
vector_tags = 'rhs vec_tag_u'
[]
[diffusion_v]
type = LinearFVDiffusion
variable = v
diffusion_coeff = 1.0
[]
[reaction_v]
type = LinearFVReaction
variable = v
coeff = 1.5
matrix_tags = 'system mat_tag_v'
[]
[source_v]
type = LinearFVSource
variable = v
source_density = 20.0
vector_tags = 'rhs vec_tag_v'
[]
[]
[LinearFVBCs]
[left_u]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = u
boundary = left
functor = 1.0
[]
[right_u]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = u
boundary = right
functor = 3.0
[]
[left_v]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = v
boundary = left
functor = 1.0
[]
[right_v]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = v
boundary = right
functor = 3.0
[]
[]
[AuxVariables]
[soln_u_dof]
type = MooseLinearVariableFVReal
[]
[soln_u]
type = MooseLinearVariableFVReal
[]
[rhs_u_dof]
type = MooseLinearVariableFVReal
[]
[rhs_u]
type = MooseLinearVariableFVReal
[]
[vector_tag_u]
type = MooseLinearVariableFVReal
[]
[matrix_u_diag]
type = MooseLinearVariableFVReal
[]
[soln_v_dof]
type = MooseLinearVariableFVReal
[]
[soln_v]
type = MooseLinearVariableFVReal
[]
[rhs_v_dof]
type = MooseLinearVariableFVReal
[]
[rhs_v]
type = MooseLinearVariableFVReal
[]
[vector_tag_v]
type = MooseLinearVariableFVReal
[]
[matrix_v_diag]
type = MooseLinearVariableFVReal
[]
[]
[AuxKernels]
[soln_u_dof]
type = TagVectorDofValueAux
variable = soln_u_dof
v = u
vector_tag = 'solution'
[]
[soln_u]
type = TagVectorAux
variable = soln_u
v = u
vector_tag = 'solution'
[]
[rhs_u_dof]
type = TagVectorDofValueAux
variable = rhs_u_dof
v = u
vector_tag = 'rhs'
[]
[rhs_u]
type = TagVectorAux
variable = rhs_u
v = u
vector_tag = 'rhs'
[]
[extra_vector_u_dof]
type = TagVectorDofValueAux
variable = vector_tag_u
v = u
vector_tag = 'vec_tag_u'
[]
[extra_vector_u]
type = TagVectorAux
variable = vector_tag_u
v = u
vector_tag = 'vec_tag_u'
[]
[extra_matrix_u]
type = TagMatrixAux
variable = matrix_u_diag
v = u
matrix_tag = 'mat_tag_u'
[]
[soln_v_dof]
type = TagVectorDofValueAux
variable = soln_v_dof
v = v
vector_tag = 'solution'
[]
[soln_v]
type = TagVectorAux
variable = soln_v
v = v
vector_tag = 'solution'
[]
[rhs_v_dof]
type = TagVectorDofValueAux
variable = rhs_v_dof
v = v
vector_tag = 'rhs'
[]
[rhs_v]
type = TagVectorAux
variable = rhs_v
v = v
vector_tag = 'rhs'
[]
[extra_vector_v_dof]
type = TagVectorDofValueAux
variable = vector_tag_v
v = v
vector_tag = 'vec_tag_v'
[]
[extra_vector_v]
type = TagVectorAux
variable = vector_tag_v
v = v
vector_tag = 'vec_tag_v'
[]
[extra_matrix_v]
type = TagMatrixAux
variable = matrix_v_diag
v = v
matrix_tag = 'mat_tag_v'
[]
[]
[Executioner]
type = Steady
solve_type = 'LINEAR'
system_names = 'u_sys v_sys'
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Outputs]
exodus = true
execute_on = timestep_end
[]
(test/tests/linearfvkernels/reaction/reaction-1d.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 1
nx = 10
[]
[]
[Problem]
linear_sys_names = 'u_sys'
[]
[Variables]
[u]
type = MooseLinearVariableFVReal
solver_sys = 'u_sys'
initial_condition = 1.0
[]
[]
[LinearFVKernels]
[reaction]
type = LinearFVReaction
variable = u
coeff = coeff_func
[]
[source]
type = LinearFVSource
variable = u
source_density = source_func
[]
[]
[Functions]
[coeff_func]
type = ParsedFunction
expression = '1+sin(x)'
[]
[source_func]
type = ParsedFunction
expression = '(1+sin(x))*(1+cos(x))'
[]
[analytic_solution]
type = ParsedFunction
expression = '1+cos(x)'
[]
[]
[Postprocessors]
[l2error]
type = ElementL2FunctorError
approximate = u
exact = analytic_solution
execute_on = TIMESTEP_END
[]
[]
[Executioner]
type = Steady
system_names = u_sys
l_tol = 1e-10
[]
[Outputs]
[exodus]
type = Exodus
execute_on = TIMESTEP_END
[]
[]
(test/tests/outputs/debug/show_execution_linear_fv_elemental.i)
[Mesh]
[gen_mesh]
type = GeneratedMeshGenerator
dim = 1
xmin = 0
xmax = 10
nx = 50
[]
[left]
type = ParsedSubdomainMeshGenerator
input = 'gen_mesh'
combinatorial_geometry = 'x < 0.5'
block_id = '1'
[]
[]
[Problem]
linear_sys_names = 'u_sys'
[]
[Variables]
[u]
type = MooseLinearVariableFVReal
solver_sys = 'u_sys'
[]
[]
[LinearFVKernels]
[reaction_1]
type = LinearFVReaction
variable = u
coeff = 1.5
block = 0
[]
[reaction_2]
type = LinearFVReaction
variable = u
coeff = 2.5
block = 1
[]
[source_1]
type = LinearFVSource
variable = u
source_density = 3.5
block = 0
[]
[source_2]
type = LinearFVSource
variable = u
source_density = 4.5
block = 1
[]
[]
[Executioner]
type = Steady
system_names = u_sys
l_tol = 1e-10
[]
[Debug]
show_execution_order = 'NONLINEAR'
[]
(modules/navier_stokes/test/tests/finite_volume/two_phase/mixture_model/segregated/channel-drift-flux.i)
mu = 1.0
rho = 10.0
mu_d = 0.1
rho_d = 1.0
l = 2
# 'average' leads to slight oscillations, upwind may be preferred
# This method is selected for consistency with the original nonlinear input
advected_interp_method = 'average'
# TODO remove need for those
cp = 1
k = 1
cp_d = 1
k_d = 1
[Mesh]
[gen]
type = GeneratedMeshGenerator
dim = 2
xmin = 0
xmax = '${fparse l * 5}'
ymin = '${fparse -l / 2}'
ymax = '${fparse l / 2}'
nx = 10
ny = 4
[]
uniform_refine = 0
[]
[Problem]
linear_sys_names = 'u_system v_system pressure_system phi_system'
previous_nl_solution_required = true
[]
[Variables]
[vel_x]
type = MooseLinearVariableFVReal
solver_sys = u_system
initial_condition = 1
[]
[vel_y]
type = MooseLinearVariableFVReal
solver_sys = v_system
[]
[pressure]
type = MooseLinearVariableFVReal
solver_sys = pressure_system
[]
[phase_2]
type = MooseLinearVariableFVReal
solver_sys = phi_system
[]
[]
[FVInterpolationMethods]
[average]
type = FVGeometricAverage
[]
[upwind]
type = FVAdvectedUpwind
[]
[]
[LinearFVKernels]
[flow_p_diffusion]
type = LinearFVPressureCorrectionDiffusion
diffusion_tensor = Ainv
use_nonorthogonal_correction = false
variable = pressure
[]
[flow_HbyA_divergence]
type = LinearFVDivergence
face_flux = HbyA
force_boundary_execution = true
variable = pressure
[]
[flow_ins_momentum_flux_x]
type = LinearWCNSFVMomentumFlux
advected_interp_method_name = ${advected_interp_method}
momentum_component = x
mu = mu_mixture
rhie_chow_user_object = ins_rhie_chow_interpolator
u = vel_x
use_deviatoric_terms = false
use_nonorthogonal_correction = false
v = vel_y
variable = vel_x
[]
[flow_ins_momentum_flux_y]
type = LinearWCNSFVMomentumFlux
advected_interp_method_name = ${advected_interp_method}
momentum_component = y
mu = mu_mixture
rhie_chow_user_object = ins_rhie_chow_interpolator
u = vel_x
use_deviatoric_terms = false
use_nonorthogonal_correction = false
v = vel_y
variable = vel_y
[]
[mixture_drift_flux_x]
type = LinearWCNSFV2PMomentumDriftFlux
density_interp_method = average
fraction_dispersed = phase_2
momentum_component = x
rhie_chow_user_object = ins_rhie_chow_interpolator
rho_d = ${rho_d}
u_slip = vel_slip_x
v_slip = vel_slip_y
variable = vel_x
[]
[mixture_drift_flux_y]
type = LinearWCNSFV2PMomentumDriftFlux
density_interp_method = average
fraction_dispersed = phase_2
momentum_component = y
rhie_chow_user_object = ins_rhie_chow_interpolator
rho_d = ${rho_d}
u_slip = vel_slip_x
v_slip = vel_slip_y
variable = vel_y
[]
[flow_ins_momentum_pressure_x]
type = LinearFVMomentumPressure
momentum_component = x
pressure = pressure
variable = vel_x
[]
[flow_ins_momentum_pressure_y]
type = LinearFVMomentumPressure
momentum_component = y
pressure = pressure
variable = vel_y
[]
[flow_momentum_friction_0_x]
type = LinearFVMomentumFriction
Darcy_name = Darcy_coefficient_vec
momentum_component = x
mu = mu_mixture
variable = vel_x
[]
[flow_momentum_friction_0_y]
type = LinearFVMomentumFriction
Darcy_name = Darcy_coefficient_vec
momentum_component = y
mu = mu_mixture
variable = vel_y
[]
# Mixture phase equation
[mixture_ins_phase_2_advection]
type = LinearFVScalarAdvection
advected_interp_method_name = upwind
rhie_chow_user_object = ins_rhie_chow_interpolator
u_slip = vel_slip_x
v_slip = vel_slip_y
variable = phase_2
[]
[mixture_phase_interface_reaction]
type = LinearFVReaction
coeff = 0.1
variable = phase_2
[]
[mixture_phase_interface_source]
type = LinearFVSource
scaling_factor = 0.1
source_density = phase_1
variable = phase_2
[]
[]
[LinearFVBCs]
[vel_x_left]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
boundary = left
functor = 1
variable = vel_x
[]
[vel_y_left]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
boundary = left
functor = 0
variable = vel_y
[]
[pressure_extrapolation_inlet_left]
type = LinearFVExtrapolatedPressureBC
boundary = left
use_two_term_expansion = true
variable = pressure
[]
[vel_x_right]
type = LinearFVAdvectionDiffusionOutflowBC
boundary = right
use_two_term_expansion = true
variable = vel_x
[]
[vel_y_right]
type = LinearFVAdvectionDiffusionOutflowBC
boundary = right
use_two_term_expansion = true
variable = vel_y
[]
[pressure_right]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
boundary = right
functor = 0
variable = pressure
[]
[vel_x_bottom]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
boundary = bottom
functor = 0
variable = vel_x
[]
[vel_y_bottom]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
boundary = bottom
functor = 0
variable = vel_y
[]
[vel_x_top]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
boundary = top
functor = 0
variable = vel_x
[]
[vel_y_top]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
boundary = top
functor = 0
variable = vel_y
[]
[pressure_extrapolation_top_bottom]
type = LinearFVExtrapolatedPressureBC
boundary = 'top bottom'
use_two_term_expansion = true
variable = pressure
[]
[phase_2_left]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
boundary = left
functor = 0.1
variable = phase_2
[]
[phase_2_right]
type = LinearFVAdvectionDiffusionOutflowBC
boundary = right
use_two_term_expansion = true
variable = phase_2
[]
[]
[FunctorMaterials]
[flow_ins_speed_material]
type = ADVectorMagnitudeFunctorMaterial
execute_on = ALWAYS
outputs = none
vector_magnitude_name = speed
x_functor = vel_x
y_functor = vel_y
[]
[mixture_phase_1_fraction]
type = ParsedFunctorMaterial
execute_on = ALWAYS
expression = '1 - phase_2'
functor_names = phase_2
output_properties = phase_1
outputs = all
property_name = phase_1
[]
[mixture_mixture_material]
type = WCNSLinearFVMixtureFunctorMaterial
execute_on = ALWAYS
limit_phase_fraction = true
outputs = all
phase_1_fraction = phase_2
phase_1_names = '${rho_d} ${mu_d} ${cp_d} ${k_d}'
phase_2_names = '${rho} ${mu} ${cp} ${k}'
prop_names = 'rho_mixture mu_mixture cp_mixture k_mixture'
[]
[mixture_slip_x]
type = WCNSFV2PSlipVelocityFunctorMaterial
execute_on = ALWAYS
gravity = '0 0 0'
linear_coef_name = Darcy_coefficient
momentum_component = x
mu = mu_mixture
outputs = all
particle_diameter = 0.01
rho = ${rho}
rho_d = ${rho_d}
slip_velocity_name = vel_slip_x
u = vel_x
v = vel_y
[]
[mixture_slip_y]
type = WCNSFV2PSlipVelocityFunctorMaterial
execute_on = ALWAYS
gravity = '0 0 0'
linear_coef_name = Darcy_coefficient
momentum_component = y
mu = mu_mixture
outputs = all
particle_diameter = 0.01
rho = ${rho}
rho_d = ${rho_d}
slip_velocity_name = vel_slip_y
u = vel_x
v = vel_y
[]
[mixture_dispersed_drag]
type = NSFVDispersePhaseDragFunctorMaterial
drag_coef_name = Darcy_coefficient
execute_on = ALWAYS
mu = mu_mixture
outputs = all
particle_diameter = 0.01
rho = rho_mixture
u = vel_x
v = vel_y
[]
[]
[UserObjects]
[ins_rhie_chow_interpolator]
type = RhieChowMassFlux
p_diffusion_kernel = flow_p_diffusion
pressure = pressure
rho = rho_mixture
u = vel_x
v = vel_y
[]
[]
[Executioner]
type = SIMPLE
rhie_chow_user_object = 'ins_rhie_chow_interpolator'
# Systems
momentum_systems = 'u_system v_system'
pressure_system = 'pressure_system'
active_scalar_systems = 'phi_system'
momentum_equation_relaxation = 0.8
active_scalar_equation_relaxation = '0.7'
pressure_variable_relaxation = 0.3
# We need to converge the problem to show conservation
num_iterations = 200
pressure_absolute_tolerance = 1e-10
momentum_absolute_tolerance = 1e-10
active_scalar_absolute_tolerance = '1e-10'
momentum_petsc_options_iname = '-pc_type -pc_hypre_type'
momentum_petsc_options_value = 'hypre boomeramg'
pressure_petsc_options_iname = '-pc_type -pc_hypre_type'
pressure_petsc_options_value = 'hypre boomeramg'
active_scalar_petsc_options_iname = '-pc_type -pc_hypre_type'
active_scalar_petsc_options_value = 'hypre boomeramg'
momentum_l_abs_tol = 1e-13
pressure_l_abs_tol = 1e-13
active_scalar_l_abs_tol = 1e-13
momentum_l_tol = 0
pressure_l_tol = 0
active_scalar_l_tol = 0
# print_fields = true
continue_on_max_its = true
[]
[Outputs]
csv = true
[]
[Postprocessors]
[Re]
type = ParsedPostprocessor
expression = '10.0 * 2 * 1'
[]
[average_phase2]
type = ElementAverageValue
variable = phase_2
[]
[dp]
type = PressureDrop
boundary = 'left right'
downstream_boundary = right
pressure = pressure
upstream_boundary = left
[]
[max_phase2]
type = ElementExtremeValue
variable = phase_2
[]
[]
(test/tests/linearfvkernels/diffusion-reaction-advection/advection-diffusion-reaction-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]
[average]
type = FVGeometricAverage
[]
[]
[LinearFVKernels]
[diffusion]
type = LinearFVDiffusion
variable = u
diffusion_coeff = diff_coeff_func
use_nonorthogonal_correction = false
[]
[advection]
type = LinearFVAdvection
variable = u
velocity = "0.5 0 0"
advected_interp_method_name = average
[]
[reaction]
type = LinearFVReaction
variable = u
coeff = coeff_func
[]
[source]
type = LinearFVSource
variable = u
source_density = source_func
[]
[]
[LinearFVBCs]
inactive = "outflow neumann"
[dir]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = u
boundary = "left right top bottom"
functor = analytic_solution
[]
[outflow]
type = LinearFVAdvectionDiffusionOutflowBC
variable = u
boundary = "right"
use_two_term_expansion = true
[]
[neumann]
type = LinearFVAdvectionDiffusionFunctorNeumannBC
variable = u
boundary = "top"
functor = analytic_solution_neumann_top
diffusion_coeff = diff_coeff_func
[]
[]
[Functions]
[diff_coeff_func]
type = ParsedFunction
expression = '1.0+0.5*x*y'
[]
[coeff_func]
type = ParsedFunction
expression = '1.0+1.0/(1+x*y)'
[]
[source_func]
type = ParsedFunction
expression = '-1.0*x*pi*sin((1/2)*x*pi)*cos(2*y*pi) - 0.25*y*pi*sin(2*y*pi)*cos((1/2)*x*pi) + (1.0 + 1.0/(x*y + 1))*(sin((1/2)*x*pi)*sin(2*y*pi) + 1.5) + (17/4)*pi^2*(0.5*x*y + 1.0)*sin((1/2)*x*pi)*sin(2*y*pi) + 0.25*pi*sin(2*y*pi)*cos((1/2)*x*pi)'
[]
[analytic_solution]
type = ParsedFunction
expression = 'sin((1/2)*x*pi)*sin(2*y*pi) + 1.5'
[]
[analytic_solution_neumann_top]
type = ParsedFunction
expression = '(1.0+0.5*x*y)*sin((1/2)*x*pi)*cos(2*y*pi)*2*pi'
[]
[]
[Postprocessors]
[h]
type = AverageElementSize
execute_on = FINAL
[]
[error]
type = ElementL2FunctorError
approximate = u
exact = analytic_solution
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_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Outputs]
[csv]
type = CSV
execute_on = FINAL
[]
[]
(modules/navier_stokes/examples/solidification/gallium_melting_linear.i)
##########################################################
# Simulation of Gallium Melting Experiment
# Ref: Gau, C., & Viskanta, R. (1986). Melting and solidification of a pure metal on a vertical wall.
# Key physics: melting/solidification, convective heat transfer, natural convection
##########################################################
mu = 1.81e-3
rho_solid = 6093
rho_liquid = 6093
k_solid = 32
k_liquid = 32
cp_solid = 381.5
cp_liquid = 381.5
L = 80160
alpha_b = 1.2e-4
T_solidus = 302.93
T_liquidus = '${fparse T_solidus + 0.1}'
T_cold = 301.15
T_hot = 311.15
Nx = 200
Ny = 120
[Mesh]
[gen]
type = GeneratedMeshGenerator
dim = 2
xmin = 0
xmax = 88.9e-3
ymin = 0
ymax = 63.5e-3
nx = ${Nx}
ny = ${Ny}
bias_x = 1.005
[]
[]
[UserObjects]
[rc]
type = RhieChowMassFlux
u = vel_x
v = vel_y
pressure = pressure
rho = ${rho_liquid}
p_diffusion_kernel = p_diffusion
[]
[]
[Problem]
linear_sys_names = 'u_system v_system pressure_system energy_system'
previous_nl_solution_required = true
[]
[AuxVariables]
[U]
type = MooseVariableFVReal
[]
[fl]
type = MooseVariableFVReal
initial_condition = 0.0
[]
[density]
type = MooseVariableFVReal
[]
[th_cond]
type = MooseVariableFVReal
[]
[cp_var]
type = MooseVariableFVReal
[]
[darcy_coef]
type = MooseVariableFVReal
[]
[fch_coef]
type = MooseVariableFVReal
[]
[]
[AuxKernels]
[mag]
type = VectorMagnitudeAux
variable = U
x = vel_x
y = vel_y
[]
[compute_fl]
type = NSLiquidFractionAux
variable = fl
temperature = T
T_liquidus = '${T_liquidus}'
T_solidus = '${T_solidus}'
execute_on = 'TIMESTEP_END'
[]
[rho_out]
type = FunctorAux
functor = 'rho_mixture'
variable = 'density'
[]
[th_cond_out]
type = FunctorAux
functor = 'k_mixture'
variable = 'th_cond'
[]
[cp_out]
type = FunctorAux
functor = 'cp_mixture'
variable = 'cp_var'
[]
[darcy_out]
type = FunctorAux
functor = 'Darcy_coefficient'
variable = 'darcy_coef'
[]
[fch_out]
type = FunctorAux
functor = 'Forchheimer_coefficient'
variable = 'fch_coef'
[]
[]
[Variables]
[vel_x]
type = MooseLinearVariableFVReal
initial_condition = 0.0
solver_sys = u_system
[]
[vel_y]
type = MooseLinearVariableFVReal
solver_sys = v_system
initial_condition = 0.0
[]
[pressure]
type = MooseLinearVariableFVReal
solver_sys = pressure_system
initial_condition = 0.2
[]
[T]
type = MooseLinearVariableFVReal
solver_sys = energy_system
initial_condition = ${T_cold}
[]
[]
[FVInterpolationMethods]
[upwind]
type = FVAdvectedUpwind
[]
[]
[LinearFVKernels]
[u_time]
type = LinearFVTimeDerivative
variable = vel_x
factor = 'rho_mixture'
[]
[v_time]
type = LinearFVTimeDerivative
variable = vel_y
factor = 'rho_mixture'
[]
[u_advection_stress]
type = LinearWCNSFVMomentumFlux
variable = vel_x
mu = ${mu}
u = vel_x
v = vel_y
momentum_component = 'x'
rhie_chow_user_object = 'rc'
use_nonorthogonal_correction = false
advected_interp_method_name = upwind
[]
[v_advection_stress]
type = LinearWCNSFVMomentumFlux
variable = vel_y
mu = ${mu}
u = vel_x
v = vel_y
momentum_component = 'y'
rhie_chow_user_object = 'rc'
use_nonorthogonal_correction = false
advected_interp_method_name = upwind
[]
[u_pressure]
type = LinearFVMomentumPressure
variable = vel_x
pressure = pressure
momentum_component = 'x'
[]
[v_pressure]
type = LinearFVMomentumPressure
variable = vel_y
pressure = pressure
momentum_component = 'y'
[]
[u_boussinesq]
type = LinearFVMomentumBoussinesq
variable = vel_x
rho = '${rho_liquid}'
gravity = '0 -9.81 0'
alpha_name = ${alpha_b}
ref_temperature = ${T_solidus}
T_fluid = T
momentum_component = 'x'
[]
[v_boussinesq]
type = LinearFVMomentumBoussinesq
variable = vel_y
rho = '${rho_liquid}'
gravity = '0 -9.81 0'
alpha_name = ${alpha_b}
ref_temperature = ${T_solidus}
T_fluid = T
momentum_component = 'y'
[]
[u_friction_darcy]
type = LinearFVReaction
variable = vel_x
coeff = 'darcy_coef_friction'
[]
[v_friction_darcy]
type = LinearFVReaction
variable = vel_y
coeff = 'darcy_coef_friction'
[]
[u_friction_forch]
type = LinearFVReaction
variable = vel_x
coeff = 'forch_coef_friction'
[]
[v_friction_forch]
type = LinearFVReaction
variable = vel_y
coeff = 'forch_coef_friction'
[]
[p_diffusion]
type = LinearFVPressureCorrectionDiffusion
variable = pressure
diffusion_tensor = Ainv
use_nonorthogonal_correction = false
[]
[HbyA_divergence]
type = LinearFVDivergence
variable = pressure
face_flux = HbyA
force_boundary_execution = true
[]
[h_time]
type = LinearFVTimeDerivative
variable = T
# factor should be mixture. For simplicity and
# because the properties are the same for liquid and solid
# the factor is defined as below.
factor = ${fparse rho_liquid*cp_liquid}
[]
[h_advection]
type = LinearFVEnergyAdvection
variable = T
advected_quantity = temperature
cp = ${cp_liquid}
rhie_chow_user_object = 'rc'
[]
[conduction]
type = LinearFVDiffusion
variable = T
diffusion_coeff = k_mixture
use_nonorthogonal_correction = false
[]
[energy_source]
type = LinearFVPhaseChangeSource
variable = T
L = ${L}
T_liquidus = ${T_liquidus}
T_solidus = ${T_solidus}
rho = 'rho_mixture'
[]
[]
[LinearFVBCs]
[walls-u]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
boundary = 'left right top bottom'
variable = vel_x
functor = 0.0
[]
[walls-v]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
boundary = 'left right top bottom'
variable = vel_y
functor = 0.0
[]
[hot_wall]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = T
functor = '${T_hot}'
boundary = 'left'
[]
[cold_wall]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = T
functor = '${T_cold}'
boundary = 'right'
[]
[]
[FunctorMaterials]
[eff_cp]
type = NSFVMixtureFunctorMaterial
phase_2_names = '${cp_solid} ${k_solid} ${rho_solid}'
phase_1_names = '${cp_liquid} ${k_liquid} ${rho_liquid}'
prop_names = 'cp_mixture k_mixture rho_mixture'
phase_1_fraction = fl
[]
[mushy_zone_resistance]
type = INSFVMushyPorousFrictionFunctorMaterial
liquid_fraction = 'fl'
mu = '${mu}'
rho_l = '${rho_liquid}'
dendrite_spacing_scaling = 1e-3
[]
[darcy_coeff_friction]
type = ParsedFunctorMaterial
property_name = 'darcy_coef_friction'
functor_names = 'darcy_coef'
functor_symbols = 'darcy_coef'
expression = 'darcy_coef'
[]
[forch_coeff_friction]
type = ParsedFunctorMaterial
property_name = 'forch_coef_friction'
functor_names = 'U fch_coef'
functor_symbols = 'U fch_coef'
expression = 'fch_coef * U'
[]
[]
[Executioner]
type = PIMPLE
momentum_l_abs_tol = 1e-12
pressure_l_abs_tol = 1e-12
energy_l_abs_tol = 1e-12
momentum_l_tol = 1e-12
pressure_l_tol = 1e-12
energy_l_tol = 1e-12
rhie_chow_user_object = 'rc'
momentum_systems = 'u_system v_system'
pressure_system = 'pressure_system'
energy_system = 'energy_system'
momentum_equation_relaxation = 0.7
pressure_variable_relaxation = 0.3
energy_equation_relaxation = 0.9
num_iterations = 8
pressure_absolute_tolerance = 1e-11
momentum_absolute_tolerance = 1e-11
energy_absolute_tolerance = 1e-11
momentum_petsc_options_iname = '-pc_type -pc_hypre_type'
momentum_petsc_options_value = 'hypre boomeramg'
pressure_petsc_options_iname = '-pc_type -pc_hypre_type'
pressure_petsc_options_value = 'hypre boomeramg'
energy_petsc_options_iname = '-pc_type -pc_hypre_type'
energy_petsc_options_value = 'hypre boomeramg'
print_fields = false
continue_on_max_its = true
dt = 0.005
start_time = 0.0
end_time = 60.0
num_piso_iterations = 0
pin_pressure = true
pressure_pin_value = 0.0
pressure_pin_point = '0.05 0.05 0.0'
[]
[Postprocessors]
[ave_p]
type = ElementAverageValue
variable = 'pressure'
execute_on = 'INITIAL TIMESTEP_END'
[]
[ave_fl]
type = ElementAverageValue
variable = 'fl'
execute_on = 'INITIAL TIMESTEP_END'
[]
[ave_T]
type = ElementAverageValue
variable = 'T'
execute_on = 'INITIAL TIMESTEP_END'
[]
[]
[Outputs]
[out_avg]
type = Exodus
time_step_interval = 2000
[]
csv = false
[]
(test/tests/linearfvkernels/diffusion-reaction-advection/advection-diffusion-reaction-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]
[average]
type = FVGeometricAverage
[]
[]
[LinearFVKernels]
[diffusion]
type = LinearFVDiffusion
variable = u
diffusion_coeff = diff_coeff_func
use_nonorthogonal_correction = false
[]
[advection]
type = LinearFVAdvection
variable = u
velocity = "0.5 0 0"
advected_interp_method_name = average
[]
[reaction]
type = LinearFVReaction
variable = u
coeff = coeff_func
[]
[source]
type = LinearFVSource
variable = u
source_density = source_func
[]
[]
[LinearFVBCs]
inactive = "outflow neumann"
[dir]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = u
boundary = "left right"
functor = analytic_solution
[]
[outflow]
type = LinearFVAdvectionDiffusionOutflowBC
variable = u
boundary = "right"
use_two_term_expansion = true
[]
[neumann]
type = LinearFVAdvectionDiffusionFunctorNeumannBC
variable = u
boundary = "left"
functor = analytic_solution_neumann_left
diffusion_coeff = diff_coeff_func
[]
[]
[Functions]
[diff_coeff_func]
type = ParsedFunction
expression = '1+0.5*x'
[]
[coeff_func]
type = ParsedFunction
expression = '1+1/(1+x)'
[]
[source_func]
type = ParsedFunction
expression = '(1+1/(x+1))*(sin(pi/2*x)+1.5)+0.25*pi*pi*(0.5*x+1)*sin(pi/2*x)'
[]
[analytic_solution]
type = ParsedFunction
expression = 'sin(pi/2*x)+1.5'
[]
[analytic_solution_neumann_left]
type = ParsedFunction
expression = '-(1+0.5*x)*cos(pi/2*x)*pi/2'
[]
[]
[Postprocessors]
[h]
type = AverageElementSize
execute_on = FINAL
[]
[error]
type = ElementL2FunctorError
approximate = u
exact = analytic_solution
execute_on = FINAL
[]
[]
[Convergence]
[linear]
type = IterationCountConvergence
max_iterations = 1
converge_at_max_iterations = true
[]
[]
[Executioner]
type = Steady
system_names = u_sys
multi_system_fixed_point=true
multi_system_fixed_point_convergence=linear
petsc_options_iname = '-pc_type -pc_hypre_type -ksp_rtol'
petsc_options_value = 'hypre boomeramg 1e-10'
[]
[Outputs]
[csv]
type = CSV
execute_on = FINAL
[]
[]
(modules/navier_stokes/test/tests/finite_volume/pins/mms/linear-segregated/hydrostatic-jump/hydrostatic-jump.i)
# Fluid at rest under gravity in a closed box split by a pressure baffle across which porosity
# jumps. The interface x - skew * y = interface is a mesh line.
# The superficial momentum balance at rest is 0 = -eps grad(p) + eps rho g, so
# U = 0 and grad(p) = rho g on both sides,
# independent of porosity. With density rho = rho_0 + strat * z linear in the height
# z = -g . x / |g|, the exact pressure is
# p = -|g| (rho_0 z + strat z^2 / 2) + const.
# The body force is the porosity-weighted buoyancy eps rho g, applied either by
# LinearFVMomentumBuoyancy or, with LinearFVKernels/inactive = 'u_buoyancy v_buoyancy', by
# LinearFVMomentumBoussinesq with a temperature chosen so that -alpha rho_ref (T - T_ref) = rho.
rho_0 = 1
strat = -0.1
eps_left = 1
eps_right = 1
mu = 0.01
reaction = 1
gx = 0
gy = -9.81
interface = 0.5
skew = 0
nx = 8
ny = 8
nonorthogonal = false
alpha = 1e-3
T_ref = 300
pressure_gradient_method = reconstructed
[Problem]
linear_sys_names = 'u_system v_system pressure_system'
previous_nl_solution_required = true
[]
[Mesh]
[generated]
type = GeneratedMeshGenerator
dim = 2
nx = ${nx}
ny = ${ny}
[]
[right]
type = ParsedSubdomainMeshGenerator
input = generated
combinatorial_geometry = 'x > ${interface}'
block_id = 2
block_name = right
[]
[left]
type = ParsedSubdomainMeshGenerator
input = right
combinatorial_geometry = 'x < ${interface}'
block_id = 1
block_name = left
[]
[skew]
type = ParsedNodeTransformGenerator
input = left
x_function = 'x + ${skew} * y'
[]
[baffle]
type = SideSetsBetweenSubdomainsGenerator
input = skew
primary_block = left
paired_block = right
new_boundary = baffle
[]
[]
[FVGradientMethods]
[jump_aware]
type = FVPressureJumpGreenGaussGradient
[]
[velocity_jump_aware]
type = FVVelocityJumpGreenGaussGradient
[]
[reconstructed]
type = FVReconstructedPressureGradient
base_gradient_method = jump_aware
gradient_relaxation = 1
[]
[]
[FVInterpolationMethods]
[average]
type = FVGeometricAverage
[]
[]
[UserObjects]
[pressure_jump]
type = BernoulliFormLossPressureJump
boundary = baffle
porosity = porosity
density = density
[]
[rc]
type = PorousRhieChowMassFlux
u = superficial_u
v = superficial_v
pressure = pressure
rho = density
porosity = porosity
p_diffusion_kernel = p_diffusion
pressure_jump_models = pressure_jump
pressure_projection_method = consistent
# The body force enters H/A through face averages, so the 1/A diffusion must be averaged the
# same way for the hydrostatic balance to hold on the face when the viscous A varies.
pressure_diffusion_interpolation = average
[]
[]
[Variables]
[superficial_u]
type = MooseLinearVariableFVReal
solver_sys = u_system
initial_condition = 0
gradient_method = velocity_jump_aware
[]
[superficial_v]
type = MooseLinearVariableFVReal
solver_sys = v_system
initial_condition = 0
gradient_method = velocity_jump_aware
[]
[pressure]
type = MooseLinearVariableFVReal
solver_sys = pressure_system
initial_condition = 0
gradient_method = jump_aware
[]
[]
[LinearFVKernels]
inactive = 'u_boussinesq v_boussinesq'
[u_advection]
type = LinearPWCNSFVMomentumFlux
variable = superficial_u
advected_interp_method_name = average
mu = ${mu}
u = superficial_u
v = superficial_v
momentum_component = x
rhie_chow_user_object = rc
use_nonorthogonal_correction = ${nonorthogonal}
[]
[v_advection]
type = LinearPWCNSFVMomentumFlux
variable = superficial_v
advected_interp_method_name = average
mu = ${mu}
u = superficial_u
v = superficial_v
momentum_component = y
rhie_chow_user_object = rc
use_nonorthogonal_correction = ${nonorthogonal}
[]
[u_pressure]
type = LinearPWCNSFVMomentumPressure
variable = superficial_u
pressure = pressure
porosity = porosity
momentum_component = x
gradient_method = ${pressure_gradient_method}
[]
[v_pressure]
type = LinearPWCNSFVMomentumPressure
variable = superficial_v
pressure = pressure
porosity = porosity
momentum_component = y
gradient_method = ${pressure_gradient_method}
[]
[u_buoyancy]
type = LinearFVMomentumBuoyancy
variable = superficial_u
rho = density
porosity = porosity
reference_rho = 0
gravity = '${gx} ${gy} 0'
momentum_component = x
[]
[v_buoyancy]
type = LinearFVMomentumBuoyancy
variable = superficial_v
rho = density
porosity = porosity
reference_rho = 0
gravity = '${gx} ${gy} 0'
momentum_component = y
[]
[u_boussinesq]
type = LinearFVMomentumBoussinesq
variable = superficial_u
T_fluid = T_fluid
rho = 1
alpha_name = ${alpha}
ref_temperature = ${T_ref}
porosity = porosity
gravity = '${gx} ${gy} 0'
momentum_component = x
[]
[v_boussinesq]
type = LinearFVMomentumBoussinesq
variable = superficial_v
T_fluid = T_fluid
rho = 1
alpha_name = ${alpha}
ref_temperature = ${T_ref}
porosity = porosity
gravity = '${gx} ${gy} 0'
momentum_component = y
[]
[u_reaction]
type = LinearFVReaction
variable = superficial_u
coeff = ${reaction}
[]
[v_reaction]
type = LinearFVReaction
variable = superficial_v
coeff = ${reaction}
[]
[p_diffusion]
type = LinearFVPressureCorrectionDiffusionJump
variable = pressure
rhie_chow_user_object = rc
use_nonorthogonal_correction = ${nonorthogonal}
[]
[HbyA_divergence]
type = LinearFVDivergence
variable = pressure
face_flux = HbyA
force_boundary_execution = true
[]
[]
[LinearFVBCs]
[velocity_x]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
boundary = 'left right top bottom'
variable = superficial_u
functor = 0
[]
[velocity_y]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
boundary = 'left right top bottom'
variable = superficial_v
functor = 0
[]
[pressure_flux]
type = LinearFVPressureFluxBC
boundary = 'left right top bottom'
variable = pressure
HbyA_flux = HbyA
Ainv = Ainv
rho = density
u = superficial_u
v = superficial_v
[]
[]
[FunctorMaterials]
[density]
type = ParsedFunctorMaterial
property_name = density
functor_names = 'exact_density'
expression = 'exact_density'
[]
[porosity]
type = ParsedFunctorMaterial
property_name = porosity
expression = 'if(x-${skew}*y<${interface},${eps_left},${eps_right})'
[]
[pressure_error]
type = ParsedFunctorMaterial
property_name = pressure_error
functor_names = 'pressure exact_pressure'
expression = 'pressure-exact_pressure'
[]
[speed]
type = ParsedFunctorMaterial
property_name = speed
functor_names = 'superficial_u superficial_v'
expression = 'sqrt(superficial_u^2+superficial_v^2)'
[]
[]
[AuxVariables]
[T_fluid]
type = MooseLinearVariableFVReal
[]
[]
[AuxKernels]
[T_fluid]
type = FunctorAux
variable = T_fluid
functor = boussinesq_temperature
execute_on = INITIAL
[]
[]
[Functions]
[boussinesq_temperature]
type = ParsedFunction
expression = 'T_ref-rho/alpha'
symbol_names = 'T_ref rho alpha'
symbol_values = '${T_ref} exact_density ${alpha}'
[]
[height]
type = ParsedFunction
expression = '-(gx*x+gy*y)/sqrt(gx^2+gy^2)'
symbol_names = 'gx gy'
symbol_values = '${gx} ${gy}'
[]
[exact_density]
type = ParsedFunction
expression = 'rho_0+strat*hz'
symbol_names = 'rho_0 strat hz'
symbol_values = '${rho_0} ${strat} height'
[]
# Hydrostatic pressure with the pin at (0.3, 0.3), inside a cell on 2^n meshes, set to zero.
[exact_pressure]
type = ParsedFunction
expression = '-sqrt(gx^2+gy^2)*(rho_0*(hz-hp)+strat*(hz^2-hp^2)/2)'
symbol_names = 'gx gy rho_0 strat hz hp'
symbol_values = '${gx} ${gy} ${rho_0} ${strat} height '
'${fparse -(gx*(0.3+skew*0.3)+gy*0.3)/sqrt(gx^2+gy^2)}'
[]
[]
[Executioner]
type = SIMPLE
momentum_l_abs_tol = 1e-13
pressure_l_abs_tol = 1e-13
momentum_l_tol = 0
pressure_l_tol = 0
momentum_l_max_its = 100
pressure_l_max_its = 100
rhie_chow_user_object = rc
momentum_systems = 'u_system v_system'
pressure_system = pressure_system
momentum_equation_relaxation = 0.7
pressure_variable_relaxation = 0.5
# At rest the normalized momentum residual has no flow to scale against and stalls near 1e-4,
# so the absolute tolerances below are not reached. The solution is fixed well before 50
# iterations.
num_iterations = 50
continue_on_max_its = true
pressure_absolute_tolerance = 1e-12
momentum_absolute_tolerance = 1e-12
momentum_petsc_options_iname = '-pc_type -pc_hypre_type'
momentum_petsc_options_value = 'hypre boomeramg'
pressure_petsc_options_iname = '-pc_type -pc_hypre_type'
pressure_petsc_options_value = 'hypre boomeramg'
print_fields = false
pin_pressure = true
pressure_pin_value = 0
pressure_pin_point = '${fparse 0.3 + skew * 0.3} 0.3 0'
[]
[Postprocessors]
[max_speed]
type = ElementExtremeFunctorValue
functor = speed
value_type = max
execute_on = FINAL
[]
# The pin sits at a point, not a cell centroid, so the error is compared up to a constant.
[max_pressure_error]
type = ElementExtremeFunctorValue
functor = pressure_error
value_type = max
execute_on = FINAL
outputs = none
[]
[min_pressure_error]
type = ElementExtremeFunctorValue
functor = pressure_error
value_type = min
execute_on = FINAL
outputs = none
[]
[pressure_error_range]
type = ParsedPostprocessor
pp_names = 'max_pressure_error min_pressure_error'
expression = 'max_pressure_error-min_pressure_error'
execute_on = FINAL
[]
[]
[Outputs]
[csv]
type = CSV
execute_on = FINAL
[]
[]