diff --git a/include/base/foam/fvCFD_moose.h b/include/base/foam/fvCFD_moose.h index 27a08f1a..1c685f15 100644 --- a/include/base/foam/fvCFD_moose.h +++ b/include/base/foam/fvCFD_moose.h @@ -44,4 +44,9 @@ #include #include +// FoamSideIntegratedFunctionObject.h +#include +#include +#include + #undef NotImplemented diff --git a/include/postprocessors/FoamPostprocessorBase.h b/include/postprocessors/FoamPostprocessorBase.h new file mode 100644 index 00000000..fbb6f01f --- /dev/null +++ b/include/postprocessors/FoamPostprocessorBase.h @@ -0,0 +1,32 @@ +#pragma once + +#include "fvCFD_moose.h" + +#include "InputParameters.h" +#include "Postprocessor.h" +#include "ElementUserObject.h" + +class FoamPostprocessorBase : public ElementUserObject, public Postprocessor +{ +public: + static InputParameters validParams(); + + FoamPostprocessorBase(const InputParameters & params); + + // We dont want the usual UserObject functions to be executed + // But we still want the Foam Postprocessors to be reported with the other + // Foam postprocessors + virtual void initialize() final; + + virtual void execute() final; + + virtual void finalize() final; + + virtual void threadJoin([[maybe_unused]] const UserObject & uo) final {}; + + // Compute postprocessor, to be called within FoamProblem + virtual void compute() = 0; + +protected: + Foam::fvMesh * _foam_mesh; +}; diff --git a/include/postprocessors/FoamSideAdvectiveFluxIntegral.h b/include/postprocessors/FoamSideAdvectiveFluxIntegral.h new file mode 100644 index 00000000..1fce7755 --- /dev/null +++ b/include/postprocessors/FoamSideAdvectiveFluxIntegral.h @@ -0,0 +1,20 @@ +#pragma once +#include "FoamSidePostprocessor.h" + +class FoamSideAdvectiveFluxIntegral : public FoamSidePostprocessor +{ +public: + static InputParameters validParams(); + + FoamSideAdvectiveFluxIntegral(const InputParameters & params); + + virtual PostprocessorValue getValue() const override; + + virtual void compute() override; + +protected: + Real _value; + + std::string _foam_scalar; + std::string _advection_velocity; +}; diff --git a/include/postprocessors/FoamSideAverageFunctionObject.h b/include/postprocessors/FoamSideAverageFunctionObject.h new file mode 100644 index 00000000..c74bee38 --- /dev/null +++ b/include/postprocessors/FoamSideAverageFunctionObject.h @@ -0,0 +1,17 @@ +#pragma once + +#include "FoamSideIntegratedFunctionObject.h" +#include "InputParameters.h" + +class FoamSideAverageFunctionObject : public FoamSideIntegratedFunctionObject +{ +public: + static InputParameters validParams(); + + FoamSideAverageFunctionObject(const InputParameters & params) + : FoamSideIntegratedFunctionObject(params) + { + } + + virtual void compute() override; +}; diff --git a/include/postprocessors/FoamSideAverageValue.h b/include/postprocessors/FoamSideAverageValue.h new file mode 100644 index 00000000..12623583 --- /dev/null +++ b/include/postprocessors/FoamSideAverageValue.h @@ -0,0 +1,13 @@ +#pragma once +#include "FoamSideIntegratedValue.h" +#include "InputParameters.h" + +class FoamSideAverageValue : public FoamSideIntegratedValue +{ +public: + static InputParameters validParams(); + + FoamSideAverageValue(const InputParameters & params); + + virtual void compute() override; +}; diff --git a/include/postprocessors/FoamSideIntegratedBase.h b/include/postprocessors/FoamSideIntegratedBase.h new file mode 100644 index 00000000..d71e533c --- /dev/null +++ b/include/postprocessors/FoamSideIntegratedBase.h @@ -0,0 +1,19 @@ +#pragma once +#include "FoamSidePostprocessor.h" + +class FoamSideIntegratedBase : public FoamSidePostprocessor +{ +public: + static InputParameters validParams(); + + FoamSideIntegratedBase(const InputParameters & params); + + virtual PostprocessorValue getValue() const override; + +protected: + virtual Real integrateValue(const std::string & variable); + + Real getArea(); + + Real _value; +}; diff --git a/include/postprocessors/FoamSideIntegratedFunctionObject.h b/include/postprocessors/FoamSideIntegratedFunctionObject.h new file mode 100644 index 00000000..4917a929 --- /dev/null +++ b/include/postprocessors/FoamSideIntegratedFunctionObject.h @@ -0,0 +1,22 @@ +#pragma once + +#include "FoamSideIntegratedBase.h" +#include "InputParameters.h" + +#include + +class FoamSideIntegratedFunctionObject : public FoamSideIntegratedBase +{ +public: + static InputParameters validParams(); + + FoamSideIntegratedFunctionObject(const InputParameters & params); + + virtual void compute() override; + +protected: + /// Creates function objects to be executed by compute + std::unique_ptr createFunctionObject(const std::string & fo_name); + + std::unique_ptr _function_object; +}; diff --git a/include/postprocessors/FoamSideIntegratedValue.h b/include/postprocessors/FoamSideIntegratedValue.h new file mode 100644 index 00000000..fb25bfb3 --- /dev/null +++ b/include/postprocessors/FoamSideIntegratedValue.h @@ -0,0 +1,15 @@ +#pragma once +#include "FoamSideIntegratedBase.h" + +class FoamSideIntegratedValue : public FoamSideIntegratedBase +{ +public: + static InputParameters validParams(); + + FoamSideIntegratedValue(const InputParameters & params); + + virtual void compute() override; + +protected: + const std::string & _foam_variable; +}; diff --git a/include/postprocessors/FoamSidePostprocessor.h b/include/postprocessors/FoamSidePostprocessor.h new file mode 100644 index 00000000..060e661e --- /dev/null +++ b/include/postprocessors/FoamSidePostprocessor.h @@ -0,0 +1,15 @@ +#pragma once + +#include "FoamPostprocessorBase.h" +#include "MooseTypes.h" + +class FoamSidePostprocessor : public FoamPostprocessorBase +{ +public: + static InputParameters validParams(); + + FoamSidePostprocessor(const InputParameters & params); + +protected: + std::vector _boundary; +}; diff --git a/include/problems/FoamProblem.h b/include/problems/FoamProblem.h index 1d3d4736..dae211f0 100644 --- a/include/problems/FoamProblem.h +++ b/include/problems/FoamProblem.h @@ -1,6 +1,7 @@ #pragma once #include "FoamMesh.h" +#include "FoamPostprocessorBase.h" #include "FoamSolver.h" #include "FoamVariableField.h" #include "FoamBCBase.h" @@ -42,9 +43,13 @@ class FoamProblem : public ExternalProblem // check FoamBCs and print summarising table void verifyFoamBCs(); + // check FoamPostprocessors and print summarising table + void verifyFoamPostprocessors(); + FoamMesh * _foam_mesh = nullptr; Hippo::FoamSolver _solver; std::vector _foam_variables; std::vector _foam_bcs; + std::vector _foam_postprocessor; }; diff --git a/src/postprocessors/FoamPostprocessorBase.C b/src/postprocessors/FoamPostprocessorBase.C new file mode 100644 index 00000000..90c2b05c --- /dev/null +++ b/src/postprocessors/FoamPostprocessorBase.C @@ -0,0 +1,39 @@ +#include "FoamMesh.h" +#include "FoamPostprocessorBase.h" +#include "InputParameters.h" +#include "Postprocessor.h" +#include "ElementUserObject.h" +#include "FoamProblem.h" + +InputParameters +FoamPostprocessorBase::validParams() +{ + auto params = ElementUserObject::validParams(); + params += Postprocessor::validParams(); + return params; +} + +FoamPostprocessorBase::FoamPostprocessorBase(const InputParameters & params) + : ElementUserObject(params), Postprocessor(this), _foam_mesh(nullptr) +{ + FoamProblem * problem = dynamic_cast(&getSubProblem()); + if (!problem) + mooseError("Foam-based Postprocessors can only be used with FoamProblem"); + + _foam_mesh = &problem->mesh().fvMesh(); +} + +void +FoamPostprocessorBase::initialize() +{ +} + +void +FoamPostprocessorBase::execute() +{ +} + +void +FoamPostprocessorBase::finalize() +{ +} diff --git a/src/postprocessors/FoamSideAdvectiveFluxIntegral.C b/src/postprocessors/FoamSideAdvectiveFluxIntegral.C new file mode 100644 index 00000000..0d3e1fd4 --- /dev/null +++ b/src/postprocessors/FoamSideAdvectiveFluxIntegral.C @@ -0,0 +1,64 @@ +#include "FoamSideAdvectiveFluxIntegral.h" +#include "InputParameters.h" +#include "MooseTypes.h" + +registerMooseObject("hippoApp", FoamSideAdvectiveFluxIntegral); + +InputParameters +FoamSideAdvectiveFluxIntegral::validParams() +{ + auto params = FoamSidePostprocessor::validParams(); + params.addClassDescription("Class that calculates the integrated advective flux of a scalar over " + "OpenFOAM boundary patches."); + params.addRequiredParam("foam_scalar", "Foam scalar being advected."); + params.addParam("advective_velocity", "U", "Advection velocity"); + return params; +} + +FoamSideAdvectiveFluxIntegral::FoamSideAdvectiveFluxIntegral(const InputParameters & params) + : FoamSidePostprocessor(params), + _value(0.), + _foam_scalar(params.get("foam_scalar")), + _advection_velocity(params.get("advective_velocity")) +{ + + if (!_foam_mesh->foundObject(_foam_scalar)) + mooseError("foam_scalar '", _foam_scalar, "' not found."); + + if (!_foam_mesh->foundObject(_advection_velocity)) + mooseError("advective_velocity '", _advection_velocity, "' not found."); +} + +void +FoamSideAdvectiveFluxIntegral::compute() +{ + _value = 0.; + for (auto & boundary : _boundary) + { + auto & var_array = + _foam_mesh->boundary()[boundary].lookupPatchField( + _foam_scalar); + + auto & vel_array = + _foam_mesh->boundary()[boundary].lookupPatchField( + _advection_velocity); + + auto & areas = _foam_mesh->boundary()[boundary].magSf(); + auto && normals = _foam_mesh->boundary()[boundary].nf(); + + // integrate locally + for (int i = 0; i < var_array.size(); ++i) + { + _value += var_array[i] * areas[i] * (normals->data()[i] & vel_array[i]); + } + } + + // Sum across ranks + gatherSum(_value); +} + +PostprocessorValue +FoamSideAdvectiveFluxIntegral::getValue() const +{ + return _value; +} diff --git a/src/postprocessors/FoamSideAverageFunctionObject.C b/src/postprocessors/FoamSideAverageFunctionObject.C new file mode 100644 index 00000000..4fda2118 --- /dev/null +++ b/src/postprocessors/FoamSideAverageFunctionObject.C @@ -0,0 +1,19 @@ +#include "FoamSideAverageFunctionObject.h" + +registerMooseObject("hippoApp", FoamSideAverageFunctionObject); + +InputParameters +FoamSideAverageFunctionObject::validParams() +{ + InputParameters params = FoamSideIntegratedFunctionObject::validParams(); + params.addClassDescription( + "Class that averages a function object over OpenFOAM boundary patches."); + return params; +} + +void +FoamSideAverageFunctionObject::compute() +{ + _function_object->execute(); + _value = integrateValue(_function_object->name()) / getArea(); +} diff --git a/src/postprocessors/FoamSideAverageValue.C b/src/postprocessors/FoamSideAverageValue.C new file mode 100644 index 00000000..60cc3894 --- /dev/null +++ b/src/postprocessors/FoamSideAverageValue.C @@ -0,0 +1,23 @@ +#include "FoamSideAverageValue.h" +#include "InputParameters.h" + +registerMooseObject("hippoApp", FoamSideAverageValue); + +InputParameters +FoamSideAverageValue::validParams() +{ + InputParameters params = FoamSideIntegratedValue::validParams(); + params.addClassDescription("Class that averages a variable over OpenFOAM boundary patches."); + return params; +} + +FoamSideAverageValue::FoamSideAverageValue(const InputParameters & params) + : FoamSideIntegratedValue(params) +{ +} + +void +FoamSideAverageValue::compute() +{ + _value = integrateValue(_foam_variable) / getArea(); +} diff --git a/src/postprocessors/FoamSideIntegratedBase.C b/src/postprocessors/FoamSideIntegratedBase.C new file mode 100644 index 00000000..6a76cbb1 --- /dev/null +++ b/src/postprocessors/FoamSideIntegratedBase.C @@ -0,0 +1,92 @@ +#include "FoamSideIntegratedBase.h" +#include "MooseEnum.h" +#include "MooseTypes.h" +#include + +InputParameters +FoamSideIntegratedBase::validParams() +{ + MooseEnum components("x y z normal magnitude", "magnitude"); + auto params = FoamSidePostprocessor::validParams(); + params.addParam( + "component", components, "If foam variable is a vector, which component to output"); + return params; +} + +FoamSideIntegratedBase::FoamSideIntegratedBase(const InputParameters & params) + : FoamSidePostprocessor(params), _value(0.) +{ +} + +PostprocessorValue +FoamSideIntegratedBase::getValue() const +{ + return _value; +} + +Real +FoamSideIntegratedBase::integrateValue(const std::string & variable) +{ + + Real value = 0.; + // loop over boundary ids + for (auto & boundary : _boundary) + { + auto & areas = _foam_mesh->boundary()[boundary].magSf(); + Foam::Field var_array; + + if (_foam_mesh->foundObject(variable)) + { + // get vector data associated with the boundary + auto & vec_data = + _foam_mesh->boundary()[boundary].lookupPatchField(variable); + + // get the component specified in parameters and get the + // component of the vector in that direction + auto components = parameters().get("component"); + if (components == "normal") + { + auto && normals = _foam_mesh->boundary()[boundary].nf(); + var_array = normals & vec_data; + } + else if (components == "magnitude") + var_array = Foam::mag(vec_data); + else + var_array = vec_data.component(int(components)); + } + else + { + var_array = + _foam_mesh->boundary()[boundary].lookupPatchField(variable); + } + + // Integrate + for (int i = 0; i < var_array.size(); ++i) + { + value += var_array[i] * areas[i]; + } + } + + // sum over ranks + gatherSum(value); + + return value; +} + +Real +FoamSideIntegratedBase::getArea() +{ + Real area = 0.; + // loop over boundary ids + for (auto & boundary : _boundary) + { + auto & areas = _foam_mesh->boundary()[boundary].magSf(); + for (int i = 0; i < areas.size(); ++i) + { + area += areas[i]; + } + } + // sum over ranks + gatherSum(area); + return area; +} diff --git a/src/postprocessors/FoamSideIntegratedFunctionObject.C b/src/postprocessors/FoamSideIntegratedFunctionObject.C new file mode 100644 index 00000000..f14b8b3c --- /dev/null +++ b/src/postprocessors/FoamSideIntegratedFunctionObject.C @@ -0,0 +1,53 @@ +#include "FoamSideIntegratedFunctionObject.h" +#include "InputParameters.h" +#include "MooseEnum.h" + +registerMooseObject("hippoApp", FoamSideIntegratedFunctionObject); + +InputParameters +FoamSideIntegratedFunctionObject::validParams() +{ + InputParameters params = FoamSideIntegratedBase::validParams(); + + MooseEnum function_objects("wallHeatFlux wallShearStress"); + params.addRequiredParam( + "function_object", function_objects, "OpenFOAM function object"); + params.addClassDescription( + "Class that integrates a function object over OpenFOAM boundary patches."); + return params; +} + +FoamSideIntegratedFunctionObject::FoamSideIntegratedFunctionObject(const InputParameters & params) + : FoamSideIntegratedBase(params), + _function_object(createFunctionObject(getParam("function_object"))) +{ +} + +std::unique_ptr +FoamSideIntegratedFunctionObject::createFunctionObject(const std::string & fo_name) +{ + auto fo_dict = _foam_mesh->time().controlDict().lookupOrDefault(fo_name, Foam::dictionary()); + + Foam::wordList patch_names(_boundary.begin(), _boundary.end()); + + fo_dict.set("patches", patch_names); + fo_dict.set("writeToFile", false); + + if (fo_name == "wallHeatFlux") + { + return std::make_unique( + "wallHeatFlux", _foam_mesh->time(), fo_dict); + } + else // wallShearStress + { + return std::make_unique( + "wallShearStress", _foam_mesh->time(), fo_dict); + } +} + +void +FoamSideIntegratedFunctionObject::compute() +{ + _function_object->execute(); + _value = integrateValue(_function_object->name()); +} diff --git a/src/postprocessors/FoamSideIntegratedValue.C b/src/postprocessors/FoamSideIntegratedValue.C new file mode 100644 index 00000000..9609b599 --- /dev/null +++ b/src/postprocessors/FoamSideIntegratedValue.C @@ -0,0 +1,30 @@ +#include "FoamSideIntegratedValue.h" +#include "InputParameters.h" +#include "MooseTypes.h" + +registerMooseObject("hippoApp", FoamSideIntegratedValue); + +InputParameters +FoamSideIntegratedValue::validParams() +{ + auto params = FoamSideIntegratedBase::validParams(); + params.addRequiredParam("foam_variable", + "Foam variable to be averaged over a boundary patch."); + params.addClassDescription("Class that integrates a variable over OpenFOAM boundary patches."); + return params; +} + +FoamSideIntegratedValue::FoamSideIntegratedValue(const InputParameters & params) + : FoamSideIntegratedBase(params), _foam_variable(getParam("foam_variable")) +{ + // determine if this is a vector scalar, ahead of computation + if (!_foam_mesh->foundObject(_foam_variable) && + !_foam_mesh->foundObject(_foam_variable)) + mooseError("No Foam scalar or vector called '", _foam_variable, "'."); +} + +void +FoamSideIntegratedValue::compute() +{ + _value = integrateValue(_foam_variable); +} diff --git a/src/postprocessors/FoamSidePostprocessor.C b/src/postprocessors/FoamSidePostprocessor.C new file mode 100644 index 00000000..98bd6b98 --- /dev/null +++ b/src/postprocessors/FoamSidePostprocessor.C @@ -0,0 +1,22 @@ +#include "FoamSidePostprocessor.h" +#include "InputParameters.h" +#include "MooseTypes.h" + +InputParameters +FoamSidePostprocessor::validParams() +{ + auto params = FoamPostprocessorBase::validParams(); + params.addRequiredParam>( + "boundary", "List of boundaries where postprocessor applies."); + return params; +} + +FoamSidePostprocessor::FoamSidePostprocessor(const InputParameters & params) + : FoamPostprocessorBase(params), _boundary(params.get>("boundary")) +{ + for (auto & boundary : _boundary) + { + if (_foam_mesh->boundary().findIndex(boundary) == -1) + mooseError("Boundary '", boundary, "' not found in FoamMesh."); + } +} diff --git a/src/problems/FoamProblem.C b/src/problems/FoamProblem.C index 8679a555..d1c470f9 100644 --- a/src/problems/FoamProblem.C +++ b/src/problems/FoamProblem.C @@ -1,3 +1,4 @@ +#include "Attributes.h" #include "ExternalProblem.h" #include "FoamMesh.h" #include "FoamProblem.h" @@ -57,7 +58,8 @@ FoamProblem::FoamProblem(InputParameters const & params) _foam_mesh->fvMesh()) .ptr()), _foam_variables(), - _foam_bcs() + _foam_bcs(), + _foam_postprocessor() { assert(_foam_mesh); } @@ -78,6 +80,8 @@ FoamProblem::initialSetup() query_bcs.queryInto(_foam_bcs); verifyFoamBCs(); + + verifyFoamPostprocessors(); } void @@ -103,6 +107,10 @@ FoamProblem::syncSolutions(Direction dir) { var->transferVariable(); } + for (auto & fpp : _foam_postprocessor) + { + fpp->compute(); + } } else if (dir == ExternalProblem::Direction::TO_EXTERNAL_APP) { @@ -194,3 +202,30 @@ FoamProblem::verifyFoamBCs() } vt.print(_console); } + +void +FoamProblem::verifyFoamPostprocessors() +{ + std::vector pps; + TheWarehouse::Query query_uos = + theWarehouse().query().condition(Interfaces::Postprocessor); + query_uos.queryInto(pps); + + VariadicTable vt({ + "Foam postprocessor", + "Type", + "Boundaries", + }); + + for (auto pp : pps) + { + auto fpp = dynamic_cast(pp); + if (fpp) + { + _foam_postprocessor.push_back(fpp); + vt.addRow(fpp->name(), fpp->type(), listFromVector(fpp->blocks())); + } + } + + vt.print(_console); +} diff --git a/test/OpenFOAM/foam_modules.mk b/test/OpenFOAM/foam_modules.mk index 25c3a3a7..80bf70a8 100644 --- a/test/OpenFOAM/foam_modules.mk +++ b/test/OpenFOAM/foam_modules.mk @@ -11,3 +11,4 @@ build_foam_tests: @$(MAKE) -s -j $(MOOSE_JOBS) test/OpenFOAM/modules/functionTestSolver/ @$(MAKE) -s -j $(MOOSE_JOBS) test/OpenFOAM/modules/laplacianTestSolver/ @$(MAKE) -s -j $(MOOSE_JOBS) test/OpenFOAM/modules/odeTestSolver/ + @$(MAKE) -s -j $(MOOSE_JOBS) test/OpenFOAM/modules/postprocessorTestSolver/ diff --git a/test/OpenFOAM/modules/functionTestSolver/Make/files b/test/OpenFOAM/modules/functionTestSolver/Make/files index e586ede8..d97f57e4 100644 --- a/test/OpenFOAM/modules/functionTestSolver/Make/files +++ b/test/OpenFOAM/modules/functionTestSolver/Make/files @@ -1,3 +1,3 @@ -functionTestSolver.C +SOURCE += functionTestSolver.C LIB = $(FOAM_USER_LIBBIN)/libfunctionTestSolver diff --git a/test/OpenFOAM/modules/laplacianTestSolver/Make/files b/test/OpenFOAM/modules/laplacianTestSolver/Make/files index 8b6888f6..80aaef16 100644 --- a/test/OpenFOAM/modules/laplacianTestSolver/Make/files +++ b/test/OpenFOAM/modules/laplacianTestSolver/Make/files @@ -1,3 +1,3 @@ -laplacianTestSolver.C +SOURCE += laplacianTestSolver.C LIB = $(FOAM_USER_LIBBIN)/liblaplacianTestSolver diff --git a/test/OpenFOAM/modules/odeTestSolver/Make/files b/test/OpenFOAM/modules/odeTestSolver/Make/files index ce5757f0..467ac083 100644 --- a/test/OpenFOAM/modules/odeTestSolver/Make/files +++ b/test/OpenFOAM/modules/odeTestSolver/Make/files @@ -1,3 +1,3 @@ -odeTestSolver.C +SOURCE += odeTestSolver.C LIB = $(FOAM_USER_LIBBIN)/libodeTestSolver diff --git a/test/OpenFOAM/modules/postprocessorTestSolver/Make/files b/test/OpenFOAM/modules/postprocessorTestSolver/Make/files new file mode 100644 index 00000000..42765a4f --- /dev/null +++ b/test/OpenFOAM/modules/postprocessorTestSolver/Make/files @@ -0,0 +1,3 @@ +SOURCE += postprocessorTestSolver.C + +LIB = $(FOAM_USER_LIBBIN)/libpostprocessorTestSolver diff --git a/test/OpenFOAM/modules/postprocessorTestSolver/Make/options b/test/OpenFOAM/modules/postprocessorTestSolver/Make/options new file mode 100644 index 00000000..3d0e96db --- /dev/null +++ b/test/OpenFOAM/modules/postprocessorTestSolver/Make/options @@ -0,0 +1,23 @@ +EXE_INC = \ + -I$(FOAM_MODULES)/fluid/lnInclude \ + -I$(FOAM_MODULES)/fluidSolver/lnInclude \ + -I$(FOAM_MODULES)/isothermalFluid/lnInclude \ + -I$(LIB_SRC)/physicalProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ + -I$(LIB_SRC)/ThermophysicalTransportModels/thermophysicalTransportModel/lnInclude \ + -I$(LIB_SRC)/ThermophysicalTransportModels/fluid/lnInclude \ + -I$(LIB_SRC)/ThermophysicalTransportModels/fluidThermo/lnInclude \ + -I$(LIB_SRC)/finiteVolume/cfdTools \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude + +LIB_LIBS = \ + -lfluid \ + -lfluidSolver \ + -lisothermalFluid \ + -lfluidThermophysicalModels \ + -lcompressibleMomentumTransportModels \ + -lcoupledThermophysicalTransportModels diff --git a/test/OpenFOAM/modules/postprocessorTestSolver/postprocessorTestSolver.C b/test/OpenFOAM/modules/postprocessorTestSolver/postprocessorTestSolver.C new file mode 100644 index 00000000..2add8c28 --- /dev/null +++ b/test/OpenFOAM/modules/postprocessorTestSolver/postprocessorTestSolver.C @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "DimensionedField.H" +#include "dimensionSets.H" +#include "dimensionedScalar.H" +#include "dimensionedVector.H" +#include "fvMesh.H" +#include "postprocessorTestSolver.H" +#include "fvMeshMover.H" +#include "addToRunTimeSelectionTable.H" +#include "scalar.H" +#include "volFieldsFwd.H" +#include "volMesh.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solvers +{ +defineTypeNameAndDebug(postprocessorTestSolver, 0); +addToRunTimeSelectionTable(solver, postprocessorTestSolver, fvMesh); +} +} + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +// Solver based on solid.C module +Foam::solvers::postprocessorTestSolver::postprocessorTestSolver(fvMesh & mesh) : fluid(mesh) {} + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::solvers::postprocessorTestSolver::~postprocessorTestSolver() {} + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void +Foam::solvers::postprocessorTestSolver::preSolve() +{ + fvModels().preUpdateMesh(); + + // Update the mesh for topology change, mesh to mesh mapping + mesh_.update(); +} + +void +Foam::solvers::postprocessorTestSolver::moveMesh() +{ + if (pimple.firstIter() || pimple.moveMeshOuterCorrectors()) + { + if (!mesh_.mover().solidBody()) + { + FatalErrorInFunction << "Region " << name() << " of type " << type() + << " does not support non-solid body mesh motion" << exit(FatalError); + } + + mesh_.move(); + } +} + +void +Foam::solvers::postprocessorTestSolver::thermophysicalPredictor() +{ + // To set temperature for testing, internal energy must be set. The + // thermo_.correct() call calculates Temperature. + + // Get e and Cv + volScalarField & h = thermo_.he(); + const volScalarField & Cp = thermo_.Cp(); + + // Set e to Cv*(xy + yz + xz)t which gives a non-uniform be first order value of wall heat flux at + // all boundaries. + // auto x_mesh = + volScalarField t(IOobject("0", "0", mesh_), + mesh_, + dimTemperature, + time().userTimeValue() * mesh_.C().component(0)->internalField(), + time().userTimeValue() * mesh_.C().component(0)->boundaryField()); + h = Cp * t; + + thermo_.correct(); +} + +// ************************************************************************* // diff --git a/test/OpenFOAM/modules/postprocessorTestSolver/postprocessorTestSolver.H b/test/OpenFOAM/modules/postprocessorTestSolver/postprocessorTestSolver.H new file mode 100644 index 00000000..8a8a799c --- /dev/null +++ b/test/OpenFOAM/modules/postprocessorTestSolver/postprocessorTestSolver.H @@ -0,0 +1,112 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::solvers::postprocessorTestSolver + +Description + Solver module to test OpenFOAM-specifc Postprocessors. Based on Solid + solver + +SourceFiles + postprocessorTestSolver.C + +\*---------------------------------------------------------------------------*/ + +#pragma once + +#include "fluid.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solvers +{ + +/*---------------------------------------------------------------------------*\ + Class postprocessorTestSolver Declaration +\*---------------------------------------------------------------------------*/ + +class postprocessorTestSolver : public fluid +{ + +public: + //- Runtime type information + TypeName("postprocessorTestSolver"); + + // Constructors + + postprocessorTestSolver(fvMesh & mesh); + + //- Disallow default bitwise copy construction + postprocessorTestSolver(const postprocessorTestSolver &) = delete; + + //- Destructor + virtual ~postprocessorTestSolver(); + + // Member Functions + + //- Called at the start of the time-step, before the PIMPLE loop + virtual void preSolve(); + + //- Called at the start of the PIMPLE loop to move the mesh + virtual void moveMesh(); + + //- Corrections that follow mesh motion + virtual void motionCorrector() {}; + + //- Called at the beginning of the PIMPLE loop + virtual void prePredictor() {}; + + //- Construct and optionally solve the momentum equation + virtual void momentumPredictor() {}; + + //- Construct and solve the energy equation, + // convert to temperature + // and update thermophysical and transport properties + virtual void thermophysicalPredictor(); + + //- Construct and solve the pressure equation in the PISO loop + virtual void pressureCorrector() {}; + + //- Correct the thermophysical transport modelling + virtual void postCorrector() {}; + + //- Called after the PIMPLE loop at the end of the time-step + virtual void postSolve() {}; + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const postprocessorTestSolver &) = delete; +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace solvers +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_advective_flux_integral/foam/0/T b/test/tests/postprocessors/side_advective_flux_integral/foam/0/T new file mode 100644 index 00000000..f8312bb2 --- /dev/null +++ b/test/tests/postprocessors/side_advective_flux_integral/foam/0/T @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class volScalarField; + location "0"; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 0.1; + +boundaryField +{ + left + { + type calculated; + value uniform 0.; + } + right + { + type calculated; + value uniform 0.; + } + top + { + type calculated; + value uniform 0.; + } + bottom + { + type calculated; + value uniform 0.; + } + back + { + type calculated; + value uniform 0.; + } + front + { + type calculated; + value uniform 0.; + } +} + + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_advective_flux_integral/foam/0/U b/test/tests/postprocessors/side_advective_flux_integral/foam/0/U new file mode 100644 index 00000000..d23654bb --- /dev/null +++ b/test/tests/postprocessors/side_advective_flux_integral/foam/0/U @@ -0,0 +1,31 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 12 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 1 -1 0 0 0 0 ]; + +internalField uniform (2 -1 0); + +boundaryField +{ + + ".*" + { + type fixedValue; + value $internalField; + } +} + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_advective_flux_integral/foam/0/p b/test/tests/postprocessors/side_advective_flux_integral/foam/0/p new file mode 100644 index 00000000..0d00fc2f --- /dev/null +++ b/test/tests/postprocessors/side_advective_flux_integral/foam/0/p @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 12 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class volScalarField; + location "0"; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 1 -1 -2 0 0 0 0 ]; + +internalField uniform 0; + +boundaryField +{ + ".*" + { + type calculated; + value $internalField; + } +} + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_advective_flux_integral/foam/0/p_rgh b/test/tests/postprocessors/side_advective_flux_integral/foam/0/p_rgh new file mode 100644 index 00000000..cfc89a8c --- /dev/null +++ b/test/tests/postprocessors/side_advective_flux_integral/foam/0/p_rgh @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 12 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class volScalarField; + location "0"; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 1 -1 -2 0 0 0 0 ]; + +internalField uniform 0; + +boundaryField +{ + ".*" + { + type fixedValue; + value $internalField; + } +} + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_advective_flux_integral/foam/0/rho b/test/tests/postprocessors/side_advective_flux_integral/foam/0/rho new file mode 100644 index 00000000..e6da2e67 --- /dev/null +++ b/test/tests/postprocessors/side_advective_flux_integral/foam/0/rho @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 12 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class volScalarField; + location "0"; + object rho; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -3 0 0 0 0 0]; + +internalField uniform 0.5; + +boundaryField +{ + left + { + type calculated; + value uniform 0.5; + } + right + { + type calculated; + value uniform 0.5; + } + top + { + type calculated; + value uniform 0.5; + } + front + { + type calculated; + value uniform 0.5; + } + bottom + { + type calculated; + value uniform 0.5; + } + back + { + type calculated; + value uniform 0.5; + } +} + + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_advective_flux_integral/foam/constant/g b/test/tests/postprocessors/side_advective_flux_integral/foam/constant/g new file mode 100644 index 00000000..8af96f3a --- /dev/null +++ b/test/tests/postprocessors/side_advective_flux_integral/foam/constant/g @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value (0 0 0); + + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_advective_flux_integral/foam/constant/momentumTransport b/test/tests/postprocessors/side_advective_flux_integral/foam/constant/momentumTransport new file mode 100644 index 00000000..0416f1a9 --- /dev/null +++ b/test/tests/postprocessors/side_advective_flux_integral/foam/constant/momentumTransport @@ -0,0 +1,18 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_advective_flux_integral/foam/constant/physicalProperties b/test/tests/postprocessors/side_advective_flux_integral/foam/constant/physicalProperties new file mode 100644 index 00000000..20dafc61 --- /dev/null +++ b/test/tests/postprocessors/side_advective_flux_integral/foam/constant/physicalProperties @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + location "constant"; + object physicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heRhoThermo; + mixture pureMixture; + transport const; + thermo hConst; + equationOfState rhoConst; + specie specie; + energy sensibleEnthalpy; +} + +mixture +{ + specie + { + molWeight 1; + } + thermodynamics + { + Cp 1; // Specific heat capacity [J/(kg·K)] + Hf 1; // Heat of formation [J/kg] + Tref 0; + } + transport + { + kappa 1; // Thermal conductivity [W/(m·K)] + mu 1.; + } + equationOfState + { + rho 1; // Density [kg/m^3] + } +} + + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_advective_flux_integral/foam/system/blockMeshDict b/test/tests/postprocessors/side_advective_flux_integral/foam/system/blockMeshDict new file mode 100644 index 00000000..face9ea6 --- /dev/null +++ b/test/tests/postprocessors/side_advective_flux_integral/foam/system/blockMeshDict @@ -0,0 +1,85 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} + +vertices +( + ( 0.0 0.0 0.0 ) + ( 10.0 0.0 0.0 ) + ( 10.0 1.0 0.0 ) + ( 0.0 1.0 0.0 ) + + ( 0.0 0.0 1.0) + ( 10.0 0.0 1.0) + ( 10.0 1.0 1.0) + ( 0.0 1.0 1.0) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (50 1 1) simpleGrading (25 1 1) +); + +boundary +( + + // interface + left + { + type wall; + faces + ( + (4 7 3 0) + ); + } + + right + { + type wall; + faces + ( + (6 5 1 2) + ); + } + + top + { + type wall; + faces + ( + (2 3 7 6) + ); + } + + front + { + type wall; + faces + ( + (3 2 1 0) + ); + } + + bottom + { + type wall; + faces + ( + (0 1 5 4) + ); + } + + back + { + type wall; + faces + ( + (4 5 6 7) + ); + } + +); diff --git a/test/tests/postprocessors/side_advective_flux_integral/foam/system/controlDict b/test/tests/postprocessors/side_advective_flux_integral/foam/system/controlDict new file mode 100644 index 00000000..4e2baf59 --- /dev/null +++ b/test/tests/postprocessors/side_advective_flux_integral/foam/system/controlDict @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solver postprocessorTestSolver; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 0.32; + +deltaT 0.01; + +writeControl timeStep; + +writeInterval 1; + +writeFormat ascii; + +writePrecision 20; + +writeCompression off; + +timeFormat general; + +timePrecision 20; + +runTimeModifiable true; + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_advective_flux_integral/foam/system/decomposeParDict b/test/tests/postprocessors/side_advective_flux_integral/foam/system/decomposeParDict new file mode 100644 index 00000000..0204a6b9 --- /dev/null +++ b/test/tests/postprocessors/side_advective_flux_integral/foam/system/decomposeParDict @@ -0,0 +1,42 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + location "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 2; + +method simple; + +simpleCoeffs +{ + n (2 1 1); +} + +hierarchicalCoeffs +{ + n (1 1 1); + order xyz; +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots ( ); + + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_advective_flux_integral/foam/system/fvSchemes b/test/tests/postprocessors/side_advective_flux_integral/foam/system/fvSchemes new file mode 100644 index 00000000..787f3b83 --- /dev/null +++ b/test/tests/postprocessors/side_advective_flux_integral/foam/system/fvSchemes @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 12 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + + div(phi,U) Gauss linear; + div(phi,K) Gauss linear; + div(phi,h) Gauss linear; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_advective_flux_integral/foam/system/fvSolution b/test/tests/postprocessors/side_advective_flux_integral/foam/system/fvSolution new file mode 100644 index 00000000..61143b21 --- /dev/null +++ b/test/tests/postprocessors/side_advective_flux_integral/foam/system/fvSolution @@ -0,0 +1,61 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 12 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + rho + { + solver diagonal; + } + + rhoFinal + { + $rho; + } + + + "(U|h|p_rgh)" + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-8; + relTol 1e-8; + } + + "(U|h|p_rgh)Final" + { + $U; + tolerance 1e-8; + relTol 1e-8; + } +} + +PIMPLE +{ + momentumPredictor yes; + pRefCell 0; + pRefValue 0; +} + +relaxationFactors +{ + equations + { + h 1; + U 1; + } +} + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_advective_flux_integral/gold/main_out.csv b/test/tests/postprocessors/side_advective_flux_integral/gold/main_out.csv new file mode 100644 index 00000000..e82176d3 --- /dev/null +++ b/test/tests/postprocessors/side_advective_flux_integral/gold/main_out.csv @@ -0,0 +1,34 @@ +time,m_dot_x1,m_dot_x12,m_dot_x2,m_dot_y1,m_dot_y12,m_dot_y2,m_dot_z1,m_dot_z12,m_dot_z2 +0,0,0,0,0,0,0,0,0,0 +0.01,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.02,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.03,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.04,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.05,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.06,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.07,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.08,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.09,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.1,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.11,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.12,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.13,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.14,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.15,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.16,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.17,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.18,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.19,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.2,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.21,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.22,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.23,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.24,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.25,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.26,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.27,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.28,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.29,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.3,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.31,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 +0.32,-1,0,1,5,1.3322676295502e-15,-5,-3.6347636898442e-17,-3.6347636898442e-17,0 diff --git a/test/tests/postprocessors/side_advective_flux_integral/main.i b/test/tests/postprocessors/side_advective_flux_integral/main.i new file mode 100644 index 00000000..b9815796 --- /dev/null +++ b/test/tests/postprocessors/side_advective_flux_integral/main.i @@ -0,0 +1,80 @@ +[Mesh] + type = FoamMesh + case = 'foam' + foam_patch = 'left right bottom top back front' +[] + +[Variables] + [dummy] + family = MONOMIAL + order = CONSTANT + initial_condition = 999 + [] +[] + +[Problem] + type = FoamProblem +[] + +[Executioner] + type = Transient + end_time = 0.32 + [TimeSteppers] + [foam] + type = FoamControlledTimeStepper + [] + [] +[] + +[Postprocessors] + [m_dot_x1] + type = FoamSideAdvectiveFluxIntegral + foam_scalar = 'rho' + boundary = left + [] + [m_dot_x2] + type = FoamSideAdvectiveFluxIntegral + foam_scalar = 'rho' + boundary = right + [] + [m_dot_x12] # should be zero + type = FoamSideAdvectiveFluxIntegral + foam_scalar = 'rho' + boundary = 'left right' + [] + [m_dot_y1] + type = FoamSideAdvectiveFluxIntegral + foam_scalar = 'rho' + boundary = bottom + [] + [m_dot_y2] + type = FoamSideAdvectiveFluxIntegral + foam_scalar = 'rho' + boundary = top + [] + [m_dot_y12] # should be zero + type = FoamSideAdvectiveFluxIntegral + foam_scalar = 'rho' + boundary = 'bottom top' + [] + [m_dot_z1] + type = FoamSideAdvectiveFluxIntegral + foam_scalar = 'rho' + boundary = back + [] + [m_dot_z2] + type = FoamSideAdvectiveFluxIntegral + foam_scalar = 'rho' + boundary = front + [] + [m_dot_z12] # should be zero + type = FoamSideAdvectiveFluxIntegral + foam_scalar = 'rho' + boundary = 'front back' + [] +[] + +[Outputs] + exodus = false + csv = true +[] diff --git a/test/tests/postprocessors/side_advective_flux_integral/tests b/test/tests/postprocessors/side_advective_flux_integral/tests new file mode 100644 index 00000000..96e7ac47 --- /dev/null +++ b/test/tests/postprocessors/side_advective_flux_integral/tests @@ -0,0 +1,40 @@ +[Tests] + [postprocessor_test] + [setup] + type = RunCommand + command = 'bash -c "foamCleanCase -case foam && blockMesh -case foam && decomposePar -case foam"' + [] + [check_csv] + type = CSVDiff + input = main.i + prereq = postprocessor_test/setup + csvdiff = main_out.csv + allow_warnings = true + [] + [check_csv_parallel] + type = CSVDiff + input = main.i + prereq = postprocessor_test/setup + csvdiff = main_out.csv + allow_warnings = true + min_parallel=2 + max_parallel=2 + [] + [invalid_advective_velocity] + type = RunException + input = main.i + prereq = postprocessor_test/setup + allow_warnings = true + cli_args='Postprocessors/m_dot_x1/advective_velocity=U1' + expect_err = "advective_velocity 'U1' not found." + [] + [invalid_scalar] + type = RunException + input = main.i + prereq = postprocessor_test/setup + allow_warnings = true + cli_args='Postprocessors/m_dot_x1/foam_scalar=rho1' + expect_err = "foam_scalar 'rho1' not found." + [] + [] +[] diff --git a/test/tests/postprocessors/side_average/foam/0/T b/test/tests/postprocessors/side_average/foam/0/T new file mode 100644 index 00000000..f8312bb2 --- /dev/null +++ b/test/tests/postprocessors/side_average/foam/0/T @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class volScalarField; + location "0"; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 0.1; + +boundaryField +{ + left + { + type calculated; + value uniform 0.; + } + right + { + type calculated; + value uniform 0.; + } + top + { + type calculated; + value uniform 0.; + } + bottom + { + type calculated; + value uniform 0.; + } + back + { + type calculated; + value uniform 0.; + } + front + { + type calculated; + value uniform 0.; + } +} + + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_average/foam/0/U b/test/tests/postprocessors/side_average/foam/0/U new file mode 100644 index 00000000..d23654bb --- /dev/null +++ b/test/tests/postprocessors/side_average/foam/0/U @@ -0,0 +1,31 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 12 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 1 -1 0 0 0 0 ]; + +internalField uniform (2 -1 0); + +boundaryField +{ + + ".*" + { + type fixedValue; + value $internalField; + } +} + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_average/foam/0/p b/test/tests/postprocessors/side_average/foam/0/p new file mode 100644 index 00000000..0d00fc2f --- /dev/null +++ b/test/tests/postprocessors/side_average/foam/0/p @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 12 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class volScalarField; + location "0"; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 1 -1 -2 0 0 0 0 ]; + +internalField uniform 0; + +boundaryField +{ + ".*" + { + type calculated; + value $internalField; + } +} + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_average/foam/0/p_rgh b/test/tests/postprocessors/side_average/foam/0/p_rgh new file mode 100644 index 00000000..cfc89a8c --- /dev/null +++ b/test/tests/postprocessors/side_average/foam/0/p_rgh @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 12 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class volScalarField; + location "0"; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 1 -1 -2 0 0 0 0 ]; + +internalField uniform 0; + +boundaryField +{ + ".*" + { + type fixedValue; + value $internalField; + } +} + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_average/foam/0/rho b/test/tests/postprocessors/side_average/foam/0/rho new file mode 100644 index 00000000..d30a04dc --- /dev/null +++ b/test/tests/postprocessors/side_average/foam/0/rho @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 12 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class volScalarField; + location "0"; + object rho; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -3 0 0 0 0 0]; + +internalField uniform 1; + +boundaryField +{ + left + { + type calculated; + value uniform 1; + } + right + { + type calculated; + value uniform 1; + } + top + { + type calculated; + value uniform 1; + } + front + { + type calculated; + value uniform 1; + } + bottom + { + type calculated; + value uniform 1; + } + back + { + type calculated; + value uniform 1; + } +} + + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_average/foam/constant/g b/test/tests/postprocessors/side_average/foam/constant/g new file mode 100644 index 00000000..8af96f3a --- /dev/null +++ b/test/tests/postprocessors/side_average/foam/constant/g @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value (0 0 0); + + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_average/foam/constant/momentumTransport b/test/tests/postprocessors/side_average/foam/constant/momentumTransport new file mode 100644 index 00000000..0416f1a9 --- /dev/null +++ b/test/tests/postprocessors/side_average/foam/constant/momentumTransport @@ -0,0 +1,18 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_average/foam/constant/physicalProperties b/test/tests/postprocessors/side_average/foam/constant/physicalProperties new file mode 100644 index 00000000..20dafc61 --- /dev/null +++ b/test/tests/postprocessors/side_average/foam/constant/physicalProperties @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + location "constant"; + object physicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heRhoThermo; + mixture pureMixture; + transport const; + thermo hConst; + equationOfState rhoConst; + specie specie; + energy sensibleEnthalpy; +} + +mixture +{ + specie + { + molWeight 1; + } + thermodynamics + { + Cp 1; // Specific heat capacity [J/(kg·K)] + Hf 1; // Heat of formation [J/kg] + Tref 0; + } + transport + { + kappa 1; // Thermal conductivity [W/(m·K)] + mu 1.; + } + equationOfState + { + rho 1; // Density [kg/m^3] + } +} + + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_average/foam/system/blockMeshDict b/test/tests/postprocessors/side_average/foam/system/blockMeshDict new file mode 100644 index 00000000..face9ea6 --- /dev/null +++ b/test/tests/postprocessors/side_average/foam/system/blockMeshDict @@ -0,0 +1,85 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} + +vertices +( + ( 0.0 0.0 0.0 ) + ( 10.0 0.0 0.0 ) + ( 10.0 1.0 0.0 ) + ( 0.0 1.0 0.0 ) + + ( 0.0 0.0 1.0) + ( 10.0 0.0 1.0) + ( 10.0 1.0 1.0) + ( 0.0 1.0 1.0) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (50 1 1) simpleGrading (25 1 1) +); + +boundary +( + + // interface + left + { + type wall; + faces + ( + (4 7 3 0) + ); + } + + right + { + type wall; + faces + ( + (6 5 1 2) + ); + } + + top + { + type wall; + faces + ( + (2 3 7 6) + ); + } + + front + { + type wall; + faces + ( + (3 2 1 0) + ); + } + + bottom + { + type wall; + faces + ( + (0 1 5 4) + ); + } + + back + { + type wall; + faces + ( + (4 5 6 7) + ); + } + +); diff --git a/test/tests/postprocessors/side_average/foam/system/controlDict b/test/tests/postprocessors/side_average/foam/system/controlDict new file mode 100644 index 00000000..4e2baf59 --- /dev/null +++ b/test/tests/postprocessors/side_average/foam/system/controlDict @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solver postprocessorTestSolver; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 0.32; + +deltaT 0.01; + +writeControl timeStep; + +writeInterval 1; + +writeFormat ascii; + +writePrecision 20; + +writeCompression off; + +timeFormat general; + +timePrecision 20; + +runTimeModifiable true; + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_average/foam/system/decomposeParDict b/test/tests/postprocessors/side_average/foam/system/decomposeParDict new file mode 100644 index 00000000..0204a6b9 --- /dev/null +++ b/test/tests/postprocessors/side_average/foam/system/decomposeParDict @@ -0,0 +1,42 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + location "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 2; + +method simple; + +simpleCoeffs +{ + n (2 1 1); +} + +hierarchicalCoeffs +{ + n (1 1 1); + order xyz; +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots ( ); + + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_average/foam/system/fvSchemes b/test/tests/postprocessors/side_average/foam/system/fvSchemes new file mode 100644 index 00000000..787f3b83 --- /dev/null +++ b/test/tests/postprocessors/side_average/foam/system/fvSchemes @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 12 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + + div(phi,U) Gauss linear; + div(phi,K) Gauss linear; + div(phi,h) Gauss linear; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_average/foam/system/fvSolution b/test/tests/postprocessors/side_average/foam/system/fvSolution new file mode 100644 index 00000000..61143b21 --- /dev/null +++ b/test/tests/postprocessors/side_average/foam/system/fvSolution @@ -0,0 +1,61 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 12 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + rho + { + solver diagonal; + } + + rhoFinal + { + $rho; + } + + + "(U|h|p_rgh)" + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-8; + relTol 1e-8; + } + + "(U|h|p_rgh)Final" + { + $U; + tolerance 1e-8; + relTol 1e-8; + } +} + +PIMPLE +{ + momentumPredictor yes; + pRefCell 0; + pRefValue 0; +} + +relaxationFactors +{ + equations + { + h 1; + U 1; + } +} + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_average/gold/main_out.csv b/test/tests/postprocessors/side_average/gold/main_out.csv new file mode 100644 index 00000000..3c317aac --- /dev/null +++ b/test/tests/postprocessors/side_average/gold/main_out.csv @@ -0,0 +1,34 @@ +time,U_avg_magnitude,U_avg_magnitude_multiple,U_avg_normal,U_avg_normal_multiple,U_avg_x,U_avg_x_multiple,U_avg_y,U_avg_y_multiple,U_avg_z,heat_flux,heat_flux_multiple,t_avg,t_avg_multiple +0,0,0,0,0,0,0,0,0,0,0,0,0,0 +0.01,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.01,7.8062556418956e-18,0.05,0.05 +0.02,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.02,1.5612511283791e-17,0.1,0.1 +0.03,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.03,2.2551405187698e-17,0.15,0.15 +0.04,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.04,3.1225022567583e-17,0.2,0.2 +0.05,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.05,-5.2041704279304e-17,0.25,0.25 +0.06,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.06,4.1633363423443e-17,0.3,0.3 +0.07,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.07,4.8572257327351e-17,0.35,0.35 +0.08,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.08,6.2450045135165e-17,0.4,0.4 +0.09,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.09,-1.0408340855861e-16,0.45,0.45 +0.1,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.1,-9.7144514654701e-17,0.5,0.5 +0.11,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.11,-8.3266726846887e-17,0.55,0.55 +0.12,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.12,-2.3592239273285e-16,0.6,0.6 +0.13,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.13,-6.9388939039072e-17,0.65,0.65 +0.14,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.14,9.7144514654701e-17,0.7,0.7 +0.15,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.15,-5.5511151231258e-17,0.75,0.75 +0.16,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.16,1.2490009027033e-16,0.8,0.8 +0.17,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.17,-5.5511151231258e-17,0.85,0.85 +0.18,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.18,1.1102230246252e-16,0.9,0.9 +0.19,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.19,-5.5511151231258e-17,0.95,0.95 +0.2,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.2,1.2490009027033e-16,1,1 +0.21,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.21,-4.1633363423443e-17,1.05,1.05 +0.22,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.22,-1.942890293094e-16,1.1,1.1 +0.23,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.23,3.0531133177192e-16,1.15,1.15 +0.24,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.24,1.2490009027033e-16,1.2,1.2 +0.25,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.25,-2.7755575615629e-17,1.25,1.25 +0.26,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.26,-1.942890293094e-16,1.3,1.3 +0.27,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.27,-3.3306690738755e-16,1.35,1.35 +0.28,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.28,1.6653345369377e-16,1.4,1.4 +0.29,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.29,-2.7755575615629e-17,1.45,1.45 +0.3,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.3,-1.942890293094e-16,1.5,1.5 +0.31,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.31,-3.6082248300318e-16,1.55,1.55 +0.32,2.2360679774998,2.2360679774998,2,0,2,2,-1,-1,0,0.32,2.4980018054066e-16,1.6,1.6 diff --git a/test/tests/postprocessors/side_average/main.i b/test/tests/postprocessors/side_average/main.i new file mode 100644 index 00000000..c88a8655 --- /dev/null +++ b/test/tests/postprocessors/side_average/main.i @@ -0,0 +1,122 @@ +[Mesh] + type = FoamMesh + case = 'foam' + foam_patch = 'right top' +[] + +[Variables] + [dummy] + family = MONOMIAL + order = CONSTANT + initial_condition = 999 + [] +[] + +[Problem] + type = FoamProblem +[] + +[Executioner] + type = Transient + end_time = 0.32 + [TimeSteppers] + [foam] + type = FoamControlledTimeStepper + [] + [] +[] + +[Postprocessors] + [t_avg] + type = FoamSideAverageValue + foam_variable = 'T' + boundary = top + execute_on = TIMESTEP_END + [] + [t_avg_multiple] # Should be same as t_avg + type = FoamSideAverageValue + foam_variable = 'T' + boundary = 'top bottom' + execute_on = TIMESTEP_END + [] + [U_avg_magnitude] + type = FoamSideAverageValue + foam_variable = 'U' + boundary = right + execute_on = TIMESTEP_END + [] + [U_avg_magnitude_multiple] # Should be the same as U_avg_multitude + type = FoamSideAverageValue + foam_variable = 'U' + boundary = 'left right' + execute_on = TIMESTEP_END + [] + [U_avg_normal] + type = FoamSideAverageValue + foam_variable = 'U' + boundary = right + component = normal + execute_on = TIMESTEP_END + [] + [U_avg_normal_multiple] # Should be zero, left and right should cancel + type = FoamSideAverageValue + foam_variable = 'U' + boundary = 'right left' + component = normal + execute_on = TIMESTEP_END + [] + [U_avg_x] + type = FoamSideAverageValue + foam_variable = 'U' + boundary = right + component = x + execute_on = TIMESTEP_END + [] + [U_avg_x_multiple] # Should be same as U_avg_x + type = FoamSideAverageValue + foam_variable = 'U' + boundary = 'left right' + component = x + execute_on = TIMESTEP_END + [] + [U_avg_y] + type = FoamSideAverageValue + foam_variable = 'U' + boundary = right + component = y + execute_on = TIMESTEP_END + [] + [U_avg_y_multiple] # Should be same as U_avg_y + type = FoamSideAverageValue + foam_variable = 'U' + boundary = 'left right' + component = y + execute_on = TIMESTEP_END + [] + [U_avg_z] + type = FoamSideAverageValue + foam_variable = 'U' + boundary = right + component = z + execute_on = TIMESTEP_END + [] + [heat_flux] + type = FoamSideAverageFunctionObject + function_object = 'wallHeatFlux' + boundary = right + component = x + execute_on = TIMESTEP_END + [] + [heat_flux_multiple] # should be zero + type = FoamSideAverageFunctionObject + function_object = 'wallHeatFlux' + boundary = 'left right' + component = x + execute_on = TIMESTEP_END + [] +[] + +[Outputs] + exodus = false + csv = true +[] diff --git a/test/tests/postprocessors/side_average/tests b/test/tests/postprocessors/side_average/tests new file mode 100644 index 00000000..23d80044 --- /dev/null +++ b/test/tests/postprocessors/side_average/tests @@ -0,0 +1,24 @@ +[Tests] + [postprocessor_test] + [setup] + type = RunCommand + command = 'bash -c "foamCleanCase -case foam && blockMesh -case foam && decomposePar -case foam"' + [] + [check_csv] + type = CSVDiff + input = main.i + prereq = postprocessor_test/setup + csvdiff = main_out.csv + allow_warnings = true + [] + [check_csv_parallel] + type = CSVDiff + input = main.i + prereq = postprocessor_test/setup + csvdiff = main_out.csv + allow_warnings = true + min_parallel = 2 + max_parallel = 2 + [] + [] +[] diff --git a/test/tests/postprocessors/side_integrated_value/foam/0/T b/test/tests/postprocessors/side_integrated_value/foam/0/T new file mode 100644 index 00000000..f8312bb2 --- /dev/null +++ b/test/tests/postprocessors/side_integrated_value/foam/0/T @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class volScalarField; + location "0"; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 0.1; + +boundaryField +{ + left + { + type calculated; + value uniform 0.; + } + right + { + type calculated; + value uniform 0.; + } + top + { + type calculated; + value uniform 0.; + } + bottom + { + type calculated; + value uniform 0.; + } + back + { + type calculated; + value uniform 0.; + } + front + { + type calculated; + value uniform 0.; + } +} + + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_integrated_value/foam/0/U b/test/tests/postprocessors/side_integrated_value/foam/0/U new file mode 100644 index 00000000..d23654bb --- /dev/null +++ b/test/tests/postprocessors/side_integrated_value/foam/0/U @@ -0,0 +1,31 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 12 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 1 -1 0 0 0 0 ]; + +internalField uniform (2 -1 0); + +boundaryField +{ + + ".*" + { + type fixedValue; + value $internalField; + } +} + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_integrated_value/foam/0/p b/test/tests/postprocessors/side_integrated_value/foam/0/p new file mode 100644 index 00000000..0d00fc2f --- /dev/null +++ b/test/tests/postprocessors/side_integrated_value/foam/0/p @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 12 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class volScalarField; + location "0"; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 1 -1 -2 0 0 0 0 ]; + +internalField uniform 0; + +boundaryField +{ + ".*" + { + type calculated; + value $internalField; + } +} + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_integrated_value/foam/0/p_rgh b/test/tests/postprocessors/side_integrated_value/foam/0/p_rgh new file mode 100644 index 00000000..cfc89a8c --- /dev/null +++ b/test/tests/postprocessors/side_integrated_value/foam/0/p_rgh @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 12 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class volScalarField; + location "0"; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 1 -1 -2 0 0 0 0 ]; + +internalField uniform 0; + +boundaryField +{ + ".*" + { + type fixedValue; + value $internalField; + } +} + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_integrated_value/foam/0/rho b/test/tests/postprocessors/side_integrated_value/foam/0/rho new file mode 100644 index 00000000..d30a04dc --- /dev/null +++ b/test/tests/postprocessors/side_integrated_value/foam/0/rho @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 12 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class volScalarField; + location "0"; + object rho; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -3 0 0 0 0 0]; + +internalField uniform 1; + +boundaryField +{ + left + { + type calculated; + value uniform 1; + } + right + { + type calculated; + value uniform 1; + } + top + { + type calculated; + value uniform 1; + } + front + { + type calculated; + value uniform 1; + } + bottom + { + type calculated; + value uniform 1; + } + back + { + type calculated; + value uniform 1; + } +} + + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_integrated_value/foam/constant/g b/test/tests/postprocessors/side_integrated_value/foam/constant/g new file mode 100644 index 00000000..8af96f3a --- /dev/null +++ b/test/tests/postprocessors/side_integrated_value/foam/constant/g @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value (0 0 0); + + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_integrated_value/foam/constant/momentumTransport b/test/tests/postprocessors/side_integrated_value/foam/constant/momentumTransport new file mode 100644 index 00000000..0416f1a9 --- /dev/null +++ b/test/tests/postprocessors/side_integrated_value/foam/constant/momentumTransport @@ -0,0 +1,18 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_integrated_value/foam/constant/physicalProperties b/test/tests/postprocessors/side_integrated_value/foam/constant/physicalProperties new file mode 100644 index 00000000..20dafc61 --- /dev/null +++ b/test/tests/postprocessors/side_integrated_value/foam/constant/physicalProperties @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + location "constant"; + object physicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heRhoThermo; + mixture pureMixture; + transport const; + thermo hConst; + equationOfState rhoConst; + specie specie; + energy sensibleEnthalpy; +} + +mixture +{ + specie + { + molWeight 1; + } + thermodynamics + { + Cp 1; // Specific heat capacity [J/(kg·K)] + Hf 1; // Heat of formation [J/kg] + Tref 0; + } + transport + { + kappa 1; // Thermal conductivity [W/(m·K)] + mu 1.; + } + equationOfState + { + rho 1; // Density [kg/m^3] + } +} + + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_integrated_value/foam/system/blockMeshDict b/test/tests/postprocessors/side_integrated_value/foam/system/blockMeshDict new file mode 100644 index 00000000..a59719de --- /dev/null +++ b/test/tests/postprocessors/side_integrated_value/foam/system/blockMeshDict @@ -0,0 +1,85 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} + +vertices +( + ( 0.0 0.0 0.0 ) + ( 10.0 0.0 0.0 ) + ( 10.0 1.0 0.0 ) + ( 0.0 1.0 0.0 ) + + ( 0.0 0.0 1.0) + ( 10.0 0.0 1.0) + ( 10.0 1.0 1.0) + ( 0.0 1.0 1.0) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (50 1 1) simpleGrading (1 1 1) +); + +boundary +( + + // interface + left + { + type wall; + faces + ( + (4 7 3 0) + ); + } + + right + { + type wall; + faces + ( + (6 5 1 2) + ); + } + + top + { + type wall; + faces + ( + (2 3 7 6) + ); + } + + front + { + type wall; + faces + ( + (3 2 1 0) + ); + } + + bottom + { + type wall; + faces + ( + (0 1 5 4) + ); + } + + back + { + type wall; + faces + ( + (4 5 6 7) + ); + } + +); diff --git a/test/tests/postprocessors/side_integrated_value/foam/system/controlDict b/test/tests/postprocessors/side_integrated_value/foam/system/controlDict new file mode 100644 index 00000000..4e2baf59 --- /dev/null +++ b/test/tests/postprocessors/side_integrated_value/foam/system/controlDict @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solver postprocessorTestSolver; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 0.32; + +deltaT 0.01; + +writeControl timeStep; + +writeInterval 1; + +writeFormat ascii; + +writePrecision 20; + +writeCompression off; + +timeFormat general; + +timePrecision 20; + +runTimeModifiable true; + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_integrated_value/foam/system/decomposeParDict b/test/tests/postprocessors/side_integrated_value/foam/system/decomposeParDict new file mode 100644 index 00000000..0204a6b9 --- /dev/null +++ b/test/tests/postprocessors/side_integrated_value/foam/system/decomposeParDict @@ -0,0 +1,42 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + location "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 2; + +method simple; + +simpleCoeffs +{ + n (2 1 1); +} + +hierarchicalCoeffs +{ + n (1 1 1); + order xyz; +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots ( ); + + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_integrated_value/foam/system/fvSchemes b/test/tests/postprocessors/side_integrated_value/foam/system/fvSchemes new file mode 100644 index 00000000..787f3b83 --- /dev/null +++ b/test/tests/postprocessors/side_integrated_value/foam/system/fvSchemes @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 12 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + + div(phi,U) Gauss linear; + div(phi,K) Gauss linear; + div(phi,h) Gauss linear; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_integrated_value/foam/system/fvSolution b/test/tests/postprocessors/side_integrated_value/foam/system/fvSolution new file mode 100644 index 00000000..61143b21 --- /dev/null +++ b/test/tests/postprocessors/side_integrated_value/foam/system/fvSolution @@ -0,0 +1,61 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 12 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + rho + { + solver diagonal; + } + + rhoFinal + { + $rho; + } + + + "(U|h|p_rgh)" + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-8; + relTol 1e-8; + } + + "(U|h|p_rgh)Final" + { + $U; + tolerance 1e-8; + relTol 1e-8; + } +} + +PIMPLE +{ + momentumPredictor yes; + pRefCell 0; + pRefValue 0; +} + +relaxationFactors +{ + equations + { + h 1; + U 1; + } +} + +// ************************************************************************* // diff --git a/test/tests/postprocessors/side_integrated_value/gold/main_out.csv b/test/tests/postprocessors/side_integrated_value/gold/main_out.csv new file mode 100644 index 00000000..fc0950cc --- /dev/null +++ b/test/tests/postprocessors/side_integrated_value/gold/main_out.csv @@ -0,0 +1,34 @@ +time,U_avg_magnitude,U_avg_magnitude_multiple,U_avg_normal,U_avg_normal_multiple,U_avg_x,U_avg_x_multiple,U_avg_y,U_avg_y_multiple,U_avg_z,heat_flux,heat_flux_multiple,t_avg,t_avg_multiple +0,0,0,0,0,0,0,0,0,0,0,0,0,0 +0.01,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.01,5.2041704279304e-18,0.5,1 +0.02,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.02,1.0408340855861e-17,1,2 +0.03,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.03,1.5612511283791e-16,1.5,3 +0.04,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.04,2.0816681711722e-17,2,4 +0.05,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.05,-1.1102230246252e-16,2.5,5 +0.06,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.06,3.0531133177192e-16,3,6 +0.07,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.07,1.6653345369377e-16,3.5,7 +0.08,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.08,4.1633363423443e-17,4,8 +0.09,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.09,-8.3266726846887e-17,4.5,9 +0.1,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.1,-2.2204460492503e-16,5,10 +0.11,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.11,-3.4694469519536e-16,5.5,11 +0.12,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.12,-1.5820678100908e-15,6,12 +0.13,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.13,1.6098233857065e-15,6.5,13 +0.14,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.14,3.6082248300318e-16,7,14 +0.15,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.15,1.3322676295502e-15,7.5,15 +0.16,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.16,8.3266726846887e-17,8,16 +0.17,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.17,1.0547118733939e-15,8.5,17 +0.18,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.18,-1.942890293094e-16,9,18 +0.19,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.19,7.7715611723761e-16,9.5,19 +0.2,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.2,-4.7184478546569e-16,10,20 +0.21,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.21,4.7184478546569e-16,10.5,21 +0.22,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.22,-7.7715611723761e-16,11,22 +0.23,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.23,2.4147350785597e-15,11.5,23 +0.24,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.24,1.1657341758564e-15,12,24 +0.25,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.25,-5.5511151231258e-17,12.5,25 +0.26,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.26,-1.3322676295502e-15,13,26 +0.27,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.27,-2.5535129566379e-15,13.5,27 +0.28,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.28,6.1062266354384e-16,14,28 +0.29,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.29,-6.1062266354384e-16,14.5,29 +0.3,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.3,-1.8873791418628e-15,15,30 +0.31,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.31,-3.1086244689504e-15,15.5,31 +0.32,22.360679774998,44.721359549996,10,7.105427357601e-15,20,40,-10,-20,0,0.32,1.6653345369377e-16,16,32 diff --git a/test/tests/postprocessors/side_integrated_value/main.i b/test/tests/postprocessors/side_integrated_value/main.i new file mode 100644 index 00000000..efdc99ba --- /dev/null +++ b/test/tests/postprocessors/side_integrated_value/main.i @@ -0,0 +1,122 @@ +[Mesh] + type = FoamMesh + case = 'foam' + foam_patch = 'right top' +[] + +[Variables] + [dummy] + family = MONOMIAL + order = CONSTANT + initial_condition = 999 + [] +[] + +[Problem] + type = FoamProblem +[] + +[Executioner] + type = Transient + end_time = 0.32 + [TimeSteppers] + [foam] + type = FoamControlledTimeStepper + [] + [] +[] + +[Postprocessors] + [t_avg] + type = FoamSideIntegratedValue + foam_variable = 'T' + boundary = top + execute_on = TIMESTEP_END + [] + [t_avg_multiple] # should be double t_avg + type = FoamSideIntegratedValue + foam_variable = 'T' + boundary = 'bottom top' + execute_on = TIMESTEP_END + [] + [U_avg_magnitude] + type = FoamSideIntegratedValue + foam_variable = 'U' + boundary = back + execute_on = TIMESTEP_END + [] + [U_avg_magnitude_multiple] # should be double U_avg_magnitude + type = FoamSideIntegratedValue + foam_variable = 'U' + boundary = 'back front' + execute_on = TIMESTEP_END + [] + [U_avg_normal] + type = FoamSideIntegratedValue + foam_variable = 'U' + boundary = bottom + component = normal + execute_on = TIMESTEP_END + [] + [U_avg_normal_multiple] # should be zero + type = FoamSideIntegratedValue + foam_variable = 'U' + boundary = 'bottom top' + component = normal + execute_on = TIMESTEP_END + [] + [U_avg_x] + type = FoamSideIntegratedValue + foam_variable = 'U' + boundary = front + component = x + execute_on = TIMESTEP_END + [] + [U_avg_x_multiple] # should be double U_avg_x + type = FoamSideIntegratedValue + foam_variable = 'U' + boundary = 'front back' + component = x + execute_on = TIMESTEP_END + [] + [U_avg_y] + type = FoamSideIntegratedValue + foam_variable = 'U' + boundary = back + component = y + execute_on = TIMESTEP_END + [] + [U_avg_y_multiple] # should be double U_avg_y + type = FoamSideIntegratedValue + foam_variable = 'U' + boundary = 'back front' + component = y + execute_on = TIMESTEP_END + [] + [U_avg_z] + type = FoamSideIntegratedValue + foam_variable = 'U' + boundary = front + component = z + execute_on = TIMESTEP_END + [] + [heat_flux] + type = FoamSideIntegratedFunctionObject + function_object = 'wallHeatFlux' + boundary = right + component = x + execute_on = TIMESTEP_END + [] + [heat_flux_multiple] # should be zero + type = FoamSideIntegratedFunctionObject + function_object = 'wallHeatFlux' + boundary = 'left right' + component = x + execute_on = TIMESTEP_END + [] +[] + +[Outputs] + exodus = false + csv = true +[] diff --git a/test/tests/postprocessors/side_integrated_value/tests b/test/tests/postprocessors/side_integrated_value/tests new file mode 100644 index 00000000..382d954b --- /dev/null +++ b/test/tests/postprocessors/side_integrated_value/tests @@ -0,0 +1,46 @@ +[Tests] + [postprocessor_test] + [setup] + type = RunCommand + command = 'bash -c "foamCleanCase -case foam && blockMesh -case foam && decomposePar -case foam"' + [] + [check_csv] + type = CSVDiff + input = main.i + prereq = postprocessor_test/setup + csvdiff = main_out.csv + allow_warnings = true + [] + [check_csv_parallel] + type = CSVDiff + input = main.i + prereq = postprocessor_test/setup + csvdiff = main_out.csv + allow_warnings = true + min_parallel = 2 + max_parallel = 2 + [] + [boundary_err] + type = RunException + input = main.i + prereq = postprocessor_test/setup + allow_warnings = true + cli_args='Postprocessors/t_avg/boundary=top1' + expect_err = "Boundary 'top1' not found in FoamMesh." + [] + [invalid_foam_scalar] + type = RunException + input = main.i + prereq = postprocessor_test/setup + allow_warnings = true + cli_args='Postprocessors/t_avg/foam_variable=T1' + expect_err = "No Foam scalar or vector called 'T1'." + [] + [check_valid_func_obj] + type = RunException + input = main.i + expect_err = 'Invalid option "wallHeatFlux1" in MooseEnum' + cli_args = "Postprocessors/heat_flux/function_object='wallHeatFlux1'" + [] + [] +[]