Flow123d  release_2.2.0-19-g1279b7e
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 "mesh/mesh.h"
23 #include <string>
24 #include <vector>
25 
26 #include "io/output_time.hh"
28 #include "input/accessors.hh"
29 
30 #include "fem/mapping_p1.hh"
31 #include "fem/fe_p.hh"
32 
33 #include "fields/vec_seq_double.hh"
35 
36 
37 class DarcyMH;
38 class OutputTime;
39 class DOFHandlerMultiDim;
40 
41 
42 /**
43  * Actually this class only collect former code from postprocess.*
44  * This code depends on values stored in mesh and has to be changed to use fields or other data provided by
45  * interface to darcy_flow. We have to relay on the interface in order to allow different implementation of darcy_flow.
46  *
47  * Principal functionalities of current postprocess are:
48  * - move computed values into mesh - this can be removed after we get new output classes,
49  * other dependent code can use directly field interface
50  * - compute interpolation to nodes - this can be external and operate directly on fields
51  * - compute water balances over materials and boundary parts - is feasible through field interface
52  *
53  * Further functionality of this class should be:
54  * - prepare data for general output classes
55  *
56  */
58 public:
59 
60  class OutputFields : public EquationOutput {
61  public:
62 
63  OutputFields();
64 
71 
75 
77  };
78 
81 
82  static const Input::Type::Instance & get_input_type();
84 
85  /** \brief Calculate values for output. **/
86  void output();
87 
88  //const OutputFields &get_output_fields() { return output_fields; }
89 
90 
91 
92 private:
94 
95  void make_side_flux();
96  void make_element_scalar(ElementSetRef element_indices);
97 
98  /** Computes fluxes at the barycenters of elements.
99  * TODO:
100  * We use FEValues to get fluxes at the barycenters of elements,
101  * but we still use MHDofHandler. Once we are able to make output routines
102  * parallel, we can use simply FieldFE for velocity here.
103  */
104  void make_element_vector(ElementSetRef element_indices);
105 
106  //void make_sides_scalar();
107  /**
108  * \brief Calculate nodes scalar,
109  * store it in double* node_scalars instead of node->scalar
110  * */
111  void make_node_scalar_param(ElementSetRef element_indices);
112  //void make_node_scalar();
113  void make_corner_scalar(vector<double> &node_scalar);
114  //void make_neighbour_flux();
116 
117  /**
118  * Temporary hack.
119  * Calculate approximation of L2 norm for:
120  * 1) difference between regularized pressure and analytical solution (using FunctionPython)
121  * 2) difference between RT velocities and analytical solution
122  * 3) difference of divergence
123  *
124  * TODO:
125  * 1) implement field objects
126  * 2) implement DG_P2 finite elements
127  * 3) implement pressure postprocessing (result is DG_P2 field)
128  * 4) implement calculation of L2 norm for two field (compute the norm and values on individual elements as P0 field)
129  */
130  void compute_l2_difference();
131 
132 
135 
136  /// Specific experimental error computing.
138 
139 
140  /** Pressure head (in [m]) interpolated into nodes. Provides P1 approximation. Indexed by element-node numbering.*/
142  /** Pressure head (in [m]) in barycenters of elements (or equivalently mean pressure over every element). Indexed by element indexes in the mesh.*/
144  /** Piezo-metric head (in [m]) in barycenter of elements (or equivalently mean pressure over every element). Indexed by element indexes in the mesh.*/
146 
147  /** Average flux in barycenter of every element. Indexed as elements in the mesh. */
148  // TODO: Definitely we need more general (templated) implementation of Output that accept arbitrary containers. So
149  // that we can pass there directly vector< arma:: vec3 >
151 
152  // A vector of all element indexes
154 
155  // integrals of squared differences on individual elements - error indicators, can be written out into VTK files
157 
166 
168 
169  std::shared_ptr<OutputTime> output_stream;
170 
171  /// Raw data output file.
172  ofstream raw_output_file;
173 };
174 
175 
176 #endif /* DARCY_FLOW_MH_OUTPUT_HH_ */
177 
Field< 3, FieldValue< 3 >::VectorFixed > field_ele_flux
Class MappingP1 implements the affine transformation of the unit cell onto the actual cell...
Field< 3, FieldValue< 3 >::Scalar > velocity_diff
VectorSeqDouble ele_pressure
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:61
std::vector< double > l2_diff_velocity
Field< 3, FieldValue< 3 >::Scalar > field_node_pressure
MappingP1< 1, 3 > map1
void output(TimeStep step)
Class template representing a field with values dependent on: point, element, and region...
Definition: field.hh:62
void make_element_vector(ElementSetRef element_indices)
DOFHandlerMultiDim * dh
Definition: mesh.h:97
void make_corner_scalar(vector< double > &node_scalar)
Helper class that stores data of generic types.
Definition: type_generic.hh:89
Field< 3, FieldValue< 3 >::Integer > subdomain
std::vector< double > l2_diff_divergence
std::vector< unsigned int > all_element_idx_
std::shared_ptr< OutputTime > output_stream
void make_node_scalar_param(ElementSetRef element_indices)
Calculate nodes scalar, store it in double* node_scalars instead of node->scalar. ...
Field< 3, FieldValue< 3 >::Scalar > field_ele_pressure
FE_P_disc< 1, 2, 3 > fe2
VectorSeqDouble ele_piezo_head
MappingP1< 2, 3 > map2
Definitions of basic Lagrangean finite elements with polynomial shape functions.
Accessor to the data with type Type::Record.
Definition: accessors.hh:292
Provides the numbering of the finite element degrees of freedom on the computational mesh...
Definition: dofhandler.hh:248
VectorSeqDouble ele_flux
ofstream raw_output_file
Raw data output file.
The class for outputting data during time.
Definition: output_time.hh:44
static const Input::Type::Record & get_input_type_specific()
MappingP1< 3, 3 > map3
Field< 3, FieldValue< 3 >::Scalar > field_ele_piezo_head
Field< 3, FieldValue< 3 >::Integer > region_id
Field< 3, FieldValue< 3 >::Scalar > pressure_diff
bool compute_errors_
Specific experimental error computing.
static Input::Type::Record & get_input_type()
Field< 3, FieldValue< 3 >::Scalar > div_diff
FE_P_disc< 1, 3, 3 > fe3
vector< double > corner_pressure
Record type proxy class.
Definition: type_record.hh:182
const vector< unsigned int > & ElementSetRef
DarcyFlowMHOutput(DarcyMH *flow, Input::Record in_rec)
FE_P_disc< 1, 1, 3 > fe1
void make_element_scalar(ElementSetRef element_indices)
std::vector< double > l2_diff_pressure
Mixed-hybrid of steady Darcy flow with sources and variable density.