Flow123d
darcy_flow_mh_output.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2007 Technical University of Liberec. All rights reserved.
4  *
5  * Please make a following refer to Flow123d on your project site if you use the program for any purpose,
6  * especially for academic research:
7  * Flow123d, Research Centre: Advanced Remedial Technologies, Technical University of Liberec, Czech Republic
8  *
9  * This program is free software; you can redistribute it and/or modify it under the terms
10  * of the GNU General Public License version 3 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along with this program; if not,
17  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 021110-1307, USA.
18  *
19  *
20  * $Id: darcy_flow_mh.hh 877 2011-02-04 13:13:25Z jakub.sistek $
21  * $Revision: 877 $
22  * $LastChangedBy: jakub.sistek $
23  * $LastChangedDate: 2011-02-04 14:13:25 +0100 (Fri, 04 Feb 2011) $
24  *
25  * @file
26  * @brief Output class for darcy_flow_mh model.
27  *
28  * @author Jan Brezina
29  *
30  */
31 
32 #ifndef DARCY_FLOW_MH_OUTPUT_HH_
33 #define DARCY_FLOW_MH_OUTPUT_HH_
34 
35 #include "mesh/mesh.h"
36 #include <string>
37 #include <vector>
38 #include "io/output.h"
39 
40 #include "input/input_type.hh"
41 #include "input/accessors.hh"
42 
43 #include "fem/mapping_p1.hh"
44 #include "fem/fe_p.hh"
45 
46 
47 class DarcyFlowMH_Steady;
48 class OutputTime;
49 class DOFHandlerMultiDim;
50 
51 
52 /**
53  * Actually this class only collect former code from postprocess.*
54  * This code depends on values stored in mesh and has to be changed to use fields or other data provided by
55  * interface to darcy_flow. We have to relay on the interface in order to allow different implementation of darcy_flow.
56  *
57  * Principal functionalities of current postprocess are:
58  * - move computed values into mesh - this can be removed after we get new output classes,
59  * other dependent code can use directly field interface
60  * - compute interpolation to nodes - this can be external and operate directly on fields
61  * - compute water balances over materials and boundary parts - is feasible through field interface
62  *
63  * Further functionality of this class should be:
64  * - prepare data for general output classes
65  *
66  */
68 public:
69 
70  class OutputFields : public FieldSet {
71  public:
72 
73  OutputFields();
74 
80 
84 
85  // List fields, we have initialized for output
86  // In case of error fields, we have to add them to the main field set
87  // but perform output only if user set compute_errors flag.
89 
91  };
92 
95 
97 
98 
99  /** \brief Calculate values for output. **/
100  void output();
101 
102 
103 private:
104  void make_side_flux();
105  void make_element_scalar();
106  void make_element_vector();
107 
108  //void make_element_vector_line(ElementFullIter, arma::vec3 &vec);
109  //void make_element_vector_triangle(ElementFullIter, arma::vec3 &vec);
110  //void make_element_vector_tetrahedron(ElementFullIter, arma::vec3 &vec);
111 
112  void make_sides_scalar();
113  /**
114  * \brief Calculate nodes scalar,
115  * store it in double* node_scalars instead of node->scalar
116  * */
117  void make_node_scalar_param();
118  void make_node_scalar();
119  void make_corner_scalar(vector<double> &node_scalar);
120  void make_neighbour_flux();
121  //void make_previous_scalar();
123 
124  /**
125  * Temporary hack.
126  * Calculate approximation of L2 norm for:
127  * 1) difference between regularized pressure and analytical solution (using FunctionPython)
128  * 2) difference between RT velocities and analytical solution
129  * 3) difference of divergence
130  *
131  * TODO:
132  * 1) implement field objects
133  * 2) implement DG_P2 finite elements
134  * 3) implement pressure postprocessing (result is DG_P2 field)
135  * 4) implement calculation of L2 norm for two field (compute the norm and values on individual elements as P0 field)
136  */
137  void compute_l2_difference();
138 
139  /**
140  * Calculate and output water balance over material subdomains and boudary fluxes.
141  * Works only for steady flow.
142  *
143  * TODO:
144  * - fix it also for unsteady flow
145  * - create separate class for this caculations and output
146  * - create class for output of tables with support to output into various file formats
147  * like GNUplot of excel/open calc
148  **/
149  void water_balance();
150  double calc_water_balance();
151 
154 
155  //TimeMark::Type output_mark_type;
156 
157  /// Accessor to the input record for the DarcyFlow output.
159 
160 
161  /** This we need to allow piezo output and nead not to modify all test outputs. It should be replaced by
162  * more general scheme, where you can switch every output field on or off.
163  */
164  //bool output_piezo_head;
165 
166  /** Pressure head (in [m]) interpolated into nodes. Provides P1 approximation. Indexed by node indexes in mesh.*/
167  //vector<double> node_pressure;
168  /** Pressure head (in [m]) interpolated into nodes. Provides P1 approximation. Indexed by element-node numbering.*/
170  /** Pressure head (in [m]) in barycenters of elements (or equivalently mean pressure over every element). Indexed by element indexes in the mesh.*/
172  /** Piezo-metric head (in [m]) in barycenter of elements (or equivalently mean pressure over every element). Indexed by element indexes in the mesh.*/
174  /// have to copy vector<int> provided by Mesh, in order to use FieldElementwise
175  /// TEMPORARY SOLUTION
177 
178  /** Average flux in barycenter of every element. Indexed as elements in the mesh. */
179  // TODO: Definitely we need more general (templated) implementation of Output that accept arbitrary containers. So
180  // that we can pass there directly vector< arma:: vec3 >
182 
183  // integrals of squared differences on individual elements - error indicators, can be written out into VTK files
185 
194 
196 
198 
199  /// Temporary solution for writing balance into separate file.
201  /// Raw data output file.
203 };
204 
205 
206 #endif /* DARCY_FLOW_MH_OUTPUT_HH_ */
207