34 #include "fourier_decomposed_helmholtz.h"
37 #include "time_harmonic_fourier_decomposed_linear_elasticity.h"
40 #include "multi_physics.h"
43 #include "meshes/annular_mesh.h"
46 #include "oomph_crbond_bessel.h"
48 using namespace oomph;
79 std::complex<double>
Nu(std::complex<double>(0.3,0.0));
82 std::complex<double>
Omega_sq(std::complex<double>(100.0,0.0));
99 Vector<std::complex<double> >& u)
101 Vector<double> normal(2);
102 double norm=sqrt(x[0]*x[0]+x[1]*x[1]);
103 double theta=atan2(x[1],x[0]);
107 u[0]=complex<double>(normal[0]*cos(
double(
M)*theta),0.0);
108 u[1]=complex<double>(normal[1]*cos(
double(
M)*theta),0.0);
125 template<
class ELASTICITY_ELEMENT,
class HELMHOLTZ_ELEMENT>
143 Helmholtz_DtN_mesh_pt->setup_gamma();
147 void doc_solution(DocInfo& doc_info);
152 void create_fsi_traction_elements();
155 void create_helmholtz_fsi_flux_elements();
158 void setup_interaction();
161 void create_helmholtz_DtN_elements();
187 template<
class ELASTICITY_ELEMENT,
class HELMHOLTZ_ELEMENT>
194 double azimuthal_fraction_of_coating=0.5;
195 double phi=0.5*MathematicalConstants::Pi;
210 TwoDAnnularMesh<ELASTICITY_ELEMENT>(periodic,azimuthal_fraction_of_coating,
211 ntheta_solid,nr_solid,a,
231 Helmholtz_mesh_pt =
new TwoDAnnularMesh<HELMHOLTZ_ELEMENT>
232 (periodic,azimuthal_fraction_of_coating,
233 ntheta_helmholtz,nr_helmholtz,a,h_thick_helmholtz,phi);
237 unsigned nfourier=20;
238 Helmholtz_DtN_mesh_pt=
239 new FourierDecomposedHelmholtzDtNMesh<HELMHOLTZ_ELEMENT>(
243 unsigned nel=Solid_mesh_pt->nelement();
244 for (
unsigned e=0;e<nel;e++)
247 ELASTICITY_ELEMENT* el_pt=
dynamic_cast<ELASTICITY_ELEMENT*
>(
248 Solid_mesh_pt->element_pt(e));
261 unsigned n_element = Helmholtz_mesh_pt->nelement();
262 for(
unsigned i=0;i<n_element;i++)
265 HELMHOLTZ_ELEMENT *el_pt =
dynamic_cast<HELMHOLTZ_ELEMENT*
>(
266 Helmholtz_mesh_pt->element_pt(i));
277 Solid_mesh_pt->output(
"solid_mesh.dat");
278 Helmholtz_mesh_pt->output(
"helmholtz_mesh.dat");
279 Solid_mesh_pt->output_boundaries(
"solid_mesh_boundary.dat");
280 Helmholtz_mesh_pt->output_boundaries(
"helmholtz_mesh_boundary.dat");
286 FSI_traction_mesh_pt=
new Mesh;
287 create_fsi_traction_elements();
290 Helmholtz_fsi_flux_mesh_pt=
new Mesh;
291 create_helmholtz_fsi_flux_elements();
294 create_helmholtz_DtN_elements();
299 add_sub_mesh(Solid_mesh_pt);
300 add_sub_mesh(FSI_traction_mesh_pt);
301 add_sub_mesh(Helmholtz_mesh_pt);
302 add_sub_mesh(Helmholtz_fsi_flux_mesh_pt);
303 add_sub_mesh(Helmholtz_DtN_mesh_pt);
314 unsigned n_node = Solid_mesh_pt->nboundary_node(b);
316 Vector<std::complex<double> > u(2);
321 for(
unsigned i=0;i<n_node;i++)
323 Node* nod_pt=Solid_mesh_pt->boundary_node_pt(b,i);
337 nod_pt->set_value(0,u[0].real());
339 nod_pt->set_value(1,u[1].real());
341 nod_pt->set_value(2,0.0);
343 nod_pt->set_value(3,u[0].imag());
345 nod_pt->set_value(4,u[1].imag());
347 nod_pt->set_value(5,0.0);
354 unsigned num_nod= Solid_mesh_pt->nboundary_node(ibound);
355 for (
unsigned inod=0;inod<num_nod;inod++)
358 Node* nod_pt=Solid_mesh_pt->boundary_node_pt(ibound,inod);
362 nod_pt->set_value(0,0.0);
364 nod_pt->set_value(3,0.0);
368 nod_pt->set_value(2,0.0);
370 nod_pt->set_value(5,0.0);
380 unsigned num_nod= Solid_mesh_pt->nboundary_node(ibound);
381 for (
unsigned inod=0;inod<num_nod;inod++)
384 Node* nod_pt=Solid_mesh_pt->boundary_node_pt(ibound,inod);
388 nod_pt->set_value(0,0.0);
390 nod_pt->set_value(3,0.0);
394 nod_pt->set_value(2,0.0);
396 nod_pt->set_value(5,0.0);
408 Trace_file.open(filename);
411 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
420 template<
class ELASTICITY_ELEMENT,
class HELMHOLTZ_ELEMENT>
428 unsigned n_element = Helmholtz_mesh_pt->nboundary_element(b);
429 for(
unsigned e=0;e<n_element;e++)
432 HELMHOLTZ_ELEMENT* bulk_elem_pt =
dynamic_cast<HELMHOLTZ_ELEMENT*
>(
433 Helmholtz_mesh_pt->boundary_element_pt(b,e));
436 int face_index = Helmholtz_mesh_pt->face_index_at_boundary(b,e);
439 FourierDecomposedHelmholtzDtNBoundaryElement<HELMHOLTZ_ELEMENT>*
440 flux_element_pt =
new
441 FourierDecomposedHelmholtzDtNBoundaryElement<HELMHOLTZ_ELEMENT>
442 (bulk_elem_pt,face_index);
445 Helmholtz_DtN_mesh_pt->add_element_pt(flux_element_pt);
449 flux_element_pt->set_outer_boundary_mesh_pt(Helmholtz_DtN_mesh_pt);
461 template<
class ELASTICITY_ELEMENT,
class HELMHOLTZ_ELEMENT>
467 unsigned boundary_in_helmholtz_mesh=0;
471 the_file.open(
"boundary_coordinate_hh.dat");
472 Helmholtz_mesh_pt->Mesh::template doc_boundary_coordinates<HELMHOLTZ_ELEMENT>
473 (boundary_in_helmholtz_mesh, the_file);
477 Multi_domain_functions::setup_bulk_elements_adjacent_to_face_mesh
478 <HELMHOLTZ_ELEMENT,2>
479 (
this,boundary_in_helmholtz_mesh,Helmholtz_mesh_pt,FSI_traction_mesh_pt);
482 unsigned boundary_in_solid_mesh=2;
485 the_file.open(
"boundary_coordinate_solid.dat");
486 Solid_mesh_pt->Mesh::template doc_boundary_coordinates<ELASTICITY_ELEMENT>
487 (boundary_in_solid_mesh, the_file);
491 Multi_domain_functions::setup_bulk_elements_adjacent_to_face_mesh
492 <ELASTICITY_ELEMENT,2>(
493 this,boundary_in_solid_mesh,Solid_mesh_pt,Helmholtz_fsi_flux_mesh_pt);
504 template<
class ELASTICITY_ELEMENT,
class HELMHOLTZ_ELEMENT>
512 unsigned n_element = Solid_mesh_pt->nboundary_element(b);
515 for(
unsigned e=0;e<n_element;e++)
518 ELASTICITY_ELEMENT* bulk_elem_pt =
dynamic_cast<ELASTICITY_ELEMENT*
>(
519 Solid_mesh_pt->boundary_element_pt(b,e));
522 int face_index = Solid_mesh_pt->face_index_at_boundary(b,e);
525 FourierDecomposedTimeHarmonicLinElastLoadedByHelmholtzPressureBCElement
526 <ELASTICITY_ELEMENT,HELMHOLTZ_ELEMENT>* el_pt=
527 new FourierDecomposedTimeHarmonicLinElastLoadedByHelmholtzPressureBCElement
528 <ELASTICITY_ELEMENT,HELMHOLTZ_ELEMENT>(bulk_elem_pt,
531 FSI_traction_mesh_pt->add_element_pt(el_pt);
535 el_pt->set_boundary_number_in_bulk_mesh(b);
548 template<
class ELASTICITY_ELEMENT,
class HELMHOLTZ_ELEMENT>
557 unsigned n_element = Helmholtz_mesh_pt->nboundary_element(b);
560 for(
unsigned e=0;e<n_element;e++)
563 HELMHOLTZ_ELEMENT* bulk_elem_pt =
dynamic_cast<HELMHOLTZ_ELEMENT*
>(
564 Helmholtz_mesh_pt->boundary_element_pt(b,e));
567 int face_index = Helmholtz_mesh_pt->face_index_at_boundary(b,e);
570 FourierDecomposedHelmholtzFluxFromNormalDisplacementBCElement
571 <HELMHOLTZ_ELEMENT,ELASTICITY_ELEMENT>* el_pt=
572 new FourierDecomposedHelmholtzFluxFromNormalDisplacementBCElement
573 <HELMHOLTZ_ELEMENT,ELASTICITY_ELEMENT>(bulk_elem_pt,
577 Helmholtz_fsi_flux_mesh_pt->add_element_pt(el_pt);
581 el_pt->set_boundary_number_in_bulk_mesh(b);
591 template<
class ELASTICITY_ELEMENT,
class HELMHOLTZ_ELEMENT>
597 oomph_info <<
"Writing result for step " << doc_info.number()
598 <<
". Parameters: "<< std::endl;
599 oomph_info <<
"Fourier mode number : N = "
607 << std::endl << std::endl;
610 ofstream some_file,some_file2;
618 sprintf(filename,
"%s/power%i.dat",doc_info.directory().c_str(),
620 some_file.open(filename);
624 unsigned nn_element=Helmholtz_DtN_mesh_pt->nelement();
625 for(
unsigned e=0;e<nn_element;e++)
627 FourierDecomposedHelmholtzBCElementBase<HELMHOLTZ_ELEMENT> *el_pt =
628 dynamic_cast<FourierDecomposedHelmholtzBCElementBase<HELMHOLTZ_ELEMENT>*
>(
629 Helmholtz_DtN_mesh_pt->element_pt(e));
630 power += el_pt->global_power_contribution(some_file);
633 oomph_info <<
"Radiated power: " << power << std::endl;
637 sprintf(filename,
"%s/elast_soln%i.dat",doc_info.directory().c_str(),
639 some_file.open(filename);
640 Solid_mesh_pt->output(some_file,n_plot);
645 sprintf(filename,
"%s/helmholtz_soln%i.dat",doc_info.directory().c_str(),
647 some_file.open(filename);
648 Helmholtz_mesh_pt->output(some_file,n_plot);
654 sprintf(filename,
"%s/fsi_traction_soln%i.dat",doc_info.directory().c_str(),
656 some_file.open(filename);
657 FSI_traction_mesh_pt->output(some_file,n_plot);
663 sprintf(filename,
"%s/fsi_flux_bc_soln%i.dat",doc_info.directory().c_str(),
665 some_file.open(filename);
666 Helmholtz_fsi_flux_mesh_pt->output(some_file,n_plot);
687 int main(
int argc,
char **argv)
691 CommandLineArgs::setup(argc,argv);
697 CommandLineArgs::specify_command_line_flag(
"--dir",
701 CommandLineArgs::specify_command_line_flag(
"--k_squared",
705 CommandLineArgs::specify_command_line_flag(
"--q_initial",
710 CommandLineArgs::specify_command_line_flag(
"--nstep",&nstep);
713 double q_increment=5.0;
714 CommandLineArgs::specify_command_line_flag(
"--q_increment",&q_increment);
719 CommandLineArgs::specify_command_line_flag(
"--M",
723 CommandLineArgs::specify_command_line_flag(
"--el_multiplier",
727 CommandLineArgs::parse_and_assign();
730 CommandLineArgs::doc_specified_flags();
743 QFourierDecomposedHelmholtzElement<3> > problem;
746 for(
unsigned i=0;i<nstep;i++)
749 problem.newton_solve();
void create_fsi_traction_elements()
Create FSI traction elements.
void actions_before_newton_convergence_check()
Recompute gamma integral before checking Newton residuals.
Mesh * FSI_traction_mesh_pt
Pointer to mesh of FSI traction elements.
TwoDAnnularMesh< ELASTICITY_ELEMENT > * Solid_mesh_pt
Pointer to solid mesh.
TwoDAnnularMesh< HELMHOLTZ_ELEMENT > * Helmholtz_mesh_pt
Pointer to Helmholtz mesh.
ofstream Trace_file
Trace file.
void create_helmholtz_DtN_elements()
Create DtN elements on outer boundary.
void create_helmholtz_fsi_flux_elements()
Create Helmholtz FSI flux elements.
void actions_before_newton_solve()
Update function (empty)
void doc_solution(DocInfo &doc_info)
Doc the solution.
CoatedSphereProblem()
Constructor:
FourierDecomposedHelmholtzDtNMesh< HELMHOLTZ_ELEMENT > * Helmholtz_DtN_mesh_pt
Pointer to mesh containing the DtN elements.
void actions_after_newton_solve()
Update function (empty)
void setup_interaction()
Setup interaction.
Mesh * Helmholtz_fsi_flux_mesh_pt
Pointer to mesh of Helmholtz FSI flux elements.
int main(int argc, char **argv)
Driver for coated sphere loaded by lineared fluid loading.
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
string Directory
Output directory.
unsigned El_multiplier
Multiplier for number of elements.
std::complex< double > Nu(std::complex< double >(0.3, 0.0))
Poisson's ratio Nu.
double Density_ratio
Density ratio: solid to fluid.
double Outer_radius
Radius of outer boundary of Helmholtz domain.
std::complex< double > Omega_sq(std::complex< double >(100.0, 0.0))
Non-dim square of frequency for solid – dependent variable!
double K_squared
Square of wavenumber for the Helmholtz equation.
void solid_boundary_displacement(const Vector< double > &x, Vector< std::complex< double > > &u)
Displacement field on inner boundary of solid.
unsigned M
Wavenumber "zenith"-variation of imposed displacement of coating on inner boundary.
void update_parameter_values()
Function to update dependent parameter values.
int Fourier_wavenumber
Define azimuthal Fourier wavenumber.
double H_coating
Non-dim thickness of elastic coating.