optimisation/disable_ALE/unsteady_heat/two_d_unsteady_heat_adapt.cc File Reference

Classes

class  MyUnitCircle
 
class  RefineableUnsteadyHeatProblem< ELEMENT >
 Unsteady heat problem in deformable ellipse domain. More...
 

Namespaces

 TanhSolnForUnsteadyHeat
 

Functions

double TanhSolnForUnsteadyHeat::step_position (const double &time)
 Position of step (x-axis intercept) More...
 
void TanhSolnForUnsteadyHeat::get_exact_u (const double &time, const Vector< double > &x, Vector< double > &u)
 Exact solution as a Vector. More...
 
void TanhSolnForUnsteadyHeat::get_exact_u (const double &time, const Vector< double > &x, double &u)
 Exact solution as a scalar. More...
 
void TanhSolnForUnsteadyHeat::get_source (const double &time, const Vector< double > &x, double &source)
 Source function to make it an exact solution. More...
 
void TanhSolnForUnsteadyHeat::prescribed_flux_on_fixed_y_boundary (const double &time, const Vector< double > &x, double &flux)
 Flux required by the exact solution on a boundary on which y is fixed. More...
 
void run_it (const bool &use_ale)
 
int main (int argc, char *argv[])
 

Variables

double TanhSolnForUnsteadyHeat::Alpha
 Parameter for steepness of step. More...
 
double TanhSolnForUnsteadyHeat::Beta
 Parameter for amplitude of step translation. More...
 
double TanhSolnForUnsteadyHeat::Gamma
 Parameter for timescale of step translation. More...
 
double TanhSolnForUnsteadyHeat::TanPhi
 Parameter for angle of step. More...
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

Demonstrate how to solve an unsteady heat problem with mesh adaptation. Command line arguments specify the name of the restart file.

1026 {
1027 
1028  // Store command line arguments
1029  CommandLineArgs::setup(argc,argv);
1030 
1031  // Run it with ALE
1032  run_it(true);
1033 
1034  // Run it without ALE
1035  run_it(false);
1036 
1037 }; // end of main
void setup(Time *time_pt)
Create all GeomObjects needed to define the cylinder and the flag.
Definition: turek_flag_non_fsi.cc:277
void run_it(const bool &use_ale)
Definition: optimisation/disable_ALE/unsteady_heat/two_d_unsteady_heat_adapt.cc:928

References run_it(), and Flag_definition::setup().

◆ run_it()

void run_it ( const bool use_ale)

///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// Solve an unsteady heat problem with mesh adaptation with and without ALE terms

929 {
930 
931  // Build problem
934 
935  // Specify duration of the simulation
936  //double t_max=3.0;
937 
938  // Set targets for spatial adaptivity
939  problem.bulk_mesh_pt()->max_permitted_error()=0.001;
940  problem.bulk_mesh_pt()->min_permitted_error()=0.0001;
941 
942  // First timestep?
943  bool first=true;
944 
945  // Max. number of spatial adaptations per timestep. Allow plenty
946  // of adaptations at first timestep as the initial conditions
947  // can be reset "exactly" from without any interpolation error.
948  unsigned max_adapt=10;
949 
950  // Set IC
951  problem.set_initial_condition();
952 
953  // Initial timestep: Use the one used when setting up the initial
954  // condition
955  double dt=problem.time_pt()->dt();
956 
957  // If restart: The first step isn't really the first step,
958  // i.e. initial condition should not be re-set when
959  // adaptive refinement has been performed. Also, limit
960  // the max. number of refinements per timestep to the
961  // normal value straightaway.
962  if (CommandLineArgs::Argc==2)
963  {
964  first=false;
965  max_adapt=1;
966  }
967  // If no restart, refine mesh uniformly before we get started
968  else
969  {
970  problem.refine_uniformly();
971  problem.refine_uniformly();
972  // Solution is automatically interpolated from the coarse initial mesh
973  // onto the refined mesh but this provides a very poor representation
974  // of the intial condition: Re-assign the initial conditions
975  problem.set_initial_condition();
976  }
977 
978  //Output FE representation of the initial condition
979  problem.doc_solution();
980 
981  // Find number of steps
982  unsigned nstep = 6; // unsigned(t_max/dt);
983 
984  // Initialise timer
985  clock_t t_start = clock();
986 
987  // Timestepping loop
988  for (unsigned istep=0;istep<nstep;istep++)
989  {
990  // Take timestep
991  problem.unsteady_newton_solve(dt,max_adapt,first);
992 
993  // Now we've done the first timestep -- don't re-set the IC
994  // in subsequent steps
995  first=false;
996 
997  // Reduce the number of spatial adaptations to one per
998  // timestep
999  max_adapt=1;
1000 
1001  //Output solution
1002  //problem.doc_solution();
1003 
1004  }
1005 
1006  // Stop timer
1007  clock_t t_end = clock();
1008 
1009  std::cout << "Total time for solution: "
1010  << double(t_end-t_start)/CLOCKS_PER_SEC
1011  << std::endl;
1012 
1013  //Output final solution for check
1014  problem.doc_solution();
1015 
1016 };
Unsteady heat problem in deformable ellipse domain.
Definition: two_d_unsteady_heat_2adapt_load_balance.cc:223
void get_source(const double &time, const Vector< double > &x, double &source)
Source function to make it an exact solution.
Definition: optimisation/disable_ALE/unsteady_heat/two_d_unsteady_heat_adapt.cc:140
int Argc
Number of arguments + 1.
Definition: oomph_utilities.cc:407
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References oomph::CommandLineArgs::Argc, TanhSolnForUnsteadyHeat::get_source(), and problem.

Referenced by main().