Flow123d  JS_before_hm-913-g695b665
darcy_flow_mh_output.cc
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.cc
15  * @ingroup flow
16  * @brief Output class for darcy_flow_mh model.
17  * @author Jan Brezina
18  */
19 
20 #include <vector>
21 #include <iostream>
22 #include <sstream>
23 #include <string>
24 
25 #include <system/global_defs.h>
26 
27 #include "flow/darcy_flow_mh.hh"
28 #include "flow/darcy_flow_lmh.hh"
29 #include "flow/assembly_mh.hh"
30 #include "flow/assembly_lmh.hh"
32 
33 #include "io/output_time.hh"
34 #include "io/observe.hh"
35 #include "system/system.hh"
36 #include "system/sys_profiler.hh"
37 #include "system/index_types.hh"
38 
39 #include "fields/field_set.hh"
40 #include "fem/dofhandler.hh"
41 #include "fem/fe_values.hh"
42 #include "fem/fe_rt.hh"
43 #include "fem/fe_values_views.hh"
45 #include "fields/field_fe.hh"
47 #include "fields/generic_field.hh"
48 
49 #include "mesh/mesh.h"
50 #include "mesh/partitioning.hh"
51 #include "mesh/accessors.hh"
52 #include "mesh/node_accessor.hh"
53 #include "mesh/range_wrapper.hh"
54 
55 // #include "coupling/balance.hh"
58 
59 namespace it = Input::Type;
60 
61 
62 const it::Instance & DarcyFlowMHOutput::get_input_type(FieldSet& eq_data, const std::string &equation_name) {
64  output_fields += eq_data;
65  return output_fields.make_output_type(equation_name, "");
66 }
67 
68 
70 
71  static it::Record& rec = it::Record("Output_DarcyMHSpecific", "Specific Darcy flow MH output.")
73  .declare_key("compute_errors", it::Bool(), it::Default("false"),
74  "SPECIAL PURPOSE. Computes error norms of the solution, particulary suited for non-compatible coupling models.")
76  "Output file with raw data from MH module.")
77  .close();
78 
80  return output_fields.make_output_type_from_record(rec,
81  "Flow_Darcy_MH_specific",
82  "");
83 }
84 
85 
88 {
89 
90 // *this += field_ele_pressure.name("pressure_p0_old").units(UnitSI().m()) // TODO remove: obsolete field
91 // .flags(FieldFlag::equation_result)
92 // .description("Pressure solution - P0 interpolation.");
93 // *this += field_node_pressure.name("pressure_p1").units(UnitSI().m())
94 // .flags(FieldFlag::equation_result)
95 // .description("Pressure solution - P1 interpolation.");
96 // *this += field_ele_piezo_head.name("piezo_head_p0_old").units(UnitSI().m()) // TODO remove: obsolete field
97 // .flags(FieldFlag::equation_result)
98 // .description("Piezo head solution - P0 interpolation.");
99 // *this += field_ele_flux.name("velocity_p0_old").units(UnitSI().m()) // TODO remove: obsolete field
100 // .flags(FieldFlag::equation_result)
101 // .description("Velocity solution - P0 interpolation.");
102  *this += subdomain.name("subdomain")
105  .description("Subdomain ids of the domain decomposition.");
106  *this += region_id.name("region_id")
109  .description("Region ids.");
110 }
111 
112 
114 : EquationOutput()
115 {
116  *this += pressure_diff.name("pressure_diff").units(UnitSI().m())
118  .description("Error norm of the pressure solution. [Experimental]");
119  *this += velocity_diff.name("velocity_diff").units(UnitSI().m().s(-1))
121  .description("Error norm of the velocity solution. [Experimental]");
122  *this += div_diff.name("div_diff").units(UnitSI().s(-1))
124  .description("Error norm of the divergence of the velocity solution. [Experimental]");
125 }
126 
128 : darcy_flow(flow),
129  mesh_(&darcy_flow->mesh()),
130  compute_errors_(false),
132 {
133  Input::Record in_rec_output = main_mh_in_rec.val<Input::Record>("output");
134 
136  main_mh_in_rec.val<Input::Record>("output_stream"),
138  prepare_output(in_rec_output);
139 
140  auto in_rec_specific = main_mh_in_rec.find<Input::Record>("output_specific");
141  if (in_rec_specific) {
142  in_rec_specific->opt_val("compute_errors", compute_errors_);
143 
144  // raw output
145  int rank;
147  if (rank == 0) {
148 
149  // optionally open raw output file
150  FilePath raw_output_file_path;
151  if (in_rec_specific->opt_val("raw_flow_output", raw_output_file_path))
152  {
153  int mpi_size;
154  MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
155  if(mpi_size > 1)
156  {
157  WarningOut() << "Raw output is not available in parallel computation. MPI size: " << mpi_size << "\n";
158  }
159  else
160  {
161  MessageOut() << "Opening raw flow output: " << raw_output_file_path << "\n";
162  try {
163  raw_output_file_path.open_stream(raw_output_file);
164  } INPUT_CATCH(FilePath::ExcFileOpen, FilePath::EI_Address_String, (*in_rec_specific))
165  }
166  }
167  }
168 
169  auto fields_array = in_rec_specific->val<Input::Array>("fields");
170  if(fields_array.size() > 0){
172  prepare_specific_output(*in_rec_specific);
173  }
174  }
175 }
176 
178 {
179  // we need to add data from the flow equation at this point, not in constructor of OutputFields
182 
185 
186  //output_stream->add_admissible_field_names(in_rec_output.val<Input::Array>("fields"));
187  //output_stream->mark_output_times(darcy_flow->time());
189 }
190 
192 {
193  diff_data.data_ = nullptr;
194  if(DarcyMH* d = dynamic_cast<DarcyMH*>(darcy_flow))
195  {
196  diff_data.data_ = d->data_.get();
197  }
198  else if(DarcyLMH* d = dynamic_cast<DarcyLMH*>(darcy_flow))
199  {
200  diff_data.data_ = d->data_.get();
201  }
203 
204  { // init DOF handlers represents element DOFs
205  uint p_elem_component = 1;
206  diff_data.dh_ = std::make_shared<SubDOFHandlerMultiDim>(diff_data.data_->dh_, p_elem_component);
207  }
208 
209  // mask 2d elements crossing 1d
213  diff_data.velocity_mask[ isec.bulk_ele_idx() ]++;
214  }
215  }
216 
218 
219  diff_data.vel_diff_ptr = std::make_shared< FieldFE<3, FieldValue<3>::Scalar> >();
220  diff_data.vel_diff_ptr->set_fe_data(diff_data.dh_);
222  diff_data.pressure_diff_ptr = std::make_shared< FieldFE<3, FieldValue<3>::Scalar> >();
225  diff_data.div_diff_ptr = std::make_shared< FieldFE<3, FieldValue<3>::Scalar> >();
226  diff_data.div_diff_ptr->set_fe_data(diff_data.dh_);
228 
231 }
232 
234 {}
235 
236 
237 
238 
239 
240 //=============================================================================
241 // CONVERT SOLUTION, CALCULATE BALANCES, ETC...
242 //=============================================================================
243 
244 
246 {
247  START_TIMER("Darcy fields output");
248 
249  {
250  START_TIMER("post-process output fields");
251 
252  {
254  }
255  }
256 
257  {
258  START_TIMER("evaluate output fields");
261  }
262 
263  if (compute_errors_)
264  {
265  START_TIMER("compute specific output fields");
267  }
268 
270  {
271  START_TIMER("evaluate output fields");
274  }
275 
276  {
277  START_TIMER("write time frame");
278  output_stream->write_time_frame();
279  }
280 
281 
282 }
283 
284 
285 
286 /*
287  * Output of internal flow data.
288  */
290 {
291  START_TIMER("DarcyFlowMHOutput::output_internal_flow_data");
292 
293  if (! raw_output_file.is_open()) return;
294 
295  //char dbl_fmt[ 16 ]= "%.8g ";
296  // header
297  raw_output_file << "// fields:\n//ele_id ele_presure flux_in_barycenter[3] n_sides side_pressures[n] side_fluxes[n]\n";
298  raw_output_file << fmt::format("$FlowField\nT={}\n", darcy_flow->time().t());
299  raw_output_file << fmt::format("{}\n" , mesh_->n_elements() );
300 
301 
302  DarcyMH::EqData* data = nullptr;
303  if(DarcyMH* d = dynamic_cast<DarcyMH*>(darcy_flow))
304  {
305  data = d->data_.get();
306  }
307  else if(DarcyLMH* d = dynamic_cast<DarcyLMH*>(darcy_flow))
308  {
309  data = d->data_.get();
310  }
311  ASSERT_PTR(data);
312 
313  arma::vec3 flux_in_center;
314 
315  int cit = 0;
316  for ( DHCellAccessor dh_cell : data->dh_->own_range() ) {
317  ElementAccessor<3> ele = dh_cell.elm();
318  LocDofVec indices = dh_cell.get_loc_dof_indices();
319 
320  // pressure
321  raw_output_file << fmt::format("{} {} ", dh_cell.elm().index(), data->full_solution[indices[ele->n_sides()]]);
322 
323  // velocity at element center
324  flux_in_center = data->field_ele_velocity.value(ele.centre(), ele);
325  for (unsigned int i = 0; i < 3; i++)
326  raw_output_file << flux_in_center[i] << " ";
327 
328  // number of sides
329  raw_output_file << ele->n_sides() << " ";
330 
331  // pressure on edges
332  unsigned int lid = ele->n_sides() + 1;
333  for (unsigned int i = 0; i < ele->n_sides(); i++, lid++) {
334  raw_output_file << data->full_solution[indices[lid]] << " ";
335  }
336  // fluxes on sides
337  for (unsigned int i = 0; i < ele->n_sides(); i++) {
338  raw_output_file << data->full_solution[indices[i]] << " ";
339  }
340 
341  raw_output_file << endl;
342  cit ++;
343  }
344 
345  raw_output_file << "$EndFlowField\n" << endl;
346 }
347 
348 
350 #include "fem/fe_p.hh"
351 #include "fem/fe_values.hh"
352 #include "fields/field_python.hh"
353 #include "fields/field_values.hh"
354 
356 
357 /*
358 * Calculate approximation of L2 norm for:
359  * 1) difference between regularized pressure and analytical solution (using FunctionPython)
360  * 2) difference between RT velocities and analytical solution
361  * 3) difference of divergence
362  * */
363 
365  FEValues<3> &fe_values, FEValues<3> &fv_rt,
366  ExactSolution &anal_sol, DarcyFlowMHOutput::DiffData &result) {
367 
368  ASSERT_DBG( fe_values.dim() == fv_rt.dim());
369  unsigned int dim = fe_values.dim();
370 
371  ElementAccessor<3> ele = dh_cell.elm();
372  fv_rt.reinit(ele);
373  fe_values.reinit(ele);
374 
375  double conductivity = result.data_->conductivity.value(ele.centre(), ele );
376  double cross = result.data_->cross_section.value(ele.centre(), ele );
377 
378 
379  // get coefficients on the current element
380  vector<double> fluxes(dim+1);
381 // vector<double> pressure_traces(dim+1);
382 
383  for (unsigned int li = 0; li < ele->n_sides(); li++) {
384  fluxes[li] = diff_data.data_->full_solution[ dh_cell.get_loc_dof_indices()[li] ];
385 // pressure_traces[li] = result.dh->side_scalar( *(ele->side( li ) ) );
386  }
387  const uint ndofs = dh_cell.n_dofs();
388  // TODO: replace with DHCell getter when available for FESystem component
389  double pressure_mean = diff_data.data_->full_solution[ dh_cell.get_loc_dof_indices()[ndofs/2] ];
390 
391  arma::vec analytical(5);
392  arma::vec3 flux_in_q_point;
393  arma::vec3 anal_flux;
394 
395  double velocity_diff=0, divergence_diff=0, pressure_diff=0, diff;
396 
397  // 1d: mean_x_squared = 1/6 (v0^2 + v1^2 + v0*v1)
398  // 2d: mean_x_squared = 1/12 (v0^2 + v1^2 +v2^2 + v0*v1 + v0*v2 + v1*v2)
399  double mean_x_squared=0;
400  for(unsigned int i_node=0; i_node < ele->n_nodes(); i_node++ )
401  for(unsigned int j_node=0; j_node < ele->n_nodes(); j_node++ )
402  {
403  mean_x_squared += (i_node == j_node ? 2.0 : 1.0) / ( 6 * dim ) // multiply by 2 on diagonal
404  * arma::dot( *ele.node(i_node), *ele.node(j_node));
405  }
406 
407  for(unsigned int i_point=0; i_point < fe_values.n_points(); i_point++) {
408  arma::vec3 q_point = fe_values.point(i_point);
409 
410 
411  analytical = anal_sol.value(q_point, ele );
412  for(unsigned int i=0; i< 3; i++) anal_flux[i] = analytical[i+1];
413 
414  // compute postprocesed pressure
415  diff = 0;
416  for(unsigned int i_shape=0; i_shape < ele->n_sides(); i_shape++) {
417  unsigned int oposite_node = 0;
418  switch (dim) {
419  case 1: oposite_node = RefElement<1>::oposite_node(i_shape); break;
420  case 2: oposite_node = RefElement<2>::oposite_node(i_shape); break;
421  case 3: oposite_node = RefElement<3>::oposite_node(i_shape); break;
422  default: ASSERT(false)(dim).error("Unsupported FE dimension."); break;
423  }
424 
425  diff += fluxes[ i_shape ] *
426  ( arma::dot( q_point, q_point )/ 2
427  - mean_x_squared / 2
428  - arma::dot( q_point, *ele.node(oposite_node) )
429  + arma::dot( ele.centre(), *ele.node(oposite_node) )
430  );
431  }
432 
433  diff = - (1.0 / conductivity) * diff / dim / ele.measure() / cross + pressure_mean ;
434  diff = ( diff - analytical[0]);
435  pressure_diff += diff * diff * fe_values.JxW(i_point);
436 
437 
438  // velocity difference
439  flux_in_q_point.zeros();
440  for(unsigned int i_shape=0; i_shape < ele->n_sides(); i_shape++) {
441  flux_in_q_point += fluxes[ i_shape ]
442  * fv_rt.vector_view(0).value(i_shape, i_point)
443  / cross;
444  }
445 
446  flux_in_q_point -= anal_flux;
447  velocity_diff += dot(flux_in_q_point, flux_in_q_point) * fe_values.JxW(i_point);
448 
449  // divergence diff
450  diff = 0;
451  for(unsigned int i_shape=0; i_shape < ele->n_sides(); i_shape++) diff += fluxes[ i_shape ];
452  diff = ( diff / ele.measure() / cross - analytical[4]);
453  divergence_diff += diff * diff * fe_values.JxW(i_point);
454 
455  }
456 
457  // DHCell constructed with diff fields DH, get DOF indices of actual element
458  DHCellAccessor sub_dh_cell = dh_cell.cell_with_other_dh(result.dh_.get());
459  IntIdx idx = sub_dh_cell.get_loc_dof_indices()[0];
460 
461  auto velocity_data = result.vel_diff_ptr->get_data_vec();
462  velocity_data[ idx ] = sqrt(velocity_diff);
463  result.velocity_error[dim-1] += velocity_diff;
464  if (dim == 2 && result.velocity_mask.size() != 0 ) {
465  result.mask_vel_error += (result.velocity_mask[ ele.idx() ])? 0 : velocity_diff;
466  }
467 
468  auto pressure_data = result.pressure_diff_ptr->get_data_vec();
469  pressure_data[ idx ] = sqrt(pressure_diff);
470  result.pressure_error[dim-1] += pressure_diff;
471 
472  auto div_data = result.div_diff_ptr->get_data_vec();
473  div_data[ idx ] = sqrt(divergence_diff);
474  result.div_error[dim-1] += divergence_diff;
475 
476 }
477 
479 : order(4),
480  quad(QGauss::make_array(order)),
481  fe_p1(0), fe_p0(0),
482  fe_rt( )
483 {
485  fe_values = mixed_fe_values(quad, fe_p0, flags);
486  fv_rt = mixed_fe_values(quad, fe_rt, flags);
487 }
488 
489 
491  DebugOut() << "l2 norm output\n";
492  ofstream os( FilePath("solution_error", FilePath::output_file) );
493 
494  FilePath source_file( "analytical_module.py", FilePath::input_file);
495  ExactSolution anal_sol_1d(5); // components: pressure, flux vector 3d, divergence
496  anal_sol_1d.set_python_field_from_file( source_file, "all_values_1d");
497 
498  ExactSolution anal_sol_2d(5);
499  anal_sol_2d.set_python_field_from_file( source_file, "all_values_2d");
500 
501  ExactSolution anal_sol_3d(5);
502  anal_sol_3d.set_python_field_from_file( source_file, "all_values_3d");
503 
505  for(unsigned int j=0; j<3; j++){
506  diff_data.pressure_error[j] = 0;
507  diff_data.velocity_error[j] = 0;
508  diff_data.div_error[j] = 0;
509  }
510 
511  //diff_data.ele_flux = &( ele_flux );
512 
513  for (DHCellAccessor dh_cell : diff_data.data_->dh_->own_range()) {
514 
515  switch (dh_cell.dim()) {
516  case 1:
517  l2_diff_local( dh_cell, fe_data.fe_values[1], fe_data.fv_rt[1], anal_sol_1d, diff_data);
518  break;
519  case 2:
520  l2_diff_local( dh_cell, fe_data.fe_values[2], fe_data.fv_rt[2], anal_sol_2d, diff_data);
521  break;
522  case 3:
523  l2_diff_local( dh_cell, fe_data.fe_values[3], fe_data.fv_rt[3], anal_sol_3d, diff_data);
524  break;
525  }
526  }
527 
528  // square root for L2 norm
529  for(unsigned int j=0; j<3; j++){
532  diff_data.div_error[j] = sqrt(diff_data.div_error[j]);
533  }
535 
536  os << "l2 norm output\n\n"
537  << "pressure error 1d: " << diff_data.pressure_error[0] << endl
538  << "pressure error 2d: " << diff_data.pressure_error[1] << endl
539  << "pressure error 3d: " << diff_data.pressure_error[2] << endl
540  << "velocity error 1d: " << diff_data.velocity_error[0] << endl
541  << "velocity error 2d: " << diff_data.velocity_error[1] << endl
542  << "velocity error 3d: " << diff_data.velocity_error[2] << endl
543  << "masked velocity error 2d: " << diff_data.mask_vel_error <<endl
544  << "div error 1d: " << diff_data.div_error[0] << endl
545  << "div error 2d: " << diff_data.div_error[1] << endl
546  << "div error 3d: " << diff_data.div_error[2];
547 }
548 
549 
TimeGovernor & time()
Definition: equation.hh:151
FieldSet & data()
Definition: equation.hh:204
void set_python_field_from_file(const FilePath &file_name, const string &func_name)
Shape function values.
Definition: update_flags.hh:87
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > vel_diff_ptr
UpdateFlags
Enum type UpdateFlags indicates which quantities are to be recomputed on each finite element cell...
Definition: update_flags.hh:67
static auto subdomain(Mesh &mesh) -> IndexField
struct DarcyFlowMHOutput::DiffData diff_data
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:74
Declaration of class which handles the ordering of degrees of freedom (dof) and mappings between loca...
Output class for darcy_flow_mh model.
unsigned int n_nodes() const
Definition: elements.h:126
virtual void prepare_specific_output(Input::Record in_rec)
RegionSet get_region_set(const std::string &set_name) const
Definition: region.cc:329
const FEValuesViews::Vector< spacedim > & vector_view(unsigned int i) const
Accessor to vector values of multicomponent FE.
Definition: fe_values.hh:254
Accessor to input data conforming to declared Array.
Definition: accessors.hh:567
ArmaVec< double, N > vec
Definition: armor.hh:861
arma::Col< IntIdx > LocDofVec
Definition: index_types.hh:28
unsigned int uint
Classes with algorithms for computation of intersections of meshes.
std::shared_ptr< SubDOFHandlerMultiDim > dh_
virtual void prepare_output(Input::Record in_rec)
OutputSpecificFields output_specific_fields
Specific quantities for output in DarcyFlowMH - error estimates etc.
MixedMeshIntersections & mixed_intersections()
Definition: mesh.cc:822
Class Input::Type::Default specifies default value of keys of a Input::Type::Record.
Definition: type_record.hh:61
Class for declaration of the input of type Bool.
Definition: type_base.hh:459
int IntIdx
Definition: index_types.hh:25
#define MessageOut()
Macro defining &#39;message&#39; record of log.
Definition: logger.hh:255
std::shared_ptr< DOFHandlerMultiDim > dh_
full DOF handler represents DOFs of sides, elements and edges
void output(TimeStep step)
const Input::Type::Instance & make_output_type_from_record(Input::Type::Record &in_rec, const string &equation_name, const string &aditional_description="")
std::string format(CStringRef format_str, ArgList args)
Definition: format.h:3141
#define INPUT_CATCH(ExceptionType, AddressEITag, input_accessor)
Definition: accessors.hh:64
static std::shared_ptr< OutputTime > create_output_stream(const std::string &equation_name, const Input::Record &in_rec, std::string unit_str)
This method delete all object instances of class OutputTime stored in output_streams vector...
Definition: output_time.cc:184
bool is_output_specific_fields
Output specific field stuff.
Standard quantities for output in DarcyFlowMH.
Lumped mixed-hybrid model of linear Darcy flow, possibly unsteady.
Fields computed from the mesh data.
Iterator< Ret > find(const string &key) const
Cell accessor allow iterate over DOF handler cells.
Helper class that stores data of generic types.
Definition: type_generic.hh:89
Class FEValues calculates finite element data on the actual cells such as shape function values...
FieldPython< 3, FieldValue< 3 >::Vector > ExactSolution
static const Input::Type::Instance & get_input_type(FieldSet &eq_data, const std::string &equation_name)
LocDofVec get_loc_dof_indices() const
Returns the local indices of dofs associated to the cell on the local process.
const RegionDB & region_db() const
Definition: mesh.h:143
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
Definition: asserts.hh:347
const TimeStep & step(int index=-1) const
Mixed-hybrid model of linear Darcy flow, possibly unsteady.
double t() const
Field< 3, FieldValue< 3 >::Scalar > subdomain
unsigned int n_dofs() const
Return number of dofs on given cell.
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
void reinit(const ElementAccessor< spacedim > &cell)
Update cell-dependent data (gradients, Jacobians etc.)
Definition: fe_values.cc:553
std::shared_ptr< OutputTime > output_stream
NodeAccessor< 3 > node(unsigned int ni) const
Definition: accessors.hh:200
Field< 3, FieldValue< 3 >::Scalar > pressure_diff
Record & close() const
Close the Record for further declarations of keys.
Definition: type_record.cc:304
static unsigned int oposite_node(unsigned int sid)
Definition: ref_element.cc:327
Symmetric Gauss-Legendre quadrature formulae on simplices.
arma::vec::fixed< spacedim > centre() const
Computes the barycenter.
Field< 3, FieldValue< 3 >::Scalar > velocity_diff
static Default optional()
The factory function to make an empty default value which is optional.
Definition: type_record.hh:124
void open_stream(Stream &stream) const
Definition: file_path.cc:211
bool opt_val(const string &key, Ret &value) const
Transformed quadrature points.
const ElementAccessor< 3 > elm() const
Return ElementAccessor to element of loc_ele_idx_.
Global macros to enhance readability and debugging, general constants.
static constexpr Mask equation_result
Match result fields. These are never given by input or copy of input.
Definition: field_flag.hh:55
static const Input::Type::Instance & get_input_type_specific()
Definitions of basic Lagrangean finite elements with polynomial shape functions.
static constexpr Mask equation_external_output
Match an output field, that can be also copy of other field.
Definition: field_flag.hh:58
Accessor to the data with type Type::Record.
Definition: accessors.hh:292
const Ret val(const string &key) const
unsigned int n_sides() const
Definition: elements.h:132
static auto region_id(Mesh &mesh) -> IndexField
#define START_TIMER(tag)
Starts a timer with specified tag.
unsigned int dim() const
Return dimension of reference space.
Definition: fe_values.hh:285
DarcyFlowMHOutput(DarcyFlowInterface *flow, Input::Record in_rec)
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm) const
Definition: field.hh:431
Field< 3, FieldValue< 3 >::Scalar > div_diff
Record & declare_key(const string &key, std::shared_ptr< TypeBase > type, const Default &default_value, const string &description, TypeBase::attribute_map key_attributes=TypeBase::attribute_map())
Declares a new key of the Record.
Definition: type_record.cc:503
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > pressure_diff_ptr
ofstream raw_output_file
Raw data output file.
double measure() const
Computes the measure of the element.
VectorMPI full_solution
#define MPI_Comm_size
Definition: mpi.h:235
std::vector< FEValues< 3 > > fe_values
#define MPI_Comm_rank
Definition: mpi.h:236
Record & copy_keys(const Record &other)
Copy keys from other record.
Definition: type_record.cc:216
Dedicated class for storing path to input and output files.
Definition: file_path.hh:54
FieldCommon & description(const string &description)
std::string get_unit_string() const
virtual unsigned int n_elements(bool boundary=false) const
Returns count of boundary or bulk elements.
Definition: mesh.h:337
void initialize(std::shared_ptr< OutputTime > stream, Mesh *mesh, Input::Record in_rec, const TimeGovernor &tg)
DarcyFlowInterface * darcy_flow
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR)
Definition: asserts.hh:336
Field< 3, FieldValue< 3 >::Scalar > region_id
bool compute_errors_
Specific experimental error computing.
static Input::Type::Record & get_input_type()
void set_field(const RegionSet &domain, FieldBasePtr field, double time=0.0)
Definition: field.impl.hh:229
bool set_time(const TimeStep &time, LimitSide limit_side)
Definition: field_set.cc:157
#define ASSERT_DBG(expr)
Definitions of particular quadrature rules on simplices.
#define WarningOut()
Macro defining &#39;warning&#39; record of log.
Definition: logger.hh:258
FieldCommon & name(const string &name)
#define MPI_COMM_WORLD
Definition: mpi.h:123
void l2_diff_local(DHCellAccessor dh_cell, FEValues< 3 > &fe_values, FEValues< 3 > &fv_rt, FieldPython< 3, FieldValue< 3 >::Vector > &anal_sol, DiffData &result)
Computes L2 error on an element.
std::vector< FEValues< 3 > > fv_rt
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > div_diff_ptr
mixed-hybrid model of linear Darcy flow, possibly unsteady.
void set_mesh(const Mesh &mesh)
Definition: field_set.hh:186
DHCellAccessor cell_with_other_dh(const DOFHandlerMultiDim *dh) const
Create new accessor with same local idx and given DOF handler. Actual and given DOF handler must be c...
Record type proxy class.
Definition: type_record.hh:182
const Input::Type::Instance & make_output_type(const string &equation_name, const string &aditional_description="")
Field< 3, FieldValue< 3 >::Scalar > cross_section
Field< 3, FieldValue< 3 >::Scalar > conductivity
FieldCommon & flags(FieldFlag::Flags::Mask mask)
double JxW(const unsigned int point_no)
Return the product of Jacobian determinant and the quadrature weight at given quadrature point...
Definition: fe_values.hh:200
Class for representation SI units of Fields.
Definition: unit_si.hh:40
static FileName output()
The factory function for declaring type FileName for input files.
Definition: type_base.cc:533
arma::vec::fixed< spacedim > point(const unsigned int point_no)
Return coordinates of the quadrature point in the actual cell system.
Definition: fe_values.hh:213
static UnitSI & dimensionless()
Returns dimensionless unit.
Definition: unit_si.cc:55
#define DebugOut()
Macro defining &#39;debug&#39; record of log.
Definition: logger.hh:264
unsigned int idx() const
Return local idx of element in boundary / bulk part of element vector.
Definition: accessors.hh:181
std::vector< FEValues< 3 > > mixed_fe_values(QGauss::array &quadrature, MixedPtr< FiniteElement > fe, UpdateFlags flags)
Definition: fe_values.cc:587
std::vector< IntersectionLocal< 1, 2 > > intersection_storage12_
Stores 1D-2D intersections.
unsigned int n_points() const
Returns the number of quadrature points.
Definition: fe_values.hh:273
Implementation of range helper class.
Definitions of Raviart-Thomas finite elements.
MortarMethod mortar_method_
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm)
void output()
Calculate values for output.
Transformed quadrature weights.
Mixed-hybrid model of linear Darcy flow, possibly unsteady.