34 #include "linear_elasticity.h"    37 #include "meshes/rectangular_quadmesh.h"    41 using namespace oomph;
    65  IsotropicElasticityTensor 
E(Nu);
    71   u[0] = -Amplitude*cos(2.0*MathematicalConstants::Pi*x[0]/Lx)*
    72         exp(2.0*MathematicalConstants::Pi*(x[1]-Ly))/
    73         (2.0/(1.0+
Nu)*MathematicalConstants::Pi);
    74   u[1] = -Amplitude*sin(2.0*MathematicalConstants::Pi*x[0]/Lx)*
    75         exp(2.0*MathematicalConstants::Pi*(x[1]-Ly))/
    76         (2.0/(1.0+
Nu)*MathematicalConstants::Pi);
    81                        const Vector<double> &x,
    82                        const Vector<double> &n,
    83                        Vector<double> &result)
    85   result[0] = -Amplitude*cos(2.0*MathematicalConstants::Pi*x[0]/Lx);
    86   result[1] = -Amplitude*sin(2.0*MathematicalConstants::Pi*x[0]/Lx);
    94 template<
class ELEMENT>
   102                      const double &lx, 
const double &ly);
   111  void doc_solution(DocInfo& doc_info);
   116  void assign_traction_elements();
   131 template<
class ELEMENT>
   133 (
const unsigned &nx, 
const unsigned &ny,
   134  const double &lx, 
const double& ly)
   137  bool periodic_in_x=
true;
   139   new RectangularQuadMesh<ELEMENT>(nx,ny,lx,ly,periodic_in_x);
   142  Surface_mesh_pt=
new Mesh;
   143  assign_traction_elements();
   149  unsigned num_nod=Bulk_mesh_pt->nboundary_node(ibound);
   150  for (
unsigned inod=0;inod<num_nod;inod++)
   153    Node* nod_pt=Bulk_mesh_pt->boundary_node_pt(ibound,inod);
   163       nod_pt->set_value(0,0);
   164       nod_pt->set_value(1,0);
   178       nod_pt->set_value(0,u[0]);
   179       nod_pt->set_value(1,u[1]);
   186  unsigned n_el = Bulk_mesh_pt->nelement();
   187  for(
unsigned e=0;e<n_el;e++)
   190    ELEMENT *el_pt = 
dynamic_cast<ELEMENT*
>(Bulk_mesh_pt->element_pt(e));
   197  unsigned n_traction =  Surface_mesh_pt->nelement();
   198  for(
unsigned e=0;e<n_traction;e++)
   201    LinearElasticityTractionElement<ELEMENT> *el_pt = 
   202     dynamic_cast<LinearElasticityTractionElement<ELEMENT>* 
>   203     (Surface_mesh_pt->element_pt(e));
   210  add_sub_mesh(Bulk_mesh_pt);
   211  add_sub_mesh(Surface_mesh_pt);
   217  cout << assign_eqn_numbers() << 
" equations assigned" << std::endl; 
   224 template<
class ELEMENT>
   230  unsigned n_neigh = Bulk_mesh_pt->nboundary_element(bound); 
   233  for(
unsigned n=0;n<n_neigh;n++)
   236    FiniteElement *traction_element_pt 
   237     = 
new LinearElasticityTractionElement<ELEMENT>
   238     (Bulk_mesh_pt->boundary_element_pt(bound,n),
   239      Bulk_mesh_pt->face_index_at_boundary(bound,n));
   242    Surface_mesh_pt->add_element_pt(traction_element_pt);
   250 template<
class ELEMENT>
   260  sprintf(filename,
"%s/soln.dat",doc_info.directory().c_str());
   261  some_file.open(filename);
   262  Bulk_mesh_pt->output(some_file,npts);
   266  sprintf(filename,
"%s/exact_soln.dat",doc_info.directory().c_str());
   267  some_file.open(filename);
   268  Bulk_mesh_pt->output_fct(some_file,npts,
   275  sprintf(filename,
"%s/error.dat",doc_info.directory().c_str());
   276  some_file.open(filename);
   277  Bulk_mesh_pt->compute_error(some_file,
   283  cout << 
"\nNorm of error    " << sqrt(error) << std::endl; 
   284  cout << 
"Norm of solution : " << sqrt(norm) << std::endl << std::endl;
   294 int main(
int argc, 
char* argv[]) 
   306  doc_info.set_directory(
"RESLT");
   313  problem.newton_solve();
 Mesh * Surface_mesh_pt
Pointer to the mesh of traction elements. 
 
void doc_solution(DocInfo &doc_info)
Doc the solution. 
 
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. 
 
bool Finite
Specify problem to be solved (boundary conditons for finite or infinite domain). 
 
double Lx
Length of domain in x direction. 
 
Periodic loading problem. 
 
void periodic_traction(const double &time, const Vector< double > &x, const Vector< double > &n, Vector< double > &result)
The traction function. 
 
void assign_traction_elements()
Allocate traction elements on the top surface. 
 
Mesh * Bulk_mesh_pt
Pointer to the bulk mesh. 
 
Namespace for global parameters. 
 
double Amplitude
Amplitude of traction applied. 
 
int main(int argc, char *argv[])
Driver code for PeriodicLoad linearly elastic problem. 
 
double Nu
Define Poisson coefficient Nu. 
 
void exact_solution(const Vector< double > &x, Vector< double > &u)
The exact solution for infinite depth case. 
 
IsotropicElasticityTensor E(Nu)
The elasticity tensor. 
 
void actions_after_newton_solve()
Update after solve is empty. 
 
double Ly
Length of domain in y direction.