33 #ifndef __H__UG__LIB_DISC__SPATIAL_DISC__DARCY_VELOCITY_LINKER__
34 #define __H__UG__LIB_DISC__SPATIAL_DISC__DARCY_VELOCITY_LINKER__
64 :
public StdDataLinker< DarcyVelocityLinker<dim>, MathVector<dim>, dim>
92 (*m_spDensity)(density, globIP,
time, si);
93 (*m_spViscosity)(viscosity, globIP,
time, si);
94 (*m_spGravity)(gravity, globIP,
time, si);
95 (*m_spPressureGrad)(pressureGrad, globIP,
time, si);
96 (*m_spPermeability)(permeability, globIP,
time, si);
112 template <
int refDim>
123 std::vector<number> vDensity(nip);
124 std::vector<number> vViscosity(nip);
125 std::vector<MathVector<dim> > vGravity(nip);
126 std::vector<MathVector<dim> > vPressureGrad(nip);
127 std::vector<MathMatrix<dim,dim> > vPermeability(nip);
129 (*m_spDensity)(&vDensity[0], vGlobIP,
time, si,
130 elem, vCornerCoords, vLocIP, nip, u, vJT);
131 (*m_spViscosity)(&vViscosity[0], vGlobIP,
time, si,
132 elem, vCornerCoords, vLocIP, nip, u, vJT);
133 (*m_spGravity)(&vGravity[0], vGlobIP,
time, si,
134 elem, vCornerCoords, vLocIP, nip, u, vJT);
135 (*m_spPressureGrad)(&vPressureGrad[0], vGlobIP,
time, si,
136 elem, vCornerCoords, vLocIP, nip, u, vJT);
137 (*m_spPermeability)(&vPermeability[0], vGlobIP,
time, si,
138 elem, vCornerCoords, vLocIP, nip, u, vJT);
140 for(
size_t ip = 0;
ip < nip; ++
ip)
157 template <
int refDim>
178 for(
size_t ip = 0;
ip < nip; ++
ip)
201 this->set_zero(vvvDeriv, nip);
205 for(
size_t ip = 0;
ip < nip; ++
ip)
215 for(
size_t sh = 0; sh < this->num_sh(commonFct); ++sh)
224 for(
size_t ip = 0;
ip < nip; ++
ip)
225 for(
size_t fct = 0; fct <
m_spDDensity->num_fct(); ++fct)
243 for(
size_t sh = 0; sh < this->num_sh(commonFct); ++sh)
245 UG_ASSERT(commonFct < vvvDeriv[
ip].size(), commonFct<<
", "<<vvvDeriv[
ip].size());
246 UG_ASSERT(sh < vvvDeriv[
ip][commonFct].size(), sh<<
", "<<vvvDeriv[
ip][commonFct].size());
249 vDDensity[sh], Kmug);
255 for(
size_t ip = 0;
ip < nip; ++
ip)
256 for(
size_t fct = 0; fct <
m_spDGravity->num_fct(); ++fct)
271 for(
size_t sh = 0; sh < this->num_sh(commonFct); ++sh)
276 vvvDeriv[
ip][commonFct][sh] += tmp;
282 for(
size_t ip = 0;
ip < nip; ++
ip)
298 for(
size_t sh = 0; sh < this->num_sh(commonFct); ++sh)
303 vvvDeriv[
ip][commonFct][sh] += tmp;
309 for(
size_t ip = 0;
ip < nip; ++
ip)
331 for(
size_t sh = 0; sh < this->num_sh(commonFct); ++sh)
336 vvvDeriv[
ip][commonFct][sh] += tmp;
371 m_spDViscosity = data.template cast_dynamic<DependentUserData<number, dim> >();
384 m_spDDensity = data.template cast_dynamic<DependentUserData<number, dim> >();
397 m_spDGravity = data.template cast_dynamic<DependentUserData<MathVector<dim>,
dim> >();
411 static const size_t _K_ = 0;
426 static const size_t _G_ = 3;
439 std::cerr <<
"Setting some derivatives: "<<
m_partialDerivMask <<
"(" <<
this <<
")" << std::endl;
Definition: smart_pointer.h:108
constant matrix user data
Definition: const_user_data.h:232
constant scalar user data
Definition: const_user_data.h:153
Type based UserData.
Definition: user_data.h:501
const TData & value(size_t s, size_t ip) const
returns the value at ip
Definition: user_data.h:512
Hard Coded Linker for the Darcy velocity.
Definition: darcy_velocity_linker.h:65
SmartPtr< CplUserData< MathVector< dim >, dim > > m_spPressureGrad
Definition: darcy_velocity_linker.h:432
void set_density(number val)
Definition: darcy_velocity_linker.h:388
void set_pressure_gradient(SmartPtr< CplUserData< MathVector< dim >, dim > > data)
set pressure gradient import
Definition: darcy_velocity_linker.h:402
SmartPtr< CplUserData< MathMatrix< dim, dim >, dim > > m_spPermeability
Definition: darcy_velocity_linker.h:412
SmartPtr< CplUserData< MathVector< dim >, dim > > m_spGravity
Definition: darcy_velocity_linker.h:427
void set_viscosity(number val)
Definition: darcy_velocity_linker.h:375
SmartPtr< DependentUserData< MathVector< dim >, dim > > m_spDPressureGrad
Definition: darcy_velocity_linker.h:433
void evaluate(MathVector< dim > 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: darcy_velocity_linker.h:113
void set_permeability(SmartPtr< CplUserData< MathMatrix< dim, dim >, dim > > data)
set permeability import
Definition: darcy_velocity_linker.h:343
static const size_t _G_
import for gravity
Definition: darcy_velocity_linker.h:426
void set_viscosity(SmartPtr< CplUserData< number, dim > > data)
set permeability import
Definition: darcy_velocity_linker.h:368
SmartPtr< CplUserData< number, dim > > m_spViscosity
Definition: darcy_velocity_linker.h:417
SmartPtr< CplUserData< number, dim > > m_spDensity
Definition: darcy_velocity_linker.h:422
void evaluate(MathVector< dim > &value, const MathVector< dim > &globIP, number time, int si) const
Definition: darcy_velocity_linker.h:82
void set_derivative_mask(int mask)
Definition: darcy_velocity_linker.h:437
static const size_t _DP_
import for pressure gradient
Definition: darcy_velocity_linker.h:431
void set_permeability(number val)
Definition: darcy_velocity_linker.h:350
static const size_t _RHO_
import for density
Definition: darcy_velocity_linker.h:421
static const size_t _K_
import for permeability
Definition: darcy_velocity_linker.h:411
SmartPtr< DependentUserData< number, dim > > m_spDDensity
Definition: darcy_velocity_linker.h:423
StdDataLinker< DarcyVelocityLinker< dim >, MathVector< dim >, dim > base_type
Base class type.
Definition: darcy_velocity_linker.h:67
void set_gravity(SmartPtr< CplUserData< MathVector< dim >, dim > > data)
set gravity import
Definition: darcy_velocity_linker.h:394
static const size_t _MU_
import for viscosity
Definition: darcy_velocity_linker.h:416
SmartPtr< DependentUserData< MathMatrix< dim, dim >, dim > > m_spDPermeability
Definition: darcy_velocity_linker.h:413
void eval_and_deriv(MathVector< dim > vDarcyVel[], 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< MathVector< dim > > > vvvDeriv[], const MathMatrix< refDim, dim > *vJT=NULL) const
Definition: darcy_velocity_linker.h:158
void set_density(SmartPtr< CplUserData< number, dim > > data)
set density import
Definition: darcy_velocity_linker.h:381
int m_partialDerivMask
Definition: darcy_velocity_linker.h:444
DarcyVelocityLinker()
Definition: darcy_velocity_linker.h:70
SmartPtr< DependentUserData< MathVector< dim >, dim > > m_spDGravity
Definition: darcy_velocity_linker.h:428
SmartPtr< DependentUserData< number, dim > > m_spDViscosity
Definition: darcy_velocity_linker.h:418
The base class for all geometric objects, such as vertices, edges, faces, volumes,...
Definition: grid_base_objects.h:157
const MathVector< dim > & ip(size_t s, size_t ip) const
returns global ip
Definition: user_data.h:401
number time() const
get the current evaluation time
Definition: user_data.h:285
Definition: local_algebra.h:198
Factory providing LuaUserData.
Definition: lua_user_data.h:180
combines several UserDatas to a new UserData of a specified type
Definition: linker.h:54
void set_num_input(size_t num)
sets the number of inputs
Definition: linker.h:107
size_t input_common_fct(size_t i, size_t fct) const
returns the number in the common FctGrp for a fct of an input
Definition: linker.h:153
virtual void set_input(size_t i, SmartPtr< ICplUserData< dim > > input, SmartPtr< UserDataInfo > info)
sets an input
Definition: linker.h:114
virtual bool zero_derivative() const
returns if derivative is zero
Definition: linker_impl.h:179
void MatScale(matrix_t &mOut, typename matrix_t::value_type s, const matrix_t &m)
scales a matrix_t
Definition: math_matrix_functions_common_impl.hpp:317
#define UG_ASSERT(expr, msg)
Definition: assert.h:70
double number
Definition: types.h:124
void MatVecMult(vector_t_out &vOut, const matrix_t &m, const vector_t_in &v)
Matrix - Vector Multiplication.
Definition: math_matrix_vector_functions_common_impl.hpp:49
void VecScaleAppend(vector_t &vOut, typename vector_t::value_type s1, const vector_t &v1)
Scales a Vector and adds it to a second vector.
Definition: math_vector_functions_common_impl.hpp:126
void VecSubtract(vector_t &vOut, const vector_t &v1, const vector_t &v2)
subtracts v2 from v1 and stores the result in a vOut
Definition: math_vector_functions_common_impl.hpp:226
void VecScale(vector_t &vOut, const vector_t &v, typename vector_t::value_type s)
scales a MathVector<N>
Definition: math_vector_functions_common_impl.hpp:252
function util LuaCallbackHelper create(func)
SmartPtr< T, FreePolicy > make_sp(T *inst)
returns a SmartPtr for the passed raw pointer
Definition: smart_pointer.h:836