OpenFCST: The open-source Fuel Cell Simulation Toolbox
|
This class is initialized with an application that describes the linearization of the problem that we would like to solve and the nonlinear solver that drives the process (usually a Newton loop). More...
#include <adaptive_refinement.h>
Public Member Functions | |
AdaptiveRefinement (FuelCell::ApplicationCore::ApplicationBase &application) | |
Constructor. More... | |
AdaptiveRefinement (FuelCell::ApplicationCore::OptimizationBlockMatrixApplication< dim > &app_lin, FuelCell::ApplicationCore::ApplicationWrapper &app, const FuelCell::ApplicationCore::FEVector &solution=FuelCell::ApplicationCore::FEVector()) | |
Constructor. More... | |
~AdaptiveRefinement () | |
void | declare_parameters (ParameterHandler ¶m) const |
Declare all parameters that are needed for: More... | |
void | initialize (ParameterHandler ¶m) |
Set up how many equations are needed and read in parameters for the parameter handler in order to initialize data. More... | |
void | test_derivatives (const std::string input_file, const std::string dvar, const double value, std::vector< double > &resp, std::vector< std::vector< double > > &dresp, const bool gradient=true) |
Member function used to test the derivatives. More... | |
void | print_parameters () const |
Print parameters: More... | |
const FuelCell::ApplicationCore::FEVector & | get_solution () const |
This function returns solution . More... | |
const FuelCell::ApplicationCore::FEVector & | get_coarse_solution () const |
This function returns coarse_solution . More... | |
const Triangulation< dim > & | get_coarse_triangulation () const |
This function returns coarse_triangulation . More... | |
Solving functions | |
void | solve (const std::string param_file, ParameterHandler ¶m, bool solution_component_changes_between_data_files=false) |
Solve the nonlinear problem. More... | |
void | run_app (bool solution_component_changes_between_data_files=false) |
Run application. More... | |
void | run_app (std::vector< double > &resp, bool solution_component_changes_between_data_files=false) |
Run application. More... | |
void | run_app (std::vector< double > &resp, std::vector< std::vector< double > > &dresp_dl, bool solution_component_changes_between_data_files=false) |
Run application. More... | |
Public Member Functions inherited from FuelCell::ApplicationCore::ApplicationWrapper | |
ApplicationWrapper (ApplicationBase &app) | |
Constructor for a derived application. More... | |
~ApplicationWrapper () | |
Destructor. More... | |
virtual void | declare_parameters (ParameterHandler ¶m) |
Declare parameters for a parameter file. More... | |
virtual void | remesh () |
Generate the next mesh depending on the mesh generation parameters. More... | |
virtual void | init_vector (FEVector &dst) const |
Initialize vector to problem size. More... | |
virtual double | residual (FEVector &dst, const FEVectors &src, bool apply_boundaries=true) |
Compute residual of src and store it into dst . More... | |
virtual void | solve (FEVector &dst, const FEVectors &src) |
Solve the system assembled with right hand side in FEVectors src and return the result in FEVector dst . More... | |
virtual void | Tsolve (FEVector &dst, const FEVectors &src) |
Solve the dual system assembled with right hand side rhs and return the result in start . More... | |
virtual double | estimate (const FEVectors &src) |
Estimate cell-wise errors. More... | |
virtual double | evaluate (const FEVectors &src) |
Evaluate a functional. More... | |
virtual void | grid_out (const std::string &filename) const |
virtual void | data_out (const std::string &filename, const FEVectors &src) |
Write data in the format specified by the ParameterHandler. More... | |
virtual std::string | id () const |
Return a unique identification string for this application. More... | |
virtual void | notify (const Event &reason) |
Add a reason for assembling. More... | |
Public Member Functions inherited from FuelCell::ApplicationCore::ApplicationBase | |
ApplicationBase (boost::shared_ptr< ApplicationData > data=boost::shared_ptr< ApplicationData >()) | |
Constructor for an application. More... | |
ApplicationBase (const ApplicationBase &other) | |
Copy constructor. More... | |
virtual | ~ApplicationBase () |
Virtual destructor. More... | |
void | print_parameters_to_file (ParameterHandler ¶m, const std::string &file_name, const ParameterHandler::OutputStyle &style) |
Print default parameters for the application to a file. More... | |
virtual void | start_vector (FEVector &dst, std::string) const |
Initialize vector to problem size. More... | |
virtual void | grid_out (const std::string &) |
Write the mesh in the format specified by the ParameterHandler. More... | |
boost::shared_ptr < ApplicationData > | get_data () |
Get access to the protected variable data. More... | |
const boost::shared_ptr < ApplicationData > | get_data () const |
Get read-only access to the protected variable data. More... | |
virtual void | clear () |
All true in notifications . More... | |
virtual void | clear_events () |
All false in notifications . More... | |
virtual unsigned int | get_solution_index () |
Returns solution index. More... | |
Private Member Functions | |
void | print_convergence_table () |
Private Attributes | |
std::string | filename_initial_mesh |
Filename where to output the initial grid. More... | |
bool | output_initial_mesh |
Flag to specify if the initial grid should be saved to a file. More... | |
bool | output_intermediate_sol |
Boolean flag that is set to true if intermediate solutions, i.e. More... | |
bool | output_final_sol |
Boolean flag used to specify if the final solution should be output to a file. More... | |
std::string | filename_final_sol |
Filename where the final solution will be output. More... | |
bool | output_intermediate_resp |
Bool flag used to specify if all responses/functionals should be evaluated at intermediate refinement levels. More... | |
bool | L1_L2_error_and_convergence_rate |
Use true if you have the exact or analytical solution to compare your numerical results with. More... | |
bool | nonlinear_solver_for_linear_problem |
Use true along with zero initial guess defined in your application to solve a linear problem by means of using any of the FCST nonlinear solvers. More... | |
unsigned int | n_ref |
Number of initial refinements for the original mesh. More... | |
bool | gradients |
Compute the gradients? More... | |
Triangulation< dim > | coarse_triangulation |
Initial mesh. More... | |
FuelCell::ApplicationCore::OptimizationBlockMatrixApplication < dim > * | app_linear |
Pointer to linear application. More... | |
FuelCell::ApplicationCore::ApplicationWrapper * | app |
Poiner to nonlinear application. More... | |
FuelCell::ApplicationCore::FEVector | solution |
Global FE solution at the support points of the most refined mesh. More... | |
FuelCell::ApplicationCore::FEVector | coarse_solution |
Global FE solution at the support points of the initial mesh. More... | |
std::vector< ConvergenceTable > | convergence_tables |
If the exact or analytical solution is available, then those convergence tables collect all necessary information on L1 and L2 norms of the error and convergence rates for each particular component of the numerical solution. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from FuelCell::ApplicationCore::ApplicationWrapper | |
SmartPointer< ApplicationBase > | get_wrapped_application () |
Gain access to the inner application. More... | |
Protected Member Functions inherited from FuelCell::ApplicationCore::ApplicationBase | |
void | print_caller_name (const std::string &caller_name) const |
Print caller name. More... | |
Protected Attributes inherited from FuelCell::ApplicationCore::ApplicationWrapper | |
SmartPointer< ApplicationBase > | app |
Pointer to the application this one depends upon. More... | |
Protected Attributes inherited from FuelCell::ApplicationCore::ApplicationBase | |
boost::shared_ptr < ApplicationData > | data |
Object for auxiliary data. More... | |
Event | notifications |
Accumulate reasons for assembling here. More... | |
This class is initialized with an application that describes the linearization of the problem that we would like to solve and the nonlinear solver that drives the process (usually a Newton loop).
Then, this class implements the adaptive refinement loop for the application.
and the concept of sequential applications, simplified parameter study without Dakota, and convergence tables by
|
inline |
Constructor.
References FuelCell::ApplicationCore::AdaptiveRefinement< dim >::solution.
Constructor.
FuelCell::ApplicationCore::AdaptiveRefinement< dim >::~AdaptiveRefinement | ( | ) |
void FuelCell::ApplicationCore::AdaptiveRefinement< dim >::declare_parameters | ( | ParameterHandler & | param | ) | const |
Declare all parameters that are needed for:
- control of adaptive refinement loop - control of output options during the loop, e.g. return the solution at each cycle
Currently the options implemented are:
|
inline |
This function returns coarse_solution
.
References FuelCell::ApplicationCore::AdaptiveRefinement< dim >::coarse_solution.
|
inline |
This function returns coarse_triangulation
.
References FuelCell::ApplicationCore::AdaptiveRefinement< dim >::coarse_triangulation.
|
inline |
This function returns solution
.
References FuelCell::ApplicationCore::AdaptiveRefinement< dim >::solution.
|
virtual |
Set up how many equations are needed and read in parameters for the parameter handler in order to initialize data.
Reimplemented from FuelCell::ApplicationCore::ApplicationWrapper.
|
private |
void FuelCell::ApplicationCore::AdaptiveRefinement< dim >::print_parameters | ( | ) | const |
Print parameters:
void FuelCell::ApplicationCore::AdaptiveRefinement< dim >::run_app | ( | bool | solution_component_changes_between_data_files = false | ) |
Run application.
void FuelCell::ApplicationCore::AdaptiveRefinement< dim >::run_app | ( | std::vector< double > & | resp, |
bool | solution_component_changes_between_data_files = false |
||
) |
Run application.
void FuelCell::ApplicationCore::AdaptiveRefinement< dim >::run_app | ( | std::vector< double > & | resp, |
std::vector< std::vector< double > > & | dresp_dl, | ||
bool | solution_component_changes_between_data_files = false |
||
) |
Run application.
void FuelCell::ApplicationCore::AdaptiveRefinement< dim >::solve | ( | const std::string | param_file, |
ParameterHandler & | param, | ||
bool | solution_component_changes_between_data_files = false |
||
) |
Solve the nonlinear problem.
void FuelCell::ApplicationCore::AdaptiveRefinement< dim >::test_derivatives | ( | const std::string | input_file, |
const std::string | dvar, | ||
const double | value, | ||
std::vector< double > & | resp, | ||
std::vector< std::vector< double > > & | dresp, | ||
const bool | gradient = true |
||
) |
Member function used to test the derivatives.
|
private |
Poiner to nonlinear application.
|
private |
Pointer to linear application.
|
private |
Global FE solution at the support points of the initial mesh.
Referenced by FuelCell::ApplicationCore::AdaptiveRefinement< dim >::get_coarse_solution().
|
private |
Initial mesh.
Referenced by FuelCell::ApplicationCore::AdaptiveRefinement< dim >::get_coarse_triangulation().
|
private |
If the exact or analytical solution is available, then those convergence tables collect all necessary information on L1 and L2 norms of the error and convergence rates for each particular component of the numerical solution.
|
private |
Filename where the final solution will be output.
The final format of the solution will be as follows: filename_final_sol+"_Cycle_" + grid_streamOut.str() + "_Sol_" + sol_streamOut.str(); where Cycle refers to the adaptive refinement cycle and Sol refers to the point in the polarization curve.
|
private |
Filename where to output the initial grid.
|
private |
Compute the gradients?
|
private |
Use true
if you have the exact or analytical solution to compare your numerical results with.
|
private |
Number of initial refinements for the original mesh.
|
private |
Use true
along with zero initial guess defined in your application to solve a linear problem by means of using any of the FCST nonlinear solvers.
|
private |
Boolean flag used to specify if the final solution should be output to a file.
This flag is set via the input file using:
|
private |
Flag to specify if the initial grid should be saved to a file.
This flag is initialized via the input file using:
|
private |
Bool flag used to specify if all responses/functionals should be evaluated at intermediate refinement levels.
This is useful when trying to estimate if the solution is grid independent as eventually the functionals and solution should become independent of refinement level.
This flag is set via the input file using:
|
private |
Boolean flag that is set to true if intermediate solutions, i.e.
solutions at intermediate adaptive refinement levels should be saved to file. This flag is set via input file with:
|
private |
Global FE solution at the support points of the most refined mesh.
Referenced by FuelCell::ApplicationCore::AdaptiveRefinement< dim >::AdaptiveRefinement(), and FuelCell::ApplicationCore::AdaptiveRefinement< dim >::get_solution().