19 quadrature_(*(data->mesh)),
20 slave_ac_(data->mh_dh)
25 for(
uint row_dim=0; row_dim<4; row_dim ++)
26 for(
uint col_dim=0; col_dim<4; col_dim ++) {
28 row_avg.fill(1.0 / (row_dim+1));
30 col_avg.fill(1.0 / (col_dim+1));
51 for(
unsigned int i_side=0; i_side < ele_ac.
n_sides(); i_side++ ) {
63 double bc_pressure =
data_->bc_pressure.value(b_ele.
centre(), b_ele);
107 if (master_ac.
dim() > 2)
return;
109 if (isec_list.size() == 0)
return;
115 double m_sigma =
data_->sigma.value( ele_centre, ele);
116 double m_conductivity =
data_->conductivity.value( ele_centre, ele);
117 double m_crossection =
data_->cross_section.value( ele_centre, ele );
119 double master_sigma = 2*m_sigma*m_conductivity *
136 double cs_sqr_avg = 0.0;
137 double isec_sum = 0.0;
139 for(; i < isec_list.size(); ++i) {
143 if (! non_zero)
continue;
148 cs_sqr_avg += cs*cs*isec_measure;
149 isec_sum += isec_measure;
154 if( fabs(isec_sum - ele.
measure()) > 1E-5) {
156 for(
auto & isec : isec_list) {
172 master_sigma = master_sigma * (cs_sqr_avg / isec_sum)
181 if (i < isec_list.size()) {
184 for(; i < isec_list.size(); ++i) {
188 isec_sum += isec_measure;
194 master_sigma = 100 * m_conductivity/ m_crossection / isec_sum;
205 for(
IsecData &col_ele : isec_data_list) {
208 double s = -scale * row_ele.delta * col_ele.delta;
214 for(
uint i=0; i< row_ele.n_dirichlet; i++)
240 double * solution =
data_->lin_sys->get_solution_array();
241 for(
uint icol=0; icol < n_cols; icol++ ) pressure[icol] = solution[col_ele.
dofs[icol]];
244 for(
uint irow=0; irow < n_rows; irow++ ) solution[row_ele.
vel_dofs[irow]] += add_velocity[irow] ;
249 for(
unsigned int i_side=0; i_side < ele_ac.
n_sides(); i_side++ ) {
250 dofs[shift+i_side] = ele_ac.
edge_row(i_side);
259 dofs[shift + i_side] = -dofs[shift + i_side];
260 double bc_pressure =
data_->bc_pressure.value(b_ele.
centre(), b_ele);
261 dirichlet[shift + i_side] = bc_pressure;
const arma::vec3 centre() const
void set_solution_col(uint loc_col, double solution)
const arma::mat & get_matrix()
const arma::vec & get_rhs()
void add_to_linsys(double scale)
void set_matrix(arma::mat matrix)
void reinit(uint loc_ele_idx)
ElementAccessor< 3 > element_accessor()
Wrappers for linear systems based on MPIAIJ and MATIS format.
std::string format(CStringRef format_str, ArgList args)
std::shared_ptr< DarcyMH::EqData > AssemblyDataPtr
void add_sides(LocalElementAccessorBase< 3 > ele_ac, unsigned int shift, vector< int > &dofs, vector< double > &dirichlet)
std::vector< std::vector< ILpair > > element_intersections_
bool reinit(const IntersectionLocalBase *isec)
SideIter side(const unsigned int loc_index)
void pressure_diff(LocalElementAccessorBase< 3 > ele_ac, double delta)
IntersectionQuadratureP0 quadrature_
void assembly(LocalElementAccessorBase< 3 > ele_ac)
MixedMeshIntersections & mixed_mesh_
void fix_velocity_local(const IsecData &row_ele, const IsecData &col_ele)
void assembly(LocalElementAccessorBase< 3 > ele_ac)
P0_CouplingAssembler(AssemblyDataPtr data)
arma::vec::fixed< spacedim > centre() const
Computes the barycenter.
LocalSystem::DofVec vel_dofs
bool is_boundary() const
Returns true for side on the boundary.
void reset()
Resets the matrix, RHS, dofs to zero and clears solution settings.
double measure() const
Computes the measure of the element.
LocalElementAccessorBase< 3 > slave_ac_
LocalSystem::DofVec dirichlet_dofs
arma::mat & tensor_average(unsigned int row_dim, unsigned int col_dim)
void set_solution_row(uint loc_row, double solution, double diag=0.0)
std::vector< arma::vec > col_average_
void set_rhs(arma::vec rhs)
#define WarningOut()
Macro defining 'warning' record of log.
vector< IsecData > isec_data_list
unsigned int idx() const
Return local idx of element in boundary / bulk part of element vector.
void eliminate_solution()
ElementAccessor< 3 > element_accessor()