two_d_unsteady_heat_restarted.cc File Reference
#include "generic.h"
#include "unsteady_heat.h"
#include "meshes/rectangular_quadmesh.h"

Classes

class  UnsteadyHeatProblem< ELEMENT >
 UnsteadyHeat problem. More...
 

Namespaces

 ExactSolnForUnsteadyHeat
 Namespace for unforced exact solution for UnsteadyHeat equation.
 

Functions

void ExactSolnForUnsteadyHeat::get_exact_u (const double &time, const Vector< double > &x, Vector< double > &u)
 Exact solution as a Vector. More...
 
void ExactSolnForUnsteadyHeat::get_exact_u (const double &time, const Vector< double > &x, double &u)
 Exact solution as a scalar. More...
 
void ExactSolnForUnsteadyHeat::get_source (const double &time, const Vector< double > &x, double &source)
 Source function to make it an exact solution. More...
 
int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// Driver code for unsteady heat equation with option for restart from disk: Only a single command line argument is allowed. If specified it is interpreted as the name of the restart file.

533 {
534 
535  // Store command line arguments
536  CommandLineArgs::setup(argc,argv);
537 
538  // Build problem
541 
542  // Setup labels for output
543  DocInfo doc_info;
544 
545  // Output directory
546  doc_info.set_directory("RESLT");
547 
548  // Output number
549  doc_info.number()=0;
550 
551  // Open a trace file
552  ofstream trace_file;
553  char filename[100];
554  sprintf(filename,"%s/trace.dat",doc_info.directory().c_str());
555  trace_file.open(filename);
556  trace_file << "VARIABLES=\"time\",\"u<SUB>FE</SUB>\","
557  << "\"u<SUB>exact</SUB>\",\"norm of error\",\"norm of solution\""
558  << std::endl;
559 
560  // Choose simulation interval
561  double t_max=0.5;
562 
563  // Set IC
564  problem.set_initial_condition();
565 
566  //Output initial condition
567  problem.doc_solution(doc_info,trace_file);
568 
569  //Increment counter for solutions
570  doc_info.number()++;
571 
572 
573  // Get (fixed) timestep dt from Time object. dt was set in
574  // set_initial_conditions(), either by assigning a
575  // value or re-cycling the one from the restart file.
576  // This is necessary because the history values obtained from the
577  // restart file are only correct if the same dts are used.
578  double dt=problem.time_pt()->dt();
579 
580  // Find number of steps
581  unsigned nstep = unsigned(t_max/dt);
582 
583  // Timestepping loop
584  for (unsigned istep=0;istep<nstep;istep++)
585  {
586  // Take timestep
587  problem.unsteady_newton_solve(dt);
588 
589  //Output solution
590  problem.doc_solution(doc_info,trace_file);
591 
592  //Increment counter for solutions
593  doc_info.number()++;
594  }
595 
596  // Close trace file
597  trace_file.close();
598 
599 
600 }; // end of main
UnsteadyHeat problem.
Definition: pretend_melt.cc:80
Definition: oomph_utilities.h:499
std::string directory() const
Output directory.
Definition: oomph_utilities.h:524
void set_directory(const std::string &directory)
Definition: oomph_utilities.cc:298
unsigned & number()
Number used (e.g.) for labeling output files.
Definition: oomph_utilities.h:554
void get_source(const double &time, const Vector< double > &x, double &source)
Source function to make it an exact solution.
Definition: heat_transfer_and_melting/two_d_unsteady_heat_melt/two_d_unsteady_heat.cc:79
void setup(Time *time_pt)
Create all GeomObjects needed to define the cylinder and the flag.
Definition: turek_flag_non_fsi.cc:277
string filename
Definition: MergeRestartFiles.py:39
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References oomph::DocInfo::directory(), MergeRestartFiles::filename, ExactSolnForUnsteadyHeat::get_source(), oomph::DocInfo::number(), problem, oomph::DocInfo::set_directory(), and Flag_definition::setup().