From 20aa5b1b8830d37be393986afcb9e56dc3c6840d Mon Sep 17 00:00:00 2001 From: Ansh Chaube <31393012+anshchaube@users.noreply.github.com> Date: Sun, 24 Nov 2024 07:11:15 -0500 Subject: [PATCH] address review - updated wording, file names based on suggestions - added docstrings - simplified test, changed dt --- .../source/postprocessors/NumTimeSteps.md | 8 +- .../include/postprocessors/NumTimeSteps.h | 3 + .../num_time_steps/gold/moose_out.csv | 12 --- .../num_time_steps/gold/numtimesteps_out.csv | 12 +++ .../postprocessors/num_time_steps/moose.i | 98 ------------------- .../num_time_steps/numtimesteps.i | 23 +++++ .../tests/postprocessors/num_time_steps/tests | 4 +- 7 files changed, 42 insertions(+), 118 deletions(-) delete mode 100644 test/tests/postprocessors/num_time_steps/gold/moose_out.csv create mode 100644 test/tests/postprocessors/num_time_steps/gold/numtimesteps_out.csv delete mode 100644 test/tests/postprocessors/num_time_steps/moose.i create mode 100644 test/tests/postprocessors/num_time_steps/numtimesteps.i diff --git a/framework/doc/content/source/postprocessors/NumTimeSteps.md b/framework/doc/content/source/postprocessors/NumTimeSteps.md index aa02c0df56c0..a64b5b6b9014 100644 --- a/framework/doc/content/source/postprocessors/NumTimeSteps.md +++ b/framework/doc/content/source/postprocessors/NumTimeSteps.md @@ -1,14 +1,10 @@ -# TimestepSize +# NumTimeSteps !syntax description /Postprocessors/NumTimeSteps -## Description - -`NumTimeSteps` reports the timestep size. - ## Example Input Syntax -!listing /Users/achaube/tools/moose/test/tests/postprocessors/num_time_steps/moose.i block=Postprocessors +!listing /Users/achaube/tools/moose/test/tests/postprocessors/num_time_steps/numtimesteps.i block=Postprocessors !syntax parameters /Postprocessors/NumTimeSteps diff --git a/framework/include/postprocessors/NumTimeSteps.h b/framework/include/postprocessors/NumTimeSteps.h index 58f5c90190bc..fc6b7b2b43c5 100644 --- a/framework/include/postprocessors/NumTimeSteps.h +++ b/framework/include/postprocessors/NumTimeSteps.h @@ -11,6 +11,9 @@ #include "GeneralPostprocessor.h" +/** + * Reports on the number of time steps already taken in the transient + */ class NumTimeSteps : public GeneralPostprocessor { public: diff --git a/test/tests/postprocessors/num_time_steps/gold/moose_out.csv b/test/tests/postprocessors/num_time_steps/gold/moose_out.csv deleted file mode 100644 index d7a5fc759cf3..000000000000 --- a/test/tests/postprocessors/num_time_steps/gold/moose_out.csv +++ /dev/null @@ -1,12 +0,0 @@ -time,timestep_ctr -0,0 -1,1 -2,2 -3,3 -4,4 -5,5 -6,6 -7,7 -8,8 -9,9 -10,10 diff --git a/test/tests/postprocessors/num_time_steps/gold/numtimesteps_out.csv b/test/tests/postprocessors/num_time_steps/gold/numtimesteps_out.csv new file mode 100644 index 000000000000..2c892a836f9e --- /dev/null +++ b/test/tests/postprocessors/num_time_steps/gold/numtimesteps_out.csv @@ -0,0 +1,12 @@ +time,timestep_ctr +0,0 +0.001,1 +0.002,2 +0.003,3 +0.004,4 +0.005,5 +0.006,6 +0.007,7 +0.008,8 +0.009,9 +0.01,10 diff --git a/test/tests/postprocessors/num_time_steps/moose.i b/test/tests/postprocessors/num_time_steps/moose.i deleted file mode 100644 index d7e6d3b3f5a9..000000000000 --- a/test/tests/postprocessors/num_time_steps/moose.i +++ /dev/null @@ -1,98 +0,0 @@ -[Mesh] - type = GeneratedMesh - dim = 3 - nx = 30 - ny = 30 - nz = 30 -[] - -[Variables] - [temperature] - initial_condition = 500.0 - [] -[] - -[AuxVariables] - [source] - [] -[] - -[Kernels] - [conduction] - type = HeatConduction - variable = temperature - [] - [source] - type = CoupledForce - variable = temperature - v = source - [] -[] - -[AuxKernels] - [source] - type = ParsedAux - variable = source - function = 'temperature*7*t' - coupled_variables = 'temperature' - execute_on = 'linear' - use_xyzt = true - [] -[] - -[BCs] - [left] - type = DirichletBC - variable = temperature - boundary = 'left' - value = 500.0 - [] - [right] - type = DirichletBC - variable = temperature - boundary = 'right' - value = 600.0 - [] - [top] - type = DirichletBC - variable = temperature - boundary = 'top' - value = 650.0 - [] - [front] - type = DirichletBC - variable = temperature - boundary = 'front' - value = 650.0 - [] -[] - -[Materials] - [k] - type = GenericConstantMaterial - prop_names = 'thermal_conductivity' - prop_values = '1.5' - [] -[] - -[Postprocessors] - [timestep_ctr] - type = NumTimeSteps - [] -[] - - -[Executioner] - type = Transient - nl_abs_tol = 1e-10 - nl_rel_tol = 1e-4 - dt = 1 - num_steps = 10 -[] - -[Outputs] - exodus = false - csv = true - hide = 'source temperature' -[] - diff --git a/test/tests/postprocessors/num_time_steps/numtimesteps.i b/test/tests/postprocessors/num_time_steps/numtimesteps.i new file mode 100644 index 000000000000..2991ea9ff690 --- /dev/null +++ b/test/tests/postprocessors/num_time_steps/numtimesteps.i @@ -0,0 +1,23 @@ +[Mesh/gmg] + type = GeneratedMeshGenerator + dim = 1 +[] + +[Postprocessors/timestep_ctr] + type = NumTimeSteps +[] + +[Problem] + solve = False +[] + +[Executioner] + type = Transient + dt = 0.001 + num_steps = 10 +[] + +[Outputs] + csv = true + exodus = false +[] diff --git a/test/tests/postprocessors/num_time_steps/tests b/test/tests/postprocessors/num_time_steps/tests index 4b7be1e6a7e1..c62c3b549d23 100644 --- a/test/tests/postprocessors/num_time_steps/tests +++ b/test/tests/postprocessors/num_time_steps/tests @@ -3,7 +3,7 @@ type = 'CSVDiff' input = 'numtimesteps.i' csvdiff = 'numtimesteps_out.csv' - requirement = 'The postprocessor `NumTimeSteps` shall count the number of time-steps accurately' - 'over the course of a transient solve' + requirement = 'The postprocessor shall be able to count the number of time-steps that have been taken ' + 'over the course of the simulation of a transient.' [] []