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 ++) {
27 arma::vec row_avg = arma::vec(row_dim+1);
28 row_avg.fill(1.0 / (row_dim+1));
29 arma::vec col_avg = arma::vec(col_dim+1);
30 col_avg.fill(1.0 / (col_dim+1));
31 arma::mat avg = row_avg * col_avg.t();
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->element_accessor());
116 double m_conductivity =
data_->conductivity.value( ele_centre, ele->element_accessor());
117 double m_crossection =
data_->cross_section.value( ele_centre, ele->element_accessor() );
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) {
161 double diff = (isec_sum - ele->measure())/ele->measure();
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++)
238 arma::vec pressure(n_cols);
239 arma::vec add_velocity(n_rows);
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)
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)
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)
int id()
Returns id of the iterator. See VectorId documentation.
void reset()
Resets the matrix, RHS, dofs to zero and clears solution settings.
LocalElementAccessorBase< 3 > slave_ac_
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.
arma::vec::fixed< spacedim > centre() const
vector< IsecData > isec_data_list
ElementFullIter full_iter()
arma::uvec dirichlet_dofs
void eliminate_solution()
ElementAccessor< 3 > element_accessor()