GRINS-0.8.0
List of all members | Public Member Functions
GRINS::SteadyVisualization Class Reference

#include <steady_visualization.h>

Inheritance diagram for GRINS::SteadyVisualization:
Inheritance graph
[legend]
Collaboration diagram for GRINS::SteadyVisualization:
Collaboration graph
[legend]

Public Member Functions

 SteadyVisualization (const GetPot &input, const libMesh::Parallel::Communicator &comm LIBMESH_CAN_DEFAULT_TO_COMMWORLD)
 
 ~SteadyVisualization ()
 
virtual void output_residual (SharedPtr< libMesh::EquationSystems > equation_system, GRINS::MultiphysicsSystem *system, const unsigned int time_step, const libMesh::Real time)
 
virtual void output_residual_sensitivities (SharedPtr< libMesh::EquationSystems > equation_system, GRINS::MultiphysicsSystem *system, const libMesh::ParameterVector &params, const unsigned int time_step, const libMesh::Real time)
 
virtual void output_adjoint (SharedPtr< libMesh::EquationSystems > equation_system, GRINS::MultiphysicsSystem *system, const unsigned int time_step, const libMesh::Real time)
 
virtual void output_solution_sensitivities (SharedPtr< libMesh::EquationSystems > equation_system, GRINS::MultiphysicsSystem *system, const libMesh::ParameterVector &params, const unsigned int time_step, const libMesh::Real time)
 
- Public Member Functions inherited from GRINS::Visualization
 Visualization (const GetPot &input, const libMesh::Parallel::Communicator &comm LIBMESH_CAN_DEFAULT_TO_COMMWORLD)
 
virtual ~Visualization ()
 
void output (SharedPtr< libMesh::EquationSystems > equation_system)
 
void output (SharedPtr< libMesh::EquationSystems > equation_system, const unsigned int time_step, const libMesh::Real time)
 
void output_residual (SharedPtr< libMesh::EquationSystems > equation_system, GRINS::MultiphysicsSystem *system)
 
void output_residual_sensitivities (SharedPtr< libMesh::EquationSystems > equation_system, GRINS::MultiphysicsSystem *system, const libMesh::ParameterVector &params)
 
void output_adjoint (SharedPtr< libMesh::EquationSystems > equation_system, GRINS::MultiphysicsSystem *system)
 
void output_solution_sensitivities (SharedPtr< libMesh::EquationSystems > equation_system, GRINS::MultiphysicsSystem *system, const libMesh::ParameterVector &params)
 
void dump_visualization (SharedPtr< libMesh::EquationSystems > equation_system, const std::string &filename_prefix, const libMesh::Real time)
 

Additional Inherited Members

- Protected Attributes inherited from GRINS::Visualization
std::string _vis_output_file_prefix
 
std::vector< std::string > _output_format
 

Detailed Description

Definition at line 33 of file steady_visualization.h.

Constructor & Destructor Documentation

GRINS::SteadyVisualization::SteadyVisualization ( const GetPot &  input,
const libMesh::Parallel::Communicator &comm  LIBMESH_CAN_DEFAULT_TO_COMMWORLD 
)

Definition at line 41 of file steady_visualization.C.

43  : Visualization(input, comm)
44  {
45  return;
46  }
Visualization(const GetPot &input, const libMesh::Parallel::Communicator &comm LIBMESH_CAN_DEFAULT_TO_COMMWORLD)
Definition: visualization.C:50
GRINS::SteadyVisualization::~SteadyVisualization ( )

Definition at line 48 of file steady_visualization.C.

49  {
50  return;
51  }

Member Function Documentation

void GRINS::SteadyVisualization::output_adjoint ( SharedPtr< libMesh::EquationSystems >  equation_system,
GRINS::MultiphysicsSystem system,
const unsigned int  time_step,
const libMesh::Real  time 
)
virtual

Implements GRINS::Visualization.

Definition at line 104 of file steady_visualization.C.

References GRINS::Visualization::_vis_output_file_prefix, GRINS::Visualization::dump_visualization(), GRINS::CompositeQoI::get_qoi(), GRINS::CompositeQoI::n_qois(), and GRINS::QoIBase::name().

108  {
109  const libMesh::DifferentiableQoI* raw_qoi = system->get_qoi();
110  const CompositeQoI* qoi = dynamic_cast<const CompositeQoI*>( raw_qoi );
111 
112  unsigned int n_qois = qoi->n_qois();
113 
114  for( unsigned int q = 0; q < n_qois; q++ )
115  {
116  libMesh::NumericVector<libMesh::Number>& dual_solution = system->get_adjoint_solution(q);
117 
118  const std::string& qoi_name = qoi->get_qoi(q).name();
119  std::string filename = this->_vis_output_file_prefix+"_adjoint_"+qoi_name;
120 
121  system->solution->swap( dual_solution );
122  equation_system->update();
123 
124  this->dump_visualization( equation_system, filename, 0.0 );
125 
126  // Now swap back and reupdate
127  system->solution->swap( dual_solution );
128  equation_system->update();
129  }
130  }
void dump_visualization(SharedPtr< libMesh::EquationSystems > equation_system, const std::string &filename_prefix, const libMesh::Real time)
std::string _vis_output_file_prefix
void GRINS::SteadyVisualization::output_residual ( SharedPtr< libMesh::EquationSystems >  equation_system,
GRINS::MultiphysicsSystem system,
const unsigned int  time_step,
const libMesh::Real  time 
)
virtual

Implements GRINS::Visualization.

Definition at line 53 of file steady_visualization.C.

References GRINS::Visualization::_vis_output_file_prefix, and GRINS::Visualization::dump_visualization().

57  {
58  std::string filename = this->_vis_output_file_prefix+"_residual";
59 
60  // Idea is that this->rhs stashes the residual. Thus, when we swap
61  // with the solution, we should be dumping the residual. Then, we swap
62  // back once we're done outputting.
63 
64  // Swap solution with computed residual
65  system->solution->swap( *(system->rhs) );
66  equation_system->update();
67 
68  this->dump_visualization( equation_system, filename, 0.0 );
69 
70  // Now swap back and reupdate
71  system->solution->swap( *(system->rhs) );
72  equation_system->update();
73 
74  return;
75  }
void dump_visualization(SharedPtr< libMesh::EquationSystems > equation_system, const std::string &filename_prefix, const libMesh::Real time)
std::string _vis_output_file_prefix
void GRINS::SteadyVisualization::output_residual_sensitivities ( SharedPtr< libMesh::EquationSystems >  equation_system,
GRINS::MultiphysicsSystem system,
const libMesh::ParameterVector &  params,
const unsigned int  time_step,
const libMesh::Real  time 
)
virtual

Implements GRINS::Visualization.

Definition at line 78 of file steady_visualization.C.

83  {
84  for (unsigned int p=0; p != params.size(); ++p)
85  {
86  std::stringstream pstr;
87  pstr << p;
88 
89  std::string filename =
90  this->_vis_output_file_prefix+"_dRdp"+pstr.str();
91 
92  // Swap solution with precomputed sensitivity rhs
93  system->solution->swap(system->get_sensitivity_rhs(p));
94  equation_system->update();
95 
96  this->dump_visualization( equation_system, filename, 0.0 );
97 
98  // Now swap back and reupdate
99  system->solution->swap(system->get_sensitivity_rhs(p));
100  equation_system->update();
101  }
102  }
void dump_visualization(SharedPtr< libMesh::EquationSystems > equation_system, const std::string &filename_prefix, const libMesh::Real time)
std::string _vis_output_file_prefix
void GRINS::SteadyVisualization::output_solution_sensitivities ( SharedPtr< libMesh::EquationSystems >  equation_system,
GRINS::MultiphysicsSystem system,
const libMesh::ParameterVector &  params,
const unsigned int  time_step,
const libMesh::Real  time 
)
virtual

Implements GRINS::Visualization.

Definition at line 133 of file steady_visualization.C.

138  {
139  for (unsigned int p=0; p != params.size(); ++p)
140  {
141  std::stringstream pstr;
142  pstr << p;
143 
144  std::string filename =
145  this->_vis_output_file_prefix+"_dudp"+pstr.str();
146 
147  // Swap solution with precomputed sensitivity solution
148  system->solution->swap(system->get_sensitivity_solution(p));
149  equation_system->update();
150 
151  this->dump_visualization( equation_system, filename, 0.0 );
152 
153  // Now swap back and reupdate
154  system->solution->swap(system->get_sensitivity_solution(p));
155  equation_system->update();
156  }
157  }
void dump_visualization(SharedPtr< libMesh::EquationSystems > equation_system, const std::string &filename_prefix, const libMesh::Real time)
std::string _vis_output_file_prefix

The documentation for this class was generated from the following files:

Generated on Tue Dec 19 2017 12:47:32 for GRINS-0.8.0 by  doxygen 1.8.9.1