Flow123d  jenkins-Flow123d-windows32-release-multijob-51
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_sides_scalar();
109  /**
110  * \brief Calculate nodes scalar,
111  * store it in double* node_scalars instead of node->scalar
112  * */
113  void make_node_scalar_param();
114  void make_node_scalar();
115  void make_corner_scalar(vector<double> &node_scalar);
116  void make_neighbour_flux();
118 
119  /**
120  * Temporary hack.
121  * Calculate approximation of L2 norm for:
122  * 1) difference between regularized pressure and analytical solution (using FunctionPython)
123  * 2) difference between RT velocities and analytical solution
124  * 3) difference of divergence
125  *
126  * TODO:
127  * 1) implement field objects
128  * 2) implement DG_P2 finite elements
129  * 3) implement pressure postprocessing (result is DG_P2 field)
130  * 4) implement calculation of L2 norm for two field (compute the norm and values on individual elements as P0 field)
131  */
132  void compute_l2_difference();
133 
134  /**
135  * Calculate and output water balance over material subdomains and boudary fluxes.
136  * Works only for steady flow.
137  *
138  * TODO:
139  * - fix it also for unsteady flow
140  * - create separate class for this caculations and output
141  * - create class for output of tables with support to output into various file formats
142  * like GNUplot of excel/open calc
143  **/
144  void water_balance();
145  double calc_water_balance();
146 
149 
150  /// Accessor to the input record for the DarcyFlow output.
152 
153 
154  /** Pressure head (in [m]) interpolated into nodes. Provides P1 approximation. Indexed by element-node numbering.*/
156  /** Pressure head (in [m]) in barycenters of elements (or equivalently mean pressure over every element). Indexed by element indexes in the mesh.*/
158  /** Piezo-metric head (in [m]) in barycenter of elements (or equivalently mean pressure over every element). Indexed by element indexes in the mesh.*/
160  /// have to copy vector<int> provided by Mesh, in order to use FieldElementwise
161  /// TEMPORARY SOLUTION
163 
164  /** Average flux in barycenter of every element. Indexed as elements in the mesh. */
165  // TODO: Definitely we need more general (templated) implementation of Output that accept arbitrary containers. So
166  // that we can pass there directly vector< arma:: vec3 >
168 
169  // integrals of squared differences on individual elements - error indicators, can be written out into VTK files
171 
180 
182 
184 
185  /// Temporary solution for writing balance into separate file.
187  /// Raw data output file.
189 };
190 
191 
192 #endif /* DARCY_FLOW_MH_OUTPUT_HH_ */
193 
Field< 3, FieldValue< 3 >::VectorFixed > field_ele_flux
vector< double > ele_piezo_head
Class MappingP1 implements the affine transformation of the unit cell onto the actual cell...
Field< 3, FieldValue< 3 >::Scalar > velocity_diff
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:51
DarcyFlowMH_Steady * darcy_flow
Header: The functions for all outputs.
std::vector< double > l2_diff_velocity
static Input::Type::Record input_type
Field< 3, FieldValue< 3 >::Scalar > field_node_pressure
MappingP1< 1, 3 > map1
Class template representing a field with values dependent on: point, element, and region...
Definition: field.hh:48
DarcyFlowMHOutput(DarcyFlowMH_Steady *flow, Input::Record in_rec)
DOFHandlerMultiDim * dh
???
Definition: mesh.h:108
void make_corner_scalar(vector< double > &node_scalar)
double calc_water_balance()
Field< 3, FieldValue< 3 >::Integer > subdomain
std::vector< double > l2_diff_divergence
void make_sides_scalar()
Field< 3, FieldValue< 3 >::Scalar > field_ele_pressure
FE_P_disc< 1, 2, 3 > fe2
void make_neighbour_flux()
MappingP1< 2, 3 > map2
Definitions of basic Lagrangean finite elements with polynomial shape functions.
FILE * raw_output_file
Raw data output file.
Accessor to the data with type Type::Record.
Definition: accessors.hh:308
Provides the numbering of the finite element degrees of freedom on the computational mesh...
Definition: dofhandler.hh:251
FILE * balance_output_file
Temporary solution for writing balance into separate file.
vector< double > ele_pressure
Input::Record in_rec_
Accessor to the input record for the DarcyFlow output.
The class for outputing data during time.
Definition: output_time.hh:37
vector< double > subdomains
static Input::Type::Selection output_selection
MappingP1< 3, 3 > map3
Field< 3, FieldValue< 3 >::Scalar > field_ele_piezo_head
Field< 3, FieldValue< 3 >::Scalar > pressure_diff
Mixed-hybrid of steady Darcy flow with sources and variable density.
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:161
FE_P_disc< 1, 1, 3 > fe1
vector< double > ele_flux
void make_node_scalar_param()
Calculate nodes scalar, store it in double* node_scalars instead of node->scalar. ...
Template for classes storing finite set of named values.
std::vector< double > l2_diff_pressure
void output()
Calculate values for output.