64 output_fields += eq_data;
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.")
81 "Flow_Darcy_MH_specific",
105 .
description(
"Subdomain ids of the domain decomposition.");
118 .
description(
"Error norm of the pressure solution. [Experimental]");
121 .
description(
"Error norm of the velocity solution. [Experimental]");
124 .
description(
"Error norm of the divergence of the velocity solution. [Experimental]");
141 if (in_rec_specific) {
151 if (in_rec_specific->opt_val(
"raw_flow_output", raw_output_file_path))
157 WarningOut() <<
"Raw output is not available in parallel computation. MPI size: " << mpi_size <<
"\n";
161 MessageOut() <<
"Opening raw flow output: " << raw_output_file_path <<
"\n";
164 }
INPUT_CATCH(FilePath::ExcFileOpen, FilePath::EI_Address_String, (*in_rec_specific))
169 auto fields_array = in_rec_specific->val<
Input::Array>(
"fields");
170 if(fields_array.size() > 0){
205 uint p_elem_component = 1;
288 START_TIMER(
"DarcyFlowMHOutput::output_internal_flow_data");
294 raw_output_file <<
"// fields:\n//ele_id ele_presure flux_in_barycenter[3] n_sides side_pressures[n] side_fluxes[n]\n";
302 data = d->data_.get();
306 data = d->data_.get();
315 LocDofVec indices = dh_cell.get_loc_dof_indices();
321 flux_in_center = data->field_ele_velocity.value(ele.
centre(), ele);
322 for (
unsigned int i = 0; i < 3; i++)
329 unsigned int lid = ele->
n_sides() + 1;
330 for (
unsigned int i = 0; i < ele->
n_sides(); i++, lid++) {
334 for (
unsigned int i = 0; i < ele->
n_sides(); i++) {
366 unsigned int dim = fe_values.
dim();
380 for (
unsigned int li = 0; li < ele->
n_sides(); li++) {
392 double velocity_diff=0, divergence_diff=0, pressure_diff=0, diff;
396 double mean_x_squared=0;
397 for(
unsigned int i_node=0; i_node < ele->
n_nodes(); i_node++ )
398 for(
unsigned int j_node=0; j_node < ele->
n_nodes(); j_node++ )
400 mean_x_squared += (i_node == j_node ? 2.0 : 1.0) / ( 6 * dim )
401 * arma::dot( *ele.
node(i_node), *ele.
node(j_node));
404 for(
unsigned int i_point=0; i_point < fe_values.
n_points(); i_point++) {
408 analytical = anal_sol.
value(q_point, ele );
409 for(
unsigned int i=0; i< 3; i++) anal_flux[i] = analytical[i+1];
413 for(
unsigned int i_shape=0; i_shape < ele->
n_sides(); i_shape++) {
414 unsigned int oposite_node = 0;
419 default:
ASSERT(
false)(dim).error(
"Unsupported FE dimension.");
break;
422 diff += fluxes[ i_shape ] *
423 ( arma::dot( q_point, q_point )/ 2
425 - arma::dot( q_point, *ele.
node(oposite_node) )
426 + arma::dot( ele.
centre(), *ele.
node(oposite_node) )
430 diff = - (1.0 / conductivity) * diff / dim / ele.
measure() / cross + pressure_mean ;
431 diff = ( diff - analytical[0]);
432 pressure_diff += diff * diff * fe_values.
JxW(i_point);
436 flux_in_q_point.zeros();
437 for(
unsigned int i_shape=0; i_shape < ele->
n_sides(); i_shape++) {
438 flux_in_q_point += fluxes[ i_shape ]
443 flux_in_q_point -= anal_flux;
444 velocity_diff += dot(flux_in_q_point, flux_in_q_point) * fe_values.
JxW(i_point);
448 for(
unsigned int i_shape=0; i_shape < ele->
n_sides(); i_shape++) diff += fluxes[ i_shape ];
449 diff = ( diff / ele.
measure() / cross - analytical[4]);
450 divergence_diff += diff * diff * fe_values.
JxW(i_point);
458 auto velocity_data = result.
vel_diff_ptr->get_data_vec();
459 velocity_data[ idx ] = sqrt(velocity_diff);
466 pressure_data[ idx ] = sqrt(pressure_diff);
470 div_data[ idx ] = sqrt(divergence_diff);
471 result.
div_error[dim-1] += divergence_diff;
477 quad(
QGauss::make_array(order)),
502 for(
unsigned int j=0; j<3; j++){
512 switch (dh_cell.dim()) {
526 for(
unsigned int j=0; j<3; j++){
533 os <<
"l2 norm output\n\n"
MixedPtr< FE_P_disc > fe_p0
void set_python_field_from_file(const FilePath &file_name, const string &func_name)
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...
static auto subdomain(Mesh &mesh) -> IndexField
struct DarcyFlowMHOutput::DiffData diff_data
Container for various descendants of FieldCommonBase.
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
virtual void prepare_specific_output(Input::Record in_rec)
RegionSet get_region_set(const std::string &set_name) const
const FEValuesViews::Vector< spacedim > & vector_view(unsigned int i) const
Accessor to vector values of multicomponent FE.
arma::Col< IntIdx > LocDofVec
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()
#define MessageOut()
Macro defining 'message' record of log.
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)
std::vector< int > velocity_mask
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...
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.
void compute_l2_difference()
Fields computed from the mesh data.
Cell accessor allow iterate over DOF handler cells.
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
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
const TimeStep & step(int index=-1) const
Mixed-hybrid model of linear Darcy flow, possibly unsteady.
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.)
std::shared_ptr< OutputTime > output_stream
NodeAccessor< 3 > node(unsigned int ni) const
Field< 3, FieldValue< 3 >::Scalar > pressure_diff
static unsigned int oposite_node(unsigned int sid)
Symmetric Gauss-Legendre quadrature formulae on simplices.
arma::vec::fixed< spacedim > centre() const
Computes the barycenter.
Field< 3, FieldValue< 3 >::Scalar > velocity_diff
void open_stream(Stream &stream) 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.
OutputFields output_fields
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.
unsigned int n_sides() const
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.
DarcyFlowMHOutput(DarcyFlowInterface *flow, Input::Record in_rec)
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm) const
Field< 3, FieldValue< 3 >::Scalar > div_diff
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.
void output_internal_flow_data()
std::vector< FEValues< 3 > > fe_values
Dedicated class for storing path to input and output files.
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.
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)
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)
bool set_time(const TimeStep &time, LimitSide limit_side)
Definitions of particular quadrature rules on simplices.
#define WarningOut()
Macro defining 'warning' record of log.
FieldCommon & name(const string &name)
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)
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...
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...
Class for representation SI units of Fields.
arma::vec::fixed< spacedim > point(const unsigned int point_no)
Return coordinates of the quadrature point in the actual cell system.
static UnitSI & dimensionless()
Returns dimensionless unit.
#define DebugOut()
Macro defining 'debug' record of log.
unsigned int idx() const
Return local idx of element in boundary / bulk part of element vector.
virtual ~DarcyFlowMHOutput()
std::vector< FEValues< 3 > > mixed_fe_values(QGauss::array &quadrature, MixedPtr< FiniteElement > fe, UpdateFlags flags)
std::vector< IntersectionLocal< 1, 2 > > intersection_storage12_
Stores 1D-2D intersections.
unsigned int n_points() const
Returns the number of quadrature points.
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.