From 42bd899b5ba8338829f7fb661b57775afa4eec18 Mon Sep 17 00:00:00 2001 From: Timo Koch <timokoch@uio.no> Date: Sat, 20 May 2023 20:04:05 +0200 Subject: [PATCH] [dualnetwork][cleanup] Improve code style and consistency --- doc/doxygen/groups/models.md | 2 +- dumux/multidomain/dualnetwork/CMakeLists.txt | 3 + .../dualnetwork/couplingmanager.hh | 14 +- .../multidomain/dualnetwork/couplingmapper.hh | 4 +- .../dualnetwork/extendedsourcestencil.hh | 12 +- dumux/porenetwork/solidenergy/CMakeLists.txt | 3 + .../solidenergy/fluxvariablescache.hh | 20 +- dumux/porenetwork/solidenergy/iofields.hh | 22 +- dumux/porenetwork/solidenergy/model.hh | 22 +- .../porenetwork/solidenergy/spatialparams.hh | 22 +- .../localresidual_incompressible.hh | 18 +- test/multidomain/dualnetwork/CMakeLists.txt | 3 + .../Berea_center_cropped_200_200_dual.dgf | 2 + test/multidomain/dualnetwork/main.cc | 6 +- test/multidomain/dualnetwork/problem_solid.hh | 24 +- test/multidomain/dualnetwork/problem_void.hh | 308 ++++++++---------- test/porenetwork/solidenergy/CMakeLists.txt | 7 +- test/porenetwork/solidenergy/main.cc | 1 - test/porenetwork/solidenergy/problem.hh | 20 +- test/porenetwork/solidenergy/properties.hh | 4 +- 20 files changed, 199 insertions(+), 318 deletions(-) diff --git a/doc/doxygen/groups/models.md b/doc/doxygen/groups/models.md index c48f3b30f3..b44b106b3e 100644 --- a/doc/doxygen/groups/models.md +++ b/doc/doxygen/groups/models.md @@ -228,7 +228,7 @@ @copydoc dumux/porenetwork/2p/model.hh @ingroup PoreNetworkModels -@defgroup PNMSolidEnergyModel +@defgroup PNMSolidEnergyModel solidenergy @brief Energy equation for the solid (heat equation) @copydoc dumux/porenetwork/solidenergy/model.hh @ingroup PoreNetworkModels diff --git a/dumux/multidomain/dualnetwork/CMakeLists.txt b/dumux/multidomain/dualnetwork/CMakeLists.txt index 7f6eca3918..e95ca099a8 100644 --- a/dumux/multidomain/dualnetwork/CMakeLists.txt +++ b/dumux/multidomain/dualnetwork/CMakeLists.txt @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder +# SPDX-License-Identifier: GPL-3.0-or-later + file(GLOB DUMUX_MULTIDOMAIN_DUALNETWORK_HEADERS *.hh *.inc) install(FILES ${DUMUX_MULTIDOMAIN_DUALNETWORK_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/multidomain/dualnetwork) diff --git a/dumux/multidomain/dualnetwork/couplingmanager.hh b/dumux/multidomain/dualnetwork/couplingmanager.hh index 04e548c802..55dd22d338 100644 --- a/dumux/multidomain/dualnetwork/couplingmanager.hh +++ b/dumux/multidomain/dualnetwork/couplingmanager.hh @@ -254,7 +254,7 @@ public: // \{ /*! - * \brief returns an iteratable container of all indices of degrees of freedom of domain j + * \brief returns an iterable container of all indices of degrees of freedom of domain j * that couple with / influence the element residual of the given element of domain i * * \param domainI the domain index of domain i @@ -437,7 +437,7 @@ public: } } } - DUNE_THROW(Dune::InvalidStateException, "No neigbor area found"); + DUNE_THROW(Dune::InvalidStateException, "No neighbor area found"); }; static const bool useAvgA = getParam<bool>("Problem.UseAverageConvectionArea", false); @@ -811,14 +811,14 @@ public: /*! * \brief set the pointers to the grid variables - * \param problems A tuple of shared pointers to the grid variables + * \param gridVariables A tuple of shared pointers to the grid variables */ void setGridVariables(GridVariablesTuple&& gridVariables) { gridVariables_ = gridVariables; } /*! * \brief set a pointer to one of the grid variables - * \param problem a pointer to the grid variables + * \param gridVariables a pointer to the grid variables * \param domainIdx the domain index of the grid variables */ template<class GridVariables, std::size_t i> @@ -963,11 +963,9 @@ protected: GridVariablesTuple gridVariables_; //! the extended source stencil object - EmbeddedCoupling::PNMHeatExtendedSourceStencil<ThisType> extendedSourceStencil_; - - + PoreNetwork::PNMHeatExtendedSourceStencil<ThisType> extendedSourceStencil_; }; -}; // end namespace Dumux +}; // end namespace Dumux::PoreNetwork #endif diff --git a/dumux/multidomain/dualnetwork/couplingmapper.hh b/dumux/multidomain/dualnetwork/couplingmapper.hh index 5f6abd4d92..32c76259ed 100644 --- a/dumux/multidomain/dualnetwork/couplingmapper.hh +++ b/dumux/multidomain/dualnetwork/couplingmapper.hh @@ -7,7 +7,7 @@ /*! * \file * \ingroup PoreNetwork - * \copydoc Dumux::DualNetworkCouplingMapper + * \copydoc Dumux::PoreNetwork::DualNetworkCouplingMapper */ #ifndef DUMUX_DUAL_NETWORK_COUPLINGMAPPER_HH @@ -410,6 +410,6 @@ private: std::unordered_map<std::size_t, std::size_t> hostGridElementIndexToGlobalId_; }; -} // end namespace Dumux +} // end namespace Dumux::PoreNetwork #endif diff --git a/dumux/multidomain/dualnetwork/extendedsourcestencil.hh b/dumux/multidomain/dualnetwork/extendedsourcestencil.hh index 4bfc099dbf..2463bd23a4 100644 --- a/dumux/multidomain/dualnetwork/extendedsourcestencil.hh +++ b/dumux/multidomain/dualnetwork/extendedsourcestencil.hh @@ -6,12 +6,12 @@ // /*! * \file - * \ingroup EmbeddedCoupling + * \ingroup PoreNetwork * \brief Extended source stencil helper class for coupling managers */ -#ifndef DUMUX_PNM_HEAT_EXTENDEDSOURCESTENCIL_HH -#define DUMUX_PNM_HEAT_EXTENDEDSOURCESTENCIL_HH +#ifndef DUMUX_DUAL_NETWORK_EXTENDEDSOURCESTENCIL_HH +#define DUMUX_DUAL_NETWORK_EXTENDEDSOURCESTENCIL_HH #include <vector> @@ -22,10 +22,10 @@ #include <dumux/common/numericdifferentiation.hh> #include <dumux/discretization/method.hh> -namespace Dumux::EmbeddedCoupling { +namespace Dumux::PoreNetwork { /*! - * \ingroup EmbeddedCoupling + * \ingroup PoreNetwork * \brief A class managing an extended source stencil * \tparam CouplingManager the coupling manager type */ @@ -175,6 +175,6 @@ private: std::unordered_map<std::size_t, std::vector<std::size_t>> sourceStencils_; }; -} // end namespace Dumux::EmbeddedCoupling +} // end namespace Dumux::PoreNetwork #endif diff --git a/dumux/porenetwork/solidenergy/CMakeLists.txt b/dumux/porenetwork/solidenergy/CMakeLists.txt index 4c4e0f42fe..c437a45f7a 100644 --- a/dumux/porenetwork/solidenergy/CMakeLists.txt +++ b/dumux/porenetwork/solidenergy/CMakeLists.txt @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder +# SPDX-License-Identifier: GPL-3.0-or-later + file(GLOB DUMUX_PORENETWORK_SOLIDENERGY_HEADERS *.hh *.inc) install(FILES ${DUMUX_PORENETWORK_SOLIDENERGY_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/porenetwork/solidenergy) diff --git a/dumux/porenetwork/solidenergy/fluxvariablescache.hh b/dumux/porenetwork/solidenergy/fluxvariablescache.hh index b9d7de5b08..5bf204bb3e 100644 --- a/dumux/porenetwork/solidenergy/fluxvariablescache.hh +++ b/dumux/porenetwork/solidenergy/fluxvariablescache.hh @@ -1,21 +1,9 @@ // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- // vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program 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 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. * - *****************************************************************************/ +// +// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder +// SPDX-License-Identifier: GPL-3.0-or-later +// /*! * \file * \ingroup PNMSolidEnergyModel diff --git a/dumux/porenetwork/solidenergy/iofields.hh b/dumux/porenetwork/solidenergy/iofields.hh index 06a2e3f212..92d6d516ca 100644 --- a/dumux/porenetwork/solidenergy/iofields.hh +++ b/dumux/porenetwork/solidenergy/iofields.hh @@ -1,25 +1,13 @@ // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- // vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program 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 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. * - *****************************************************************************/ +// +// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder +// SPDX-License-Identifier: GPL-3.0-or-later +// /*! * \file * \ingroup PNMSolidEnergyModel - * \copydoc Dumux::PNMOnePIOFields + * \copydoc Dumux::PoreNetwork::SolidEnergyIOFields */ #ifndef DUMUX_PNM_SOLID_ENERGY_IO_FIELDS_HH #define DUMUX_PNM_SOLID_ENERGY_IO_FIELDS_HH diff --git a/dumux/porenetwork/solidenergy/model.hh b/dumux/porenetwork/solidenergy/model.hh index d9153e767c..a278bd2c36 100644 --- a/dumux/porenetwork/solidenergy/model.hh +++ b/dumux/porenetwork/solidenergy/model.hh @@ -1,21 +1,9 @@ // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- // vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program 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 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. * - *****************************************************************************/ +// +// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder +// SPDX-License-Identifier: GPL-3.0-or-later +// /*! * \file * \ingroup PNMSolidEnergyModel @@ -105,6 +93,6 @@ template<class TypeTag> struct IOFields<TypeTag, TTag::PNMSolidEnergy> { using type = PoreNetwork::SolidEnergyIOFields; }; -} // namespace Dumux::Properies +} // namespace Dumux::Properties #endif diff --git a/dumux/porenetwork/solidenergy/spatialparams.hh b/dumux/porenetwork/solidenergy/spatialparams.hh index e7936746fc..562aece0c9 100644 --- a/dumux/porenetwork/solidenergy/spatialparams.hh +++ b/dumux/porenetwork/solidenergy/spatialparams.hh @@ -1,21 +1,9 @@ // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- // vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program 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 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. * - *****************************************************************************/ +// +// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder +// SPDX-License-Identifier: GPL-3.0-or-later +// /*! * \file * \ingroup PNMSolidEnergyModel @@ -63,6 +51,6 @@ public: }; -} // namespace Dumux +} // end namespace Dumux::PoreNetwork #endif diff --git a/dumux/porousmediumflow/nonisothermal/localresidual_incompressible.hh b/dumux/porousmediumflow/nonisothermal/localresidual_incompressible.hh index 8fcc29bc2b..850d4b474c 100644 --- a/dumux/porousmediumflow/nonisothermal/localresidual_incompressible.hh +++ b/dumux/porousmediumflow/nonisothermal/localresidual_incompressible.hh @@ -61,14 +61,19 @@ public: /*! * \brief The advective phase energy fluxes for incompressible flow. * - * Using specific internal energy $u$ instead of specific enthalpy $h$ for incompressible flow in convective flux - * to account for otherwise neglected pressure work term ($\nabla p \cdot v$). + * Using specific internal energy $u$ instead of specific enthalpy \f$h\f$ for incompressible flow in convective flux + * to account for otherwise neglected pressure work term (\f$\nabla p \cdot v\f$). * - * Compressible formulation in EnergyLocalResidual (neglecting pressure work term ($\nabla p \cdot v$)) - * is $\frac{\partial}{\partial t} (\rho u) = -\nabla \cdot (\rho v h) + \nabla \cdot (\lambda \nabla T)$. + * Compressible formulation in EnergyLocalResidual (neglecting pressure work term (\f$\nabla p \cdot v\f$)) + * is + \f{align*}{ + \frac{\partial}{\partial t} (\rho u) &= -\nabla \cdot (\rho v h) + \nabla \cdot (\lambda \nabla T) + \f} * * Incompressible energy formulation is - * $\frac{\partial}{\partial t} (\rho u) = -\nabla \cdot (\rho v u) + \nabla \cdot (\lambda \nabla T)$ + \f{align*}{ + \frac{\partial}{\partial t} (\rho u) = -\nabla \cdot (\rho v u) + \nabla \cdot (\lambda \nabla T) + \f} * * \param flux The flux * \param fluxVars The flux variables. @@ -78,8 +83,9 @@ public: FluxVariables& fluxVars, int phaseIdx) { + // internal energy used instead of enthalpy for incompressible flow auto upwindTerm = [phaseIdx](const auto& volVars) - { return volVars.density(phaseIdx)*volVars.mobility(phaseIdx)*volVars.internalEnergy(phaseIdx); }; //internal energy used instead of enthalpy for incompressible flow + { return volVars.density(phaseIdx)*volVars.mobility(phaseIdx)*volVars.internalEnergy(phaseIdx); }; flux[energyEqIdx] += fluxVars.advectiveFlux(phaseIdx, upwindTerm); } diff --git a/test/multidomain/dualnetwork/CMakeLists.txt b/test/multidomain/dualnetwork/CMakeLists.txt index 6af1c5f3da..fbeae0cf0e 100644 --- a/test/multidomain/dualnetwork/CMakeLists.txt +++ b/test/multidomain/dualnetwork/CMakeLists.txt @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder +# SPDX-License-Identifier: GPL-3.0-or-later + dune_symlink_to_source_files(FILES grids "params.input") dumux_add_test(NAME test_md_dualnetwork_heat_1p_solid diff --git a/test/multidomain/dualnetwork/grids/Berea_center_cropped_200_200_dual.dgf b/test/multidomain/dualnetwork/grids/Berea_center_cropped_200_200_dual.dgf index bee69c4543..77c9b8e3b6 100644 --- a/test/multidomain/dualnetwork/grids/Berea_center_cropped_200_200_dual.dgf +++ b/test/multidomain/dualnetwork/grids/Berea_center_cropped_200_200_dual.dgf @@ -1,4 +1,6 @@ DGF +% SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder +% SPDX-License-Identifier: CC-BY-4.0 % Vertex parameters: PoreInscribedRadius PoreExtendedRadius PoreVolume PoreLabel PoreDomainType % Element parameters: ThroatInscribedRadius ThroatLength ThroatCrossSectionalArea ThroatShapeFactor ThroatCenterX ThroatCenterY ThroatCenterZ ThroatLabel ThroatDomainType Vertex diff --git a/test/multidomain/dualnetwork/main.cc b/test/multidomain/dualnetwork/main.cc index 98110b3fac..923673c6ce 100644 --- a/test/multidomain/dualnetwork/main.cc +++ b/test/multidomain/dualnetwork/main.cc @@ -525,7 +525,7 @@ int main(int argc, char** argv) std::cout << "Total sum void " << voidInletFlux[1] + voidOutletFlux[1] + voidHeaterFlux[1] - sumCouplingVoid << std::endl; - std::cout << "\n\n ***Exhange *** " << std::endl; + std::cout << "\n\n ***Exchange *** " << std::endl; std::cout << "sumCouplingVoid: " << sumCouplingVoid << std::endl; std::cout << "solidInletFlux: " << solidInletFlux << std::endl; std::cout << "voidHeaterFlux: " << voidHeaterFlux[1] << std::endl; @@ -552,10 +552,6 @@ int main(int argc, char** argv) std::cout << "\n\n ***Sum of sums *** " << std::endl; std::cout << sumConvection + sumInletCond + sumHeaterFlux << std::endl; - - - - Dune::VTKWriter fluxVtkWriter(voidGridGeometry->gridView()); std::vector<Scalar> voidMassFlux(voidGridGeometry->numDofs()); std::vector<Scalar> voidHeatFlux(voidGridGeometry->numDofs()); diff --git a/test/multidomain/dualnetwork/problem_solid.hh b/test/multidomain/dualnetwork/problem_solid.hh index fe2d6c7668..4dd666c727 100644 --- a/test/multidomain/dualnetwork/problem_solid.hh +++ b/test/multidomain/dualnetwork/problem_solid.hh @@ -68,18 +68,9 @@ public: sourceMode_ = SourceMode::max; } - /*! - * \brief The problem name. - */ const std::string& name() const - { - return problemName_; - } + { return problemName_; } - /*! - * \brief Specifies which kind of boundary condition should be - * used for which equation on a given boundary control volume. - */ BoundaryTypes boundaryTypes(const Element &element, const SubControlVolume& scv) const { BoundaryTypes values; @@ -158,9 +149,6 @@ public: return flux; } - /*! - * \brief Evaluates the boundary conditions for a Dirichlet control volume. - */ PrimaryVariables dirichlet(const Element& element, const SubControlVolume& scv) const { auto values = initialAtPos(scv.dofPosition()); @@ -178,9 +166,6 @@ public: return values; } - /*! - * \brief Evaluates the boundary conditions for a Neumann control volume. - */ template<class ElementVolumeVariables, class ElementFluxVariablesCache> NumEqVector neumann(const Element& element, const FVElementGeometry& fvGeometry, @@ -191,9 +176,6 @@ public: return NumEqVector(0.0); } - /*! - * \brief Evaluates the initial value for a control volume. - */ PrimaryVariables initialAtPos(const GlobalPosition& pos) const { PrimaryVariables values(initialTemperature_); @@ -221,13 +203,13 @@ private: bool onHeaterBoundary_(const SubControlVolume& scv) const { return this->gridGeometry().poreLabel(scv.dofIndex()) == heaterIndex_; } + std::shared_ptr<const CouplingManager> couplingManager_; + std::string problemName_; Scalar initialTemperature_; Scalar temperatureIn_; Scalar temperatureBottom_; bool heatingOn_; - - std::shared_ptr<const CouplingManager> couplingManager_; bool enableCoupling_; int inletIndex_; int heaterIndex_; diff --git a/test/multidomain/dualnetwork/problem_void.hh b/test/multidomain/dualnetwork/problem_void.hh index 9af50eefbf..95a049f5db 100644 --- a/test/multidomain/dualnetwork/problem_void.hh +++ b/test/multidomain/dualnetwork/problem_void.hh @@ -6,26 +6,18 @@ // /*! * \file - * * \brief A test problem for the one-phase pore network model. */ - #ifndef DUMUX_TEST_MULTIDOMAIN_DUALNETWORK_PROBLEM_VOID_HH -#define DUMUX_TEST_MULTIDOMAIN_DUALNETWORK_PROBLEM__VOID_HH - +#define DUMUX_TEST_MULTIDOMAIN_DUALNETWORK_PROBLEM_VOID_HH -// base problem #include <dumux/porousmediumflow/problem.hh> -// Pore network model #include <dumux/porenetwork/1p/model.hh> #include <dumux/common/boundarytypes.hh> #include <dumux/common/numeqvector.hh> -namespace Dumux -{ -template <class TypeTag> -class VoidSubProblem; +namespace Dumux { template <class TypeTag> class VoidSubProblem : public PorousMediumFlowProblem<TypeTag> @@ -57,6 +49,7 @@ public: std::shared_ptr<const CouplingManager> couplingManager) : ParentType(gridGeometry, spatialParams, "Void"), couplingManager_(couplingManager) { + problemName_ = getParam<std::string>("Vtk.OutputName") + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name"); pressureIn_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.InletPressure"); pressureOut_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.OutletPressure"); temperatureInitial_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.InitialTemperature"); @@ -84,31 +77,14 @@ public: sourceMode_ = SourceMode::max; } - /*! - * \name Simulation steering - */ - // \{ - - /*! - * \brief The problem name. - */ const std::string& name() const - { - static const auto problemName = getParam<std::string>("Vtk.OutputName") + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name"); - return problemName; - } + { return problemName_; } void setGridVariables(std::shared_ptr<GridVariables> gridVars) { gridVars_ = gridVars; } - /*! - * \name Boundary conditions - */ - // \{ - //! Specifies which kind of boundary condition should be used for - //! which equation for a finite volume on the boundary. BoundaryTypes boundaryTypes(const Element& element, const SubControlVolume& scv) const { BoundaryTypes bcTypes; @@ -145,15 +121,6 @@ public: return bcTypes; } - /*! - * \brief Evaluate the boundary conditions for a dirichlet - * control volume. - * - * \param values The dirichlet values for the primary variables - * \param vertex The vertex (pore body) for which the condition is evaluated - * - * For this method, the \a values parameter stores primary variables. - */ PrimaryVariables dirichlet(const Element& element, const SubControlVolume& scv) const { @@ -180,56 +147,37 @@ public: return values; } - // \} - - /*! - * \name Volume terms - */ - // \{ - /*! - * \brief Evaluate the source term for all phases within a given - * sub-control-volume. - * - * This is the method for the case where the source term is - * potentially solution dependent and requires some quantities that - * are specific to the fully-implicit method. - * - * \param element The finite element - * \param fvGeometry The finite-volume geometry - * \param elemVolVars All volume variables for the element - * \param scv The sub control volume - * - * For this method, the return parameter stores the conserved quantity rate - * generated or annihilate per volume unit. Positive values mean - * that the conserved quantity is created, negative ones mean that it vanishes. - * E.g. for the mass balance that would be a mass rate in \f$ [ kg / (m^3 \cdot s)] \f$. - */ - template<class ElementVolumeVariables> - NumEqVector source(const Element& element, - const FVElementGeometry& fvGeometry, - const ElementVolumeVariables& elemVolVars, - const SubControlVolume& scv) const - { + + template<class ElementVolumeVariables> + NumEqVector source(const Element& element, + const FVElementGeometry& fvGeometry, + const ElementVolumeVariables& elemVolVars, + const SubControlVolume& scv) const + { NumEqVector value(0.0); if (enableCoupling_ && couplingManager_->isCoupledPore(CouplingManager::voidDomainIdx, scv.dofIndex())) { if (sourceMode_ == SourceMode::conduction) { - value[Indices::energyEqIdx] = couplingManager_->conductionSource(CouplingManager::voidDomainIdx, - element, fvGeometry, elemVolVars, scv); + value[Indices::energyEqIdx] = couplingManager_->conductionSource( + CouplingManager::voidDomainIdx, element, fvGeometry, elemVolVars, scv + ); } else if (sourceMode_ == SourceMode::convection) { - value[Indices::energyEqIdx] = couplingManager_->convectionSource(CouplingManager::voidDomainIdx, - element, fvGeometry, elemVolVars, scv); + value[Indices::energyEqIdx] = couplingManager_->convectionSource( + CouplingManager::voidDomainIdx, element, fvGeometry, elemVolVars, scv + ); } else { - const Scalar condSource = couplingManager_->conductionSource(CouplingManager::voidDomainIdx, - element, fvGeometry, elemVolVars, scv); - const Scalar convSource = couplingManager_->convectionSource(CouplingManager::voidDomainIdx, - element, fvGeometry, elemVolVars, scv); + const Scalar condSource = couplingManager_->conductionSource( + CouplingManager::voidDomainIdx, element, fvGeometry, elemVolVars, scv + ); + const Scalar convSource = couplingManager_->convectionSource( + CouplingManager::voidDomainIdx, element, fvGeometry, elemVolVars, scv + ); using std::abs; if (abs(condSource) > abs(convSource)) value[Indices::energyEqIdx] = condSource; @@ -245,108 +193,114 @@ public: value[Indices::energyEqIdx] += heatOutFlowCondition(element, fvGeometry, elemVolVars, scv); return value; - } - - - template<class ElementVolumeVariables> - Scalar heatOutFlowCondition(const Element& element, - const FVElementGeometry& fvGeometry, - const ElementVolumeVariables& elemVolVars, - const SubControlVolume& scv) const - { - Scalar value = 0.0; - using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>; - auto elemFluxVarsCache = localView(gridVars_->gridFluxVarsCache()); - elemFluxVarsCache.bindElement(element, fvGeometry, elemVolVars); - - for (auto&& scvf : scvfs(fvGeometry)) - { - FluxVariables fluxVars; - fluxVars.init(*this, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache); - const Scalar flux = fluxVars.advectiveFlux(0, [&](const auto& volVars){ return elemVolVars[scv].mobility(0)*elemVolVars[scv].density(0)*elemVolVars[scv].enthalpy(0);}); - - const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx()); - - if (insideScv.dofIndex() == scv.dofIndex()) - value += flux / scv.volume(); - else - value -= flux / scv.volume(); - } - return value; - } + } - template<class ElementVolumeVariables> - Scalar robinInletHeatFlux(const Element& element, - const FVElementGeometry& fvGeometry, - const ElementVolumeVariables& elemVolVars, - const SubControlVolume& scv) const - { - Scalar flux = 0.0; - if (useRobinInlet_ && onInletBoundary_(scv)) - { - flux += robinInletAdvectiveHeatFlux(element, fvGeometry, elemVolVars, scv); - flux += robinInletConductiveHeatFlux(element, fvGeometry, elemVolVars, scv); - } + template<class ElementVolumeVariables> + Scalar heatOutFlowCondition(const Element& element, + const FVElementGeometry& fvGeometry, + const ElementVolumeVariables& elemVolVars, + const SubControlVolume& scv) const + { + Scalar value = 0.0; + using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>; + auto elemFluxVarsCache = localView(gridVars_->gridFluxVarsCache()); + elemFluxVarsCache.bindElement(element, fvGeometry, elemVolVars); + + for (auto&& scvf : scvfs(fvGeometry)) + { + FluxVariables fluxVars; + fluxVars.init(*this, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache); + const Scalar flux = fluxVars.advectiveFlux(0, + [&](const auto& volVars) + { + return elemVolVars[scv].mobility(0) + * elemVolVars[scv].density(0) + * elemVolVars[scv].enthalpy(0); + } + ); + + const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx()); + + if (insideScv.dofIndex() == scv.dofIndex()) + value += flux / scv.volume(); + else + value -= flux / scv.volume(); + } + return value; + } + + template<class ElementVolumeVariables> + Scalar robinInletHeatFlux(const Element& element, + const FVElementGeometry& fvGeometry, + const ElementVolumeVariables& elemVolVars, + const SubControlVolume& scv) const + { + Scalar flux = 0.0; - return flux; - } + if (useRobinInlet_ && onInletBoundary_(scv)) + { + flux += robinInletAdvectiveHeatFlux(element, fvGeometry, elemVolVars, scv); + flux += robinInletConductiveHeatFlux(element, fvGeometry, elemVolVars, scv); + } + + return flux; + } + + template<class ElementVolumeVariables> + Scalar robinInletAdvectiveHeatFlux(const Element& element, + const FVElementGeometry& fvGeometry, + const ElementVolumeVariables& elemVolVars, + const SubControlVolume& scv) const + { + using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>; + auto elemFluxVarsCache = localView(gridVars_->gridFluxVarsCache()); + elemFluxVarsCache.bindElement(element, fvGeometry, elemVolVars); + const auto& volVars = elemVolVars[scv]; + + for (auto&& scvf : scvfs(fvGeometry)) + { + FluxVariables fluxVars; + fluxVars.init(*this, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache); + const Scalar enthalypy = ElementVolumeVariables::VolumeVariables::FluidSystem::enthalpy( + temperatureIn_, volVars.pressure(0) + ); + + const Scalar result = fluxVars.advectiveFlux(0, + [&](const auto& v) + { + return volVars.mobility(0) + * volVars.density(0)*enthalypy; + } + ); + const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx()); + + if (insideScv.dofIndex() == scv.dofIndex()) + return result / scv.volume(); + else + return -result / scv.volume(); + } + + DUNE_THROW(Dune::InvalidStateException, "Flux failed"); + } - template<class ElementVolumeVariables> - Scalar robinInletAdvectiveHeatFlux(const Element& element, + template<class ElementVolumeVariables> + Scalar robinInletConductiveHeatFlux(const Element& element, const FVElementGeometry& fvGeometry, const ElementVolumeVariables& elemVolVars, const SubControlVolume& scv) const - { - using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>; - auto elemFluxVarsCache = localView(gridVars_->gridFluxVarsCache()); - elemFluxVarsCache.bindElement(element, fvGeometry, elemVolVars); - const auto& volVars = elemVolVars[scv]; - - for (auto&& scvf : scvfs(fvGeometry)) - { - FluxVariables fluxVars; - fluxVars.init(*this, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache); - const Scalar enthalypy = ElementVolumeVariables::VolumeVariables::FluidSystem::enthalpy(temperatureIn_, volVars.pressure(0)); - - const Scalar result = fluxVars.advectiveFlux(0, [&](const auto& v){ return volVars.mobility(0)*volVars.density(0)*enthalypy;}); - const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx()); - - if (insideScv.dofIndex() == scv.dofIndex()) - return result / scv.volume(); - else - return -result / scv.volume(); - } - DUNE_THROW(Dune::InvalidStateException, "Flux failed"); - } - - template<class ElementVolumeVariables> - Scalar robinInletConductiveHeatFlux(const Element& element, - const FVElementGeometry& fvGeometry, - const ElementVolumeVariables& elemVolVars, - const SubControlVolume& scv) const - { - const auto& volVars = elemVolVars[scv]; - const Scalar r = volVars.poreInscribedRadius(); - static const Scalar lambdaFluid = getParam<Scalar>("2.Component.LiquidThermalConductivity"); - static const Scalar dPadding = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.PaddingThickness"); - static const Scalar robinShapeFactor = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.RobinShapeFactor", 1.0); - const Scalar A = M_PI * r*r * robinShapeFactor; - - return (temperatureIn_ - volVars.temperature()) - * A * lambdaFluid / (r + dPadding) / (scv.volume() * fvGeometry.gridGeometry().coordinationNumber()[scv.dofIndex()]); - } - - - - // \} - - /*! - * \brief Evaluate the initial value for a control volume. - * - * For this method, the \a priVars parameter stores primary - * variables. - */ + { + const auto& volVars = elemVolVars[scv]; + const Scalar r = volVars.poreInscribedRadius(); + static const Scalar lambdaFluid = getParam<Scalar>("2.Component.LiquidThermalConductivity"); + static const Scalar dPadding = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.PaddingThickness"); + static const Scalar robinShapeFactor = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.RobinShapeFactor", 1.0); + const Scalar A = M_PI * r*r * robinShapeFactor; + + return (temperatureIn_ - volVars.temperature()) + * A * lambdaFluid / (r + dPadding) / (scv.volume() * fvGeometry.gridGeometry().coordinationNumber()[scv.dofIndex()]); + } + PrimaryVariables initial(const Vertex& vertex) const { PrimaryVariables values(0.0); @@ -356,14 +310,10 @@ public: } int outletPoreLabel() const - { - return outletIndex_; - } + { return outletIndex_; } int inletPoreLabel() const - { - return inletIndex_; - } + { return inletIndex_; } int heaterPoreLabel() const { return heaterIndex_; } @@ -388,8 +338,6 @@ public: auto sourceMode() const { return sourceMode_; } - // \} - private: bool onInletBoundary_(const SubControlVolume& scv) const @@ -401,6 +349,7 @@ private: std::shared_ptr<const CouplingManager> couplingManager_; std::shared_ptr<GridVariables> gridVars_; + std::string problemName_; Scalar pressureIn_; Scalar pressureOut_; Scalar temperatureInitial_; @@ -418,6 +367,7 @@ private: std::vector<Scalar> dirichletValuesForOutput_; bool useRobinInlet_; }; -} //end namespace + +} // end namespace Dumux #endif diff --git a/test/porenetwork/solidenergy/CMakeLists.txt b/test/porenetwork/solidenergy/CMakeLists.txt index 9ec3c3b704..f051aa4d59 100644 --- a/test/porenetwork/solidenergy/CMakeLists.txt +++ b/test/porenetwork/solidenergy/CMakeLists.txt @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder +# SPDX-License-Identifier: GPL-3.0-or-later + dune_symlink_to_source_files(FILES grids "params.input") add_executable(test_porenetwork_solid_energy EXCLUDE_FROM_ALL main.cc) @@ -5,7 +8,7 @@ add_executable(test_porenetwork_solid_energy EXCLUDE_FROM_ALL main.cc) dumux_add_test(NAME test_porenetwork_solid_energy_stationary LABELS porenetwork solid energy TARGET test_porenetwork_solid_energy - CMAKE_GUARD "( dune-subgrid_FOUND AND dune-foamgrid_FOUND AND HAVE_UMFPACK )" + CMAKE_GUARD "( dune-foamgrid_FOUND AND HAVE_UMFPACK )" COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py CMD_ARGS --script fuzzy --files ${CMAKE_SOURCE_DIR}/test/references/test_pnm_solid_energy-reference.vtp @@ -16,7 +19,7 @@ dumux_add_test(NAME test_porenetwork_solid_energy_stationary dumux_add_test(NAME test_porenetwork_solid_energy_transient LABELS porenetwork solid energy TARGET test_porenetwork_solid_energy - CMAKE_GUARD "( dune-subgrid_FOUND AND dune-foamgrid_FOUND AND HAVE_UMFPACK )" + CMAKE_GUARD "( dune-foamgrid_FOUND AND HAVE_UMFPACK )" COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py CMD_ARGS --script fuzzy --files ${CMAKE_SOURCE_DIR}/test/references/test_pnm_solid_energy-reference.vtp diff --git a/test/porenetwork/solidenergy/main.cc b/test/porenetwork/solidenergy/main.cc index 23a39b0633..31e1885fd1 100644 --- a/test/porenetwork/solidenergy/main.cc +++ b/test/porenetwork/solidenergy/main.cc @@ -6,7 +6,6 @@ // /*! * \file - * * \brief heat conduction test for the pore network model (with solid properties) */ #include <config.h> diff --git a/test/porenetwork/solidenergy/problem.hh b/test/porenetwork/solidenergy/problem.hh index 9d05e69091..867c328a6b 100644 --- a/test/porenetwork/solidenergy/problem.hh +++ b/test/porenetwork/solidenergy/problem.hh @@ -11,8 +11,6 @@ #include <dumux/common/parameters.hh> #include <dumux/common/boundarytypes.hh> #include <dumux/common/numeqvector.hh> - -// base problem #include <dumux/porousmediumflow/problem.hh> namespace Dumux { @@ -53,18 +51,9 @@ public: rightIndex_ = getParam<int>("Problem.RightIndex"); } - /*! - * \brief The problem name. - */ const std::string& name() const - { - return problemName_; - } + { return problemName_; } - /*! - * \brief Specifies which kind of boundary condition should be - * used for which equation on a given boundary control volume. - */ BoundaryTypes boundaryTypes(const Element &element, const SubControlVolume& scv) const { BoundaryTypes values; @@ -86,9 +75,6 @@ public: return value; } - /*! - * \brief Evaluates the boundary conditions for a Dirichlet control volume. - */ PrimaryVariables dirichlet(const Element& element, const SubControlVolume& scv) const { auto values = initialAtPos(scv.dofPosition()); //onRightBoundary_(scv) @@ -101,9 +87,6 @@ public: return values; } - /*! - * \brief Evaluates the initial value for a control volume. - */ PrimaryVariables initialAtPos(const GlobalPosition& pos) const { PrimaryVariables values(initialTemperature_); //uniform initial temperature @@ -126,6 +109,7 @@ private: int leftIndex_; int rightIndex_; }; + } // end namespace Dumux #endif diff --git a/test/porenetwork/solidenergy/properties.hh b/test/porenetwork/solidenergy/properties.hh index 512754ebd5..5c0f7ba948 100644 --- a/test/porenetwork/solidenergy/properties.hh +++ b/test/porenetwork/solidenergy/properties.hh @@ -12,7 +12,6 @@ #define DUMUX_TEST_PORENETWORK_SOLID_ENERGY_PROPERTIES_HH #include <dumux/common/properties.hh> -#include <dumux/io/grid/gridmanager.hh> #include <dune/foamgrid/foamgrid.hh> #include <dumux/porenetwork/solidenergy/model.hh> @@ -67,7 +66,8 @@ struct HeatConductionType<TypeTag, TTag::PNMSolidModel> private: using Scalar = GetPropType<TypeTag, Properties::Scalar>; public: - using type = PoreNetwork::TruncatedPyramidGrainFouriersLaw<Scalar>; //from grainfourierslaw.hh (specified in solidenergy/model.hh) + // from grainfourierslaw.hh (specified in solidenergy/model.hh) + using type = PoreNetwork::TruncatedPyramidGrainFouriersLaw<Scalar>; }; } // end namespace Dumux::Properties -- GitLab