35#include "fourier_decomposed_helmholtz.h"
38#include "meshes/triangle_mesh.h"
41#include "oomph_crbond_bessel.h"
66 std::complex<double>
I(0.0,1.0);
144 for (
unsigned i=0;
i<
nr;
i++)
147 for (
unsigned j=0;
j<
nz;
j++)
153 <<
uu.real() <<
" " <<
uu.imag() <<
"\n";
188 std::complex<double>
I(0.0,1.0);
253 flux=std::complex<double>(0.0,0.0);
323template<
class ELEMENT>
417template<
class ELEMENT>
423 delete_face_elements(Helmholtz_outer_boundary_mesh_pt);
425 delete_face_elements(Helmholtz_inner_boundary_mesh_pt);
436template<
class ELEMENT>
446 unsigned n_element = Bulk_mesh_pt->nelement();
462 create_flux_elements_on_inner_boundary();
465 create_outer_bc_elements();
477template<
class ELEMENT>
483 Trace_file.open(
"RESLT/trace.dat");
611 Bulk_mesh_pt->min_permitted_error()=0.00004;
612 Bulk_mesh_pt->max_permitted_error()=0.0001;
622 Bulk_mesh_pt->output(
"mesh.dat");
623 Bulk_mesh_pt->output_boundaries(
"boundaries.dat");
629 Helmholtz_outer_boundary_mesh_pt=
634 create_outer_bc_elements();
638 Helmholtz_inner_boundary_mesh_pt=
new Mesh;
639 create_flux_elements_on_inner_boundary();
653 unsigned n_element = Bulk_mesh_pt->nelement();
676template<
class ELEMENT>
681 Helmholtz_outer_boundary_mesh_pt->setup_gamma();
691 unsigned nel=Helmholtz_outer_boundary_mesh_pt->nelement();
692 for (
unsigned e=0;
e<
nel;
e++)
697 (Helmholtz_outer_boundary_mesh_pt->element_pt(
e));
700 const unsigned n_intpt =
el_pt->integral_pt()->nweight();
704 Helmholtz_outer_boundary_mesh_pt->gamma_at_gauss_point(
el_pt));
715 for(
unsigned i=0;
i<
n;
i++)
728 <<
flux.real() <<
" "
729 <<
flux.imag() <<
" "
744template<
class ELEMENT>
784 cout <<
"Norm of solution: " <<
sqrt(
norm) << std::endl << std::endl;
788 Bulk_mesh_pt->compute_norm(
norm);
789 Trace_file <<
norm << std::endl;
805template<
class ELEMENT>
813 unsigned n_element = Bulk_mesh_pt->nboundary_element(
b);
818 Bulk_mesh_pt->boundary_element_pt(
b,
e));
821 int face_index = Bulk_mesh_pt->face_index_at_boundary(
b,
e);
844template<
class ELEMENT>
852 unsigned n_element = Bulk_mesh_pt->nboundary_element(
b);
857 Bulk_mesh_pt->boundary_element_pt(
b,
e));
860 int face_index = Bulk_mesh_pt->face_index_at_boundary(
b,
e);
945 for (
unsigned j=0;
j<=
n;
j++)
952 for (
unsigned j=0;
j<=
n;
j++)
959 for (
unsigned j=0;
j<=
n;
j++)
966 for (
unsigned j=0;
j<=
n;
j++)
993 for (
unsigned j=0;
j<=
n;
j++)
AnnularQuadMesh(const unsigned &n_r, const unsigned &n_phi, const double &r_min, const double &r_max, const double &phi_min, const double &phi_max)
~FourierDecomposedHelmholtzProblem()
Destructor (empty)
void actions_after_adapt()
Actions after adapt: Rebuild the mesh of prescribed flux elements.
void create_outer_bc_elements()
Create BC elements on outer boundary.
Mesh * Helmholtz_inner_boundary_mesh_pt
Mesh of face elements that apply the prescribed flux on the inner boundary.
RefineableTriangleMesh< ELEMENT > * Bulk_mesh_pt
Pointer to the "bulk" mesh.
void actions_after_newton_solve()
Update the problem after solve (empty)
void create_flux_elements_on_inner_boundary()
Create flux elements on inner boundary.
void actions_before_newton_solve()
Update the problem specs before solve (empty)
void doc_solution(DocInfo &doc_info)
Doc the solution. DocInfo object stores flags/labels for where the output gets written to.
void delete_face_elements(Mesh *const &boundary_mesh_pt)
Delete boundary face elements and wipe the surface mesh.
TriangleMesh< ELEMENT > * Bulk_mesh_pt
Pointer to the "bulk" mesh.
FourierDecomposedHelmholtzProblem()
Constructor.
FourierDecomposedHelmholtzDtNMesh< ELEMENT > * Helmholtz_outer_boundary_mesh_pt
Pointer to mesh containing the DtN boundary condition elements.
ofstream Trace_file
Trace file.
void check_gamma(DocInfo &doc_info)
Check gamma computation.
void actions_before_adapt()
Actions before adapt: Wipe the mesh of prescribed flux elements.
void actions_before_newton_convergence_check()
Recompute gamma integral before checking Newton residuals.
Namespace to test representation of planar wave in spherical polars.
void get_exact_u(const Vector< double > &x, Vector< double > &u)
Exact solution as a Vector of size 2, containing real and imag parts.
std::complex< double > I(0.0, 1.0)
Imaginary unit.
unsigned N_terms
Number of terms in series.
Namespace for the Fourier decomposed Helmholtz problem parameters.
unsigned N_terms
Number of terms in the exact solution.
unsigned Nterms_for_DtN
Number of terms in computation of DtN boundary condition.
double K_squared
Square of the wavenumber.
void exact_minus_dudr(const Vector< double > &x, std::complex< double > &flux)
Get -du/dr (spherical r) for exact solution. Equal to prescribed flux on inner boundary.
int N_fourier
Fourier wave number.
Vector< double > Coeff(N_terms, 1.0)
Coefficients in the exact solution.
std::complex< double > I(0.0, 1.0)
Imaginary unit.
void get_exact_u(const Vector< double > &x, Vector< double > &u)
Exact solution as a Vector of size 2, containing real and imag parts.
int main(int argc, char **argv)
Driver code for Fourier decomposed Helmholtz problem.