28 #ifndef OOMPH_HELMHOLTZ_FLUX_ELEMENTS_HEADER
29 #define OOMPH_HELMHOLTZ_FLUX_ELEMENTS_HEADER
34 #include <oomph-lib-config.h>
38 #include "../generic/Qelements.h"
50 template<
class ELEMENT>
59 std::complex<double>&
flux);
70 "Don't call empty constructor for HelmholtzFluxElement",
111 residuals, jacobian, 1);
122 const unsigned&
i)
const
137 void output(std::ostream& outfile,
const unsigned& n_plot)
153 void output(FILE* file_pt,
const unsigned& n_plot)
177 unsigned n_node =
nnode();
183 for (
unsigned i = 0;
i < n_node;
i++)
201 unsigned n_node =
nnode();
207 for (
unsigned i = 0;
i < n_node;
i++)
224 flux = std::complex<double>(0.0, 0.0);
229 (*Flux_fct_pt)(
x,
flux);
245 const unsigned& flag);
267 template<
class ELEMENT>
280 ELEMENT* elem_pt =
dynamic_cast<ELEMENT*
>(bulk_el_pt);
282 if (elem_pt->dim() == 3)
291 throw OomphLibError(
"This flux element will not work correctly if "
292 "nodes are hanging\n",
328 "Bulk element must inherit from HelmholtzEquations.";
330 "Nodes are one dimensional, but cannot cast the bulk element to\n";
331 error_string +=
"HelmholtzEquations<1>\n.";
332 error_string +=
"If you desire this functionality, you must "
333 "implement it yourself\n";
356 "Bulk element must inherit from HelmholtzEquations.";
358 "Nodes are two dimensional, but cannot cast the bulk element to\n";
359 error_string +=
"HelmholtzEquations<2>\n.";
360 error_string +=
"If you desire this functionality, you must "
361 "implement it yourself\n";
384 "Bulk element must inherit from HelmholtzEquations.";
385 error_string +=
"Nodes are three dimensional, but cannot cast the "
387 error_string +=
"HelmholtzEquations<3>\n.";
388 error_string +=
"If you desire this functionality, you must "
389 "implement it yourself\n";
404 std::ostringstream error_stream;
405 error_stream <<
"Dimension of node is " <<
Dim
406 <<
". It should be 1,2, or 3!" << std::endl;
418 template<
class ELEMENT>
423 const unsigned& flag)
426 const unsigned n_node = nnode();
429 Shape psif(n_node), testf(n_node);
432 const unsigned n_intpt = integral_pt()->nweight();
438 int local_eqn_real = 0, local_eqn_imag = 0;
442 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
445 for (
unsigned i = 0;
i < (
Dim - 1);
i++)
447 s[
i] = integral_pt()->knot(ipt,
i);
451 double w = integral_pt()->weight(ipt);
455 double J = shape_and_test(
s, psif, testf);
464 for (
unsigned l = 0; l < n_node; l++)
466 for (
unsigned i = 0;
i <
Dim;
i++)
468 interpolated_x[
i] += nodal_position(l,
i) * psif[l];
473 std::complex<double>
flux(0.0, 0.0);
478 for (
unsigned l = 0; l < n_node; l++)
480 local_eqn_real = nodal_local_eqn(l, U_index_helmholtz.real());
482 if (local_eqn_real >= 0)
485 residuals[local_eqn_real] -=
flux.real() * testf[l] *
W;
491 local_eqn_imag = nodal_local_eqn(l, U_index_helmholtz.imag());
493 if (local_eqn_imag >= 0)
496 residuals[local_eqn_imag] -=
flux.imag() * testf[l] *
W;
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
JacobiRotation< float > J
Definition: Jacobi_makeJacobi.cpp:3
RowVector3d w
Definition: Matrix_resize_int.cpp:3
Definition: elements.h:4338
int & face_index()
Definition: elements.h:4626
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
Definition: elements.h:4497
double J_eulerian(const Vector< double > &s) const
Definition: elements.cc:5242
double J_eulerian_at_knot(const unsigned &ipt) const
Definition: elements.cc:5328
Definition: elements.h:4998
Definition: elements.h:1313
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2175
virtual void output(std::ostream &outfile)
Definition: elements.h:3050
virtual void build_face_element(const int &face_index, FaceElement *face_element_pt)
Definition: elements.cc:5132
virtual void shape(const Vector< double > &s, Shape &psi) const =0
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2210
virtual void shape_at_knot(const unsigned &ipt, Shape &psi) const
Definition: elements.cc:3220
bool has_hanging_nodes() const
Definition: elements.h:2470
static DenseMatrix< double > Dummy_matrix
Definition: elements.h:227
Definition: helmholtz_elements.h:56
virtual std::complex< unsigned > u_index_helmholtz() const
Broken assignment operator.
Definition: helmholtz_elements.h:80
Definition: helmholtz_flux_elements.h:53
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
Definition: helmholtz_flux_elements.h:120
void output(std::ostream &outfile)
Definition: helmholtz_flux_elements.h:130
void get_flux(const Vector< double > &x, std::complex< double > &flux)
Definition: helmholtz_flux_elements.h:219
void output(FILE *file_pt, const unsigned &n_plot)
Definition: helmholtz_flux_elements.h:153
HelmholtzPrescribedFluxFctPt Flux_fct_pt
Function pointer to the (global) prescribed-flux function.
Definition: helmholtz_flux_elements.h:249
double shape_and_test_at_knot(const unsigned &ipt, Shape &psi, Shape &test) const
Definition: helmholtz_flux_elements.h:196
virtual void fill_in_generic_residual_contribution_helmholtz_flux(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag)
Compute the element's residual vector and the (zero) Jacobian matrix.
Definition: helmholtz_flux_elements.h:420
unsigned Dim
The spatial dimension of the problem.
Definition: helmholtz_flux_elements.h:252
HelmholtzFluxElement()
Broken empty constructor.
Definition: helmholtz_flux_elements.h:67
HelmholtzFluxElement(const HelmholtzFluxElement &dummy)=delete
Broken copy constructor.
double shape_and_test(const Vector< double > &s, Shape &psi, Shape &test) const
Definition: helmholtz_flux_elements.h:172
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector.
Definition: helmholtz_flux_elements.h:95
void output(FILE *file_pt)
Definition: helmholtz_flux_elements.h:145
void output(std::ostream &outfile, const unsigned &n_plot)
Definition: helmholtz_flux_elements.h:137
HelmholtzPrescribedFluxFctPt & flux_fct_pt()
Broken assignment operator.
Definition: helmholtz_flux_elements.h:88
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Definition: helmholtz_flux_elements.h:106
std::complex< unsigned > U_index_helmholtz
Definition: helmholtz_flux_elements.h:236
void(* HelmholtzPrescribedFluxFctPt)(const Vector< double > &x, std::complex< double > &flux)
Definition: helmholtz_flux_elements.h:58
virtual std::complex< unsigned > u_index_helmholtz() const
Definition: helmholtz_flux_elements.h:161
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
Definition: nodes.h:1054
Definition: oomph_definitions.h:222
Definition: refineable_elements.h:97
RealScalar s
Definition: level1_cplx_impl.h:130
char char char int int * k
Definition: level2_impl.h:374
static const unsigned Dim
Problem dimension.
Definition: two_d_tilted_square.cc:62
void flux(const double &time, const Vector< double > &x, double &flux)
Get flux applied along boundary x=0.
Definition: pretend_melt.cc:59
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
@ W
Definition: quadtree.h:63
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
void get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux: .
Definition: gen_axisym_advection_diffusion_elements.h:424
list x
Definition: plotDoE.py:28
Definition: indexed_view.cpp:20
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86