fish_poisson_adapt.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::get_source (const Vector< double > &x, double &source)
 Const source function. More...
 
void solve_with_incremental_adaptation ()
 
int main ()
 

Function Documentation

◆ main()

int main ( )

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

282 {
283  // Solve with adaptation, docing the intermediate steps
285 
286 } // end of main
void solve_with_incremental_adaptation()
Definition: fish_poisson_adapt.cc:190

References solve_with_incremental_adaptation().

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

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