fish_poisson_simple_adapt.cc File Reference
#include "generic.h"
#include "poisson.h"
#include "meshes/fish_mesh.h"

Classes

class  SimpleRefineableFishMesh< ELEMENT >
 Fish shaped mesh with simple adaptivity (no macro elements). More...
 
class  SimpleRefineableFishPoissonProblem< ELEMENT >
 

Namespaces

 ConstSourceForPoisson
 Namespace for const source term in Poisson equation.
 

Functions

void ConstSourceForPoisson::get_source (const Vector< double > &x, double &source)
 Const source function. More...
 
int main ()
 

Function Documentation

◆ main()

int main ( )

Demonstrate how to solve 2D Poisson problem in fish-shaped domain with mesh adaptation. First we solve on the original coarse mesh. Next we do a few uniform refinement steps and resolve. Finally, we enter into an automatic adapation loop.

233 {
234 
235  //Set up the problem with 4 node Poisson elements
237 
238  // Setup labels for output
239  //------------------------
240  DocInfo doc_info;
241 
242  // Set output directory
243  doc_info.set_directory("RESLT");
244 
245  // Step number
246  doc_info.number()=0;
247 
248 
249  // Doc adaptivity targets
250  //-----------------------
251  problem.mesh_pt()->doc_adaptivity_targets(cout);
252 
253 
254  // Solve/doc the problem
255  //----------------------
256 
257  // Solve the problem
258  problem.newton_solve();
259 
260  //Output solution
261  problem.doc_solution(doc_info);
262 
263  //Increment counter for solutions
264  doc_info.number()++;
265 
266 
267  // Do two rounds of uniform mesh refinement and re-solve
268  //-------------------------------------------------------
269  problem.refine_uniformly();
270  problem.refine_uniformly();
271 
272  // Solve the problem
273  problem.newton_solve();
274 
275  //Output solution
276  problem.doc_solution(doc_info);
277 
278  //Increment counter for solutions
279  doc_info.number()++;
280 
281 
282  // Now do (up to) four rounds of fully automatic adapation in response to
283  //-----------------------------------------------------------------------
284  // error estimate
285  //---------------
286  unsigned max_solve=4;
287  for (unsigned isolve=0;isolve<max_solve;isolve++)
288  {
289  // Adapt problem/mesh
290  problem.adapt();
291 
292  // Re-solve the problem if the adaptation has changed anything
293  if ((problem.mesh_pt()->nrefined() !=0)||
294  (problem.mesh_pt()->nunrefined()!=0))
295  {
296  problem.newton_solve();
297  }
298  else
299  {
300  cout << "Mesh wasn't adapted --> we'll stop here" << std::endl;
301  break;
302  }
303 
304  //Output solution
305  problem.doc_solution(doc_info);
306 
307  //Increment counter for solutions
308  doc_info.number()++;
309  }
310 
311 
312 } // end of main
Definition: fish_poisson_simple_adapt.cc:111
Definition: oomph_utilities.h:499
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
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References oomph::DocInfo::number(), problem, and oomph::DocInfo::set_directory().