Negative determinant error with tetrahedrals

33 views
Skip to first unread message

Kumar Saurabh

unread,
Apr 27, 2023, 6:09:42 PM4/27/23
to deal.II User Group
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.
Screenshot 2023-04-27 3.05.21 PM.png

Wolfgang Bangerth

unread,
Apr 27, 2023, 11:16:51 PM4/27/23
to dea...@googlegroups.com

Kumar,
can you come up with a small example that illustrates the problem? We can't
tell where the error might come from without seeing a (complete) piece of code
and an input mesh.

Best
W.

On 4/27/23 16:09, Kumar Saurabh wrote:
> *** Caution: EXTERNAL Sender ***
> --
> The deal.II project is located at http://www.dealii.org/
> <http://www.dealii.org/>
> For mailing list/forum options, see
> https://groups.google.com/d/forum/dealii?hl=en
> <https://groups.google.com/d/forum/dealii?hl=en>
> ---
> You received this message because you are subscribed to the Google Groups
> "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to dealii+un...@googlegroups.com
> <mailto:dealii+un...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/76400cc7-0f27-4f5b-abfb-452b795a51aan%40googlegroups.com <https://groups.google.com/d/msgid/dealii/76400cc7-0f27-4f5b-abfb-452b795a51aan%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/


Reply all
Reply to author
Forward
0 new messages