34 #include "time_harmonic_fourier_decomposed_linear_elasticity.h" 37 #include "meshes/rectangular_quadmesh.h" 41 using namespace oomph;
49 std::complex<double>
Nu(0.3,0.05);
52 std::complex<double>
E(1.0,0.01);
55 std::complex<double>
lambda = E*Nu/(1.0+
Nu)/(1.0-2.0*Nu);
56 std::complex<double>
mu = E/2.0/(1.0+
Nu);
63 std::complex<double>
Omega_sq (10.0,5.0);
78 const std::complex<double>
I(0.0,1.0);
82 const Vector<double> &n,
83 Vector<std::complex<double> > &result)
85 result[0] = -6.0*pow(x[0],2)*mu*cos(x[1])-
86 lambda*(
I*double(Fourier_wavenumber)*pow(x[0],2)*pow(x[1],3)+
87 (4.0*pow(x[0],2)+pow(x[0],3))*cos(x[1]));
88 result[1] = -mu*(3.0*pow(x[0],2)-pow(x[0],3))*sin(x[1]);
89 result[2] = -mu*pow(x[0],2)*(2*pow(x[1],3)+
I*double(Fourier_wavenumber)*
97 Vector<std::complex<double> > &result)
100 x[0]*(-2.0*
I*lambda*double(Fourier_wavenumber)*pow(x[1],3)-cos(x[1])*
101 (lambda*(8.0+3.0*x[0])-
102 mu*(pow(
double(Fourier_wavenumber),2)
103 -16.0+x[0]*(x[0]-3.0))+pow(x[0],2)*
Omega_sq));
105 x[0]*sin(x[1])*(mu*(pow(
double(Fourier_wavenumber),2)-9.0)+
106 4.0*x[0]*(lambda+
mu)+pow(x[0],2)*
108 3.0*
I*double(Fourier_wavenumber)*pow(x[0],2)*pow(x[1],2)*(lambda+
mu);
110 -x[0]*(8.0*mu*pow(x[1],3)-pow(
double(Fourier_wavenumber),2)*pow(x[1],3)*
111 (lambda+2.0*
mu)+pow(x[0],2)*(pow(x[1],3)*
Omega_sq+6.0*mu*x[1])+
112 I*cos(x[1])*double(Fourier_wavenumber)*
113 (lambda*(4.0+x[0])+mu*(6.0+x[0])));
121 u[0] = pow(x[0],3)*cos(x[1]);
122 u[1] = pow(x[0],3)*sin(x[1]);
123 u[2] = pow(x[0],3)*pow(x[1],3);
136 template<
class ELEMENT>
144 const unsigned &nr,
const unsigned &nz,
145 const double &
rmin,
const double&
rmax,
146 const double &
zmin,
const double&
zmax);
156 void doc_solution(DocInfo& doc_info);
161 void assign_traction_elements();
175 template<
class ELEMENT>
178 (
const unsigned &nr,
const unsigned &nz,
179 const double &
rmin,
const double&
rmax,
180 const double &
zmin,
const double&
zmax)
186 Surface_mesh_pt=
new Mesh;
187 assign_traction_elements();
203 for (
unsigned ibound=0;ibound<=2;ibound++)
205 unsigned num_nod=Bulk_mesh_pt->nboundary_node(ibound);
206 for (
unsigned inod=0;inod<num_nod;inod++)
209 Node* nod_pt=Bulk_mesh_pt->boundary_node_pt(ibound,inod);
216 nod_pt->pin(0);nod_pt->pin(1);nod_pt->pin(2);
217 nod_pt->pin(3);nod_pt->pin(4);nod_pt->pin(5);
224 nod_pt->set_value(0,u[0]);
225 nod_pt->set_value(1,u[1]);
226 nod_pt->set_value(2,u[2]);
227 nod_pt->set_value(3,u[3]);
228 nod_pt->set_value(4,u[4]);
229 nod_pt->set_value(5,u[5]);
237 unsigned n_el = Bulk_mesh_pt->nelement();
238 for(
unsigned e=0;e<n_el;e++)
241 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(Bulk_mesh_pt->element_pt(e));
261 unsigned n_traction = Surface_mesh_pt->nelement();
262 for(
unsigned e=0;e<n_traction;e++)
265 TimeHarmonicFourierDecomposedLinearElasticityTractionElement<ELEMENT>*
267 dynamic_cast<TimeHarmonicFourierDecomposedLinearElasticityTractionElement
268 <ELEMENT
>* >(Surface_mesh_pt->element_pt(e));
276 add_sub_mesh(Bulk_mesh_pt);
277 add_sub_mesh(Surface_mesh_pt);
283 cout << assign_eqn_numbers() <<
" equations assigned" << std::endl;
291 template<
class ELEMENT>
295 unsigned bound, n_neigh;
299 n_neigh = Bulk_mesh_pt->nboundary_element(bound);
302 for(
unsigned n=0;n<n_neigh;n++)
305 FiniteElement *traction_element_pt
306 =
new TimeHarmonicFourierDecomposedLinearElasticityTractionElement<ELEMENT>
307 (Bulk_mesh_pt->boundary_element_pt(bound,n),
308 Bulk_mesh_pt->face_index_at_boundary(bound,n));
311 Surface_mesh_pt->add_element_pt(traction_element_pt);
320 template<
class ELEMENT>
331 sprintf(filename,
"%s/soln.dat",doc_info.directory().c_str());
332 some_file.open(filename);
333 Bulk_mesh_pt->output(some_file,npts);
337 sprintf(filename,
"%s/exact_soln.dat",doc_info.directory().c_str());
338 some_file.open(filename);
339 Bulk_mesh_pt->output_fct(some_file,npts,
346 sprintf(filename,
"%s/error.dat",doc_info.directory().c_str());
347 some_file.open(filename);
348 Bulk_mesh_pt->compute_error(some_file,
354 cout <<
"\nNorm of error: " << sqrt(error) << std::endl;
355 cout <<
"Norm of solution: " << sqrt(norm) << std::endl << std::endl;
364 int main(
int argc,
char* argv[])
376 doc_info.set_directory(
"RESLT");
380 <QTimeHarmonicFourierDecomposedLinearElasticityElement<3> >
385 problem.newton_solve();
388 problem.doc_solution(doc_info);
const std::complex< double > I(0.0, 1.0)
Define the imaginary unit.
Mesh * Bulk_mesh_pt
Pointer to the bulk mesh.
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 > lambda
std::complex< double > Nu(0.3, 0.05)
Define Poisson's ratio Nu.
int Fourier_wavenumber
Define Fourier wavenumber.
void doc_solution(DocInfo &doc_info)
Doc the solution.
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.
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, b_theta)
void actions_before_newton_solve()
Update before solve is empty.
Namespace for global parameters.
std::complex< double > E(1.0, 0.01)
Define the non-dimensional Young's modulus.
double Lr
Length of domain in r direction.
double Lz
Length of domain in z-direction.
void exact_solution(const Vector< double > &x, Vector< double > &u)
The exact solution in a flat-packed vector:
std::complex< double > mu
void actions_after_newton_solve()
Update after solve is empty.
void assign_traction_elements()
Allocate traction elements on the bottom surface.
std::complex< double > Omega_sq(10.0, 5.0)
Define the non-dimensional square angular frequency of time-harmonic motion.
int main(int argc, char *argv[])
Driver code.
Mesh * Surface_mesh_pt
Pointer to the mesh of traction elements.