Flow123d  jenkins-Flow123d-linux-release-multijob-282
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 
39 #include "io/output_time.hh"
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 #include "fields/vec_seq_double.hh"
47 
48 
49 class DarcyFlowMH_Steady;
50 class OutputTime;
51 class DOFHandlerMultiDim;
52 
53 
54 /**
55  * Actually this class only collect former code from postprocess.*
56  * This code depends on values stored in mesh and has to be changed to use fields or other data provided by
57  * interface to darcy_flow. We have to relay on the interface in order to allow different implementation of darcy_flow.
58  *
59  * Principal functionalities of current postprocess are:
60  * - move computed values into mesh - this can be removed after we get new output classes,
61  * other dependent code can use directly field interface
62  * - compute interpolation to nodes - this can be external and operate directly on fields
63  * - compute water balances over materials and boundary parts - is feasible through field interface
64  *
65  * Further functionality of this class should be:
66  * - prepare data for general output classes
67  *
68  */
70 public:
71 
72  class OutputFields : public FieldSet {
73  public:
74 
75  OutputFields();
76 
83 
87 
88  // List fields, we have initialized for output
89  // In case of error fields, we have to add them to the main field set
90  // but perform output only if user set compute_errors flag.
92 
94  };
95 
98 
100 
101 
102  /** \brief Calculate values for output. **/
103  void output();
104 
106 
107 
108 private:
109  void make_side_flux();
110  void make_element_scalar();
111  void make_element_vector();
112 
113  void make_sides_scalar();
114  /**
115  * \brief Calculate nodes scalar,
116  * store it in double* node_scalars instead of node->scalar
117  * */
118  void make_node_scalar_param();
119  void make_node_scalar();
120  void make_corner_scalar(vector<double> &node_scalar);
121  void make_neighbour_flux();
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  /// Accessor to the input record for the DarcyFlow output.
157 
158 
159  /** Pressure head (in [m]) interpolated into nodes. Provides P1 approximation. Indexed by element-node numbering.*/
161  /** Pressure head (in [m]) in barycenters of elements (or equivalently mean pressure over every element). Indexed by element indexes in the mesh.*/
163  /** Piezo-metric head (in [m]) in barycenter of elements (or equivalently mean pressure over every element). Indexed by element indexes in the mesh.*/
165 
166  /** Average flux in barycenter of every element. Indexed as elements in the mesh. */
167  // TODO: Definitely we need more general (templated) implementation of Output that accept arbitrary containers. So
168  // that we can pass there directly vector< arma:: vec3 >
170 
171  // integrals of squared differences on individual elements - error indicators, can be written out into VTK files
173 
182 
184 
186 
187  /// Temporary solution for writing balance into separate file.
189  /// Raw data output file.
191 };
192 
193 
194 #endif /* DARCY_FLOW_MH_OUTPUT_HH_ */
195 
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:51
DarcyFlowMH_Steady * darcy_flow
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:52
DarcyFlowMHOutput(DarcyFlowMH_Steady *flow, Input::Record in_rec)
DOFHandlerMultiDim * dh
???
Definition: mesh.h:109
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
VectorSeqDouble ele_piezo_head
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:327
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.
Input::Record in_rec_
Accessor to the input record for the DarcyFlow output.
VectorSeqDouble ele_flux
The class for outputting data during time.
Definition: output_time.hh:32
static Input::Type::Selection output_selection
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
const OutputFields & get_output_fields()
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:169
FE_P_disc< 1, 1, 3 > fe1
void make_node_scalar_param()
Calculate nodes scalar, store it in double* node_scalars instead of node-&gt;scalar. ...
Template for classes storing finite set of named values.
std::vector< double > l2_diff_pressure
void output()
Calculate values for output.