LCOV - code coverage report
Current view: top level - /builds/ug4-project/ugcore/ug4-new/plugins/ConvectionDiffusion - convection_diffusion_base.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 1 0
Test Date: 2025-09-21 23:31:46 Functions: 0.0 % 3 0

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2010-2015:  G-CSC, Goethe University Frankfurt
       3              :  * Author: Andreas Vogel
       4              :  * 
       5              :  * This file is part of UG4.
       6              :  * 
       7              :  * UG4 is free software: you can redistribute it and/or modify it under the
       8              :  * terms of the GNU Lesser General Public License version 3 (as published by the
       9              :  * Free Software Foundation) with the following additional attribution
      10              :  * requirements (according to LGPL/GPL v3 §7):
      11              :  * 
      12              :  * (1) The following notice must be displayed in the Appropriate Legal Notices
      13              :  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
      14              :  * 
      15              :  * (2) The following notice must be displayed at a prominent place in the
      16              :  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
      17              :  * 
      18              :  * (3) The following bibliography is recommended for citation and must be
      19              :  * preserved in all covered files:
      20              :  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
      21              :  *   parallel geometric multigrid solver on hierarchically distributed grids.
      22              :  *   Computing and visualization in science 16, 4 (2013), 151-164"
      23              :  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
      24              :  *   flexible software system for simulating pde based models on high performance
      25              :  *   computers. Computing and visualization in science 16, 4 (2013), 165-179"
      26              :  * 
      27              :  * This program is distributed in the hope that it will be useful,
      28              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      29              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      30              :  * GNU Lesser General Public License for more details.
      31              :  */
      32              : 
      33              : #ifndef __H__UG__LIB_DISC__CONVECTION_DIFFUSION__CONVECTION_DIFFUSION_BASE__
      34              : #define __H__UG__LIB_DISC__CONVECTION_DIFFUSION__CONVECTION_DIFFUSION_BASE__
      35              : 
      36              : // other ug4 modules
      37              : #include "common/common.h"
      38              : #include "lib_grid/lg_base.h"
      39              : 
      40              : // library intern headers
      41              : #include "lib_disc/spatial_disc/elem_disc/elem_disc_interface.h"
      42              : #include "lib_disc/spatial_disc/user_data/data_export.h"
      43              : #include "lib_disc/spatial_disc/user_data/data_import.h"
      44              : 
      45              : namespace ug{
      46              : namespace ConvectionDiffusionPlugin{
      47              : 
      48              : /// \addtogroup convection_diffusion
      49              : /// \{
      50              : 
      51              : /// Discretization for the Convection-Diffusion Equation
      52              : /**
      53              :  * This class implements the IElemDisc interface to provide element local
      54              :  * assemblings for the convection diffusion equation.
      55              :  * The Equation has the form
      56              :  * \f[
      57              :  *      \partial_t (m_1 c + m_2) - \nabla \cdot \left ( D \nabla c - \vec{v} c - \vec{F} \right )
      58              :  *              + r_1 \cdot c + r_2 = f + \nabla \cdot \vec{f}_2
      59              :  * \f]
      60              :  * with
      61              :  * <ul>
      62              :  * <li>   \f$ c \f$ is the unknown solution
      63              :  * <li>   \f$ m_1 \equiv m_1(\vec{x},t) \f$ is the Mass Scaling Term
      64              :  * <li>   \f$ m_2 \equiv m_1(\vec{x},t) \f$ is the Mass Term
      65              :  * <li>   \f$ D \equiv D(\vec{x},t) \f$ is the Diffusion Tensor
      66              :  * <li>   \f$ v \equiv \vec{v}(\vec{x},t) \f$ is the Velocity Field
      67              :  * <li>   \f$ F \equiv \vec{F}(\vec{x},t) \f$ is the Flux
      68              :  * <li>   \f$ r_1 \equiv r_1(\vec{x},t) \f$ is the Reaction Rate
      69              :  * <li>   \f$ r_2 \equiv r_2(\vec{x},t) \f$ is a Reaction Term
      70              :  * <li>   \f$ f \equiv f(\vec{x},t) \f$ is a Source Term
      71              :  * <li> \f$ \vec{f}_2 \equiv \vec{f}_2(\vec{x},t) \f$ is a Vector Source Term
      72              :  * </ul>
      73              :  *
      74              :  * \tparam      TDomain         Domain
      75              :  */
      76              : template<    typename TDomain>
      77              : class ConvectionDiffusionBase
      78              : : public IElemDisc<TDomain>
      79              : {
      80              :         private:
      81              :         ///     Base class type
      82              :                 typedef IElemDisc<TDomain> base_type;
      83              : 
      84              :         public:
      85              :         ///     World dimension
      86              :                 static const int dim = base_type::dim;
      87              : 
      88              :         public:
      89              :         ///     Constructor
      90              :                 ConvectionDiffusionBase(const char* functions, const char* subsets);
      91              :         protected:
      92              :                 void init_imports();
      93              :         public:
      94              :         ///     sets the diffusion tensor
      95              :         /**
      96              :          * This method sets the Diffusion tensor used in computations. If no
      97              :          * Tensor is set, a zero value is assumed.
      98              :          */
      99              :         ///     \{
     100              :                 void set_diffusion(SmartPtr<CplUserData<MathMatrix<dim, dim>, dim> > user);
     101              :                 void set_diffusion(number val);
     102              : #ifdef UG_FOR_LUA
     103              :                 void set_diffusion(const char* fctName);
     104              :                 void set_diffusion(LuaFunctionHandle fct);
     105              : #endif
     106              :         ///     \}
     107              : 
     108              :         ///     sets the velocity field
     109              :         /**
     110              :          * This method sets the Velocity field. If no field is provided a zero
     111              :          * value is assumed.
     112              :          */
     113              :         /// \{
     114              :                 void set_velocity(SmartPtr<CplUserData<MathVector<dim>, dim> > user);
     115              :                 void set_velocity(const std::vector<number>& vVel);
     116              : #ifdef UG_FOR_LUA
     117              :                 void set_velocity(const char* fctName);
     118              :                 void set_velocity(LuaFunctionHandle fct);
     119              : #endif
     120              :         /// \}
     121              : 
     122              :         ///     sets the flux
     123              :         /**
     124              :          * This method sets the Flux. If no field is provided a zero
     125              :          * value is assumed.
     126              :          */
     127              :         /// \{
     128              :                 void set_flux(SmartPtr<CplUserData<MathVector<dim>, dim> > user);
     129              :                 void set_flux(const std::vector<number>& vVel);
     130              : #ifdef UG_FOR_LUA
     131              :                 void set_flux(const char* fctName);
     132              :                 void set_flux(LuaFunctionHandle fct);
     133              : #endif
     134              :         /// \}
     135              : 
     136              :         ///     sets the reaction rate
     137              :         /**
     138              :          * This method sets the Reaction Rate. A zero value is assumed as default.
     139              :          */
     140              :         ///     \{
     141              :                 void set_reaction_rate(SmartPtr<CplUserData<number, dim> > user);
     142              :                 void set_reaction_rate(number val);
     143              : #ifdef UG_FOR_LUA
     144              :                 void set_reaction_rate(const char* fctName);
     145              :                 void set_reaction_rate(LuaFunctionHandle fct);
     146              : #endif
     147              :         ///     \}
     148              : 
     149              :         ///     sets the reaction
     150              :         /**
     151              :          * This method sets the Reaction. A zero value is assumed as default.
     152              :          */
     153              :         ///     \{
     154              :                 void set_reaction(SmartPtr<CplUserData<number, dim> > user);
     155              :                 void set_reaction(number val);
     156              : #ifdef UG_FOR_LUA
     157              :                 void set_reaction(const char* fctName);
     158              :                 void set_reaction(LuaFunctionHandle fct);
     159              : #endif
     160              :         ///     \}
     161              : 
     162              :                 void set_reaction_rate_explicit(SmartPtr<CplUserData<number, dim> > user);
     163              :                 void set_reaction_rate_explicit(number val);
     164              : #ifdef UG_FOR_LUA
     165              :                 void set_reaction_rate_explicit(const char* fctName);
     166              : #endif
     167              : 
     168              :                 void set_reaction_explicit(SmartPtr<CplUserData<number, dim> > user);
     169              :                 void set_reaction_explicit(number val);
     170              : #ifdef UG_FOR_LUA
     171              :                 void set_reaction_explicit(const char* fctName);
     172              : #endif
     173              : 
     174              :                 void set_source_explicit(SmartPtr<CplUserData<number, dim> > user);
     175              :                 void set_source_explicit(number val);
     176              : #ifdef UG_FOR_LUA
     177              :                 void set_source_explicit(const char* fctName);
     178              : #endif
     179              : 
     180              :         ///     sets the source / sink term
     181              :         /**
     182              :          * This method sets the source/sink value. A zero value is assumed as
     183              :          * default.
     184              :          */
     185              :         ///     \{
     186              :                 void set_source(SmartPtr<CplUserData<number, dim> > user);
     187              :                 void set_source(number val);
     188              : #ifdef UG_FOR_LUA
     189              :                 void set_source(const char* fctName);
     190              :                 void set_source(LuaFunctionHandle fct);
     191              : #endif
     192              :         ///     \}
     193              : 
     194              :         ///     sets the vector source term
     195              :         /**
     196              :          * This method sets the divergence of the source as an effect of an
     197              :          * external field. A zero value is assumed as default, thus this term is
     198              :          * ignored then.
     199              :          */
     200              :         ///     \{
     201              :                 void set_vector_source(SmartPtr<CplUserData<MathVector<dim>, dim> > user);
     202              :                 void set_vector_source(const std::vector<number>& vVel);
     203              : #ifdef UG_FOR_LUA
     204              :                 void set_vector_source(const char* fctName);
     205              :                 void set_vector_source(LuaFunctionHandle fct);
     206              : #endif
     207              :         ///     \}
     208              : 
     209              :         ///     sets mass scale
     210              :         /**
     211              :          * This method sets the mass scale value. The default value is 1.0.
     212              :          */
     213              :         ///     \{
     214              :                 void set_mass_scale(SmartPtr<CplUserData<number, dim> > user);
     215              :                 void set_mass_scale(number val);
     216              : #ifdef UG_FOR_LUA
     217              :                 void set_mass_scale(const char* fctName);
     218              :                 void set_mass_scale(LuaFunctionHandle fct);
     219              : #endif
     220              :         ///     \}
     221              : 
     222              :         ///     sets mass
     223              :         /**
     224              :          * This method sets the mass value. The default value is 0.0.
     225              :          */
     226              :         ///     \{
     227              :                 void set_mass(SmartPtr<CplUserData<number, dim> > user);
     228              :                 void set_mass(number val);
     229              : #ifdef UG_FOR_LUA
     230              :                 void set_mass(const char* fctName);
     231              :                 void set_mass(LuaFunctionHandle fct);
     232              : #endif
     233              :         ///     \}
     234              : 
     235              :         protected:
     236              :         ///     Data import for Diffusion
     237              :                 DataImport<MathMatrix<dim,dim>, dim> m_imDiffusion;
     238              : 
     239              :         ///     Data import for the Velocity field
     240              :                 DataImport<MathVector<dim>, dim > m_imVelocity;
     241              : 
     242              :         ///     Data import for the Flux
     243              :                 DataImport<MathVector<dim>, dim > m_imFlux;
     244              : 
     245              :         ///     Data import for the reaction term
     246              :                 DataImport<number, dim> m_imReactionRate;
     247              : 
     248              :         ///     Data import for the reaction term
     249              :                 DataImport<number, dim> m_imReaction;
     250              : 
     251              :         ///     Data import for the reaction_rate term explicit
     252              :                 DataImport<number, dim> m_imReactionRateExpl;
     253              : 
     254              :         ///     Data import for the reaction term explicit
     255              :                 DataImport<number, dim> m_imReactionExpl;
     256              : 
     257              :         ///     Data import for the source term explicit
     258              :                 DataImport<number, dim> m_imSourceExpl;
     259              : 
     260              :         ///     Data import for the right-hand side (volume)
     261              :                 DataImport<number, dim> m_imSource;
     262              : 
     263              :         ///     Data import for the right-hand side (vector)
     264              :                 DataImport<MathVector<dim>, dim > m_imVectorSource;
     265              : 
     266              :         ///     Data import for the mass scale
     267              :                 DataImport<number, dim> m_imMassScale;
     268              : 
     269              :         ///     Data import for the mass scale
     270              :                 DataImport<number, dim> m_imMass;
     271              : 
     272              :         private:
     273              :         ///     returns if local time series is needed
     274            0 :                 virtual bool requests_local_time_series() {return false;}
     275              : 
     276              :         public:
     277              :                 typedef SmartPtr<CplUserData<number, dim> > NumberExport;
     278              :                 typedef SmartPtr<CplUserData<MathVector<dim>, dim> > GradExport;
     279              : 
     280              :         ///     returns the export of the value of associated unknown function
     281              :                 virtual SmartPtr<CplUserData<number, dim> > value();
     282              : 
     283              :         ///     returns the export of the gradient of associated unknown function
     284              :                 virtual SmartPtr<CplUserData<MathVector<dim>, dim> > gradient();
     285              : 
     286              :         protected:
     287              :         ///     Export for the concentration
     288              :                 SmartPtr<DataExport<number, dim> > m_exValue;
     289              : 
     290              :         ///     Export for the gradient of concentration
     291              :                 SmartPtr<DataExport<MathVector<dim>, dim> > m_exGrad;
     292              : };
     293              : 
     294              : // end group convection_diffusion
     295              : /// \}
     296              : 
     297              : } // end ConvectionDiffusionPlugin
     298              : } // end namespace ug
     299              : 
     300              : 
     301              : #endif /*__H__UG__LIB_DISC__CONVECTION_DIFFUSION__CONVECTION_DIFFUSION_BASE__*/
        

Generated by: LCOV version 2.0-1