128(
const unsigned& N,
const double& L)
133 add_time_stepper_pt(
new TIMESTEPPER());
139 Problem::mesh_pt() =
new OneDLagrangianMesh<ELEMENT>(
147 mesh_pt()->boundary_node_pt(ibound,0)->pin_position(1);
149 mesh_pt()->boundary_node_pt(ibound,0)->pin_position(1,0);
154 mesh_pt()->boundary_node_pt(ibound,0)->pin_position(0);
156 mesh_pt()->boundary_node_pt(ibound,0)->pin_position(1,1);
168 unsigned Nelement =
mesh_pt()->nelement();
171 for(
unsigned i=0;i<Nelement;i++)
174 ELEMENT *elem_pt =
dynamic_cast<ELEMENT*
>(
mesh_pt()->element_pt(i));
185 mesh_pt()->element_pt(Nelement-1));
192 cout <<
"# of dofs " << assign_eqn_numbers() << std::endl;
195 double eps_buckl=1.0e-2;
196 double HoR=
dynamic_cast<ELEMENT*
>(
mesh_pt()->element_pt(0))->h();
199 GeomObject* ic_geom_object_pt=
200 new PseudoBucklingRing(eps_buckl,HoR,n_buckl,imode,
201 Problem::time_stepper_pt());
204 IC_pt =
new SolidInitialCondition(ic_geom_object_pt);
217 cout <<
"Doc-ing step " << doc_info.number()
218 <<
" for time " << time_stepper_pt()->time_pt()->time() << std::endl;
222 unsigned Nelem=mesh_pt()->nelement();
226 for (
unsigned ielem=0;ielem<Nelem;ielem++)
228 dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(ielem))->get_energy(pot,kin);
235 Vector<double> xi_ctrl(1);
236 Vector<double> posn_ctrl(2);
239 xi_ctrl[0]=Displ_control_elem_pt->interpolated_xi(S_displ_control,0);
242 IC_pt->geom_object_pt()->position(xi_ctrl,posn_ctrl);
245 Trace_file << time_pt()->time() <<
" "
246 << Displ_control_elem_pt->interpolated_x(S_displ_control,1)
247 <<
" " << global_pot <<
" " << global_kin
248 <<
" " << global_pot + global_kin
249 <<
" " << posn_ctrl[1]
260 snprintf(filename,
sizeof(filename),
"%s/ring%i.dat",doc_info.directory().c_str(),
262 some_file.open(filename);
263 mesh_pt()->output(some_file,npts);
267 unsigned nsteps=time_stepper_pt()->nprev_values();
268 for (
unsigned t=0;t<=nsteps;t++)
270 snprintf(filename,
sizeof(filename),
"%s/ring%i-%i.dat",doc_info.directory().c_str(),
271 doc_info.number(),t);
272 some_file.open(filename);
273 unsigned Nelem=mesh_pt()->nelement();
274 for (
unsigned ielem=0;ielem<Nelem;ielem++)
276 dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(ielem))->
277 output(t,some_file,npts);
283 snprintf(filename,
sizeof(filename),
"%s/ic_ring%i.dat",doc_info.directory().c_str(),
285 some_file.open(filename);
287 unsigned nplot=1+(npts-1)*mesh_pt()->nelement();
288 Vector<double> xi(1);
289 Vector<double> posn(2);
290 Vector<double> veloc(2);
291 Vector<double> accel(2);
293 for (
unsigned iplot=0;iplot<nplot;iplot++)
295 xi[0]=Length/double(nplot-1)*double(iplot);
297 IC_pt->geom_object_pt()->position(xi,posn);
298 IC_pt->geom_object_pt()->dposition_dt(xi,1,veloc);
299 IC_pt->geom_object_pt()->dposition_dt(xi,2,accel);
301 some_file << posn[0] <<
" " << posn[1] <<
" "
303 << veloc[0] <<
" " << veloc[1] <<
" "
304 << accel[0] <<
" " << accel[1] <<
" "
305 << sqrt(pow(posn[0],2)+pow(posn[1],2)) <<
" "
306 << sqrt(pow(veloc[0],2)+pow(veloc[1],2)) <<
" "
307 << sqrt(pow(accel[0],2)+pow(accel[1],2)) <<
" "
327 doc_info.set_directory(
"RESLT");
334 snprintf(filename,
sizeof(filename),
"%s/trace_ring.dat",doc_info.directory().c_str());
335 Trace_file.open(filename);
337 Trace_file <<
"VARIABLES=\"time\",\"R<sub>ctrl</sub>\",\"E<sub>pot</sub>\"";
338 Trace_file <<
",\"E<sub>kin</sub>\",\"E<sub>kin</sub>+E<sub>pot</sub>\"";
339 Trace_file <<
",\"<sub>exact</sub>R<sub>ctrl</sub>\""
350 double timestep_ratio=1.0;
354 unsigned ndt=time_stepper_pt()->time_pt()->ndt();
357 Vector<double> dt_prev(ndt);
359 for (
unsigned i=1;i<ndt;i++)
361 dt_prev[i]=dt_prev[i-1]/timestep_ratio;
365 time_pt()->initialise_dt(dt_prev);
369 time_pt()->time()=time0;
377 SolidMesh::Solid_IC_problem.
378 set_newmark_initial_condition_consistently(
379 this,mesh_pt(),
static_cast<TIMESTEPPER*
>(time_stepper_pt()),IC_pt,dt);
383 SolidMesh::Solid_IC_problem.
384 set_newmark_initial_condition_directly(
385 this,mesh_pt(),
static_cast<TIMESTEPPER*
>(time_stepper_pt()),IC_pt,dt);
389 doc_solution(doc_info);
392 for(
unsigned i=1;i<=nstep;i++)
395 unsteady_newton_solve(dt);
399 doc_solution(doc_info);
402 if (time_pt()->time()<100.0) {dt=timestep_ratio*dt;}