Skip to content

Commit

Permalink
Remove libmeshlinearimplicitsystem shortcut from BCs.
Browse files Browse the repository at this point in the history
  • Loading branch information
grmnptr committed Dec 17, 2024
1 parent bd0ad90 commit dd1f014
Show file tree
Hide file tree
Showing 3 changed files with 305 additions and 4 deletions.
3 changes: 0 additions & 3 deletions framework/include/linearfvbcs/LinearFVBoundaryCondition.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@ class LinearFVBoundaryCondition : public MooseObject,
/// Reference to system base class in MOOSE
SystemBase & _sys;

/// Reference to the libmesh linear system this object contributes to
libMesh::LinearImplicitSystem & _linear_system;

/// Pointer to the face info we are operating on right now
const FaceInfo * _current_face_info;

Expand Down
1 change: 0 additions & 1 deletion framework/src/linearfvbcs/LinearFVBoundaryCondition.C
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ LinearFVBoundaryCondition::LinearFVBoundaryCondition(const InputParameters & par
_fv_problem(*getCheckedPointerParam<FVProblemBase *>("_fe_problem_base")),
_var(*mooseLinearVariableFV()),
_sys(_var.sys()),
_linear_system(libMesh::cast_ref<libMesh::LinearImplicitSystem &>(_sys.system())),
_var_num(_var.number()),
_sys_num(_sys.number())
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,305 @@
L = 30
bulk_u = 0.01
p_ref = 101325.0

advected_interp_method = 'upwind'

[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 1
xmin = 0
xmax = ${L}
nx = 400
[]
[]

[GlobalParams]
rhie_chow_user_object = 'rc'
advected_interp_method = ${advected_interp_method}
u = vel_x
[]

[Problem]
linear_sys_names = 'u_system pressure_system energy_system'
previous_nl_solution_required = true
[]

[UserObjects]
[rc]
type = RhieChowMassFlux
u = vel_x
pressure = pressure
rho = 'rho'
p_diffusion_kernel = p_diffusion
[]
[]

[Variables]
[vel_x]
type = MooseLinearVariableFVReal
solver_sys = u_system
initial_condition = ${bulk_u}
[]
[pressure]
type = MooseLinearVariableFVReal
solver_sys = pressure_system
initial_condition = ${p_ref}
[]
[h]
type = MooseLinearVariableFVReal
solver_sys = energy_system
initial_condition = ${fparse 860.*1900.}
[]
[]

[AuxVariables]
[rho_var]
type = MooseLinearVariableFVReal
[]
[cp_var]
type = MooseLinearVariableFVReal
[]
[mu_var]
type = MooseLinearVariableFVReal
[]
[k_var]
type = MooseLinearVariableFVReal
[]
[alpha_var]
type = MooseLinearVariableFVReal
[]
[T]
type = MooseLinearVariableFVReal
initial_condition = 860.
[]
[h_aux]
type = MooseLinearVariableFVReal
[]
[]

[LinearFVKernels]

[u_advection_stress]
type = LinearWCNSFVMomentumFlux
variable = vel_x
mu = 'mu'
momentum_component = 'x'
use_nonorthogonal_correction = false
[]
[u_pressure]
type = LinearFVMomentumPressure
variable = vel_x
pressure = pressure
momentum_component = 'x'
[]

[p_diffusion]
type = LinearFVAnisotropicDiffusion
variable = pressure
diffusion_tensor = Ainv
use_nonorthogonal_correction = false
[]
[HbyA_divergence]
type = LinearFVDivergence
variable = pressure
face_flux = HbyA
force_boundary_execution = true
[]

[temp_conduction]
type = LinearFVDiffusion
diffusion_coeff = 'alpha'
variable = h
[]
[temp_advection]
type = LinearFVEnergyAdvection
variable = h
[]
[source]
type = LinearFVSource
variable = h
source_density = source_func
[]
[]

[LinearFVBCs]
[inlet_u]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
boundary = 'left'
variable = vel_x
functor = ${bulk_u} #${bulk_u} #'fully_developed_velocity'
[]
[inlet_h]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = h
boundary = 'left'
functor = 'h_from_p_T'
[]
[inlet_T]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
variable = T
boundary = 'left'
functor = 860.
[]

[outlet_p]
type = LinearFVAdvectionDiffusionFunctorDirichletBC
boundary = 'right'
variable = pressure
functor = ${p_ref}
[]
[outlet_h]
type = LinearFVAdvectionDiffusionOutflowBC
variable = h
use_two_term_expansion = false
boundary = 'right'
[]
[outlet_u]
type = LinearFVAdvectionDiffusionOutflowBC
variable = vel_x
use_two_term_expansion = false
boundary = 'right'
[]
[]

[Materials]
[converter_to_regular_T]
type = FunctorADConverter
ad_props_in = 'T'
reg_props_out = 'T_nAD'
[]
[converter_to_regular_h]
type = FunctorADConverter
ad_props_in = 'h'
reg_props_out = 'h_nAD'
[]
[]

[FunctorMaterials]
[source_func]
type = ADParsedFunctorMaterial
property_name = source_func
functor_names = 'rho'
expression = '10.'
[]
[alpha]
type = ADParsedFunctorMaterial
property_name = 'alpha'
functor_names = 'k cp'
expression = 'k/cp'
[]
[enthalpy_material]
type = LinearFVEnthalpyFunctorMaterial
pressure = ${p_ref}
T_fluid = T
h = h
#fp = salt
h_from_p_T_functor = h_from_p_T_functor
T_from_p_h_functor = T_from_p_h_functor
[]
[h_from_p_T_functor]
type = ParsedFunctorMaterial
property_name = 'h_from_p_T_functor'
functor_names = 'T_nAD'
expression = '976.78*T_nAD+1.0634/2*(T_nAD^2)'
[]
[T_from_p_h_functor]
type = ParsedFunctorMaterial
property_name = 'T_from_p_h_functor'
functor_names = 'h_nAD'
expression = '(-976.78+sqrt(976.78^2+2*h_nAD*1.0634))/1.0634'
[]
[rho]
type = ADParsedFunctorMaterial
property_name = 'rho'
functor_names = 'T'
expression = '2000' #'2579.-0.624*T'
[]
[cp]
type = ADParsedFunctorMaterial
property_name = 'cp'
functor_names = 'T'
expression = '976.78+1.0634*T'
[]
[mu]
type = ADParsedFunctorMaterial
property_name = 'mu'
functor_names = 'T'
expression = '4.5e-3' #'4.e-5*exp(4170/T)'
[]
[k]
type = ADParsedFunctorMaterial
property_name = 'k'
functor_names = 'T'
expression = 0.7 #'1.24-0.000538*T'
[]
[]

[AuxKernels]
[rho_out]
type = FunctorAux
functor = 'rho'
variable = 'rho_var'
execute_on = 'NONLINEAR'
[]
[cp_out]
type = FunctorAux
functor = 'cp'
variable = 'cp_var'
execute_on = 'NONLINEAR'
[]
[T_from_h_functor_aux]
type = FunctorAux
functor = 'T_from_p_h'
variable = 'T'
execute_on = 'NONLINEAR'
[]
[h_from_T_functor_aux]
type = FunctorAux
functor = 'h_from_p_T'
variable = 'h_aux'
execute_on = 'NONLINEAR'
[]
[]

[Executioner]
type = SIMPLE
momentum_l_abs_tol = 1e-12
pressure_l_abs_tol = 1e-12
energy_l_abs_tol = 1e-12
momentum_l_tol = 0
pressure_l_tol = 0
energy_l_tol = 0
rhie_chow_user_object = 'rc'
momentum_systems = 'u_system'
pressure_system = 'pressure_system'
energy_system = 'energy_system'
momentum_equation_relaxation = 0.7
pressure_variable_relaxation = 0.3
energy_equation_relaxation = 0.95
num_iterations = 1000
pressure_absolute_tolerance = 1e-8
momentum_absolute_tolerance = 1e-8
energy_absolute_tolerance = 1e-6
print_fields = false
momentum_l_max_its = 200

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'
continue_on_max_its = true
[]


[Outputs]
[csv]
type = Exodus
execute_on = FINAL
[]
[]

0 comments on commit dd1f014

Please sign in to comment.