30 #include "time_harmonic_fourier_decomposed_linear_elasticity.h"
33 #include "meshes/rectangular_quadmesh.h"
37 using namespace oomph;
45 std::complex<double>
Nu(0.3,0.05);
48 std::complex<double>
E(1.0,0.01);
52 std::complex<double>
mu =
E/2.0/(1.0+
Nu);
74 const std::complex<double>
I(0.0,1.0);
78 const Vector<double> &n,
79 Vector<std::complex<double> > &result)
81 result[0] = -6.0*pow(x[0],2)*
mu*cos(x[1])-
83 (4.0*pow(x[0],2)+pow(x[0],3))*cos(x[1]));
84 result[1] = -
mu*(3.0*pow(x[0],2)-pow(x[0],3))*sin(x[1]);
93 Vector<std::complex<double> > &result)
99 -16.0+x[0]*(x[0]-3.0))+pow(x[0],2)*
Omega_sq));
117 u[0] = pow(x[0],3)*cos(x[1]);
118 u[1] = pow(x[0],3)*sin(x[1]);
119 u[2] = pow(x[0],3)*pow(x[1],3);
132 template<
class ELEMENT>
140 const unsigned &nr,
const unsigned &nz,
141 const double &
rmin,
const double&
rmax,
142 const double &
zmin,
const double&
zmax);
152 void doc_solution(DocInfo& doc_info);
157 void assign_traction_elements();
171 template<
class ELEMENT>
174 (
const unsigned &nr,
const unsigned &nz,
175 const double &
rmin,
const double&
rmax,
176 const double &
zmin,
const double&
zmax)
182 Surface_mesh_pt=
new Mesh;
183 assign_traction_elements();
199 for (
unsigned ibound=0;ibound<=2;ibound++)
201 unsigned num_nod=Bulk_mesh_pt->nboundary_node(ibound);
202 for (
unsigned inod=0;inod<num_nod;inod++)
205 Node* nod_pt=Bulk_mesh_pt->boundary_node_pt(ibound,inod);
212 nod_pt->pin(0);nod_pt->pin(1);nod_pt->pin(2);
213 nod_pt->pin(3);nod_pt->pin(4);nod_pt->pin(5);
220 nod_pt->set_value(0,u[0]);
221 nod_pt->set_value(1,u[1]);
222 nod_pt->set_value(2,u[2]);
223 nod_pt->set_value(3,u[3]);
224 nod_pt->set_value(4,u[4]);
225 nod_pt->set_value(5,u[5]);
233 unsigned n_el = Bulk_mesh_pt->nelement();
234 for(
unsigned e=0;e<n_el;e++)
237 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(Bulk_mesh_pt->element_pt(e));
257 unsigned n_traction = Surface_mesh_pt->nelement();
258 for(
unsigned e=0;e<n_traction;e++)
261 TimeHarmonicFourierDecomposedLinearElasticityTractionElement<ELEMENT>*
263 dynamic_cast<TimeHarmonicFourierDecomposedLinearElasticityTractionElement
264 <ELEMENT
>* >(Surface_mesh_pt->element_pt(e));
272 add_sub_mesh(Bulk_mesh_pt);
273 add_sub_mesh(Surface_mesh_pt);
279 cout << assign_eqn_numbers() <<
" equations assigned" << std::endl;
287 template<
class ELEMENT>
291 unsigned bound, n_neigh;
295 n_neigh = Bulk_mesh_pt->nboundary_element(bound);
298 for(
unsigned n=0;n<n_neigh;n++)
301 FiniteElement *traction_element_pt
302 =
new TimeHarmonicFourierDecomposedLinearElasticityTractionElement<ELEMENT>
303 (Bulk_mesh_pt->boundary_element_pt(bound,n),
304 Bulk_mesh_pt->face_index_at_boundary(bound,n));
307 Surface_mesh_pt->add_element_pt(traction_element_pt);
316 template<
class ELEMENT>
327 sprintf(filename,
"%s/soln.dat",doc_info.directory().c_str());
328 some_file.open(filename);
329 Bulk_mesh_pt->output(some_file,npts);
333 sprintf(filename,
"%s/exact_soln.dat",doc_info.directory().c_str());
334 some_file.open(filename);
335 Bulk_mesh_pt->output_fct(some_file,npts,
342 sprintf(filename,
"%s/error.dat",doc_info.directory().c_str());
343 some_file.open(filename);
344 Bulk_mesh_pt->compute_error(some_file,
350 cout <<
"\nNorm of error: " << sqrt(error) << std::endl;
351 cout <<
"Norm of solution: " << sqrt(norm) << std::endl << std::endl;
360 int main(
int argc,
char* argv[])
372 doc_info.set_directory(
"RESLT");
376 <QTimeHarmonicFourierDecomposedLinearElasticityElement<3> >
381 problem.newton_solve();
384 problem.doc_solution(doc_info);
Class to validate time harmonic linear elasticity (Fourier decomposed)
FourierDecomposedTimeHarmonicLinearElasticityProblem(const unsigned &nr, const unsigned &nz, const double &rmin, const double &rmax, const double &zmin, const double &zmax)
Constructor: Pass number of elements in r and z directions and boundary locations.
Mesh * Surface_mesh_pt
Pointer to the mesh of traction elements.
void assign_traction_elements()
Allocate traction elements on the bottom surface.
Mesh * Bulk_mesh_pt
Pointer to the bulk mesh.
void actions_after_newton_solve()
Update after solve is empty.
void actions_before_newton_solve()
Update before solve is empty.
void doc_solution(DocInfo &doc_info)
Doc the solution.
int main(int argc, char *argv[])
Driver code.
Namespace for global parameters.
double Lz
Length of domain in z-direction.
const std::complex< double > I(0.0, 1.0)
Define the imaginary unit.
std::complex< double > lambda
double Lr
Length of domain in r direction.
std::complex< double > mu
void boundary_traction(const Vector< double > &x, const Vector< double > &n, Vector< std::complex< double > > &result)
The traction function at r=rmin: (t_r, t_z, t_theta)
std::complex< double > Nu(0.3, 0.05)
Define Poisson's ratio Nu.
void exact_solution(const Vector< double > &x, Vector< double > &u)
The exact solution in a flat-packed vector:
void body_force(const Vector< double > &x, Vector< std::complex< double > > &result)
The body force function; returns vector of complex doubles in the order (b_r, b_z,...
std::complex< double > Omega_sq(10.0, 5.0)
Define the non-dimensional square angular frequency of time-harmonic motion.
std::complex< double > E(1.0, 0.01)
Define the non-dimensional Young's modulus.
int Fourier_wavenumber
Define Fourier wavenumber.