Flow123d
release_3.0.0-968-gc87a28e79
|
Go to the documentation of this file.
73 "SPECIAL PURPOSE. Computes error norms of the solution, particulary suited for non-compatible coupling models.")
75 "Output file with raw data from MH module.")
80 "Flow_Darcy_MH_specific",
91 .
description(
"Pressure solution - P0 interpolation.");
94 .
description(
"Pressure solution - P1 interpolation.");
97 .
description(
"Piezo head solution - P0 interpolation.");
100 .
description(
"Velocity solution - P0 interpolation.");
104 .
description(
"Subdomain ids of the domain decomposition.");
117 .
description(
"Error norm of the pressure solution. [Experimental]");
120 .
description(
"Error norm of the velocity solution. [Experimental]");
123 .
description(
"Error norm of the divergence of the velocity solution. [Experimental]");
141 if (in_rec_specific) {
150 if (in_rec_specific->opt_val(
"raw_flow_output", raw_output_file_path)) {
151 MessageOut() <<
"Opening raw flow output: " << raw_output_file_path <<
"\n";
154 }
INPUT_CATCH(FilePath::ExcFileOpen, FilePath::EI_Address_String, (*in_rec_specific))
158 auto fields_array = in_rec_specific->val<
Input::Array>(
"fields");
159 if(fields_array.size() > 0){
186 auto corner_ptr = make_shared< FieldFE<3, FieldValue<3>::Scalar> >();
324 START_TIMER(
"DarcyFlowMHOutput::make_element_scalar");
325 unsigned int sol_size;
330 for(
unsigned int i_ele : element_indices) {
345 START_TIMER(
"DarcyFlowMHOutput::make_element_vector");
349 auto multidim_assembler = AssemblyBase::create< AssemblyMH >(
darcy_flow->
data_);
351 for(
unsigned int i_ele : element_indices) {
354 flux_in_center = multidim_assembler[ele->
dim() -1]->make_element_vector(ele);
357 for(
unsigned int j=0; j<3; j++)
ele_flux[3*i_ele + j]=flux_in_center[j];
364 START_TIMER(
"DarcyFlowMHOutput::make_corner_scalar");
365 unsigned int ndofs =
dh_->max_elem_dofs();
376 dh_->get_dof_indices(ele, indices);
377 for (i_node=0; i_node<ele->n_nodes(); i_node++)
379 corner_pressure[indices[i_node]] = node_scalar[ ele.node_accessor(i_node).idx() ];
400 START_TIMER(
"DarcyFlowMHOutput::make_node_scalar_param");
412 int* sum_elements =
new int [n_nodes];
413 int* sum_sides =
new int [n_nodes];
414 double* sum_ele_dist =
new double [n_nodes];
415 double* sum_side_dist =
new double [n_nodes];
419 bool count_elements =
true;
420 bool count_sides =
true;
426 for (
int i = 0; i < n_nodes; i++){
429 sum_ele_dist[i] = 0.0;
430 sum_side_dist[i] = 0.0;
437 for (
unsigned int li = 0; li < ele->n_nodes(); li++) {
438 node = ele.node_accessor(li);
439 node_index = node.
idx();
442 ((node->
getX() - ele.centre()[ 0 ])*(node->
getX() - ele.centre()[ 0 ])) +
443 ((node->
getY() - ele.centre()[ 1 ])*(node->
getY() - ele.centre()[ 1 ])) +
444 ((node->
getZ() - ele.centre()[ 2 ])*(node->
getZ() - ele.centre()[ 2 ]))
446 sum_ele_dist[node_index] += dist;
447 sum_elements[node_index]++;
452 for(
SideIter side = ele.side(0); side->
side_idx() < ele->n_sides(); ++side) {
453 for (
unsigned int li = 0; li < side->n_nodes(); li++) {
454 node = side->node(li);
455 node_index = node.
idx();
457 ((node->
getX() - side->centre()[ 0 ])*(node->
getX() - side->centre()[ 0 ])) +
458 ((node->
getY() - side->centre()[ 1 ])*(node->
getY() - side->centre()[ 1 ])) +
459 ((node->
getZ() - side->centre()[ 2 ])*(node->
getZ() - side->centre()[ 2 ]))
462 sum_side_dist[node_index] += dist;
463 sum_sides[node_index]++;
471 for (
unsigned int li = 0; li < ele->n_nodes(); li++) {
472 node = ele.node_accessor(li);
473 node_index = ele.node_accessor(li).
idx();
477 ((node->
getX() - ele.centre()[ 0 ])*(node->
getX() - ele.centre()[ 0 ])) +
478 ((node->
getY() - ele.centre()[ 1 ])*(node->
getY() - ele.centre()[ 1 ])) +
479 ((node->
getZ() - ele.centre()[ 2 ])*(node->
getZ() - ele.centre()[ 2 ]))
482 (1 - dist / (sum_ele_dist[node_index] + sum_side_dist[node_index])) /
483 (sum_elements[node_index] + sum_sides[node_index] - 1);
488 for(
SideIter side = ele.side(0); side->
side_idx() < ele->n_sides(); ++side) {
489 for (
unsigned int li = 0; li < side->n_nodes(); li++) {
490 node = side->node(li);
491 node_index = node.
idx();
495 ((node->
getX() - side->centre()[ 0 ])*(node->
getX() - side->centre()[ 0 ])) +
496 ((node->
getY() - side->centre()[ 1 ])*(node->
getY() - side->centre()[ 1 ])) +
497 ((node->
getZ() - side->centre()[ 2 ])*(node->
getZ() - side->centre()[ 2 ]))
502 (1 - dist / (sum_ele_dist[node_index] + sum_side_dist[node_index])) /
503 (sum_sides[node_index] + sum_elements[node_index] - 1);
509 delete [] sum_elements;
511 delete [] sum_ele_dist;
512 delete [] sum_side_dist;
523 START_TIMER(
"DarcyFlowMHOutput::output_internal_flow_data");
530 raw_output_file <<
"// fields:\n//ele_id ele_presure flux_in_barycenter[3] n_sides side_pressures[n] side_fluxes[n]\n";
537 for (
unsigned int i = 0; i < 3; i++)
542 for (
unsigned int i = 0; i < ele->n_sides(); i++) {
545 for (
unsigned int i = 0; i < ele->n_sides(); i++) {
588 for (
unsigned int li = 0; li < ele->
n_sides(); li++) {
594 arma::vec analytical(5);
598 double velocity_diff=0, divergence_diff=0, pressure_diff=0, diff;
602 double mean_x_squared=0;
603 for(
unsigned int i_node=0; i_node < ele->
n_nodes(); i_node++ )
604 for(
unsigned int j_node=0; j_node < ele->
n_nodes(); j_node++ )
606 mean_x_squared += (i_node == j_node ? 2.0 : 1.0) / ( 6 * dim )
610 for(
unsigned int i_point=0; i_point < fe_values.
n_points(); i_point++) {
614 analytical = anal_sol.
value(q_point, ele );
615 for(
unsigned int i=0; i< 3; i++) anal_flux[i] = analytical[i+1];
619 for(
unsigned int i_shape=0; i_shape < ele->
n_sides(); i_shape++) {
622 diff += fluxes[ i_shape ] *
623 ( arma::dot( q_point, q_point )/ 2
625 - arma::dot( q_point, ele.
node(oposite_node)->
point() )
630 diff = - (1.0 / conductivity) * diff / dim / ele.
measure() / cross + pressure_mean ;
631 diff = ( diff - analytical[0]);
632 pressure_diff += diff * diff * fe_values.
JxW(i_point);
636 flux_in_q_point.zeros();
637 for(
unsigned int i_shape=0; i_shape < ele->
n_sides(); i_shape++) {
638 flux_in_q_point += fluxes[ i_shape ]
643 flux_in_q_point -= anal_flux;
644 velocity_diff += dot(flux_in_q_point, flux_in_q_point) * fe_values.
JxW(i_point);
648 for(
unsigned int i_shape=0; i_shape < ele->
n_sides(); i_shape++) diff += fluxes[ i_shape ];
649 diff = ( diff / ele.
measure() / cross - analytical[4]);
650 divergence_diff += diff * diff * fe_values.
JxW(i_point);
664 result.
div_diff[ ele.
idx() ] = sqrt(divergence_diff);
665 result.
div_error[dim-1] += divergence_diff;
670 : fe_p0(0), fe_p1(1), order(4), quad(order),
692 for(
unsigned int j=0; j<3; j++){
700 unsigned int solution_size;
706 switch (ele->dim()) {
721 for(
unsigned int j=0; j<3; j++){
728 os <<
"l2 norm output\n\n"
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
virtual void prepare_specific_output(Input::Record in_rec)
Definitions of Raviart-Thomas finite elements.
void output()
Calculate values for output.
static UnitSI & dimensionless()
Returns dimensionless unit.
bool set_time(const TimeStep &time, LimitSide limit_side)
FieldPython< 3, FieldValue< 3 >::Vector > ExactSolution
FieldCommon & output_type(OutputTime::DiscreteSpace rt)
void initialize(std::shared_ptr< OutputTime > stream, Mesh *mesh, Input::Record in_rec, const TimeGovernor &tg)
bool is_output_specific_fields
Output specific field stuff.
OutputSpecificFields output_specific_fields
void reinit(ElementAccessor< 3 > &cell)
Update cell-dependent data (gradients, Jacobians etc.)
arma::vec::fixed< spacedim > point(const unsigned int point_no)
Return coordinates of the quadrature point in the actual cell system.
virtual Range< ElementAccessor< 3 > > elements_range() const
Returns range of bulk elements.
unsigned int n_sides() const
void compute_l2_difference()
void make_element_vector(ElementSetRef element_indices)
virtual void prepare_output(Input::Record in_rec)
Class FEValues calculates finite element data on the actual cells such as shape function values,...
Dedicated class for storing path to input and output files.
void resize(unsigned int local_size)
const typedef vector< unsigned int > & ElementSetRef
@ update_values
Shape function values.
bool is_field_output_time(const FieldCommon &field, TimeStep step) const
double side_flux(const Side &side) const
temporary replacement for DofHandler accessor, flux through given side
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > ele_pressure_ptr
Field of pressure head in barycenters of elements.
void l2_diff_local(ElementAccessor< 3 > &ele, FEValues< dim, 3 > &fe_values, FEValues< dim, 3 > &fv_rt, FieldPython< 3, FieldValue< 3 >::Vector > &anal_sol, DiffData &result)
Computes L2 error on an element.
@ update_quadrature_points
Transformed quadrature points.
FieldCommon & flags(FieldFlag::Flags::Mask mask)
const Node * node(unsigned int ni) const
VectorMPI corner_pressure
Declaration of class which handles the ordering of degrees of freedom (dof) and mappings between loca...
void make_corner_scalar(vector< double > &node_scalar)
std::string format(CStringRef format_str, ArgList args)
void open_stream(Stream &stream) const
std::shared_ptr< OutputTime > output_stream
FEValues< dim, 3 > fe_values
Field< 3, FieldValue< 3 >::Scalar > pressure_diff
static constexpr Mask equation_external_output
Match an output field, that can be also copy of other field.
Standard quantities for output in DarcyFlowMH.
std::shared_ptr< DOFHandlerMultiDim > dh_
Field< 3, FieldValue< 3 >::Scalar > region_id
const Input::Type::Instance & make_output_type(const string &equation_name, const string &aditional_description="")
Definitions of basic Lagrangean finite elements with polynomial shape functions.
double side_scalar(const Side &side) const
temporary replacement for DofHandler accessor, scalar (pressure) on edge of the side
std::shared_ptr< DiscreteSpace > ds
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > div_diff_ptr
OutputFields output_fields
std::vector< unsigned int > all_element_idx_
static constexpr Mask equation_result
Match result fields. These are never given by input or copy of input.
Output class for darcy_flow_mh model.
Specific quantities for output in DarcyFlowMH - error estimates etc.
std::string get_unit_string() const
Definitions of particular quadrature rules on simplices.
Provides the numbering of the finite element degrees of freedom on the computational mesh.
void make_node_scalar_param(ElementSetRef element_indices)
Calculate nodes scalar, store it in double* node_scalars instead of node->scalar.
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > vel_diff_ptr
Field< 3, FieldValue< 3 >::Scalar > velocity_diff
const TimeStep & step(int index=-1) const
Field< 3, FieldValue< 3 >::VectorFixed > field_ele_flux
Field< 3, FieldValue< 3 >::Scalar > div_diff
void distribute_dofs(std::shared_ptr< DiscreteSpace > ds)
Distributes degrees of freedom on the mesh needed for the given discrete space.
double JxW(const unsigned int point_no)
Return the product of Jacobian determinant and the quadrature weight at given quadrature point.
static auto subdomain(Mesh &mesh) -> IndexField
Class for representation SI units of Fields.
const RegionDB & region_db() const
static const Input::Type::Instance & get_input_type()
RegionSet get_region_set(const std::string &set_name) const
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > pressure_diff_ptr
static unsigned int oposite_node(unsigned int sid)
static Input::Type::Record & get_input_type()
std::shared_ptr< DOFHandlerMultiDim > sequential()
Returns sequential version of the current dof handler.
const FEValuesViews::Vector< dim, spacedim > & vector_view(unsigned int i) const
Accessor to vector values of multicomponent FE.
static const Input::Type::Instance & get_input_type_specific()
void output_internal_flow_data()
Field< 3, FieldValue< 3 >::Scalar > field_ele_piezo_head
unsigned int side_idx() const
void set_field(const RegionSet &domain, FieldBasePtr field, double time=0.0)
std::shared_ptr< EqData > data_
virtual const Value::return_type & value(const Point &p, const ElementAccessor< spacedim > &elm) const
static auto region_id(Mesh &mesh) -> IndexField
ofstream raw_output_file
Raw data output file.
void output(TimeStep step)
Field< 3, FieldValue< 3 >::Scalar > field_node_pressure
std::vector< IntersectionLocal< 1, 2 > > intersection_storage12_
Stores 1D-2D intersections.
struct DarcyFlowMHOutput::DiffData diff_data
unsigned int n_sides() const
std::vector< int > velocity_mask
double element_scalar(ElementAccessor< 3 > &ele) const
temporary replacement for DofHandler accessor, scalar (pressure) on element
Global macros to enhance readability and debugging, general constants.
void set_mesh(const Mesh &mesh)
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::VectorFixed > > ele_flux_ptr
Field of flux in barycenter of every element.
bool compute_errors_
Specific experimental error computing.
mixed-hybrid model of linear Darcy flow, possibly unsteady.
@ update_JxW_values
Transformed quadrature weights.
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > ele_piezo_head_ptr
Field of piezo-metric head in barycenters of elements.
const Input::Type::Instance & make_output_type_from_record(Input::Type::Record &in_rec, const string &equation_name, const string &aditional_description="")
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.
MortarMethod mortar_method_
virtual const Value::return_type & value(const Point &p, const ElementAccessor< spacedim > &elm)
unsigned int idx() const
Return local idx of element in boundary / bulk part of element vector.
DarcyFlowMHOutput(DarcyMH *flow, Input::Record in_rec)
void fill_output_data(VectorMPI &vec_seq, std::shared_ptr< FieldFE< spacedim, Value > > field_ptr)
Class MappingP1 implements the affine transformation of the unit cell onto the actual cell.
Field< 3, FieldValue< 3 >::Scalar > subdomain
void set_python_field_from_file(const FilePath &file_name, const string &func_name)
virtual ~DarcyFlowMHOutput()
FieldCommon & description(const string &description)
const MH_DofHandler & get_mh_dofhandler() override
virtual unsigned int n_elements(bool boundary=false) const
Returns count of boundary or bulk elements.
MixedMeshIntersections & mixed_intersections()
#define DebugOut()
Macro defining 'debug' record of log.
SideIter side(const unsigned int loc_index)
virtual ElementAccessor< 3 > element_accessor(unsigned int idx) const
Create and return ElementAccessor to element of given idx.
Mixed-hybrid model of linear Darcy flow, possibly unsteady.
Field< 3, FieldValue< 3 >::Scalar > cross_section
Field< 3, FieldValue< 3 >::Scalar > conductivity
Field< 3, FieldValue< 3 >::Scalar > field_ele_pressure
virtual unsigned int n_nodes() const
void get_solution_vector(double *&vec, unsigned int &vec_size) override
#define START_TIMER(tag)
Starts a timer with specified tag.
unsigned int n_points()
Returns the number of quadrature points.
void make_element_scalar(ElementSetRef element_indices)
double measure() const
Computes the measure of the element.
unsigned int n_nodes() const
FieldCommon & name(const string &name)
Implementation of range helper class.
arma::vec::fixed< spacedim > centre() const
Computes the barycenter.
#define MessageOut()
Macro defining 'message' record of log.
Classes with algorithms for computation of intersections of meshes.