When I am trying to use the linear basis function with tetrahedral elements, the code keeps on crashing with the following error:
An error occurred in line <1236> of file </home/maksbh/work/dealii-9.4.1/source/fe/mapping_fe.cc> in function
dealii::CellSimilarity::Similarity dealii::MappingFE<dim, spacedim>::fill_fe_values(const typename dealii::Triangulation<dim, spacedim>::cell_iterator&, dealii::CellSimilarity::Similarity, const dealii::Quadrature<dim>&, const typename dealii::Mapping<dim, spacedim>::InternalDataBase&, dealii::internal::FEValuesImplementation::MappingRelatedData<dim, spacedim>&) const [with int dim = 3; int spacedim = 3; typename dealii::Triangulation<dim, spacedim>::cell_iterator = dealii::TriaIterator<dealii::CellAccessor<3, 3> >; typename dealii::Mapping<dim, spacedim>::InternalDataBase = dealii::Mapping<3, 3>::InternalDataBase]
The violated condition was:
det > 1e-12 * Utilities::fixed_power<dim>( cell->diameter() / std::sqrt(double(dim)))
Additional information:
The image of the mapping applied to cell with center [4.0125e-07
2.34e-06 1.0973e-06] is distorted. The cell geometry or the mapping
are invalid, giving a non-positive volume fraction of -5.07249e-21 in
quadrature point 0.
The error is coming from these lines in maping_fe.cc
if (dim == spacedim)
{
const double det = data.contravariant[point].determinant();
// check for distorted cells.
// TODO: this allows for anisotropies of up to 1e6 in 3D and
// 1e12 in 2D. might want to find a finer
// (dimension-independent) criterion
Assert(det >
1e-12 * Utilities::fixed_power<dim>(
cell->diameter() / std::sqrt(double(dim))),
(typename Mapping<dim, spacedim>::ExcDistortedMappedCell(
cell->center(), det, point)));
output_data.JxW_values[point] = weights[point] * det;
}
I am getting the value of det as negative (see attached screenshot). I am not sure why this error coming as I have made sure that the determinant of all the cells is positive by computing the volume of tetrahedron and its orientation seems to be correct.