Solving elasticity and laplace(damage) equation, one after the other.

90 views
Skip to first unread message

Wasim Niyaz Munshi ce21d400

unread,
Nov 21, 2022, 5:54:22 AM11/21/22
to deal.II User Group
Hello everyone.

I am trying to solve elasticity and laplace (damage) equations in the same program. The rhs of laplace equation depends on the elasticity solution vector. Both equations have already been solved in step3 and 8. I am following the same approach. I am creating my objects (like triangulation_elasticity, fe_elasticity,dof_handler_elasticity) for elasticity as in step8 and solving the elasticity equation. Everything works fine till this point.


Then I tried to solve the laplace equation using the elasticity solution. I followed step 3 approach and created the corresponding objects(triangulation_damage, fe_damage,dof_handler_damage).

However, I am getting the following error:

An error occurred in line <4310> of file </home/wasim/dealii-candi/tmp/unpack/deal.II-v9.4.0/source/fe/fe_values.cc> in function
    void dealii::FEValues<dim, spacedim>::reinit(const dealii::TriaIterator<dealii::DoFCellAccessor<dim, spacedim, lda> >&) [with bool level_dof_access = false; int dim = 2; int spacedim = 2]
The violated condition was:
    static_cast<const FiniteElementData<dim> &>(*this->fe) == static_cast<const FiniteElementData<dim> &>(cell->get_fe())
Additional information:
    The FiniteElement you provided to FEValues and the FiniteElement that
    belongs to the DoFHandler that provided the cell iterator do not
    match
.

Stacktrace:
-----------
#0  /home/wasim/dealii-candi/deal.II-v9.4.0/lib/libdeal_II.g.so.9.4.0: void dealii::FEValues<2, 2>::reinit<false>(dealii::TriaIterator<dealii::DoFCellAccessor<2, 2, false> > const&)
#1  ./step-200: float step200::PhaseField::H_plus<dealii::TriaActiveIterator<dealii::DoFCellAccessor<2, 2, false> > >(dealii::Vector<double>, dealii::TriaActiveIterator<dealii::DoFCellAccessor<2, 2, false> >, unsigned int)
#2  ./step-200: step200::PhaseField::assemble_system_damage()
#3  ./step-200: step200::PhaseField::damage_mesh()
#4  ./step-200: main
---------------------

It says that in assemble_damage, the finite element provided to fevalues and that of dof_handler are different.
I don't know what this exactly means as I am only creating a single object, FE_Q<2>          fe_damage for solving my damage equation.

Thanks and regards
Wasim

Bruno Turcksin

unread,
Nov 21, 2022, 8:28:04 AM11/21/22
to deal.II User Group
Wasim,

It's hard to say without seeing any code. Are you working with one or two DoFHandler? If you are working with two DoFHandler, are you sure that you are using the correct one?

Best,

Bruno

Paras Kumar

unread,
Nov 21, 2022, 8:35:59 AM11/21/22
to dea...@googlegroups.com
Wasim,

In case, what you do is close to the phase-field fracture model (which is essentially a gradient damage model, and in this case a  one-way coupled one), you might find the following master thesis and the associated code helpful: https://github.com/Jatandeep/Thesis

Best regards,
Paras

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/5f30d3ae-264a-4ff0-ba85-27e6959ecc92n%40googlegroups.com.

Wasim Niyaz Munshi ce21d400

unread,
Nov 21, 2022, 11:08:15 AM11/21/22
to dea...@googlegroups.com
I am working with 2 DoFHandlers. I checked my code. I am using the correct DoFHandlers for the 2 equations.

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "deal.II User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dealii/cV63qxefdTM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dealii+un...@googlegroups.com.

Bruno Turcksin

unread,
Nov 21, 2022, 11:13:49 AM11/21/22
to dea...@googlegroups.com
Wasim,

Before the line that errors out can you do

std::cout<<cell->get_fe().get_name()<<std::endl;

and check that it matches what you have set in FEValues.

Best,

Bruno

Wasim Niyaz Munshi ce21d400

unread,
Nov 21, 2022, 3:27:44 PM11/21/22
to dea...@googlegroups.com
Thank you, Prof. Bruno.

I used the above line of code and realized where I was going wrong. When solving the damage equation, I also call a function (let's call it H). This function is needed to find the element stiffness matrix of the damage equation.
This function returns some value for a  given quadrature point, cell in the damage mesh and the elasticity solution vector. But, this function H computes that quantity by using the fe_elasticity object.
The error, according to me, comes in this line in H function : fe_values_elastic.reinit(cell);
I need to reinit the fe_values_elasticity for each cell, but the problem is that the cell I am passing as an argument lives on the traingulation_damage while fe_values_elasticity lives on triangulation_elasticity.



Bruno Turcksin

unread,
Nov 21, 2022, 3:55:52 PM11/21/22
to dea...@googlegroups.com
Wasim,

Why do you have two different triangulations? Can you have single Triangulation and use FE_Nothing ? For example Step-70 solves two different equations on different parts of the domain using a single Triangulation.

Best,

Bruno

Wasim Niyaz Munshi ce21d400

unread,
Nov 22, 2022, 2:04:34 PM11/22/22
to dea...@googlegroups.com
I want to solve the vector problem (elasticity equation) followed by the scalar problem (Laplace equation) on the entire domain. I was creating 2 triangulations because I wanted 2 dofhandler (one for the scalar problem and one for the vector problem. I wasn't sure if I can associate 2 dofhandlers to the same traingulation). Also, I want to specify different BC's for elasticity and damage on different parts of the boundary(eg. for damage all boundaries might have same bcs but for elasticity different bcs exist at different faces of the square domain).

Bruno Turcksin

unread,
Nov 22, 2022, 3:15:45 PM11/22/22
to dea...@googlegroups.com
You can use two DoFHandler and a single Triangulation. There are no problems. That's actually what I do in my code because it is much simpler to have a single Triangulation to work with. The only trick to know is that you can go from a Triangulation cell to a DoFHandler cell using https://github.com/dealii/dealii/wiki/Frequently-Asked-Questions#can-i-convert-triangulation-cell-iterators-to-dofhandler-cell-iterators This way you an easily go from data on one DoFHandler to data on the other DoFHandler. If you have two different Triangulation, you need to create the mapping yourself.

Bruno

Wolfgang Bangerth

unread,
Nov 25, 2022, 5:14:59 PM11/25/22
to dea...@googlegroups.com
On 11/22/22 13:15, Bruno Turcksin wrote:
> **
>
> You can use two DoFHandler and a single Triangulation. There are no problems.
> That's actually what I do in my code because it is much simpler to have a
> single Triangulation to work with. The only trick to know is that you can go
> from a Triangulation cell to a DoFHandler cell using
> https://github.com/dealii/dealii/wiki/Frequently-Asked-Questions#can-i-convert-triangulation-cell-iterators-to-dofhandler-cell-iterators <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdealii%2Fdealii%2Fwiki%2FFrequently-Asked-Questions%23can-i-convert-triangulation-cell-iterators-to-dofhandler-cell-iterators&data=05%7C01%7CWolfgang.Bangerth%40colostate.edu%7C79d1a2de9ebe45086fd908daccc6575a%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C638047449496842423%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=brrYTMjtw%2FhnlNUB9Rz%2FIc4QRyh7wlLLVMG7IDuTmlA%3D&reserved=0> This way you an easily go from data on one DoFHandler to data on the other DoFHandler.

To augment Bruno's answer: This is also what step-31 does.

Best
W.

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


Reply all
Reply to author
Forward
0 new messages