32 #ifndef OOMPH_PML_FOURIER_DECOMPOSED_HELMHOLTZ_FLUX_ELEMENTS_HEADER 33 #define OOMPH_PML_FOURIER_DECOMPOSED_HELMHOLTZ_FLUX_ELEMENTS_HEADER 38 #include <oomph-lib-config.h> 45 #include "../generic/Qelements.h" 57 template <
class ELEMENT>
81 "Don't call empty constructor for PMLFourierDecomposedHelmholtzFluxElement",
82 OOMPH_CURRENT_FUNCTION,
83 OOMPH_EXCEPTION_LOCATION);
91 (
"PMLFourierDecomposedHelmholtzFluxElement");
128 (residuals,jacobian,1);
137 void output(std::ostream &outfile,
const unsigned &n_plot)
148 void output(FILE* file_pt,
const unsigned &n_plot)
154 virtual inline std::complex<unsigned>
157 return std::complex<unsigned>(
173 unsigned n_node =
nnode();
179 for(
unsigned i=0;
i<n_node;
i++) {test[
i] = psi[
i];}
194 unsigned n_node =
nnode();
200 for(
unsigned i=0;
i<n_node;
i++) {test[
i] = psi[
i];}
214 flux = std::complex<double>(0.0,0.0);
219 (*Flux_fct_pt)(x,flux);
235 const unsigned& flag);
256 template<
class ELEMENT>
273 std::complex<unsigned>(0,1);
282 "Bulk element must inherit from PMLFourierDecomposedHelmholtzEquationsBase.";
285 OOMPH_CURRENT_FUNCTION,
286 OOMPH_EXCEPTION_LOCATION);
292 eqn_pt->u_index_pml_fourier_decomposed_helmholtz();
301 template<
class ELEMENT>
305 const unsigned& flag)
308 const unsigned n_node =
nnode();
311 Shape psif(n_node), testf(n_node);
320 int local_eqn_real=0 ,local_eqn_imag=0;
324 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
344 for(
unsigned l=0;l<n_node;l++)
347 for(
unsigned i=0;
i<2;
i++)
354 double r = interpolated_x[0];
357 std::complex<double> flux(0.0,0.0);
362 for(
unsigned l=0;l<n_node;l++)
369 if(local_eqn_real >= 0)
372 residuals[local_eqn_real] -= flux.real()*testf[l]*r*
W;
383 if(local_eqn_imag >= 0)
386 residuals[local_eqn_imag] -= flux.imag()*testf[l]*r*
W;
411 template <
class ELEMENT>
428 "Don't call empty constructor for PMLFourierDecomposedHelmholtzPowerMonitorElement",
429 OOMPH_CURRENT_FUNCTION,
430 OOMPH_EXCEPTION_LOCATION);
438 (
"PMLFourierDecomposedHelmholtzPowerMonitorElement");
455 const unsigned &
i)
const 465 void output(std::ostream &outfile,
const unsigned &n_plot)
475 void output(FILE* file_pt,
const unsigned &n_plot)
480 virtual inline std::complex<unsigned>
484 return std::complex<unsigned>(
496 std::ofstream outfile;
497 return global_power_contribution(outfile);
508 ELEMENT* bulk_elem_pt =
dynamic_cast<ELEMENT*
>(this->
bulk_element_pt());
511 unsigned nnode_bulk=bulk_elem_pt->nnode();
512 const unsigned n_node_local = this->
nnode();
515 const unsigned bulk_dim= bulk_elem_pt->dim();
516 const unsigned local_dim= this->
node_pt(0)->
ndim();
519 Shape psi(n_node_local);
522 Shape psi_bulk(nnode_bulk);
523 DShape dpsi_bulk_dx(nnode_bulk,bulk_dim);
536 if (outfile.is_open())
543 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
546 for(
unsigned i=0;
i<(local_dim-1);
i++)
568 (void)bulk_elem_pt->dshape_eulerian(s_bulk,psi_bulk,dpsi_bulk_dx);
572 std::complex<double> dphi_dn(0.0,0.0);
574 std::complex<double> interpolated_phi(0.0,0.0);
580 for(
unsigned l=0;l<nnode_bulk;l++)
583 const std::complex<double> phi_value(
584 bulk_elem_pt->nodal_value(
587 bulk_elem_pt->nodal_value(
593 for(
unsigned i=0;
i<bulk_dim;
i++)
595 interpolated_dphidx[
i] += phi_value*dpsi_bulk_dx(l,
i);
599 for(
unsigned l=0;l<n_node_local;l++)
602 const std::complex<double> phi_value(
608 interpolated_phi += phi_value*psi(l);
612 for(
unsigned i=0;
i<bulk_dim;
i++)
614 dphi_dn += interpolated_dphidx[
i]*unit_normal[
i];
619 (interpolated_phi.real()*dphi_dn.imag()-
620 interpolated_phi.imag()*dphi_dn.real());
623 double theta=atan2(x[0],x[1]);
625 if (outfile.is_open())
627 outfile << x[0] <<
" " 630 << integrand <<
"\n";
651 unsigned nnod=
nnode();
652 for (
unsigned i=0;
i<nnod;
i++)
671 unsigned n_node =
nnode();
677 for(
unsigned i=0;
i<n_node;
i++)
679 for(
unsigned j=0;j<1;j++)
682 dtest_ds(
i,j)= dpsi_ds(
i,j);
704 template<
class ELEMENT>
708 const int &face_index) :
718 std::complex<unsigned>(0,1);
730 "Bulk element must inherit from PMLFourierDecomposedHelmholtzEquationsBase.";
733 OOMPH_CURRENT_FUNCTION,
734 OOMPH_EXCEPTION_LOCATION);
741 eqn_pt->u_index_pml_fourier_decomposed_helmholtz();
double global_power_contribution(std::ofstream &outfile)
Compute the element's contribution to the time-averaged radiated power over the artificial boundary...
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector.
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...
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
void output(std::ostream &outfile, const unsigned &n_plot)
Output function – forward to broken version in FiniteElement until somebody decides what exactly the...
PMLFourierDecomposedHelmholtzFluxElement(const PMLFourierDecomposedHelmholtzFluxElement &dummy)
Broken copy constructor.
virtual void output(std::ostream &outfile)
Output the element data — typically the values at the nodes in a format suitable for post-processing...
A class for elements that allow the imposition of an applied flux on the boundaries of Fourier decomp...
double nodal_position(const unsigned &n, const unsigned &i) const
Return the i-th coordinate at local node n. If the node is hanging, the appropriate interpolation is ...
void output(std::ostream &outfile)
double shape_and_test(const Vector< double > &s, Shape &psi, Shape &test) const
Function to compute the test functions and to return the Jacobian of mapping between local and global...
int & face_index()
Index of the face (a number that uniquely identifies the face in the element)
const double Pi
50 digits from maple
PMLFourierDecomposedHelmholtzPrescribedFluxFctPt Flux_fct_pt
Function pointer to the (global) prescribed-flux function.
void outer_unit_normal(const Vector< double > &s, Vector< double > &unit_normal) const
Compute outer unit normal at the specified local coordinate.
A general Finite Element class.
PMLFourierDecomposedHelmholtzFluxElement()
Broken empty constructor.
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
In a FaceElement, the "global" intrinsic coordinate of the element along the boundary, when viewed as part of a compound geometric object is specified using the boundary coordinate defined by the mesh. Note: Boundary coordinates will have been set up when creating the underlying mesh, and their values will have been stored at the nodes.
double global_power_contribution()
Compute the element's contribution to the time-averaged radiated power over the artificial boundary...
double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s. Overloaded to get information from bulk...
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
Broken assignment operator.
PMLFourierDecomposedHelmholtzPrescribedFluxFctPt & flux_fct_pt()
Broken assignment operator.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
void output(std::ostream &outfile, const unsigned &n_plot)
Output function – forward to broken version in FiniteElement until somebody decides what exactly the...
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.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function – forward to broken version in FiniteElement until somebody decides what exa...
double J_eulerian(const Vector< double > &s) const
Return the Jacobian of mapping from local to global coordinates at local position s...
void(* PMLFourierDecomposedHelmholtzPrescribedFluxFctPt)(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 compl...
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
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 ...
FaceElement()
Constructor: Initialise all appropriate member data.
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
virtual void shape_at_knot(const unsigned &ipt, Shape &psi) const
Return the geometric shape function at the ipt-th integration point.
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
void get_flux(const Vector< double > &x, std::complex< double > &flux)
virtual void dshape_local(const Vector< double > &s, Shape &psi, DShape &dpsids) const
Function to compute the geometric shape functions and derivatives w.r.t. local coordinates at local c...
virtual std::complex< unsigned > u_index_pml_fourier_decomposed_helmholtz() const
Return the index at which the real/imag unknown value is stored.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function – forward to broken version in FiniteElement until somebody decides what exa...
A class for elements that allow postprocessing of the results – currently computes radiated power ov...
double nodal_value(const unsigned &n, const unsigned &i) const
Return the i-th value stored at local node n. Produces suitably interpolated values for hanging nodes...
void output(FILE *file_pt)
double d_shape_and_test_local(const Vector< double > &s, Shape &psi, Shape &test, DShape &dpsi_ds, DShape &dtest_ds) const
Function to compute the shape, test functions and derivates and to return the Jacobian of mapping bet...
virtual std::complex< unsigned > u_index_pml_fourier_decomposed_helmholtz() const
Return the index at which the unknown value is stored. (Real/imag part gives real index of real/imag ...
virtual void fill_in_generic_residual_contribution_pml_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...
void output(FILE *file_pt)
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
FiniteElement *& bulk_element_pt()
Pointer to higher-dimensional "bulk" element.
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...
std::complex< unsigned > U_index_pml_fourier_decomposed_helmholtz
The index at which the real and imag part of the unknown is stored at the nodes.
PMLFourierDecomposedHelmholtzPowerMonitorElement()
Broken empty constructor.
unsigned nnode() const
Return the number of nodes.
Vector< double > local_coordinate_in_bulk(const Vector< double > &s) const
Return vector of local coordinates in bulk element, given the local coordinates in this FaceElement...
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...
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...
std::complex< unsigned > U_index_pml_fourier_decomposed_helmholtz
The index at which the real and imag part of the unknown is stored at the nodes.
void output(std::ostream &outfile)
int nodal_local_eqn(const unsigned &n, const unsigned &i) const
Return the local equation number corresponding to the i-th value at the n-th local node...
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 ...