diff --git a/framework/doc/content/source/dirackernels/VectorPostprocessorPointSource.md b/framework/doc/content/source/dirackernels/VectorPostprocessorPointSource.md index 5fccb65a9433..9ef82ef516b6 100644 --- a/framework/doc/content/source/dirackernels/VectorPostprocessorPointSource.md +++ b/framework/doc/content/source/dirackernels/VectorPostprocessorPointSource.md @@ -1,14 +1,33 @@ # VectorPostprocessorPointSource -A `VectorPostprocessorPointSource` reads in multiple point sources from a VectorPostprocessor. The point source values and coordinates are updated as the vectorPostprocessor values are changed. Example syntax for a `VectorPostprocessorPointSource` used in a transient simulation is given by: +A `VectorPostprocessorPointSource` reads in multiple point sources from a `VectorPostprocessor` or `Reporter`. The point source values and coordinates are updated as the `VectorPostprocessor` or `Reporter` values are changed. + +An example of a `VectorPostprocessorPointSource` using a `Reporter` of type [ConstantReporter](/ConstantReporter.md) +and a `VectorPostrocessor` of type [CSVReader](/CSVReader.md) is given by + +!listing test/tests/dirackernels/vectorPostprocessor_point_source/2d_vpp.i block=reporter_point_source + +with the following `Reporter`: + +!listing test/tests/dirackernels/vectorPostprocessor_point_source/2d_vpp.i block=Reporters + +and `CSVReader`: + +!listing test/tests/dirackernels/vectorPostprocessor_point_source/2d_vpp.i block=VectorPostprocessors + +reading from the following csv file: + +!listing test/tests/dirackernels/vectorPostprocessor_point_source/point_value_file.csv + +The next example applies a `VectorPostprocessorPointSource` in a transient simulation given by: !listing test/tests/dirackernels/vectorPostprocessor_point_source/2d_vpp_transient.i block=DiracKernels -using the following VectorPostprocessor to provide x,y,z coordinates and `value_name = u` +using the following `VectorPostprocessor` to provide x,y,z coordinates and `value_name = u` !listing test/tests/dirackernels/vectorPostprocessor_point_source/2d_vpp_transient.i block=VectorPostprocessors/point_sample_out -Note that the `PointValueSampler` has `execute_on = timestep_begin` to force the vpp to execute prior to being used by `VectorPostprocessorPointSource`. It is also important for the `VectorPostprocessorPointSource` to never use a vpp with `contains_complete_history = true`, as this can modify the ordering of the coordinates and points. In the above input file, two locations have loads applied to them by the `VectorPostprocessorPointSource`. The load values are given by the `PointValueSampler`. +Note that the `PointValueSampler` has `execute_on = timestep_begin` to force the `VectorPostprocessor` to execute prior to being used by `VectorPostprocessorPointSource`. It is also important for the `VectorPostprocessorPointSource` to never use a `VectorPostprocessor` with `contains_complete_history = true`, as this can modify the ordering of the coordinates and points. In the above input file, two locations have loads applied to them by the `VectorPostprocessorPointSource`. The load values are given by the `PointValueSampler`. !syntax parameters /DiracKernels/VectorPostprocessorPointSource diff --git a/framework/include/dirackernels/VectorPostprocessorPointSource.h b/framework/include/dirackernels/VectorPostprocessorPointSource.h index 6389665955dd..f2dbe9e1ac66 100644 --- a/framework/include/dirackernels/VectorPostprocessorPointSource.h +++ b/framework/include/dirackernels/VectorPostprocessorPointSource.h @@ -11,6 +11,7 @@ // Moose Includes #include "DiracKernel.h" +#include "ReporterInterface.h" // Forward Declarations class VectorPostprocessorPointSource; @@ -23,7 +24,7 @@ InputParameters validParams(); * Coordinates and values are given by a vector Postprocessor. Values and coordinates for the point * source are allowed change as the vector Postprocessor is updated. */ -class VectorPostprocessorPointSource : public DiracKernel +class VectorPostprocessorPointSource : public DiracKernel, public ReporterInterface { public: static InputParameters validParams(); @@ -34,10 +35,10 @@ class VectorPostprocessorPointSource : public DiracKernel virtual Real computeQpResidual() override; private: - const VectorPostprocessorValue & _vpp_values; - const VectorPostprocessorValue & _x_coord; - const VectorPostprocessorValue & _y_coord; - const VectorPostprocessorValue & _z_coord; + const std::vector & _vpp_values; + const std::vector & _x_coord; + const std::vector & _y_coord; + const std::vector & _z_coord; /// map to associate points with their index into the vpp value std::map _point_to_index; }; diff --git a/framework/src/dirackernels/VectorPostprocessorPointSource.C b/framework/src/dirackernels/VectorPostprocessorPointSource.C index 7011464b0430..9c63f7de0b45 100644 --- a/framework/src/dirackernels/VectorPostprocessorPointSource.C +++ b/framework/src/dirackernels/VectorPostprocessorPointSource.C @@ -20,28 +20,46 @@ VectorPostprocessorPointSource::validParams() { InputParameters params = DiracKernel::validParams(); - params.addClassDescription("Apply a point load defined by VectorPostprocessor."); + params.addClassDescription("Apply a point load defined by Reporter or VectorPostprocessor."); - params.addParam( + params.addParam( "vector_postprocessor", - "The name of the VectorPostprocessor containing positions and corresponding load values"); - params.addParam("x_coord_name", "x", "name of column containing x coordinates."); - params.addParam("y_coord_name", "y", "name of column containing y coordinates."); - params.addParam("z_coord_name", "z", "name of column containing z coordinates."); - params.addParam("value_name", "value", "name of column containing values."); + "The name of the VectorPostprocessor containing positions and corresponding load values. " + "This will be appended onto the reporter name as /."); + params.addParam("x_coord_name", "x", "name of reporter containing x coordinates."); + params.addParam("y_coord_name", "y", "name of reporter containing y coordinates."); + params.addParam("z_coord_name", "z", "name of reporter containing z coordinates."); + params.addParam("value_name", "value", "name of reporter containing values."); + return params; } VectorPostprocessorPointSource::VectorPostprocessorPointSource(const InputParameters & parameters) : DiracKernel(parameters), - _vpp_values(getVectorPostprocessorValue( - "vector_postprocessor", getParam("value_name"), true)), - _x_coord(getVectorPostprocessorValue( - "vector_postprocessor", getParam("x_coord_name"), true)), - _y_coord(getVectorPostprocessorValue( - "vector_postprocessor", getParam("y_coord_name"), true)), - _z_coord(getVectorPostprocessorValue( - "vector_postprocessor", getParam("z_coord_name"), true)) + ReporterInterface(this), + _vpp_values( + isParamValid("vector_postprocessor") + ? getReporterValueByName>( + getParam("vector_postprocessor") + "/" + + getParam("value_name")) + : getReporterValueByName>(getParam("value_name"))), + _x_coord( + isParamValid("vector_postprocessor") + ? getReporterValueByName>( + getParam("vector_postprocessor") + "/" + + getParam("x_coord_name")) + : getReporterValueByName>(getParam("x_coord_name"))), + _y_coord( + isParamValid("vector_postprocessor") + ? getReporterValueByName>( + getParam("vector_postprocessor") + "/" + + getParam("y_coord_name")) + : getReporterValueByName>(getParam("y_coord_name"))), + _z_coord(isParamValid("vector_postprocessor") + ? getReporterValueByName>( + getParam("vector_postprocessor") + "/" + + getParam("z_coord_name")) + : getReporterValueByName>(getParam("z_coord_name"))) { } diff --git a/test/tests/dirackernels/vectorPostprocessor_point_source/2d_vpp.i b/test/tests/dirackernels/vectorPostprocessor_point_source/2d_vpp.i index 026ffa0bc139..d52202fcc67b 100644 --- a/test/tests/dirackernels/vectorPostprocessor_point_source/2d_vpp.i +++ b/test/tests/dirackernels/vectorPostprocessor_point_source/2d_vpp.i @@ -23,12 +23,21 @@ [] [DiracKernels] + inactive = 'reporter_point_source' [./vpp_point_source] type = VectorPostprocessorPointSource variable = u value_name = 'u' vector_postprocessor = csv_reader [../] + [./reporter_point_source] + type = VectorPostprocessorPointSource + variable = u + value_name = 'reporterData/u' + x_coord_name = 'reporterData/x' + y_coord_name = 'reporterData/y' + z_coord_name = 'reporterData/z' + [../] [] [BCs] @@ -53,6 +62,18 @@ [../] [] +[Reporters] + [reporterData] + type = ConstantReporter + real_vector_names = 'x y z u' + real_vector_values = + '0.2 0.2 0.0; + 0.3 0.8 0.0; + 0 0 0; + 1 -.5 0' + [] +[] + [Executioner] type = Steady solve_type = 'PJFNK' diff --git a/test/tests/dirackernels/vectorPostprocessor_point_source/tests b/test/tests/dirackernels/vectorPostprocessor_point_source/tests index 011e0e8389d3..5b4d966670b2 100644 --- a/test/tests/dirackernels/vectorPostprocessor_point_source/tests +++ b/test/tests/dirackernels/vectorPostprocessor_point_source/tests @@ -1,14 +1,25 @@ [Tests] - issues = '#15831' - design = 'syntax/DiracKernels/index.md' + design = 'VectorPostprocessorPointSource.md' [2dConstant] - type = 'Exodiff' - input = '2d_vpp.i' - exodiff = '2d_vpp_out.e' - requirement = "The system shall support point sources with locations and values given by a VectorPostprocessor " - "in a steady state 2D problem, reproducing the constantPointSource." + requirement = 'The system shall support point sources with locations and values given by a' + [vpp] + issues = '#15831' + type = 'Exodiff' + input = '2d_vpp.i' + exodiff = '2d_vpp_out.e' + detail = ' VectorPostprocessor in a steady state 2D problem, reproducing the constantPointSource.' + [] + [reporter] + issues = '#18528' + type = 'Exodiff' + input = '2d_vpp.i' + exodiff = '2d_vpp_out.e' + cli_args = 'DiracKernels/inactive=vpp_point_source' + detail = ' ConstantReporter in a steady state 2D problem, reproducing the constantPointSource.' + [] [] [3dConstant] + issues = '#15831' type = 'Exodiff' input = '3d_vpp.i' exodiff = '3d_vpp_out.e' @@ -16,6 +27,7 @@ "file given by a VectorPostprocessor in steady state 3D problem, reproducing the constantPointSource." [] [2dTransient] + issues = '#15831' type = 'CSVDiff' input = '2d_vpp_transient.i' csvdiff = '2d_vpp_transient_out_point_sample_out.csv'