diff --git a/framework/include/indicators/ElementIndicator.h b/framework/include/indicators/ElementIndicator.h index f38d3854370e..a91cc15dfb0c 100644 --- a/framework/include/indicators/ElementIndicator.h +++ b/framework/include/indicators/ElementIndicator.h @@ -52,7 +52,7 @@ class ElementIndicator : public Indicator, const MooseArray & _JxW; const MooseArray & _coord; - MooseVariable & _var; + // MooseVariable & _var; /// Holds the solution at current quadrature points const VariableValue & _u; diff --git a/framework/src/indicators/ElementIndicator.C b/framework/src/indicators/ElementIndicator.C index 1e8e820b1288..a954ec802af4 100644 --- a/framework/src/indicators/ElementIndicator.C +++ b/framework/src/indicators/ElementIndicator.C @@ -10,7 +10,7 @@ #include "ElementIndicator.h" #include "Assembly.h" -#include "MooseVariableFE.h" +#include "MooseVariableField.h" #include "SystemBase.h" #include "libmesh/threads.h" @@ -51,14 +51,12 @@ ElementIndicator::ElementIndicator(const InputParameters & parameters) _JxW(_assembly.JxW()), _coord(_assembly.coordTransformation()), - _var(_subproblem.getStandardVariable(_tid, parameters.get("variable"))), - - _u(_var.sln()), - _grad_u(_var.gradSln()) + _u(mooseVariableField().sln()), + _grad_u(mooseVariableField().gradSln()) { - const std::vector & coupled_vars = getCoupledMooseVars(); + const std::vector & coupled_vars = getCoupledMooseVars(); for (const auto & var : coupled_vars) addMooseVariableDependency(var); - addMooseVariableDependency(mooseVariable()); + addMooseVariableDependency(&mooseVariableField()); } diff --git a/test/tests/indicators/analytical_indicator/analytical_indicator_fv.i b/test/tests/indicators/analytical_indicator/analytical_indicator_fv.i new file mode 100644 index 000000000000..a42cbe410eb2 --- /dev/null +++ b/test/tests/indicators/analytical_indicator/analytical_indicator_fv.i @@ -0,0 +1,80 @@ +[Mesh] + type = GeneratedMesh + dim = 2 + nx = 20 + ny = 1 +[] + +[Variables] + [u] + order = CONSTANT + family = MONOMIAL + fv = true + [] +[] + +[Problem] + kernel_coverage_check = false +[] + +[Functions] + [solution] + type = ParsedFunction + value = (exp(x)-1)/(exp(1)-1) + [] +[] + +[FVKernels] + [diff] + type = FVDiffusion + variable = u + coeff = coeff + [] + [conv] + type = FVAdvection + variable = u + velocity = '1 0 0' + [] +[] + +[FVBCs] + [left] + type = FVDirichletBC + variable = u + boundary = left + value = 0 + [] + [right] + type = FVDirichletBC + variable = u + boundary = right + value = 1 + [] +[] + +[Materials] + [diff] + type = ADGenericConstantMaterial + prop_names = 'coeff' + prop_values = '1' + [] +[] + +[Executioner] + type = Steady + solve_type = NEWTON +[] + +[Adaptivity] + [Indicators] + [error] + type = AnalyticalIndicator + variable = u + function = solution + [] + [] +[] + +[Outputs] + exodus = true +[] diff --git a/test/tests/indicators/analytical_indicator/gold/analytical_indicator_fv_out.e b/test/tests/indicators/analytical_indicator/gold/analytical_indicator_fv_out.e new file mode 100644 index 000000000000..a05c0c33770f Binary files /dev/null and b/test/tests/indicators/analytical_indicator/gold/analytical_indicator_fv_out.e differ diff --git a/test/tests/indicators/analytical_indicator/tests b/test/tests/indicators/analytical_indicator/tests index 3df474969a7f..1695ed19796e 100644 --- a/test/tests/indicators/analytical_indicator/tests +++ b/test/tests/indicators/analytical_indicator/tests @@ -1,13 +1,19 @@ [Tests] - issues = '#1275' + issues = '#1275 #16069' design = 'AnalyticalIndicator.md' - [./test] + [analytical] type = 'Exodiff' input = 'analytical_indicator_test.i' exodiff = 'analytical_indicator_test_out.e' scale_refine = 2 requirement = "The system shall include the ability to compute the square of the difference between a solution variable and an analytical function for the purpose of performing automatic mesh adaptivity." - [../] + [] + [analytical_fv] + type = 'Exodiff' + input = 'analytical_indicator_fv.i' + exodiff = 'analytical_indicator_fv_out.e' + requirement = "The system shall include the ability to compute the square of the difference between a FV solution variable and an analytical function for the purpose of performing automatic mesh adaptivity." + [] [] diff --git a/test/tests/markers/error_fraction_marker/error_fraction_marker_fv.i b/test/tests/markers/error_fraction_marker/error_fraction_marker_fv.i new file mode 100644 index 000000000000..866d8e7ec02d --- /dev/null +++ b/test/tests/markers/error_fraction_marker/error_fraction_marker_fv.i @@ -0,0 +1,92 @@ +[Mesh] + type = GeneratedMesh + dim = 2 + nx = 10 + ny = 10 +[] + +[Variables] + [u] + order = CONSTANT + family = MONOMIAL + fv = true + [] +[] + +[Problem] + kernel_coverage_check = false +[] + +[Functions] + [solution] + type = ParsedFunction + value = (exp(x)-1)/(exp(1)-1) + [] +[] + +[FVKernels] + [diff] + type = FVDiffusion + variable = u + coeff = coeff + [] + [conv] + type = FVAdvection + variable = u + velocity = '1 0 0' + [] +[] + +[FVBCs] + [left] + type = FVDirichletBC + variable = u + boundary = left + value = 0 + [] + [right] + type = FVDirichletBC + variable = u + boundary = right + value = 1 + [] +[] + +[Materials] + [diff] + type = ADGenericConstantMaterial + prop_names = 'coeff' + prop_values = '1' + [] +[] + +[Executioner] + type = Transient + num_steps = 2 + dt = 1 + solve_type = NEWTON +[] + +[Adaptivity] + marker = marker + max_h_level = 1 + [Indicators] + [error] + type = AnalyticalIndicator + variable = u + function = solution + [] + [] + [Markers] + [marker] + type = ErrorFractionMarker + coarsen = 0.1 + indicator = error + refine = 0.3 + [] + [] +[] + +[Outputs] + exodus = true +[] diff --git a/test/tests/markers/error_fraction_marker/gold/error_fraction_marker_fv_out.e-s002 b/test/tests/markers/error_fraction_marker/gold/error_fraction_marker_fv_out.e-s002 new file mode 100644 index 000000000000..c72811887dc3 Binary files /dev/null and b/test/tests/markers/error_fraction_marker/gold/error_fraction_marker_fv_out.e-s002 differ diff --git a/test/tests/markers/error_fraction_marker/tests b/test/tests/markers/error_fraction_marker/tests index 5be86bf2065d..6f038de7bdcf 100644 --- a/test/tests/markers/error_fraction_marker/tests +++ b/test/tests/markers/error_fraction_marker/tests @@ -2,17 +2,16 @@ design = 'ErrorFractionMarker.md' issues = '#1301' - [./test] + [test] type = 'Exodiff' input = 'error_fraction_marker_test.i' exodiff = 'error_fraction_marker_test_out.e' scale_refine = 2 requirement = "The system shall include a means for setting mesh refinement flags based on percent of error for a sorted vector of error values computed for each finite element." - [../] + [] - - [./no_clear] + [no_clear] type = 'Exodiff' input = 'error_fraction_marker_no_clear_test.i' exodiff = 'error_fraction_marker_no_clear_test_out.e-s003' @@ -20,5 +19,12 @@ issues = '#9914' requirement = "The system shall include the ability to use the same error extremes during all calculations of error fraction values during mesh adaptivity." - [../] + [] + [fv] + type = 'Exodiff' + input = 'error_fraction_marker_fv.i' + exodiff = 'error_fraction_marker_fv_out.e-s002' + issues = '#16069' + requirement = "The system shall include a means for setting mesh refinement flags based on percent of error for a sorted vector of error values computed for each finite element using FV variables" + [] []