Go to the documentation of this file.
72 "SPECIAL PURPOSE. Computes error norms of the solution, particulary suited for non-compatible coupling models.")
74 "Output file with raw data from MH module.")
79 "Flow_Darcy_MH_specific",
103 .
description(
"Subdomain ids of the domain decomposition.");
116 .
description(
"Error norm of the pressure solution. [Experimental]");
119 .
description(
"Error norm of the velocity solution. [Experimental]");
122 .
description(
"Error norm of the divergence of the velocity solution. [Experimental]");
139 if (in_rec_specific) {
149 if (in_rec_specific->opt_val(
"raw_flow_output", raw_output_file_path))
155 WarningOut() <<
"Raw output is not available in parallel computation. MPI size: " << mpi_size <<
"\n";
159 MessageOut() <<
"Opening raw flow output: " << raw_output_file_path <<
"\n";
162 }
INPUT_CATCH(FilePath::ExcFileOpen, FilePath::EI_Address_String, (*in_rec_specific))
167 auto fields_array = in_rec_specific->val<
Input::Array>(
"fields");
168 if(fields_array.size() > 0){
201 uint p_elem_component = 1;
282 START_TIMER(
"DarcyFlowMHOutput::output_internal_flow_data");
288 raw_output_file <<
"// fields:\n//ele_id ele_presure flux_in_barycenter[3] n_sides side_pressures[n] side_fluxes[n]\n";
297 eq_fields = d->eq_fields_.get();
298 eq_data = d->eq_data_.get();
304 auto permutation_vec = eq_data->
dh_->mesh()->element_permutations();
305 for (
unsigned int i_elem=0; i_elem<eq_data->
dh_->n_own_cells(); ++i_elem) {
310 std::stringstream ss;
316 for (
unsigned int i = 0; i < 3; i++)
317 ss << flux_in_center[i] <<
" ";
325 for (
unsigned int i = 0; i < ele->
n_sides(); i++) {
328 uint old_opp_node = new_to_old_node[new_opp_node];
329 uint old_iside = ele->
n_sides() - old_opp_node - 1;
330 old_to_new_side[old_iside] = i;
335 for (
unsigned int i = 0; i < ele->
n_sides(); i++) {
336 uint new_lid = ele->
n_sides() + 1 + old_to_new_side[i];
340 for (
unsigned int i = 0; i < ele->
n_sides(); i++) {
341 uint new_iside = old_to_new_side[i];
346 string line = ss.str();
374 unsigned int dim = fe_values.
dim();
388 for (
unsigned int li = 0; li < ele->
n_sides(); li++) {
400 double velocity_diff=0, divergence_diff=0, pressure_diff=0, diff;
404 double mean_x_squared=0;
405 for(
unsigned int i_node=0; i_node < ele->
n_nodes(); i_node++ )
406 for(
unsigned int j_node=0; j_node < ele->
n_nodes(); j_node++ )
408 mean_x_squared += (i_node == j_node ? 2.0 : 1.0) / ( 6 * dim )
409 * arma::dot( *ele.
node(i_node), *ele.
node(j_node));
412 for(
unsigned int i_point=0; i_point < fe_values.
n_points(); i_point++) {
416 analytical = anal_sol.
value(q_point, ele );
417 for(
unsigned int i=0; i< 3; i++) anal_flux[i] = analytical[i+1];
421 for(
unsigned int i_shape=0; i_shape < ele->
n_sides(); i_shape++) {
422 unsigned int oposite_node = 0;
427 default:
ASSERT_PERMANENT(
false)(dim).error(
"Unsupported FE dimension.");
break;
430 diff += fluxes[ i_shape ] *
431 ( arma::dot( q_point, q_point )/ 2
433 - arma::dot( q_point, *ele.
node(oposite_node) )
434 + arma::dot( ele.
centre(), *ele.
node(oposite_node) )
438 diff = - (1.0 / conductivity) * diff / dim / ele.
measure() / cross + pressure_mean ;
439 diff = ( diff - analytical[0]);
440 pressure_diff += diff * diff * fe_values.
JxW(i_point);
444 flux_in_q_point.zeros();
445 for(
unsigned int i_shape=0; i_shape < ele->
n_sides(); i_shape++) {
446 flux_in_q_point += fluxes[ i_shape ]
451 flux_in_q_point -= anal_flux;
452 velocity_diff += dot(flux_in_q_point, flux_in_q_point) * fe_values.
JxW(i_point);
456 for(
unsigned int i_shape=0; i_shape < ele->
n_sides(); i_shape++) diff += fluxes[ i_shape ];
457 diff = ( diff / ele.
measure() / cross - analytical[4]);
458 divergence_diff += diff * diff * fe_values.
JxW(i_point);
467 velocity_data.set( idx, sqrt(velocity_diff) );
474 pressure_data.set( idx, sqrt(pressure_diff) );
478 div_data.set( idx, sqrt(divergence_diff) );
479 result.
div_error[dim-1] += divergence_diff;
485 quad(
QGauss::make_array(order)),
510 for(
unsigned int j=0; j<3; j++){
520 switch (dh_cell.dim()) {
534 for(
unsigned int j=0; j<3; j++){
541 os <<
"l2 norm output\n\n"
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
static std::shared_ptr< OutputTime > create_output_stream(const std::string &equation_name, const Input::Record &in_rec, const std::shared_ptr< TimeUnitConversion > &time_unit_conv)
This method delete all object instances of class OutputTime stored in output_streams vector.
arma::Col< IntIdx > LocDofVec
arma::vec::fixed< spacedim > point(const unsigned int point_no)
Return coordinates of the quadrature point in the actual cell system.
virtual void prepare_specific_output(Input::Record in_rec)
Field< 3, FieldValue< 3 >::Scalar > conductivity
Definitions of Raviart-Thomas finite elements.
void output()
Calculate values for output.
const FEValuesViews::Vector< spacedim > & vector_view(unsigned int i) const
Accessor to vector values of multicomponent FE.
static UnitSI & dimensionless()
Returns dimensionless unit.
unsigned int n_points() const
Returns the number of quadrature points.
std::shared_ptr< DOFHandlerMultiDim > dh_
full DOF handler represents DOFs of sides, elements and edges
bool set_time(const TimeStep &time, LimitSide limit_side)
FieldPython< 3, FieldValue< 3 >::Vector > ExactSolution
DarcyLMH::EqFields * eq_fields_
void initialize(std::shared_ptr< OutputTime > stream, Mesh *mesh, Input::Record in_rec, const TimeGovernor &tg)
std::shared_ptr< TimeUnitConversion > get_unit_conversion() const
Getter for time unit conversion object.
bool is_output_specific_fields
Output specific field stuff.
OutputSpecificFields output_specific_fields
void compute_l2_difference()
double JxW(const unsigned int point_no)
Return the product of Jacobian determinant and the quadrature weight at given quadrature point.
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.
unsigned int dim() const
Return dimension of reference space.
@ update_values
Shape function values.
auto & orig_nodes_order() const
@ update_quadrature_points
Transformed quadrature points.
FieldCommon & flags(FieldFlag::Flags::Mask mask)
Declaration of class which handles the ordering of degrees of freedom (dof) and mappings between loca...
std::string format(CStringRef format_str, ArgList args)
Lumped mixed-hybrid model of linear Darcy flow, possibly unsteady.
void open_stream(Stream &stream) const
std::shared_ptr< OutputTime > output_stream
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.
Field< 3, FieldValue< 3 >::Scalar > cross_section
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.
static const Input::Type::Instance & get_input_type(FieldSet &eq_data, const std::string &equation_name)
std::vector< FEValues< 3 > > mixed_fe_values(QGauss::array &quadrature, MixedPtr< FiniteElement > fe, UpdateFlags flags)
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > div_diff_ptr
OutputFields output_fields
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...
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.
#define ASSERT_PERMANENT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
Specific quantities for output in DarcyFlowMH - error estimates etc.
Definitions of particular quadrature rules on simplices.
MortarMethod mortar_method_
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > vel_diff_ptr
void set(FieldBasePtr field, double time, std::vector< std::string > region_set_names={"ALL"})
Field< 3, FieldValue< 3 >::Scalar > velocity_diff
const TimeStep & step(int index=-1) const
Field< 3, FieldValue< 3 >::Scalar > div_diff
const ElementAccessor< 3 > elm() const
Return ElementAccessor to element of loc_ele_idx_.
static auto subdomain(Mesh &mesh) -> IndexField
Class for representation SI units of Fields.
std::vector< FEValues< 3 > > fv_rt
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()
DarcyFlowMHOutput(DarcyFlowInterface *flow, Input::Record in_rec)
static const Input::Type::Instance & get_input_type_specific()
Container for various descendants of FieldCommonBase.
unsigned int n_dofs() const
Return number of dofs on given cell.
void output_internal_flow_data()
NodeAccessor< 3 > node(unsigned int ni) const
unsigned int input_id() const
Return the element ID in the input mesh. Should be only used for special output.
virtual const Value::return_type & value(const Point &p, const ElementAccessor< spacedim > &elm) const
Symmetric Gauss-Legendre quadrature formulae on simplices.
static auto region_id(Mesh &mesh) -> IndexField
ofstream raw_output_file
Raw data output file.
void output(TimeStep step)
Field< 3, FieldValue< 3 >::VectorFixed > field_ele_velocity
std::vector< IntersectionLocal< 1, 2 > > intersection_storage12_
Stores 1D-2D intersections.
struct DarcyFlowMHOutput::DiffData diff_data
unsigned int n_sides() const
Cell accessor allow iterate over DOF handler cells.
std::vector< int > velocity_mask
Global macros to enhance readability and debugging, general constants.
std::vector< FEValues< 3 > > fe_values
void set_mesh(const Mesh &mesh)
#define WarningOut()
Macro defining 'warning' record of log.
DarcyFlowInterface * darcy_flow
MixedPtr< FE_P_disc > fe_p0
bool compute_errors_
Specific experimental error computing.
Mixed-hybrid model of linear Darcy flow, possibly unsteady.
@ update_JxW_values
Transformed quadrature weights.
const Input::Type::Instance & make_output_type_from_record(Input::Type::Record &in_rec, const string &equation_name, const string &aditional_description="")
LocDofVec get_loc_dof_indices() const
Returns the local indices of dofs associated to the cell on the local process.
virtual const Value::return_type & value(const Point &p, const ElementAccessor< spacedim > &elm)
unsigned int idx() const
We need this method after replacing Region by RegionIdx, and movinf RegionDB instance into particular...
UpdateFlags
Enum type UpdateFlags indicates which quantities are to be recomputed on each finite element cell.
std::shared_ptr< SubDOFHandlerMultiDim > dh_
double get(unsigned int pos) const
Return value on given position.
void reinit(const ElementAccessor< spacedim > &cell)
Update cell-dependent data (gradients, Jacobians etc.)
Field< 3, FieldValue< 3 >::Scalar > subdomain
void set_python_field_from_file(const FilePath &file_name, const string &func_name)
virtual ~DarcyFlowMHOutput()
unsigned int n_elements() const
FieldCommon & description(const string &description)
DarcyLMH::EqData * eq_data_
MixedMeshIntersections & mixed_intersections()
#define DebugOut()
Macro defining 'debug' record of log.
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR) only for debug mode.
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.
#define START_TIMER(tag)
Starts a timer with specified tag.
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.