diff --git a/include/dirackernels/EnthalpySink.h b/include/dirackernels/EnthalpySink.h new file mode 100644 index 00000000..eaeb15c7 --- /dev/null +++ b/include/dirackernels/EnthalpySink.h @@ -0,0 +1,36 @@ +//* 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 "DiracKernel.h" +#include "PorousFlowPolyLineSink.h" + +class SinglePhaseFluidProperties; + +/** + * Point source (or sink) that adds (removes) fluid at a mass flux rate specified by a postprocessor + */ +class EnthalpySink : public PorousFlowPolyLineSink +{ +public: + static InputParameters validParams(); + + EnthalpySink(const InputParameters & parameters); + + virtual Real computeQpBaseOutflow(unsigned current_dirac_ptid) const override; + +protected: + /// Pressure + const VariableValue & _pressure; + /// Specified inlet temperature + const Real & _T_in; + /// Fluid properties UserObject + const SinglePhaseFluidProperties & _fp; +}; diff --git a/include/dirackernels/FunctionEnthalpySink.h b/include/dirackernels/FunctionEnthalpySink.h new file mode 100644 index 00000000..0c06deb6 --- /dev/null +++ b/include/dirackernels/FunctionEnthalpySink.h @@ -0,0 +1,35 @@ +//* 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 "PorousFlowPolyLineSink.h" + +class SinglePhaseFluidProperties; +class Function; +/** + * Point source (or sink) that adds (removes) fluid at a mass flux rate specified by a postprocessor + */ +class FunctionEnthalpySink : public PorousFlowPolyLineSink +{ +public: + static InputParameters validParams(); + + FunctionEnthalpySink(const InputParameters & parameters); + + virtual Real computeQpBaseOutflow(unsigned current_dirac_ptid) const override; + +protected: + /// Pressure + const VariableValue & _pressure; + /// The function being used for evaluation + const Function & _func; + /// Fluid properties UserObject + const SinglePhaseFluidProperties & _fp; +}; diff --git a/include/dirackernels/PointEnthalpySink.h b/include/dirackernels/PointEnthalpySink.h new file mode 100644 index 00000000..d34ce82c --- /dev/null +++ b/include/dirackernels/PointEnthalpySink.h @@ -0,0 +1,46 @@ +//* 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 "DiracKernel.h" + +class SinglePhaseFluidProperties; + +/** + * Point source that adds heat energy corresponding to adding a fluid with flux rate specified by a + * postprocessor at given temperature (specified by a postprocessor). + */ +class PointEnthalpySink : public DiracKernel +{ +public: + static InputParameters validParams(); + + PointEnthalpySink(const InputParameters & parameters); + + virtual void addPoints() override; + virtual Real computeQpResidual() override; + virtual Real computeQpJacobian() override; + virtual Real computeQpOffDiagJacobian(unsigned int jvar) override; + +protected: + /// The constant mass flux (kg/s) + const PostprocessorValue & _mass_flux; + /// Pressure + const VariableValue & _pressure; + /// Quadpoint temperature + const MaterialProperty * const _temperature; + + /// Fluid properties UserObject + const SinglePhaseFluidProperties & _fp; + /// The location of the point source + const Point _p; + /// Presure variable number + unsigned int _p_var_num; +}; diff --git a/include/dirackernels/PointEnthalpySourceFromFunction.h b/include/dirackernels/PointEnthalpySourceFromFunction.h new file mode 100644 index 00000000..7af6c76e --- /dev/null +++ b/include/dirackernels/PointEnthalpySourceFromFunction.h @@ -0,0 +1,44 @@ +//* 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 "DiracKernel.h" + +class SinglePhaseFluidProperties; + +/** + * Point source that adds heat energy corresponding to adding a fluid with flux rate specified by a + * postprocessor at given temperature (specified by a postprocessor). + */ +class PointEnthalpySourceFromFunction : public DiracKernel +{ +public: + static InputParameters validParams(); + + PointEnthalpySourceFromFunction(const InputParameters & parameters); + + virtual void addPoints() override; + virtual Real computeQpResidual() override; + virtual Real computeQpJacobian() override; + virtual Real computeQpOffDiagJacobian(unsigned int jvar) override; +protected: + /// The constant mass flux (kg/s) + const PostprocessorValue & _mass_flux; + /// Pressure + const VariableValue & _pressure; + /// The function being used for inlet temperature (K) + const Function & _func; + /// Fluid properties UserObject + const SinglePhaseFluidProperties & _fp; + /// The location of the point source + const Point _p; + /// Presure variable number + unsigned int _p_var_num; +}; diff --git a/include/dirackernels/PointEnthalpySourceSinkFromFunction.h b/include/dirackernels/PointEnthalpySourceSinkFromFunction.h new file mode 100644 index 00000000..6ef6f259 --- /dev/null +++ b/include/dirackernels/PointEnthalpySourceSinkFromFunction.h @@ -0,0 +1,55 @@ +//* 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 "DiracKernel.h" +#include "PorousFlowSumQuantity.h" +class Function; +class SinglePhaseFluidProperties; +/** + * Point source (or sink) that adds (removes) fluid at a constant mass flux rate for times + * between the specified start and end times. If no start and end times are specified, + * the source (sink) starts at the start of the simulation and continues to act indefinitely + */ +class PointEnthalpySourceSinkFromFunction : public DiracKernel +{ +public: + static InputParameters validParams(); + + PointEnthalpySourceSinkFromFunction(const InputParameters & parameters); + + virtual void addPoints() override; + virtual Real computeQpResidual() override; + virtual Real computeQpJacobian() override; + virtual Real computeQpOffDiagJacobian(unsigned int jvar) override; + +protected: + /** + * This is used to hold the total fluid flowing into the line sink for each time step. + * Hence, it is positive for production wells where fluid is flowing + * from porespace into the line sink (and hence removed from the model) + */ + PorousFlowSumQuantity & _total_outflow_enthalpy; + /// The function being used for mass flux (kg/s) function + const Function & _func_mass_flux; + /// The function being used for temperature (K) function + const Function & _func_temperature; + /// Pressure + const VariableValue & _pressure; + /// Quadpoint temperature + const MaterialProperty * const _temperature; + /// Fluid properties UserObject + const SinglePhaseFluidProperties & _fp; + /// The location of the point source (sink) + const Point _p; + /// Presure variable number + unsigned int _p_var_num; + +}; diff --git a/include/dirackernels/PointSourceSinkFromFunction.h b/include/dirackernels/PointSourceSinkFromFunction.h new file mode 100644 index 00000000..541e6300 --- /dev/null +++ b/include/dirackernels/PointSourceSinkFromFunction.h @@ -0,0 +1,41 @@ +//* 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 "DiracKernel.h" +#include "PorousFlowSumQuantity.h" +class Function; +/** + * Point source (or sink) that adds (removes) fluid at a mass flux rate specified by a postprocessor + */ +class PointSourceSinkFromFunction : public DiracKernel +{ +public: + static InputParameters validParams(); + + PointSourceSinkFromFunction(const InputParameters & parameters); + + virtual void addPoints() override; + virtual Real computeQpResidual() override; + // virtual Real computeQpJacobian() override; + // virtual Real computeQpOffDiagJacobian(unsigned int jvar) override; + +protected: + /// The function being used for evaluation mass flux + const Function & _func; + /// The location of the point source (sink) + const Point _p; + /** + * This is used to hold the total fluid flowing into the line sink for each time step. + * Hence, it is positive for production wells where fluid is flowing + * from porespace into the line sink (and hence removed from the model) + */ + PorousFlowSumQuantity & _total_outflow_mass; +}; diff --git a/include/dirackernels/PorousFlowSquarePulsePointEnthalpySink.h b/include/dirackernels/PorousFlowSquarePulsePointEnthalpySink.h new file mode 100644 index 00000000..58d92ea2 --- /dev/null +++ b/include/dirackernels/PorousFlowSquarePulsePointEnthalpySink.h @@ -0,0 +1,51 @@ +//* 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 "DiracKernel.h" + +class SinglePhaseFluidProperties; + +/** + * Point source that adds heat energy corresponding to adding a fluid with flux rate specified by a + * postprocessor at given temperature (specified by a postprocessor). + */ +class PorousFlowSquarePulsePointEnthalpySink : public DiracKernel +{ +public: + static InputParameters validParams(); + + PorousFlowSquarePulsePointEnthalpySink(const InputParameters & parameters); + + virtual void addPoints() override; + virtual Real computeQpResidual() override; + virtual Real computeQpJacobian() override; + virtual Real computeQpOffDiagJacobian(unsigned int jvar) override; + +protected: + /// The constant mass flux (kg/s) + const Real _mass_flux; + /// Pressure + const VariableValue & _pressure; + /// Quadpoint temperature + const MaterialProperty * const _temperature; + + /// Fluid properties UserObject + const SinglePhaseFluidProperties & _fp; + /// The location of the point source + const Point _p; + /// The time at which the point source (sink) starts operating + const Real _start_time; + + /// The time at which the point source (sink) stops operating + const Real _end_time; + /// Presure variable number + unsigned int _p_var_num; +}; diff --git a/include/dirackernels/PorousFlowSquarePulsePointEnthalpySource.h b/include/dirackernels/PorousFlowSquarePulsePointEnthalpySource.h new file mode 100644 index 00000000..f04a6a70 --- /dev/null +++ b/include/dirackernels/PorousFlowSquarePulsePointEnthalpySource.h @@ -0,0 +1,52 @@ +//* 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 "DiracKernel.h" +class SinglePhaseFluidProperties; +/** + * Point source (or sink) that adds (removes) fluid at a constant mass flux rate for times + * between the specified start and end times. If no start and end times are specified, + * the source (sink) starts at the start of the simulation and continues to act indefinitely + */ +class PorousFlowSquarePulsePointEnthalpySource : public DiracKernel +{ +public: + static InputParameters validParams(); + + PorousFlowSquarePulsePointEnthalpySource(const InputParameters & parameters); + + virtual void addPoints() override; + virtual Real computeQpResidual() override; + virtual Real computeQpJacobian() override; + virtual Real computeQpOffDiagJacobian(unsigned int jvar) override; + +protected: + /// The constant mass flux (kg/s) + const Real _mass_flux; + /// Pressure + const VariableValue & _pressure; + /// The location of the point source (sink) + const Point _p; + /// Input temperature + const Real _temperature; + + /// Fluid properties UserObject + const SinglePhaseFluidProperties & _fp; + + /// The time at which the point source (sink) starts operating + const Real _start_time; + + /// The time at which the point source (sink) stops operating + const Real _end_time; + + /// Pressure variable number + unsigned int _p_var_num; +}; diff --git a/include/postprocessors/PorousFlowAccumulator.h b/include/postprocessors/PorousFlowAccumulator.h new file mode 100644 index 00000000..cf3a11c1 --- /dev/null +++ b/include/postprocessors/PorousFlowAccumulator.h @@ -0,0 +1,45 @@ +//* 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 "GeneralPostprocessor.h" + +class PorousFlowAccumulator; + +///template <> +///InputParameters validParams(); + +/** + * Computes the relative change rate in a post-processor value. + */ +class PorousFlowAccumulator : public GeneralPostprocessor +{ +public: + static InputParameters validParams(); + + PorousFlowAccumulator(const InputParameters & parameters); + + virtual void initialize() override; + virtual void execute() override; + virtual Real getValue() const override; + +protected: + /// current post-processor value + const PostprocessorValue & _pps_value; + + /// current time value + const PostprocessorValue & _pps_t; + + // Real _accumulator_start_time; + // Real _accumulator_end_time; + Real _accumulator; + +}; + diff --git a/include/postprocessors/PorousFlowDoubletBreakthroughTerminator.h b/include/postprocessors/PorousFlowDoubletBreakthroughTerminator.h new file mode 100644 index 00000000..b79e05b1 --- /dev/null +++ b/include/postprocessors/PorousFlowDoubletBreakthroughTerminator.h @@ -0,0 +1,41 @@ +//* 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 "GeneralPostprocessor.h" + +class PorousFlowDoubletBreakthroughTerminator; + +///template <> +///InputParameters validParams(); + +/** + * Computes the relativse change rate in a post-processor value. + */ +class PorousFlowDoubletBreakthroughTerminator : public GeneralPostprocessor +{ +public: + static InputParameters validParams(); + + PorousFlowDoubletBreakthroughTerminator(const InputParameters & parameters); + + virtual void initialize() override; + virtual void execute() override; + virtual Real getValue() const override; + +protected: + /// current post-processor value + const PostprocessorValue & _pps_value; + /// constant input + Real _temp_init_value; + Real _pps_relative_diff; + Real _keep_constant; + +}; diff --git a/include/postprocessors/PorousFlowDoubletBreakthroughTime.h b/include/postprocessors/PorousFlowDoubletBreakthroughTime.h new file mode 100644 index 00000000..8656a692 --- /dev/null +++ b/include/postprocessors/PorousFlowDoubletBreakthroughTime.h @@ -0,0 +1,41 @@ +//* 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 "GeneralPostprocessor.h" + +class PorousFlowDoubletBreakthroughTime; + +///template <> +///InputParameters validParams(); + +/** + * Computes the relative change rate in a post-processor value. + */ +class PorousFlowDoubletBreakthroughTime : public GeneralPostprocessor +{ +public: + static InputParameters validParams(); + + PorousFlowDoubletBreakthroughTime(const InputParameters & parameters); + + virtual void initialize() override; + virtual void execute() override; + virtual Real getValue() const override; + +protected: + /// current post-processor value + const PostprocessorValue & _pps_value; + const PostprocessorValue & _pps_time; + /// constant input + + Real _keep_constant; + +}; diff --git a/include/postprocessors/PorousFlowDoubletSwitch.h b/include/postprocessors/PorousFlowDoubletSwitch.h new file mode 100644 index 00000000..3d7fd5cb --- /dev/null +++ b/include/postprocessors/PorousFlowDoubletSwitch.h @@ -0,0 +1,42 @@ +//* 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 "GeneralPostprocessor.h" + +class PorousFlowDoubletSwitch; + +///template <> +///InputParameters validParams(); + +/** + * Computes the relative change rate in a post-processor value. + */ +class PorousFlowDoubletSwitch : public GeneralPostprocessor +{ +public: + static InputParameters validParams(); + + PorousFlowDoubletSwitch(const InputParameters & parameters); + + virtual void initialize() override; + virtual void execute() override; + virtual Real getValue() const override; + +protected: + /// current post-processor value + const PostprocessorValue & _pps_value; + const PostprocessorValue & _pps_time; + /// constant input + Real _temp_init_value; + Real _pps_relative_diff; + Real _charge_time; + +}; diff --git a/include/postprocessors/PorousFlowEnergyAccumulator.h b/include/postprocessors/PorousFlowEnergyAccumulator.h new file mode 100644 index 00000000..7b66bdab --- /dev/null +++ b/include/postprocessors/PorousFlowEnergyAccumulator.h @@ -0,0 +1,41 @@ +//* 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 "GeneralPostprocessor.h" + +class PorousFlowEnergyAccumulator; + +///template <> +///InputParameters validParams(); + +/** + * Computes the relative change rate in a post-processor value. + */ +class PorousFlowEnergyAccumulator : public GeneralPostprocessor +{ +public: + static InputParameters validParams(); + + PorousFlowEnergyAccumulator(const InputParameters & parameters); + + virtual void initialize() override; + virtual void execute() override; + virtual Real getValue() const override; + +protected: + /// current post-processor value + const PostprocessorValue & _pps_hot; + const PostprocessorValue & _pps_cold; + const PostprocessorValue & _pps_pro; + + Real _accumulator; + +}; diff --git a/include/postprocessors/PorousFlowRecoveryRate.h b/include/postprocessors/PorousFlowRecoveryRate.h new file mode 100644 index 00000000..885698fc --- /dev/null +++ b/include/postprocessors/PorousFlowRecoveryRate.h @@ -0,0 +1,41 @@ +//* 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 "GeneralPostprocessor.h" + +class PorousFlowRecoveryRate; + +///template <> +///InputParameters validParams(); + +/** + * Computes the relative change rate in a post-processor value. + */ +class PorousFlowRecoveryRate : public GeneralPostprocessor +{ +public: + static InputParameters validParams(); + + PorousFlowRecoveryRate(const InputParameters & parameters); + + virtual void initialize() override; + virtual void execute() override; + virtual Real getValue() const override; + +protected: + /// current post-processor value + const PostprocessorValue & _pps_hot; + const PostprocessorValue & _pps_cold; + + Real _accumulator_inj; + Real _accumulator_ext; + +}; diff --git a/include/postprocessors/PorousFlowRecoveryRateSeason.h b/include/postprocessors/PorousFlowRecoveryRateSeason.h new file mode 100644 index 00000000..9843b4b0 --- /dev/null +++ b/include/postprocessors/PorousFlowRecoveryRateSeason.h @@ -0,0 +1,43 @@ +//* 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 "GeneralPostprocessor.h" + +class PorousFlowRecoveryRateSeason; + +///template <> +///InputParameters validParams(); + +/** + * Computes the relative change rate in a post-processor value. + */ +class PorousFlowRecoveryRateSeason : public GeneralPostprocessor +{ +public: + static InputParameters validParams(); + + PorousFlowRecoveryRateSeason(const InputParameters & parameters); + + virtual void initialize() override; + virtual void execute() override; + virtual Real getValue() const override; + +protected: + /// current post-processor value + const PostprocessorValue & _pps_hot; + const PostprocessorValue & _pps_cold; + const PostprocessorValue & _pps_inj; + const PostprocessorValue & _pps_pro; + + Real _accumulator_inj; + Real _accumulator_ext; + +}; diff --git a/include/postprocessors/PorousFlowRecoveryTime.h b/include/postprocessors/PorousFlowRecoveryTime.h new file mode 100644 index 00000000..931cb16d --- /dev/null +++ b/include/postprocessors/PorousFlowRecoveryTime.h @@ -0,0 +1,39 @@ +//* 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 "GeneralPostprocessor.h" + +class PorousFlowRecoveryTime; + +///template <> +///InputParameters validParams(); + +/** + * Computes the relative change rate in a post-processor value. + */ +class PorousFlowRecoveryTime : public GeneralPostprocessor +{ +public: + static InputParameters validParams(); + + PorousFlowRecoveryTime(const InputParameters & parameters); + + virtual void initialize() override; + virtual void execute() override; + virtual Real getValue() const override; + +protected: + /// current post-processor value + const PostprocessorValue & _pps_value; + const PostprocessorValue & _pps_time; + /// constant input + +}; diff --git a/include/postprocessors/PorousFlowRecoveryTimeAccumulator.h b/include/postprocessors/PorousFlowRecoveryTimeAccumulator.h new file mode 100644 index 00000000..c61d1cfe --- /dev/null +++ b/include/postprocessors/PorousFlowRecoveryTimeAccumulator.h @@ -0,0 +1,40 @@ +//* 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 "GeneralPostprocessor.h" + +class PorousFlowRecoveryTimeAccumulator; + +///template <> +///InputParameters validParams(); + +/** + * Computes the relative change rate in a post-processor value. + */ +class PorousFlowRecoveryTimeAccumulator : public GeneralPostprocessor +{ +public: + static InputParameters validParams(); + + PorousFlowRecoveryTimeAccumulator(const InputParameters & parameters); + + virtual void initialize() override; + virtual void execute() override; + virtual Real getValue() const override; + +protected: + /// current post-processor value + const PostprocessorValue & _pps_iswinter; + const PostprocessorValue & _pps_dt; + Real _accumulator; + /// constant input + +}; diff --git a/include/postprocessors/PorousFlowSteadyStateDetection.h b/include/postprocessors/PorousFlowSteadyStateDetection.h new file mode 100644 index 00000000..fbacdf69 --- /dev/null +++ b/include/postprocessors/PorousFlowSteadyStateDetection.h @@ -0,0 +1,45 @@ +//* 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 "GeneralPostprocessor.h" + +class PorousFlowSteadyStateDetection; + +///template <> +///InputParameters validParams(); + +/** + * Computes the relative change rate in a post-processor value. + */ +class PorousFlowSteadyStateDetection : public GeneralPostprocessor +{ +public: + static InputParameters validParams(); + + PorousFlowSteadyStateDetection(const InputParameters & parameters); + + virtual void initialize() override; + virtual void execute() override; + virtual Real getValue() const override; + +protected: + /// current post-processor value + const PostprocessorValue & _pps_value; + + /// old post-processor value + const PostprocessorValue & _pps_value_old; + + /// current dt value + const PostprocessorValue & _pps_dt; + + /// old dt + const PostprocessorValue & _pps_dt_old; +}; diff --git a/include/postprocessors/PorousFlowSteadyStateTerminator.h b/include/postprocessors/PorousFlowSteadyStateTerminator.h new file mode 100644 index 00000000..0800d9e1 --- /dev/null +++ b/include/postprocessors/PorousFlowSteadyStateTerminator.h @@ -0,0 +1,44 @@ +//* 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 "GeneralPostprocessor.h" + +class PorousFlowSteadyStateTerminator; + +///template <> +///InputParameters validParams(); + +/** + * Computes the relative change rate in a post-processor value. + */ +class PorousFlowSteadyStateTerminator : public GeneralPostprocessor +{ +public: + static InputParameters validParams(); + + PorousFlowSteadyStateTerminator(const InputParameters & parameters); + + virtual void initialize() override; + virtual void execute() override; + virtual Real getValue() const override; + +protected: + /// current post-processor value + const PostprocessorValue & _pps_value; + + /// current time value + const PostprocessorValue & _pps_t; + + Real _steady_state_start_time; + Real _steady_state_end_time; + Real _steady_state_relative_diff; + +}; diff --git a/include/postprocessors/PorousFlowTemperatureDropTerminator.h b/include/postprocessors/PorousFlowTemperatureDropTerminator.h new file mode 100644 index 00000000..19846656 --- /dev/null +++ b/include/postprocessors/PorousFlowTemperatureDropTerminator.h @@ -0,0 +1,46 @@ +//* 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 "GeneralPostprocessor.h" + +class PorousFlowTemperatureDropTerminator; + +///template <> +///InputParameters validParams(); + +/** + * Computes the relative change rate in a post-processor value. + */ +class PorousFlowTemperatureDropTerminator : public GeneralPostprocessor +{ +public: + static InputParameters validParams(); + + PorousFlowTemperatureDropTerminator(const InputParameters & parameters); + + virtual void initialize() override; + virtual void execute() override; + virtual Real getValue() const override; + +protected: + + const PostprocessorValue & _pps_value_J; + + const PostprocessorValue & _pps_value_kg; + /// current time value + const PostprocessorValue & _pps_t; + + // Real _temperature_detection_cap_time; + Real _temperature_inj; + Real _temperature_init; + Real _percentile_drop; + +}; diff --git a/include/postprocessors/timestepPostprocessor.h b/include/postprocessors/timestepPostprocessor.h new file mode 100644 index 00000000..6ed09009 --- /dev/null +++ b/include/postprocessors/timestepPostprocessor.h @@ -0,0 +1,41 @@ +//* 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 "GeneralPostprocessor.h" + +class timestepPostprocessor; + +///template <> +///InputParameters validParams(); + +/** + * Computes the relative change rate in a post-processor value. + */ +class timestepPostprocessor : public GeneralPostprocessor +{ +public: + static InputParameters validParams(); + + timestepPostprocessor(const InputParameters & parameters); + + virtual void initialize() override; + virtual void execute() override; + virtual Real getValue() const override; + +protected: + /// current post-processor value + const PostprocessorValue & _pps_value; + const PostprocessorValue & _pps_time; + /// constant input + Real _pps_relative_diff; + Real _charge_time; + +}; diff --git a/src/dirackernels/EnthalpySink.C b/src/dirackernels/EnthalpySink.C new file mode 100644 index 00000000..ac2dba18 --- /dev/null +++ b/src/dirackernels/EnthalpySink.C @@ -0,0 +1,38 @@ +//* 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 + +#include "EnthalpySink.h" +#include "SinglePhaseFluidProperties.h" + +registerMooseObject("FalconApp", EnthalpySink); + +InputParameters +EnthalpySink::validParams() +{ + InputParameters params = PorousFlowPolyLineSink::validParams(); + params.addRequiredParam("fp", "The name of the user object for fluid properties"); + params.addRequiredCoupledVar("pressure", "Pressure"); + params.addRequiredParam("T_in", "The incoming fluid temperature"); + return params; +} + +EnthalpySink::EnthalpySink(const InputParameters & parameters) + : PorousFlowPolyLineSink(parameters), + _pressure(coupledValue("pressure")), + _T_in(getParam("T_in")), + _fp(getUserObject("fp")) +{ +} + +Real +EnthalpySink::computeQpBaseOutflow(unsigned current_dirac_ptid) const +{ + Real h = _fp.h_from_p_T(_pressure[_qp], _T_in); + return PorousFlowPolyLineSink::computeQpBaseOutflow(current_dirac_ptid) * h; +} diff --git a/src/dirackernels/FunctionEnthalpySink.C b/src/dirackernels/FunctionEnthalpySink.C new file mode 100644 index 00000000..a217d10a --- /dev/null +++ b/src/dirackernels/FunctionEnthalpySink.C @@ -0,0 +1,40 @@ +//* 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 + +#include "FunctionEnthalpySink.h" +#include "SinglePhaseFluidProperties.h" +#include "Function.h" + +registerMooseObject("FalconApp", FunctionEnthalpySink); + +InputParameters +FunctionEnthalpySink::validParams() +{ + InputParameters params = PorousFlowPolyLineSink::validParams(); + params.addRequiredParam("fp", "The name of the user object for fluid properties"); + params.addRequiredCoupledVar("pressure", "Pressure"); + params.addRequiredParam("function", "The forcing function."); + return params; +} + +FunctionEnthalpySink::FunctionEnthalpySink(const InputParameters & parameters) + : PorousFlowPolyLineSink(parameters), + _pressure(coupledValue("pressure")), + _func(getFunction("function")), + _fp(getUserObject("fp")) +{ +} + +Real +FunctionEnthalpySink::computeQpBaseOutflow(unsigned current_dirac_ptid) const +{ + Real _T_in = _func.value(_t, _q_point[_qp]); + Real h = _fp.h_from_p_T(_pressure[_qp], _T_in); + return PorousFlowPolyLineSink::computeQpBaseOutflow(current_dirac_ptid) * h; +} diff --git a/src/dirackernels/PointEnthalpySink.C b/src/dirackernels/PointEnthalpySink.C new file mode 100644 index 00000000..9297174c --- /dev/null +++ b/src/dirackernels/PointEnthalpySink.C @@ -0,0 +1,78 @@ +//* 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 + +#include "PointEnthalpySink.h" +#include "SinglePhaseFluidProperties.h" + +registerMooseObject("FalconApp", PointEnthalpySink); + +InputParameters +PointEnthalpySink::validParams() +{ + InputParameters params = DiracKernel::validParams(); + params.addRequiredParam( + "mass_flux", + "The postprocessor name holding the mass flux of injected fluid at this point in kg/s " + "(please ensure this is positive so that this object acts like a source)"); + params.addRequiredParam( + "fp", + "The name of the user object used to calculate the fluid properties of the injected fluid"); + params.addRequiredCoupledVar( + "pressure", "Pressure used to calculate the injected fluid enthalpy (measured in Pa)"); + params.addRequiredParam("point", "The x,y,z coordinates of the point source"); + params.addClassDescription("Point source that adds heat energy corresponding to injection of a " + "fluid with specified mass flux rate (specified by a postprocessor) " + "at given temperature (specified by a postprocessor)"); + return params; +} + +PointEnthalpySink::PointEnthalpySink( + const InputParameters & parameters) + : DiracKernel(parameters), + _mass_flux(getPostprocessorValue("mass_flux")), + _pressure(coupledValue("pressure")), + _temperature(&getMaterialProperty("PorousFlow_temperature_qp")), + _fp(getUserObject("fp")), + _p(getParam("point")), + _p_var_num(coupled("pressure")) +{ +} + +void +PointEnthalpySink::addPoints() +{ + addPoint(_p, 0); +} + +Real +PointEnthalpySink::computeQpResidual() +{ + // Negative sign to make a positive mass_flux in the input file a source + Real h = _fp.h_from_p_T(_pressure[_qp], (*_temperature)[_qp]); + return _test[_i][_qp] * _mass_flux * h; +} + +Real +PointEnthalpySink::computeQpJacobian() +{ + return 0.; +} + +Real +PointEnthalpySink::computeQpOffDiagJacobian(unsigned int jvar) +{ + if (jvar == _p_var_num) + { + Real h, dh_dp, dh_dT; + _fp.h_from_p_T(_pressure[_qp], (*_temperature)[_qp], h, dh_dp, dh_dT); + return _test[_i][_qp] * _phi[_j][_qp] * _mass_flux * dh_dp; + } + else + return 0.; +} diff --git a/src/dirackernels/PointEnthalpySourceSinkFromFunction.C b/src/dirackernels/PointEnthalpySourceSinkFromFunction.C new file mode 100644 index 00000000..9fca3165 --- /dev/null +++ b/src/dirackernels/PointEnthalpySourceSinkFromFunction.C @@ -0,0 +1,116 @@ +//* 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 + +#include "PointEnthalpySourceSinkFromFunction.h" +#include "SinglePhaseFluidProperties.h" +#include "Function.h" + +registerMooseObject("FalconApp", PointEnthalpySourceSinkFromFunction); + +InputParameters +PointEnthalpySourceSinkFromFunction::validParams() +{ + InputParameters params = DiracKernel::validParams(); + params.addRequiredParam( + "SumQuantityUO", + "User Object of type=PorousFlowSumQuantity in which to place the total " + "outflow from the line sink for each time step."); + params.addRequiredParam("mass_flux_function", + "The function holding the mass flux at this point in kg/s (positive is flux in," + "negative is flux out)"); + params.addRequiredParam("temperature_function", + "The function holding the temperature (K) of the injected fluid," + "Function value is 0 if the fluid is extracted"); + params.addRequiredCoupledVar( + "pressure", "Pressure used to calculate the injected fluid enthalpy (measured in Pa)"); + params.addRequiredParam( + "fp", + "The name of the user object used to calculate the fluid properties of the injected fluid"); + params.addRequiredParam("point", "The x,y,z coordinates of the point source"); + params.addClassDescription("Integrated Point Sink that adds/minus heat energy at a variable mass " + " flux rate and a variable temperature "); + return params; +} + +PointEnthalpySourceSinkFromFunction::PointEnthalpySourceSinkFromFunction( + const InputParameters & parameters) + : DiracKernel(parameters), + _total_outflow_enthalpy(const_cast(getUserObject("SumQuantityUO"))), + _func_mass_flux(getFunction("mass_flux_function")), + _func_temperature(getFunction("temperature_function")), + _pressure(coupledValue("pressure")), + _temperature(&getMaterialProperty("PorousFlow_temperature_qp")), + _fp(getUserObject("fp")), + _p(getParam("point")), + _p_var_num(coupled("pressure")) +{ + // zero the outflow mass + _total_outflow_enthalpy.zero(); +} + +void +PointEnthalpySourceSinkFromFunction::addPoints() +{ + _total_outflow_enthalpy.zero(); + addPoint(_p, 0); +} + +Real +PointEnthalpySourceSinkFromFunction::computeQpResidual() +{ + //check whether the fluid is injected for extracted from the point + Real _mass_flux = _func_mass_flux.value(_t, _p); + Real _T_input = _func_temperature.value(_t, _p); + // printf("_mass_flux=%f",_mass_flux); + // printf("_T_input=%f",_T_input); + Real h =0; + if ((_mass_flux>=0) && (_T_input<=0)){ //extraction + h = _fp.h_from_p_T(_pressure[_qp], (*_temperature)[_qp]); + // printf("check_extraction"); + }else if((_mass_flux<=0) && (_T_input>0)){ //injection + h = _fp.h_from_p_T(_pressure[_qp], _T_input); + // printf("check_injection"); + }else{ + mooseError(name(), "The functions of mass flux and temperature are not coordinated for injection and extraction"); + } + // printf("h=%f",h); + // The test function is used here to account for all quadrature points + _total_outflow_enthalpy.add(_test[_i][_qp]*_mass_flux * h * _dt); + // negative sign means source, while positive sign means sink + return _test[_i][_qp] * _mass_flux * h; +} + +Real +PointEnthalpySourceSinkFromFunction::computeQpJacobian() +{ + return 0.; +} + +Real +PointEnthalpySourceSinkFromFunction::computeQpOffDiagJacobian(unsigned int jvar) +{ + + if (jvar == _p_var_num) + { + Real h, dh_dp, dh_dT; + Real _mass_flux = _func_mass_flux.value(_t, _p); + Real _T_input = _func_temperature.value(_t, _p); + if ((_mass_flux>=0) && (_T_input<=0)){ //extraction + _fp.h_from_p_T(_pressure[_qp], (*_temperature)[_qp], h, dh_dp, dh_dT); + return _test[_i][_qp] * _phi[_j][_qp]* _mass_flux * dh_dp; + }else if((_mass_flux<=0) && (_T_input>0)){ //injection + _fp.h_from_p_T(_pressure[_qp], _T_input, h, dh_dp, dh_dT); + return _test[_i][_qp] * _phi[_j][_qp]* _mass_flux * dh_dp; + }else{ + mooseError(name(), "The functions of mass flux and temperature are not coordinated for injection and extraction"); + } + } + else + return 0.; +} diff --git a/src/dirackernels/PointSourceSinkFromFunction.C b/src/dirackernels/PointSourceSinkFromFunction.C new file mode 100644 index 00000000..dfe0faaa --- /dev/null +++ b/src/dirackernels/PointSourceSinkFromFunction.C @@ -0,0 +1,55 @@ +//* 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 + +#include "PointSourceSinkFromFunction.h" +#include "Function.h" + +registerMooseObject("FalconApp", PointSourceSinkFromFunction); + +InputParameters +PointSourceSinkFromFunction::validParams() +{ + InputParameters params = DiracKernel::validParams(); + params.addRequiredParam("mass_flux_function", "The function holding the mass flux at this point in kg/s (positive is flux in, " + "negative is flux out)"); + params.addRequiredParam("point", "The x,y,z coordinates of the point source (sink)"); + params.addRequiredParam( + "SumQuantityUO", + "User Object of type=PorousFlowSumQuantity in which to place the total " + "outflow from the line sink for each time step."); + params.addClassDescription("This inject or extract fluid from a point via a function"); + return params; +} + +PointSourceSinkFromFunction::PointSourceSinkFromFunction(const InputParameters & parameters) + : DiracKernel(parameters), + _func(getFunction("mass_flux_function")), + _p(getParam("point")), + _total_outflow_mass(const_cast(getUserObject("SumQuantityUO"))) +{ + // zero the outflow mass + _total_outflow_mass.zero(); +} + +void +PointSourceSinkFromFunction::addPoints() +{ + _total_outflow_mass.zero(); + addPoint(_p, 0); +} + +Real +PointSourceSinkFromFunction::computeQpResidual() +{ + Real _mass_flux = _func.value(_t, _p); + // The test function is used here to account for all quadrature points + _total_outflow_mass.add(_test[_i][_qp]*_mass_flux * _dt) ; + // Negative sign to make a positive mass_flux in the input file a source + return _test[_i][_qp] * _mass_flux; +} diff --git a/src/dirackernels/PorousFlowSquarePulsePointEnthalpySink.C b/src/dirackernels/PorousFlowSquarePulsePointEnthalpySink.C new file mode 100644 index 00000000..419830d4 --- /dev/null +++ b/src/dirackernels/PorousFlowSquarePulsePointEnthalpySink.C @@ -0,0 +1,137 @@ +//* 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 + +#include "PorousFlowSquarePulsePointEnthalpySink.h" +#include "SinglePhaseFluidProperties.h" + +registerMooseObject("FalconApp", PorousFlowSquarePulsePointEnthalpySink); + +InputParameters +PorousFlowSquarePulsePointEnthalpySink::validParams() +{ + InputParameters params = DiracKernel::validParams(); + params.addRequiredParam( + "mass_flux", + "The mass flux at this point in kg/s (positive is flux in, negative is flux out)"); + params.addRequiredParam( + "fp", + "The name of the user object used to calculate the fluid properties of the injected fluid"); + params.addRequiredCoupledVar( + "pressure", "Pressure used to calculate the injected fluid enthalpy (measured in Pa)"); + params.addRequiredParam("point", "The x,y,z coordinates of the point source"); + params.addParam( + "start_time", 0.0, "The time at which the source will start (Default is 0)"); + params.addParam( + "end_time", 1.0e30, "The time at which the source will end (Default is 1e30)"); + params.addClassDescription("Point sink that adds heat energy at a constant mass " + " flux rate " + "at given temperature (specified by a postprocessor)"); + return params; +} + +PorousFlowSquarePulsePointEnthalpySink::PorousFlowSquarePulsePointEnthalpySink( + const InputParameters & parameters) + : DiracKernel(parameters), + _mass_flux(getParam("mass_flux")), + _pressure(coupledValue("pressure")), + _temperature(&getMaterialProperty("PorousFlow_temperature_qp")), + _fp(getUserObject("fp")), + _p(getParam("point")), + _start_time(getParam("start_time")), + _end_time(getParam("end_time")), + _p_var_num(coupled("pressure")) +{ + // Sanity check to ensure that the end_time is greater than the start_time + if (_end_time <= _start_time) + mooseError(name(), + ": start time for PorousFlowSquarePulsePointEnthalpySource is ", + _start_time, + " but it must be less than end time ", + _end_time); +} + +void +PorousFlowSquarePulsePointEnthalpySink::addPoints() +{ + addPoint(_p, 0); +} + +Real +PorousFlowSquarePulsePointEnthalpySink::computeQpResidual() +{ + Real factor = 0.0; + /** + * There are six cases for the start and end time in relation to t-dt and t. + * If the interval (t-dt,t) is only partly but not fully within the (start,end) + * interval, then the mass_flux is scaled so that the total mass added + * (or removed) is correct + */ + if (_t < _start_time || _t - _dt >= _end_time) + factor = 0.0; + else if (_t - _dt < _start_time) + { + if (_t <= _end_time) + factor = (_t - _start_time) / _dt; + else + factor = (_end_time - _start_time) / _dt; + } + else + { + if (_t <= _end_time) + factor = 1.0; + else + factor = (_end_time - (_t - _dt)) / _dt; + } + // Negative sign to make a positive mass_flux in the input file a source + Real h = _fp.h_from_p_T(_pressure[_qp], (*_temperature)[_qp]); + return _test[_i][_qp] * factor * _mass_flux * h; +} + +Real +PorousFlowSquarePulsePointEnthalpySink::computeQpJacobian() +{ + return 0.; +} + +Real +PorousFlowSquarePulsePointEnthalpySink::computeQpOffDiagJacobian(unsigned int jvar) +{ + Real factor = 0.0; + + /** + * There are six cases for the start and end time in relation to t-dt and t. + * If the interval (t-dt,t) is only partly but not fully within the (start,end) + * interval, then the mass_flux is scaled so that the total mass added + * (or removed) is correct + */ + if (_t < _start_time || _t - _dt >= _end_time) + factor = 0.0; + else if (_t - _dt < _start_time) + { + if (_t <= _end_time) + factor = (_t - _start_time) / _dt; + else + factor = (_end_time - _start_time) / _dt; + } + else + { + if (_t <= _end_time) + factor = 1.0; + else + factor = (_end_time - (_t - _dt)) / _dt; + } + if (jvar == _p_var_num) + { + Real h, dh_dp, dh_dT; + _fp.h_from_p_T(_pressure[_qp], (*_temperature)[_qp], h, dh_dp, dh_dT); + return _test[_i][_qp] * _phi[_j][_qp]* factor * _mass_flux * dh_dp; + } + else + return 0.; +} diff --git a/src/dirackernels/PorousFlowSquarePulsePointEnthalpySource.C b/src/dirackernels/PorousFlowSquarePulsePointEnthalpySource.C new file mode 100644 index 00000000..37216857 --- /dev/null +++ b/src/dirackernels/PorousFlowSquarePulsePointEnthalpySource.C @@ -0,0 +1,142 @@ +//* 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 + +#include "PorousFlowSquarePulsePointEnthalpySource.h" +#include "SinglePhaseFluidProperties.h" + +registerMooseObject("FalconApp", PorousFlowSquarePulsePointEnthalpySource); + +InputParameters +PorousFlowSquarePulsePointEnthalpySource::validParams() +{ + InputParameters params = DiracKernel::validParams(); + params.addRequiredParam( + "mass_flux", + "The mass flux at this point in kg/s (positive is flux in, negative is flux out)"); + params.addRequiredParam( + "fp", + "The name of the user object used to calculate the fluid properties of the injected fluid"); + params.addRequiredCoupledVar( + "pressure", "Pressure used to calculate the injected fluid enthalpy (measured in Pa)"); + params.addRequiredParam("T_in", "The incoming fluid temperature"); + params.addRequiredParam("point", "The x,y,z coordinates of the point source (sink)"); + params.addParam( + "start_time", 0.0, "The time at which the source will start (Default is 0)"); + params.addParam( + "end_time", 1.0e30, "The time at which the source will end (Default is 1e30)"); + params.addClassDescription("Point source that adds heat energy at a constant mass " + "flux rate for times between the specified start and end times."); + return params; +} + +PorousFlowSquarePulsePointEnthalpySource::PorousFlowSquarePulsePointEnthalpySource( + const InputParameters & parameters) + : DiracKernel(parameters), + _mass_flux(getParam("mass_flux")), + _pressure(coupledValue("pressure")), + _p(getParam("point")), + _temperature(getParam("T_in")), + _fp(getUserObject("fp")), + _start_time(getParam("start_time")), + _end_time(getParam("end_time")), + _p_var_num(coupled("pressure")) +{ + // Sanity check to ensure that the end_time is greater than the start_time + if (_end_time <= _start_time) + mooseError(name(), + ": start time for PorousFlowSquarePulsePointEnthalpySource is ", + _start_time, + " but it must be less than end time ", + _end_time); +} + +void +PorousFlowSquarePulsePointEnthalpySource::addPoints() +{ + addPoint(_p, 0); +} + +Real +PorousFlowSquarePulsePointEnthalpySource::computeQpResidual() +{ + Real factor = 0.0; + + /** + * There are six cases for the start and end time in relation to t-dt and t. + * If the interval (t-dt,t) is only partly but not fully within the (start,end) + * interval, then the mass_flux is scaled so that the total mass added + * (or removed) is correct + */ + if (_t < _start_time || _t - _dt >= _end_time) + factor = 0.0; + else if (_t - _dt < _start_time) + { + if (_t <= _end_time) + factor = (_t - _start_time) / _dt; + else + factor = (_end_time - _start_time) / _dt; + } + else + { + if (_t <= _end_time) + factor = 1.0; + else + factor = (_end_time - (_t - _dt)) / _dt; + } + + // Negative sign to make a positive mass_flux in the input file a source + Real h = _fp.h_from_p_T(_pressure[_qp], _temperature); + return -_test[_i][_qp] * factor * _mass_flux * h; +} + +Real +PorousFlowSquarePulsePointEnthalpySource::computeQpJacobian() +{ + return 0.; +} + +Real +PorousFlowSquarePulsePointEnthalpySource::computeQpOffDiagJacobian(unsigned int jvar) +{ + Real factor = 0.0; + + /** + * There are six cases for the start and end time in relation to t-dt and t. + * If the interval (t-dt,t) is only partly but not fully within the (start,end) + * interval, then the mass_flux is scaled so that the total mass added + * (or removed) is correct + */ + if (_t < _start_time || _t - _dt >= _end_time) + factor = 0.0; + else if (_t - _dt < _start_time) + { + if (_t <= _end_time) + factor = (_t - _start_time) / _dt; + else + factor = (_end_time - _start_time) / _dt; + } + else + { + if (_t <= _end_time) + factor = 1.0; + else + factor = (_end_time - (_t - _dt)) / _dt; + } + + + if (jvar == _p_var_num) + { + Real h, dh_dp, dh_dT; + _fp.h_from_p_T(_pressure[_qp], _temperature, h, dh_dp, dh_dT); + return _test[_i][_qp] * _phi[_j][_qp] * factor * _mass_flux * dh_dp; + } + else + return 0.; +} + diff --git a/src/postprocessors/PorousFlowAccumulator.C b/src/postprocessors/PorousFlowAccumulator.C new file mode 100644 index 00000000..ec14254f --- /dev/null +++ b/src/postprocessors/PorousFlowAccumulator.C @@ -0,0 +1,55 @@ +//* 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 + +#include "PorousFlowAccumulator.h" + +registerMooseObject("FalconApp", PorousFlowAccumulator); + +InputParameters +PorousFlowAccumulator::validParams() +{ + InputParameters params = GeneralPostprocessor::validParams(); + params.addRequiredParam("targetpostprocessor", "The name of the targetpostprocessor"); + params.addRequiredParam("timepostprocessor", "The name of the timepostprocessor"); +/* params.addParam("accumulator_start_time", 0.0, "accumulator start time"); + params.addParam("accumulator_end_time", 0.0, "accumulator cap time"); +*/ + params.addClassDescription("accumulate the targetted post processor value"); + return params; +} + +PorousFlowAccumulator::PorousFlowAccumulator(const InputParameters & parameters) + : GeneralPostprocessor(parameters), + _pps_value(getPostprocessorValue("targetpostprocessor")), + _pps_t(getPostprocessorValue("timepostprocessor")), +/* _accumulator_start_time(getParam("accumulator_start_time")), + _accumulator_end_time(getParam("accumulator_end_time")), +*/ + _accumulator(0) +{ +} + +void +PorousFlowAccumulator::initialize() +{ +} + +void +PorousFlowAccumulator::execute() +{ +/// if (_pps_t > _accumulator_start_time && _pps_t < _accumulator_end_time) + if (_pps_value < 0) + _accumulator += _pps_value; +} + +Real +PorousFlowAccumulator::getValue() const +{ + return abs(_accumulator); +} diff --git a/src/postprocessors/PorousFlowDoubletBreakthroughTerminator.C b/src/postprocessors/PorousFlowDoubletBreakthroughTerminator.C new file mode 100644 index 00000000..37ae7b17 --- /dev/null +++ b/src/postprocessors/PorousFlowDoubletBreakthroughTerminator.C @@ -0,0 +1,53 @@ +//* 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 + +#include "PorousFlowDoubletBreakthroughTerminator.h" + +registerMooseObject("FalconApp", PorousFlowDoubletBreakthroughTerminator); + +InputParameters +PorousFlowDoubletBreakthroughTerminator::validParams() +{ + InputParameters params = GeneralPostprocessor::validParams(); + params.addRequiredParam("targetpostprocessor", "The name of the targetpostprocessor"); + params.addParam("temperature_init", 273.15, "Reservior initial temperature"); + params.addParam("temperature_tolerance", 1e-2, "Postprocessor relative tolerance"); + params.addClassDescription("provide true or false on doublet breakthrough detection"); + return params; +} + +PorousFlowDoubletBreakthroughTerminator::PorousFlowDoubletBreakthroughTerminator(const InputParameters & parameters) + : GeneralPostprocessor(parameters), + _pps_value(getPostprocessorValue("targetpostprocessor")), + _temp_init_value(getParam("temperature_init")), + _pps_relative_diff(getParam("temperature_tolerance")), + _keep_constant(0) +{ +} + +void +PorousFlowDoubletBreakthroughTerminator::initialize() +{ +} + +void +PorousFlowDoubletBreakthroughTerminator::execute() +{ + Real temp_diff = abs(_pps_value-_temp_init_value); + if (temp_diff >= _pps_relative_diff) + _keep_constant = 1; + else + _keep_constant = 0; +} + +Real +PorousFlowDoubletBreakthroughTerminator::getValue() const +{ + return _keep_constant; +} diff --git a/src/postprocessors/PorousFlowDoubletBreakthroughTime.C b/src/postprocessors/PorousFlowDoubletBreakthroughTime.C new file mode 100644 index 00000000..b779b200 --- /dev/null +++ b/src/postprocessors/PorousFlowDoubletBreakthroughTime.C @@ -0,0 +1,48 @@ +//* 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 + +#include "PorousFlowDoubletBreakthroughTime.h" + +registerMooseObject("FalconApp", PorousFlowDoubletBreakthroughTime); + +InputParameters +PorousFlowDoubletBreakthroughTime::validParams() +{ + InputParameters params = GeneralPostprocessor::validParams(); + params.addRequiredParam("breakthroughterminator", "The name of the targetpostprocessor"); + params.addRequiredParam("timepostprocessor", "The name of the timepostprocessor"); + params.addClassDescription("provide true or false on doublet breakthrough detection"); + return params; +} + +PorousFlowDoubletBreakthroughTime::PorousFlowDoubletBreakthroughTime(const InputParameters & parameters) + : GeneralPostprocessor(parameters), + _pps_value(getPostprocessorValue("breakthroughterminator")), + _pps_time(getPostprocessorValue("timepostprocessor")), + _keep_constant(0) +{ +} + +void +PorousFlowDoubletBreakthroughTime::initialize() +{ +} + +void +PorousFlowDoubletBreakthroughTime::execute() +{ + if (_keep_constant == 0 && _pps_value ==1) + _keep_constant = _pps_time/3600/24; +} + +Real +PorousFlowDoubletBreakthroughTime::getValue() const +{ + return _keep_constant; +} diff --git a/src/postprocessors/PorousFlowDoubletSwitch.C b/src/postprocessors/PorousFlowDoubletSwitch.C new file mode 100644 index 00000000..b3b58581 --- /dev/null +++ b/src/postprocessors/PorousFlowDoubletSwitch.C @@ -0,0 +1,72 @@ +//* 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 + +#include "PorousFlowDoubletSwitch.h" +#include + +registerMooseObject("FalconApp", PorousFlowDoubletSwitch); + +InputParameters +PorousFlowDoubletSwitch::validParams() +{ + InputParameters params = GeneralPostprocessor::validParams(); + params.addRequiredParam("targetpostprocessor", "The name of the targetpostprocessor"); + params.addRequiredParam("timepostprocessor", "The name of the timepostprocessor"); + params.addParam("temperature_init", 273.15, "Reservior initial temperature"); + params.addParam("temperature_tolerance", 1e-2, "Postprocessor relative tolerance"); + params.addClassDescription("provide true or false on doublet breakthrough detection"); + return params; +} + +PorousFlowDoubletSwitch::PorousFlowDoubletSwitch(const InputParameters & parameters) + : GeneralPostprocessor(parameters), + _pps_value(getPostprocessorValue("targetpostprocessor")), + _pps_time(getPostprocessorValue("timepostprocessor")), + _temp_init_value(getParam("temperature_init")), + _pps_relative_diff(getParam("temperature_tolerance")), + _charge_time(0) +{ +} + +void +PorousFlowDoubletSwitch::initialize() +{ +} + +void +PorousFlowDoubletSwitch::execute() +{ + if (_charge_time == 0) + { + if (abs(_pps_value-_temp_init_value) >= _pps_relative_diff ) + { + _charge_time = _pps_time; + } + } +} + +Real +PorousFlowDoubletSwitch::getValue() const +{ + if (_charge_time == 0) + return 0; + else + { + Real temp_time; + Real check; + temp_time = _pps_time - _charge_time; + check = temp_time/3600/24 - floor(temp_time/3600/24); + if ( check < 0.6666667 ) + return 1; + else + return 0; + } +} + + diff --git a/src/postprocessors/PorousFlowEnergyAccumulator.C b/src/postprocessors/PorousFlowEnergyAccumulator.C new file mode 100644 index 00000000..d546e1ed --- /dev/null +++ b/src/postprocessors/PorousFlowEnergyAccumulator.C @@ -0,0 +1,51 @@ +//* 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 + +#include "PorousFlowEnergyAccumulator.h" + +registerMooseObject("FalconApp", PorousFlowEnergyAccumulator); + +InputParameters +PorousFlowEnergyAccumulator::validParams() +{ + InputParameters params = GeneralPostprocessor::validParams(); + params.addRequiredParam("hotwellenergy", "The name of the enthalpy postprocessor at hot well"); + params.addRequiredParam("coldwellenergy", "The name of the enthalpy postprocessor at cold well"); + params.addRequiredParam("ProductionIndicator", "The name of the postprocessor for production indication"); + params.addClassDescription("accumulate the produced thermal enegy"); + return params; +} + +PorousFlowEnergyAccumulator::PorousFlowEnergyAccumulator(const InputParameters & parameters) + : GeneralPostprocessor(parameters), + _pps_hot(getPostprocessorValue("hotwellenergy")), + _pps_cold(getPostprocessorValue("coldwellenergy")), + _pps_pro(getPostprocessorValue("ProductionIndicator")), + _accumulator(0) +{ +} + +void +PorousFlowEnergyAccumulator::initialize() +{ +} + +void +PorousFlowEnergyAccumulator::execute() +{ + if(_pps_pro == 1 ){ + _accumulator += (_pps_hot + _pps_cold); + } +} + +Real +PorousFlowEnergyAccumulator::getValue() const +{ + return abs(_accumulator); +} diff --git a/src/postprocessors/PorousFlowRecoveryRate.C b/src/postprocessors/PorousFlowRecoveryRate.C new file mode 100644 index 00000000..294eaec3 --- /dev/null +++ b/src/postprocessors/PorousFlowRecoveryRate.C @@ -0,0 +1,60 @@ +//* 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 + +#include "PorousFlowRecoveryRate.h" + +registerMooseObject("FalconApp", PorousFlowRecoveryRate); + +InputParameters +PorousFlowRecoveryRate::validParams() +{ + InputParameters params = GeneralPostprocessor::validParams(); + params.addRequiredParam("hotwellenergy", "The name of the enthalpy postprocessor at hot well"); + params.addRequiredParam("coldwellenergy", "The name of the enthalpy postprocessor at cold well"); +/* params.addParam("accumulator_start_time", 0.0, "accumulator start time"); + params.addParam("accumulator_end_time", 0.0, "accumulator cap time"); + */ + params.addClassDescription("Calculate the recovery rate for the doublet system"); + return params; +} + +PorousFlowRecoveryRate::PorousFlowRecoveryRate(const InputParameters & parameters) + : GeneralPostprocessor(parameters), + _pps_hot(getPostprocessorValue("hotwellenergy")), + _pps_cold(getPostprocessorValue("coldwellenergy")), +/* _accumulator_start_time(getParam("accumulator_start_time")), + _accumulator_end_time(getParam("accumulator_end_time")), + */ + _accumulator_inj(0), + _accumulator_ext(0) +{ +} + +void +PorousFlowRecoveryRate::initialize() +{ +} + +void +PorousFlowRecoveryRate::execute() +{ + if (_pps_hot <= 0) + _accumulator_inj += (_pps_hot + _pps_cold); + else + _accumulator_ext += (_pps_hot + _pps_cold); +} + +Real +PorousFlowRecoveryRate::getValue() const +{ + if (_accumulator_ext == 0) + return 0; + else + return abs(_accumulator_ext)/abs(_accumulator_inj)*100; +} diff --git a/src/postprocessors/PorousFlowRecoveryRateSeason.C b/src/postprocessors/PorousFlowRecoveryRateSeason.C new file mode 100644 index 00000000..611e8ea2 --- /dev/null +++ b/src/postprocessors/PorousFlowRecoveryRateSeason.C @@ -0,0 +1,63 @@ +//* 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 + +#include "PorousFlowRecoveryRateSeason.h" + +registerMooseObject("FalconApp", PorousFlowRecoveryRateSeason); + +InputParameters +PorousFlowRecoveryRateSeason::validParams() +{ + InputParameters params = GeneralPostprocessor::validParams(); + params.addRequiredParam("hotwellenergy", "The name of the enthalpy postprocessor at hot well"); + params.addRequiredParam("coldwellenergy", "The name of the enthalpy postprocessor at cold well"); + params.addRequiredParam("InjectionIndicator", "The name of the postprocessor for injeciton indication"); + params.addRequiredParam("ProductionIndicator", "The name of the postprocessor for production indication"); +/* params.addParam("accumulator_start_time", 0.0, "accumulator start time"); + params.addParam("accumulator_end_time", 0.0, "accumulator cap time"); + */ + params.addClassDescription("Calculate the recovery rate for the doublet system"); + return params; +} + +PorousFlowRecoveryRateSeason::PorousFlowRecoveryRateSeason(const InputParameters & parameters) + : GeneralPostprocessor(parameters), + _pps_hot(getPostprocessorValue("hotwellenergy")), + _pps_cold(getPostprocessorValue("coldwellenergy")), + _pps_inj(getPostprocessorValue("InjectionIndicator")), + _pps_pro(getPostprocessorValue("ProductionIndicator")), + _accumulator_inj(0), + _accumulator_ext(0) +{ +} + +void +PorousFlowRecoveryRateSeason::initialize() +{ +} + +void +PorousFlowRecoveryRateSeason::execute() +{ + if (_pps_inj == 1){ + _accumulator_inj += (_pps_hot + _pps_cold); + }else if(_pps_pro == 1 ){ + _accumulator_ext += (_pps_hot + _pps_cold); + } + +} + +Real +PorousFlowRecoveryRateSeason::getValue() const +{ + if (_accumulator_ext == 0) + return 0; + else + return abs(_accumulator_ext)/abs(_accumulator_inj)*100; +} diff --git a/src/postprocessors/PorousFlowRecoveryTime.C b/src/postprocessors/PorousFlowRecoveryTime.C new file mode 100644 index 00000000..36df3ac3 --- /dev/null +++ b/src/postprocessors/PorousFlowRecoveryTime.C @@ -0,0 +1,45 @@ +//* 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 + +#include "PorousFlowRecoveryTime.h" + +registerMooseObject("FalconApp", PorousFlowRecoveryTime); + +InputParameters +PorousFlowRecoveryTime::validParams() +{ + InputParameters params = GeneralPostprocessor::validParams(); + params.addRequiredParam("breakthroughtime", "The name of the targetpostprocessor"); + params.addRequiredParam("timepostprocessor", "The name of the timepostprocessor"); + params.addClassDescription("provide true or false on doublet breakthrough detection"); + return params; +} + +PorousFlowRecoveryTime::PorousFlowRecoveryTime(const InputParameters & parameters) + : GeneralPostprocessor(parameters), + _pps_value(getPostprocessorValue("breakthroughtime")), + _pps_time(getPostprocessorValue("timepostprocessor")) +{ +} + +void +PorousFlowRecoveryTime::initialize() +{ +} + +void +PorousFlowRecoveryTime::execute() +{ +} + +Real +PorousFlowRecoveryTime::getValue() const +{ + return (_pps_time/3600/24 - _pps_value); +} diff --git a/src/postprocessors/PorousFlowRecoveryTimeAccumulator.C b/src/postprocessors/PorousFlowRecoveryTimeAccumulator.C new file mode 100644 index 00000000..6cad164f --- /dev/null +++ b/src/postprocessors/PorousFlowRecoveryTimeAccumulator.C @@ -0,0 +1,48 @@ +//* 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 + +#include "PorousFlowRecoveryTimeAccumulator.h" + +registerMooseObject("FalconApp", PorousFlowRecoveryTimeAccumulator); + +InputParameters +PorousFlowRecoveryTimeAccumulator::validParams() +{ + InputParameters params = GeneralPostprocessor::validParams(); + params.addRequiredParam("targetpostprocessor", "The name of the targetpostprocessor"); + params.addRequiredParam("dtpostprocessor", "The name of the dtpostprocessor"); + params.addClassDescription("provide functioning time accumulation"); + return params; +} + +PorousFlowRecoveryTimeAccumulator::PorousFlowRecoveryTimeAccumulator(const InputParameters & parameters) + : GeneralPostprocessor(parameters), + _pps_iswinter(getPostprocessorValue("targetpostprocessor")), + _pps_dt(getPostprocessorValue("dtpostprocessor")), + _accumulator(0) +{ +} + +void +PorousFlowRecoveryTimeAccumulator::initialize() +{ +} + +void +PorousFlowRecoveryTimeAccumulator::execute() +{ + if (_pps_iswinter) + _accumulator += _pps_dt; +} + +Real +PorousFlowRecoveryTimeAccumulator::getValue() const +{ + return abs(_accumulator/3600/24); +} diff --git a/src/postprocessors/PorousFlowSteadyStateDetection.C b/src/postprocessors/PorousFlowSteadyStateDetection.C new file mode 100644 index 00000000..ff0f31a3 --- /dev/null +++ b/src/postprocessors/PorousFlowSteadyStateDetection.C @@ -0,0 +1,54 @@ +//* 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 + +#include "PorousFlowSteadyStateDetection.h" + +registerMooseObject("FalconApp", PorousFlowSteadyStateDetection); + +InputParameters +PorousFlowSteadyStateDetection::validParams() +{ + InputParameters params = GeneralPostprocessor::validParams(); + params.addRequiredParam("targetpostprocessor", "The name of the targetpostprocessor"); + params.addRequiredParam("timepostprocessor", "The name of the timepostprocessor"); + params.addClassDescription("Computes the rate of relative change in a post-processor value " + "over a timestep"); + return params; +} + +PorousFlowSteadyStateDetection::PorousFlowSteadyStateDetection(const InputParameters & parameters) + : GeneralPostprocessor(parameters), + _pps_value(getPostprocessorValue("targetpostprocessor")), + _pps_value_old(getPostprocessorValueOld("targetpostprocessor")), + _pps_dt(getPostprocessorValue("timepostprocessor")), + _pps_dt_old(getPostprocessorValueOld("timepostprocessor")) +{ +} + +void +PorousFlowSteadyStateDetection::initialize() +{ +} + +void +PorousFlowSteadyStateDetection::execute() +{ +} + +Real +PorousFlowSteadyStateDetection::getValue() const +{ + // copy initial value in case difference is measured against initial value + Real change; + if (_t_step == 0) + change = 0; + else + change = (_pps_value/_pps_dt - _pps_value_old/_pps_dt_old)/(_pps_value_old/_pps_dt_old); + return std::fabs(change); +} diff --git a/src/postprocessors/PorousFlowSteadyStateTerminator.C b/src/postprocessors/PorousFlowSteadyStateTerminator.C new file mode 100644 index 00000000..2197fe6e --- /dev/null +++ b/src/postprocessors/PorousFlowSteadyStateTerminator.C @@ -0,0 +1,60 @@ +//* 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 + +#include "PorousFlowSteadyStateTerminator.h" + +registerMooseObject("FalconApp", PorousFlowSteadyStateTerminator); + +InputParameters +PorousFlowSteadyStateTerminator::validParams() +{ + InputParameters params = GeneralPostprocessor::validParams(); + params.addRequiredParam("targetpostprocessor", "The name of the targetpostprocessor"); + params.addRequiredParam("timepostprocessor", "The name of the timepostprocessor"); + params.addParam( + "ss_dection_start_time", 0.0, + "steady state dection start time"); + params.addParam( + "ss_dection_end_time", 0.0, + "steady state dection cap time"); + params.addParam( + "ss_relative_error", 1e-2, + "Postprocessor relative difference"); + params.addClassDescription("provide true or false on steadystatedetection"); + return params; +} + +PorousFlowSteadyStateTerminator::PorousFlowSteadyStateTerminator(const InputParameters & parameters) + : GeneralPostprocessor(parameters), + _pps_value(getPostprocessorValue("targetpostprocessor")), + _pps_t(getPostprocessorValue("timepostprocessor")), + _steady_state_start_time(getParam("ss_dection_start_time")), + _steady_state_end_time(getParam("ss_dection_end_time")), + _steady_state_relative_diff(getParam("ss_relative_error")) +{ +} + +void +PorousFlowSteadyStateTerminator::initialize() +{ +} + +void +PorousFlowSteadyStateTerminator::execute() +{ +} + +Real +PorousFlowSteadyStateTerminator::getValue() const +{ + if ((_pps_value <= _steady_state_relative_diff && _pps_t > _steady_state_start_time)|| _pps_t > _steady_state_end_time ) + return 1; + else + return 0; +} diff --git a/src/postprocessors/PorousFlowTemperatureDropTerminator.C b/src/postprocessors/PorousFlowTemperatureDropTerminator.C new file mode 100644 index 00000000..c23dc022 --- /dev/null +++ b/src/postprocessors/PorousFlowTemperatureDropTerminator.C @@ -0,0 +1,59 @@ +//* 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 + +#include "PorousFlowTemperatureDropTerminator.h" + +registerMooseObject("FalconApp", PorousFlowTemperatureDropTerminator); + +InputParameters +PorousFlowTemperatureDropTerminator::validParams() +{ + InputParameters params = GeneralPostprocessor::validParams(); + params.addRequiredParam("enthalpypostprocessor", "The name of the enthalpy postprocessor"); + params.addRequiredParam("masspostprocessor", "The name of the mass postprocessor"); + params.addRequiredParam("timepostprocessor", "The name of the timepostprocessor"); + params.addParam("T_inj", 0.0, "Injection fluid temperature"); + params.addParam("T_init", 0.0, "reservior intial temperature"); + params.addParam("P_drop", 1e-2, "Percent drop"); + // params.addParam("Cap_time", 0.0, "Dection cap time"); + params.addClassDescription("provide true or false on PorousFlowTemperatureDropTerminator"); + return params; +} + +PorousFlowTemperatureDropTerminator::PorousFlowTemperatureDropTerminator(const InputParameters & parameters) + : GeneralPostprocessor(parameters), + _pps_value_J(getPostprocessorValue("enthalpypostprocessor")), + _pps_value_kg(getPostprocessorValue("masspostprocessor")), + _pps_t(getPostprocessorValue("timepostprocessor")), + _temperature_inj(getParam("T_inj")), + _temperature_init(getParam("T_init")), + _percentile_drop(getParam("P_drop")) +{ +} + +void +PorousFlowTemperatureDropTerminator::initialize() +{ +} + +void +PorousFlowTemperatureDropTerminator::execute() +{ +} + +Real +PorousFlowTemperatureDropTerminator::getValue() const +{ + if (((_pps_value_J/_pps_value_kg/4186 + 273.15)-_temperature_init)/(_temperature_inj-_temperature_init) < _percentile_drop/100) + return 1; + else if (_pps_t >= 315360000) + return 1; + else + return 0; +} diff --git a/src/postprocessors/timestepPostprocessor.C b/src/postprocessors/timestepPostprocessor.C new file mode 100644 index 00000000..ea3065ab --- /dev/null +++ b/src/postprocessors/timestepPostprocessor.C @@ -0,0 +1,60 @@ +//* 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 + +#include "timestepPostprocessor.h" + +registerMooseObject("FalconApp", timestepPostprocessor); + +InputParameters +timestepPostprocessor::validParams() +{ + InputParameters params = GeneralPostprocessor::validParams(); + params.addRequiredParam("targetpostprocessor", "The name of the targetpostprocessor"); + params.addRequiredParam("timepostprocessor", "The name of the timepostprocessor"); + params.addParam("enthalpy_relative_tolerance", 1e-2, "Postprocessor relative tolerance"); + params.addClassDescription("provide true or false on doublet breakthrough detection"); + return params; +} + +timestepPostprocessor::timestepPostprocessor(const InputParameters & parameters) + : GeneralPostprocessor(parameters), + _pps_value(getPostprocessorValue("targetpostprocessor")), + _pps_time(getPostprocessorValue("timepostprocessor")), + _pps_relative_diff(getParam("enthalpy_relative_tolerance")), + _charge_time(0) +{ +} + +void +timestepPostprocessor::initialize() +{ +} + +void +timestepPostprocessor::execute() +{ + if (_charge_time == 0) + { + if ( _pps_value >= _pps_relative_diff ) + { + _charge_time = _pps_time; + } + } +} + +Real +timestepPostprocessor::getValue() const +{ + if (_charge_time == 0) + return 2592000; /// 1 months 3600*24*30 + else + return 10800; /// 6 hours +} + +