volumevariables.hh 7.06 KB
 Timo Koch committed Jan 30, 2017 1 2 3 4 5 6 7 // -*- 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 *  Timo Koch committed Dec 17, 2018 8  * the Free Software Foundation, either version 3 of the License, or *  Timo Koch committed Jan 30, 2017 9 10 11 12 13 14 15 16 17 18 19 20  * (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 . * *****************************************************************************/ /*! * \file  Melanie Lipp committed Dec 20, 2017 21  * \ingroup TracerModel  Sina Ackermann committed Dec 18, 2018 22  * \brief Quantities required by the tracer model in a control volume.  Timo Koch committed Jan 30, 2017 23  */  Sina Ackermann committed Dec 18, 2018 24   Timo Koch committed Jan 30, 2017 25 26 27 #ifndef DUMUX_TRACER_VOLUME_VARIABLES_HH #define DUMUX_TRACER_VOLUME_VARIABLES_HH  Bernd Flemisch committed Jun 04, 2018 28 29 #include  Kilian Weishaupt committed Dec 15, 2017 30 #include  Timo Koch committed May 08, 2018 31 #include  Timo Koch committed Jan 30, 2017 32   Timo Koch committed Mar 05, 2018 33 namespace Dumux {  Timo Koch committed Jan 30, 2017 34 35 36 37 38 39  /*! * \ingroup TracerModel * \brief Contains the quantities which are constant within a * finite volume for the tracer model. */  Dennis Gläser committed Apr 15, 2018 40 41 template class TracerVolumeVariables  Katharina Heck committed May 08, 2018 42 : public PorousMediumFlowVolumeVariables  Timo Koch committed Jan 30, 2017 43 {  Katharina Heck committed May 08, 2018 44  using ParentType = PorousMediumFlowVolumeVariables;  Dennis Gläser committed Apr 15, 2018 45 46  using Scalar = typename Traits::PrimaryVariables::value_type; static constexpr bool useMoles = Traits::ModelTraits::useMoles();  Timo Koch committed Jan 30, 2017 47 48  public:  Sina Ackermann committed Dec 18, 2018 49  //! Export fluid system type  Dennis Gläser committed Apr 15, 2018 50  using FluidSystem = typename Traits::FluidSystem;  Katharina Heck committed May 08, 2018 51  using SolidState = typename Traits::SolidState;  Timo Koch committed Jan 30, 2017 52 53  /*!  Sina Ackermann committed Dec 18, 2018 54  * \brief Updates all quantities for a given control volume.  Melanie Lipp committed Dec 20, 2017 55 56 57 58 59 60  * * \param elemSol A vector containing all primary variables connected to the element * \param problem The object specifying the problem which ought to * be simulated * \param element An element which contains part of the control volume * \param scv The sub-control volume  Timo Koch committed Jan 30, 2017 61  */  Dennis Gläser committed Apr 15, 2018 62 63  template void update(const ElemSol &elemSol,  Timo Koch committed Jan 30, 2017 64 65  const Problem &problem, const Element &element,  Dennis Gläser committed Apr 15, 2018 66  const Scv &scv)  Timo Koch committed Jan 30, 2017 67 68 69 70  { // update parent type sets primary variables ParentType::update(elemSol, problem, element, scv);  71  updateSolidVolumeFractions(elemSol, problem, element, scv, solidState_, ParentType::numFluidComponents());  Dennis Gläser committed Apr 15, 2018 72  // dispersivity_ = problem.spatialParams().dispersivity(element, scv, elemSol);  Timo Koch committed Jan 30, 2017 73 74 75 76 77  // the spatial params special to the tracer model fluidDensity_ = problem.spatialParams().fluidDensity(element, scv); fluidMolarMass_ = problem.spatialParams().fluidMolarMass(element, scv);  78  for (int compIdx = 0; compIdx < ParentType::numFluidComponents(); ++compIdx)  Timo Koch committed Jan 30, 2017 79  {  Kilian Weishaupt committed Jul 20, 2017 80  moleOrMassFraction_[compIdx] = this->priVars()[compIdx];  Timo Koch committed Dec 12, 2017 81  diffCoeff_[compIdx] = FluidSystem::binaryDiffusionCoefficient(compIdx, problem, element, scv);  Timo Koch committed Jan 30, 2017 82 83 84 85  } } /*!  Sina Ackermann committed Dec 18, 2018 86  * \brief Returns the density \f$\mathrm{[kg/m^3]}\f$ the of the fluid phase.  Timo Koch committed Jan 30, 2017 87 88  * * We always forward to the fluid state with the phaseIdx property (see class description).  Melanie Lipp committed Dec 20, 2017 89  *  Simon Scholz committed Mar 26, 2019 90  * \param phaseIdx The phase index  Timo Koch committed Jan 30, 2017 91  */  Simon Scholz committed Mar 26, 2019 92  Scalar density(int phaseIdx = 0) const  Timo Koch committed Jan 30, 2017 93 94  { return fluidDensity_; }  Katharina Heck committed May 08, 2018 95 96 97 98 99 100  /*! * \brief Returns the phase state for the control volume. */ const SolidState &solidState() const { return solidState_; }  Timo Koch committed Jan 30, 2017 101  /*!  Sina Ackermann committed Dec 18, 2018 102  * \brief Returns the saturation.  Timo Koch committed Jan 30, 2017 103 104 105  * * This method is here for compatibility reasons with other models. The saturation * is always 1.0 in a one-phasic context.  Melanie Lipp committed Dec 20, 2017 106  *  Simon Scholz committed Mar 26, 2019 107  * \param phaseIdx The phase index  Timo Koch committed Jan 30, 2017 108  */  Simon Scholz committed Mar 26, 2019 109  Scalar saturation(int phaseIdx = 0) const  Timo Koch committed Jan 30, 2017 110 111 112  { return 1.0; } /*!  Sina Ackermann committed Dec 18, 2018 113  * \brief Returns the mobility.  Timo Koch committed Jan 30, 2017 114 115 116  * * This method is here for compatibility reasons with other models. The mobility is always 1 * for one-phasic models where the velocity field is given  Melanie Lipp committed Dec 20, 2017 117  *  Simon Scholz committed Mar 26, 2019 118  * \param phaseIdx The phase index  Timo Koch committed Jan 30, 2017 119  */  Simon Scholz committed Mar 26, 2019 120  Scalar mobility(int phaseIdx = 0) const  Timo Koch committed Jan 30, 2017 121 122 123  { return 1.0; } /*!  Sina Ackermann committed Dec 18, 2018 124  * \brief Returns the molar density \f$\mathrm{[mol/m^3]}\f$ the of the fluid phase.  Melanie Lipp committed Dec 20, 2017 125  *  Simon Scholz committed Mar 26, 2019 126  * \param phaseIdx The phase index  Timo Koch committed Jan 30, 2017 127  */  Simon Scholz committed Mar 26, 2019 128  Scalar molarDensity(int phaseIdx = 0) const  Timo Koch committed Jan 30, 2017 129 130 131  { return fluidDensity_/fluidMolarMass_; } /*!  Sina Ackermann committed Dec 18, 2018 132  * \brief Returns the mole fraction \f$\mathrm{[mol/mol]}\f$ of a component in the phase.  Melanie Lipp committed Dec 20, 2017 133  *  Simon Scholz committed Mar 26, 2019 134  * \param phaseIdx The phase index  Timo Koch committed Jan 30, 2017 135 136  * \param compIdx The index of the component */  Simon Scholz committed Mar 26, 2019 137  Scalar moleFraction(int phaseIdx, int compIdx) const  Kilian Weishaupt committed Jul 20, 2017 138  { return useMoles ? moleOrMassFraction_[compIdx] : moleOrMassFraction_[compIdx]/FluidSystem::molarMass(compIdx)*fluidMolarMass_; }  Timo Koch committed Jan 30, 2017 139 140  /*!  Sina Ackermann committed Dec 18, 2018 141  * \brief Returns the mass fraction \f$\mathrm{[kg/kg]}\f$ of a component in the phase.  Melanie Lipp committed Dec 20, 2017 142  *  Simon Scholz committed Mar 26, 2019 143  * \param phaseIdx The phase index  Timo Koch committed Jan 30, 2017 144 145  * \param compIdx The index of the component */  Simon Scholz committed Mar 26, 2019 146  Scalar massFraction(int phaseIdx, int compIdx) const  Kilian Weishaupt committed Jul 20, 2017 147  { return useMoles ? moleOrMassFraction_[compIdx]*FluidSystem::molarMass(compIdx)/fluidMolarMass_ : moleOrMassFraction_[compIdx]; }  Timo Koch committed Jan 30, 2017 148 149  /*!  Sina Ackermann committed Dec 18, 2018 150  * \brief Returns the concentration \f$\mathrm{[mol/m^3]}\f$ of a component in the phase.  Melanie Lipp committed Dec 20, 2017 151  *  Simon Scholz committed Mar 26, 2019 152  * \param phaseIdx The phase index  Timo Koch committed Jan 30, 2017 153 154  * \param compIdx The index of the component */  Simon Scholz committed Mar 26, 2019 155 156  Scalar molarity(int phaseIdx, int compIdx) const { return moleFraction(phaseIdx, compIdx)*molarDensity(); }  Timo Koch committed Jan 30, 2017 157 158  /*!  Sina Ackermann committed Dec 18, 2018 159  * \brief Returns the binary diffusion coefficient \f$\mathrm{[m^2/s]}\f$ in the fluid.  Melanie Lipp committed Dec 20, 2017 160  *  Simon Scholz committed Mar 26, 2019 161  * \param phaseIdx The phase index  Melanie Lipp committed Dec 20, 2017 162  * \param compIdx The index of the component  Timo Koch committed Jan 30, 2017 163  */  Simon Scholz committed Mar 26, 2019 164  Scalar diffusionCoefficient(int phaseIdx, int compIdx) const  Timo Koch committed Jan 30, 2017 165 166  { return diffCoeff_[compIdx]; }  Dennis Gläser committed Apr 15, 2018 167 168 169 170 171 172  // /*! // * \brief Returns the dispersivity of the fluid's streamlines. // * \todo implement me // */ // const DispersivityType &dispersivity() const // { return dispersivity_; }  Timo Koch committed Jan 30, 2017 173 174 175 176 177  /*! * \brief Return the average porosity \f$\mathrm{[-]}\f$ within the control volume. */ Scalar porosity() const  Katharina Heck committed May 08, 2018 178  { return solidState_.porosity(); }  Timo Koch committed Jan 30, 2017 179 180  protected:  Katharina Heck committed May 08, 2018 181  SolidState solidState_;  Timo Koch committed Jan 30, 2017 182  Scalar fluidDensity_, fluidMolarMass_;  Dennis Gläser committed Apr 15, 2018 183  // DispersivityType dispersivity_;  184 185  std::array diffCoeff_; std::array moleOrMassFraction_;  Timo Koch committed Jan 30, 2017 186 187 188 189 190 }; } // end namespace Dumux #endif