33 #ifndef __H__UG__RICHARDS_PLUGIN__LINKER_H__
34 #define __H__UG__RICHARDS_PLUGIN__LINKER_H__
94 template <
int dim,
class TFunctor>
96 :
public StdDataLinker< RichardsLinker<dim, TFunctor>, number, dim>,
103 typedef typename TFunctor::TModel
TModel;
117 UG_LOG(
"RichardsLinker::RichardsLinker" << std::endl);
128 (*richards_base_type::m_spCapillary)(cap, globIP,
time, si);
129 TFunctor::get_func_values(
m_model, &cap, &
value, &dummy, 1);
132 template <
int refDim>
145 (*richards_base_type::m_spCapillary)(&vCapVal[0], vGlobIP,
time, si,
146 elem, vCornerCoords, vLocIP, nip, u, vJT);
149 TFunctor::get_func_values(
m_model,vCapVal, vValue, vdSdH, nip);
153 template <
int refDim>
164 std::vector<std::vector<number > > vvvDeriv[],
171 UG_ASSERT(
s >=0,
"Huhh: Requires non-negative s");
175 "Huhh: Requires data m_spCapillary:" << nip <<
"!=" << this->m_spCapillary->num_ip(sid));
177 "Huhh: Requires data m_spCapillary:" << nip <<
"!=" << this->m_spDCapillary->num_ip(sid));
184 TFunctor::get_func_values(
m_model, vH, vValue, vdSdH, nip);
199 for(
size_t ip = 0;
ip < nip; ++
ip)
208 if (this->
num_sh(commonFct) == nip)
211 vvvDeriv[
ip][commonFct][
ip] += vdSdH[
ip] * vDHeight[
ip];
215 for(
size_t sh = 0; sh < this->
num_sh(commonFct); ++sh)
217 UG_ASSERT(commonFct < vvvDeriv[
ip].size(), commonFct<<
", "<<vvvDeriv[
ip].size());
218 vvvDeriv[
ip][commonFct][sh] += vdSdH[
ip] * vDHeight[sh];
246 template <
typename M>
251 { model.get_saturations(h,
s, dsdh, n); }
255 template <
typename M>
259 static void get_func_values(
const M& model,
const double *h,
double *k,
double *dkdh,
size_t n)
260 { model.get_conductivities(h, k, dkdh, n);}
427 number time,
int si)
const
430 m_spFlux->operator()(fluxVec, globIP, time, si);
433 return (fluxVec[
dim]>0) ? true :
false;
439 number time,
int si,
const size_t nip)
const
570 struct adl_serializer<
ug::Richards::RichardsSaturation<dim> >
575 static TRichardsLinker
from_json(
const json& j)
576 {
return j.get<TModel>(); }
578 static void to_json(json& j, TRichardsLinker
s)
584 struct adl_serializer<
ug::Richards::RichardsConductivity<dim> >
589 static TRichardsLinker
from_json(
const json& j)
590 {
return j.get<TModel>(); }
592 static void to_json(json& j, TRichardsLinker
s)
TData & value(size_t s, size_t ip)
static void set_zero(std::vector< std::vector< TData > > vvvDeriv[], const size_t nip)
size_t num_sh(size_t fct) const
CplUserData< TData, dim > base_type
size_t num_series() const
const MathVector< dim > & ip(size_t s, size_t ip) const
Implement a simple exponential model.
Definition: van_genuchten.h:278
Definition: richards_linker.h:332
RichardsLinker< dim, GardnerConductivityAdapter > base_type
Definition: richards_linker.h:334
GardnerConductivity(const typename base_type::TModel &model)
Definition: richards_linker.h:335
Definition: richards_linker.h:324
RichardsLinker< dim, GardnerSaturationAdapter > base_type
Definition: richards_linker.h:326
GardnerSaturation(const typename base_type::TModel &model)
Definition: richards_linker.h:327
Definition: richards_linker.h:354
RichardsLinker< dim, HaverkampConductivityAdapter > base_type
Definition: richards_linker.h:356
HaverkampConductivity(const typename base_type::TModel &model)
Definition: richards_linker.h:357
Definition: richards_linker.h:346
RichardsLinker< dim, HaverkampSaturationAdapter > base_type
Definition: richards_linker.h:348
HaverkampSaturation(const typename base_type::TModel &model)
Definition: richards_linker.h:349
Definition: richards_linker.h:399
virtual void operator()(TData vValue[], const MathVector< dim > vGlobIP[], number time, int si, GridObject *elem, const MathVector< dim > vCornerCoords[], const MathVector< 2 > vLocIP[], const size_t nip, LocalVector *u, const MathMatrix< 2, dim > *vJT=NULL) const
Definition: richards_linker.h:453
virtual ~OnSurfaceCondition()
Definition: richards_linker.h:410
virtual void operator()(TData vValue[], const MathVector< dim > vGlobIP[], number time, int si, const size_t nip) const
returns values for global positions
Definition: richards_linker.h:437
MathVector< dim > math_vector_type
Definition: richards_linker.h:406
virtual void operator()(TData vValue[], const MathVector< dim > vGlobIP[], number time, int si, GridObject *elem, const MathVector< dim > vCornerCoords[], const MathVector< 3 > vLocIP[], const size_t nip, LocalVector *u, const MathMatrix< 3, dim > *vJT=NULL) const
Definition: richards_linker.h:464
OnSurfaceCondition(SmartPtr< TVectorData > spFlux)
Definition: richards_linker.h:409
UserData< MathVector< dim >, dim > TVectorData
Definition: richards_linker.h:407
virtual TRet operator()(TData &value, const MathVector< dim > &globIP, number time, int si) const
returns value for a global position
Definition: richards_linker.h:425
SmartPtr< TVectorData > m_spFlux
Definition: richards_linker.h:414
virtual void operator()(TData vValue[], const MathVector< dim > vGlobIP[], number time, int si, GridObject *elem, const MathVector< dim > vCornerCoords[], const MathVector< 1 > vLocIP[], const size_t nip, LocalVector *u, const MathMatrix< 1, dim > *vJT=NULL) const
Definition: richards_linker.h:442
UserData< number, dim, bool > user_data_base_type
Definition: richards_linker.h:405
bool continuous() const
returns if provided data is continuous over geometric object boundaries
Definition: richards_linker.h:418
number TData
Definition: richards_linker.h:402
bool TRet
Definition: richards_linker.h:403
bool requires_grid_fct() const
returns if grid function is needed for evaluation
Definition: richards_linker.h:421
Prototype of a linker. Returns values depending on the Functor class.
Definition: richards_linker.h:98
void evaluate(data_type &value, const MathVector< dim > &globIP, number time, int si) const
Definition: richards_linker.h:121
IRichardsLinker< dim > richards_base_type
Definition: richards_linker.h:104
TFunctor::TModel TModel
Definition: richards_linker.h:103
void set_capillary(SmartPtr< CplUserData< number, dim > > data)
Implements IRichardsLinker interface.
Definition: richards_linker.h:229
StdDataLinker< RichardsLinker< dim, TFunctor >, number, dim > base_type
Base class type.
Definition: richards_linker.h:101
number data_type
Definition: richards_linker.h:102
RichardsLinker(const TModel &model)
Definition: richards_linker.h:112
base_type::base_type user_data_base_type
Definition: richards_linker.h:110
TModel & model()
Definition: richards_linker.h:237
inputs
Definition: richards_linker.h:106
@ _SIZE_
Definition: richards_linker.h:106
@ _H_
Definition: richards_linker.h:106
void evaluate(data_type vValue[], const MathVector< dim > vGlobIP[], number time, int si, GridObject *elem, const MathVector< dim > vCornerCoords[], const MathVector< refDim > vLocIP[], const size_t nip, LocalVector *u, const MathMatrix< refDim, dim > *vJT=NULL) const
Definition: richards_linker.h:133
const TModel & model() const
Definition: richards_linker.h:238
TModel m_model
Definition: richards_linker.h:241
void eval_and_deriv(data_type vValue[], const MathVector< dim > vGlobIP[], number time, int si, GridObject *elem, const MathVector< dim > vCornerCoords[], const MathVector< refDim > vLocIP[], const size_t nip, LocalVector *u, bool bDeriv, int s, std::vector< std::vector< number > > vvvDeriv[], const MathMatrix< refDim, dim > *vJT=NULL) const
Definition: richards_linker.h:154
Factory class. This constructs appropriate "UserData" from suitable models.
Definition: richards_linker.h:366
return_type create_saturation(const ExponentialModel &m)
Exponential models.
Definition: richards_linker.h:378
return_type create_conductivity(const VanGenuchtenModel &m)
Definition: richards_linker.h:388
CplUserData< number, dim > TUserDataNumber
Definition: richards_linker.h:370
SmartPtr< CplUserData< number, dim > > input_type
Definition: richards_linker.h:373
input_type m_capillary
Definition: richards_linker.h:392
return_type create_conductivity(const ExponentialModel &m)
Definition: richards_linker.h:381
UserDataFactory(input_type capillary)
Definition: richards_linker.h:375
return_type create_saturation(const VanGenuchtenModel &m)
Definition: richards_linker.h:385
SmartPtr< TUserDataNumber > return_type
Definition: richards_linker.h:371
Implements a van Genuchten-Mualem model.
Definition: van_genuchten.h:368
void set_num_input(size_t num)
size_t series_id(size_t i, size_t s) const
size_t input_common_fct(size_t i, size_t fct) const
virtual void set_input(size_t i, SmartPtr< ICplUserData< dim > > input, SmartPtr< UserDataInfo > info)
virtual bool zero_derivative() const
#define UG_ASSERT(expr, msg)
void to_json(nlohmann::json &j, const BiotSubsetParameters &p)
Definition: biot_tools.cpp:57
void from_json(const nlohmann::json &j, BiotSubsetParameters &p)
Definition: biot_tools.cpp:69
ConductivityAdapter< HaverkampModel > HaverkampConductivityAdapter
Definition: richards_linker.h:342
SaturationAdapter< VanGenuchtenModel > vanGenuchtenSaturationAdapter
Shortcuts for van Genuchten.
Definition: richards_linker.h:290
ConductivityAdapter< GardnerModel > GardnerConductivityAdapter
Definition: richards_linker.h:320
SaturationAdapter< GardnerModel > GardnerSaturationAdapter
Definition: richards_linker.h:319
ConductivityAdapter< VanGenuchtenModel > vanGenuchtenConductivityAdapter
Definition: richards_linker.h:291
SaturationAdapter< HaverkampModel > HaverkampSaturationAdapter
Definition: richards_linker.h:341
SmartPtr< T, FreePolicy > make_sp(T *inst)
Returns conductivities (note: corresponds to relative permeability, iff Ksat=1.0).
Definition: richards_linker.h:257
static void get_func_values(const M &model, const double *h, double *k, double *dkdh, size_t n)
Definition: richards_linker.h:259
M TModel
Definition: richards_linker.h:258
Definition: richards_linker.h:278
RichardsLinker< dim, ConductivityAdapter< ExponentialModel > > base_type
Definition: richards_linker.h:279
ExponentialConductivity(const ExponentialModel &m)
Definition: richards_linker.h:280
Definition: richards_linker.h:270
ExponentialSaturation(const ExponentialModel &m)
Definition: richards_linker.h:272
RichardsLinker< dim, SaturationAdapter< ExponentialModel > > base_type
Definition: richards_linker.h:271
This is a 'dummy' base class. It indicates a pressure dependent linker.
Definition: richards_linker.h:82
IRichardsLinker()
Definition: richards_linker.h:83
SmartPtr< DependentUserData< number, dim > > m_spDCapillary
Definition: richards_linker.h:87
virtual ~IRichardsLinker()
Definition: richards_linker.h:84
SmartPtr< CplUserData< number, dim > > m_spCapillary
Definition: richards_linker.h:84
virtual void set_capillary(SmartPtr< CplUserData< number, dim > > data)=0
Definition: richards_linker.h:303
RichardsConductivity(const typename base_type::TModel &model)
Definition: richards_linker.h:305
RichardsLinker< dim, vanGenuchtenConductivityAdapter > base_type
Definition: richards_linker.h:304
van Genuchten classes. (ideally, those could be type-def'ed as well..)
Definition: richards_linker.h:296
RichardsLinker< dim, vanGenuchtenSaturationAdapter > base_type
Definition: richards_linker.h:297
RichardsSaturation(const typename base_type::TModel &model)
Definition: richards_linker.h:298
Returns saturations.
Definition: richards_linker.h:248
M TModel
Definition: richards_linker.h:249
static void get_func_values(const TModel &model, const double *h, double *s, double *dsdh, size_t n)
Definition: richards_linker.h:250