34 #include "helmholtz.h" 35 #include "time_harmonic_linear_elasticity.h" 36 #include "multi_physics.h" 39 #include "meshes/annular_mesh.h" 42 using namespace oomph;
71 TimeHarmonicIsotropicElasticityTensor
E(Nu);
82 Omega_sq=Density_ratio*
Q;
91 Vector<std::complex<double> >& u)
93 Vector<double> normal(2);
94 double norm=sqrt(x[0]*x[0]+x[1]*x[1]);
95 double phi=atan2(x[1],x[0]);
99 u[0]=complex<double>(normal[0]*cos(
double(N)*phi),0.0);
100 u[1]=complex<double>(normal[1]*cos(
double(N)*phi),0.0);
111 std::complex<double>
HankelH1(
const double& k,
const double& x)
113 Vector<std::complex<double> > h(2);
114 Vector<std::complex<double> > hp(2);
115 Hankel_functions_for_helmholtz_problem::Hankel_first(2,x,h,hp);
127 cout <<
"Never get here. k=" << k << std::endl;
130 return std::complex<double>(1.0,1.0);
139 std::complex<double> MapleGenVar1;
140 std::complex<double> MapleGenVar2;
141 std::complex<double> MapleGenVar3;
142 std::complex<double> MapleGenVar4;
143 std::complex<double> MapleGenVar5;
144 std::complex<double> MapleGenVar6;
145 std::complex<double> MapleGenVar7;
146 std::complex<double> MapleGenVar8;
147 std::complex<double> t0;
150 MapleGenVar3 = (-2.0/(2.0+2.0*
Nu)*1.0+2.0/(2.0+2.0*Nu)*1.0*
151 H_coating)/(Nu/(1.0+Nu)/(1.0-2.0*
Nu)+2.0/(2.0+2.0*Nu)-2.0/(2.0+2.0*
Nu)*
152 H_coating+1/(2.0+2.0*Nu)*H_coating*
H_coating)/2.0;
153 MapleGenVar5 = -1/(Nu/(1.0+
Nu)/(1.0-2.0*Nu)+2.0/(2.0+2.0*
Nu)-2.0/(2.0+2.0
154 *Nu)*H_coating+1/(2.0+2.0*
Nu)*H_coating*H_coating)*Q/2.0;
155 MapleGenVar6 =
HankelH1(0.0,sqrt(K_squared))*(-(-2.0/(2.0+2.0*
Nu)*1.0
156 +2.0/(2.0+2.0*Nu)*1.0*
H_coating)/(Nu/(1.0+Nu)/(1.0-2.0*
Nu)+2.0/(2.0+2.0*Nu)
157 -2.0/(2.0+2.0*
Nu)*H_coating+1/(2.0+2.0*Nu)*H_coating*
H_coating)/2.0+(2.0/(2.0+
158 2.0*Nu)*1.0-2.0/(2.0+2.0*
Nu)*1.0*H_coating+2.0*1.0*Nu/(1.0+Nu)/(1.0
159 -2.0*
Nu)-2.0*1.0*H_coating*Nu/(1.0+Nu)/(1.0-2.0*
Nu))/(Nu/(1.0+
Nu)/(1.0-2.0*
160 Nu)+2.0/(2.0+2.0*
Nu)-2.0/(2.0+2.0*Nu)*H_coating+1/(2.0+2.0*
Nu)*H_coating*
161 H_coating)/2.0)/(
HankelH1(1.0,sqrt(K_squared))*sqrt(K_squared)-Q*
HankelH1(0.0,
162 sqrt(K_squared))/(Nu/(1.0+
Nu)/(1.0-2.0*Nu)+2.0/(2.0+2.0*
Nu)-2.0/(2.0+2.0*Nu)*
163 H_coating+1/(2.0+2.0*
Nu)*H_coating*H_coating)/2.0+Q*
HankelH1(0.0,sqrt(K_squared
164 ))*(1.0-2.0*H_coating+H_coating*
H_coating)/(Nu/(1.0+Nu)/(1.0-2.0*
Nu)+2.0/(2.0+
165 2.0*Nu)-2.0/(2.0+2.0*
Nu)*H_coating+1/(2.0+2.0*Nu)*H_coating*
H_coating)/2.0);
166 MapleGenVar4 = MapleGenVar5*MapleGenVar6;
167 MapleGenVar2 = MapleGenVar3+MapleGenVar4;
168 MapleGenVar3 = MapleGenVar2;
169 MapleGenVar5 = -(2.0/(2.0+2.0*
Nu)*1.0-2.0/(2.0+2.0*Nu)*1.0*
170 H_coating+2.0*1.0*Nu/(1.0+
Nu)/(1.0-2.0*Nu)-2.0*1.0*H_coating*Nu/(1.0+
Nu 171 )/(1.0-2.0*Nu))/(Nu/(1.0+Nu)/(1.0-2.0*
Nu)+2.0/(2.0+2.0*Nu)-2.0/(2.0+2.0*
Nu)*
172 H_coating+1/(2.0+2.0*Nu)*H_coating*
H_coating)/2.0;
173 MapleGenVar7 = (1.0-2.0*H_coating+H_coating*
H_coating)/(Nu/(1.0+Nu)/(1.0
174 -2.0*
Nu)+2.0/(2.0+2.0*Nu)-2.0/(2.0+2.0*
Nu)*H_coating+1/(2.0+2.0*Nu)*H_coating*
176 MapleGenVar8 = Q*
HankelH1(0.0,sqrt(K_squared))*(-(-2.0/(2.0+2.0*
Nu)*
177 1.0+2.0/(2.0+2.0*Nu)*1.0*
H_coating)/(Nu/(1.0+Nu)/(1.0-2.0*
Nu)+2.0/(2.0+
178 2.0*Nu)-2.0/(2.0+2.0*
Nu)*H_coating+1/(2.0+2.0*Nu)*H_coating*
H_coating)/2.0+(2.0
179 /(2.0+2.0*Nu)*1.0-2.0/(2.0+2.0*
Nu)*1.0*H_coating+2.0*1.0*Nu/(1.0+Nu
180 )/(1.0-2.0*
Nu)-2.0*1.0*H_coating*Nu/(1.0+Nu)/(1.0-2.0*
Nu))/(Nu/(1.0+
Nu)/(
181 1.0-2.0*Nu)+2.0/(2.0+2.0*
Nu)-2.0/(2.0+2.0*Nu)*H_coating+1/(2.0+2.0*
Nu)*
182 H_coating*H_coating)/2.0)/(
HankelH1(1.0,sqrt(K_squared))*sqrt(K_squared)-Q*
183 HankelH1(0.0,sqrt(K_squared))/(Nu/(1.0+
Nu)/(1.0-2.0*Nu)+2.0/(2.0+2.0*
Nu)-2.0/(
184 2.0+2.0*Nu)*H_coating+1/(2.0+2.0*
Nu)*H_coating*H_coating)/2.0+Q*
HankelH1(0.0,
185 sqrt(K_squared))*(1.0-2.0*H_coating+H_coating*
H_coating)/(Nu/(1.0+Nu)/(1.0-2.0*
186 Nu)+2.0/(2.0+2.0*Nu)-2.0/(2.0+2.0*
Nu)*H_coating+1/(2.0+2.0*Nu)*H_coating*
188 MapleGenVar6 = MapleGenVar7*MapleGenVar8;
189 MapleGenVar4 = MapleGenVar5+MapleGenVar6;
190 MapleGenVar1 = MapleGenVar3+MapleGenVar4;
191 MapleGenVar2 = 1.0/
HankelH1(1.0,sqrt(K_squared))/sqrt(K_squared);
192 t0 = MapleGenVar1*MapleGenVar2;
200 Vector<double>& soln)
203 double r=sqrt(x[0]*x[0]+x[1]*x[1]);
204 soln[0]=real(
HankelH1(0,sqrt(K_squared)*r)*C);
205 soln[1]=imag(
HankelH1(0,sqrt(K_squared)*r)*C);
218 double rr=sqrt(K_squared)*r;
221 Vector<std::complex<double> > h(2),hp(2);
222 Hankel_functions_for_helmholtz_problem::Hankel_first(1,rr,h,hp);
225 double power=sqrt(K_squared)*0.5*r*2.0*MathematicalConstants::Pi*
226 (imag(C*hp[0])*real(C*h[0])-real(C*hp[0])*imag(C*h[0]));
238 template<
class ELASTICITY_ELEMENT,
class HELMHOLTZ_ELEMENT>
256 Helmholtz_outer_boundary_mesh_pt->setup_gamma();
260 void actions_before_adapt();
263 void actions_after_adapt();
271 void create_fsi_traction_elements();
274 void create_helmholtz_fsi_flux_elements();
277 void delete_face_elements(Mesh*
const & boundary_mesh_pt);
280 void create_helmholtz_DtN_elements();
283 void setup_interaction();
312 template<
class ELASTICITY_ELEMENT,
class HELMHOLTZ_ELEMENT>
318 double azimuthal_fraction_of_coating=1.0;
333 RefineableTwoDAnnularMesh<ELASTICITY_ELEMENT>
334 (periodic,azimuthal_fraction_of_coating,
354 Helmholtz_mesh_pt =
new 355 RefineableTwoDAnnularMesh<HELMHOLTZ_ELEMENT>
356 (periodic,azimuthal_fraction_of_coating,
357 ntheta_helmholtz,nr_helmholtz,a,h_thick_helmholtz);
361 Solid_mesh_pt->spatial_error_estimator_pt()=
new Z2ErrorEstimator;
362 Helmholtz_mesh_pt->spatial_error_estimator_pt()=
new Z2ErrorEstimator;
368 unsigned nfourier=20;
369 Helmholtz_outer_boundary_mesh_pt =
375 unsigned n_element=Solid_mesh_pt->nelement();
376 for(
unsigned i=0;i<n_element;i++)
379 ELASTICITY_ELEMENT *el_pt =
380 dynamic_cast<ELASTICITY_ELEMENT*
>(Solid_mesh_pt->element_pt(i));
391 n_element =Helmholtz_mesh_pt->nelement();
392 for(
unsigned i=0;i<n_element;i++)
395 HELMHOLTZ_ELEMENT *el_pt =
396 dynamic_cast<HELMHOLTZ_ELEMENT*
>(Helmholtz_mesh_pt->element_pt(i));
405 Solid_mesh_pt->output(
"solid_mesh.dat");
406 Helmholtz_mesh_pt->output(
"helmholtz_mesh.dat");
407 Solid_mesh_pt->output_boundaries(
"solid_mesh_boundary.dat");
408 Helmholtz_mesh_pt->output_boundaries(
"helmholtz_mesh_boundary.dat");
415 FSI_traction_mesh_pt=
new Mesh;
416 create_fsi_traction_elements();
419 Helmholtz_fsi_flux_mesh_pt=
new Mesh;
420 create_helmholtz_fsi_flux_elements();
423 create_helmholtz_DtN_elements();
430 add_sub_mesh(Solid_mesh_pt);
433 add_sub_mesh(FSI_traction_mesh_pt);
436 add_sub_mesh(Helmholtz_mesh_pt);
439 add_sub_mesh(Helmholtz_fsi_flux_mesh_pt);
442 add_sub_mesh(Helmholtz_outer_boundary_mesh_pt);
451 unsigned n_node = Solid_mesh_pt->nboundary_node(0);
452 Vector<std::complex<double> > u(2);
454 for(
unsigned i=0;i<n_node;i++)
456 Node* nod_pt=Solid_mesh_pt->boundary_node_pt(0,i);
468 nod_pt->set_value(0,u[0].real());
471 nod_pt->set_value(1,u[1].real());
474 nod_pt->set_value(2,u[0].imag());
477 nod_pt->set_value(3,u[1].imag());
486 oomph_info <<
"Number of unknowns: " << assign_eqn_numbers() << std::endl;
493 sprintf(filename,
"%s/trace.dat",Doc_info.directory().c_str());
494 Trace_file.open(filename);
503 template<
class ELASTICITY_ELEMENT,
class HELMHOLTZ_ELEMENT>
508 delete_face_elements(FSI_traction_mesh_pt);
511 delete_face_elements(Helmholtz_fsi_flux_mesh_pt);
514 delete_face_elements(Helmholtz_outer_boundary_mesh_pt);
517 rebuild_global_mesh();
526 template<
class ELASTICITY_ELEMENT,
class HELMHOLTZ_ELEMENT>
532 create_fsi_traction_elements();
535 create_helmholtz_fsi_flux_elements();
539 create_helmholtz_DtN_elements();
545 rebuild_global_mesh();
553 template<
class ELASTICITY_ELEMENT,
class HELMHOLTZ_ELEMENT>
558 unsigned n_element = boundary_mesh_pt->nelement();
561 for(
unsigned e=0;e<n_element;e++)
564 delete boundary_mesh_pt->element_pt(e);
568 boundary_mesh_pt->flush_element_and_node_storage();
577 template<
class ELASTICITY_ELEMENT,
class HELMHOLTZ_ELEMENT>
585 unsigned n_element = Solid_mesh_pt->nboundary_element(b);
588 for(
unsigned e=0;e<n_element;e++)
591 ELASTICITY_ELEMENT* bulk_elem_pt =
dynamic_cast<ELASTICITY_ELEMENT*
>(
592 Solid_mesh_pt->boundary_element_pt(b,e));
595 int face_index = Solid_mesh_pt->face_index_at_boundary(b,e);
598 TimeHarmonicLinElastLoadedByHelmholtzPressureBCElement
599 <ELASTICITY_ELEMENT,HELMHOLTZ_ELEMENT>* el_pt=
600 new TimeHarmonicLinElastLoadedByHelmholtzPressureBCElement
601 <ELASTICITY_ELEMENT,HELMHOLTZ_ELEMENT>(bulk_elem_pt,
604 FSI_traction_mesh_pt->add_element_pt(el_pt);
608 el_pt->set_boundary_number_in_bulk_mesh(b);
623 template<
class ELASTICITY_ELEMENT,
class HELMHOLTZ_ELEMENT>
632 unsigned n_element = Helmholtz_mesh_pt->nboundary_element(b);
635 for(
unsigned e=0;e<n_element;e++)
638 HELMHOLTZ_ELEMENT* bulk_elem_pt =
dynamic_cast<HELMHOLTZ_ELEMENT*
>(
639 Helmholtz_mesh_pt->boundary_element_pt(b,e));
642 int face_index = Helmholtz_mesh_pt->face_index_at_boundary(b,e);
645 HelmholtzFluxFromNormalDisplacementBCElement
646 <HELMHOLTZ_ELEMENT,ELASTICITY_ELEMENT>* el_pt=
647 new HelmholtzFluxFromNormalDisplacementBCElement
648 <HELMHOLTZ_ELEMENT,ELASTICITY_ELEMENT>(bulk_elem_pt,
652 Helmholtz_fsi_flux_mesh_pt->add_element_pt(el_pt);
656 el_pt->set_boundary_number_in_bulk_mesh(b);
667 template<
class ELASTICITY_ELEMENT,
class HELMHOLTZ_ELEMENT>
675 unsigned n_element = Helmholtz_mesh_pt->nboundary_element(b);
678 for(
unsigned e=0;e<n_element;e++)
681 HELMHOLTZ_ELEMENT* bulk_elem_pt =
dynamic_cast<HELMHOLTZ_ELEMENT*
>(
682 Helmholtz_mesh_pt->boundary_element_pt(b,e));
685 int face_index = Helmholtz_mesh_pt->face_index_at_boundary(b,e);
688 HelmholtzDtNBoundaryElement<HELMHOLTZ_ELEMENT>* flux_element_pt =
new 689 HelmholtzDtNBoundaryElement<HELMHOLTZ_ELEMENT>(bulk_elem_pt,face_index);
693 flux_element_pt->set_outer_boundary_mesh_pt(
694 Helmholtz_outer_boundary_mesh_pt);
697 Helmholtz_outer_boundary_mesh_pt->add_element_pt(flux_element_pt);
708 template<
class ELASTICITY_ELEMENT,
class HELMHOLTZ_ELEMENT>
713 unsigned boundary_in_helmholtz_mesh=0;
714 Multi_domain_functions::setup_bulk_elements_adjacent_to_face_mesh
715 <HELMHOLTZ_ELEMENT,2>
716 (
this,boundary_in_helmholtz_mesh,Helmholtz_mesh_pt,FSI_traction_mesh_pt);
719 unsigned boundary_in_solid_mesh=2;
720 Multi_domain_functions::setup_bulk_elements_adjacent_to_face_mesh
721 <ELASTICITY_ELEMENT,2>(
722 this,boundary_in_solid_mesh,Solid_mesh_pt,Helmholtz_fsi_flux_mesh_pt);
730 template<
class ELASTICITY_ELEMENT,
class HELMHOLTZ_ELEMENT>
734 ofstream some_file,some_file2;
742 sprintf(filename,
"%s/power%i.dat",Doc_info.directory().c_str(),
744 some_file.open(filename);
748 unsigned nn_element=Helmholtz_outer_boundary_mesh_pt->nelement();
749 for(
unsigned e=0;e<nn_element;e++)
751 HelmholtzBCElementBase<HELMHOLTZ_ELEMENT> *el_pt =
752 dynamic_cast<HelmholtzBCElementBase<HELMHOLTZ_ELEMENT>*
>(
753 Helmholtz_outer_boundary_mesh_pt->element_pt(e));
754 power += el_pt->global_power_contribution(some_file);
757 oomph_info <<
"Step: " << Doc_info.number()
762 <<
" Total radiated power " << power <<
"\n" 763 <<
" Axisymmetric radiated power " <<
"\n" 777 std::ostringstream case_string;
778 case_string <<
"TEXT X=10,Y=90, T=\"Q=" 780 <<
", k<sup>2</sup>=" 782 <<
", density ratio=" 791 sprintf(filename,
"%s/elast_soln%i.dat",Doc_info.directory().c_str(),
793 some_file.open(filename);
794 Solid_mesh_pt->output(some_file,n_plot);
800 sprintf(filename,
"%s/traction_soln%i.dat",Doc_info.directory().c_str(),
802 some_file.open(filename);
803 FSI_traction_mesh_pt->output(some_file,n_plot);
809 sprintf(filename,
"%s/flux_bc_soln%i.dat",Doc_info.directory().c_str(),
811 some_file.open(filename);
812 Helmholtz_fsi_flux_mesh_pt->output(some_file,n_plot);
818 sprintf(filename,
"%s/helmholtz_soln%i.dat",Doc_info.directory().c_str(),
820 some_file.open(filename);
821 Helmholtz_mesh_pt->output(some_file,n_plot);
822 some_file << case_string.str();
828 sprintf(filename,
"%s/exact_helmholtz_soln%i.dat",Doc_info.directory().c_str(),
830 some_file.open(filename);
831 Helmholtz_mesh_pt->output_fct(some_file,n_plot,
837 << Doc_info.number() <<
")\n";
849 int main(
int argc,
char **argv)
853 CommandLineArgs::setup(argc,argv);
859 CommandLineArgs::specify_command_line_flag(
"--dir",
866 CommandLineArgs::specify_command_line_flag(
"--el_multiplier",
870 CommandLineArgs::specify_command_line_flag(
"--outer_radius",
875 CommandLineArgs::specify_command_line_flag(
"--nstep",&nstep);
878 double q_increment=5.0;
879 CommandLineArgs::specify_command_line_flag(
"--q_increment",&q_increment);
882 unsigned max_adapt=3;
883 CommandLineArgs::specify_command_line_flag(
"--max_adapt",&max_adapt);
886 CommandLineArgs::parse_and_assign();
889 CommandLineArgs::doc_specified_flags();
893 RefineableQHelmholtzElement<2,3> > problem;
901 for(
unsigned i=0;i<nstep;i++)
905 problem.newton_solve(max_adapt);
double Omega_sq
Non-dim square of frequency for solid – dependent variable!
CoatedDiskProblem()
Constructor:
std::complex< double > axisym_coefficient()
Coefficient in front of Hankel function for axisymmetric solution of Helmholtz potential.
std::complex< double > HankelH1(const double &k, const double &x)
Interface to Hankel function in maple style.
double Outer_radius
Radius of outer boundary of Helmholtz domain.
void create_helmholtz_DtN_elements()
Create DtN face elements.
void update_parameter_values()
Function to update dependent parameter values.
double Density_ratio
Density ratio: solid to fluid.
void doc_solution()
Doc the solution.
void actions_before_adapt()
Actions before adapt: Wipe the mesh of traction elements.
double K_squared
Square of wavenumber for the Helmholtz equation.
int main(int argc, char **argv)
Driver for acoustic fsi problem.
void create_helmholtz_fsi_flux_elements()
Create Helmholtz FSI flux elements.
void setup_interaction()
Setup interaction.
double exact_axisym_radiated_power()
Exact radiated power for axisymmetric solution.
string Directory
Output directory.
TreeBasedRefineableMeshBase * Helmholtz_mesh_pt
Pointer to Helmholtz mesh.
unsigned El_multiplier
Multiplier for number of elements.
double H_coating
Non-dim thickness of elastic coating.
HelmholtzDtNMesh< HELMHOLTZ_ELEMENT > * Helmholtz_outer_boundary_mesh_pt
Pointer to mesh containing the DtN elements.
TimeHarmonicIsotropicElasticityTensor E(Nu)
The elasticity tensor for the solid.
TreeBasedRefineableMeshBase * Solid_mesh_pt
Pointer to solid mesh.
void delete_face_elements(Mesh *const &boundary_mesh_pt)
Delete (face) elements in specified mesh.
ofstream Trace_file
Trace file.
double Nu
Poisson's ratio.
void actions_after_adapt()
Actions after adapt: Rebuild the mesh of traction elements.
void solid_boundary_displacement(const Vector< double > &x, Vector< std::complex< double > > &u)
Displacement field on inner boundary of solid.
void actions_before_newton_solve()
Update function (empty)
void actions_after_newton_solve()
Update function (empty)
Mesh * FSI_traction_mesh_pt
Pointer to mesh of FSI traction elements.
unsigned N
Azimuthal wavenumber for imposed displacement of coating on inner boundary.
Mesh * Helmholtz_fsi_flux_mesh_pt
Pointer to mesh of Helmholtz FSI flux elements.
void create_fsi_traction_elements()
Create FSI traction elements.
void exact_axisym_potential(const Vector< double > &x, Vector< double > &soln)
Exact solution for Helmholtz potential for axisymmetric solution.
DocInfo Doc_info
DocInfo object for output.
void actions_before_newton_convergence_check()
Recompute gamma integral before checking Newton residuals.