35 #include "meshes/eighth_sphere_mesh.h"
39 using namespace oomph;
130 template<
class ELEMENT>
138 PoissonEquations<3>::PoissonSourceFctPt source_fct_pt);
145 RefineableEighthSphereMesh<ELEMENT>*
mesh_pt()
147 return dynamic_cast<RefineableEighthSphereMesh<ELEMENT>*
>(Problem::mesh_pt());
158 unsigned num_bound = mesh_pt()->nboundary();
159 for(
unsigned ibound=0;ibound<num_bound;ibound++)
162 unsigned num_nod=mesh_pt()->nboundary_node(ibound);
163 for (
unsigned inod=0;inod<num_nod;inod++)
165 Node* nod_pt=mesh_pt()->boundary_node_pt(ibound,inod);
172 nod_pt->set_value(0,u);
178 void doc_solution(DocInfo& doc_info);
194 template<
class ELEMENT>
196 PoissonEquations<3>::PoissonSourceFctPt source_fct_pt) :
197 Source_fct_pt(source_fct_pt)
206 Problem::mesh_pt() =
new RefineableEighthSphereMesh<ELEMENT>(radius);
209 Z2ErrorEstimator* error_estimator_pt=
new Z2ErrorEstimator;
210 mesh_pt()->spatial_error_estimator_pt()=error_estimator_pt;
213 if (CommandLineArgs::Argc>1)
217 mesh_pt()->max_permitted_error()=0.7;
218 mesh_pt()->min_permitted_error()=0.5;
222 mesh_pt()->max_permitted_error()=0.01;
223 mesh_pt()->min_permitted_error()=0.001;
228 some_file.open(
"boundaries.dat");
229 mesh_pt()->output_boundaries(some_file);
235 unsigned num_bound =
mesh_pt()->nboundary();
236 for(
unsigned ibound=0;ibound<num_bound;ibound++)
238 unsigned num_nod=
mesh_pt()->nboundary_node(ibound);
239 for (
unsigned inod=0;inod<num_nod;inod++)
241 mesh_pt()->boundary_node_pt(ibound,inod)->pin(0);
247 unsigned n_element =
mesh_pt()->nelement();
251 for(
unsigned i=0;i<n_element;i++)
254 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(
mesh_pt()->element_pt(i));
261 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
270 template<
class ELEMENT>
283 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
285 some_file.open(filename);
286 mesh_pt()->output(some_file,npts);
292 sprintf(filename,
"%s/exact_soln%i.dat",doc_info.directory().c_str(),
294 some_file.open(filename);
302 sprintf(filename,
"%s/error%i.dat",doc_info.directory().c_str(),
304 some_file.open(filename);
308 cout <<
"error: " << sqrt(error) << std::endl;
309 cout <<
"norm : " << sqrt(norm) << std::endl << std::endl;
326 int main(
int argc,
char *argv[])
330 CommandLineArgs::setup(argc,argv);
341 doc_info.set_directory(
"RESLT");
347 cout <<
"Self test: " << problem.self_test() << std::endl;
350 problem.newton_solve();
361 if (CommandLineArgs::Argc>1)
365 cout <<
"Only doing one adaptation for validation" << std::endl;
373 for (
unsigned isolve=0;isolve<max_solve;isolve++)
379 if ((problem.
mesh_pt()->nrefined() !=0)||
380 (problem.
mesh_pt()->nunrefined()!=0))
382 problem.newton_solve();
386 cout <<
"Mesh wasn't adapted --> we'll stop here" << std::endl;
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
~EighthSpherePoissonProblem()
Destructor: Empty.
void actions_after_newton_solve()
Update the problem specs after solve (empty)
RefineableEighthSphereMesh< ELEMENT > * mesh_pt()
Overload generic access function by one that returns a pointer to the specific mesh.
void doc_solution(DocInfo &doc_info)
Doc the solution.
EighthSpherePoissonProblem(PoissonEquations< 3 >::PoissonSourceFctPt source_fct_pt)
Constructor: Pass pointer to source function.
PoissonEquations< 3 >::PoissonSourceFctPt Source_fct_pt
Pointer to source function.
void actions_before_newton_solve()
Update the problem specs before solve: Set Dirchlet boundary conditions from exact solution.
int main(int argc, char *argv[])
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
Namespace for exact solution for Poisson equation with sharp step.
double N_y
Orientation (non-normalised y-component of unit vector in direction of step plane)
double Z_0
Orientation (z-coordinate of step plane)
double N_x
Orientation (non-normalised x-component of unit vector in direction of step plane)
double Y_0
Orientation (y-coordinate of step plane)
void get_source(const Vector< double > &x, double &source)
Source function to make it an exact solution.
double Alpha
Parameter for steepness of step.
double N_z
Orientation (non-normalised z-component of unit vector in direction of step plane)
void get_exact_u(const Vector< double > &x, double &u)
Exact solution as a scalar.
double X_0
Orientation (x-coordinate of step plane)
void get_exact_u(const Vector< double > &x, Vector< double > &u)