30 #include "time_harmonic_fourier_decomposed_linear_elasticity.h"
33 #include "meshes/rectangular_quadmesh.h"
34 #include "meshes/triangle_mesh.h"
38 using namespace oomph;
47 std::complex<double>
Nu(0.3,0.0);
50 std::complex<double>
E(1.0,0.0);
72 const std::complex<double>
I(0.0,1.0);
79 const Vector<double> &n,
80 Vector<std::complex<double> > &result)
98 template<
class ELEMENT>
106 const unsigned &nr,
const unsigned &nz,
107 const double &
rmin,
const double&
rmax,
108 const double &
zmin,
const double&
zmax);
118 void delete_traction_elements();
121 void complete_problem_setup();
127 delete_traction_elements();
130 rebuild_global_mesh();
139 assign_traction_elements();
142 rebuild_global_mesh();
145 complete_problem_setup();
169 Mesh* Surface_mesh_pt;
177 template<
class ELEMENT>
180 (
const unsigned &nr,
const unsigned &nz,
181 const double &
rmin,
const double&
rmax,
182 const double &
zmin,
const double&
zmax)
189 Vector<TriangleMeshCurveSection*> boundary_polyline_pt(4);
192 Vector<Vector<double> > bound_coords(2);
193 bound_coords[0].resize(2);
194 bound_coords[1].resize(2);
197 bound_coords[0][0]=
rmin;
198 bound_coords[0][1]=
zmin;
199 bound_coords[1][0]=
rmax;
200 bound_coords[1][1]=
zmin;
203 unsigned boundary_id=0;
204 boundary_polyline_pt[0]=
new TriangleMeshPolyLine(bound_coords,boundary_id);
207 bound_coords[0][0]=
rmax;
208 bound_coords[0][1]=
zmin;
209 bound_coords[1][0]=
rmax;
210 bound_coords[1][1]=
zmax;
214 boundary_polyline_pt[1]=
new TriangleMeshPolyLine(bound_coords,boundary_id);
218 bound_coords[0][0]=
rmax;
219 bound_coords[0][1]=
zmax;
220 bound_coords[1][0]=
rmin;
221 bound_coords[1][1]=
zmax;
225 boundary_polyline_pt[2]=
new TriangleMeshPolyLine(bound_coords,boundary_id);
228 bound_coords[0][0]=
rmin;
229 bound_coords[0][1]=
zmax;
230 bound_coords[1][0]=
rmin;
231 bound_coords[1][1]=
zmin;
235 boundary_polyline_pt[3]=
new TriangleMeshPolyLine(bound_coords,boundary_id);
238 TriangleMeshClosedCurve* closed_curve_pt=
239 new TriangleMeshPolygon(boundary_polyline_pt);
243 TriangleMeshParameters triangle_mesh_parameters(closed_curve_pt);
246 double uniform_element_area=0.2;
247 triangle_mesh_parameters.element_area() = uniform_element_area;
250 Bulk_mesh_pt=
new RefineableTriangleMesh<ELEMENT>(triangle_mesh_parameters);
253 Bulk_mesh_pt->spatial_error_estimator_pt()=
new Z2ErrorEstimator;
263 Surface_mesh_pt=
new Mesh;
264 assign_traction_elements();
267 complete_problem_setup();
270 add_sub_mesh(Bulk_mesh_pt);
271 add_sub_mesh(Surface_mesh_pt);
277 cout << assign_eqn_numbers() <<
" equations assigned" << std::endl;
286 template<
class ELEMENT>
296 for (
unsigned ibound=0;ibound<3;ibound=ibound+2)
298 unsigned num_nod=Bulk_mesh_pt->nboundary_node(ibound);
299 for (
unsigned inod=0;inod<num_nod;inod++)
302 Node* nod_pt=Bulk_mesh_pt->boundary_node_pt(ibound,inod);
305 nod_pt->pin(0);nod_pt->pin(1);nod_pt->pin(2);
306 nod_pt->pin(3);nod_pt->pin(4);nod_pt->pin(5);
309 nod_pt->set_value(0,0.0);
310 nod_pt->set_value(1,0.0);
311 nod_pt->set_value(2,0.0);
312 nod_pt->set_value(3,0.0);
313 nod_pt->set_value(4,0.0);
314 nod_pt->set_value(5,0.0);
322 unsigned n_el = Bulk_mesh_pt->nelement();
323 for(
unsigned e=0;e<n_el;e++)
326 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(Bulk_mesh_pt->element_pt(e));
343 unsigned n_traction = Surface_mesh_pt->nelement();
344 for(
unsigned e=0;e<n_traction;e++)
347 TimeHarmonicFourierDecomposedLinearElasticityTractionElement<ELEMENT>*
349 dynamic_cast<TimeHarmonicFourierDecomposedLinearElasticityTractionElement
350 <ELEMENT
>* >(Surface_mesh_pt->element_pt(e));
362 template<
class ELEMENT>
366 unsigned bound, n_neigh;
370 n_neigh = Bulk_mesh_pt->nboundary_element(bound);
373 for(
unsigned n=0;n<n_neigh;n++)
376 FiniteElement *traction_element_pt
377 =
new TimeHarmonicFourierDecomposedLinearElasticityTractionElement<ELEMENT>
378 (Bulk_mesh_pt->boundary_element_pt(bound,n),
379 Bulk_mesh_pt->face_index_at_boundary(bound,n));
382 Surface_mesh_pt->add_element_pt(traction_element_pt);
391 template<
class ELEMENT>
396 unsigned n_element = Surface_mesh_pt->nelement();
399 for(
unsigned e=0;e<n_element;e++)
402 delete Surface_mesh_pt->element_pt(e);
406 Surface_mesh_pt->flush_element_and_node_storage();
414 template<
class ELEMENT>
425 sprintf(filename,
"%s/soln.dat",doc_info.directory().c_str());
426 some_file.open(filename);
427 Bulk_mesh_pt->output(some_file,npts);
432 sprintf(filename,
"%s/norm.dat",doc_info.directory().c_str());
433 some_file.open(filename);
435 unsigned nel=Bulk_mesh_pt->nelement();
436 for (
unsigned e=0;e<nel;e++)
439 Bulk_mesh_pt->compute_norm(el_norm);
442 some_file << norm << std::endl;
451 int main(
int argc,
char* argv[])
463 doc_info.set_directory(
"RESLT");
469 <ProjectableTimeHarmonicFourierDecomposedLinearElasticityElement
470 <TTimeHarmonicFourierDecomposedLinearElasticityElement<3> > >
475 unsigned max_adapt=3;
476 problem.newton_solve(max_adapt);
482 <QTimeHarmonicFourierDecomposedLinearElasticityElement<3> >
487 problem.newton_solve();
492 problem.doc_solution(doc_info);
Class to validate time harmonic linear elasticity (Fourier decomposed)
void actions_before_adapt()
Actions before adapt: Wipe the mesh of traction elements.
RefineableTriangleMesh< ELEMENT > * Bulk_mesh_pt
Pointer to the bulk mesh.
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 actions_after_adapt()
Actions after adapt: Rebuild the mesh of traction elements.
void assign_traction_elements()
Allocate traction elements on the bottom surface.
void actions_after_newton_solve()
Update after solve is empty.
void delete_traction_elements()
Delete traction elements.
void actions_before_newton_solve()
Update before solve is empty.
void complete_problem_setup()
Helper function to complete problem setup.
void doc_solution(DocInfo &doc_info)
Doc the solution.
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.
double Lr
Length of domain in r direction.
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.
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.
std::complex< double > Omega_sq(10.0, 0.0)
Define the non-dimensional square angular frequency of time-harmonic motion.
int Fourier_wavenumber
Define Fourier wavenumber.
int main(int argc, char *argv[])
Driver code.