optimisation/disable_ALE/unsteady_heat/two_d_unsteady_heat.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...
 
void run_it (const bool &use_ale)
 
int main ()
 Driver code for unsteady heat equation. More...
 

Function Documentation

◆ main()

int main ( )

Driver code for unsteady heat equation.

532 {
533 
534  // Run with ale
535  run_it(true);
536 
537 
538  // Run without ale
539  run_it(false);
540 
541 
542 
543 }; // end of main
void run_it(const bool &use_ale)
Definition: optimisation/disable_ALE/unsteady_heat/two_d_unsteady_heat.cc:435

References run_it().

◆ run_it()

void run_it ( const bool use_ale)

///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// Run adaptive solution of unsteady heat equation with or without ALE

436 {
437 
438  // Build problem
441 
442 
443  // Switch off ALE?
444  if (!use_ale)
445  {
446  problem.disable_ALE();
447  }
448 
449  // Setup labels for output
450  DocInfo doc_info;
451 
452  // Output directory
453  if (!use_ale)
454  {
455  doc_info.set_directory("RESLT");
456  }
457  else
458  {
459  doc_info.set_directory("RESLT_ALE");
460  }
461 
462  // Output number
463  doc_info.number()=0;
464 
465  // Open a trace file
466  ofstream trace_file;
467  char filename[100];
468  sprintf(filename,"%s/trace.dat",doc_info.directory().c_str());
469  trace_file.open(filename);
470  trace_file << "VARIABLES=\"time\",\"u<SUB>FE</SUB>\","
471  << "\"u<SUB>exact</SUB>\",\"norm of error\",\"norm of solution\""
472  << std::endl;
473 
474  // Choose simulation interval and timestep
475  double t_max=0.1; // 0.5;
476  double dt=0.01;
477 
478  // Initialise timestep -- also sets the weights for all timesteppers
479  // in the problem.
480  problem.initialise_dt(dt);
481 
482  // Set IC
483  problem.set_initial_condition();
484 
485  //Output initial condition
486  problem.doc_solution(doc_info,trace_file);
487 
488  //Increment counter for solutions
489  doc_info.number()++;
490 
491  // Find number of steps
492  unsigned nstep = unsigned(t_max/dt);
493 
494  // Initialise timer
495  clock_t t_start = clock();
496 
497  // Timestepping loop
498  for (unsigned istep=0;istep<nstep;istep++)
499  {
500  // cout << " Timestep " << istep << std::endl;
501 
502  // Take timestep
503  problem.unsteady_newton_solve(dt);
504 
505  //Output solution
506  // problem.doc_solution(doc_info,trace_file);
507 
508  //Increment counter for solutions
509  // doc_info.number()++;
510  }
511 
512  // Stop timer
513  clock_t t_end = clock();
514 
515  std::cout << "Total time for solution: "
516  << double(t_end-t_start)/CLOCKS_PER_SEC
517  << std::endl;
518 
519  //Output final solution for check
520  problem.doc_solution(doc_info,trace_file);
521 
522 }; // 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
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, and oomph::DocInfo::set_directory().

Referenced by main().