SOS - UNABLE to complete coding assignment 1 of Coursera - problems with UMFPACK - sparsity issues

90 views
Skip to first unread message

Jordi Parra Porcar

unread,
Dec 27, 2019, 8:01:09 PM12/27/19
to deal.II User Group
Dear all,

I am new to this group. I wanted to ask for some help as I am unable to find the solution to a problem.
I am following a course in Coursera called "The Finite Element Method for problems in physics". The course first assignment it is about coding with dealii.
I have posted in the Coursera forum but got no answer so, I am trying by here just to see if I am lucky and someone give me a hand.
The issue that I have is that I can only solve the problem with 1st order basis functions as with quadratic and cubic basis functions it gives me an error related with the K global matrix.
I have been going around discussions but still unable to find where is the problem. I checked my basis functions and its gradients and seem to be correct.
I uploaded all the files related to the problem. Now the ./main executes the problem=1 with order=1, that is the linear basis function.

Thank you all in advance and happy ending of the year!

Jordi,
CMakeCache.txt
CMakeLists.txt
FEM1.h
Makefile
cmake_install.cmake
main1
main1.cc
writeSolutions.h
_b66323d90964cccb91c92f77bcb02ab0_codingAssign1.pdf

Jean-Paul Pelteret

unread,
Dec 29, 2019, 4:29:11 PM12/29/19
to dea...@googlegroups.com
Dear Jordi,

Firstly, welcome to the forum. Well, as this is a course assignment I think that its fair to assume that some course mentor should be available to guide you toward the solution to the problem. You say that you’ve had no luck on the course site forum — that’s a bit poor. Anyway, I wouldn’t want to give away the answer, but after skimming through your code and seeing your comment that 

I checked my basis functions and its gradients and seem to be correct

I would say that you’re looking in the right sorts of places for the problem. Remember that in the finite element method we use basis functions to approximate the solution, and these need to evaluated in certain places where we form approximations for certain calculations. You’ve seem to have the “evaluated” part sorted, but what about the other part? What might need to change when you move from linear to higher order shape functions in order to ensure that those approximate calculations are performed accurately?

I hope that my somewhat cryptic response will give you a nudge in the right direction. Oh, and I also hope that you take a look at our tutorial programs sometime to see how we typically code up FEM problems. It’s good to get a hand on the basics, but you might be pleased to know that the deal.II library does most of this for you in a clean and easy to understand manner.

Best,
Jean-Paul

--
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/5a12993f-9687-4b5a-9ad5-e4711e49f6a4%40googlegroups.com.
<CMakeCache.txt><CMakeLists.txt><FEM1.h><Makefile><cmake_install.cmake><main1><main1.cc><writeSolutions.h><_b66323d90964cccb91c92f77bcb02ab0_codingAssign1.pdf>

curr...@gmail.com

unread,
Dec 30, 2019, 5:13:56 AM12/30/19
to dea...@googlegroups.com

Hello Jordi:

 

I also joined "The Finite Element Method for problems in physics" in Coursera and I had the same problem. I solved it switching back to version 8.2.1 of deal.II library. With version 8.5.0, the latest available at that time, it did not work fine. I don’t know the root cause.

 

I also think there is a mentoring problem with this particular course; a new video should have been posted to clarify the changes required to make the assignment work with the current versions of deal.II.

 

Nevertheless I still think "The Finite Element Method for problems in physics" in Coursera is highly recommendable.

 

Best wishes for 2020.

 

Curro Trigo

Curro Trigo

unread,
Dec 30, 2019, 5:31:15 AM12/30/19
to deal.II User Group

Hello Jordi:

 

I also joined "The Finite Element Method for problems in physics" in Coursera and I had similar problems. I worked them around by switching back to version 8.2.1 of deal.II library. With version 8.5.0, the latest available at that time, it did not work fine. I don’t know the root cause.

 

I also think there is a mentoring problem with this particular course; a new video should have been posted to clarify the changes required to make the assignment work with the current versions of deal.II.

 

Nevertheless I still think "The Finite Element Method for problems in physics" in Coursera is highly recommendable.

 

Best wishes for 2020.

 

Curro Trigo


On Sunday, December 29, 2019 at 10:29:11 PM UTC+1, Jean-Paul Pelteret wrote:
Dear Jordi,

Firstly, welcome to the forum. Well, as this is a course assignment I think that its fair to assume that some course mentor should be available to guide you toward the solution to the problem. You say that you’ve had no luck on the course site forum — that’s a bit poor. Anyway, I wouldn’t want to give away the answer, but after skimming through your code and seeing your comment that 

I checked my basis functions and its gradients and seem to be correct

I would say that you’re looking in the right sorts of places for the problem. Remember that in the finite element method we use basis functions to approximate the solution, and these need to evaluated in certain places where we form approximations for certain calculations. You’ve seem to have the “evaluated” part sorted, but what about the other part? What might need to change when you move from linear to higher order shape functions in order to ensure that those approximate calculations are performed accurately?

I hope that my somewhat cryptic response will give you a nudge in the right direction. Oh, and I also hope that you take a look at our tutorial programs sometime to see how we typically code up FEM problems. It’s good to get a hand on the basics, but you might be pleased to know that the deal.II library does most of this for you in a clean and easy to understand manner.

Best,
Jean-Paul
On 28 Dec 2019, at 02:01, Jordi Parra Porcar <jordipar...@gmail.com> wrote:

Dear all,

I am new to this group. I wanted to ask for some help as I am unable to find the solution to a problem.
I am following a course in Coursera called "The Finite Element Method for problems in physics". The course first assignment it is about coding with dealii.
I have posted in the Coursera forum but got no answer so, I am trying by here just to see if I am lucky and someone give me a hand.
The issue that I have is that I can only solve the problem with 1st order basis functions as with quadratic and cubic basis functions it gives me an error related with the K global matrix.
I have been going around discussions but still unable to find where is the problem. I checked my basis functions and its gradients and seem to be correct.
I uploaded all the files related to the problem. Now the ./main executes the problem=1 with order=1, that is the linear basis function.

Thank you all in advance and happy ending of the year!

Jordi,

--
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 dea...@googlegroups.com.

Brandon Gleeson

unread,
Dec 30, 2019, 9:00:56 PM12/30/19
to deal.II User Group
Hi Jordi,


I took that course last year, and also had some troubles with the first coding assignment. As Curro mentioned, there was an update to deal.ii after the course was created that could affect the results for the 3rd order solution.  It had to do with a change in spacing of the quadrature points from equidistant to Gauss-Lobatto for orders > 2.  If you're also having trouble with the 2nd order problem, that would suggest you have another issue to sort out (looks like Jean-Paul gave you some feedback to help), but I wanted to point you to this thread deeper within the Coursera forums that helped me out in the end, as I was using a later release of deal.ii: Coursera Forum Link - Programming Assignment: Coding Assignment 1  .

The first assignment was by far the most difficult & time consuming, the remaining ones got easier each time.   I thought it was a great course and learned a lot!

Good Luck!
Brandon






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

Jordi Parra Porcar

unread,
Jan 3, 2020, 1:28:47 PM1/3/20
to deal.II User Group
Hello Jean-Paul,

Thanks in advance for your time answering my question, unfortunately I have been unable to understand what do you mean in your somewhat criptic explanation :(. I was thinking about something wrong with the implication of the Jacobian in the basis gradients but, for 1d and 2d this has not to be affecting due to the same spacing between nodes. Can you somehow "decript" your answer a little bit, I am really struggling with this assignment XD

Kind regards and thanks again!

On Sunday, 29 December 2019 16:29:11 UTC-5, Jean-Paul Pelteret wrote:
Dear Jordi,

Firstly, welcome to the forum. Well, as this is a course assignment I think that its fair to assume that some course mentor should be available to guide you toward the solution to the problem. You say that you’ve had no luck on the course site forum — that’s a bit poor. Anyway, I wouldn’t want to give away the answer, but after skimming through your code and seeing your comment that 

I checked my basis functions and its gradients and seem to be correct

I would say that you’re looking in the right sorts of places for the problem. Remember that in the finite element method we use basis functions to approximate the solution, and these need to evaluated in certain places where we form approximations for certain calculations. You’ve seem to have the “evaluated” part sorted, but what about the other part? What might need to change when you move from linear to higher order shape functions in order to ensure that those approximate calculations are performed accurately?

I hope that my somewhat cryptic response will give you a nudge in the right direction. Oh, and I also hope that you take a look at our tutorial programs sometime to see how we typically code up FEM problems. It’s good to get a hand on the basics, but you might be pleased to know that the deal.II library does most of this for you in a clean and easy to understand manner.

Best,
Jean-Paul
On 28 Dec 2019, at 02:01, Jordi Parra Porcar <jordipar...@gmail.com> wrote:

Dear all,

I am new to this group. I wanted to ask for some help as I am unable to find the solution to a problem.
I am following a course in Coursera called "The Finite Element Method for problems in physics". The course first assignment it is about coding with dealii.
I have posted in the Coursera forum but got no answer so, I am trying by here just to see if I am lucky and someone give me a hand.
The issue that I have is that I can only solve the problem with 1st order basis functions as with quadratic and cubic basis functions it gives me an error related with the K global matrix.
I have been going around discussions but still unable to find where is the problem. I checked my basis functions and its gradients and seem to be correct.
I uploaded all the files related to the problem. Now the ./main executes the problem=1 with order=1, that is the linear basis function.

Thank you all in advance and happy ending of the year!

Jordi,

--
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 dea...@googlegroups.com.

Jordi Parra Porcar

unread,
Jan 3, 2020, 1:34:02 PM1/3/20
to deal.II User Group
Hello Curro,

Thank you for answering, yes I agree with you about the clarifying videos... However I also get error for quadratic basis functions and the nodes are equally spaced in this case,

Kind regards,

Jordi,

To unsubscribe from this group and stop receiving emails from it, send an email to dea...@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/5a12993f-9687-4b5a-9ad5-e4711e49f6a4%40googlegroups.com.
<CMakeCache.txt><CMakeLists.txt><FEM1.h><Makefile><cmake_install.cmake><main1><main1.cc><writeSolutions.h><_b66323d90964cccb91c92f77bcb02ab0_codingAssign1.pdf>

--
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 dea...@googlegroups.com.

Jordi Parra Porcar

unread,
Jan 3, 2020, 1:36:01 PM1/3/20
to deal.II User Group
Hello Brandon,

Thank you for answering, I will take in account your suggestions when I will arrive to the third order shape functions part,

Kind regards,

Jordi,
To unsubscribe from this group and stop receiving emails from it, send an email to dea...@googlegroups.com.

To view this discussion on the web visit

Jean-Paul Pelteret

unread,
Jan 3, 2020, 5:26:34 PM1/3/20
to dea...@googlegroups.com
Hi Jordi,

Well, Brandon actually provided you with the key phrase that I was hinting towards. This element of the code looks in order for linear basis functions. However, it looks to me like there's actually a set of comments in your code that suggests/indicates that you’ve not completed something that is relevant when using higher order basis functions. It is presumably this that renders your system matrix non-invertible when using quadratic or cubic basis functions, which is what UMFPack is complaining about when this message (which I presume is the one that you see) is emitted

$ make run
Scanning dependencies of target main1
[ 33%] Building CXX object CMakeFiles/main1.dir/main1.cc.o
[ 66%] Linking CXX executable main1
[ 66%] Built target main1
[100%] Run main1 with Debug configuration
   Number of active elems:       2
   Number of degrees of freedom: 5


----------------------------------------------------
Exception on processing:

--------------------------------------------------------
An error occurred in line <291> of file <path/dealii/source/lac/sparse_direct.cc> in function
    void dealii::SparseDirectUMFPACK::factorize(const Matrix &) [Matrix = dealii::SparseMatrix<double>]
The violated condition was:
    status == UMFPACK_OK
Additional information:
    UMFPACK routine umfpack_dl_numeric returned error status 1.

A complete list of error codes can be found in the file <bundled/umfpack/UMFPACK/Include/umfpack.h>.

That said, the two most common errors that can happen are that your matrix cannot be factorized because it is rank deficient, and that UMFPACK runs out of memory because your problem is too large.

The first of these cases most often happens if you forget terms in your bilinear form necessary to ensure that the matrix has full rank, or if your equation has a spatially variable coefficient (or nonlinearity) that is supposed to be strictly positive but, for whatever reasons, is negative or zero. In either case, you probably want to check your assembly procedure. Similarly, a matrix can be rank deficient if you forgot to apply the appropriate boundary conditions. For example, the Laplace equation without boundary conditions has a single zero eigenvalue and its rank is therefore deficient by one.

The other common situation is that you run out of memory. On a typical laptop or desktop, it should easily be possible to solve problems with 100,000 unknowns in 2d. If you are solving problems with many more unknowns than that, in particular if you are in 3d, then you may be running out of memory and you will need to consider iterative solvers instead of the direct solver employed by UMFPACK.

You can also take a look at the first 8-10 paragraphs of this section of a tutorial
which may also give you some further insights into where (I think) you’re going wrong. 

Good luck!
Jean-Paul

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/f7bfa8a0-6c68-4e91-bc48-7170f37f5934%40googlegroups.com.

Jordi Parra Porcar

unread,
Jan 3, 2020, 6:16:45 PM1/3/20
to deal.II User Group
Thanks Jean-Paul,

To be honest I start thinking that starting this Coursera course was a mistake. The majority of the questions have no answer, people asking many times and no answer... that a pitty!, this assignment has already turned into something personal indeed XD. So far I have been able to exchange some mails with professor Garikipati but, otherwise my questions would simply left without answer in the course forum. It seems to me I am the only one following this course nowadays XD. anyway... I really appreaciate that you use some time to asnwer me :) actually I have other questions that I posted in the Coursera forum, I will give some time to Prof. Garikipati to answer but, looks that there should me some "course moderators", I do not understand it. If I do not get some answers from coursera could I ask you something else regarding this coding assignment? it is just I have some other doubts... anyway Jean-Paul, thank you in advance!

Jordi,

Wolfgang Bangerth

unread,
Jan 6, 2020, 2:52:56 PM1/6/20
to dea...@googlegroups.com
On 1/3/20 4:16 PM, Jordi Parra Porcar wrote:
>
> To be honest I start thinking that starting this Coursera course was a
> mistake. The majority of the questions have no answer, people asking many
> times and no answer... that a pitty!, this assignment has already turned into
> something personal indeed XD. So far I have been able to exchange some mails
> with professor Garikipati but, otherwise my questions would simply left
> without answer in the course forum. It seems to me I am the only one following
> this course nowadays XD. anyway... I really appreaciate that you use some time
> to asnwer me :) actually I have other questions that I posted in the Coursera
> forum, I will give some time to Prof. Garikipati to answer but, looks that
> there should me some "course moderators", I do not understand it. If I do not
> get some answers from coursera could I ask you something else regarding this
> coding assignment? it is just I have some other doubts... anyway Jean-Paul,
> thank you in advance!

Jordi,
I think we all regret what you state above. But just as a point of
clarification: None of the principal developers (or anyone else who typically
answers questions here) have anything to do with the Coursera course. We can
of course help with deal.II-specific questions, but we don't know the course
materials nor the assignments.

Best
W.

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

Jean-Paul Pelteret

unread,
Jan 7, 2020, 5:18:46 PM1/7/20
to dea...@googlegroups.com
Hi Jordi,

Indeed, it is as Wolfgang says. Unfortunately none of the developers know this course, or how to what extent deal.II is used in it. It was good timing that I was able to help you out during the vacation period (and you’re most welcome for that, if it did assist you), but time is limited for me and, I guess, the other developers. I choose to devote whatever time resources I have to the user group so, as Wolfgang stated, any deal.II specific questions are welcome and we’ll strive to answer them. But it’s simply not possible (for me, at least) to answer questions here, continue to contribute code to the project, and carry about one's daily business. You can of course continue to engage with the community, as its clear that there are some other people that use deal.II and have done this course. But please keep in mind that we do have a set of guidelines for the nature of the discussion that we like to see on our forum.

I know that’s not the answer that you were hoping for, but I’d guess that its one that you’re not too surprised to hear — sorry about that. But I hope that you endeavour to carry on with the course and work through the coding tasks. Best of luck with it all.

Jean-Paul


--
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/a1958ede-cae0-5ef0-1c80-19a00a5be480%40colostate.edu.

Jordi Parra Porcar

unread,
Jan 8, 2020, 7:19:32 PM1/8/20
to deal.II User Group
Hello Prof. Wolfgang,

I understand the point, I will better go through the dealii tutorials and gain insight from the beginning,

Thanks for the time,

Jordi,

Jordi Parra Porcar

unread,
Jan 8, 2020, 7:20:48 PM1/8/20
to deal.II User Group
Hello Jean-Paul,

I understand it. Nevertheless thank you very much for your time,

Jordi,
Jean-Paul


To unsubscribe from this group and stop receiving emails from it, send an email to dea...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages