31 #include "oomph_crbond_bessel.h"
34 #include "meshes/quarter_circle_sector_mesh.h"
38 using namespace oomph;
93 TimeStepper* time_stepper_pt);
100 void position(
const Vector<double>& xi, Vector<double>& r)
const;
103 void veloc(
const Vector<double>& xi, Vector<double>& veloc);
107 void accel(
const Vector<double>& xi, Vector<double>& accel);
112 Vector<double>& drdt)
132 std::ostringstream error_message;
133 error_message << j <<
"th derivative not implemented\n";
135 throw OomphLibError(error_message.str(),
136 OOMPH_CURRENT_FUNCTION,
137 OOMPH_EXCEPTION_LOCATION);
145 static void residual_for_dispersion(
const Vector<double>& param,
146 const Vector<double>& omega,
147 Vector<double>& residual);
175 TimeStepper* time_stepper_pt) :
176 GeomObject(2,2,time_stepper_pt), Ampl(ampl),
Nu(nu)
179 Vector<double> param(1);
183 Vector<double> omega(1);
194 T=2.0*MathematicalConstants::Pi/
Omega;
196 std::cout <<
"Period of oscillation: " <<
T << std::endl;
207 Vector<double>& r)
const
210 double time=Geom_object_time_stepper_pt->time_pt()->time();
213 double lagr_radius=sqrt( pow(xi[0],2) + pow(xi[1],2) );
215 if (lagr_radius<1.0e-12)
224 double j0,j1,y0,y1,j0p,j1p,y0p,y1p;
225 CRBond_Bessel::bessjy01a(
Omega*lagr_radius,j0,j1,y0,y1,j0p,j1p,y0p,y1p);
228 double u=
Ampl*j1*sin(2.0*MathematicalConstants::Pi*time/
T);
231 r[0]=(xi[0]+xi[0]/lagr_radius*u);
232 r[1]=(xi[1]+xi[1]/lagr_radius*u);
245 Vector<double>& veloc)
248 double time=Geom_object_time_stepper_pt->time_pt()->time();
251 double lagr_radius=sqrt(pow(xi[0],2)+pow(xi[1],2));
253 if (lagr_radius<1.0e-12)
262 double j0,j1,y0,y1,j0p,j1p,y0p,y1p;
263 CRBond_Bessel::bessjy01a(
Omega*lagr_radius,j0,j1,y0,y1,j0p,j1p,y0p,y1p);
266 double udot=2.0*MathematicalConstants::Pi/
T*
Ampl*j1*
267 cos(2.0*MathematicalConstants::Pi*time/
T);
270 veloc[0]=(xi[0]/lagr_radius*udot);
271 veloc[1]=(xi[1]/lagr_radius*udot);
284 Vector<double>& accel)
287 double time=Geom_object_time_stepper_pt->time_pt()->time();
290 double lagr_radius=sqrt(pow(xi[0],2)+pow(xi[1],2));
293 if (lagr_radius<1.0e-12)
302 double j0,j1,y0,y1,j0p,j1p,y0p,y1p;
303 CRBond_Bessel::bessjy01a(
Omega*lagr_radius,j0,j1,y0,y1,j0p,j1p,y0p,y1p);
306 double udotdot=-pow(2.0*MathematicalConstants::Pi/
T,2)*
Ampl*j1*
307 sin(2.0*MathematicalConstants::Pi*time/
T);
310 accel[0]=(xi[0]/lagr_radius*udotdot);
311 accel[1]=(xi[1]/lagr_radius*udotdot);
324 const Vector<double>& param,
const Vector<double>& omega,
325 Vector<double>& residual)
334 double j0,j1,y0,y1,j0p,j1p,y0p,y1p;
335 CRBond_Bessel::bessjy01a(arg,j0,j1,y0,y1,j0p,j1p,y0p,y1p);
338 residual[0]=nu/(1.0-2.0*nu)*(j1+(j0-j1/omega[0])*omega[0])+
339 (j0-j1/omega[0])*omega[0];
358 template <
class ELEMENT>
360 public virtual RefineableQuarterCircleSectorMesh<ELEMENT>,
361 public virtual SolidMesh
371 const double& fract_mid,
373 TimeStepper* time_stepper_pt=
374 &Mesh::Default_TimeStepper) :
375 RefineableQuarterCircleSectorMesh<ELEMENT>(wall_pt,xi_lo,fract_mid,xi_hi,
380 SolidFiniteElement* el_pt=
dynamic_cast<SolidFiniteElement*
>
381 (finite_element_pt(0));
385 "Element needs to be derived from SolidFiniteElement\n",
386 OOMPH_CURRENT_FUNCTION,
387 OOMPH_EXCEPTION_LOCATION);
394 set_lagrangian_nodal_coordinates();
413 template<
class ELEMENT>
436 void run(
const unsigned& nstep);
461 template<
class ELEMENT>
467 add_time_stepper_pt(
new Newmark<2>);
473 GeomObject* curved_boundary_pt=
new Ellipse(1.0,1.0);
478 double xi_hi=2.0*atan(1.0);
482 double fract_mid=0.5;
486 curved_boundary_pt,xi_lo,fract_mid,xi_hi,time_stepper_pt());
491 unsigned nnod0=mesh_pt()->nboundary_node(0);
492 unsigned nnod1=mesh_pt()->nboundary_node(1);
493 Trace_node_pt.resize(nnod0+nnod1);
494 for (
unsigned j=0;j<nnod0;j++)
497 Trace_node_pt[j]=mesh_pt()->boundary_node_pt(0,j);
500 for (
unsigned j=0;j<nnod1;j++)
503 Trace_node_pt[j+nnod0]=mesh_pt()->boundary_node_pt(1,j);
509 unsigned n_hor = mesh_pt()->nboundary_node(0);
510 for(
unsigned i=0;i<n_hor;i++)
512 mesh_pt()->boundary_node_pt(0,i)->pin_position(1);
516 unsigned n_vert = mesh_pt()->nboundary_node(2);
517 for(
unsigned i=0;i<n_vert;i++)
520 mesh_pt()->boundary_node_pt(2,i)->pin_position(0);
526 unsigned n_element =mesh_pt()->nelement();
527 for(
unsigned i=0;i<n_element;i++)
530 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(i));
533 el_pt->constitutive_law_pt() =
541 mesh_pt()->refine_uniformly();
544 assign_eqn_numbers();
553 template<
class ELEMENT>
558 ofstream some_file, some_file2;
567 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
569 some_file.open(filename);
570 mesh_pt()->output(some_file,npts);
578 Vector<double> r_exact(2);
579 Vector<double> xi(2);
582 IC_geom_object_pt->position(xi,r_exact);
585 double exact_r=r_exact[0];
588 Trace_file << time_pt()->time() <<
" "
592 unsigned ntrace_node=Trace_node_pt.size();
593 for (
unsigned j=0;j<ntrace_node;j++)
595 Trace_file << sqrt(pow(Trace_node_pt[j]->x(0),2)+
596 pow(Trace_node_pt[j]->x(1),2)) <<
" ";
598 Trace_file << std::endl;
607 unsigned nelem=mesh_pt()->nboundary_element(0);
610 sprintf(filename,
"%s/displ_along_line%i.dat",doc_info.directory().c_str(),
612 some_file.open(filename);
615 sprintf(filename,
"%s/exact_displ_along_line%i.dat",
616 doc_info.directory().c_str(),
618 some_file2.open(filename);
622 Vector<double> dxdt(2);
623 Vector<double> xi(2);
624 Vector<double> r_exact(2);
625 Vector<double> v_exact(2);
627 for (
unsigned e=0;e<nelem;e++)
629 some_file <<
"ZONE " << std::endl;
630 some_file2 <<
"ZONE " << std::endl;
632 for (
unsigned i=0;i<npts;i++)
635 s[0]=-1.0+2.0*double(i)/double(npts-1);
639 SolidFiniteElement* el_pt=
dynamic_cast<SolidFiniteElement*
>
640 (mesh_pt()->boundary_element_pt(0,e));
643 el_pt->interpolated_xi(s,xi);
646 el_pt->interpolated_x(s,x);
649 el_pt->interpolated_dxdt(s,1,dxdt);
652 IC_geom_object_pt->position(xi,r_exact);
655 IC_geom_object_pt->veloc(xi,v_exact);
658 some_file << xi[0] <<
" " << x[0]-xi[0] <<
" "
659 << dxdt[0] << std::endl;
661 some_file2 << xi[0] <<
" " << r_exact[0]-xi[0] <<
" "
662 << v_exact[0] << std::endl;
676 unsigned nelem=mesh_pt()->nelement();
679 sprintf(filename,
"%s/displ%i.dat",doc_info.directory().c_str(),
681 some_file.open(filename);
683 sprintf(filename,
"%s/exact_displ%i.dat",
684 doc_info.directory().c_str(),
686 some_file2.open(filename);
690 Vector<double> dxdt(2);
691 Vector<double> xi(2);
692 Vector<double> r_exact(2);
693 Vector<double> v_exact(2);
695 for (
unsigned e=0;e<nelem;e++)
697 some_file <<
"ZONE I=" << npts <<
", J="<< npts << std::endl;
698 some_file2 <<
"ZONE I=" << npts <<
", J="<< npts << std::endl;
700 for (
unsigned i=0;i<npts;i++)
702 s[0]=-1.0+2.0*double(i)/double(npts-1);
703 for (
unsigned j=0;j<npts;j++)
705 s[1]=-1.0+2.0*double(j)/double(npts-1);
708 SolidFiniteElement* el_pt=
dynamic_cast<SolidFiniteElement*
>
709 (mesh_pt()->element_pt(e));
712 el_pt->interpolated_xi(s,xi);
715 el_pt->interpolated_x(s,x);
718 el_pt->interpolated_dxdt(s,1,dxdt);
721 IC_geom_object_pt->position(xi,r_exact);
724 IC_geom_object_pt->veloc(xi,v_exact);
727 some_file << xi[0] <<
" " << xi[1] <<
" "
728 << x[0]-xi[0] <<
" " << x[1]-xi[1] <<
" "
729 << dxdt[0] <<
" " << dxdt[1] << std::endl;
732 some_file2 << xi[0] <<
" " << xi[1] <<
" "
733 << r_exact[0]-xi[0] <<
" " << r_exact[1]-xi[1] <<
" "
734 << v_exact[0] <<
" " << v_exact[1] << std::endl;
752 template<
class ELEMENT>
760 doc_info.set_directory(
"RESLT");
764 sprintf(filename,
"%s/trace.dat",doc_info.directory().c_str());
765 Trace_file.open(filename);
769 time_pt()->time()=time0;
773 time_pt()->initialise_dt(dt);
786 SolidInitialCondition* IC_pt =
new SolidInitialCondition(IC_geom_object_pt);
789 SolidMesh::Solid_IC_problem.set_newmark_initial_condition_consistently(
790 this,mesh_pt(),time_stepper_pt(),IC_pt,dt,
794 doc_solution(doc_info);
798 for(
unsigned i=0;i<nstep;i++)
800 unsteady_newton_solve(dt);
801 doc_solution(doc_info);
815 int main(
int argc,
char* argv[])
819 CommandLineArgs::setup(argc,argv);
824 if (CommandLineArgs::Argc!=1)
////////////////////////////////////////////////////////////////////
void dposition_dt(const Vector< double > &xi, const unsigned &j, Vector< double > &drdt)
Parametrised j-th time-derivative on object at current time: .
AxisymOscillatingDisk(const double &l, const double &nu, TimeStepper *time_stepper_pt)
Constructor: 2 Lagrangian coordinate, 2 Eulerian coords. Pass amplitude of oscillation,...
double T
Period of oscillation.
void veloc(const Vector< double > &xi, Vector< double > &veloc)
Parametrised velocity on object at current time: veloc = d r(xi)/dt.
void accel(const Vector< double > &xi, Vector< double > &accel)
Parametrised acceleration on object at current time: accel = d^2 r(xi)/dt^2.
double Ampl
Amplitude of oscillation.
double Omega
Eigenfrequency.
void position(const Vector< double > &xi, Vector< double > &r) const
Position vector at Lagrangian coordinate xi at present time.
~AxisymOscillatingDisk()
Destructor (empty)
double Nu
Poisson ratio nu.
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) ...
////////////////////////////////////////////////////////////////////// //////////////////////////////...
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.
ofstream Trace_file
Trace file.
DiskOscillationProblem()
Constructor.
void actions_after_newton_solve()
Update function (empty)
ElasticRefineableQuarterCircleSectorMesh< ELEMENT > * mesh_pt()
Access function for the solid mesh.
void run(const unsigned &nstep)
Run the problem: Pass number of timesteps to be performed.
void doc_solution(DocInfo &doc_info)
Doc the solution.
void actions_before_newton_solve()
Update function (empty)
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
int main(int argc, char *argv[])
Driver for disk oscillation problem.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
double multiplier(const Vector< double > &xi)
Multiplier for inertia terms (needed for consistent assignment of initial conditions in Newmark schem...
ConstitutiveLaw * Constitutive_law_pt
Pointer to constitutive law.
double Nu
Poisson's ratio.
double Lambda_sq
Timescale ratio.