39 #include "libmesh/getpot.h"
40 #include "libmesh/fem_system.h"
41 #include "libmesh/diff_solver.h"
42 #include "libmesh/newton_solver.h"
43 #include "libmesh/dof_map.h"
49 : _max_nonlinear_iterations( input(
"linear-nonlinear-solver/max_nonlinear_iterations", 10 ) ),
50 _relative_step_tolerance( input(
"linear-nonlinear-solver/relative_step_tolerance", 1.e-6 ) ),
51 _absolute_step_tolerance( input(
"linear-nonlinear-solver/absolute_step_tolerance", 0.0 ) ),
52 _relative_residual_tolerance( input(
"linear-nonlinear-solver/relative_residual_tolerance", 1.e-15 ) ),
53 _absolute_residual_tolerance( input(
"linear-nonlinear-solver/absolute_residual_tolerance", 0.0 ) ),
54 _initial_linear_tolerance( input(
"linear-nonlinear-solver/initial_linear_tolerance", 1.e-3 ) ),
55 _minimum_linear_tolerance( input(
"linear-nonlinear-solver/minimum_linear_tolerance", 1.e-3 ) ),
56 _max_linear_iterations( input(
"linear-nonlinear-solver/max_linear_iterations", 500 ) ),
57 _continue_after_backtrack_failure( input(
"linear-nonlinear-solver/continue_after_backtrack_failure", false ) ),
58 _continue_after_max_iterations( input(
"linear-nonlinear-solver/continue_after_max_iterations", false ) ),
59 _require_residual_reduction( input(
"linear-nonlinear-solver/require_residual_reduction", true ) ),
60 _solver_quiet( input(
"screen-options/solver_quiet", false ) ),
61 _solver_verbose( input(
"screen-options/solver_verbose", false ) )
73 SharedPtr<libMesh::EquationSystems> equation_system,
81 equation_system->init();
84 libMesh::DiffSolver &solver = *(system->time_solver->diff_solver().get());
106 if(dynamic_cast<libMesh::NewtonSolver*>(&solver))
116 libmesh_warning(
"GRINS can't change require_residual_reduction when not using NewtonSolver!");
125 libMesh::out <<
"==========================================================" << std::endl
126 <<
"Solving adjoint problem." << std::endl
127 <<
"==========================================================" << std::endl;
129 context.
system->adjoint_solve();
130 context.
system->set_adjoint_already_solved(
true);
135 for (
unsigned int v=0; v != context.
system->n_vars(); ++v)
136 if (context.
system->variable(v).type().family ==
139 std::cout << context.
system->variable_name(v) <<
141 std::vector<libMesh::dof_id_type> scalar_indices;
142 context.
system->get_dof_map().SCALAR_dof_indices
144 if (scalar_indices.size())
146 context.
system->current_solution(scalar_indices[0]);
147 for (
unsigned int i=1; i < scalar_indices.size();
150 context.
system->current_solution(scalar_indices[i]);
151 std::cout <<
'}' << std::endl;
157 context.
system->assemble_qoi();
158 const CompositeQoI* my_qoi = libMesh::cast_ptr<const CompositeQoI*>(context.
system->get_qoi());
double _absolute_residual_tolerance
virtual void init_time_solver(GRINS::MultiphysicsSystem *system)=0
double _relative_residual_tolerance
Solver(const GetPot &input)
unsigned int _max_linear_iterations
void set_solver_options(libMesh::DiffSolver &solver)
double _relative_step_tolerance
void steady_adjoint_solve(SolverContext &context)
Do steady version of adjoint solve.
bool _continue_after_backtrack_failure
double _minimum_linear_tolerance
SharedPtr< QoIOutput > qoi_output
virtual void initialize(const GetPot &input, SharedPtr< libMesh::EquationSystems > equation_system, GRINS::MultiphysicsSystem *system)
double _absolute_step_tolerance
GRINS::MultiphysicsSystem * system
void print_scalar_vars(SolverContext &context)
Interface with libMesh for solving Multiphysics problems.
bool _continue_after_max_iterations
Simple class to hold objects passed to Solver::solve.
void print_qoi(SolverContext &context)
unsigned int _max_nonlinear_iterations
bool _require_residual_reduction
double _initial_linear_tolerance