- gradient_variableThe variable from which to compute the gradient component
C++ Type:std::vector<VariableName>
Controllable:No
Description:The variable from which to compute the gradient component
- variableThe name of the variable that this object applies to
C++ Type:AuxVariableName
Controllable:No
Description:The name of the variable that this object applies to
VariableGradientComponent
Creates a field consisting of one component of the gradient of a coupled variable.
The result of this operation is stored in an auxiliary variable: variable
. The analysis of gradients is useful to examine a solution or the adequacy of a mesh discretization.
AuxVariables currently do not contain the Automatic Differentiation information about the derivatives. Using this object in the solve, to compute a material property for example, will lead to an imperfect Jacobian which can impact convergence.
VariableGradientComponent may only be applied to elemental variables, and only considers the gradient within an element. For example, the reported gradient of a CONSTANT
MONOMIAL
is identically zero.
Example Input File Syntax
In this example, u is the (linear) solution of a 2D diffusion equation with no source term. We compute the two gradient components using the AuxKernels below, which each store a gradient component in a separate auxiliary variable. We can then examine the gradient of u, for example to decide to use a finer mesh in a given direction if the corresponding gradient is not well resolved.
[AuxKernels]
[./grad_u_x_aux]
type = VariableGradientComponent
variable = grad_u_x
component = x
gradient_variable = u
[../]
[./grad_u_y_aux]
type = VariableGradientComponent
variable = grad_u_y
component = y
gradient_variable = u
[../]
[]
(test/tests/auxkernels/grad_component/grad_component.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
- boundaryThe list of boundaries (ids or names) from the mesh where this object applies
C++ Type:std::vector<BoundaryName>
Controllable:No
Description:The list of boundaries (ids or names) from the mesh where this object applies
- check_boundary_restrictedTrueWhether to check for multiple element sides on the boundary in the case of a boundary restricted, element aux variable. Setting this to false will allow contribution to a single element's elemental value(s) from multiple boundary sides on the same element (example: when the restricted boundary exists on two or more sides of an element, such as at a corner of a mesh
Default:True
C++ Type:bool
Controllable:No
Description:Whether to check for multiple element sides on the boundary in the case of a boundary restricted, element aux variable. Setting this to false will allow contribution to a single element's elemental value(s) from multiple boundary sides on the same element (example: when the restricted boundary exists on two or more sides of an element, such as at a corner of a mesh
- componentThe gradient component to compute
C++ Type:MooseEnum
Options:x, y, z
Controllable:No
Description:The gradient component to compute
- execute_onLINEAR TIMESTEP_ENDThe list of flag(s) indicating when this object should be executed, the available options include FORWARD, ADJOINT, HOMOGENEOUS_FORWARD, ADJOINT_TIMESTEP_BEGIN, ADJOINT_TIMESTEP_END, NONE, INITIAL, LINEAR, NONLINEAR, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM, PRE_DISPLACE.
Default:LINEAR TIMESTEP_END
C++ Type:ExecFlagEnum
Options:FORWARD, ADJOINT, HOMOGENEOUS_FORWARD, ADJOINT_TIMESTEP_BEGIN, ADJOINT_TIMESTEP_END, NONE, INITIAL, LINEAR, NONLINEAR, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM, PRE_DISPLACE
Controllable:No
Description:The list of flag(s) indicating when this object should be executed, the available options include FORWARD, ADJOINT, HOMOGENEOUS_FORWARD, ADJOINT_TIMESTEP_BEGIN, ADJOINT_TIMESTEP_END, NONE, INITIAL, LINEAR, NONLINEAR, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM, PRE_DISPLACE.
- prop_getter_suffixAn optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.
C++ Type:MaterialPropertyName
Controllable:No
Description:An optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.
- use_interpolated_stateFalseFor the old and older state use projected material properties interpolated at the quadrature points. To set up projection use the ProjectedStatefulMaterialStorageAction.
Default:False
C++ Type:bool
Controllable:No
Description:For the old and older state use projected material properties interpolated at the quadrature points. To set up projection use the ProjectedStatefulMaterialStorageAction.
Optional 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.
- 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
Input Files
- (modules/navier_stokes/test/tests/finite_element/ins/scalar_adr/supg/advection_error_testing.i)
- (modules/phase_field/test/tests/electrochem_sintering/ElectrochemicalSintering_test.i)
- (test/tests/auxkernels/grad_component/grad_component.i)
- (modules/navier_stokes/test/tests/finite_element/ins/mms/supg/supg_pspg_adv_dominated_mms.i)
- (test/tests/auxkernels/grad_component/grad_component_monomial.i)
- (modules/phase_field/examples/slkks/CrFe_sigma.i)
- (modules/optimization/test/tests/optimizationreporter/material/adjoint_explicit.i)
- (modules/navier_stokes/test/tests/finite_element/ins/mms/pspg/pspg_mms_test.i)
- (test/tests/auxkernels/forcing_function_aux/forcing_function_aux.i)
- (modules/navier_stokes/test/tests/finite_element/ins/scalar_adr/supg/2d_advection_error_testing.i)
- (modules/navier_stokes/test/tests/finite_element/ins/mms/supg/supg_mms_test.i)
- (modules/navier_stokes/test/tests/finite_element/ins/mms/supg/supg_adv_dominated_mms.i)
Child Objects
(test/tests/auxkernels/grad_component/grad_component.i)
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
[]
[Variables]
[./u]
[../]
[]
[AuxVariables]
[./grad_u_x]
order = CONSTANT
family = MONOMIAL
[../]
[./grad_u_y]
order = CONSTANT
family = MONOMIAL
[../]
[]
[Kernels]
[./diff]
type = Diffusion
variable = u
[../]
[]
[AuxKernels]
[./grad_u_x_aux]
type = VariableGradientComponent
variable = grad_u_x
component = x
gradient_variable = u
[../]
[./grad_u_y_aux]
type = VariableGradientComponent
variable = grad_u_y
component = y
gradient_variable = u
[../]
[]
[BCs]
[./left]
type = DirichletBC
variable = u
boundary = left
value = 0
[../]
[./right]
type = DirichletBC
variable = u
boundary = right
value = 1
[../]
[]
[Executioner]
type = Steady
solve_type = PJFNK
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Outputs]
exodus = true
[]
(modules/navier_stokes/test/tests/finite_element/ins/scalar_adr/supg/advection_error_testing.i)
velocity=1
[GlobalParams]
u = ${velocity}
pressure = 0
tau_type = mod
[]
[Mesh]
type = GeneratedMesh
dim = 1
nx = 4
xmax = 1
elem_type = EDGE2
[]
[Variables]
[./c]
family = LAGRANGE
order = FIRST
[../]
[]
[Kernels]
[./adv]
type = AdvectionSUPG
variable = c
forcing_func = 'ffn'
[../]
[]
[BCs]
[./left]
type = DirichletBC
variable = c
boundary = left
value = 0
[../]
[]
[Materials]
[./mat]
type = GenericConstantMaterial
prop_names = 'mu rho'
prop_values = '0 1'
[../]
[]
[Functions]
[./ffn]
type = ParsedFunction
expression = '1-x^2'
[../]
[./c_func]
type = ParsedFunction
expression = 'x-x^3/3'
[../]
[]
[Executioner]
type = Steady
petsc_options_iname = '-pc_type -pc_factor_shift_type'
petsc_options_value = 'lu NONZERO'
[]
[Outputs]
[./exodus]
type = Exodus
[../]
[./csv]
type = CSV
[../]
[]
[Postprocessors]
[./L2c]
type = ElementL2Error
variable = c
function = c_func
outputs = 'console' execute_on = 'timestep_end'
[../]
[./L2cx]
type = ElementL2Error
variable = cx
function = ffn
outputs = 'console' execute_on = 'timestep_end'
[../]
[]
[AuxVariables]
[./cx]
family = MONOMIAL
order = FIRST
[../]
[]
[AuxKernels]
[./cx]
type = VariableGradientComponent
component = x
variable = cx
gradient_variable = c
[../]
[]
(modules/phase_field/test/tests/electrochem_sintering/ElectrochemicalSintering_test.i)
[Mesh]
type = GeneratedMesh
dim = 1
nx = 800
xmin = 0
xmax = 80
[]
[GlobalParams]
op_num = 2
var_name_base = gr
int_width = 4
[]
[Variables]
[wvy]
[]
[wvo]
[]
[phi]
[]
[PolycrystalVariables]
[]
[V]
[]
[]
[AuxVariables]
[bnds]
[]
[negative_V]
[]
[E_x]
order = CONSTANT
family = MONOMIAL
[]
[E_y]
order = CONSTANT
family = MONOMIAL
[]
[ns_cat_aux]
order = CONSTANT
family = MONOMIAL
[]
[ns_an_aux]
order = CONSTANT
family = MONOMIAL
[]
[T]
[]
[]
[Functions]
[ic_func_gr0]
type = ParsedFunction
expression = '0.5*(1.0-tanh((x)/sqrt(2.0*2.0)))'
[]
[ic_func_gr1]
type = ParsedFunction
expression = '0.5*(1.0+tanh((x)/sqrt(2.0*2.0)))'
[]
[]
[ICs]
[gr0_IC]
type = FunctionIC
variable = gr0
function = ic_func_gr0
[]
[gr1_IC]
type = FunctionIC
variable = gr1
function = ic_func_gr1
[]
[wvy_IC]
type = ConstantIC
variable = wvy
value = 2.7827
[]
[wvo_IC]
type = ConstantIC
variable = wvo
value = 2.7827
[]
[T_IC]
type = ConstantIC
variable = T
value = 1600
[]
[]
[BCs]
[v_left]
type = DirichletBC
preset = true
variable = V
boundary = left
value = 1e-2
[]
[v_right]
type = DirichletBC
preset = true
variable = V
boundary = right
value = 0
[]
[gr0_left]
type = DirichletBC
preset = true
variable = gr0
boundary = left
value = 0.5 #Grain boundary at left hand side of domain
[]
[gr1_left]
type = DirichletBC
preset = true
variable = gr1
boundary = left
value = 0.5 #Grain boundary at left hand side of domain
[]
[wvo_right]
type = DirichletBC
preset = true
variable = wvo
boundary = right
value = 2.7827
[]
[wvy_right]
type = DirichletBC
preset = true
variable = wvy
boundary = right
value = 2.7827
[]
[]
[Materials]
# Free energy coefficients for parabolic curves
[ks_cat]
type = ParsedMaterial
property_name = ks_cat
coupled_variables = 'T'
constant_names = 'a b Va'
constant_expressions = '-0.0017 140.44 0.03726'
expression = '(a*T + b) * Va^2'
[]
[ks_an]
type = ParsedMaterial
property_name = ks_an
coupled_variables = 'T'
constant_names = 'a b Va'
constant_expressions = '-0.0017 140.44 0.03726'
expression = '(a*T + b) * Va^2'
[]
[kv_cat]
type = ParsedMaterial
property_name = kv_cat
material_property_names = 'ks_cat'
expression = '10*ks_cat'
[]
[kv_an]
type = ParsedMaterial
property_name = kv_an
material_property_names = 'ks_cat'
expression = '10*ks_cat'
[]
# Diffusivity and mobilities
[chiDy]
type = GrandPotentialTensorMaterial
f_name = chiDy
diffusivity_name = Dvy
solid_mobility = L
void_mobility = Lv
chi = chi_cat
surface_energy = 6.24
c = phi
T = T
D0 = 5.9e11
GBmob0 = 1.60e12
Q = 4.14
Em = 4.25
bulkindex = 1
gbindex = 1
surfindex = 1
[]
[chiDo]
type = GrandPotentialTensorMaterial
f_name = chiDo
diffusivity_name = Dvo
solid_mobility = Lo
void_mobility = Lvo
chi = chi_an
surface_energy = 6.24
c = phi
T = T
D0 = 5.9e11
GBmob0 = 1.60e12
Q = 4.14
Em = 4.25
bulkindex = 1
gbindex = 1
surfindex = 1
[]
# Everything else
[ns_y_min]
type = DerivativeParsedMaterial
property_name = ns_y_min
coupled_variables = 'gr0 gr1 T'
constant_names = 'Ef_B Ef_GB kB Va_Y'
constant_expressions = '4.37 4.37 8.617343e-5 0.03726'
derivative_order = 2
expression = 'bnds:=gr0^2 + gr1^2; Ef:=Ef_B + 4.0 * (Ef_GB - Ef_B) * (1.0 - bnds)^2;
'
' exp(-Ef/kB/T) / Va_Y'
[]
[ns_o_min]
type = DerivativeParsedMaterial
property_name = ns_o_min
coupled_variables = 'gr0 gr1 T'
constant_names = 'Ef_B Ef_GB kB Va_O'
constant_expressions = '4.37 4.37 8.617343e-5 0.02484'
derivative_order = 2
expression = 'bnds:=gr0^2 + gr1^2; Ef:=Ef_B + 4.0 * (Ef_GB - Ef_B) * (1.0 - bnds)^2;
'
' exp(-Ef/kB/T) / Va_O'
[]
[sintering]
type = ElectrochemicalSinteringMaterial
chemical_potentials = 'wvy wvo'
electric_potential = V
void_op = phi
Temperature = T
surface_energy = 6.24
grainboundary_energy = 5.18
solid_energy_coefficients = 'kv_cat kv_cat'
void_energy_coefficients = 'kv_cat kv_an'
min_vacancy_concentrations_solid = 'ns_y_min ns_o_min'
min_vacancy_concentrations_void = '26.837 40.256'
defect_charges = '-3 2'
solid_relative_permittivity = 30
solid_energy_model = DILUTE
[]
[density_chi_y]
type = ElectrochemicalDefectMaterial
chemical_potential = wvy
void_op = phi
Temperature = T
electric_potential = V
void_density_name = nv_cat
solid_density_name = ns_cat
chi_name = chi_cat
void_energy_coefficient = kv_cat
min_vacancy_concentration_solid = ns_y_min
min_vacancy_concentration_void = 26.837
solid_energy_model = DILUTE
defect_charge = -3
solid_relative_permittivity = 30
[]
[density_chi_o]
type = ElectrochemicalDefectMaterial
chemical_potential = wvo
void_op = phi
Temperature = T
electric_potential = V
void_density_name = nv_an
solid_density_name = ns_an
chi_name = chi_an
void_energy_coefficient = kv_an
min_vacancy_concentration_solid = ns_o_min
min_vacancy_concentration_void = 40.256
solid_energy_model = DILUTE
defect_charge = 2
solid_relative_permittivity = 30
[]
[permittivity]
type = DerivativeParsedMaterial
property_name = permittivity
coupled_variables = 'phi'
material_property_names = 'hs hv'
constant_names = 'eps_rel_solid eps_void_over_e'
constant_expressions = '30 5.52e-2' #eps_void_over_e in 1/V/nm
derivative_order = 2
expression = '-hs * eps_rel_solid * eps_void_over_e - hv * eps_void_over_e'
[]
[void_pre]
type = DerivativeParsedMaterial
property_name = void_pre
material_property_names = 'hv'
constant_names = 'Z_cat Z_an nv_y_min nv_o_min'
constant_expressions = '-3 2 26.837 40.256'
derivative_order = 2
expression = '-hv * (Z_cat * nv_y_min + Z_an * nv_o_min)'
[]
[cat_mu_pre]
type = DerivativeParsedMaterial
property_name = cat_mu_pre
material_property_names = 'hv kv_cat'
constant_names = 'Z_cat'
constant_expressions = '-3'
derivative_order = 2
expression = '-hv * Z_cat / kv_cat'
[]
[an_mu_pre]
type = DerivativeParsedMaterial
property_name = an_mu_pre
material_property_names = 'hv kv_an'
constant_names = 'Z_an'
constant_expressions = '2'
derivative_order = 2
expression = '-hv * Z_an / kv_an'
[]
[cat_V_pre]
type = DerivativeParsedMaterial
property_name = cat_V_pre
material_property_names = 'hv kv_cat'
constant_names = 'Z_cat v_scale e '
constant_expressions = '-3 1 1'
derivative_order = 2
expression = 'hv * Z_cat^2 * e * v_scale / kv_cat'
[]
[an_V_pre]
type = DerivativeParsedMaterial
property_name = an_V_pre
material_property_names = 'hv kv_an'
constant_names = 'Z_an v_scale e '
constant_expressions = '2 1 1'
derivative_order = 2
expression = 'hv * Z_an^2 * e * v_scale / kv_an'
[]
[]
#This action adds most kernels needed for grand potential model
[Modules]
[PhaseField]
[GrandPotential]
switching_function_names = 'hv hs'
anisotropic = 'true true'
chemical_potentials = 'wvy wvo'
mobilities = 'chiDy chiDo'
susceptibilities = 'chi_cat chi_an'
free_energies_w = 'nv_cat ns_cat nv_an ns_an'
gamma_gr = gamma
mobility_name_gr = L
kappa_gr = kappa
free_energies_gr = 'omegav omegas'
additional_ops = 'phi'
gamma_grxop = gamma
mobility_name_op = Lv
kappa_op = kappa
free_energies_op = 'omegav omegas'
[]
[]
[]
[Kernels]
[barrier_phi]
type = ACBarrierFunction
variable = phi
v = 'gr0 gr1'
gamma = gamma
mob_name = Lv
[]
[kappa_phi]
type = ACKappaFunction
variable = phi
mob_name = Lv
kappa_name = kappa
[]
[Laplace]
type = MatDiffusion
variable = V
diffusivity = permittivity
args = 'phi'
[]
[potential_void_constants]
type = MaskedBodyForce
variable = V
coupled_variables = 'phi'
mask = void_pre
[]
[potential_cat_mu]
type = MatReaction
variable = V
v = wvy
mob_name = cat_mu_pre
[]
[potential_an_mu]
type = MatReaction
variable = V
v = wvo
mob_name = an_mu_pre
[]
[potential_cat_V]
type = MatReaction
variable = V
mob_name = cat_V_pre
[]
[potential_an_V]
type = MatReaction
variable = V
mob_name = an_V_pre
[]
[potential_solid_cat]
type = MaskedExponential
variable = V
w = wvy
T = T
coupled_variables = 'phi gr0 gr1'
mask = hs
species_charge = -3
n_eq = ns_y_min
[]
[potential_solid_an]
type = MaskedExponential
variable = V
w = wvo
T = T
coupled_variables = 'phi gr0 gr1'
mask = hs
species_charge = 2
n_eq = ns_o_min
[]
[]
[AuxKernels]
[bnds_aux]
type = BndsCalcAux
variable = bnds
execute_on = 'initial timestep_end'
[]
[negative_V]
type = ParsedAux
variable = negative_V
coupled_variables = V
expression = '-V'
[]
[E_x]
type = VariableGradientComponent
variable = E_x
gradient_variable = negative_V
component = x
[]
[E_y]
type = VariableGradientComponent
variable = E_y
gradient_variable = negative_V
component = y
[]
[ns_cat_aux]
type = MaterialRealAux
variable = ns_cat_aux
property = ns_cat
[]
[ns_an_aux]
type = MaterialRealAux
variable = ns_an_aux
property = ns_an
[]
[]
[Postprocessors]
[ns_cat_total]
type = ElementIntegralMaterialProperty
mat_prop = ns_cat
[]
[ns_an_total]
type = ElementIntegralMaterialProperty
mat_prop = ns_an
[]
[]
[Preconditioning]
[SMP]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
scheme = bdf2
solve_type = PJFNK
petsc_options_iname = '-pc_type -sub_pc_type -pc_asm_overlap -ksp_gmres_restart -sub_ksp_type'
petsc_options_value = ' asm lu 1 31 preonly'
nl_max_its = 40
l_max_its = 30
l_tol = 1e-4
nl_rel_tol = 1e-8
nl_abs_tol = 1e-13
start_time = 0
num_steps = 2
automatic_scaling = true
[TimeStepper]
type = IterationAdaptiveDT
dt = 1
optimal_iterations = 8
iteration_window = 2
[]
[]
[Outputs]
exodus = true
[]
(test/tests/auxkernels/grad_component/grad_component.i)
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
[]
[Variables]
[./u]
[../]
[]
[AuxVariables]
[./grad_u_x]
order = CONSTANT
family = MONOMIAL
[../]
[./grad_u_y]
order = CONSTANT
family = MONOMIAL
[../]
[]
[Kernels]
[./diff]
type = Diffusion
variable = u
[../]
[]
[AuxKernels]
[./grad_u_x_aux]
type = VariableGradientComponent
variable = grad_u_x
component = x
gradient_variable = u
[../]
[./grad_u_y_aux]
type = VariableGradientComponent
variable = grad_u_y
component = y
gradient_variable = u
[../]
[]
[BCs]
[./left]
type = DirichletBC
variable = u
boundary = left
value = 0
[../]
[./right]
type = DirichletBC
variable = u
boundary = right
value = 1
[../]
[]
[Executioner]
type = Steady
solve_type = PJFNK
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Outputs]
exodus = true
[]
(modules/navier_stokes/test/tests/finite_element/ins/mms/supg/supg_pspg_adv_dominated_mms.i)
mu=1.5e-4
rho=2.5
[GlobalParams]
gravity = '0 0 0'
supg = true
pspg = true
convective_term = true
integrate_p_by_parts = false
transient_term = true
laplace = true
u = vel_x
v = vel_y
pressure = p
alpha = 1e0
order = FIRST
family = LAGRANGE
[]
[Mesh]
[gen]
type = GeneratedMeshGenerator
dim = 2
xmin = 0
xmax = 1.0
ymin = 0
ymax = 1.0
elem_type = QUAD9
nx = 4
ny = 4
[]
[./corner_node]
type = ExtraNodesetGenerator
new_boundary = 'pinned_node'
nodes = '0'
input = gen
[../]
[]
[Variables]
[./vel_x]
[../]
[./vel_y]
[../]
[./p]
order = FIRST
[../]
[]
[Kernels]
# mass
[./mass]
type = INSMass
variable = p
x_vel_forcing_func = vel_x_source_func
y_vel_forcing_func = vel_y_source_func
[../]
[./x_time]
type = INSMomentumTimeDerivative
variable = vel_x
[../]
[./y_time]
type = INSMomentumTimeDerivative
variable = vel_y
[../]
# x-momentum, space
[./x_momentum_space]
type = INSMomentumLaplaceForm
variable = vel_x
component = 0
forcing_func = vel_x_source_func
[../]
# y-momentum, space
[./y_momentum_space]
type = INSMomentumLaplaceForm
variable = vel_y
component = 1
forcing_func = vel_y_source_func
[../]
[./p_source]
type = BodyForce
function = p_source_func
variable = p
[../]
[]
[BCs]
[./vel_x]
type = FunctionDirichletBC
boundary = 'left right top bottom'
function = vel_x_func
variable = vel_x
[../]
[./vel_y]
type = FunctionDirichletBC
boundary = 'left right top bottom'
function = vel_y_func
variable = vel_y
[../]
[./p]
type = FunctionDirichletBC
boundary = 'left right top bottom'
function = p_func
variable = p
[../]
[]
[Functions]
[./vel_x_source_func]
type = ParsedFunction
expression = '-${mu}*(-0.028*pi^2*x^2*sin(0.2*pi*x*y) - 0.028*pi^2*y^2*sin(0.2*pi*x*y) - 0.1*pi^2*sin(0.5*pi*x) - 0.4*pi^2*sin(pi*y)) + ${rho}*(0.14*pi*x*cos(0.2*pi*x*y) + 0.4*pi*cos(pi*y))*(0.6*sin(0.8*pi*x) + 0.3*sin(0.3*pi*y) + 0.2*sin(0.3*pi*x*y) + 0.3) + ${rho}*(0.14*pi*y*cos(0.2*pi*x*y) + 0.2*pi*cos(0.5*pi*x))*(0.4*sin(0.5*pi*x) + 0.4*sin(pi*y) + 0.7*sin(0.2*pi*x*y) + 0.5) + 0.1*pi*y*cos(0.2*pi*x*y) + 0.25*pi*cos(0.5*pi*x)'
[../]
[./vel_y_source_func]
type = ParsedFunction
expression = '-${mu}*(-0.018*pi^2*x^2*sin(0.3*pi*x*y) - 0.018*pi^2*y^2*sin(0.3*pi*x*y) - 0.384*pi^2*sin(0.8*pi*x) - 0.027*pi^2*sin(0.3*pi*y)) + ${rho}*(0.06*pi*x*cos(0.3*pi*x*y) + 0.09*pi*cos(0.3*pi*y))*(0.6*sin(0.8*pi*x) + 0.3*sin(0.3*pi*y) + 0.2*sin(0.3*pi*x*y) + 0.3) + ${rho}*(0.06*pi*y*cos(0.3*pi*x*y) + 0.48*pi*cos(0.8*pi*x))*(0.4*sin(0.5*pi*x) + 0.4*sin(pi*y) + 0.7*sin(0.2*pi*x*y) + 0.5) + 0.1*pi*x*cos(0.2*pi*x*y) + 0.3*pi*cos(0.3*pi*y)'
[../]
[./p_source_func]
type = ParsedFunction
expression = '-0.06*pi*x*cos(0.3*pi*x*y) - 0.14*pi*y*cos(0.2*pi*x*y) - 0.2*pi*cos(0.5*pi*x) - 0.09*pi*cos(0.3*pi*y)'
[../]
[./vel_x_func]
type = ParsedFunction
expression = '0.4*sin(0.5*pi*x) + 0.4*sin(pi*y) + 0.7*sin(0.2*pi*x*y) + 0.5'
[../]
[./vel_y_func]
type = ParsedFunction
expression = '0.6*sin(0.8*pi*x) + 0.3*sin(0.3*pi*y) + 0.2*sin(0.3*pi*x*y) + 0.3'
[../]
[./p_func]
type = ParsedFunction
expression = '0.5*sin(0.5*pi*x) + 1.0*sin(0.3*pi*y) + 0.5*sin(0.2*pi*x*y) + 0.5'
[../]
[./vxx_func]
type = ParsedFunction
expression = '0.14*pi*y*cos(0.2*pi*x*y) + 0.2*pi*cos(0.5*pi*x)'
[../]
[]
[Materials]
[./const]
type = GenericConstantMaterial
block = 0
prop_names = 'rho mu'
prop_values = '${rho} ${mu}'
[../]
[]
[Preconditioning]
[./SMP]
type = SMP
full = true
solve_type = 'NEWTON'
[../]
[]
[Executioner]
petsc_options = '-snes_converged_reason -ksp_converged_reason -snes_view'
petsc_options_iname = '-pc_type -pc_factor_shift_type -pc_factor_mat_solver_package'
petsc_options_value = 'lu NONZERO superlu_dist'
line_search = 'none'
nl_rel_tol = 1e-8
nl_abs_tol = 1e-12
nl_max_its = 10
l_tol = 1e-6
l_max_its = 10
# To run to steady-state, set num-steps to some large number (1000000 for example)
type = Transient
num_steps = 10
steady_state_detection = true
steady_state_tolerance = 1e-10
[./TimeStepper]
dt = .1
type = IterationAdaptiveDT
cutback_factor = 0.4
growth_factor = 1.2
optimal_iterations = 20
[../]
[]
[Outputs]
execute_on = 'final'
[./exodus]
type = Exodus
[../]
[./csv]
type = CSV
[../]
[]
[Postprocessors]
[./L2vel_x]
type = ElementL2Error
variable = vel_x
function = vel_x_func
outputs = 'console' execute_on = 'timestep_end'
[../]
[./L2vel_y]
variable = vel_y
function = vel_y_func
type = ElementL2Error
outputs = 'console' execute_on = 'timestep_end'
[../]
[./L2p]
variable = p
function = p_func
type = ElementL2Error
outputs = 'console' execute_on = 'timestep_end'
[../]
[./L2vxx]
variable = vxx
function = vxx_func
type = ElementL2Error
outputs = 'console' execute_on = 'timestep_end'
[../]
[]
[AuxVariables]
[./vxx]
family = MONOMIAL
order = FIRST
[../]
[]
[AuxKernels]
[./vxx]
type = VariableGradientComponent
component = x
variable = vxx
gradient_variable = vel_x
[../]
[]
(test/tests/auxkernels/grad_component/grad_component_monomial.i)
[Mesh]
type = GeneratedMesh
dim = 2
xmax = 2
nx = 20
ny = 10
[]
[Variables]
[./not_u]
[../]
[]
[AuxVariables]
[./u]
family = MONOMIAL
order = FIRST
[../]
[./grad_u_x]
order = CONSTANT
family = MONOMIAL
[../]
[]
[ICs]
[./u]
type = FunctionIC
variable = u
function = 'if(x>0.5,if(x<1.5,2*x,3),0)'
[../]
[]
[AuxKernels]
[./grad_u_x_aux]
type = VariableGradientComponent
variable = grad_u_x
component = x
gradient_variable = u
execute_on = initial
[../]
[]
[Problem]
type = FEProblem
solve = false
kernel_coverage_check = false
[]
[Executioner]
type = Steady
[]
[Outputs]
exodus = true
[]
(modules/phase_field/examples/slkks/CrFe_sigma.i)
#
# SLKKS two phase example for the BCC and SIGMA phases. The sigma phase contains
# multiple sublattices. Free energy from
# Jacob, Aurelie, Erwin Povoden-Karadeniz, and Ernst Kozeschnik. "Revised thermodynamic
# description of the Fe-Cr system based on an improved sublattice model of the sigma phase."
# Calphad 60 (2018): 16-28.
#
# In this simulation we solve only for the sublattice concentrations of the sigma phase
# (and consequently for the free energy of the sigma phase as function of total concentration.)
# The Cr concentration is prescribed as a linear gradient. This permits us to plot
# the free energies of the BCC and sigma phases.
#
[Mesh]
[gen]
type = GeneratedMeshGenerator
dim = 2
nx = 1000
ny = 1
xmin = 0.01
xmax = 0.99
ymax = 0.1
[]
[]
[AuxVariables]
[cCr]
[InitialCondition]
type = FunctionIC
function = x
[]
[]
[Fb]
order = FIRST
family = MONOMIAL
[]
[Fs]
order = FIRST
family = MONOMIAL
[]
[dFs]
order = CONSTANT
family = MONOMIAL
[]
[dFs0]
order = CONSTANT
family = MONOMIAL
[]
[dFs1]
order = CONSTANT
family = MONOMIAL
[]
[dFs2]
order = CONSTANT
family = MONOMIAL
[]
[]
[Variables]
[SIGMA_0CR]
[InitialCondition]
type = FunctionIC
function = x
[]
[]
[SIGMA_1CR]
[InitialCondition]
type = FunctionIC
function = x
[]
[]
[SIGMA_2CR]
[InitialCondition]
type = FunctionIC
function = x
[]
[]
[]
[AuxKernels]
[Fb]
type = MaterialRealAux
variable = Fb
property = F_BCC_A2
[]
[Fs]
type = MaterialRealAux
variable = Fs
property = F_SIGMA
[]
[dFs0]
type = MaterialRealAux
variable = dFs0
property = dF_SIGMA/dSIGMA_0CR
[]
[dFs1]
type = MaterialRealAux
variable = dFs1
property = dF_SIGMA/dSIGMA_1CR
[]
[dFs2]
type = MaterialRealAux
variable = dFs1
property = dF_SIGMA/dSIGMA_2CR
[]
[dFs]
type = VariableGradientComponent
variable = dFs
gradient_variable = Fs
component = x
[]
[]
[Kernels]
[chempot2a2b]
# This kernel ties the first two sublattices in the sigma phase together
type = SLKKSChemicalPotential
variable = SIGMA_0CR
a = 10
cs = SIGMA_1CR
as = 4
F = F_SIGMA
[]
[chempot2b2c]
# This kernel ties the remaining two sublattices in the sigma phase together
type = SLKKSChemicalPotential
variable = SIGMA_1CR
a = 4
cs = SIGMA_2CR
as = 16
F = F_SIGMA
[]
[sum]
type = SLKKSSum
variable = SIGMA_2CR
a = 16
cs = 'SIGMA_0CR SIGMA_1CR'
as = '10 4'
sum = cCr
[]
[]
[Materials]
# CALPHAD free energy of the FeCr sigma phase
[F_SIGMA]
type = DerivativeParsedMaterial
property_name = F_SIGMA
expression = 'SIGMA_0FE := 1-SIGMA_0CR;
SIGMA_1FE := 1-SIGMA_1CR;
'
'SIGMA_2FE := 1-SIGMA_2CR; 8.3145*T*(10.0*if(SIGMA_0CR > '
'1.0e-15,SIGMA_0CR*log(SIGMA_0CR),0) + 10.0*if(SIGMA_0FE > '
'1.0e-15,SIGMA_0FE*log(SIGMA_0FE),0) + 4.0*if(SIGMA_1CR > '
'1.0e-15,SIGMA_1CR*log(SIGMA_1CR),0) + 4.0*if(SIGMA_1FE > '
'1.0e-15,SIGMA_1FE*log(SIGMA_1FE),0) + 16.0*if(SIGMA_2CR > '
'1.0e-15,SIGMA_2CR*log(SIGMA_2CR),0) + 16.0*if(SIGMA_2FE > '
'1.0e-15,SIGMA_2FE*log(SIGMA_2FE),0))/(10.0*SIGMA_0CR + 10.0*SIGMA_0FE + '
'4.0*SIGMA_1CR + 4.0*SIGMA_1FE + 16.0*SIGMA_2CR + 16.0*SIGMA_2FE) + '
'(SIGMA_0FE*SIGMA_1CR*SIGMA_2CR*SIGMA_2FE*(-70.0*T - 170400.0) + '
'SIGMA_0FE*SIGMA_1FE*SIGMA_2CR*SIGMA_2FE*(-10.0*T - 330839.0))/(10.0*SIGMA_0CR + '
'10.0*SIGMA_0FE + 4.0*SIGMA_1CR + 4.0*SIGMA_1FE + 16.0*SIGMA_2CR + 16.0*SIGMA_2FE) + '
'(SIGMA_0CR*SIGMA_1CR*SIGMA_2CR*(30.0*if(T >= 298.15 & T < 2180.0,139250.0*1/T - '
'26.908*T*log(T) + 157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= '
'2180.0 & T < 6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) '
'+ 132000.0) + SIGMA_0CR*SIGMA_1CR*SIGMA_2FE*(-110.0*T + 16.0*if(T >= 298.15 & T < '
'1811.0,77358.5*1/T - 23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - '
'5.89269e-8*T^3.0 + 1225.7,if(T >= 1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - '
'46.0*T*log(T) + 299.31255*T - 25383.581,0)) + 14.0*if(T >= 298.15 & T < '
'2180.0,139250.0*1/T - 26.908*T*log(T) + 157.48*T + 0.00189435*T^2.0 - '
'1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < 6000.0,-2.88526e+32*T^(-9.0) - '
'50.0*T*log(T) + 344.18*T - 34869.344,0)) + 123500.0) + '
'SIGMA_0CR*SIGMA_1FE*SIGMA_2CR*(4.0*if(T >= 298.15 & T < 1811.0,77358.5*1/T - '
'23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= '
'1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - '
'25383.581,0)) + 26.0*if(T >= 298.15 & T < 2180.0,139250.0*1/T - 26.908*T*log(T) + '
'157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < '
'6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) + 140486.0) '
'+ SIGMA_0CR*SIGMA_1FE*SIGMA_2FE*(20.0*if(T >= 298.15 & T < 1811.0,77358.5*1/T - '
'23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= '
'1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - '
'25383.581,0)) + 10.0*if(T >= 298.15 & T < 2180.0,139250.0*1/T - 26.908*T*log(T) + '
'157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < '
'6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) + 148800.0) '
'+ SIGMA_0FE*SIGMA_1CR*SIGMA_2CR*(10.0*if(T >= 298.15 & T < 1811.0,77358.5*1/T - '
'23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= '
'1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - '
'25383.581,0)) + 20.0*if(T >= 298.15 & T < 2180.0,139250.0*1/T - 26.908*T*log(T) + '
'157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < '
'6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) + 56200.0) + '
'SIGMA_0FE*SIGMA_1CR*SIGMA_2FE*(26.0*if(T >= 298.15 & T < 1811.0,77358.5*1/T - '
'23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= '
'1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - '
'25383.581,0)) + 4.0*if(T >= 298.15 & T < 2180.0,139250.0*1/T - 26.908*T*log(T) + '
'157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < '
'6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) + 152700.0) '
'+ SIGMA_0FE*SIGMA_1FE*SIGMA_2CR*(14.0*if(T >= 298.15 & T < 1811.0,77358.5*1/T - '
'23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= '
'1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - '
'25383.581,0)) + 16.0*if(T >= 298.15 & T < 2180.0,139250.0*1/T - 26.908*T*log(T) + '
'157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < '
'6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) + 46200.0) + '
'SIGMA_0FE*SIGMA_1FE*SIGMA_2FE*(30.0*if(T >= 298.15 & T < 1811.0,77358.5*1/T - '
'23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= '
'1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - '
'25383.581,0)) + 173333.0))/(10.0*SIGMA_0CR + 10.0*SIGMA_0FE + 4.0*SIGMA_1CR + '
'4.0*SIGMA_1FE + 16.0*SIGMA_2CR + 16.0*SIGMA_2FE)'
coupled_variables = 'SIGMA_0CR SIGMA_1CR SIGMA_2CR'
constant_names = 'T'
constant_expressions = '1000'
[]
# single sublattice BCC phase (no sublattice concentration solve necessary)
[F_BCC_A2]
type = DerivativeParsedMaterial
property_name = F_BCC_A2
expression = 'BCC_CR:=cCr; BCC_FE:=1-BCC_CR; 8.3145*T*(1.0*if(BCC_CR > '
'1.0e-15,BCC_CR*log(BCC_CR),0) + 1.0*if(BCC_FE > 1.0e-15,BCC_FE*log(BCC_FE),0) + '
'3.0*if(BCC_VA > 1.0e-15,BCC_VA*log(BCC_VA),0))/(BCC_CR + BCC_FE) + 8.3145*T*if(T < '
'548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - 932.5*BCC_CR*BCC_FE*BCC_VA + '
'311.5*BCC_CR*BCC_VA - '
'1043.0*BCC_FE*BCC_VA,-8.13674105561218e-49*T^15/(0.525599232981783*BCC_CR*BCC_FE*BCC_'
'VA*(BCC_CR - BCC_FE) - 0.894055608820709*BCC_CR*BCC_FE*BCC_VA + '
'0.298657718120805*BCC_CR*BCC_VA - BCC_FE*BCC_VA + 9.58772770853308e-13)^15 - '
'4.65558036243985e-30*T^9/(0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - '
'0.894055608820709*BCC_CR*BCC_FE*BCC_VA + 0.298657718120805*BCC_CR*BCC_VA - '
'BCC_FE*BCC_VA + 9.58772770853308e-13)^9 - '
'1.3485349181899e-10*T^3/(0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - '
'0.894055608820709*BCC_CR*BCC_FE*BCC_VA + 0.298657718120805*BCC_CR*BCC_VA - '
'BCC_FE*BCC_VA + 9.58772770853308e-13)^3 + 1 - '
'0.905299382744392*(548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - '
'932.5*BCC_CR*BCC_FE*BCC_VA + 311.5*BCC_CR*BCC_VA - 1043.0*BCC_FE*BCC_VA + '
'1.0e-9)/T,if(T < -548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
'932.5*BCC_CR*BCC_FE*BCC_VA - 311.5*BCC_CR*BCC_VA + '
'1043.0*BCC_FE*BCC_VA,-8.13674105561218e-49*T^15/(-0.525599232981783*BCC_CR*BCC_FE*BCC'
'_VA*(BCC_CR - BCC_FE) + 0.894055608820709*BCC_CR*BCC_FE*BCC_VA - '
'0.298657718120805*BCC_CR*BCC_VA + BCC_FE*BCC_VA + 9.58772770853308e-13)^15 - '
'4.65558036243985e-30*T^9/(-0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) '
'+ 0.894055608820709*BCC_CR*BCC_FE*BCC_VA - 0.298657718120805*BCC_CR*BCC_VA + '
'BCC_FE*BCC_VA + 9.58772770853308e-13)^9 - '
'1.3485349181899e-10*T^3/(-0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
'0.894055608820709*BCC_CR*BCC_FE*BCC_VA - 0.298657718120805*BCC_CR*BCC_VA + '
'BCC_FE*BCC_VA + 9.58772770853308e-13)^3 + 1 - '
'0.905299382744392*(-548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
'932.5*BCC_CR*BCC_FE*BCC_VA - 311.5*BCC_CR*BCC_VA + 1043.0*BCC_FE*BCC_VA + '
'1.0e-9)/T,if(T > -548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
'932.5*BCC_CR*BCC_FE*BCC_VA - 311.5*BCC_CR*BCC_VA + 1043.0*BCC_FE*BCC_VA & '
'548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - 932.5*BCC_CR*BCC_FE*BCC_VA + '
'311.5*BCC_CR*BCC_VA - 1043.0*BCC_FE*BCC_VA < '
'0,-79209031311018.7*(-0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
'0.894055608820709*BCC_CR*BCC_FE*BCC_VA - 0.298657718120805*BCC_CR*BCC_VA + '
'BCC_FE*BCC_VA + 9.58772770853308e-13)^5/T^5 - '
'3.83095660520737e+42*(-0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
'0.894055608820709*BCC_CR*BCC_FE*BCC_VA - 0.298657718120805*BCC_CR*BCC_VA + '
'BCC_FE*BCC_VA + 9.58772770853308e-13)^15/T^15 - '
'1.22565886734485e+72*(-0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
'0.894055608820709*BCC_CR*BCC_FE*BCC_VA - 0.298657718120805*BCC_CR*BCC_VA + '
'BCC_FE*BCC_VA + 9.58772770853308e-13)^25/T^25,if(T > '
'548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - 932.5*BCC_CR*BCC_FE*BCC_VA + '
'311.5*BCC_CR*BCC_VA - 1043.0*BCC_FE*BCC_VA & 548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - '
'BCC_FE) - 932.5*BCC_CR*BCC_FE*BCC_VA + 311.5*BCC_CR*BCC_VA - 1043.0*BCC_FE*BCC_VA > '
'0,-79209031311018.7*(0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - '
'0.894055608820709*BCC_CR*BCC_FE*BCC_VA + 0.298657718120805*BCC_CR*BCC_VA - '
'BCC_FE*BCC_VA + 9.58772770853308e-13)^5/T^5 - '
'3.83095660520737e+42*(0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - '
'0.894055608820709*BCC_CR*BCC_FE*BCC_VA + 0.298657718120805*BCC_CR*BCC_VA - '
'BCC_FE*BCC_VA + 9.58772770853308e-13)^15/T^15 - '
'1.22565886734485e+72*(0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - '
'0.894055608820709*BCC_CR*BCC_FE*BCC_VA + 0.298657718120805*BCC_CR*BCC_VA - '
'BCC_FE*BCC_VA + 9.58772770853308e-13)^25/T^25,0))))*log((2.15*BCC_CR*BCC_FE*BCC_VA - '
'0.008*BCC_CR*BCC_VA + 2.22*BCC_FE*BCC_VA)*if(2.15*BCC_CR*BCC_FE*BCC_VA - '
'0.008*BCC_CR*BCC_VA + 2.22*BCC_FE*BCC_VA <= 0,-1.0,1.0) + 1)/(BCC_CR + BCC_FE) + '
'1.0*(BCC_CR*BCC_VA*if(T >= 298.15 & T < 2180.0,139250.0*1/T - 26.908*T*log(T) + '
'157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < '
'6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) + '
'BCC_FE*BCC_VA*if(T >= 298.15 & T < 1811.0,77358.5*1/T - 23.5143*T*log(T) + 124.134*T '
'- 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= 1811.0 & T < '
'6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - 25383.581,0)))/(BCC_CR '
'+ BCC_FE) + 1.0*(BCC_CR*BCC_FE*BCC_VA*(500.0 - 1.5*T)*(BCC_CR - BCC_FE) + '
'BCC_CR*BCC_FE*BCC_VA*(24600.0 - 14.98*T) + BCC_CR*BCC_FE*BCC_VA*(9.15*T - '
'14000.0)*(BCC_CR - BCC_FE)^2)/(BCC_CR + BCC_FE)'
coupled_variables = 'cCr'
constant_names = 'BCC_VA T'
constant_expressions = '1 1000'
[]
[]
[VectorPostprocessors]
[var]
type = LineValueSampler
variable = 'SIGMA_0CR SIGMA_1CR SIGMA_2CR cCr Fb Fs dFs dFs0 dFs1 dFs2'
start_point = '0.01 0 0'
end_point = '0.99 0 0'
sort_by = x
num_points = 1000
[]
[]
[Preconditioning]
[smp]
type = SMP
full = true
[]
[]
[Executioner]
type = Steady
nl_rel_tol = 1e-12
[]
[Outputs]
exodus = true
csv = true
[]
(modules/optimization/test/tests/optimizationreporter/material/adjoint_explicit.i)
[Mesh]
[]
[Variables]
[adjoint_var]
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = adjoint_var
diffusivity = thermal_conductivity
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = adjoint_var
x_coord_name = misfit/measurement_xcoord
y_coord_name = misfit/measurement_ycoord
z_coord_name = misfit/measurement_zcoord
value_name = misfit/misfit_values
[]
[]
[Reporters]
[misfit]
type = OptimizationData
[]
[]
[AuxVariables]
[temperature_forward]
[]
[grad_Tx]
order = CONSTANT
family = MONOMIAL
[]
[grad_Ty]
order = CONSTANT
family = MONOMIAL
[]
[grad_Tz]
order = CONSTANT
family = MONOMIAL
[]
[grad_Tfx]
order = CONSTANT
family = MONOMIAL
[]
[grad_Tfy]
order = CONSTANT
family = MONOMIAL
[]
[grad_Tfz]
order = CONSTANT
family = MONOMIAL
[]
[negative_gradient]
order = CONSTANT
family = MONOMIAL
[]
[]
[AuxKernels]
[grad_Tx]
type = VariableGradientComponent
component = x
variable = grad_Tx
gradient_variable = adjoint_var
[]
[grad_Ty]
type = VariableGradientComponent
component = y
variable = grad_Ty
gradient_variable = adjoint_var
[]
[grad_Tz]
type = VariableGradientComponent
component = z
variable = grad_Tz
gradient_variable = adjoint_var
[]
[grad_Tfx]
type = VariableGradientComponent
component = x
variable = grad_Tfx
gradient_variable = temperature_forward
[]
[grad_Tfy]
type = VariableGradientComponent
component = y
variable = grad_Tfy
gradient_variable = temperature_forward
[]
[grad_Tfz]
type = VariableGradientComponent
component = z
variable = grad_Tfz
gradient_variable = temperature_forward
[]
[negative_gradient]
type = ParsedAux
variable = negative_gradient
args = 'grad_Tx grad_Ty grad_Tz grad_Tfx grad_Tfy grad_Tfz'
function = '-(grad_Tx*grad_Tfx+grad_Ty*grad_Tfy+grad_Tz*grad_Tfz)'
[]
[]
[BCs]
[left]
type = NeumannBC
variable = adjoint_var
boundary = left
value = 0
[]
[right]
type = NeumannBC
variable = adjoint_var
boundary = right
value = 0
[]
[bottom]
type = DirichletBC
variable = adjoint_var
boundary = bottom
value = 0
[]
[top]
type = DirichletBC
variable = adjoint_var
boundary = top
value = 0
[]
[]
[Functions]
[thermo_conduct]
type = ParsedFunction
value = alpha
vars = 'alpha'
vals = 'p1'
[]
[]
[Materials]
[thermalProp]
type = GenericFunctionMaterial
prop_names = 'thermal_conductivity'
prop_values = 'thermo_conduct'
[]
[thermalPropDeriv]
type = GenericFunctionMaterial
prop_names = 'thermal_conductivity_deriv'
prop_values = '1'
[]
[]
[Executioner]
type = Steady
solve_type = NEWTON
nl_abs_tol = 1e-8
nl_rel_tol = 1e-8
petsc_options_iname = '-ksp_type -pc_type -pc_factor_mat_solver_package'
petsc_options_value = 'preonly lu superlu_dist'
[]
[Postprocessors]
[pp_adjoint_grad_parsedFunc]
type = ElementIntegralVariablePostprocessor
variable = negative_gradient
execute_on = 'initial linear'
[]
[p1]
type = ConstantValuePostprocessor
value = 10
execute_on = 'initial linear'
[]
[]
[Controls]
[parameterReceiver]
type = ControlsReceiver
[]
[]
[VectorPostprocessors]
[adjoint_grad]
type = VectorOfPostprocessors
postprocessors = 'pp_adjoint_grad_parsedFunc'
[]
[]
[Outputs]
console = false
file_base = 'adjoint'
[]
(modules/navier_stokes/test/tests/finite_element/ins/mms/pspg/pspg_mms_test.i)
mu=1.5
rho=2.5
[GlobalParams]
gravity = '0 0 0'
pspg = true
convective_term = true
integrate_p_by_parts = true
laplace = true
u = vel_x
v = vel_y
pressure = p
alpha = 1e-6
order = FIRST
family = LAGRANGE
[]
[Mesh]
[gen]
type = GeneratedMeshGenerator
dim = 2
xmin = 0
xmax = 1.0
ymin = 0
ymax = 1.0
elem_type = QUAD9
nx = 4
ny = 4
[]
[./corner_node]
type = ExtraNodesetGenerator
new_boundary = 'pinned_node'
nodes = '0'
input = gen
[../]
[]
[Variables]
[./vel_x]
[../]
[./vel_y]
[../]
[./p]
[../]
[]
[Kernels]
# mass
[./mass]
type = INSMass
variable = p
x_vel_forcing_func = vel_x_source_func
y_vel_forcing_func = vel_y_source_func
[../]
# x-momentum, space
[./x_momentum_space]
type = INSMomentumLaplaceForm
variable = vel_x
component = 0
forcing_func = vel_x_source_func
[../]
# y-momentum, space
[./y_momentum_space]
type = INSMomentumLaplaceForm
variable = vel_y
component = 1
forcing_func = vel_y_source_func
[../]
[./p_source]
type = BodyForce
function = p_source_func
variable = p
[../]
[]
[BCs]
[./vel_x]
type = FunctionDirichletBC
boundary = 'left right top bottom'
function = vel_x_func
variable = vel_x
[../]
[./vel_y]
type = FunctionDirichletBC
boundary = 'left right top bottom'
function = vel_y_func
variable = vel_y
[../]
[./p]
type = FunctionDirichletBC
boundary = 'left right top bottom'
function = p_func
variable = p
[../]
[]
[Functions]
[./vel_x_source_func]
type = ParsedFunction
expression = '-${mu}*(-0.028*pi^2*x^2*sin(0.2*pi*x*y) - 0.028*pi^2*y^2*sin(0.2*pi*x*y) - 0.1*pi^2*sin(0.5*pi*x) - 0.4*pi^2*sin(pi*y)) + ${rho}*(0.14*pi*x*cos(0.2*pi*x*y) + 0.4*pi*cos(pi*y))*(0.6*sin(0.8*pi*x) + 0.3*sin(0.3*pi*y) + 0.2*sin(0.3*pi*x*y) + 0.3) + ${rho}*(0.14*pi*y*cos(0.2*pi*x*y) + 0.2*pi*cos(0.5*pi*x))*(0.4*sin(0.5*pi*x) + 0.4*sin(pi*y) + 0.7*sin(0.2*pi*x*y) + 0.5) + 0.1*pi*y*cos(0.2*pi*x*y) + 0.25*pi*cos(0.5*pi*x)'
[../]
[./vel_y_source_func]
type = ParsedFunction
expression = '-${mu}*(-0.018*pi^2*x^2*sin(0.3*pi*x*y) - 0.018*pi^2*y^2*sin(0.3*pi*x*y) - 0.384*pi^2*sin(0.8*pi*x) - 0.027*pi^2*sin(0.3*pi*y)) + ${rho}*(0.06*pi*x*cos(0.3*pi*x*y) + 0.09*pi*cos(0.3*pi*y))*(0.6*sin(0.8*pi*x) + 0.3*sin(0.3*pi*y) + 0.2*sin(0.3*pi*x*y) + 0.3) + ${rho}*(0.06*pi*y*cos(0.3*pi*x*y) + 0.48*pi*cos(0.8*pi*x))*(0.4*sin(0.5*pi*x) + 0.4*sin(pi*y) + 0.7*sin(0.2*pi*x*y) + 0.5) + 0.1*pi*x*cos(0.2*pi*x*y) + 0.3*pi*cos(0.3*pi*y)'
[../]
[./p_source_func]
type = ParsedFunction
expression = '-0.06*pi*x*cos(0.3*pi*x*y) - 0.14*pi*y*cos(0.2*pi*x*y) - 0.2*pi*cos(0.5*pi*x) - 0.09*pi*cos(0.3*pi*y)'
[../]
[./vel_x_func]
type = ParsedFunction
expression = '0.4*sin(0.5*pi*x) + 0.4*sin(pi*y) + 0.7*sin(0.2*pi*x*y) + 0.5'
[../]
[./vel_y_func]
type = ParsedFunction
expression = '0.6*sin(0.8*pi*x) + 0.3*sin(0.3*pi*y) + 0.2*sin(0.3*pi*x*y) + 0.3'
[../]
[./p_func]
type = ParsedFunction
expression = '0.5*sin(0.5*pi*x) + 1.0*sin(0.3*pi*y) + 0.5*sin(0.2*pi*x*y) + 0.5'
[../]
[./vxx_func]
type = ParsedFunction
expression = '0.14*pi*y*cos(0.2*pi*x*y) + 0.2*pi*cos(0.5*pi*x)'
[../]
[./px_func]
type = ParsedFunction
expression = '0.1*pi*y*cos(0.2*pi*x*y) + 0.25*pi*cos(0.5*pi*x)'
[../]
[]
[Materials]
[./const]
type = GenericConstantMaterial
block = 0
prop_names = 'rho mu'
prop_values = '${rho} ${mu}'
[../]
[]
[Preconditioning]
[./SMP]
type = SMP
full = true
solve_type = 'NEWTON'
[../]
[]
[Executioner]
type = Steady
petsc_options = '-snes_converged_reason -ksp_converged_reason'
petsc_options_iname = '-pc_type -pc_factor_shift_type'
petsc_options_value = 'lu NONZERO'
line_search = 'none'
nl_rel_tol = 1e-12
nl_abs_tol = 1e-13
nl_max_its = 6
l_tol = 1e-6
l_max_its = 500
[]
[Outputs]
[./exodus]
type = Exodus
[../]
[./csv]
type = CSV
[../]
[]
[Postprocessors]
[./L2vel_x]
type = ElementL2Error
variable = vel_x
function = vel_x_func
outputs = 'console' execute_on = 'timestep_end'
[../]
[./L2vel_y]
variable = vel_y
function = vel_y_func
type = ElementL2Error
outputs = 'console' execute_on = 'timestep_end'
[../]
[./L2p]
variable = p
function = p_func
type = ElementL2Error
outputs = 'console' execute_on = 'timestep_end'
[../]
[./L2vxx]
variable = vxx
function = vxx_func
type = ElementL2Error
outputs = 'console' execute_on = 'timestep_end'
[../]
[./L2px]
variable = px
function = px_func
type = ElementL2Error
outputs = 'console' execute_on = 'timestep_end'
[../]
[]
[AuxVariables]
[./vxx]
family = MONOMIAL
order = FIRST
[../]
[./px]
family = MONOMIAL
order = FIRST
[../]
[]
[AuxKernels]
[./vxx]
type = VariableGradientComponent
component = x
variable = vxx
gradient_variable = vel_x
[../]
[./px]
type = VariableGradientComponent
component = x
variable = px
gradient_variable = p
[../]
[]
(test/tests/auxkernels/forcing_function_aux/forcing_function_aux.i)
# This is a test of the ForcingFunctionAux AuxKernel.
# The diffusion equation for u is solved with boundary conditions to force a gradient
# du/dx = 2, which is constant in time.
# du/dx is integrated over the unit square domain using a postprocessor, resulting in 2.
# The value of this postprocessor is supplied to the forcing function f used by
# the ForcingFunctionAux AuxKernel, which increments the AuxVariable T.
# Since the time step is 1, the value of T increases by 2 for each time step.
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
[]
[Variables]
[./u]
[../]
[]
[AuxVariables]
[./grad_u_x]
order = CONSTANT
family = MONOMIAL
initial_condition = 2
[../]
[./T]
order = CONSTANT
family = MONOMIAL
initial_condition = 100
[../]
[]
[Functions]
[./u_ic_func]
type = ParsedFunction
expression = '2*x'
[../]
[./f]
type = ParsedFunction
symbol_names = f
symbol_values = grad_int
expression = f
[../]
[]
[ICs]
[./u_ic]
type = FunctionIC
variable = u
function = u_ic_func
[../]
[]
[Kernels]
[./dudt]
type = TimeDerivative
variable = u
[../]
[./diff]
type = Diffusion
variable = u
[../]
[]
[AuxKernels]
[./grad_u_x_aux]
type = VariableGradientComponent
variable = grad_u_x
component = x
gradient_variable = u
[../]
[./T_increment]
type = ForcingFunctionAux
variable = T
function = f
[../]
[]
[Postprocessors]
[./grad_int]
type = ElementIntegralVariablePostprocessor
variable = grad_u_x
execute_on = 'INITIAL TIMESTEP_END'
[../]
[]
[BCs]
[./left]
type = DirichletBC
variable = u
boundary = left
value = 0
[../]
[./right]
type = DirichletBC
variable = u
boundary = right
value = 2
[../]
[]
[Executioner]
type = Transient
scheme = bdf2
solve_type = PJFNK
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
nl_abs_tol = 1e-10
num_steps = 2
dt = 1
[]
[Outputs]
exodus = true
[]
(modules/navier_stokes/test/tests/finite_element/ins/scalar_adr/supg/2d_advection_error_testing.i)
ax=1
ay=1
[GlobalParams]
u = ${ax}
v = ${ay}
pressure = 0
tau_type = mod
transient_term = true
[]
[Mesh]
type = GeneratedMesh
dim = 2
nx = 2
ny = 2
xmax = 1
ymax = 1
elem_type = QUAD9
[]
[Variables]
[./c]
family = LAGRANGE
order = SECOND
[../]
[]
[Kernels]
[./adv]
type = AdvectionSUPG
variable = c
forcing_func = 'ffn'
[../]
[]
[BCs]
[./all]
type = FunctionDirichletBC
variable = c
boundary = 'left right top bottom'
function = 'c_func'
[../]
[]
[Materials]
[./mat]
type = GenericConstantMaterial
prop_names = 'mu rho'
prop_values = '0 1'
[../]
[]
[Functions]
[./ffn]
type = ParsedFunction
expression = '${ax}*(0.14*pi*y*cos(0.2*pi*x*y) + 0.2*pi*cos(0.5*pi*x)) + ${ay}*(0.14*pi*x*cos(0.2*pi*x*y) + 0.4*pi*cos(pi*y))'
[../]
[./c_func]
type = ParsedFunction
expression = '0.4*sin(0.5*pi*x) + 0.4*sin(pi*y) + 0.7*sin(0.2*pi*x*y) + 0.5'
[../]
[./cx_func]
type = ParsedFunction
expression = '0.14*pi*y*cos(0.2*pi*x*y) + 0.2*pi*cos(0.5*pi*x)'
[../]
[]
# [Executioner]
# type = Steady
# petsc_options_iname = '-pc_type -pc_factor_shift_type'
# petsc_options_value = 'lu NONZERO'
# []
[Executioner]
type = Transient
num_steps = 10
petsc_options = '-snes_converged_reason -ksp_converged_reason -snes_view'
petsc_options_iname = '-pc_type -pc_factor_shift_type -pc_factor_mat_solver_package'
petsc_options_value = 'lu NONZERO superlu_dist'
line_search = 'none'
nl_rel_tol = 1e-8
nl_abs_tol = 1e-12
nl_max_its = 10
l_tol = 1e-6
l_max_its = 10
[./TimeStepper]
dt = .05
type = IterationAdaptiveDT
cutback_factor = 0.4
growth_factor = 1.2
optimal_iterations = 20
[../]
[]
[Outputs]
[./exodus]
type = Exodus
[../]
[./csv]
type = CSV
[../]
[]
[Postprocessors]
[./L2c]
type = ElementL2Error
variable = c
function = c_func
outputs = 'console' execute_on = 'timestep_end'
[../]
[./L2cx]
type = ElementL2Error
variable = cx
function = cx_func
outputs = 'console' execute_on = 'timestep_end'
[../]
[]
[AuxVariables]
[./cx]
family = MONOMIAL
order = FIRST
[../]
[]
[AuxKernels]
[./cx_aux]
type = VariableGradientComponent
component = x
variable = cx
gradient_variable = c
[../]
[]
(modules/navier_stokes/test/tests/finite_element/ins/mms/supg/supg_mms_test.i)
mu=1.5
rho=2.5
[GlobalParams]
gravity = '0 0 0'
supg = true
convective_term = true
integrate_p_by_parts = false
laplace = true
u = vel_x
v = vel_y
pressure = p
alpha = 1
order = SECOND
family = LAGRANGE
[]
[Mesh]
[gen]
type = GeneratedMeshGenerator
dim = 2
xmin = 0
xmax = 1.0
ymin = 0
ymax = 1.0
elem_type = QUAD9
nx = 4
ny = 4
[]
[./corner_node]
type = ExtraNodesetGenerator
new_boundary = 'pinned_node'
nodes = '0'
input = gen
[../]
[]
[Variables]
[./vel_x]
[../]
[./vel_y]
[../]
[./p]
order = FIRST
[../]
[]
[Kernels]
# mass
[./mass]
type = INSMass
variable = p
[../]
# x-momentum, space
[./x_momentum_space]
type = INSMomentumLaplaceForm
variable = vel_x
component = 0
forcing_func = vel_x_source_func
[../]
# y-momentum, space
[./y_momentum_space]
type = INSMomentumLaplaceForm
variable = vel_y
component = 1
forcing_func = vel_y_source_func
[../]
[./p_source]
type = BodyForce
function = p_source_func
variable = p
[../]
[]
[BCs]
[./vel_x]
type = FunctionDirichletBC
preset = false
boundary = 'left right top bottom'
function = vel_x_func
variable = vel_x
[../]
[./vel_y]
type = FunctionDirichletBC
preset = false
boundary = 'left right top bottom'
function = vel_y_func
variable = vel_y
[../]
[./p]
type = FunctionDirichletBC
preset = false
boundary = 'left right top bottom'
function = p_func
variable = p
[../]
[]
[Functions]
[./vel_x_source_func]
type = ParsedFunction
expression = '-${mu}*(-0.028*pi^2*x^2*sin(0.2*pi*x*y) - 0.028*pi^2*y^2*sin(0.2*pi*x*y) - 0.1*pi^2*sin(0.5*pi*x) - 0.4*pi^2*sin(pi*y)) + ${rho}*(0.14*pi*x*cos(0.2*pi*x*y) + 0.4*pi*cos(pi*y))*(0.6*sin(0.8*pi*x) + 0.3*sin(0.3*pi*y) + 0.2*sin(0.3*pi*x*y) + 0.3) + ${rho}*(0.14*pi*y*cos(0.2*pi*x*y) + 0.2*pi*cos(0.5*pi*x))*(0.4*sin(0.5*pi*x) + 0.4*sin(pi*y) + 0.7*sin(0.2*pi*x*y) + 0.5) + 0.1*pi*y*cos(0.2*pi*x*y) + 0.25*pi*cos(0.5*pi*x)'
[../]
[./vel_y_source_func]
type = ParsedFunction
expression = '-${mu}*(-0.018*pi^2*x^2*sin(0.3*pi*x*y) - 0.018*pi^2*y^2*sin(0.3*pi*x*y) - 0.384*pi^2*sin(0.8*pi*x) - 0.027*pi^2*sin(0.3*pi*y)) + ${rho}*(0.06*pi*x*cos(0.3*pi*x*y) + 0.09*pi*cos(0.3*pi*y))*(0.6*sin(0.8*pi*x) + 0.3*sin(0.3*pi*y) + 0.2*sin(0.3*pi*x*y) + 0.3) + ${rho}*(0.06*pi*y*cos(0.3*pi*x*y) + 0.48*pi*cos(0.8*pi*x))*(0.4*sin(0.5*pi*x) + 0.4*sin(pi*y) + 0.7*sin(0.2*pi*x*y) + 0.5) + 0.1*pi*x*cos(0.2*pi*x*y) + 0.3*pi*cos(0.3*pi*y)'
[../]
[./p_source_func]
type = ParsedFunction
expression = '-0.06*pi*x*cos(0.3*pi*x*y) - 0.14*pi*y*cos(0.2*pi*x*y) - 0.2*pi*cos(0.5*pi*x) - 0.09*pi*cos(0.3*pi*y)'
[../]
[./vel_x_func]
type = ParsedFunction
expression = '0.4*sin(0.5*pi*x) + 0.4*sin(pi*y) + 0.7*sin(0.2*pi*x*y) + 0.5'
[../]
[./vel_y_func]
type = ParsedFunction
expression = '0.6*sin(0.8*pi*x) + 0.3*sin(0.3*pi*y) + 0.2*sin(0.3*pi*x*y) + 0.3'
[../]
[./p_func]
type = ParsedFunction
expression = '0.5*sin(0.5*pi*x) + 1.0*sin(0.3*pi*y) + 0.5*sin(0.2*pi*x*y) + 0.5'
[../]
[./vxx_func]
type = ParsedFunction
expression = '0.14*pi*y*cos(0.2*pi*x*y) + 0.2*pi*cos(0.5*pi*x)'
[../]
[]
[Materials]
[./const]
type = GenericConstantMaterial
block = 0
prop_names = 'rho mu'
prop_values = '${rho} ${mu}'
[../]
[]
[Preconditioning]
[./SMP]
type = SMP
full = true
solve_type = 'NEWTON'
[../]
[]
[Executioner]
type = Steady
petsc_options = '-snes_converged_reason -ksp_converged_reason'
petsc_options_iname = '-pc_type -pc_factor_shift_type'
petsc_options_value = 'lu NONZERO'
line_search = 'none'
nl_rel_tol = 1e-12
nl_abs_tol = 1e-13
nl_max_its = 6
l_tol = 1e-6
l_max_its = 500
[]
[Outputs]
[./exodus]
type = Exodus
[../]
[./csv]
type = CSV
[../]
[]
[Postprocessors]
[./L2vel_x]
type = ElementL2Error
variable = vel_x
function = vel_x_func
outputs = 'console' execute_on = 'timestep_end'
[../]
[./L2vel_y]
variable = vel_y
function = vel_y_func
type = ElementL2Error
outputs = 'console' execute_on = 'timestep_end'
[../]
[./L2p]
variable = p
function = p_func
type = ElementL2Error
outputs = 'console' execute_on = 'timestep_end'
[../]
[./L2vxx]
variable = vxx
function = vxx_func
type = ElementL2Error
outputs = 'console' execute_on = 'timestep_end'
[../]
[]
[AuxVariables]
[./vxx]
family = MONOMIAL
order = FIRST
[../]
[]
[AuxKernels]
[./vxx]
type = VariableGradientComponent
component = x
variable = vxx
gradient_variable = vel_x
[../]
[]
(modules/navier_stokes/test/tests/finite_element/ins/mms/supg/supg_adv_dominated_mms.i)
mu=1.5e-2
rho=2.5
[GlobalParams]
gravity = '0 0 0'
supg = true
convective_term = true
integrate_p_by_parts = false
transient_term = true
laplace = true
u = vel_x
v = vel_y
pressure = p
alpha = 1e0
order = SECOND
family = LAGRANGE
[]
[Mesh]
[gen]
type = GeneratedMeshGenerator
dim = 2
xmin = 0
xmax = 1.0
ymin = 0
ymax = 1.0
elem_type = QUAD9
nx = 4
ny = 4
[]
[./corner_node]
type = ExtraNodesetGenerator
new_boundary = 'pinned_node'
nodes = '0'
input = gen
[../]
[]
[Variables]
[./vel_x]
[../]
[./vel_y]
[../]
[./p]
order = FIRST
[../]
[]
[Kernels]
# mass
[./mass]
type = INSMass
variable = p
[../]
[./x_time]
type = INSMomentumTimeDerivative
variable = vel_x
[../]
[./y_time]
type = INSMomentumTimeDerivative
variable = vel_y
[../]
# x-momentum, space
[./x_momentum_space]
type = INSMomentumLaplaceForm
variable = vel_x
component = 0
forcing_func = vel_x_source_func
[../]
# y-momentum, space
[./y_momentum_space]
type = INSMomentumLaplaceForm
variable = vel_y
component = 1
forcing_func = vel_y_source_func
[../]
[./p_source]
type = BodyForce
function = p_source_func
variable = p
[../]
[]
[BCs]
[./vel_x]
type = FunctionDirichletBC
boundary = 'left right top bottom'
function = vel_x_func
variable = vel_x
[../]
[./vel_y]
type = FunctionDirichletBC
boundary = 'left right top bottom'
function = vel_y_func
variable = vel_y
[../]
[./p]
type = FunctionDirichletBC
boundary = 'left right top bottom'
function = p_func
variable = p
[../]
[]
[Functions]
[./vel_x_source_func]
type = ParsedFunction
expression = '-${mu}*(-0.028*pi^2*x^2*sin(0.2*pi*x*y) - 0.028*pi^2*y^2*sin(0.2*pi*x*y) - 0.1*pi^2*sin(0.5*pi*x) - 0.4*pi^2*sin(pi*y)) + ${rho}*(0.14*pi*x*cos(0.2*pi*x*y) + 0.4*pi*cos(pi*y))*(0.6*sin(0.8*pi*x) + 0.3*sin(0.3*pi*y) + 0.2*sin(0.3*pi*x*y) + 0.3) + ${rho}*(0.14*pi*y*cos(0.2*pi*x*y) + 0.2*pi*cos(0.5*pi*x))*(0.4*sin(0.5*pi*x) + 0.4*sin(pi*y) + 0.7*sin(0.2*pi*x*y) + 0.5) + 0.1*pi*y*cos(0.2*pi*x*y) + 0.25*pi*cos(0.5*pi*x)'
[../]
[./vel_y_source_func]
type = ParsedFunction
expression = '-${mu}*(-0.018*pi^2*x^2*sin(0.3*pi*x*y) - 0.018*pi^2*y^2*sin(0.3*pi*x*y) - 0.384*pi^2*sin(0.8*pi*x) - 0.027*pi^2*sin(0.3*pi*y)) + ${rho}*(0.06*pi*x*cos(0.3*pi*x*y) + 0.09*pi*cos(0.3*pi*y))*(0.6*sin(0.8*pi*x) + 0.3*sin(0.3*pi*y) + 0.2*sin(0.3*pi*x*y) + 0.3) + ${rho}*(0.06*pi*y*cos(0.3*pi*x*y) + 0.48*pi*cos(0.8*pi*x))*(0.4*sin(0.5*pi*x) + 0.4*sin(pi*y) + 0.7*sin(0.2*pi*x*y) + 0.5) + 0.1*pi*x*cos(0.2*pi*x*y) + 0.3*pi*cos(0.3*pi*y)'
[../]
[./p_source_func]
type = ParsedFunction
expression = '-0.06*pi*x*cos(0.3*pi*x*y) - 0.14*pi*y*cos(0.2*pi*x*y) - 0.2*pi*cos(0.5*pi*x) - 0.09*pi*cos(0.3*pi*y)'
[../]
[./vel_x_func]
type = ParsedFunction
expression = '0.4*sin(0.5*pi*x) + 0.4*sin(pi*y) + 0.7*sin(0.2*pi*x*y) + 0.5'
[../]
[./vel_y_func]
type = ParsedFunction
expression = '0.6*sin(0.8*pi*x) + 0.3*sin(0.3*pi*y) + 0.2*sin(0.3*pi*x*y) + 0.3'
[../]
[./p_func]
type = ParsedFunction
expression = '0.5*sin(0.5*pi*x) + 1.0*sin(0.3*pi*y) + 0.5*sin(0.2*pi*x*y) + 0.5'
[../]
[./vxx_func]
type = ParsedFunction
expression = '0.14*pi*y*cos(0.2*pi*x*y) + 0.2*pi*cos(0.5*pi*x)'
[../]
[]
[Materials]
[./const]
type = GenericConstantMaterial
block = 0
prop_names = 'rho mu'
prop_values = '${rho} ${mu}'
[../]
[]
[Preconditioning]
[./SMP]
type = SMP
full = true
solve_type = 'NEWTON'
[../]
[]
[Executioner]
type = Transient
num_steps = 10
petsc_options = '-snes_converged_reason -ksp_converged_reason'
petsc_options_iname = '-pc_type -pc_factor_shift_type'
petsc_options_value = 'lu NONZERO'
line_search = 'none'
nl_rel_tol = 1e-8
nl_abs_tol = 1e-14
nl_max_its = 10
l_tol = 1e-6
l_max_its = 10
[./TimeStepper]
dt = .05
type = IterationAdaptiveDT
cutback_factor = 0.4
growth_factor = 1.2
optimal_iterations = 20
[../]
[]
[Outputs]
execute_on = 'final'
[./exodus]
type = Exodus
[../]
[./csv]
type = CSV
[../]
[]
[Postprocessors]
[./L2vel_x]
type = ElementL2Error
variable = vel_x
function = vel_x_func
outputs = 'console' execute_on = 'timestep_end'
[../]
[./L2vel_y]
variable = vel_y
function = vel_y_func
type = ElementL2Error
outputs = 'console' execute_on = 'timestep_end'
[../]
[./L2p]
variable = p
function = p_func
type = ElementL2Error
outputs = 'console' execute_on = 'timestep_end'
[../]
[./L2vxx]
variable = vxx
function = vxx_func
type = ElementL2Error
outputs = 'console' execute_on = 'timestep_end'
[../]
[]
[AuxVariables]
[./vxx]
family = MONOMIAL
order = FIRST
[../]
[]
[AuxKernels]
[./vxx]
type = VariableGradientComponent
component = x
variable = vxx
gradient_variable = vel_x
[../]
[]
(modules/electromagnetics/include/auxkernels/PotentialToFieldAux.h)
// This file is part of the MOOSE framework
// https://www.mooseframework.org
//
// All rights reserved, see COPYRIGHT for full restrictions
// https://github.com/idaholab/moose/blob/master/COPYRIGHT
//
// Licensed under LGPL 2.1, please see LICENSE for details
// https://www.gnu.org/licenses/lgpl-2.1.html
#pragma once
#include "VariableGradientComponent.h"
/**
* This AuxKernel calculates the electrostatic electric field given the
* electrostatic potential.
*/
class PotentialToFieldAux : public VariableGradientComponent
{
public:
static InputParameters validParams();
PotentialToFieldAux(const InputParameters & parameters);
protected:
virtual Real computeValue() override;
/// Sign prefactor for calculation as determined via MooseEnum (default = negative, or -1)
Real _sign;
};