69 #include "libmesh/equation_systems.h" 70 #include "libmesh/twostep_time_solver.h" 71 #include "libmesh/euler_solver.h" 72 #include "libmesh/euler2_solver.h" 73 #include "libmesh/steady_solver.h" 74 #include "libmesh/newton_solver.h" 75 #include "libmesh/numeric_vector.h" 76 #include "libmesh/petsc_diff_solver.h" 77 #include "libmesh/mesh.h" 78 #include "libmesh/mesh_tools.h" 79 #include "libmesh/mesh_base.h" 80 #include "libmesh/mesh_refinement.h" 81 #include "libmesh/system.h" 82 #include "libmesh/system_norm.h" 83 #include "libmesh/adjoint_residual_error_estimator.h" 84 #include "libmesh/const_fem_function.h" 85 #include "libmesh/error_vector.h" 86 #include "libmesh/fem_function_base.h" 87 #include "libmesh/getpot.h" 88 #include "libmesh/gmv_io.h" 89 #include "libmesh/exodusII_io.h" 90 #include "libmesh/kelly_error_estimator.h" 91 #include "libmesh/parameter_vector.h" 92 #include "libmesh/patch_recovery_error_estimator.h" 93 #include "libmesh/petsc_vector.h" 94 #include "libmesh/sensitivity_data.h" 95 #include "libmesh/tecplot_io.h" 96 #include "libmesh/uniform_refinement_estimator.h" 97 #include "libmesh/qoi_set.h" 98 #include "libmesh/weighted_patch_recovery_error_estimator.h" 99 #include "libmesh/enum_solver_package.h" 100 #include "libmesh/enum_xdr_mode.h" 106 #include "femparameters.h" 119 std::string solution_type,
121 std::string extension,
124 std::ostringstream file_name;
125 file_name << solution_type
145 return file_name.str();
152 std::string solution_type,
157 #ifdef LIBMESH_HAVE_GMV 160 std::ostringstream file_name_gmv;
161 file_name_gmv << solution_type
174 (file_name_gmv.str(), es);
178 #ifdef LIBMESH_HAVE_TECPLOT_API 181 std::ostringstream file_name_tecplot;
182 file_name_tecplot << solution_type
196 (file_name_tecplot.str(), es);
217 #ifdef LIBMESH_HAVE_EXODUS_API 228 std::ostringstream file_name_exodus;
230 file_name_exodus << solution_type <<
".e";
232 file_name_exodus <<
"-s" 273 unsigned int newton_steps,
274 unsigned int krylov_steps,
276 unsigned int tv_usec)
287 std::ofstream activemesh (
"out_activemesh.m",
289 activemesh.precision(17);
290 activemesh << (a_step + 1) <<
' ' 291 << n_active_elem <<
' ' 292 << n_active_dofs << std::endl;
295 std::ofstream solvesteps (
"out_solvesteps.m",
297 solvesteps.precision(17);
298 solvesteps << newton_steps <<
' ' 299 << krylov_steps << std::endl;
302 std::ofstream clocktime (
"out_clocktime.m",
304 clocktime.precision(17);
305 clocktime << tv_sec <<
'.' << tv_usec << std::endl;
314 std::ofstream clocktime (
"out_clocktime.m",
316 clocktime <<
"];" << std::endl;
320 std::ofstream activemesh (
"out_activemesh.m",
322 activemesh <<
"];" << std::endl;
324 std::ofstream solvesteps (
"out_solvesteps.m",
326 solvesteps <<
"];" << std::endl;
330 std::ofstream times (
"out_time.m",
332 times <<
"];" << std::endl;
333 std::ofstream timesteps (
"out_timesteps.m",
335 timesteps <<
"];" << std::endl;
339 std::ofstream changerate (
"out_changerate.m",
341 changerate <<
"];" << std::endl;
346 std::ofstream complete (
"complete");
347 complete <<
"complete" << std::endl;
351 #if defined(LIBMESH_HAVE_GMV) || defined(LIBMESH_HAVE_TECPLOT_API) 354 unsigned int t_number,
355 unsigned int a_number,
357 std::string error_type)
367 #ifdef LIBMESH_HAVE_GMV 370 std::ostringstream error_gmv;
371 error_gmv <<
"error.gmv." 387 #ifdef LIBMESH_HAVE_TECPLOT_API 390 std::ostringstream error_tecplot;
391 error_tecplot <<
"error.plt." 411 std::string solution_type,
416 std::string file_name_mesh, file_name_soln;
420 file_name_mesh =
numbered_filename(t_step, a_step, solution_type,
"mesh",
"xda", param);
421 file_name_soln =
numbered_filename(t_step, a_step, solution_type,
"soln",
"xda", param);
425 file_name_mesh =
numbered_filename(t_step, a_step, solution_type,
"mesh",
"xdr", param);
426 file_name_soln =
numbered_filename(t_step, a_step, solution_type,
"soln",
"xdr", param);
439 for (
unsigned int i = 0; i != es.
n_systems(); ++i)
443 Real current_time = 0., current_timestep = 0.;
447 std::ifstream times (
"out_time.m");
448 std::ifstream timesteps (
"out_timesteps.m");
449 if (times.is_open() && timesteps.is_open())
452 const unsigned int headersize = 25;
453 char header[headersize];
454 timesteps.getline (header, headersize);
455 libmesh_error_msg_if(strcmp(header,
"vector_timesteps = [") != 0,
456 "Bad header in out_timesteps.m:\n" << header);
458 times.getline (header, headersize);
459 libmesh_error_msg_if(strcmp(header,
"vector_time = [") != 0,
460 "Bad header in out_time.m:\n" << header);
463 for (
unsigned int i = 0; i != t_step; ++i)
465 libmesh_error_msg_if(!times.good(),
"Error: File out_time.m is in non-good state.");
467 times >> current_time;
468 timesteps >> current_timestep;
472 current_time += current_timestep;
475 libmesh_error_msg(
"Error opening out_time.m or out_timesteps.m");
478 current_time = t_step * param.
deltat;
480 for (
unsigned int i = 0; i != es.
n_systems(); ++i)
504 std::unique_ptr<UnsteadySolver> innersolver;
507 auto euler2solver = std::make_unique<Euler2Solver>(system);
509 innersolver = std::move(euler2solver);
513 auto eulersolver = std::make_unique<EulerSolver>(system);
515 innersolver = std::move(eulersolver);
518 libmesh_error_msg(
"Don't recognize core TimeSolver type: " << param.
timesolver_core);
522 system.
time_solver = std::make_unique<TwostepTimeSolver>(system);
523 auto timesolver = cast_ptr<TwostepTimeSolver *>(system.
time_solver.get());
529 timesolver->core_time_solver = std::move(innersolver);
535 system.
time_solver = std::make_unique<SteadySolver>(system);
537 system.
time_solver->reduce_deltat_on_diffsolver_failure =
550 #ifdef LIBMESH_HAVE_PETSC 551 system.
time_solver->diff_solver() = std::make_unique<PetscDiffSolver>(system);
553 libmesh_error_msg(
"This example requires libMesh to be compiled with PETSc support.");
558 system.
time_solver->diff_solver() = std::make_unique<NewtonSolver>(system);
559 auto solver = cast_ptr<NewtonSolver*>(system.
time_solver->diff_solver().get());
570 if (system.
time_solver->reduce_deltat_on_diffsolver_failure)
572 solver->continue_after_max_iterations =
true;
573 solver->continue_after_backtrack_failure =
true;
584 #ifdef LIBMESH_ENABLE_AMR 589 auto mesh_refinement = std::make_unique<MeshRefinement>(
mesh);
590 mesh_refinement->coarsen_by_parents() =
true;
597 return mesh_refinement;
600 #endif // LIBMESH_ENABLE_AMR 606 return std::make_unique<KellyErrorEstimator>();
612 std::unique_ptr<ErrorEstimator>
614 std::vector<std::vector<Real>> & term_weights,
615 std::vector<FEMNormType> & primal_error_norm_type,
616 std::vector<FEMNormType> & dual_error_norm_type)
618 auto adjoint_residual_estimator = std::make_unique<AdjointResidualErrorEstimator>();
621 adjoint_residual_estimator->primal_error_estimator() = std::make_unique<PatchRecoveryErrorEstimator>();
622 auto p1 = cast_ptr<PatchRecoveryErrorEstimator *>(adjoint_residual_estimator->primal_error_estimator().get());
624 adjoint_residual_estimator->dual_error_estimator() = std::make_unique<PatchRecoveryErrorEstimator>();
625 auto p2 = cast_ptr<PatchRecoveryErrorEstimator *>(adjoint_residual_estimator->dual_error_estimator().get());
634 std::size_t size = primal_error_norm_type.size();
636 libmesh_assert_equal_to (size, dual_error_norm_type.size());
637 for (
unsigned int i = 0; i != size; ++i)
639 adjoint_residual_estimator->primal_error_estimator()->error_norm.set_type(i, primal_error_norm_type[i]);
640 adjoint_residual_estimator->dual_error_estimator()->error_norm.set_type(i, dual_error_norm_type[i]);
645 libmesh_assert_equal_to (size, term_weights.size());
646 for (
unsigned int i = 0; i != size; ++i)
648 libmesh_assert_equal_to (size, term_weights[i].size());
649 adjoint_residual_estimator->error_norm.set_weight(i, term_weights[i][i]);
650 for (
unsigned int j = 0; j != size; ++j)
652 adjoint_residual_estimator->error_norm.set_off_diagonal_weight(i, j, term_weights[i][j]);
655 return adjoint_residual_estimator;
660 std::unique_ptr<ErrorEstimator>
661 build_weighted_error_estimator_component_wise (
FEMParameters & param,
662 std::vector<std::vector<Real>> & term_weights,
663 std::vector<FEMNormType> & primal_error_norm_type,
664 std::vector<FEMNormType> & dual_error_norm_type,
667 auto adjoint_residual_estimator = std::make_unique<AdjointResidualErrorEstimator>();
672 adjoint_residual_estimator->primal_error_estimator() = std::make_unique<WeightedPatchRecoveryErrorEstimator>();
673 auto p1 = cast_ptr<WeightedPatchRecoveryErrorEstimator *>(adjoint_residual_estimator->primal_error_estimator().get());
675 adjoint_residual_estimator->dual_error_estimator() = std::make_unique<PatchRecoveryErrorEstimator>();
676 auto p2 = cast_ptr<PatchRecoveryErrorEstimator *>(adjoint_residual_estimator->dual_error_estimator().get());
682 p1->weight_functions.clear();
686 std::size_t size = primal_error_norm_type.size();
691 for (
unsigned int i = 0; i != size; ++i)
693 p1->weight_functions.push_back(coupled_system_weight_functions[i]);
694 adjoint_residual_estimator->primal_error_estimator()->error_norm.set_type(i, primal_error_norm_type[i]);
695 adjoint_residual_estimator->dual_error_estimator()->error_norm.set_type(i, dual_error_norm_type[i]);
700 libmesh_assert_equal_to (size, term_weights.size());
701 for (
unsigned int i = 0; i != size; ++i)
703 libmesh_assert_equal_to (size, term_weights[i].size());
704 adjoint_residual_estimator->error_norm.set_weight(i, term_weights[i][i]);
705 for (
unsigned int j = 0; j != size; ++j)
707 adjoint_residual_estimator->error_norm.set_off_diagonal_weight(i, j, term_weights[i][j]);
710 return adjoint_residual_estimator;
714 int main (
int argc,
char ** argv)
720 #ifndef LIBMESH_ENABLE_AMR 721 libmesh_example_requires(
false,
"--enable-amr");
725 #ifndef LIBMESH_ENABLE_DIRICHLET 726 libmesh_example_requires(
false,
"--enable-dirichlet");
736 std::ifstream i(
"general.in");
737 libmesh_error_msg_if(!i,
'[' <<
init.comm().rank() <<
"] Can't find general.in; exiting early.");
741 GetPot infile(
"general.in");
744 infile.parse_command_line(argc, argv);
750 libmesh_example_requires(2 <= LIBMESH_DIM,
"2D support");
757 std::unique_ptr<MeshRefinement> mesh_refinement =
784 equation_systems.init ();
788 equation_systems.print_info();
790 libMesh::out <<
"Starting adaptive loop" << std::endl << std::endl;
793 unsigned int a_step = 0;
807 libMesh::out<<
"We cant refine to both a non-zero tolerance and a target number of elements, EXITING adaptive loop. "<<std::endl<<std::endl;
814 libMesh::out <<
"Adaptive step " << a_step << std::endl;
816 libMesh::out <<
"Solving the forward problem" << std::endl;
820 <<
" active elements and " 821 << equation_systems.n_active_dofs()
830 write_output(equation_systems, 0, a_step,
"primal", param);
842 << std::setprecision(17)
849 libmesh_assert_less(std::abs(QoI_0_computed - 0.0833), 2.5e-4);
866 libMesh::out<<
"Solving the adjoint problem" <<std::endl;
875 primal_solution.
swap(dual_solution);
877 write_output(equation_systems, 0, a_step,
"adjoint", param);
880 primal_solution.
swap(dual_solution);
898 std::vector<FEMNormType> primal_norm_type_vector_non_pressure;
899 primal_norm_type_vector_non_pressure.push_back(
H1_SEMINORM);
900 primal_norm_type_vector_non_pressure.push_back(
H1_SEMINORM);
901 primal_norm_type_vector_non_pressure.push_back(
L2);
902 primal_norm_type_vector_non_pressure.push_back(
H1_SEMINORM);
904 std::vector<FEMNormType> dual_norm_type_vector_non_pressure;
905 dual_norm_type_vector_non_pressure.push_back(
H1_SEMINORM);
906 dual_norm_type_vector_non_pressure.push_back(
H1_SEMINORM);
907 dual_norm_type_vector_non_pressure.push_back(
L2);
908 dual_norm_type_vector_non_pressure.push_back(
H1_SEMINORM);
910 std::vector<std::vector<Real>>
911 weights_matrix_non_pressure(system.
n_vars(),
912 std::vector<Real>(system.
n_vars(), 0.0));
913 weights_matrix_non_pressure[0][0] = 1.;
914 weights_matrix_non_pressure[1][1] = 1.;
915 weights_matrix_non_pressure[3][3] = 1./Pe;
919 std::unique_ptr<ErrorEstimator> error_estimator_non_pressure =
920 build_error_estimator_component_wise (param,
921 weights_matrix_non_pressure,
922 primal_norm_type_vector_non_pressure,
923 dual_norm_type_vector_non_pressure);
927 error_estimator_non_pressure->estimate_error(system, error_non_pressure);
930 write_error(equation_systems, error_non_pressure, 0, a_step, param,
"_non_pressure");
938 std::vector<FEMNormType> primal_norm_type_vector_with_pressure;
939 primal_norm_type_vector_with_pressure.push_back(
H1_X_SEMINORM);
940 primal_norm_type_vector_with_pressure.push_back(
H1_Y_SEMINORM);
941 primal_norm_type_vector_with_pressure.push_back(
L2);
942 primal_norm_type_vector_with_pressure.push_back(
L2);
944 std::vector<FEMNormType> dual_norm_type_vector_with_pressure;
945 dual_norm_type_vector_with_pressure.push_back(
H1_X_SEMINORM);
946 dual_norm_type_vector_with_pressure.push_back(
H1_Y_SEMINORM);
947 dual_norm_type_vector_with_pressure.push_back(
L2);
948 dual_norm_type_vector_with_pressure.push_back(
L2);
950 std::vector<std::vector<Real>>
951 weights_matrix_with_pressure (system.
n_vars(),
952 std::vector<Real>(system.
n_vars(), 0.0));
953 weights_matrix_with_pressure[0][2] = 1.;
954 weights_matrix_with_pressure[1][2] = 1.;
955 weights_matrix_with_pressure[2][0] = 1.;
956 weights_matrix_with_pressure[2][1] = 1.;
960 std::unique_ptr<ErrorEstimator> error_estimator_with_pressure =
961 build_error_estimator_component_wise (param,
962 weights_matrix_with_pressure,
963 primal_norm_type_vector_with_pressure,
964 dual_norm_type_vector_with_pressure);
967 error_estimator_with_pressure->estimate_error(system, error_with_pressure);
970 write_error(equation_systems, error_with_pressure, 0, a_step, param,
"_with_pressure");
977 std::vector<FEMNormType> primal_norm_type_vector_convection_diffusion_x;
978 primal_norm_type_vector_convection_diffusion_x.push_back(
L2);
979 primal_norm_type_vector_convection_diffusion_x.push_back(
L2);
980 primal_norm_type_vector_convection_diffusion_x.push_back(
L2);
981 primal_norm_type_vector_convection_diffusion_x.push_back(
H1_X_SEMINORM);
983 std::vector<FEMNormType> dual_norm_type_vector_convection_diffusion_x;
984 dual_norm_type_vector_convection_diffusion_x.push_back(
L2);
985 dual_norm_type_vector_convection_diffusion_x.push_back(
L2);
986 dual_norm_type_vector_convection_diffusion_x.push_back(
L2);
988 dual_norm_type_vector_convection_diffusion_x.push_back(
L2);
990 std::vector<std::vector<Real>>
991 weights_matrix_convection_diffusion_x (system.
n_vars(),
992 std::vector<Real>(system.
n_vars(), 0.0));
993 weights_matrix_convection_diffusion_x[0][3] = 1.;
994 weights_matrix_convection_diffusion_x[3][3] = 1.;
1009 std::vector<FEMFunctionBase<Number> *> coupled_system_weight_functions_x;
1010 coupled_system_weight_functions_x.push_back(&convdiffx0);
1011 coupled_system_weight_functions_x.push_back(&identity);
1012 coupled_system_weight_functions_x.push_back(&identity);
1013 coupled_system_weight_functions_x.push_back(&convdiffx3);
1017 std::unique_ptr<ErrorEstimator> error_estimator_convection_diffusion_x =
1018 build_weighted_error_estimator_component_wise (param,
1019 weights_matrix_convection_diffusion_x,
1020 primal_norm_type_vector_convection_diffusion_x,
1021 dual_norm_type_vector_convection_diffusion_x,
1022 coupled_system_weight_functions_x);
1026 error_estimator_convection_diffusion_x->estimate_error(system, error_convection_diffusion_x);
1030 error_convection_diffusion_x,
1034 "_convection_diffusion_x");
1040 std::vector<FEMNormType> primal_norm_type_vector_convection_diffusion_y;
1041 primal_norm_type_vector_convection_diffusion_y.push_back(
L2);
1042 primal_norm_type_vector_convection_diffusion_y.push_back(
L2);
1043 primal_norm_type_vector_convection_diffusion_y.push_back(
L2);
1044 primal_norm_type_vector_convection_diffusion_y.push_back(
H1_Y_SEMINORM);
1046 std::vector<FEMNormType> dual_norm_type_vector_convection_diffusion_y;
1047 dual_norm_type_vector_convection_diffusion_y.push_back(
L2);
1048 dual_norm_type_vector_convection_diffusion_y.push_back(
L2);
1049 dual_norm_type_vector_convection_diffusion_y.push_back(
L2);
1051 dual_norm_type_vector_convection_diffusion_y.push_back(
L2);
1053 std::vector<std::vector<Real>>
1054 weights_matrix_convection_diffusion_y (system.
n_vars(),
1055 std::vector<Real>(system.
n_vars(), 0.0));
1056 weights_matrix_convection_diffusion_y[1][3] = 1.;
1057 weights_matrix_convection_diffusion_y[3][3] = 1.;
1065 std::vector<FEMFunctionBase<Number> *> coupled_system_weight_functions_y;
1066 coupled_system_weight_functions_y.push_back(&identity);
1067 coupled_system_weight_functions_y.push_back(&convdiffy1);
1068 coupled_system_weight_functions_y.push_back(&identity);
1069 coupled_system_weight_functions_y.push_back(&convdiffy3);
1073 std::unique_ptr<ErrorEstimator> error_estimator_convection_diffusion_y =
1074 build_weighted_error_estimator_component_wise (param,
1075 weights_matrix_convection_diffusion_y,
1076 primal_norm_type_vector_convection_diffusion_y,
1077 dual_norm_type_vector_convection_diffusion_y,
1078 coupled_system_weight_functions_y);
1082 error_estimator_convection_diffusion_y->estimate_error(system, error_convection_diffusion_y);
1085 write_error(equation_systems, error_convection_diffusion_y, 0, a_step, param,
"_convection_diffusion_y");
1089 error.resize(error_non_pressure.size());
1093 for (std::size_t i = 0; i < error.size(); i++)
1094 error[i] = error_non_pressure[i] + error_with_pressure[i] + error_convection_diffusion_x[i] + error_convection_diffusion_y[i];
1104 error_estimator->estimate_error(system, error);
1107 write_error(equation_systems, error, 0, a_step, param,
"_total");
1118 mesh_refinement->uniformly_refine(1);
1122 mesh_refinement->flag_elements_by_error_tolerance (error);
1125 mesh_refinement->refine_and_coarsen_elements();
1133 libMesh::out <<
"We reached the target number of elements." << std::endl <<std::endl;
1137 mesh_refinement->flag_elements_by_nelem_target (error);
1140 mesh_refinement->refine_and_coarsen_elements();
1143 equation_systems.reinit();
1149 #endif // #ifndef LIBMESH_ENABLE_AMR unsigned int nelem_target
libMesh::Real timesolver_upper_tolerance
Real time
For time-dependent problems, this is the time t at the beginning of the current timestep.
bool print_solution_norms
void start_output(unsigned int timesteps, std::string filename, std::string varname)
This is the EquationSystems class.
virtual void read(const std::string &name, void *mesh_data=nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false)=0
Interfaces for reading/writing a mesh to/from a file.
unsigned int initial_timestep
bool print_element_residuals
void write_output_headers(FEMParameters ¶m)
virtual dof_id_type n_active_elem() const =0
void write(std::string_view name, const XdrMODE, const unsigned int write_flags=(WRITE_DATA), bool partition_agnostic=true) const
Write the systems to disk using the XDR data format.
unsigned int n_systems() const
Real verify_analytic_jacobians
If verify_analytic_jacobian is equal to zero (as it is by default), no numeric jacobians will be calc...
bool reuse_preconditioner
libMesh::Real timesolver_tolerance
void set_adjoint_already_solved(bool setting)
Setter for the adjoint_already_solved boolean.
virtual void write_equation_systems(const std::string &, const EquationSystems &, const std::set< std::string > *system_names=nullptr)
This method implements writing a mesh with data to a specified file where the data is taken from the ...
virtual void set_constrain_in_solver(bool enable)
set_constrain_in_solver to false to apply constraints only via residual terms in the systems to be so...
bool print_jacobian_norms
Set print_jacobian_norms to true to print |J| whenever it is assembled.
The ErrorVector is a specialization of the StatisticsVector for error data computed on a finite eleme...
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
int extra_quadrature_order
A member int that can be employed to indicate increased or reduced quadrature order.
std::string timesolver_core
bool require_residual_reduction
std::unique_ptr< TimeSolver > time_solver
A pointer to the solver object we're going to use.
bool print_residual_norms
libMesh::Real timesolver_maxgrowth
std::string numbered_filename(unsigned int t_step, unsigned int a_step, std::string solution_type, std::string type, std::string extension, FEMParameters ¶m)
libMesh::Real relative_step_tolerance
std::string indicator_type
This class defines a norm/seminorm to be applied to a NumericVector which contains coefficients in a ...
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
The libMesh namespace provides an interface to certain functionality in the library.
This class implements writing meshes in the GMV format.
libMesh::Real refine_fraction
void set_system_parameters(LaplaceSystem &system, FEMParameters ¶m)
bool print_jacobians
Set print_jacobians to true to print J whenever it is assembled.
const T_sys & get_system(std::string_view name) const
This class provides a specific system class.
This is the MeshBase class.
bool print_element_residuals
Set print_element_residuals to true to print each R_elem contribution.
bool print_element_solutions
Set print_element_solutions to true to print each U_elem input.
SolverPackage default_solver_package()
libMesh::Real coarsen_threshold
bool print_solution_norms
Set print_residual_norms to true to print |U| whenever it is used in an assembly() call...
unsigned int max_linear_iterations
bool print_residual_norms
Set print_residual_norms to true to print |F| whenever it is assembled.
double minimum_linear_tolerance
std::unique_ptr< ErrorEstimator > build_error_estimator(const FEMParameters ¶m, const QoISet &qois)
Real deltat
For time-dependent problems, this is the amount delta t to advance the solution in time...
void print_info(std::ostream &os=libMesh::out, const unsigned int verbosity=0, const bool global=true) const
Prints relevant information about the mesh.
libMesh::Real verify_analytic_jacobians
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
bool print_residuals
Set print_residuals to true to print F whenever it is assembled.
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
unsigned int max_adaptivesteps
double initial_linear_tolerance
void read(std::string_view name, const XdrMODE, const unsigned int read_flags=(READ_HEADER|READ_DATA), bool partition_agnostic=true)
Read & initialize the systems from disk using the XDR data format.
int extra_quadrature_order
libMesh::Real global_tolerance
void attach_qoi(DifferentiableQoI *qoi_in)
Attach external QoI object.
void read(GetPot &input, const std::vector< std::string > *other_variable_names=nullptr)
std::unique_ptr< MeshRefinement > build_mesh_refinement(MeshBase &mesh, const FEMParameters ¶m)
libMesh::Real absolute_residual_tolerance
void plot_error(const std::string &filename, const MeshBase &mesh) const
Plots a data file, of a type determined by looking at the file extension in filename, of the error values on the active elements of mesh.
virtual void postprocess() override
Runs a postprocessing loop over all elements, and if postprocess_sides is true over all sides...
bool print_solutions
Set print_solutions to true to print U whenever it is used in an assembly() call. ...
libMesh::Real relative_residual_tolerance
void write_output_footers(FEMParameters ¶m)
virtual void write(const std::string &name) const =0
virtual void update()
Update the local values to reflect the solution on neighboring processors.
bool print_element_solutions
virtual void assemble_qoi(const QoISet &indices=QoISet()) override
Runs a qoi assembly loop over all elements, and if assemble_qoi_sides is true over all sides...
void build_domain(MeshBase &mesh, FEMParameters ¶m)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual LinearSolver< Number > * get_linear_solver() const override
void write_output_solvedata(EquationSystems &es, unsigned int a_step, unsigned int newton_steps, unsigned int krylov_steps, unsigned int tv_sec, unsigned int tv_usec)
virtual void reuse_preconditioner(bool)
Set the same_preconditioner flag, which indicates if we reuse the same preconditioner for subsequent ...
bool print_jacobian_norms
virtual void swap(NumericVector< T > &v)
Swaps the contents of this with v.
bool assemble_qoi_sides
If assemble_qoi_sides is true (it is false by default), the assembly loop for a quantity of interest ...
FEMSystem & build_system(EquationSystems &es, GetPot &, FEMParameters &)
void write_timestep(const std::string &fname, const EquationSystems &es, const int timestep, const Real time, const std::set< std::string > *system_names=nullptr)
Writes out the solution at a specific timestep.
processor_id_type global_processor_id()
void write_error(EquationSystems &es, ErrorVector &error, unsigned int t_number, unsigned int a_number, FEMParameters ¶m, std::string error_type) void write_error(EquationSystems &
const MeshBase & get_mesh() const
libMesh::Real min_step_length
std::size_t n_active_dofs() const
libMesh::Real timesolver_theta
NumericVector< Number > & get_adjoint_solution(unsigned int i=0)
unsigned int max_nonlinear_iterations
double linear_tolerance_multiplier
virtual void solve() override
Invokes the solver associated with the system.
This class implements writing meshes in the Tecplot format.
FEMFunction that returns a single value, regardless of the time and location inputs.
void write_output(EquationSystems &es, unsigned int t_step, unsigned int a_step, std::string solution_type, FEMParameters ¶m)
unsigned int n_vars() const
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
processor_id_type processor_id() const
std::vector< libMesh::FEMNormType > timesolver_norm
virtual std::pair< unsigned int, Real > adjoint_solve(const QoISet &qoi_indices=QoISet()) override
This function sets the _is_adjoint boolean member of TimeSolver to true and then calls the adjoint_so...
virtual void renumber_nodes_and_elements()=0
After partitioning a mesh it is useful to renumber the nodes and elements so that they lie in contigu...
libMesh::Real coarsen_fraction
int main(int argc, char **argv)
libMesh::Real steadystate_tolerance
unsigned int deltat_reductions