45 mLeftElectrodeArea(0.0),
46 mRightElectrodeArea(0.0)
49 double magnitude, duration;
53 assert(axis_index < DIM);
71 input_flux = magnitude;
72 output_flux = -input_flux;
78 input_flux = magnitude;
82 assert( ! std::isnan(output_flux));
83 assert( output_flux != 0.0);
96 if (fabs((*iter)->CalculateCentroid()[axis_index] - global_min) < 1e-6)
103 if (fabs((*iter)->CalculateCentroid()[axis_index] - global_max) < 1e-6)
122 if (fabs((*iter).rGetLocation()[axis_index]-global_max) < 1e-6)
129 delete p_bc_flux_out;
176 double local_left_area = 0.0;
177 double local_right_area = 0.0;
179 c_vector<double,DIM> weighted_direction;
180 double jacobian_determinant;
183 = mpMesh->GetBoundaryElementIteratorBegin();
184 iter != mpMesh->GetBoundaryElementIteratorEnd();
187 if (mpMesh->CalculateDesignatedOwnershipOfBoundaryElement((*iter)->GetIndex()))
189 if (fabs((*iter)->CalculateCentroid()[dimensionIndex] - lowerValue) < 1e-6)
191 mpMesh->GetWeightedDirectionForBoundaryElement((*iter)->GetIndex(), weighted_direction, jacobian_determinant);
192 local_left_area += jacobian_determinant;
195 if (fabs((*iter)->CalculateCentroid()[dimensionIndex] - upperValue) < 1e-6)
197 mpMesh->GetWeightedDirectionForBoundaryElement((*iter)->GetIndex(), weighted_direction, jacobian_determinant);
198 local_right_area += jacobian_determinant;
212 local_left_area /= 2.0;
213 local_right_area /= 2.0;
216 int mpi_ret = MPI_Allreduce(&local_left_area, &mLeftElectrodeArea, 1, MPI_DOUBLE, MPI_SUM, PETSC_COMM_WORLD);
218 assert(mpi_ret == MPI_SUCCESS);
220 mpi_ret = MPI_Allreduce(&local_right_area, &mRightElectrodeArea, 1, MPI_DOUBLE, MPI_SUM, PETSC_COMM_WORLD);
221 assert(mpi_ret == MPI_SUCCESS);
223 if (mLeftElectrodeArea != mRightElectrodeArea)
225 EXCEPTION(
"Electrodes have different area");