26 #ifndef OOMPH_FD_HH_TIME_HARMONIC_LIN_ELAST_HEADER
27 #define OOMPH_FD_HH_TIME_HARMONIC_LIN_ELAST_HEADER
46 template<
class ELASTICITY_BULK_ELEMENT,
class HELMHOLTZ_BULK_ELEMENT>
89 ELASTICITY_BULK_ELEMENT* elem_pt =
90 dynamic_cast<ELASTICITY_BULK_ELEMENT*
>(element_pt);
92 if (elem_pt->dim() == 3)
101 throw OomphLibError(
"This flux element will not work correctly "
102 "if nodes are hanging\n",
119 ELASTICITY_BULK_ELEMENT* cast_element_pt =
120 dynamic_cast<ELASTICITY_BULK_ELEMENT*
>(element_pt);
122 ->U_index_fourier_decomposed_time_harmonic_linear_elasticity_helmholtz_traction
124 for (
unsigned i = 0;
i < n_dim + 1;
i++)
127 ->U_index_fourier_decomposed_time_harmonic_linear_elasticity_helmholtz_traction
130 ->u_index_time_harmonic_fourier_decomposed_linear_elasticity(
i);
158 const double&
q()
const
181 void output(std::ostream& outfile,
const unsigned& n_plot)
190 const double q_value =
q();
198 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
213 HELMHOLTZ_BULK_ELEMENT* ext_el_pt =
216 std::complex<double> u_helmholtz =
217 ext_el_pt->interpolated_u_fourier_decomposed_helmholtz(s_ext);
220 ext_el_pt->interpolated_u_fourier_decomposed_helmholtz(s_ext);
221 for (
unsigned i = 0;
i < n_dim;
i++)
223 traction[
i] = -q_value * interpolated_normal[
i] * u_helmholtz;
226 outfile << ext_el_pt->interpolated_x(s_ext, 0) <<
" "
227 << ext_el_pt->interpolated_x(s_ext, 1) <<
" " << traction[0]
228 <<
" " << traction[1] <<
" " << interpolated_normal[0] <<
" "
229 << interpolated_normal[1] <<
" " << u_helmholtz <<
" "
230 <<
zeta[0] << std::endl;
241 void output(FILE* file_pt,
const unsigned& n_plot)
256 template<
class ELASTICITY_BULK_ELEMENT,
class HELMHOLTZ_BULK_ELEMENT>
258 FourierDecomposedTimeHarmonicLinElastLoadedByHelmholtzPressureBCElement<
259 ELASTICITY_BULK_ELEMENT,
260 HELMHOLTZ_BULK_ELEMENT>::Default_Q_Value = 1.0;
266 template<
class ELASTICITY_BULK_ELEMENT,
class HELMHOLTZ_BULK_ELEMENT>
267 void FourierDecomposedTimeHarmonicLinElastLoadedByHelmholtzPressureBCElement<
268 ELASTICITY_BULK_ELEMENT,
269 HELMHOLTZ_BULK_ELEMENT>::
270 fill_in_contribution_to_residuals_helmholtz_traction(
274 unsigned n_node = nnode();
278 unsigned n_position_type = this->nnodal_position_type();
279 if (n_position_type != 1)
281 throw OomphLibError(
"LinearElasticity is not yet implemented for more "
282 "than one position type.",
289 const unsigned n_dim = this->nodal_dimension();
292 std::vector<std::complex<unsigned>> u_nodal_index(n_dim + 1);
293 for (
unsigned i = 0;
i < n_dim + 1;
i++)
297 ->U_index_fourier_decomposed_time_harmonic_linear_elasticity_helmholtz_traction
306 DShape dpsids(n_node, n_dim - 1);
309 const double q_value =
q();
315 unsigned n_intpt = integral_pt()->nweight();
318 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
321 double w = integral_pt()->weight(ipt);
324 dshape_local_at_knot(ipt, psi, dpsids);
333 for (
unsigned l = 0; l < n_node; l++)
336 for (
unsigned i = 0;
i < n_dim;
i++)
339 const double x_local = nodal_position(l,
i);
340 interpolated_x[
i] += x_local * psi(l);
343 for (
unsigned j = 0;
j < n_dim - 1;
j++)
345 interpolated_A(
j,
i) += x_local * dpsids(l,
j);
351 double r = interpolated_x[0];
355 for (
unsigned i = 0;
i < n_dim - 1;
i++)
357 for (
unsigned j = 0;
j < n_dim - 1;
j++)
363 for (
unsigned k = 0;
k < n_dim;
k++)
365 A(
i,
j) += interpolated_A(
i,
k) * interpolated_A(
j,
k);
372 outer_unit_normal(ipt, interpolated_normal);
382 Adet =
A(0, 0) *
A(1, 1) -
A(0, 1) *
A(1, 0);
386 "Wrong dimension in TimeHarmonicLinElastLoadedByPressureElement",
387 "TimeHarmonicLinElastLoadedByPressureElement::fill_in_contribution_"
394 double W =
w *
sqrt(Adet);
397 HELMHOLTZ_BULK_ELEMENT* ext_el_pt =
398 dynamic_cast<HELMHOLTZ_BULK_ELEMENT*
>(external_element_pt(0, ipt));
402 std::complex<double> u_helmholtz =
403 ext_el_pt->interpolated_u_fourier_decomposed_helmholtz(s_ext);
404 for (
unsigned i = 0;
i < n_dim;
i++)
406 traction[
i] = -q_value * interpolated_normal[
i] * u_helmholtz;
409 for (
unsigned l = 0; l < n_node; l++)
412 for (
unsigned i = 0;
i < n_dim + 1;
i++)
414 local_eqn = this->nodal_local_eqn(l, u_nodal_index[
i].
real());
419 residuals[local_eqn] -= traction[
i].real() * psi(l) *
r *
W;
422 local_eqn = this->nodal_local_eqn(l, u_nodal_index[
i].
imag());
427 residuals[local_eqn] -= traction[
i].imag() * psi(l) *
r *
W;
450 template<
class HELMHOLTZ_BULK_ELEMENT,
class ELASTICITY_BULK_ELEMENT>
495 residuals, jacobian, 1);
510 void output(std::ostream& outfile,
const unsigned& n_plot)
521 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
524 for (
unsigned i = 0;
i < (
Dim - 1);
i++)
536 ELASTICITY_BULK_ELEMENT* ext_el_pt =
541 ->interpolated_u_time_harmonic_fourier_decomposed_linear_elasticity(
547 std::complex<double>
flux = (displ[0] * interpolated_normal[0] +
548 displ[1] * interpolated_normal[1]);
551 outfile << ext_el_pt->interpolated_x(s_ext, 0) <<
" "
552 << ext_el_pt->interpolated_x(s_ext, 1) <<
" "
553 <<
flux * interpolated_normal[0] <<
" "
554 <<
flux * interpolated_normal[1] <<
" "
555 << interpolated_normal[0] <<
" " << interpolated_normal[1]
556 <<
" " <<
flux <<
" " <<
zeta[0] << std::endl;
568 void output(FILE* file_pt,
const unsigned& n_plot)
583 unsigned n_node =
nnode();
589 for (
unsigned i = 0;
i < n_node;
i++)
607 unsigned n_node =
nnode();
613 for (
unsigned i = 0;
i < n_node;
i++)
630 const unsigned& flag);
649 template<
class HELMHOLTZ_BULK_ELEMENT,
class ELASTICITY_BULK_ELEMENT>
651 HELMHOLTZ_BULK_ELEMENT,
652 ELASTICITY_BULK_ELEMENT>::
653 FourierDecomposedHelmholtzFluxFromNormalDisplacementBCElement(
665 HELMHOLTZ_BULK_ELEMENT* elem_pt =
666 dynamic_cast<HELMHOLTZ_BULK_ELEMENT*
>(bulk_el_pt);
668 if (elem_pt->dim() == 3)
677 throw OomphLibError(
"This flux element will not work correctly if "
678 "nodes are hanging\n",
714 "Bulk element must inherit from HelmholtzEquations.";
716 "Nodes are three dimensional, but cannot cast the bulk element to\n";
717 error_string +=
"HelmholtzEquations<3>\n.";
719 "If you desire this functionality, you must implement it yourself\n";
737 template<
class HELMHOLTZ_BULK_ELEMENT,
class ELASTICITY_BULK_ELEMENT>
739 HELMHOLTZ_BULK_ELEMENT,
740 ELASTICITY_BULK_ELEMENT>::
741 fill_in_generic_residual_contribution_helmholtz_flux_from_displacement(
744 const unsigned& flag)
747 const unsigned n_node = nnode();
750 Shape psif(n_node), testf(n_node);
753 const unsigned n_intpt = integral_pt()->nweight();
762 const std::complex<unsigned> u_index_helmholtz =
763 U_index_helmholtz_from_displacement;
767 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
770 for (
unsigned i = 0;
i < (
Dim - 1);
i++)
772 s[
i] = integral_pt()->knot(ipt,
i);
776 double w = integral_pt()->weight(ipt);
780 double J = shape_and_test(
s, psif, testf);
789 for (
unsigned l = 0; l < n_node; l++)
792 for (
unsigned i = 0;
i <
Dim;
i++)
794 interpolated_x[
i] += nodal_position(l,
i) * psif[l];
799 double r = interpolated_x[0];
802 outer_unit_normal(ipt, interpolated_normal);
805 ELASTICITY_BULK_ELEMENT* ext_el_pt =
806 dynamic_cast<ELASTICITY_BULK_ELEMENT*
>(external_element_pt(0, ipt));
810 ->interpolated_u_time_harmonic_fourier_decomposed_linear_elasticity(
816 std::complex<double>
flux =
817 (displ[0] * interpolated_normal[0] + displ[1] * interpolated_normal[1]);
822 for (
unsigned l = 0; l < n_node; l++)
824 local_eqn = nodal_local_eqn(l, u_index_helmholtz.real());
829 residuals[local_eqn] -=
flux.real() * testf[l] *
r *
W;
836 local_eqn = nodal_local_eqn(l, u_index_helmholtz.imag());
841 residuals[local_eqn] -=
flux.imag() * testf[l] *
r *
W;
AnnoyingScalar imag(const AnnoyingScalar &)
Definition: AnnoyingScalar.h:132
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
int i
Definition: BiCGSTAB_step_by_step.cpp:9
JacobiRotation< float > J
Definition: Jacobi_makeJacobi.cpp:3
RowVector3d w
Definition: Matrix_resize_int.cpp:3
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Definition: bench_gemm.cpp:47
Definition: element_with_external_element.h:56
Vector< double > & external_element_local_coord(const unsigned &interaction_index, const unsigned &ipt)
Definition: element_with_external_element.h:136
void set_ninteraction(const unsigned &n_interaction)
Definition: element_with_external_element.h:178
FiniteElement *& external_element_pt(const unsigned &interaction_index, const unsigned &ipt)
Definition: element_with_external_element.h:107
void fill_in_jacobian_from_external_interaction_by_fd(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Definition: element_with_external_element.h:345
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 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
void interpolated_zeta(const Vector< double > &s, Vector< double > &zeta) const
Definition: elements.cc:4675
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
unsigned nodal_dimension() const
Return the required Eulerian dimension of the nodes in this element.
Definition: elements.h:2484
virtual void shape_at_knot(const unsigned &ipt, Shape &psi) const
Definition: elements.cc:3220
bool has_hanging_nodes() const
Definition: elements.h:2470
Definition: fourier_decomposed_helmholtz_elements.h:84
virtual std::complex< unsigned > u_index_fourier_decomposed_helmholtz() const
Broken assignment operator.
Definition: fourier_decomposed_helmholtz_elements.h:114
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:455
FourierDecomposedHelmholtzFluxFromNormalDisplacementBCElement(FiniteElement *const &bulk_el_pt, const int &face_index)
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:653
void fill_in_generic_residual_contribution_helmholtz_flux_from_displacement(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag)
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:741
FourierDecomposedHelmholtzFluxFromNormalDisplacementBCElement(const FourierDecomposedHelmholtzFluxFromNormalDisplacementBCElement &dummy)=delete
Broken copy constructor.
void output(std::ostream &outfile)
Output function.
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:502
std::complex< unsigned > U_index_helmholtz_from_displacement
The index at which the unknown is stored at the nodes.
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:636
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:490
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function.
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:568
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Broken assignment operator.
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:479
void output(FILE *file_pt)
C-style output function.
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:562
double shape_and_test_at_knot(const unsigned &ipt, Shape &psi, Shape &test) const
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:602
unsigned Dim
The spatial dimension of the problem.
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:633
void output(std::ostream &outfile, const unsigned &n_plot)
Output function: flux etc at Gauss points; n_plot is ignored.
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:510
double shape_and_test(const Vector< double > &s, Shape &psi, Shape &test) const
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:578
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:51
void output(FILE *file_pt)
C_style output function.
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:235
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function.
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:241
void output(std::ostream &outfile, const unsigned &n_plot)
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:181
Vector< std::complex< unsigned > > U_index_fourier_decomposed_time_harmonic_linear_elasticity_helmholtz_traction
Index at which the i-th displacement component is stored.
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:64
static double Default_Q_Value
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:60
const double & q() const
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:158
double *& q_pt()
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:165
void fill_in_contribution_to_residuals_helmholtz_traction(Vector< double > &residuals)
Helper function that actually calculates the residuals.
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:270
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Return the residuals.
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:136
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Fill in contribution from Jacobian.
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:143
double * Q_pt
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:56
FourierDecomposedTimeHarmonicLinElastLoadedByHelmholtzPressureBCElement(FiniteElement *const &element_pt, const int &face_index)
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:76
void output(std::ostream &outfile)
Output function.
Definition: fourier_decomposed_helmholtz_time_harmonic_linear_elasticity_interaction.h:172
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.
Definition: oomph_definitions.h:222
Definition: refineable_elements.h:97
Definition: oomph-lib/src/generic/Vector.h:58
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
EIGEN_DEVICE_FUNC const Scalar & q
Definition: SpecialFunctionsImpl.h:2019
EIGEN_STRONG_INLINE const Eigen::CwiseBinaryOp< Eigen::internal::scalar_zeta_op< typename DerivedX::Scalar >, const DerivedX, const DerivedQ > zeta(const Eigen::ArrayBase< DerivedX > &x, const Eigen::ArrayBase< DerivedQ > &q)
Definition: SpecialFunctionsArrayAPI.h:152
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
Definition: indexed_view.cpp:20
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
void output(std::ostream &outfile, const unsigned &nplot)
Overload output function.
Definition: overloaded_element_body.h:490
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2