From ae08c3394e91f0ff240f0c8acfed850b73a0cc71 Mon Sep 17 00:00:00 2001 From: Guillaume Giudicelli Date: Wed, 30 Oct 2024 18:19:30 -0600 Subject: [PATCH 1/2] Misc doco fixups --- framework/doc/content/source/timeintegrators/Ralston.md | 2 +- framework/src/userobjects/PropertyReadFile.C | 6 +++--- .../doc/content/source/fvbcs/NSFVHeatFluxBC.md | 2 +- .../doc/content/source/materials/ADComputeFiniteStrain.md | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/framework/doc/content/source/timeintegrators/Ralston.md b/framework/doc/content/source/timeintegrators/Ralston.md index d536f748b04f..4bf42d48cc20 100644 --- a/framework/doc/content/source/timeintegrators/Ralston.md +++ b/framework/doc/content/source/timeintegrators/Ralston.md @@ -35,7 +35,7 @@ All kernels except time-(derivative)-kernels should have the parameter `implicit time integrator. !alert warning -ExplicitRK2-derived TimeIntegrators [ExplicitMidpoint.md], [Heun.md], [Ralston.md]) and other multistage +ExplicitRK2-derived TimeIntegrators ([ExplicitMidpoint.md], [Heun.md], [Ralston.md]) and other multistage TimeIntegrators are known not to work with Materials/AuxKernels that accumulate 'state' and should be used with caution. diff --git a/framework/src/userobjects/PropertyReadFile.C b/framework/src/userobjects/PropertyReadFile.C index 5c18e012012d..61d9e7b5f3a2 100644 --- a/framework/src/userobjects/PropertyReadFile.C +++ b/framework/src/userobjects/PropertyReadFile.C @@ -303,7 +303,7 @@ PropertyReadFile::getElementData(const Elem * elem, unsigned int prop_num) const jelem, " greater than than total number of element in mesh: ", _mesh.nElem(), - ". Elements should be numbered consecutively."); + ". Elements should be numbered consecutively, and ids should start from 0."); return _reader.getData(jelem)[prop_num]; } @@ -316,7 +316,7 @@ PropertyReadFile::getNodeData(const Node * const node, const unsigned int prop_n jnode, " greater than than total number of nodes in mesh: ", _mesh.nNodes(), - ". Nodes should be numbered consecutively."); + ". Nodes should be numbered consecutively, with ids starting from 0."); return _reader.getData(jnode)[prop_num]; } @@ -334,7 +334,7 @@ PropertyReadFile::getBlockData(const Elem * elem, unsigned int prop_num) const elem_subdomain_id, " greater than than total number of blocks in mesh: ", _nblock, - ". Blocks should be numbered consecutively."); + ". Blocks should be numbered consecutively, starting from 0."); return _reader.getData(elem_subdomain_id - offset)[prop_num]; } diff --git a/modules/navier_stokes/doc/content/source/fvbcs/NSFVHeatFluxBC.md b/modules/navier_stokes/doc/content/source/fvbcs/NSFVHeatFluxBC.md index 3470c7f81310..de24b1ea90dc 100644 --- a/modules/navier_stokes/doc/content/source/fvbcs/NSFVHeatFluxBC.md +++ b/modules/navier_stokes/doc/content/source/fvbcs/NSFVHeatFluxBC.md @@ -70,7 +70,7 @@ must be provided: - `splitting = effective_thermal_conductivity`, `locality = global`: `average_kappa` and `average_kappa_solid` postprocessors, as well as `average_eps` postprocessor due to internal representation of $\kappa_f$ as $\epsilon\tilde{\kappa}_f$. -! alert note +!alert note To protect against cases where at the first time step the thermal conductivity or effective thermal conductivity might not have yet been initialized, or cases where the coupled postprocessors have not yet been diff --git a/modules/solid_mechanics/doc/content/source/materials/ADComputeFiniteStrain.md b/modules/solid_mechanics/doc/content/source/materials/ADComputeFiniteStrain.md index e3ee8d2a84fa..46f92e3320aa 100644 --- a/modules/solid_mechanics/doc/content/source/materials/ADComputeFiniteStrain.md +++ b/modules/solid_mechanics/doc/content/source/materials/ADComputeFiniteStrain.md @@ -42,7 +42,7 @@ where $\boldsymbol{x}_{n+1}$ is the position vector of materials points in $\kappa_{n+1}$, and $\boldsymbol{x}_{n}$ is the position vector of materials points in $\kappa_{n}$. -alert note title=Incremental vs Total Deformation Gradient +!alert note title=Incremental vs Total Deformation Gradient Note that $\hat{\boldsymbol{F}}$ is NOT the deformation gradient, but rather the incremental deformation gradient of $\kappa_{n+1}$ with respect to $\kappa_n$. Thus $\hat{\boldsymbol{F}} = \boldsymbol{F}_{n+1} \boldsymbol{F}_n^{-1}$, where From ced9d7ec5b7a590b85376a2e014fcc9820d237d7 Mon Sep 17 00:00:00 2001 From: Guillaume Giudicelli Date: Thu, 31 Oct 2024 08:19:54 -0600 Subject: [PATCH 2/2] Forbid using auxiliary variables for the neighbor variable in IKs closes #28977 --- .../src/interfacekernels/InterfaceKernel.C | 7 ++ .../interfacekernels/InterfaceKernelBase.C | 3 +- .../auxiliary_variables/reaction_1D_steady.i | 83 +++++++++++++++++++ .../auxiliary_variables/tests | 10 +++ 4 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 test/tests/interfacekernels/auxiliary_variables/reaction_1D_steady.i create mode 100644 test/tests/interfacekernels/auxiliary_variables/tests diff --git a/framework/src/interfacekernels/InterfaceKernel.C b/framework/src/interfacekernels/InterfaceKernel.C index 239df0998bbc..5b91f3824645 100644 --- a/framework/src/interfacekernels/InterfaceKernel.C +++ b/framework/src/interfacekernels/InterfaceKernel.C @@ -13,6 +13,7 @@ #include "Assembly.h" #include "MooseVariableFE.h" #include "SystemBase.h" +#include "AuxiliarySystem.h" #include "libmesh/quadrature.h" @@ -56,8 +57,14 @@ InterfaceKernelTempl::InterfaceKernelTempl(const InputParameters & parameters _grad_test_neighbor(_neighbor_var.gradPhiFaceNeighbor()) { + // Neighbor variable dependency is added by + // NeighborCoupleableMooseVariableDependencyIntermediateInterface addMooseVariableDependency(this->mooseVariable()); + // Disallow auxiliary variables for neighbor variables + if (_fe_problem.getAuxiliarySystem().hasVariable(_neighbor_var.name())) + paramError("neighbor_var", "Auxiliary variables may not be used as the neighbor variable"); + if (!parameters.isParamValid("boundary")) mooseError( "In order to use an interface kernel, you must specify a boundary where it will live."); diff --git a/framework/src/interfacekernels/InterfaceKernelBase.C b/framework/src/interfacekernels/InterfaceKernelBase.C index ca23e42ee9de..881e575764f5 100644 --- a/framework/src/interfacekernels/InterfaceKernelBase.C +++ b/framework/src/interfacekernels/InterfaceKernelBase.C @@ -62,7 +62,7 @@ InterfaceKernelBase::validParams() "length as diag_save_in. This vector specifies whether the corresponding aux_var should " "save-in jacobian contributions from the primary ('p') or secondary side ('s')."); params.addParamNamesToGroup("diag_save_in save_in save_in_var_side diag_save_in_var_side", - "Advanced"); + "Residual and Jacobian debug output"); // InterfaceKernels always need one layer of ghosting. params.addRelationshipManager("ElementSideNeighborLayers", @@ -98,7 +98,6 @@ InterfaceKernelBase::InterfaceKernelBase(const InputParameters & parameters) _save_in_strings(parameters.get>("save_in")), _diag_save_in_var_side(parameters.get("diag_save_in_var_side")), _diag_save_in_strings(parameters.get>("diag_save_in")) - { } diff --git a/test/tests/interfacekernels/auxiliary_variables/reaction_1D_steady.i b/test/tests/interfacekernels/auxiliary_variables/reaction_1D_steady.i new file mode 100644 index 000000000000..a7edcfbc834c --- /dev/null +++ b/test/tests/interfacekernels/auxiliary_variables/reaction_1D_steady.i @@ -0,0 +1,83 @@ +[Mesh] + [gen] + type = GeneratedMeshGenerator + dim = 1 + nx = 10 + xmax = 2 + [] + [subdomain1] + input = gen + type = SubdomainBoundingBoxGenerator + bottom_left = '1.0 0 0' + block_id = 1 + top_right = '2.0 1.0 0' + [] + [interface] + type = SideSetsBetweenSubdomainsGenerator + input = 'subdomain1' + primary_block = '0' + paired_block = '1' + new_boundary = 'primary0_interface' + [] +[] + +[Variables] + [u] + order = FIRST + family = LAGRANGE + block = '0' + [] +[] + +[AuxVariables] + [v] + order = FIRST + family = LAGRANGE + block = '1' + [] +[] + +[Kernels] + [diff_u] + type = MatDiffusion + variable = u + block = '0' + diffusivity = D + [] +[] + +[InterfaceKernels] + [interface] + type = InterfaceDiffusion + variable = u + neighbor_var = 'v' + boundary = 'primary0_interface' + D = D + D_neighbor = D + [] +[] + +[Materials] + [block0] + type = GenericConstantMaterial + block = '0' + prop_names = 'D' + prop_values = '4' + [] + [block1] + type = GenericConstantMaterial + block = '1' + prop_names = 'D' + prop_values = '2' + [] +[] + +[Executioner] + type = Steady + solve_type = PJFNK + nl_rel_tol = 1e-10 +[] + +[Problem] + kernel_coverage_check = false +[] diff --git a/test/tests/interfacekernels/auxiliary_variables/tests b/test/tests/interfacekernels/auxiliary_variables/tests new file mode 100644 index 000000000000..f292f23fbc97 --- /dev/null +++ b/test/tests/interfacekernels/auxiliary_variables/tests @@ -0,0 +1,10 @@ +[Tests] + design = 'InterfaceKernels/index.md' + [no_aux] + type = RunException + input = 'reaction_1D_steady.i' + expect_err = 'Auxiliary variables may not be used as the neighbor variable' + requirement = 'The system shall error if the error attempts to use an auxiliary variable as the neighbor variable in an interface kernel.' + issues = '#28977' + [] +[]