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

Classes

class  RefineableFishPoissonProblem< ELEMENT >
 

Namespaces

 ConstSourceForPoisson
 Namespace for const source term in Poisson equation.
 

Functions

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

Function Documentation

◆ main()

int main ( )

Demonstrate how to solve 2D Poisson problem in fish-shaped domain with mesh adaptation.

326 {
327  // Solve with adaptation, docing the intermediate steps
329 
330  // Solve directly, with fully automatic adaptation
332 
333 } // end of main
void solve_with_fully_automatic_adaptation()
Definition: poisson/fish_poisson/fish_poisson.cc:282
void solve_with_incremental_adaptation()
Definition: poisson/fish_poisson/fish_poisson.cc:191

References solve_with_fully_automatic_adaptation(), and solve_with_incremental_adaptation().

◆ solve_with_fully_automatic_adaptation()

void solve_with_fully_automatic_adaptation ( )

Demonstrate how to solve 2D Poisson problem in fish-shaped domain with fully automatic mesh adaptation

283 {
284 
285  //Set up the problem with nine-node refineable Poisson elements
287 
288  // Setup labels for output
289  //------------------------
290  DocInfo doc_info;
291 
292  // Set output directory
293  doc_info.set_directory("RESLT_fully_automatic");
294 
295  // Step number
296  doc_info.number()=0;
297 
298 
299  // Doc (default) refinement targets
300  //----------------------------------
301  problem.mesh_pt()->doc_adaptivity_targets(cout);
302 
303 
304  // Solve/doc the problem with fully automatic adaptation
305  //------------------------------------------------------
306 
307  // Maximum number of adaptations:
308  unsigned max_adapt=5;
309 
310  // Solve the problem; perform up to specified number of adaptations.
311  problem.newton_solve(max_adapt);
312 
313  //Output solution
314  problem.doc_solution(doc_info);
315 
316 } // end black box
Definition: algebraic_free_boundary_poisson.cc:81
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().

Referenced by main().

◆ solve_with_incremental_adaptation()

void solve_with_incremental_adaptation ( )

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 re-solve. Finally, we enter into an automatic adapation loop.

192 {
193 
194  //Set up the problem with nine-node refineable Poisson elements
196 
197  // Setup labels for output
198  //------------------------
199  DocInfo doc_info;
200 
201  // Set output directory
202  doc_info.set_directory("RESLT_incremental");
203 
204  // Step number
205  doc_info.number()=0;
206 
207 
208  // Doc (default) refinement targets
209  //----------------------------------
210  problem.mesh_pt()->doc_adaptivity_targets(cout);
211 
212  // Solve/doc the problem on the initial, very coarse mesh
213  //-------------------------------------------------------
214 
215  // Solve the problem
216  problem.newton_solve();
217 
218  //Output solution
219  problem.doc_solution(doc_info);
220 
221  //Increment counter for solutions
222  doc_info.number()++;
223 
224 
225  // Do three rounds of uniform mesh refinement and re-solve
226  //--------------------------------------------------------
227  problem.refine_uniformly();
228  problem.refine_uniformly();
229  problem.refine_uniformly();
230 
231  // Solve the problem
232  problem.newton_solve();
233 
234  //Output solution
235  problem.doc_solution(doc_info);
236 
237  //Increment counter for solutions
238  doc_info.number()++;
239 
240 
241  // Now do (up to) four rounds of fully automatic adapation in response to
242  //-----------------------------------------------------------------------
243  // error estimate
244  //---------------
245  unsigned max_solve=4;
246  for (unsigned isolve=0;isolve<max_solve;isolve++)
247  {
248  // Adapt problem/mesh
249  problem.adapt();
250 
251  // Re-solve the problem if the adaptation has changed anything
252  if ((problem.mesh_pt()->nrefined() !=0)||
253  (problem.mesh_pt()->nunrefined()!=0))
254  {
255  problem.newton_solve();
256  }
257  else
258  {
259  cout << "Mesh wasn't adapted --> we'll stop here" << std::endl;
260  break;
261  }
262 
263  //Output solution
264  problem.doc_solution(doc_info);
265 
266  //Increment counter for solutions
267  doc_info.number()++;
268  }
269 
270 
271 } // end of incremental

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

Referenced by main().