PlanarWave Namespace Reference

Functions

std::complex< doubleI (0.0, 1.0)
 Imaginary unit. More...
 
void get_exact_u (const Vector< double > &x, Vector< double > &u)
 Exact solution as a Vector of size 2, containing real and imag parts. More...
 
void plot ()
 Plot. More...
 

Variables

unsigned N_terms =100
 Number of terms in series. More...
 
double K =3.0*MathematicalConstants::Pi
 Wave number. More...
 

Detailed Description

Namespace to test representation of planar wave in spherical polars

////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// Namespace to test representation of planar wave in spherical polars

Function Documentation

◆ get_exact_u()

void PlanarWave::get_exact_u ( const Vector< double > &  x,
Vector< double > &  u 
)

Exact solution as a Vector of size 2, containing real and imag parts.

122  {
123  // Switch to spherical coordinates
124  double R=sqrt(x[0]*x[0]+x[1]*x[1]);
125 
126  double theta;
127  theta=atan2(x[0],x[1]);
128 
129  // Argument for Bessel/Hankel functions
130  double kr = K*R;
131 
132  // Need half-order Bessel functions
133  double bessel_offset=0.5;
134 
135  // Evaluate Bessel/Hankel functions
138  Vector<double> djv(N_terms);
139  Vector<double> dyv(N_terms);
140  double order_max_in=double(N_terms-1)+bessel_offset;
141  double order_max_out=0;
142 
143  // This function returns vectors containing
144  // J_k(x), Y_k(x) and their derivatives
145  // up to k=order_max, with k increasing in
146  // integer increments starting with smallest
147  // positive value. So, e.g. for order_max=3.5
148  // jv[0] contains J_{1/2}(x),
149  // jv[1] contains J_{3/2}(x),
150  // jv[2] contains J_{5/2}(x),
151  // jv[3] contains J_{7/2}(x).
152  CRBond_Bessel::bessjyv(order_max_in,
153  kr,
154  order_max_out,
155  &jv[0],&yv[0],
156  &djv[0],&dyv[0]);
157 
158 
159  // Assemble exact solution (actually no need to add terms
160  // below i=N_fourier as Legendre polynomial would be zero anyway)
161  complex<double> u_ex(0.0,0.0);
162  for(unsigned i=0;i<N_terms;i++)
163  {
164  //Associated_legendre_functions
166 
167  // Set exact solution
168  u_ex+=(2.0*i+1.0)*pow(I,i)*
169  sqrt(MathematicalConstants::Pi/(2.0*kr))*jv[i]*p;
170  }
171 
172  // Get the real & imaginary part of the result
173  u[0]=u_ex.real();
174  u[1]=u_ex.imag();
175 
176  }//end of get_exact_u
AnnoyingScalar cos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:136
AnnoyingScalar atan2(const AnnoyingScalar &y, const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:139
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
int i
Definition: BiCGSTAB_step_by_step.cpp:9
@ R
Definition: StatisticsVector.h:21
float * p
Definition: Tutorial_Map_using.cpp:9
EIGEN_DEVICE_FUNC const GlobalUnaryPowReturnType< Derived, ScalarExponent > pow(const Eigen::ArrayBase< Derived > &x, const ScalarExponent &exponent)
Definition: GlobalFunctions.h:137
#define I
Definition: main.h:127
double Pi
Definition: two_d_biharmonic.cc:235
double theta
Definition: two_d_biharmonic.cc:236
int bessjyv(double v, double x, double &vm, double *jv, double *yv, double *djv, double *dyv)
Definition: crbond_bessel.cc:1050
double K
Wave number.
Definition: sphere_scattering.cc:115
unsigned N_terms
Number of terms in the exact solution.
Definition: sphere_scattering.cc:234
double plgndr2(const unsigned &l, const unsigned &m, const double &x)
Legendre polynomials depending on two parameters.
Definition: fourier_decomposed_helmholtz_elements.cc:97
list x
Definition: plotDoE.py:28

References atan2(), CRBond_Bessel::bessjyv(), cos(), i, I, K, ProblemParameters::N_terms, p, oomph::MathematicalConstants::Pi, oomph::Legendre_functions_helper::plgndr2(), Eigen::bfloat16_impl::pow(), R, sqrt(), BiharmonicTestFunctions2::theta, and plotDoE::x.

◆ I()

std::complex< double > PlanarWave::I ( 0.  0,
1.  0 
)

Imaginary unit.

◆ plot()

void PlanarWave::plot ( )

Plot.

181  {
182  unsigned nr=20;
183  unsigned nz=100;
184  unsigned nt=40;
185 
186  ofstream some_file("planar_wave.dat");
187 
188  for (unsigned i_t=0;i_t<nt;i_t++)
189  {
190  double t=2.0*MathematicalConstants::Pi*double(i_t)/double(nt-1);
191 
192  some_file << "ZONE I="<< nz << ", J="<< nr << std::endl;
193 
194  Vector<double> x(2);
195  Vector<double> u(2);
196  for (unsigned i=0;i<nr;i++)
197  {
198  x[0]=0.001+double(i)/double(nr-1);
199  for (unsigned j=0;j<nz;j++)
200  {
201  x[1]=double(j)/double(nz-1);
202  get_exact_u(x,u);
203  complex<double> uu=complex<double>(u[0],u[1])*exp(-I*t);
204  some_file << x[0] << " " << x[1] << " "
205  << uu.real() << " " << uu.imag() << "\n";
206  }
207  }
208  }
209  }
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 exp(const bfloat16 &a)
Definition: BFloat16.h:615
const unsigned nz
Definition: ConstraintElementsUnitTest.cpp:32
void get_exact_u(const Vector< double > &x, Vector< double > &u)
Exact solution as a Vector of size 2, containing real and imag parts.
Definition: sphere_scattering.cc:243
t
Definition: plotPSD.py:36
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References Eigen::bfloat16_impl::exp(), ProblemParameters::get_exact_u(), i, I, j, Mesh_Parameters::nz, oomph::MathematicalConstants::Pi, plotPSD::t, and plotDoE::x.

Referenced by oomph::MGSolver< DIM >::interpolation_self_test(), oomph::FiniteElement::output_paraview(), oomph::MGSolver< DIM >::restriction_self_test(), oomph::QElement< 1, NNODE_1D >::write_paraview_output_offset_information(), oomph::QElement< 2, NNODE_1D >::write_paraview_output_offset_information(), oomph::QElement< 3, NNODE_1D >::write_paraview_output_offset_information(), and oomph::TElement< 1, NNODE_1D >::write_paraview_output_offset_information().

Variable Documentation

◆ K

double PlanarWave::K =3.0*MathematicalConstants::Pi

Wave number.

Referenced by oomph::SpineLineMarangoniSurfactantFluidInterfaceElement< ELEMENT >::add_additional_residual_contributions_interface(), bench_prod(), oomph::IsotropicStrainEnergyFunctionConstitutiveLaw::calculate_second_piola_kirchhoff_stress(), Eigen::internal::visitor_impl< Visitor, Derived, UnrollCount, Vectorize, false, ShortCircuitEvaluation >::CanVectorize(), Eigen::internal::visitor_impl< Visitor, Derived, UnrollCount, Vectorize, true, ShortCircuitEvaluation >::CanVectorize(), check_product(), WearableNurbsWall::computeWear(), WearableTriangulatedWall::computeWear(), Eigen::internal::copyBToRowMajor(), oomph::SolubleSurfactantTransportInterfaceElement::dflux_from_bulk_dC(), oomph::SolubleSurfactantTransportInterfaceElement::dflux_from_bulk_dC_bulk(), EIGEN_DECLARE_TEST(), oomph::SolubleSurfactantTransportInterfaceElement::flux_from_bulk(), Eigen::internal::gemmKernel(), get_exact_u(), Eigen::TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType, OutputKernelType >, Eigen::SyclDevice >::launchSC(), main(), SmallMatrix< numberOfRows, numberOfColumns >::operator*(), Eigen::internal::lhs_process_fraction_of_packet< nr, LhsProgress, RhsProgress, LhsScalar, RhsScalar, ResScalar, AccPacket, LhsPacket, RhsPacket, ResPacket, GEBPTraits, LinearMapper, DataMapper >::peeled_kc_onestep(), Eigen::internal::lhs_process_one_packet< nr, LhsProgress, RhsProgress, LhsScalar, RhsScalar, ResScalar, AccPacket, LhsPacket, RhsPacket, ResPacket, GEBPTraits, LinearMapper, DataMapper >::peeled_kc_onestep(), loop_on_k< M, N, K >::run(), loop_on_n< M, N, K, Scalar, Mode >::run(), Eigen::internal::visitor_impl< Visitor, Derived, UnrollCount, Vectorize, false, ShortCircuitEvaluation >::run(), Eigen::internal::visitor_impl< Visitor, Derived, UnrollCount, Vectorize, true, ShortCircuitEvaluation >::run(), test_linear_but_not_vectorizable(), Eigen::internal::triSolveKernel(), and Eigen::internal::triSolveKernelLxK().

◆ N_terms

unsigned PlanarWave::N_terms =100

Number of terms in series.

Referenced by oomph::FourierDecomposedHelmholtzDtNMesh< ELEMENT >::setup_gamma().