38 #include "meshes/geompack_mesh.h"
43 using namespace oomph;
75 source = 2.0*tanh(-1.0+
Alpha*(
Beta*x[0]-x[1]))*
76 (1.0-pow(tanh(-1.0+
Alpha*(
Beta*x[0]-x[1])),2.0))*
92 template<
class ELEMENT>
100 PoissonProblem(PoissonEquations<2>::PoissonSourceFctPt source_fct_pt,
101 const string& mesh_file_name,
102 const string& curve_file_name);
111 unsigned num_bound = mesh_pt()->nboundary();
112 for(
unsigned ibound=0;ibound<num_bound;ibound++)
115 unsigned num_nod=mesh_pt()->nboundary_node(ibound);
116 for (
unsigned inod=0;inod<num_nod;inod++)
118 Node* nod_pt=mesh_pt()->boundary_node_pt(ibound,inod);
124 nod_pt->set_value(0,u);
141 void doc_solution(DocInfo& doc_info);
155 template<
class ELEMENT>
157 PoissonProblem(PoissonEquations<2>::PoissonSourceFctPt source_fct_pt,
158 const string& mesh_file_name,
159 const string& curve_file_name)
160 : Source_fct_pt(source_fct_pt)
178 unsigned num_bound =
mesh_pt()->nboundary();
179 for(
unsigned ibound=0;ibound<num_bound;ibound++)
181 unsigned num_nod=
mesh_pt()->nboundary_node(ibound);
182 for (
unsigned inod=0;inod<num_nod;inod++)
184 mesh_pt()->boundary_node_pt(ibound,inod)->pin(0);
191 unsigned n_element =
mesh_pt()->nelement();
195 for(
unsigned i=0;i<n_element;i++)
198 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(
mesh_pt()->element_pt(i));
205 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
214 template<
class ELEMENT>
229 sprintf(filename,
"%s/boundaries.dat",doc_info.directory().c_str());
230 some_file.open(filename);
231 mesh_pt()->output_boundaries(some_file);
237 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
239 some_file.open(filename);
240 mesh_pt()->output(some_file,npts);
246 sprintf(filename,
"%s/exact_soln%i.dat",doc_info.directory().c_str(),
248 some_file.open(filename);
256 sprintf(filename,
"%s/error%i.dat",doc_info.directory().c_str(),
258 some_file.open(filename);
262 cout <<
"error: " << sqrt(error) << std::endl;
263 cout <<
"norm : " << sqrt(norm) << std::endl << std::endl;
283 int main(
int argc,
char* argv[])
286 CommandLineArgs::setup(argc,argv);
291 std::string error_message =
292 "Wrong number of command line arguments.\n";
294 "Must specify the following file names \n";
296 "filename.mh2 then filename.cs2\n";
298 throw OomphLibError(error_message,
299 OOMPH_CURRENT_FUNCTION,
300 OOMPH_EXCEPTION_LOCATION);
304 string mesh_file_name(argv[1]);
305 string curve_file_name(argv[2]);
310 mesh_file_name,curve_file_name);
316 doc_info.set_directory(
"RESLT");
319 problem.newton_solve();
Micky mouse Poisson problem.
PoissonEquations< 2 >::PoissonSourceFctPt Source_fct_pt
Pointer to source function.
void actions_before_newton_solve()
Update the problem specs before solve: (Re)set boundary conditions.
PoissonProblem(PoissonEquations< 2 >::PoissonSourceFctPt source_fct_pt, const string &mesh_file_name, const string &curve_file_name)
Constructor.
void actions_after_newton_solve()
Update the problem specs before solve (empty)
GeompackQuadMesh< ELEMENT > * mesh_pt()
void doc_solution(DocInfo &doc_info)
Doc the solution.
~PoissonProblem()
Destructor (empty)
Quadrilateral mesh generator; Uses input from Geompack++. See: http://members.shaw....
int main(int argc, char *argv[])
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
Namespace for exact solution for Poisson equation with sharp step.
double Beta
Parameter for angle of step.
void get_source(const Vector< double > &x, double &source)
Source function to make it an exact solution.
double Alpha
Parameter for steepness of step.
void get_exact_u(const Vector< double > &x, double &u)
Exact solution as a scalar.
void get_exact_u(const Vector< double > &x, Vector< double > &u)
Exact solution as a Vector.
////////////////////////////////////////////////////////////////////// //////////////////////////////...