35 #include "oomph_crbond_bessel.h" 38 #include "meshes/quarter_circle_sector_mesh.h" 42 using namespace oomph;
97 TimeStepper* time_stepper_pt);
104 void position(
const Vector<double>& xi, Vector<double>& r)
const;
107 void veloc(
const Vector<double>& xi, Vector<double>& veloc);
111 void accel(
const Vector<double>& xi, Vector<double>& accel);
116 Vector<double>& drdt)
136 std::ostringstream error_message;
137 error_message << j <<
"th derivative not implemented\n";
139 throw OomphLibError(error_message.str(),
140 OOMPH_CURRENT_FUNCTION,
141 OOMPH_EXCEPTION_LOCATION);
149 static void residual_for_dispersion(
const Vector<double>& param,
150 const Vector<double>& omega,
151 Vector<double>& residual);
179 TimeStepper* time_stepper_pt) :
180 GeomObject(2,2,time_stepper_pt), Ampl(ampl), Nu(nu)
183 Vector<double> param(1);
187 Vector<double> omega(1);
198 T=2.0*MathematicalConstants::Pi/
Omega;
200 std::cout <<
"Period of oscillation: " <<
T << std::endl;
211 Vector<double>& r)
const 214 double time=Geom_object_time_stepper_pt->time_pt()->time();
217 double lagr_radius=sqrt( pow(xi[0],2) + pow(xi[1],2) );
219 if (lagr_radius<1.0e-12)
228 double j0,j1,y0,y1,j0p,j1p,y0p,y1p;
229 CRBond_Bessel::bessjy01a(
Omega*lagr_radius,j0,j1,y0,y1,j0p,j1p,y0p,y1p);
232 double u=
Ampl*j1*sin(2.0*MathematicalConstants::Pi*time/
T);
235 r[0]=(xi[0]+xi[0]/lagr_radius*u);
236 r[1]=(xi[1]+xi[1]/lagr_radius*u);
249 Vector<double>&
veloc)
252 double time=Geom_object_time_stepper_pt->time_pt()->time();
255 double lagr_radius=sqrt(pow(xi[0],2)+pow(xi[1],2));
257 if (lagr_radius<1.0e-12)
266 double j0,j1,y0,y1,j0p,j1p,y0p,y1p;
267 CRBond_Bessel::bessjy01a(
Omega*lagr_radius,j0,j1,y0,y1,j0p,j1p,y0p,y1p);
270 double udot=2.0*MathematicalConstants::Pi/
T*
Ampl*j1*
271 cos(2.0*MathematicalConstants::Pi*time/
T);
274 veloc[0]=(xi[0]/lagr_radius*udot);
275 veloc[1]=(xi[1]/lagr_radius*udot);
288 Vector<double>&
accel)
291 double time=Geom_object_time_stepper_pt->time_pt()->time();
294 double lagr_radius=sqrt(pow(xi[0],2)+pow(xi[1],2));
297 if (lagr_radius<1.0e-12)
306 double j0,j1,y0,y1,j0p,j1p,y0p,y1p;
307 CRBond_Bessel::bessjy01a(
Omega*lagr_radius,j0,j1,y0,y1,j0p,j1p,y0p,y1p);
310 double udotdot=-pow(2.0*MathematicalConstants::Pi/
T,2)*
Ampl*j1*
311 sin(2.0*MathematicalConstants::Pi*time/
T);
314 accel[0]=(xi[0]/lagr_radius*udotdot);
315 accel[1]=(xi[1]/lagr_radius*udotdot);
328 const Vector<double>& param,
const Vector<double>& omega,
329 Vector<double>& residual)
338 double j0,j1,y0,y1,j0p,j1p,y0p,y1p;
339 CRBond_Bessel::bessjy01a(arg,j0,j1,y0,y1,j0p,j1p,y0p,y1p);
342 residual[0]=nu/(1.0-2.0*nu)*(j1+(j0-j1/omega[0])*omega[0])+
343 (j0-j1/omega[0])*omega[0];
362 template <
class ELEMENT>
364 public virtual RefineableQuarterCircleSectorMesh<ELEMENT>,
365 public virtual SolidMesh
375 const double& fract_mid,
377 TimeStepper* time_stepper_pt=
378 &Mesh::Default_TimeStepper) :
379 RefineableQuarterCircleSectorMesh<ELEMENT>(wall_pt,xi_lo,fract_mid,xi_hi,
384 SolidFiniteElement* el_pt=
dynamic_cast<SolidFiniteElement*
> 385 (finite_element_pt(0));
389 "Element needs to be derived from SolidFiniteElement\n",
390 OOMPH_CURRENT_FUNCTION,
391 OOMPH_EXCEPTION_LOCATION);
398 set_lagrangian_nodal_coordinates();
417 template<
class ELEMENT>
440 void run(
const unsigned& nstep);
443 void doc_solution(DocInfo& doc_info);
465 template<
class ELEMENT>
471 add_time_stepper_pt(
new Newmark<2>);
477 GeomObject* curved_boundary_pt=
new Ellipse(1.0,1.0);
482 double xi_hi=2.0*atan(1.0);
486 double fract_mid=0.5;
490 curved_boundary_pt,xi_lo,fract_mid,xi_hi,time_stepper_pt());
495 unsigned nnod0=mesh_pt()->nboundary_node(0);
496 unsigned nnod1=mesh_pt()->nboundary_node(1);
497 Trace_node_pt.resize(nnod0+nnod1);
498 for (
unsigned j=0;j<nnod0;j++)
501 Trace_node_pt[j]=mesh_pt()->boundary_node_pt(0,j);
504 for (
unsigned j=0;j<nnod1;j++)
507 Trace_node_pt[j+nnod0]=mesh_pt()->boundary_node_pt(1,j);
513 unsigned n_hor = mesh_pt()->nboundary_node(0);
514 for(
unsigned i=0;i<n_hor;i++)
516 mesh_pt()->boundary_node_pt(0,i)->pin_position(1);
520 unsigned n_vert = mesh_pt()->nboundary_node(2);
521 for(
unsigned i=0;i<n_vert;i++)
524 mesh_pt()->boundary_node_pt(2,i)->pin_position(0);
530 unsigned n_element =mesh_pt()->nelement();
531 for(
unsigned i=0;i<n_element;i++)
534 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(i));
537 el_pt->constitutive_law_pt() =
545 mesh_pt()->refine_uniformly();
548 assign_eqn_numbers();
557 template<
class ELEMENT>
562 ofstream some_file, some_file2;
571 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
573 some_file.open(filename);
574 mesh_pt()->output(some_file,npts);
582 Vector<double> r_exact(2);
583 Vector<double> xi(2);
586 IC_geom_object_pt->position(xi,r_exact);
589 double exact_r=r_exact[0];
592 Trace_file << time_pt()->time() <<
" " 596 unsigned ntrace_node=Trace_node_pt.size();
597 for (
unsigned j=0;j<ntrace_node;j++)
599 Trace_file << sqrt(pow(Trace_node_pt[j]->x(0),2)+
600 pow(Trace_node_pt[j]->x(1),2)) <<
" ";
602 Trace_file << std::endl;
611 unsigned nelem=mesh_pt()->nboundary_element(0);
614 sprintf(filename,
"%s/displ_along_line%i.dat",doc_info.directory().c_str(),
616 some_file.open(filename);
619 sprintf(filename,
"%s/exact_displ_along_line%i.dat",
620 doc_info.directory().c_str(),
622 some_file2.open(filename);
626 Vector<double> dxdt(2);
627 Vector<double> xi(2);
628 Vector<double> r_exact(2);
629 Vector<double> v_exact(2);
631 for (
unsigned e=0;e<nelem;e++)
633 some_file <<
"ZONE " << std::endl;
634 some_file2 <<
"ZONE " << std::endl;
636 for (
unsigned i=0;i<npts;i++)
639 s[0]=-1.0+2.0*double(i)/double(npts-1);
643 SolidFiniteElement* el_pt=
dynamic_cast<SolidFiniteElement*
> 644 (mesh_pt()->boundary_element_pt(0,e));
647 el_pt->interpolated_xi(s,xi);
650 el_pt->interpolated_x(s,x);
653 el_pt->interpolated_dxdt(s,1,dxdt);
656 IC_geom_object_pt->position(xi,r_exact);
659 IC_geom_object_pt->veloc(xi,v_exact);
662 some_file << xi[0] <<
" " << x[0]-xi[0] <<
" " 663 << dxdt[0] << std::endl;
665 some_file2 << xi[0] <<
" " << r_exact[0]-xi[0] <<
" " 666 << v_exact[0] << std::endl;
680 unsigned nelem=mesh_pt()->nelement();
683 sprintf(filename,
"%s/displ%i.dat",doc_info.directory().c_str(),
685 some_file.open(filename);
687 sprintf(filename,
"%s/exact_displ%i.dat",
688 doc_info.directory().c_str(),
690 some_file2.open(filename);
694 Vector<double> dxdt(2);
695 Vector<double> xi(2);
696 Vector<double> r_exact(2);
697 Vector<double> v_exact(2);
699 for (
unsigned e=0;e<nelem;e++)
701 some_file <<
"ZONE I=" << npts <<
", J="<< npts << std::endl;
702 some_file2 <<
"ZONE I=" << npts <<
", J="<< npts << std::endl;
704 for (
unsigned i=0;i<npts;i++)
706 s[0]=-1.0+2.0*double(i)/double(npts-1);
707 for (
unsigned j=0;j<npts;j++)
709 s[1]=-1.0+2.0*double(j)/double(npts-1);
712 SolidFiniteElement* el_pt=
dynamic_cast<SolidFiniteElement*
> 713 (mesh_pt()->element_pt(e));
716 el_pt->interpolated_xi(s,xi);
719 el_pt->interpolated_x(s,x);
722 el_pt->interpolated_dxdt(s,1,dxdt);
725 IC_geom_object_pt->position(xi,r_exact);
728 IC_geom_object_pt->veloc(xi,v_exact);
731 some_file << xi[0] <<
" " << xi[1] <<
" " 732 << x[0]-xi[0] <<
" " << x[1]-xi[1] <<
" " 733 << dxdt[0] <<
" " << dxdt[1] << std::endl;
736 some_file2 << xi[0] <<
" " << xi[1] <<
" " 737 << r_exact[0]-xi[0] <<
" " << r_exact[1]-xi[1] <<
" " 738 << v_exact[0] <<
" " << v_exact[1] << std::endl;
756 template<
class ELEMENT>
764 doc_info.set_directory(
"RESLT");
768 sprintf(filename,
"%s/trace.dat",doc_info.directory().c_str());
769 Trace_file.open(filename);
773 time_pt()->time()=time0;
777 time_pt()->initialise_dt(dt);
790 SolidInitialCondition* IC_pt =
new SolidInitialCondition(IC_geom_object_pt);
793 SolidMesh::Solid_IC_problem.set_newmark_initial_condition_consistently(
794 this,mesh_pt(),time_stepper_pt(),IC_pt,dt,
798 doc_solution(doc_info);
802 for(
unsigned i=0;i<nstep;i++)
804 unsteady_newton_solve(dt);
805 doc_solution(doc_info);
819 int main(
int argc,
char* argv[])
823 CommandLineArgs::setup(argc,argv);
828 if (CommandLineArgs::Argc!=1)
AxisymOscillatingDisk(const double &l, const double &nu, TimeStepper *time_stepper_pt)
Constructor: 2 Lagrangian coordinate, 2 Eulerian coords. Pass amplitude of oscillation, Poisson ratio nu, and pointer to global timestepper.
void actions_after_newton_solve()
Update function (empty)
void accel(const Vector< double > &xi, Vector< double > &accel)
Parametrised acceleration on object at current time: accel = d^2 r(xi)/dt^2.
double Lambda_sq
Timescale ratio.
Vector< Node * > Trace_node_pt
Vector of pointers to nodes whose position we're tracing.
AxisymOscillatingDisk * IC_geom_object_pt
Geometric object that specifies the initial conditions.
void run(const unsigned &nstep)
Run the problem: Pass number of timesteps to be performed.
Axisymmetrially oscillating disk with displacement field according to linear elasticity.
void position(const Vector< double > &xi, Vector< double > &r) const
Position vector at Lagrangian coordinate xi at present time.
double multiplier(const Vector< double > &xi)
Multiplier for inertia terms (needed for consistent assignment of initial conditions in Newmark schem...
void dposition_dt(const Vector< double > &xi, const unsigned &j, Vector< double > &drdt)
Parametrised j-th time-derivative on object at current time: .
ConstitutiveLaw * Constitutive_law_pt
Pointer to constitutive law.
DiskOscillationProblem()
Constructor.
void actions_before_newton_solve()
Update function (empty)
void doc_solution(DocInfo &doc_info)
Doc the solution.
void veloc(const Vector< double > &xi, Vector< double > &veloc)
Parametrised velocity on object at current time: veloc = d r(xi)/dt.
~AxisymOscillatingDisk()
Destructor (empty)
double T
Period of oscillation.
double Nu
Poisson ratio nu.
int main(int argc, char *argv[])
Driver for disk oscillation problem.
static void residual_for_dispersion(const Vector< double > ¶m, const Vector< double > &omega, Vector< double > &residual)
Residual of dispersion relation for use in black-box Newton method which requires global (or static) ...
Problem class to simulate small-amplitude oscillations of a circular disk.
double Omega
Eigenfrequency.
ofstream Trace_file
Trace file.
double Nu
Poisson's ratio.
double Ampl
Amplitude of oscillation.
ElasticRefineableQuarterCircleSectorMesh< ELEMENT > * mesh_pt()
Access function for the solid mesh.