30 #include "linear_elasticity.h"
33 #include "meshes/rectangular_quadmesh.h"
37 using namespace oomph;
61 IsotropicElasticityTensor
E(
Nu);
67 u[0] = -
Amplitude*cos(2.0*MathematicalConstants::Pi*x[0]/
Lx)*
68 exp(2.0*MathematicalConstants::Pi*(x[1]-
Ly))/
69 (2.0/(1.0+
Nu)*MathematicalConstants::Pi);
70 u[1] = -
Amplitude*sin(2.0*MathematicalConstants::Pi*x[0]/
Lx)*
71 exp(2.0*MathematicalConstants::Pi*(x[1]-
Ly))/
72 (2.0/(1.0+
Nu)*MathematicalConstants::Pi);
77 const Vector<double> &x,
78 const Vector<double> &n,
79 Vector<double> &result)
81 result[0] = -
Amplitude*cos(2.0*MathematicalConstants::Pi*x[0]/
Lx);
82 result[1] = -
Amplitude*sin(2.0*MathematicalConstants::Pi*x[0]/
Lx);
90 template<
class ELEMENT>
98 const double &lx,
const double &ly);
107 void doc_solution(DocInfo& doc_info);
112 void assign_traction_elements();
127 template<
class ELEMENT>
129 (
const unsigned &nx,
const unsigned &ny,
130 const double &lx,
const double& ly)
133 bool periodic_in_x=
true;
135 new RectangularQuadMesh<ELEMENT>(nx,ny,lx,ly,periodic_in_x);
138 Surface_mesh_pt=
new Mesh;
139 assign_traction_elements();
145 unsigned num_nod=Bulk_mesh_pt->nboundary_node(ibound);
146 for (
unsigned inod=0;inod<num_nod;inod++)
149 Node* nod_pt=Bulk_mesh_pt->boundary_node_pt(ibound,inod);
159 nod_pt->set_value(0,0);
160 nod_pt->set_value(1,0);
174 nod_pt->set_value(0,u[0]);
175 nod_pt->set_value(1,u[1]);
182 unsigned n_el = Bulk_mesh_pt->nelement();
183 for(
unsigned e=0;e<n_el;e++)
186 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(Bulk_mesh_pt->element_pt(e));
193 unsigned n_traction = Surface_mesh_pt->nelement();
194 for(
unsigned e=0;e<n_traction;e++)
197 LinearElasticityTractionElement<ELEMENT> *el_pt =
198 dynamic_cast<LinearElasticityTractionElement<ELEMENT>*
>
199 (Surface_mesh_pt->element_pt(e));
206 add_sub_mesh(Bulk_mesh_pt);
207 add_sub_mesh(Surface_mesh_pt);
213 cout << assign_eqn_numbers() <<
" equations assigned" << std::endl;
220 template<
class ELEMENT>
226 unsigned n_neigh = Bulk_mesh_pt->nboundary_element(bound);
229 for(
unsigned n=0;n<n_neigh;n++)
232 FiniteElement *traction_element_pt
233 =
new LinearElasticityTractionElement<ELEMENT>
234 (Bulk_mesh_pt->boundary_element_pt(bound,n),
235 Bulk_mesh_pt->face_index_at_boundary(bound,n));
238 Surface_mesh_pt->add_element_pt(traction_element_pt);
246 template<
class ELEMENT>
256 sprintf(filename,
"%s/soln.dat",doc_info.directory().c_str());
257 some_file.open(filename);
258 Bulk_mesh_pt->output(some_file,npts);
262 sprintf(filename,
"%s/exact_soln.dat",doc_info.directory().c_str());
263 some_file.open(filename);
264 Bulk_mesh_pt->output_fct(some_file,npts,
271 sprintf(filename,
"%s/error.dat",doc_info.directory().c_str());
272 some_file.open(filename);
273 Bulk_mesh_pt->compute_error(some_file,
279 cout <<
"\nNorm of error " << sqrt(error) << std::endl;
280 cout <<
"Norm of solution : " << sqrt(norm) << std::endl << std::endl;
290 int main(
int argc,
char* argv[])
302 doc_info.set_directory(
"RESLT");
309 problem.newton_solve();
Periodic loading problem.
Mesh * Bulk_mesh_pt
Pointer to the bulk mesh.
Mesh * Surface_mesh_pt
Pointer to the mesh of traction elements.
PeriodicLoadProblem(const unsigned &nx, const unsigned &ny, const double &lx, const double &ly)
Constructor: Pass number of elements in x and y directions and lengths.
void actions_before_newton_solve()
Update before solve is empty.
void actions_after_newton_solve()
Update after solve is empty.
void doc_solution(DocInfo &doc_info)
Doc the solution.
void assign_traction_elements()
Allocate traction elements on the top surface.
Namespace for global parameters.
void periodic_traction(const double &time, const Vector< double > &x, const Vector< double > &n, Vector< double > &result)
The traction function.
double Amplitude
Amplitude of traction applied.
double Nu
Define Poisson coefficient Nu.
double Ly
Length of domain in y direction.
IsotropicElasticityTensor E(Nu)
The elasticity tensor.
bool Finite
Specify problem to be solved (boundary conditons for finite or infinite domain).
void exact_solution(const Vector< double > &x, Vector< double > &u)
The exact solution for infinite depth case.
double Lx
Length of domain in x direction.
int main(int argc, char *argv[])
Driver code for PeriodicLoad linearly elastic problem.