20 #ifndef __mast_conduction_source_load_h__ 21 #define __mast_conduction_source_load_h__ 29 namespace Conduction {
31 template <
typename ScalarType,
32 typename SectionAreaType,
33 typename SourceLoadFieldType,
36 typename std::enable_if<Dim<3, ScalarType>::type
38 const SectionAreaType *s,
42 return f->value(c) * s->value(c);
45 template <
typename ScalarType,
46 typename SectionAreaType,
47 typename SourceLoadFieldType,
50 typename std::enable_if<Dim==3, ScalarType>::type
52 const SectionAreaType *s,
55 Assert0(!s,
"Pointer must be nullptr");
59 template <
typename ScalarType,
60 typename SectionAreaType,
61 typename SourceLoadFieldType,
63 typename ScalarFieldType,
65 typename std::enable_if<Dim<3, ScalarType>::type
66 source_load_derivative_multiplier(
const SourceLoadFieldType *f,
67 const SectionAreaType *s,
69 const ScalarFieldType &p) {
73 return (f->value(c) * s->derivative(c, p) +
74 s->value(c) * f->derivative(c, p));
77 template <
typename ScalarType,
78 typename SectionAreaType,
79 typename SourceLoadFieldType,
81 typename ScalarFieldType,
83 typename std::enable_if<Dim==3, ScalarType>::type
84 source_load_derivative_multiplier(
const SourceLoadFieldType *f,
85 const SectionAreaType *s,
87 const ScalarFieldType &p) {
90 Assert0(!s,
"Pointer must be nullptr");
91 return f->derivative(c);
110 template <
typename FEVarType,
111 typename SourceLoadFieldType,
112 typename SectionAreaType,
114 typename ContextType>
121 using vector_t =
typename Eigen::Matrix<scalar_t, Eigen::Dynamic, 1>;
122 using matrix_t =
typename Eigen::Matrix<scalar_t, Eigen::Dynamic, Eigen::Dynamic>;
137 Assert1(Dim < 3, Dim,
"SectionAreaType only used for 1D and 2D elements");
169 const typename FEVarType::fe_shape_deriv_t
172 for (
uint_t i=0; i<fe.n_q_points(); i++) {
181 for (
uint_t k=0; k<fe.n_basis(); k++)
182 res(k) -= fe.detJxW(i) * fe.phi(i, k) * p;
194 template <
typename ScalarFieldType>
196 const ScalarFieldType& f,
204 const typename FEVarType::fe_shape_deriv_t
207 for (
uint_t i=0; i<fe.n_q_points(); i++) {
211 source_load_derivative_multiplier<
scalar_t,
218 for (
uint_t k=0; k<fe.n_basis(); k++)
219 res(k) -= fe.detJxW(i) * fe.phi(i, k) * p;
235 #endif // __mast_conduction_source_load_h__ const SourceLoadFieldType * _load
This class implements the discrete evaluation of the conduction (Laplace operator) kernel defined as ...
typename FEVarType::scalar_t scalar_t
typename Eigen::Matrix< scalar_t, Eigen::Dynamic, Eigen::Dynamic > matrix_t
#define Assert1(cond, v1, msg)
typename Eigen::Matrix< scalar_t, Eigen::Dynamic, 1 > vector_t
typename FEVarType::fe_shape_deriv_t::scalar_t basis_scalar_t
const FEVarType * _fe_var_data
void derivative(ContextType &c, const ScalarFieldType &f, vector_t &res, matrix_t *jac=nullptr) const
Computes the derivative of residual of variational term with respect to parameter and returns it in...
virtual ~SourceHeatLoad()
#define Assert0(cond, msg)
void compute(ContextType &c, vector_t &res, matrix_t *jac=nullptr) const
Computes the residual of variational term and returns it in res.
void set_fe_var_data(const FEVarType &fe)
void set_section_area(const SectionAreaType &s)
Provides the section area through the object s.
void set_source(const SourceLoadFieldType &s)
std::enable_if< Dim==3, ScalarType >::type source_load_multiplier(const SourceLoadFieldType *f, const SectionAreaType *s, ContextType &c)
const SectionAreaType * _section