28 #ifndef OOMPH_FOURIER_DECOMPOSED_HELMHOLTZ_FLUX_ELEMENTS_HEADER
29 #define OOMPH_FOURIER_DECOMPOSED_HELMHOLTZ_FLUX_ELEMENTS_HEADER
34 #include <oomph-lib-config.h>
41 #include "../generic/Qelements.h"
52 template<
class ELEMENT>
73 "FourierDecomposedHelmholtzFluxElement",
74 OOMPH_CURRENT_FUNCTION,
75 OOMPH_EXCEPTION_LOCATION);
115 residuals, jacobian, 1);
127 void output(std::ostream& outfile,
const unsigned& n_plot)
143 void output(FILE* file_pt,
const unsigned& n_plot)
154 return std::complex<unsigned>(
169 unsigned n_node =
nnode();
175 for (
unsigned i = 0;
i < n_node;
i++)
193 unsigned n_node =
nnode();
199 for (
unsigned i = 0;
i < n_node;
i++)
216 flux = std::complex<double>(0.0, 0.0);
221 (*Flux_fct_pt)(x, flux);
237 const unsigned& flag);
256 template<
class ELEMENT>
259 const int& face_index)
281 "Bulk element must inherit from FourierDecomposedHelmholtzEquations.";
283 error_string, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
297 template<
class ELEMENT>
302 const unsigned& flag)
305 const unsigned n_node = nnode();
308 Shape psif(n_node), testf(n_node);
311 const unsigned n_intpt = integral_pt()->nweight();
317 int local_eqn_real = 0, local_eqn_imag = 0;
321 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
324 for (
unsigned i = 0;
i < 1;
i++)
326 s[
i] = integral_pt()->knot(ipt,
i);
330 double w = integral_pt()->weight(ipt);
334 double J = shape_and_test(
s, psif, testf);
343 for (
unsigned l = 0; l < n_node; l++)
346 for (
unsigned i = 0;
i < 2;
i++)
348 interpolated_x[
i] += nodal_position(l,
i) * psif[l];
353 double r = interpolated_x[0];
356 std::complex<double> flux(0.0, 0.0);
357 get_flux(interpolated_x, flux);
361 for (
unsigned l = 0; l < n_node; l++)
364 nodal_local_eqn(l, U_index_fourier_decomposed_helmholtz.real());
367 if (local_eqn_real >= 0)
370 residuals[local_eqn_real] -= flux.real() * testf[l] * r *
W;
377 nodal_local_eqn(l, U_index_fourier_decomposed_helmholtz.imag());
380 if (local_eqn_imag >= 0)
383 residuals[local_eqn_imag] -= flux.imag() * testf[l] * r *
W;
FaceElements are elements that coincide with the faces of higher-dimensional "bulk" elements....
int & face_index()
Index of the face (a number that uniquely identifies the face in the element)
double J_eulerian(const Vector< double > &s) const
Return the Jacobian of mapping from local to global coordinates at local position s....
double J_eulerian_at_knot(const unsigned &ipt) const
Return the Jacobian of the mapping from local to global coordinates at the ipt-th integration point O...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
A general Finite Element class.
virtual void output(std::ostream &outfile)
Output the element data — typically the values at the nodes in a format suitable for post-processing.
virtual void shape(const Vector< double > &s, Shape &psi) const =0
Calculate the geometric shape functions at local coordinate s. This function must be overloaded for e...
unsigned nnode() const
Return the number of nodes.
virtual void build_face_element(const int &face_index, FaceElement *face_element_pt)
Function for building a lower dimensional FaceElement on the specified face of the FiniteElement....
virtual void shape_at_knot(const unsigned &ipt, Shape &psi) const
Return the geometric shape function at the ipt-th integration point.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
virtual std::complex< unsigned > u_index_fourier_decomposed_helmholtz() const
Broken assignment operator.
A class for elements that allow the imposition of an applied flux on the boundaries of Fourier decomp...
void output(FILE *file_pt)
C-style output function – forward to broken version in FiniteElement until somebody decides what exac...
virtual std::complex< unsigned > u_index_fourier_decomposed_helmholtz() const
Return the index at which the unknown value is stored. (Real/imag part gives real index of real/imag ...
FourierDecomposedHelmholtzFluxElement()
Broken empty constructor.
double shape_and_test_at_knot(const unsigned &ipt, Shape &psi, Shape &test) const
Function to compute the shape and test functions and to return the Jacobian of mapping between local ...
void get_flux(const Vector< double > &x, std::complex< double > &flux)
Function to calculate the prescribed flux at a given spatial position.
FourierDecomposedHelmholtzFluxElement(const FourierDecomposedHelmholtzFluxElement &dummy)=delete
Broken copy constructor.
FourierDecomposedHelmholtzPrescribedFluxFctPt & flux_fct_pt()
Broken assignment operator.
void output(std::ostream &outfile, const unsigned &n_plot)
Output function – forward to broken version in FiniteElement until somebody decides what exactly they...
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector.
virtual void fill_in_generic_residual_contribution_fourier_decomposed_helmholtz_flux(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag)
Add the element's contribution to its residual vector. flag=1(or 0): do (or don't) compute the contri...
double shape_and_test(const Vector< double > &s, Shape &psi, Shape &test) const
Function to compute the shape and test functions and to return the Jacobian of mapping between local ...
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function – forward to broken version in FiniteElement until somebody decides what exac...
void output(std::ostream &outfile)
Output function – forward to broken version in FiniteElement until somebody decides what exactly they...
std::complex< unsigned > U_index_fourier_decomposed_helmholtz
The index at which the real and imag part of the unknown is stored at the nodes.
void(* FourierDecomposedHelmholtzPrescribedFluxFctPt)(const Vector< double > &x, std::complex< double > &flux)
Function pointer to the prescribed-flux function fct(x,f(x)) – x is a Vector and the flux is a comple...
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Add the element's contribution to its residual vector and its Jacobian matrix.
FourierDecomposedHelmholtzPrescribedFluxFctPt Flux_fct_pt
Function pointer to the (global) prescribed-flux function.
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...
An OomphLibError object which should be thrown when an run-time error is encountered....
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...