Flow123d  master-f44eb46
darcy_flow_mh_output.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file darcy_flow_mh_output.hh
15  * @brief Output class for darcy_flow_mh model.
16  * @author Jan Brezina
17  */
18 
19 #ifndef DARCY_FLOW_MH_OUTPUT_HH_
20 #define DARCY_FLOW_MH_OUTPUT_HH_
21 
22 #include <stdio.h> // for sprintf
23 #include <string.h> // for memcpy
24 
25 #include <cmath> // for pow
26 #include <iosfwd> // for ofstream
27 #include <memory> // for shared_ptr
28 #include <vector> // for vector
29 #include <armadillo>
30 #include "fields/equation_output.hh" // for EquationOutput
31 #include "fields/field.hh" // for Field
32 #include "fields/field_set.hh" // for FieldSet
33 #include "fields/field_values.hh" // for FieldValue<>::Scalar, FieldV...
34 #include "fields/field_python.hh"
35 #include "la/vector_mpi.hh" // for VectorMPI
36 #include "input/type_base.hh" // for Array
37 #include "input/type_generic.hh" // for Instance
38 #include "petscvec.h" // for Vec, _p_Vec
39 #include "system/exceptions.hh" // for ExcAssertMsg::~ExcAssertMsg
40 
41 class DOFHandlerMultiDim;
42 class DarcyLMH;
43 class Mesh;
44 class OutputTime;
45 namespace Input {
46  class Record;
47  namespace Type {
48  class Record;
49  }
50 }
51 
52 template<unsigned int spacedim> class FEValues;
53 template <int spacedim, class Value> class FieldFE;
54 template<unsigned int dim> class L2DifferenceAssembly;
55 template<unsigned int dim> class OutputInternalFlowAssembly;
56 template< template<IntDim...> class DimAssembly> class GenericAssembly;
57 
58 /**
59  * Actually this class only collect former code from postprocess.*
60  * This code depends on values stored in mesh and has to be changed to use fields or other data provided by
61  * interface to darcy_flow. We have to relay on the interface in order to allow different implementation of darcy_flow.
62  *
63  * Principal functionalities of current postprocess are:
64  * - move computed values into mesh - this can be removed after we get new output classes,
65  * other dependent code can use directly field interface
66  * - compute interpolation to nodes - this can be external and operate directly on fields
67  * - compute water balances over materials and boundary parts - is feasible through field interface
68  *
69  * Further functionality of this class should be:
70  * - prepare data for general output classes
71  *
72  */
74 public:
75 
76  /// Standard quantities for output in DarcyFlowMH.
77  class OutputFields : public EquationOutput {
78  public:
79 
80  OutputFields();
81 
84  };
85 
86  /// Specific quantities for output in DarcyFlowMH - error estimates etc.
88  public:
90 
94  };
95 
96  /// Output specific field stuff
97  class DiffEqData {
98  public:
100 
103 
104  // Temporary objects holding pointers to appropriate FieldFE
105  // TODO remove after final fix of equations
106  std::shared_ptr<FieldFE<3, FieldValue<3>::Scalar>> pressure_diff_ptr;
107  std::shared_ptr<FieldFE<3, FieldValue<3>::Scalar>> vel_diff_ptr;
108  std::shared_ptr<FieldFE<3, FieldValue<3>::Scalar>> div_diff_ptr;
109 
110  std::shared_ptr<SubDOFHandlerMultiDim> dh_;
111 
113  std::shared_ptr<DarcyLMH::EqData> flow_data_;
114  };
115 
117  public:
119 
120  ofstream raw_output_file; ///< Raw data output file.
121  std::vector< std::string > raw_output_strings_; ///< Output lines of cells.
122  TimeGovernor *time_; ///< Time is shared with flow equation.
123 
124  std::shared_ptr<DarcyLMH::EqData> flow_data_;
125  };
126 
128  virtual ~DarcyFlowMHOutput();
129 
130  static const Input::Type::Instance & get_input_type(FieldSet& eq_data, const std::string &equation_name);
132 
133  /** \brief Calculate values for output. **/
134  void output();
135 
136  //const OutputFields &get_output_fields() { return output_fields; }
137 
138 
139 
140 protected:
142 
143  virtual void prepare_output(Input::Record in_rec);
146 
147  template <class FieldType>
148  void set_ref_solution(const Input::Record &rec, Field<3, FieldType> &output_field, std::vector<std::string> reg);
149 
150 
153 
154  /// Specific experimental error computing.
156 
157 
158  /** Pressure head (in [m]) interpolated into nodes. Provides P1 approximation. Indexed by element-node numbering.*/
160  /** Pressure head (in [m]) in barycenters of elements (or equivalently mean pressure over every element). Indexed by element indexes in the mesh.*/
162  /** Piezo-metric head (in [m]) in barycenter of elements (or equivalently mean pressure over every element). Indexed by element indexes in the mesh.*/
164 
165  // integrals of squared differences on individual elements - error indicators, can be written out into VTK files
167 
168  std::shared_ptr<DOFHandlerMultiDim> dh_;
169  std::shared_ptr<DiscreteSpace> ds;
170 
173 
174  std::shared_ptr<OutputTime> output_stream;
175 
176  /// Output specific field stuff
178  std::shared_ptr<DarcyLMH::EqFields> flow_eq_fields_;
179  std::shared_ptr<DiffEqData> diff_eq_data_;
180  std::shared_ptr<RawOutputEqData> raw_eq_data_;
181 
182  //MixedPtr<FE_P_disc> fe_p0;
183 
184  /// general assembly objects, hold assembly objects of appropriate dimension
187 
188 };
189 
190 
191 #endif /* DARCY_FLOW_MH_OUTPUT_HH_ */
192 
Provides the numbering of the finite element degrees of freedom on the computational mesh.
Definition: dofhandler.hh:151
Output specific field stuff.
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > div_diff_ptr
std::shared_ptr< SubDOFHandlerMultiDim > dh_
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > vel_diff_ptr
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > pressure_diff_ptr
std::shared_ptr< DarcyLMH::EqData > flow_data_
Standard quantities for output in DarcyFlowMH.
Field< 3, FieldValue< 3 >::Scalar > subdomain
Field< 3, FieldValue< 3 >::Scalar > region_id
Specific quantities for output in DarcyFlowMH - error estimates etc.
Field< 3, FieldValue< 3 >::Scalar > velocity_diff
Field< 3, FieldValue< 3 >::Scalar > div_diff
Field< 3, FieldValue< 3 >::Scalar > pressure_diff
std::shared_ptr< DarcyLMH::EqData > flow_data_
ofstream raw_output_file
Raw data output file.
TimeGovernor * time_
Time is shared with flow equation.
std::vector< std::string > raw_output_strings_
Output lines of cells.
static const Input::Type::Instance & get_input_type_specific()
std::shared_ptr< DOFHandlerMultiDim > dh_
std::shared_ptr< DiffEqData > diff_eq_data_
std::vector< double > l2_diff_divergence
DarcyFlowMHOutput(DarcyLMH *flow, Input::Record in_rec)
GenericAssembly< L2DifferenceAssembly > * l2_difference_assembly_
general assembly objects, hold assembly objects of appropriate dimension
void output()
Calculate values for output.
virtual void prepare_output(Input::Record in_rec)
std::shared_ptr< DarcyLMH::EqFields > flow_eq_fields_
void set_ref_solution(const Input::Record &rec, Field< 3, FieldType > &output_field, std::vector< std::string > reg)
const vector< unsigned int > & ElementSetRef
OutputSpecificFields output_specific_fields
bool is_output_specific_fields
Output specific field stuff.
std::shared_ptr< DiscreteSpace > ds
std::shared_ptr< RawOutputEqData > raw_eq_data_
static const Input::Type::Instance & get_input_type(FieldSet &eq_data, const std::string &equation_name)
std::vector< double > l2_diff_pressure
std::vector< double > l2_diff_velocity
void prepare_specific_output(Input::Record in_rec)
bool compute_errors_
Specific experimental error computing.
std::shared_ptr< OutputTime > output_stream
GenericAssembly< OutputInternalFlowAssembly > * output_internal_assembly_
Mixed-hybrid model of linear Darcy flow, possibly unsteady.
Calculates finite element data on the actual cell.
Definition: fe_values.hh:67
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:159
Class template representing a field with values dependent on: point, element, and region.
Definition: field.hh:92
Generic class of assemblation.
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
Helper class that stores data of generic types.
Definition: type_generic.hh:89
Definition: mesh.h:362
The class for outputting data during time.
Definition: output_time.hh:51
Basic time management functionality for unsteady (and steady) solvers (class Equation).
unsigned int IntDim
A dimension index type.
Definition: mixed.hh:19
Abstract linear system class.
Definition: balance.hh:40