20 #ifndef __mast_conduction_surface_flux_load_h__ 21 #define __mast_conduction_surface_flux_load_h__ 29 namespace Conduction {
31 template <
typename ScalarType,
32 typename SectionAreaType,
33 typename FluxFieldType,
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 FluxFieldType,
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 FluxFieldType,
63 typename ScalarFieldType,
65 typename std::enable_if<Dim<3, ScalarType>::type
66 flux_derivative_multiplier(
const FluxFieldType *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 FluxFieldType,
81 typename ScalarFieldType,
83 typename std::enable_if<Dim==3, ScalarType>::type
84 flux_derivative_multiplier(
const FluxFieldType *f,
85 const SectionAreaType *s,
87 const ScalarFieldType &p) {
90 Assert0(!s,
"Pointer must be nullptr");
91 return f->derivative(c, p);
111 template <
typename FEVarType,
112 typename FluxFieldType,
113 typename SectionAreaType,
115 typename ContextType>
122 using vector_t =
typename Eigen::Matrix<scalar_t, Eigen::Dynamic, 1>;
123 using matrix_t =
typename Eigen::Matrix<scalar_t, Eigen::Dynamic, Eigen::Dynamic>;
138 Assert1(Dim < 3, Dim,
"SectionAreaType only used for 1D and 2D elements");
170 const typename FEVarType::fe_shape_deriv_t
173 for (
uint_t i=0; i<fe.n_q_points(); i++) {
182 for (
uint_t k=0; k<fe.n_basis(); k++)
183 res(k) -= fe.detJxW(i) * fe.phi(i, k) * p;
196 template <
typename ScalarFieldType>
198 const ScalarFieldType& f,
206 const typename FEVarType::fe_shape_deriv_t
209 for (
uint_t i=0; i<fe.n_q_points(); i++) {
213 flux_derivative_multiplier<
scalar_t,
220 for (
uint_t k=0; k<fe.n_basis(); k++)
221 res(k) -= fe.detJxW(i) * fe.phi(i, k) * p;
237 #endif // __mast_conduction_surface_flux_load_h__ This class implements the discrete evaluation of the surface heat flux kernel defined as where...
void set_fe_var_data(const FEVarType &fe)
const FEVarType * _fe_var_data
typename FEVarType::scalar_t scalar_t
typename Eigen::Matrix< scalar_t, Eigen::Dynamic, Eigen::Dynamic > matrix_t
#define Assert1(cond, v1, msg)
const SectionAreaType * _section
typename Eigen::Matrix< scalar_t, Eigen::Dynamic, 1 > vector_t
std::enable_if< Dim==3, ScalarType >::type flux_multiplier(const FluxFieldType *f, const SectionAreaType *s, ContextType &c)
void set_flux(const FluxFieldType &f)
void compute(ContextType &c, vector_t &res, matrix_t *jac=nullptr) const
Computes the residual of variational term and returns it in res.
virtual ~SurfaceFluxLoad()
void set_section_area(const SectionAreaType &s)
Provides the section area through the object s.
const FluxFieldType * _flux
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...
#define Assert0(cond, msg)
typename FEVarType::fe_shape_deriv_t::scalar_t basis_scalar_t