From 756eb69ce8baf870b356101c4335dd4bad4469f1 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de> Date: Fri, 27 Apr 2018 08:17:17 +0200 Subject: [PATCH] [freeflow][fluxvars] Rename computeFluxForCellCenter to computeMassFlux --- .../compositional/staggered/fluxvariables.hh | 16 ++++++++-------- .../navierstokes/staggered/fluxvariables.hh | 15 +++++++-------- .../navierstokes/staggered/localresidual.hh | 18 +++++++++++------- .../lowrekepsilon/staggered/fluxvariables.hh | 6 +++--- 4 files changed, 29 insertions(+), 26 deletions(-) diff --git a/dumux/freeflow/compositional/staggered/fluxvariables.hh b/dumux/freeflow/compositional/staggered/fluxvariables.hh index c91cb1ce0f..2fd511a10c 100644 --- a/dumux/freeflow/compositional/staggered/fluxvariables.hh +++ b/dumux/freeflow/compositional/staggered/fluxvariables.hh @@ -67,15 +67,15 @@ public: * \brief Computes the flux for the cell center residual. */ template<class ElementVolumeVariables, class ElementFaceVariables, class FluxVariablesCache> - CellCenterPrimaryVariables computeFluxForCellCenter(const Problem& problem, - const Element &element, - const FVElementGeometry& fvGeometry, - const ElementVolumeVariables& elemVolVars, - const ElementFaceVariables& elemFaceVars, - const SubControlVolumeFace &scvf, - const FluxVariablesCache& fluxVarsCache) + CellCenterPrimaryVariables computeMassFlux(const Problem& problem, + const Element &element, + const FVElementGeometry& fvGeometry, + const ElementVolumeVariables& elemVolVars, + const ElementFaceVariables& elemFaceVars, + const SubControlVolumeFace &scvf, + const FluxVariablesCache& fluxVarsCache) { - CellCenterPrimaryVariables flux = ParentType::computeFluxForCellCenter(problem, element, fvGeometry, elemVolVars, elemFaceVars, scvf, fluxVarsCache); + CellCenterPrimaryVariables flux(0.0); for (int compIdx = 0; compIdx < numComponents; ++compIdx) { diff --git a/dumux/freeflow/navierstokes/staggered/fluxvariables.hh b/dumux/freeflow/navierstokes/staggered/fluxvariables.hh index afd4f100ee..1520a64e9f 100644 --- a/dumux/freeflow/navierstokes/staggered/fluxvariables.hh +++ b/dumux/freeflow/navierstokes/staggered/fluxvariables.hh @@ -37,7 +37,6 @@ namespace Dumux { template<class TypeTag, DiscretizationMethod discMethod> class NavierStokesFluxVariablesImpl; - /*! * \ingroup NavierStokesModel * \brief The flux variables class for the Navier-Stokes model using the staggered grid discretization. @@ -133,13 +132,13 @@ public: * scvf * \endverbatim */ - CellCenterPrimaryVariables computeFluxForCellCenter(const Problem& problem, - const Element& element, - const FVElementGeometry& fvGeometry, - const ElementVolumeVariables& elemVolVars, - const ElementFaceVariables& elemFaceVars, - const SubControlVolumeFace& scvf, - const FluxVariablesCache& fluxVarsCache) + CellCenterPrimaryVariables computeMassFlux(const Problem& problem, + const Element& element, + const FVElementGeometry& fvGeometry, + const ElementVolumeVariables& elemVolVars, + const ElementFaceVariables& elemFaceVars, + const SubControlVolumeFace& scvf, + const FluxVariablesCache& fluxVarsCache) { // The advectively transported quantity (i.e density for a single-phase system). auto upwindTerm = [](const auto& volVars) { return volVars.density(); }; diff --git a/dumux/freeflow/navierstokes/staggered/localresidual.hh b/dumux/freeflow/navierstokes/staggered/localresidual.hh index 3f66da3e1a..033866eeb9 100644 --- a/dumux/freeflow/navierstokes/staggered/localresidual.hh +++ b/dumux/freeflow/navierstokes/staggered/localresidual.hh @@ -99,8 +99,8 @@ public: const ElementFluxVariablesCache& elemFluxVarsCache) const { FluxVariables fluxVars; - CellCenterPrimaryVariables flux = fluxVars.computeFluxForCellCenter(problem, element, fvGeometry, elemVolVars, - elemFaceVars, scvf, elemFluxVarsCache[scvf]); + CellCenterPrimaryVariables flux = fluxVars.computeMassFlux(problem, element, fvGeometry, elemVolVars, + elemFaceVars, scvf, elemFluxVarsCache[scvf]); EnergyLocalResidual::heatFlux(flux, problem, element, fvGeometry, elemVolVars, elemFaceVars, scvf); @@ -221,17 +221,19 @@ protected: { if (scvf.boundary()) { - auto boundaryFlux = computeFluxForCellCenter(problem, element, fvGeometry, elemVolVars, elemFaceVars, scvf, elemFluxVarsCache); - const auto& scv = fvGeometry.scv(scvf.insideScvIdx()); - - // handle the actual boundary conditions: const auto bcTypes = problem.boundaryTypes(element, scvf); + // treat Dirichlet and outflow BCs + FluxVariables fluxVars; + auto boundaryFlux = fluxVars.computeMassFlux(problem, element, fvGeometry, elemVolVars, + elemFaceVars, scvf, elemFluxVarsCache[scvf]); + EnergyLocalResidual::heatFlux(boundaryFlux, problem, element, fvGeometry, elemVolVars, elemFaceVars, scvf); + + // treat Neumann BCs, i.e. overwrite certain fluxes by user-specified values if(bcTypes.hasNeumann()) { static constexpr auto numEqCellCenter = CellCenterResidual::dimension; - // handle Neumann BCs, i.e. overwrite certain fluxes by user-specified values for(int eqIdx = 0; eqIdx < numEqCellCenter; ++eqIdx) { if(bcTypes.isNeumann(eqIdx + cellCenterOffset)) @@ -245,6 +247,8 @@ protected: residual += boundaryFlux; + // if specified, set a fixed value at the center of a cell at the boundary + const auto& scv = fvGeometry.scv(scvf.insideScvIdx()); asImp_().setFixedCell(residual, problem, scv, elemVolVars, bcTypes); } } diff --git a/dumux/freeflow/rans/twoeq/lowrekepsilon/staggered/fluxvariables.hh b/dumux/freeflow/rans/twoeq/lowrekepsilon/staggered/fluxvariables.hh index 16fdb4031d..742ab35f71 100644 --- a/dumux/freeflow/rans/twoeq/lowrekepsilon/staggered/fluxvariables.hh +++ b/dumux/freeflow/rans/twoeq/lowrekepsilon/staggered/fluxvariables.hh @@ -81,7 +81,7 @@ public: /*! * \brief Computes the flux for the cell center residual. */ - CellCenterPrimaryVariables computeFluxForCellCenter(const Problem& problem, + CellCenterPrimaryVariables computeMassFlux(const Problem& problem, const Element &element, const FVElementGeometry& fvGeometry, const ElementVolumeVariables& elemVolVars, @@ -89,8 +89,8 @@ public: const SubControlVolumeFace &scvf, const FluxVariablesCache& fluxVarsCache) { - CellCenterPrimaryVariables flux = ParentType::computeFluxForCellCenter(problem, element, fvGeometry, - elemVolVars, elemFaceVars, scvf, fluxVarsCache); + CellCenterPrimaryVariables flux = ParentType::computeMassFlux(problem, element, fvGeometry, + elemVolVars, elemFaceVars, scvf, fluxVarsCache); // calculate advective flux const auto bcTypes = problem.boundaryTypesAtPos(scvf.center()); -- GitLab