two_d_unsteady_heat_2adapt.cc File Reference

Classes

class  MyEllipse
 
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...
 
int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

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

1055 {
1056 
1057  // Store command line arguments
1058  CommandLineArgs::setup(argc,argv);
1059 
1060 
1061  // Specify duration of the simulation
1062  double t_max=0.04; // 2.0;
1063 
1064  // Build problem: Pass pointer to source function and initial timestep
1067 
1068  // Set targets for spatial adaptivity
1069  problem.bulk_mesh_pt()->max_permitted_error()=0.001;
1070  problem.bulk_mesh_pt()->min_permitted_error()=0.0001;
1071 
1072  // First timestep?
1073  bool first=true;
1074 
1075  // Max. number of spatial adaptations per timestep. Allow plenty
1076  // of adaptations at first timestep as the initial conditions
1077  // can be reset "exactly" from without any interpolation error.
1078  unsigned max_adapt=10;
1079 
1080  // Set IC
1081  problem.set_initial_condition();
1082 
1083  // Initial timestep: Use the one used when setting up the initial
1084  // condition or the "suggested next dt" from the restarted run
1085  double dt=problem.next_dt();
1086 
1087  cout << "Doing first timestep with dt: " << dt << std::endl;
1088 
1089  // If restart: The first step isn't really the first step,
1090  // i.e. initial condition should not be re-set when
1091  // adaptive refinement has been performed. Also, limit
1092  // the max. number of refinements per timestep to the
1093  // normal value straightaway.
1094  if (CommandLineArgs::Argc==2)
1095  {
1096  first=false;
1097  max_adapt=1;
1098  }
1099  // If no restart, refine mesh uniformly before we get started
1100  else
1101  {
1102  problem.refine_uniformly();
1103  problem.refine_uniformly();
1104  }
1105 
1106  // Write header for trace file
1107  problem.write_trace_file_header();
1108 
1109 
1110  // Timestepping loop
1111  while (problem.time_pt()->time()<t_max)
1112  {
1113  // Take timestep with temporal and spatial adaptivity
1114  double dt_new=
1115  problem.doubly_adaptive_unsteady_newton_solve(dt,problem.epsilon_t(),
1116  max_adapt,first);
1117  cout << "Suggested new dt: " << dt_new << std::endl;
1118  dt=dt_new;
1119 
1120  // Store for restart
1121  problem.next_dt()=dt_new;
1122 
1123  // Now we've done the first timestep -- don't re-set the IC
1124  // in subsequent steps
1125  first=false;
1126 
1127  // Reduce the number of spatial adaptations to one per
1128  // timestep -- too scared that the interpolation error will
1129  // wipe out any further gains...
1130  max_adapt=1;
1131 
1132  //Output solution
1133  problem.doc_solution();
1134 
1135  }
1136 
1137 
1138 }; // end of main
Unsteady heat problem in deformable ellipse domain.
Definition: two_d_unsteady_heat_2adapt_load_balance.cc:223
void setup(Time *time_pt)
Create all GeomObjects needed to define the cylinder and the flag.
Definition: turek_flag_non_fsi.cc:277
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(), problem, and Flag_definition::setup().