Skip to content

Commit

Permalink
Add pwcnsfv mms test
Browse files Browse the repository at this point in the history
Currently cannot converge with any number over two elements
  • Loading branch information
lindsayad committed Jul 24, 2021
1 parent 5ccc307 commit 3b66934
Showing 1 changed file with 317 additions and 0 deletions.
@@ -0,0 +1,317 @@
mu=1e-15
rho='rho'
advected_interp_method='average'
velocity_interp_method='rc'
gamma=1.4
R=8.3145
molar_mass=29.0e-3
R_specific=${fparse R/molar_mass}
cp=${fparse gamma*R_specific/(gamma-1)}

[GlobalParams]
two_term_boundary_expansion = true
[]

[Mesh]
[cartesian]
type = GeneratedMeshGenerator
dim = 1
xmin = .1
xmax = .6
nx = 100
[]
[]

[Modules]
[FluidProperties]
[fp]
type = IdealGasFluidProperties
[]
[]
[]

[Problem]
fv_bcs_integrity_check = false
[]

[Variables]
[pressure]
type = INSFVPressureVariable
[]
[sup_vel_x]
type = PINSFVSuperficialVelocityVariable
[]
[T_fluid]
type = INSFVEnergyVariable
[]
[]

[AuxVariables]
[porosity]
type = MooseVariableFVReal
[]
[]

[ICs]
[pressure]
type = FunctionIC
variable = pressure
function = 'exact_p'
[]
[sup_vel_x]
type = FunctionIC
variable = sup_vel_x
function = 'exact_sup_vel_x'
[]
[T_fluid]
type = FunctionIC
variable = T_fluid
function = 'exact_T'
[]
[eps]
type = FunctionIC
variable = porosity
function = 'eps'
[]
[]

[FVKernels]
[mass_advection]
type = PINSFVMassAdvection
variable = pressure
advected_interp_method = ${advected_interp_method}
velocity_interp_method = ${velocity_interp_method}
vel = 'velocity'
pressure = pressure
u = sup_vel_x
mu = ${mu}
rho = ${rho}
porosity = porosity
[]
[mass_fn]
type = FVBodyForce
variable = pressure
function = 'forcing_rho'
[]

[u_advection]
type = PINSFVMomentumAdvection
variable = sup_vel_x
advected_quantity = 'rhou'
vel = 'velocity'
advected_interp_method = ${advected_interp_method}
velocity_interp_method = ${velocity_interp_method}
pressure = pressure
u = sup_vel_x
mu = ${mu}
rho = ${rho}
porosity = porosity
[]
[u_pressure]
type = PINSFVMomentumPressureFlux
variable = sup_vel_x
pressure = pressure
porosity = porosity
momentum_component = 'x'
[]
[momentum_fn]
type = FVBodyForce
variable = sup_vel_x
function = 'forcing_rho_ud'
[]

[temp_advection]
type = PINSFVEnergyAdvection
variable = T_fluid
vel = 'velocity'
velocity_interp_method = ${velocity_interp_method}
advected_interp_method = ${advected_interp_method}
pressure = pressure
u = sup_vel_x
mu = ${mu}
rho = ${rho}
porosity = porosity
[]
[energy_fn]
type = FVBodyForce
variable = T_fluid
function = 'forcing_rho_et'
[]
[]

[FVBCs]
[mass]
variable = pressure
type = PWCNSFVStrongBC
boundary = 'left right'
T_fluid = T_fluid
superficial_vel_x = sup_vel_x
pressure = pressure
eqn = 'mass'
porosity = porosity
[]
[momentum]
variable = sup_vel_x
type = PWCNSFVStrongBC
boundary = 'left right'
T_fluid = T_fluid
superficial_vel_x = sup_vel_x
pressure = pressure
eqn = 'momentum'
momentum_component = 'x'
porosity = porosity
[]
[energy]
variable = T_fluid
type = PWCNSFVStrongBC
boundary = 'left right'
T_fluid = T_fluid
superficial_vel_x = sup_vel_x
pressure = pressure
eqn = 'energy'
porosity = porosity
[]

# help gradient reconstruction *and* create Dirichlet values for use in PWCNSFVStrongBC
[pressure_right]
type = FVFunctionDirichletBC
variable = pressure
function = exact_p
boundary = 'right'
[]
[sup_vel_x_left]
type = FVFunctionDirichletBC
variable = sup_vel_x
function = exact_sup_vel_x
boundary = 'left'
[]
[T_fluid_left]
type = FVFunctionDirichletBC
variable = T_fluid
function = exact_T
boundary = 'left'
[]
[]

[Materials]
[const_functor]
type = ADGenericConstantFunctorMaterial
prop_names = 'cp'
prop_values = '${cp}'
[]
[rho]
type = RhoFromPTFunctorMaterial
fp = fp
temperature = T_fluid
pressure = pressure
[]
[ins_fv]
type = INSFVMaterial
u = sup_vel_x
pressure = pressure
temperature = T_fluid
rho = ${rho}
[]
[]

[Functions]
[exact_rho]
type = ParsedFunction
value = '3.48788261470924*cos(x)'
[]
[forcing_rho]
type = ParsedFunction
value = '-3.45300378856215*sin(1.1*x)'
[]
[exact_rho_ud]
type = ParsedFunction
value = '3.13909435323832*cos(1.1*x)'
[]
[forcing_rho_ud]
type = ParsedFunction
value = '-0.9*(10.6975765229419*cos(1.2*x)/cos(x) - 0.697576522941849*cos(1.1*x)^2/cos(x)^2)*sin(x) + 0.9*(10.6975765229419*sin(x)*cos(1.2*x)/cos(x)^2 - 1.3951530458837*sin(x)*cos(1.1*x)^2/cos(x)^3 + 1.53466835047207*sin(1.1*x)*cos(1.1*x)/cos(x)^2 - 12.8370918275302*sin(1.2*x)/cos(x))*cos(x) + 3.13909435323832*sin(x)*cos(1.1*x)^2/cos(x)^2 - 6.9060075771243*sin(1.1*x)*cos(1.1*x)/cos(x)'
[]
[exact_rho_et]
type = ParsedFunction
value = '26.7439413073546*cos(1.2*x)'
[]
[forcing_rho_et]
type = ParsedFunction
value = '0.9*(3.48788261470924*(3.06706896551724*cos(1.2*x)/cos(x) - 0.2*cos(1.1*x)^2/cos(x)^2)*cos(x) + 26.7439413073546*cos(1.2*x))*sin(x)*cos(1.1*x)/cos(x)^2 - 0.99*(3.48788261470924*(3.06706896551724*cos(1.2*x)/cos(x) - 0.2*cos(1.1*x)^2/cos(x)^2)*cos(x) + 26.7439413073546*cos(1.2*x))*sin(1.1*x)/cos(x) + 0.9*(-(10.6975765229419*cos(1.2*x)/cos(x) - 0.697576522941849*cos(1.1*x)^2/cos(x)^2)*sin(x) + (10.6975765229419*sin(x)*cos(1.2*x)/cos(x)^2 - 1.3951530458837*sin(x)*cos(1.1*x)^2/cos(x)^3 + 1.53466835047207*sin(1.1*x)*cos(1.1*x)/cos(x)^2 - 12.8370918275302*sin(1.2*x)/cos(x))*cos(x) - 32.0927295688256*sin(1.2*x))*cos(1.1*x)/cos(x)'
[]
[exact_T]
type = ParsedFunction
value = '0.0106975765229418*cos(1.2*x)/cos(x) - 0.000697576522941848*cos(1.1*x)^2/cos(x)^2'
[]
[exact_eps_p]
type = ParsedFunction
value = '3.13909435323832*(3.06706896551724*cos(1.2*x)/cos(x) - 0.2*cos(1.1*x)^2/cos(x)^2)*cos(x)'
[]
[exact_p]
type = ParsedFunction
value = '3.48788261470924*(3.06706896551724*cos(1.2*x)/cos(x) - 0.2*cos(1.1*x)^2/cos(x)^2)*cos(x)'
[]
[exact_sup_vel_x]
type = ParsedFunction
value = '0.9*cos(1.1*x)/cos(x)'
[]
[exact_superficial_velocity]
type = ParsedVectorFunction
value_x = '0.9*cos(1.1*x)/cos(x)'
[]
[eps]
type = ParsedFunction
value = '0.9'
[]
[]

[Executioner]
solve_type = NEWTON
type = Transient
num_steps = 1
dtmin = 1
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
nl_max_its = 50
line_search = bt
nl_rel_tol = 1e-12
nl_abs_tol = 1e-12
[]

[Outputs]
exodus = true
csv = true
[]

[Debug]
show_var_residual_norms = true
[]

[Postprocessors]
[h]
type = AverageElementSize
outputs = 'console csv'
execute_on = 'timestep_end'
[]
[L2pressure]
type = ElementL2Error
variable = pressure
function = exact_p
outputs = 'console csv'
execute_on = 'timestep_end'
[]
[L2sup_vel_x]
variable = sup_vel_x
function = exact_sup_vel_x
type = ElementL2Error
outputs = 'console csv'
execute_on = 'timestep_end'
[]
[L2T_fluid]
variable = T_fluid
function = exact_T
type = ElementL2Error
outputs = 'console csv'
execute_on = 'timestep_end'
[]
[]

0 comments on commit 3b66934

Please sign in to comment.