27 #ifndef OOMPH_MY_GENERIC_PROBLEM_H
28 #define OOMPH_MY_GENERIC_PROBLEM_H
49 T bp_pt =
dynamic_cast<T> (prec_pt);
60 using namespace StringConversion;
62 class ElementalFunction;
72 timeinfo = localtime(&rawtime);
75 strftime(buffer, 80,
"%Y-%m-%d-%H-%M-%S", timeinfo);
86 mass_matrix_solver_for_explicit_timestepper_pt = 0;
120 std::ostringstream stream;
122 args_str.assign(stream.str());
135 Trace_filename(
"trace"),
136 Info_filename(
"info"),
137 Trace_seperator(
"; "),
141 Output_precision = 8;
142 Error_norm_limit = -1.0;
143 Solution_norm_limit = -1.0;
147 Doc_info.enable_error_if_directory_does_not_exist();
149 Disable_mass_matrix_solver_optimisations =
false;
152 Always_write_trace =
true;
156 Output_predictor_values =
false;
157 Want_doc_exact =
false;
158 Output_initial_condition =
false;
159 Should_doc_boundaries =
false;
180 explicit_timestep(dt);
184 dt = adaptive_unsteady_newton_solve(dt, tol);
188 unsteady_newton_solve(dt);
192 Total_step_time = step_time_stop - step_time_start;
195 oomph_info <<
"Time for step " << Total_step_time
258 return (explicit_time_stepper_pt() != 0)
259 && (time_stepper_pt()->is_steady());
264 return (explicit_time_stepper_pt() == 0)
265 && (time_stepper_pt()->is_steady());
276 +
to_string(nnewton_step_this_solve() + 1);
278 dump_current_mm_or_jacobian_residuals(
label);
284 return Jacobian_setup_times.size();
292 Jacobian_setup_times.push_back
293 (this->mass_matrix_solver_for_explicit_timestepper_pt()->jacobian_setup_time());
294 Solver_times.push_back
295 (this->mass_matrix_solver_for_explicit_timestepper_pt()->linear_solver_solution_time());
300 =
dynamic_cast<const IterativeLinearSolver*
>(this->mass_matrix_solver_for_explicit_timestepper_pt());
303 Solver_iterations.push_back(its_pt->
iterations());
309 Solver_iterations.push_back(Dummy_doc_data);
310 Preconditioner_setup_times.push_back(Dummy_doc_data);
341 Jacobian_setup_times.push_back
342 (this->linear_solver_pt()->jacobian_setup_time());
343 Solver_times.push_back
344 (this->linear_solver_pt()->linear_solver_solution_time());
350 Solver_iterations.push_back(its_pt->
iterations());
356 Solver_iterations.push_back(Dummy_doc_data);
357 Preconditioner_setup_times.push_back(Dummy_doc_data);
364 Jacobian_setup_times.clear();
365 Solver_times.clear();
366 Solver_iterations.clear();
367 Preconditioner_setup_times.clear();
378 for(
unsigned msh=0, nmsh=nsub_mesh(); msh<nmsh; msh++)
380 Mesh* mesh_pt = this->mesh_pt(msh);
381 for(
unsigned nd=0, nnd=mesh_pt->
nnode(); nd<nnd; nd++)
384 for(
unsigned j=0;
j<indices.size();
j++)
395 oomph_info <<
"Segregated solve, without indices:\n";
398 unsigned indices_length=indices.size();
399 if (indices_length==0)
405 oomph_info << Trace_seperator <<
"[" << indices[0];
406 if (indices_length>1)
408 for (
unsigned i=1;
i<indices_length;
i++)
417 oomph_info <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
423 for(
unsigned msh=0, nmsh=nsub_mesh(); msh<nmsh; msh++)
425 Mesh* mesh_pt = this->mesh_pt(msh);
426 for(
unsigned nd=0, nnd=mesh_pt->
nnode(); nd<nnd; nd++)
429 for(
unsigned j=0;
j<nd_pt->
nvalue();
j++)
438 oomph_info <<
"un-segregated n eqn " << assign_eqn_numbers() << std::endl;
446 for(
unsigned msh=0, nmsh=nsub_mesh(); msh<nmsh; msh++)
448 Mesh* mesh_pt = this->mesh_pt(msh);
449 for(
unsigned nd=0, nnd=mesh_pt->
nnode(); nd<nnd; nd++)
452 for(
unsigned j=0;
j<nd_pt->
nvalue();
j++)
470 if(Error_norm_limit != -1.0)
472 double error_norm = get_error_norm();
474 if((error_norm != Dummy_doc_data)
475 && (error_norm > Error_norm_limit))
478 err +=
" exceeds the limit " +
to_string(Error_norm_limit);
485 if(Solution_norm_limit != -1.0)
487 double solution_norm = get_solution_norm();
489 if((solution_norm != Dummy_doc_data)
490 && (solution_norm > Solution_norm_limit))
493 err +=
" exceeds the limit " +
to_string(Solution_norm_limit);
501 double min_element_size();
505 void write_trace(
const unsigned& t_hist=0);
512 std::ofstream& trace_file)
const {}
539 dump_current_mm_or_jacobian_residuals(
"at_end");
543 std::ofstream pvd_file((
Doc_info.directory() +
"/" +
"soln.pvd").c_str(),
545 pvd_file <<
"</Collection>" << std::endl
546 <<
"</VTKFile>" << std::endl;
552 std::ofstream pvd_file((
Doc_info.directory() +
"/" +
"exact.pvd").c_str(),
554 pvd_file <<
"</Collection>" << std::endl
555 <<
"</VTKFile>" << std::endl;
560 final_doc_additional();
569 void doc_solution(
const unsigned& t_hist=0,
576 const unsigned& npoints=2)
const
578 const unsigned n_msh = nsub_mesh();
579 for(
unsigned msh=0; msh<n_msh; msh++)
581 Mesh* msh_pt = mesh_pt(msh);
583 const unsigned n_ele = msh_pt->
nelement();
584 for(
unsigned ele=0; ele<n_ele; ele++)
587 ele_pt->
output(
t, outstream, npoints);
593 virtual void doc_boundaries(
const std::string& boundary_file_basename)
const;
598 const unsigned& npoints=2)
const
600 output_solution(0, outstream, npoints);
606 std::ostream& outstream,
607 const unsigned& npoints=2)
const
609 const double time = time_pt()->time();
611 const unsigned n_msh = nsub_mesh();
612 for(
unsigned msh=0; msh<n_msh; msh++)
614 Mesh* msh_pt = mesh_pt(msh);
616 const unsigned n_ele = msh_pt->
nelement();
617 for(
unsigned ele=0; ele<n_ele; ele++)
629 if(Exact_solution_pt != 0)
636 const double t = time_pt()->time(t_hist);
640 const unsigned n_node = mesh_pt()->nnode();
641 for(
unsigned nd=0; nd<n_node; nd++)
643 Node* nd_pt = mesh_pt()->node_pt(nd);
646 nd_pt->
value(t_hist, values);
650 const unsigned ni = values.size();
651 for(
unsigned i=0;
i<ni;
i++)
661 return Dummy_doc_data;
669 get_dofs(t_hist, dofs);
684 if(Doc_times.empty())
return true;
688 for(
unsigned j=0;
j<Doc_times.size();
j++)
690 if(( time >= Doc_times[
j]) && ((time - dt) < Doc_times[
j]))
701 Doc_times = doc_times;
709 if(time_stepper_pt()->adaptive_flag())
712 return global_temporal_error_norm();
716 return Dummy_doc_data;
722 return Want_doc_exact && (Exact_solution_pt != 0);
727 unsigned nele = mesh_pt()->nelement();
734 Node* nd_pt = mesh_pt()->finite_element_pt(
e)->node_pt(0);
735 values.assign(nd_pt->
nvalue(), 0.0);
736 nd_pt->
value(t_hist, values);
741 values.assign(1, Dummy_doc_data);
754 (this->linear_solver_pt());
762 const unsigned dim()
const {
return this->
Dim;}
767 virtual void set_up_impulsive_initial_condition();
774 virtual void actions_after_set_initial_condition();
778 virtual double integrate_over_problem(
const ElementalFunction* func_pt,
779 const Integral* quadrature_pt=0)
const;
782 virtual void dump(std::ofstream& dump_file)
const
785 dump_file.precision(14);
787 dump_file <<
Doc_info.number() <<
" # Doc_info.number()" << std::endl;
788 dump_file << N_steps_taken <<
" # N_steps_taken" << std::endl;
792 virtual void read(std::ifstream& restart_file)
799 getline(restart_file, input_string,
'#');
800 restart_file.ignore(80,
'\n');
801 Doc_info.number() = std::atoi(input_string.c_str());
805 getline(restart_file, input_string,
'#');
806 restart_file.ignore(80,
'\n');
807 N_steps_taken = std::atoi(input_string.c_str());
827 for(
unsigned j=0;
j<
Dim;
j++)
834 for(
unsigned j=0;
j<mesh_pt()->node_pt(0)->nvalue();
j++)
836 output <<
"error" <<
j <<
", ";
842 for(
unsigned i=0, ni=mesh_pt()->nnode();
i<ni;
i++)
844 Node* nd_pt = mesh_pt()->node_pt(
i);
847 for(
unsigned j=0;
j<
Dim;
j++)
853 for(
unsigned j=0;
j<nd_pt->
nvalue();
j++)
858 temporal_error_in_value(nd_pt,
j);
912 if(Exact_solution_pt == 0)
919 return (*Exact_solution_pt)(
t,
x);
952 const Integral* quadrature_pt)
const
972 (bulk_mesh_pt[0]->element_pt(0));
977 TimeStepper* ts_pt = bulk_mesh_pt[0]->node_pt(0)->time_stepper_pt();
978 this->add_time_stepper_pt(ts_pt);
983 for(
unsigned j=0;
j<bulk_mesh_pt.size();
j++)
985 if(bulk_mesh_pt[
j]->node_pt(0)->time_stepper_pt()
988 std::string err =
"Multiple timesteppers, you need to do somedhing more fancy here";
999 TimeStepper* ts_pt = bulk_mesh_pt[0]->element_pt(0)->
1000 internal_data_pt(0)->time_stepper_pt();
1001 this->add_time_stepper_pt(ts_pt);
1006 for(
unsigned j=0;
j<bulk_mesh_pt.size();
j++)
1008 if(bulk_mesh_pt[
j]->element_pt(0)->
1009 internal_data_pt(0)->time_stepper_pt() != ts_pt)
1011 std::string err =
"Multiple timesteppers? you need to do somedhing more fancy here";
1021 for(
unsigned j=0;
j<bulk_mesh_pt.size();
j++)
1023 add_sub_mesh(bulk_mesh_pt[
j]);
1036 = smart_cast_preconditioner<BlockPreconditioner<CRDoubleMatrix>*>
1077 if(!Disable_mass_matrix_solver_optimisations)
1089 mass_matrix_solver_for_explicit_timestepper_pt() = expl_solver_pt;
1096 this->enable_mass_matrix_reuse();
1101 if(Want_doc_exact && Exact_solution_pt == 0)
1103 std::string warning =
"Requested doc'ing exact solution, but we don't have an exact solution function pointer.";
1116 TR* tr_pt =
dynamic_cast<TR*
>(time_stepper_pt());
1126 if(*(
Doc_info.directory().end()-1) ==
'/')
1128 std::string error_msg =
"Don't put a / on the end of results dir";
1140 dump_current_mm_or_jacobian_residuals(
"at_start");
1146 std::ofstream pvd_file((dir +
"/" +
"soln.pvd").c_str(),
1148 pvd_file <<
"<?xml version=\"1.0\"?>" << std::endl
1149 <<
"<VTKFile type=\"Collection\" version=\"0.1\" byte_order=\"LittleEndian\">"
1151 <<
"<Collection>" << std::endl;
1157 std::ofstream pvd_file((dir +
"/" +
"exact.pvd").c_str(),
1159 pvd_file <<
"<?xml version=\"1.0\"?>" << std::endl
1160 <<
"<VTKFile type=\"Collection\" version=\"0.1\" byte_order=\"LittleEndian\">"
1162 <<
"<Collection>" << std::endl;
1170 std::ofstream trace_file((dir +
"/" + Trace_filename).c_str());
1172 <<
"DocInfo_numbers"
1173 << Trace_seperator <<
"times"
1174 << Trace_seperator <<
"dts"
1175 << Trace_seperator <<
"error_norms"
1177 << Trace_seperator <<
"n_newton_iters"
1178 << Trace_seperator <<
"n_solver_iters"
1180 << Trace_seperator <<
"solver_times"
1181 << Trace_seperator <<
"jacobian_setup_times"
1182 << Trace_seperator <<
"preconditioner_setup_times"
1184 << Trace_seperator <<
"LTE_norms"
1185 << Trace_seperator <<
"trace_values"
1187 << Trace_seperator <<
"unix_timestamp"
1188 << Trace_seperator <<
"newton_residuals"
1189 << Trace_seperator <<
"solution_norms"
1190 << Trace_seperator <<
"total_step_time"
1194 << Trace_seperator <<
"dummy"
1195 << Trace_seperator <<
"dummy"
1196 << Trace_seperator <<
"dummy"
1197 << Trace_seperator <<
"dummy"
1198 << Trace_seperator <<
"dummy"
1199 << Trace_seperator <<
"dummy";
1202 write_additional_trace_headers(trace_file);
1205 trace_file << std::endl;
1211 std::ofstream info_file((dir +
"/" + Info_filename).c_str());
1214 <<
"unix_time " << std::time(0) << std::endl
1215 <<
"driver_name " << problem_name() << std::endl
1216 <<
"initial_nnode " << mesh_pt()->nnode() << std::endl
1217 <<
"initial_nelement " << mesh_pt()->nelement() << std::endl
1218 <<
"initial_nsub_mesh " << nsub_mesh() << std::endl;
1224 if(Output_initial_condition)
1227 if(ntime_stepper() != 1)
1229 std::string err =
"More/less that 1 time stepper, not sure what to output.";
1236 const unsigned nval = time_stepper_pt()->nprev_values();
1237 for(
unsigned it=nval-1; it>0; it--)
1245 if(Should_doc_boundaries)
1247 this->doc_boundaries(dir +
"/nodes_on_boundary");
1253 initial_doc_additional();
1256 this->doc_solution();
1262 bool doc_this_step =
true;
1265 doc_this_step = should_doc_this_step(time_pt()->dt(t_hist),
1266 time_pt()->time(t_hist));
1272 if(Always_write_trace || doc_this_step)
1275 write_trace(t_hist);
1283 std::ofstream soln_file((dir +
"/" + prefix +
"soln" + num +
".dat").c_str(),
1285 soln_file.precision(Output_precision);
1286 output_solution(t_hist, soln_file);
1292 std::ofstream exact_file((dir +
"/" + prefix +
"exact" + num +
".dat").c_str(),
1294 exact_file.precision(Output_precision);
1295 output_exact_solution(t_hist, exact_file);
1300 if(!is_steady() && prefix ==
"")
1304 std::ofstream pvd_file((dir +
"/" +
"soln.pvd").c_str(),
1306 pvd_file.precision(Output_precision);
1308 pvd_file <<
"<DataSet timestep=\"" << time_pt()->time(t_hist)
1309 <<
"\" group=\"\" part=\"0\" file=\"" <<
"soln"
1311 <<
"\"/>" << std::endl;
1320 std::ofstream exact_pvd_file((dir +
"/" +
"exact.pvd").c_str(),
1322 exact_pvd_file.precision(Output_precision);
1324 exact_pvd_file <<
"<DataSet timestep=\"" << time()
1325 <<
"\" group=\"\" part=\"0\" file=\"" <<
"exact"
1327 <<
"\"/>" << std::endl;
1329 exact_pvd_file.close();
1337 std::ofstream dump_file((dir +
"/" +
"dump" + num +
".dat").c_str(),
1339 this->dump(dump_file);
1346 std::ofstream ltefile((dir +
"/ltes" + num +
".csv").c_str(),
1348 output_ltes(t_hist, ltefile);
1355 if(Output_predictor_values && ntime_stepper() != 1)
1357 std::string err =
"Can only output predictor values for a single time stepper";
1368 std::string err =
"Can't output history of predicted value: they aren't stored.";
1371 else if(Output_predictor_values && time_stepper_pt()->adaptive_flag())
1373 const unsigned predictor_time =
1374 time_stepper_pt()->predictor_storage_index();
1376 std::ofstream pred_file((dir +
"/" +
"predsoln" + num +
".dat").c_str(),
1378 pred_file.precision(Output_precision);
1379 output_solution(predictor_time, pred_file, 2);
1395 (mesh_pt(0)->element_pt(0));
1402 for(
unsigned msh=0, nmsh=nsub_mesh(); msh<nmsh; msh++)
1404 Mesh* mesh_pt = this->mesh_pt(msh);
1405 for(
unsigned ele=0, nele=mesh_pt->
nelement(); ele<nele; ele++)
1409 if(new_size < min_size)
1411 min_size = new_size;
1422 return Dummy_doc_data;
1428 std::ofstream trace_file((
Doc_info.directory() +
"/" + Trace_filename).c_str(),
1430 trace_file.precision(Output_precision);
1432 double time = Dummy_doc_data, dt = Dummy_doc_data;
1435 time = this->time_pt()->time(t_hist);
1436 dt = this->time_pt()->dt(t_hist);
1441 double nnewton_iter_taken = Dummy_doc_data,
1442 lte_norm = Dummy_doc_data,
1443 real_time = Dummy_doc_data,
1444 total_step_time = Dummy_doc_data;
1447 solver_times(1, Dummy_doc_data),
1448 jacobian_setup_times(1, Dummy_doc_data),
1449 preconditioner_setup_times(1, Dummy_doc_data),
1450 max_res(1, Dummy_doc_data);
1454 nnewton_iter_taken = Nnewton_iter_taken;
1455 solver_iterations = Solver_iterations;
1456 solver_times = Solver_times;
1457 jacobian_setup_times = Jacobian_setup_times;
1458 preconditioner_setup_times = Preconditioner_setup_times;
1459 real_time = std::time(0);
1460 total_step_time = Total_step_time;
1465 lte_norm = this->lte_norm();
1472 << Trace_seperator << time
1473 << Trace_seperator << dt
1474 << Trace_seperator << get_error_norm(t_hist)
1476 << Trace_seperator << nnewton_iter_taken;
1479 unsigned solver_iterations_length=solver_iterations.size();
1480 if (solver_iterations_length==0)
1482 trace_file << Trace_seperator <<
"[]";
1486 trace_file << Trace_seperator <<
"[" << solver_iterations[0];
1487 if (solver_iterations_length>1)
1489 for (
unsigned i=1;
i<solver_iterations_length;
i++)
1491 trace_file <<
", " << solver_iterations[
i];
1498 unsigned solver_times_length=solver_times.size();
1499 if (solver_times_length==0)
1501 trace_file << Trace_seperator <<
"[]";
1505 trace_file << Trace_seperator <<
"[" << solver_times[0];
1506 if (solver_times_length>1)
1508 for (
unsigned i=1;
i<solver_times_length;
i++)
1510 trace_file <<
", " << solver_times[
i];
1517 unsigned jacobian_setup_times_length=jacobian_setup_times.size();
1518 if (jacobian_setup_times_length==0)
1520 trace_file << Trace_seperator <<
"[]";
1524 trace_file << Trace_seperator <<
"[" << jacobian_setup_times[0];
1525 if (jacobian_setup_times_length>1)
1527 for (
unsigned i=1;
i<jacobian_setup_times_length;
i++)
1529 trace_file <<
", " << jacobian_setup_times[
i];
1536 unsigned preconditioner_setup_times_length=preconditioner_setup_times.size();
1537 if (preconditioner_setup_times_length==0)
1539 trace_file << Trace_seperator <<
"[]";
1543 trace_file << Trace_seperator <<
"[" << preconditioner_setup_times[0];
1544 if (preconditioner_setup_times_length>1)
1546 for (
unsigned i=1;
i<preconditioner_setup_times_length;
i++)
1548 trace_file <<
", " << preconditioner_setup_times[
i];
1554 trace_file << Trace_seperator << lte_norm;
1561 if (output_vector_length==0)
1563 trace_file << Trace_seperator <<
"[]";
1568 if (output_vector_length>1)
1570 for (
unsigned i=1;
i<output_vector_length;
i++)
1578 trace_file << Trace_seperator << real_time;
1581 unsigned max_res_length=max_res.size();
1582 if (max_res_length==0)
1584 trace_file << Trace_seperator <<
"[]";
1588 trace_file << Trace_seperator <<
"[" << max_res[0];
1589 if (max_res_length>1)
1591 for (
unsigned i=1;
i<max_res_length;
i++)
1593 trace_file <<
", " << max_res[
i];
1599 trace_file << Trace_seperator << get_solution_norm(t_hist)
1600 << Trace_seperator << total_step_time
1603 << Trace_seperator << Dummy_doc_data
1604 << Trace_seperator << Dummy_doc_data
1605 << Trace_seperator << Dummy_doc_data
1606 << Trace_seperator << Dummy_doc_data
1607 << Trace_seperator << Dummy_doc_data
1608 << Trace_seperator << Dummy_doc_data;
1612 write_additional_trace_data(t_hist, trace_file);
1615 trace_file << std::endl;
1621 const unsigned n_boundary = mesh_pt()->nboundary();
1622 for(
unsigned b=0;
b<n_boundary;
b++)
1624 std::ofstream boundary_file((boundary_file_basename +
1629 boundary_file <<
"x,y,z,b" << std::endl;
1631 const unsigned n_boundary_node = mesh_pt()->nboundary_node(
b);
1632 for(
unsigned nd=0; nd<n_boundary_node; nd++)
1634 Node* node_pt = mesh_pt()->boundary_node_pt(
b, nd);
1638 for(
unsigned i=0;
i<dim();
i++)
1640 boundary_file << position[
i] <<
",";
1642 for(
unsigned i=dim();
i<3;
i++)
1644 boundary_file << 0.0 <<
",";
1646 boundary_file <<
b << std::endl;
1649 boundary_file.close();
1657 if(nglobal_data() != 0)
1659 std::string err =
"Problem has global data which cannot be set from function pt.";
1664 unsigned nprev_steps=this->time_stepper_pt()->nprev_values();
1665 for(
unsigned t=0;
t< nprev_steps;
t++)
1668 for(
unsigned msh=0, nmsh=nsub_mesh(); msh<nmsh; msh++)
1670 Mesh* mesh_pt = this->mesh_pt(msh);
1672 for(
unsigned nd=0, nnd=mesh_pt->
nnode(); nd<nnd; nd++)
1675 for(
unsigned j=0, nj=nd_pt->
nvalue();
j<nj;
j++)
1682 for(
unsigned ele=0, nele=mesh_pt->
nelement(); ele<nele; ele++)
1688 "Element with non-nodal data, cannot set via function...";
1698 actions_after_set_initial_condition();
1706 if(nglobal_data() != 0)
1708 std::string err =
"Problem has global data which cannot be set from function pt.";
1715 const int nprev_values = this->time_stepper_pt()->nprev_values();
1716 for(
int tindex=0; tindex<nprev_values+1; tindex++)
1718 double time = time_pt()->time(tindex);
1721 const unsigned nmsh = nsub_mesh();
1722 for(
unsigned msh=0; msh<nmsh; msh++)
1724 Mesh* mesh_pt = this->mesh_pt(msh);
1726 for(
unsigned nd=0, nnd=mesh_pt->
nnode(); nd<nnd; nd++)
1731 const unsigned dim = nd_pt->
ndim();
1737 for(
unsigned j=0;
j<dim;
j++)
1739 nd_pt->
x(tindex,
j) =
x[
j];
1746 if(values.size() != nd_pt->
nvalue())
1748 std::string err =
"Wrong number of values in initial condition.";
1754 for(
unsigned j=0, nj=values.size();
j<nj;
j++)
1762 for(
unsigned ele=0, nele=mesh_pt->
nelement(); ele<nele; ele++)
1768 "Element with non-nodal data, cannot set via function...";
1777 actions_after_set_initial_condition();
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Scalar * b
Definition: benchVecAdd.cpp:17
The conjugate gradient method.
Definition: iterative_linear_solver.h:284
long & eqn_number(const unsigned &i)
Return the equation number of the i-th stored variable.
Definition: nodes.h:367
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
Definition: nodes.h:238
void set_value(const unsigned &i, const double &value_)
Definition: nodes.h:271
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
Definition: nodes.h:483
static long Is_unclassified
Definition: nodes.h:192
static long Is_segregated_solve_pinned
Definition: nodes.h:188
bool is_pinned(const unsigned &i) const
Test whether the i-th variable is pinned (1: true; 0: false).
Definition: nodes.h:417
Definition: oomph_utilities.h:499
Definition: double_vector.h:58
double norm() const
compute the 2 norm of this vector
Definition: double_vector.cc:867
Definition: elements.h:1313
virtual void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output an exact solution over the element.
Definition: elements.h:3104
virtual void output(std::ostream &outfile)
Definition: elements.h:3050
virtual double compute_physical_size() const
Definition: elements.h:2825
unsigned nodal_dimension() const
Return the required Eulerian dimension of the nodes in this element.
Definition: elements.h:2484
unsigned ninternal_data() const
Return the number of internal data objects.
Definition: elements.h:823
Definition: integral.h:49
Definition: iterative_linear_solver.h:54
virtual unsigned iterations() const =0
Number of iterations taken.
void enable_error_after_max_iter()
Throw an error if we don't converge within max_iter.
Definition: iterative_linear_solver.h:198
Preconditioner *& preconditioner_pt()
Access function to preconditioner.
Definition: iterative_linear_solver.h:95
virtual double preconditioner_setup_time() const
returns the the time taken to setup the preconditioner
Definition: iterative_linear_solver.h:180
unsigned & max_iter()
Access to max. number of iterations.
Definition: iterative_linear_solver.h:113
Definition: linear_solver.h:68
Matrix-based lumped preconditioner.
Definition: general_purpose_preconditioners.h:81
FiniteElement * finite_element_pt(const unsigned &e) const
Definition: mesh.h:473
unsigned long nnode() const
Return number of nodes in the mesh.
Definition: mesh.h:596
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
Definition: mesh.h:436
unsigned long nelement() const
Return number of elements in the mesh.
Definition: mesh.h:590
Definition: my_problem.h:112
std::string args_str
Definition: my_problem.h:126
void copy_args_string()
Copy dump of args into args_str.
Definition: my_problem.h:118
std::string output_jacobian
Definition: my_problem.h:125
MyDocInfo()
Default constructor.
Definition: my_problem.h:115
Definition: my_problem.h:131
Vector< double > exact_solution(const double &t, const Vector< double > &x) const
Get exact solution.
Definition: my_problem.h:909
double Total_step_time
Definition: my_problem.h:872
virtual void actions_after_explicit_stage()
Definition: my_problem.h:290
double Error_norm_limit
Definition: my_problem.h:877
bool Should_doc_boundaries
Should we output the locations of the boundary nodes?
Definition: my_problem.h:891
void initial_doc()
Definition: my_problem.h:1123
virtual void actions_before_explicit_stage()
Definition: my_problem.h:287
bool Want_doc_exact
Should we try to output exact solution?
Definition: my_problem.h:888
virtual void actions_before_time_integration()
Definition: my_problem.h:318
virtual void build(Vector< Mesh * > &bulk_mesh_pt)
Perform set up of problem.
Definition: my_problem.h:967
double smart_time_step(double dt, const double &tol)
Definition: my_problem.h:173
virtual ~MyProblem()
Definition: my_problem.h:169
virtual void set_up_impulsive_initial_condition()
Set all history values/dts to be the same as the present values/dt.
Definition: my_problem.h:1653
unsigned Output_precision
Definition: my_problem.h:869
virtual double get_error_norm(const unsigned &t_hist=0) const
Error norm calculator.
Definition: my_problem.h:627
void output_solution(std::ostream &outstream, const unsigned &npoints=2) const
Definition: my_problem.h:597
void undo_segregated_pinning()
Remove pinning set up by segregated_pin_indices.
Definition: my_problem.h:421
virtual void actions_after_explicit_timestep()
Actions that should be performed after each explicit time step.
Definition: my_problem.h:326
Vector< double > Solver_times
Definition: my_problem.h:933
virtual void actions_before_implicit_timestep()
Definition: my_problem.h:333
void segregated_pin_indices(const Vector< unsigned > &indices)
Definition: my_problem.h:376
virtual void output_solution(const unsigned &t, std::ostream &outstream, const unsigned &npoints=2) const
Definition: my_problem.h:575
void check_not_segregated(const char *function) const
Check that nothing is currently pinned for a segregated solve.
Definition: my_problem.h:443
void write_trace(const unsigned &t_hist=0)
Definition: my_problem.h:1426
SolutionFunctorBase * Exact_solution_pt
Function pointer for exact solution.
Definition: my_problem.h:906
double lte_norm()
Definition: my_problem.h:707
virtual void actions_after_set_initial_condition()
Definition: my_problem.h:1113
MyProblem()
Default constructor.
Definition: my_problem.h:134
const unsigned dim() const
Get problem dimension (nodal dimension).
Definition: my_problem.h:762
unsigned nnewton_step_this_solve() const
Definition: my_problem.h:282
virtual void actions_after_newton_step()
Definition: my_problem.h:339
void get_solver_parameters(SolverParameters &sp)
Definition: my_problem.h:210
bool Disable_mass_matrix_solver_optimisations
Definition: my_problem.h:882
virtual bool finished() const
Definition: my_problem.h:205
virtual double get_solution_norm(const unsigned &t_hist=0) const
Dummy solution norm calculator (overload in derived classes).
Definition: my_problem.h:666
virtual void my_set_initial_condition(const SolutionFunctorBase &ic)
Assign initial conditions from function pointer.
Definition: my_problem.h:1701
double min_element_size()
??ds
Definition: my_problem.h:1388
virtual void write_additional_trace_headers(std::ofstream &trace_file) const
Definition: my_problem.h:517
virtual void actions_after_implicit_timestep()
Definition: my_problem.h:331
std::string Info_filename
Definition: my_problem.h:875
virtual void actions_before_newton_solve()
Definition: my_problem.h:361
virtual void read(std::ifstream &restart_file)
Definition: my_problem.h:792
unsigned N_steps_taken
Definition: my_problem.h:871
void final_doc()
Definition: my_problem.h:533
virtual std::string problem_name() const
Definition: my_problem.h:764
Vector< double > Preconditioner_setup_times
Definition: my_problem.h:935
virtual void dump(std::ofstream &dump_file) const
Definition: my_problem.h:782
virtual void doc_boundaries(const std::string &boundary_file_basename) const
Output nodes with boundary number to csv file.
Definition: my_problem.h:1619
double Dummy_doc_data
Definition: my_problem.h:927
bool Output_predictor_values
Should we output the predicted values too?
Definition: my_problem.h:900
virtual void write_additional_trace_data(const unsigned &t_hist, std::ofstream &trace_file) const
Definition: my_problem.h:511
Vector< double > Solver_iterations
Definition: my_problem.h:934
MyProblem(const MyProblem &dummy)
Inaccessible copy constructor.
Definition: my_problem.h:941
virtual void output_exact_solution(const unsigned &t_hist, std::ostream &outstream, const unsigned &npoints=2) const
Definition: my_problem.h:605
bool explicit_flag()
Definition: my_problem.h:256
Vector< double > Jacobian_setup_times
Definition: my_problem.h:932
void doc_solution(const unsigned &t_hist=0, const std::string &prefix="")
Definition: my_problem.h:1259
bool Output_ltes
Should we output the local truncation error at each node as well?
Definition: my_problem.h:897
unsigned Dim
Definition: my_problem.h:928
MyDocInfo Doc_info
Definition: my_problem.h:868
bool Dump
Should we dump ready for a restart?
Definition: my_problem.h:894
Vector< double > Doc_times
Times at which we want to output the full solution.
Definition: my_problem.h:938
double Solution_norm_limit
Definition: my_problem.h:878
virtual void actions_before_newton_step()
Definition: my_problem.h:268
const std::string Trace_seperator
Definition: my_problem.h:926
virtual double integrate_over_problem(const ElementalFunction *func_pt, const Integral *quadrature_pt=0) const
Definition: my_problem.h:951
void check_norm_limits()
Definition: my_problem.h:467
virtual void output_solution(std::ofstream &soln_file) const
Overload to write any problem specific data.
Definition: my_problem.h:521
void dump_current_mm_or_jacobian_residuals(const std::string &label)
Definition: my_problem.h:960
bool Output_initial_condition
Should we write output for initial conditions as though they are time steps as well?
Definition: my_problem.h:903
virtual bool should_doc_this_step(const double &dt, const double &time) const
Definition: my_problem.h:676
virtual void initial_doc_additional() const
Definition: my_problem.h:523
void set_doc_times(Vector< double > &doc_times)
Assign a vector of times to output the full solution at.
Definition: my_problem.h:699
bool doc_exact() const
Definition: my_problem.h:720
bool is_steady()
Definition: my_problem.h:262
bool Always_write_trace
Should we output to trace file every step?
Definition: my_problem.h:885
virtual void final_doc_additional() const
Definition: my_problem.h:522
virtual Vector< double > trace_values(const unsigned &t_hist=0) const
Definition: my_problem.h:725
std::string Trace_filename
Definition: my_problem.h:874
virtual void actions_before_explicit_timestep()
Actions that should be performed before each explicit time step.
Definition: my_problem.h:320
void output_ltes(const unsigned &t_hist, std::ostream &output) const
Definition: my_problem.h:824
void set_solver_parameters(SolverParameters &sp)
Definition: my_problem.h:233
IterativeLinearSolver * iterative_linear_solver_pt() const
Definition: my_problem.h:751
void operator=(const MyProblem &dummy)
Inaccessible assignment operator.
Definition: my_problem.h:945
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060
void position(Vector< double > &pos) const
Definition: nodes.cc:2499
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
Definition: nodes.h:1054
double value(const unsigned &i) const
Definition: nodes.cc:2408
Definition: oomph_definitions.h:222
Definition: oomph_definitions.h:267
Definition: preconditioner.h:54
Definition: problem.h:151
virtual void actions_after_newton_solve()
Definition: problem.h:1038
virtual void dump(std::ofstream &dump_file) const
Definition: problem.cc:12029
virtual void read(std::ifstream &restart_file, bool &unsteady_restart)
Definition: problem.cc:12251
Definition: oomph_utilities.h:1109
Definition: trapezoid_rule.h:46
void setup_initial_derivative(Problem *problem_pt)
Definition: trapezoid_rule.h:189
Definition: timesteppers.h:231
void output_vector(const Vector< myType > &given_vector)
Definition: crdoublematrix_copy_constructor.cc:49
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 pow(const bfloat16 &a, const bfloat16 &b)
Definition: BFloat16.h:625
DocInfo Doc_info
Helper for documenting.
Definition: extrude_triangle_generated_mesh.cc:57
void exact_solution(const double &time, const Vector< double > &x, Vector< double > &u)
Definition: axisym_linear_elasticity/cylinder/cylinder.cc:203
static const unsigned Dim
Problem dimension.
Definition: two_d_tilted_square.cc:62
int error
Definition: calibrate.py:297
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
Definition: oomph_utilities.cc:195
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
Definition: oomph_utilities.cc:212
void doc_all_flags(std::ostream &outstream)
Document the values of all flags (specified or not).
Definition: oomph_utilities.cc:562
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
std::string to_string(T object, unsigned float_precision=8)
Definition: oomph_utilities.h:189
std::string to_lower(const std::string &input)
Convert a string to lower case (outputs a copy).
Definition: oomph_utilities.cc:345
double timer()
returns the time in seconds after some point in past
Definition: oomph_utilities.cc:1295
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
void output(std::ostream &outfile)
Output with default number of plot points.
Definition: gen_axisym_advection_diffusion_elements.h:161
std::string real_date_time()
Definition: my_problem.h:64
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
T smart_cast_preconditioner(Preconditioner *prec_pt)
Definition: my_problem.h:47
list x
Definition: plotDoE.py:28
t
Definition: plotPSD.py:36
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
Definition: my_problem.h:82
bool always_take_one_newton_step
Definition: my_problem.h:96
bool shut_up_in_newton_solve
Definition: my_problem.h:95
bool problem_is_nonlinear
Definition: my_problem.h:101
bool mass_matrix_reuse_is_enabled
Definition: my_problem.h:105
bool mass_matrix_has_been_computed
Definition: my_problem.h:106
bool discontinuous_element_formulation
Definition: my_problem.h:107
bool jacobian_reuse_is_enabled
Definition: my_problem.h:99
unsigned max_newton_iterations
Definition: my_problem.h:93
SolverParameters()
Definition: my_problem.h:83
double max_residuals
Definition: my_problem.h:94
double newton_solver_tolerance
Definition: my_problem.h:92
bool jacobian_has_been_computed
Definition: my_problem.h:100
LinearSolver * mass_matrix_solver_for_explicit_timestepper_pt
Definition: my_problem.h:104
LinearSolver * linear_solver_pt
Definition: my_problem.h:89
std::ofstream out("Result.txt")
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2