28 #ifndef OOMPH_PML_FOURIER_DECOMPOSED_HELMHOLTZ_FLUX_ELEMENTS_HEADER
29 #define OOMPH_PML_FOURIER_DECOMPOSED_HELMHOLTZ_FLUX_ELEMENTS_HEADER
34 #include <oomph-lib-config.h>
41 #include "../generic/Qelements.h"
52 template<
class ELEMENT>
73 "PMLFourierDecomposedHelmholtzFluxElement",
116 residuals, jacobian, 1);
128 void output(std::ostream& outfile,
const unsigned& n_plot)
144 void output(FILE* file_pt,
const unsigned& n_plot)
155 return std::complex<unsigned>(
170 unsigned n_node =
nnode();
176 for (
unsigned i = 0;
i < n_node;
i++)
194 unsigned n_node =
nnode();
200 for (
unsigned i = 0;
i < n_node;
i++)
217 flux = std::complex<double>(0.0, 0.0);
222 (*Flux_fct_pt)(
x,
flux);
238 const unsigned& flag);
257 template<
class ELEMENT>
260 const int& face_index)
280 std::string error_string =
"Bulk element must inherit from "
281 "PMLFourierDecomposedHelmholtzEquations.";
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);
361 for (
unsigned l = 0; l < n_node; l++)
364 nodal_local_eqn(l, U_index_pml_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_pml_fourier_decomposed_helmholtz.imag());
380 if (local_eqn_imag >= 0)
383 residuals[local_eqn_imag] -=
flux.imag() * testf[l] *
r *
W;
406 template<
class ELEMENT>
421 "PMLFourierDecomposedHelmholtzPowerMonitorElement",
442 const unsigned&
i)
const
457 void output(std::ostream& outfile,
const unsigned& n_plot)
472 void output(FILE* file_pt,
const unsigned& n_plot)
482 return std::complex<unsigned>(
494 std::ofstream outfile;
506 ELEMENT* bulk_elem_pt =
dynamic_cast<ELEMENT*
>(this->
bulk_element_pt());
509 unsigned nnode_bulk = bulk_elem_pt->nnode();
510 const unsigned n_node_local = this->
nnode();
513 const unsigned bulk_dim = bulk_elem_pt->dim();
514 const unsigned local_dim = this->
node_pt(0)->
ndim();
517 Shape psi(n_node_local);
520 Shape psi_bulk(nnode_bulk);
521 DShape dpsi_bulk_dx(nnode_bulk, bulk_dim);
534 if (outfile.is_open())
541 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
544 for (
unsigned i = 0;
i < (local_dim - 1);
i++)
566 (void)bulk_elem_pt->dshape_eulerian(s_bulk, psi_bulk, dpsi_bulk_dx);
570 std::complex<double> dphi_dn(0.0, 0.0);
572 std::complex<double> interpolated_phi(0.0, 0.0);
578 for (
unsigned l = 0; l < nnode_bulk; l++)
581 const std::complex<double> phi_value(
582 bulk_elem_pt->nodal_value(
584 bulk_elem_pt->u_index_pml_fourier_decomposed_helmholtz().real()),
585 bulk_elem_pt->nodal_value(
587 bulk_elem_pt->u_index_pml_fourier_decomposed_helmholtz().imag()));
590 for (
unsigned i = 0;
i < bulk_dim;
i++)
592 interpolated_dphidx[
i] += phi_value * dpsi_bulk_dx(l,
i);
596 for (
unsigned l = 0; l < n_node_local; l++)
599 const std::complex<double> phi_value(
603 interpolated_phi += phi_value * psi(l);
607 for (
unsigned i = 0;
i < bulk_dim;
i++)
609 dphi_dn += interpolated_dphidx[
i] * unit_normal[
i];
613 double integrand = (interpolated_phi.real() * dphi_dn.imag() -
614 interpolated_phi.imag() * dphi_dn.real());
619 if (outfile.is_open())
621 outfile <<
x[0] <<
" " <<
x[1] <<
" " <<
theta <<
" " << integrand
643 unsigned nnod =
nnode();
644 for (
unsigned i = 0;
i < nnod;
i++)
664 unsigned n_node =
nnode();
670 for (
unsigned i = 0;
i < n_node;
i++)
672 for (
unsigned j = 0;
j < 1;
j++)
675 dtest_ds(
i,
j) = dpsi_ds(
i,
j);
696 template<
class ELEMENT>
719 std::string error_string =
"Bulk element must inherit from "
720 "PMLFourierDecomposedHelmholtzEquations.";
AnnoyingScalar atan2(const AnnoyingScalar &y, const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:139
AnnoyingScalar imag(const AnnoyingScalar &)
Definition: AnnoyingScalar.h:132
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
void outer_unit_normal(const Vector< double > &s, Vector< double > &unit_normal) const
Compute outer unit normal at the specified local coordinate.
Definition: elements.cc:6006
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
Definition: elements.h:4497
Vector< double > local_coordinate_in_bulk(const Vector< double > &s) const
Definition: elements.cc:6353
FiniteElement *& bulk_element_pt()
Pointer to higher-dimensional "bulk" element.
Definition: elements.h:4735
double interpolated_x(const Vector< double > &s, const unsigned &i) const
Definition: elements.h:4528
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
double nodal_value(const unsigned &n, const unsigned &i) const
Definition: elements.h:2593
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
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
Definition: elements.h:1963
virtual void dshape_local(const Vector< double > &s, Shape &psi, DShape &dpsids) const
Definition: elements.h:1981
virtual void shape_at_knot(const unsigned &ipt, Shape &psi) const
Definition: elements.cc:3220
static DenseMatrix< double > Dummy_matrix
Definition: elements.h:227
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
Definition: nodes.h:1054
Definition: oomph_definitions.h:222
Definition: pml_fourier_decomposed_helmholtz_elements.h:162
virtual std::complex< unsigned > u_index_pml_fourier_decomposed_helmholtz() const
Broken assignment operator.
Definition: pml_fourier_decomposed_helmholtz_elements.h:197
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:56
void output(FILE *file_pt, const unsigned &n_plot)
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:144
virtual std::complex< unsigned > u_index_pml_fourier_decomposed_helmholtz() const
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:152
void(* PMLFourierDecomposedHelmholtzPrescribedFluxFctPt)(const Vector< double > &x, std::complex< double > &flux)
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:61
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector.
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:100
void output(FILE *file_pt)
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:136
std::complex< unsigned > U_index_pml_fourier_decomposed_helmholtz
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:229
double shape_and_test_at_knot(const unsigned &ipt, Shape &psi, Shape &test) const
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:189
PMLFourierDecomposedHelmholtzFluxElement(const PMLFourierDecomposedHelmholtzFluxElement &dummy)=delete
Broken copy constructor.
PMLFourierDecomposedHelmholtzFluxElement()
Broken empty constructor.
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:70
virtual void fill_in_generic_residual_contribution_pml_fourier_decomposed_helmholtz_flux(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag)
Compute the element's residual vector and the (zero) Jacobian matrix.
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:299
void output(std::ostream &outfile)
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:121
double shape_and_test(const Vector< double > &s, Shape &psi, Shape &test) const
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:165
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:111
void get_flux(const Vector< double > &x, std::complex< double > &flux)
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:212
PMLFourierDecomposedHelmholtzPrescribedFluxFctPt Flux_fct_pt
Function pointer to the (global) prescribed-flux function.
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:242
PMLFourierDecomposedHelmholtzPrescribedFluxFctPt & flux_fct_pt()
Broken assignment operator.
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:93
void output(std::ostream &outfile, const unsigned &n_plot)
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:128
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:410
PMLFourierDecomposedHelmholtzPowerMonitorElement()
Broken empty constructor.
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:418
std::complex< unsigned > U_index_pml_fourier_decomposed_helmholtz
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:684
void output(FILE *file_pt)
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:464
double d_shape_and_test_local(const Vector< double > &s, Shape &psi, Shape &test, DShape &dpsi_ds, DShape &dtest_ds) const
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:657
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
Broken assignment operator.
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:440
void output(FILE *file_pt, const unsigned &n_plot)
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:472
void output(std::ostream &outfile, const unsigned &n_plot)
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:457
double global_power_contribution(std::ofstream &outfile)
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:503
double shape_and_test(const Vector< double > &s, Shape &psi, Shape &test) const
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:636
virtual std::complex< unsigned > u_index_pml_fourier_decomposed_helmholtz() const
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:479
void output(std::ostream &outfile)
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:450
double global_power_contribution()
Definition: pml_fourier_decomposed_helmholtz_flux_elements.h:491
PMLFourierDecomposedHelmholtzPowerMonitorElement(const PMLFourierDecomposedHelmholtzPowerMonitorElement &dummy)=delete
Broken copy constructor.
float real
Definition: datatypes.h:10
RealScalar s
Definition: level1_cplx_impl.h:130
char char char int int * k
Definition: level2_impl.h:374
double theta
Definition: two_d_biharmonic.cc:236
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
const double Pi
50 digits from maple
Definition: oomph_utilities.h:157
@ 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
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2