Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Time-stepping with implicit Euler when solving for two variables simultaneously?

More
4 years 7 months ago - 4 years 7 months ago #1874 by Thauwa
Hello,

I am relatively new to NGSolve, and came of from studying FEniCS.
I am trying to time-step a weak form that involves two coupled PDEs, to solve for two variables, using the implicit Euler method.
To my understanding, in all tutorials and demos on the NGSolve website (section 3.1-3.5), the authors define the mass matrix as the product of the trial and test function. However, how do I define the mass matrix when two variables are solved for?

For example, in this demo: ngsolve.org/docu/latest/i-tutorials/unit...bolic/parabolic.html ,
the authors define a so-called m matrix, from which they define an mstar matrix of same size and sparsity, whose inverse they use in the time-stepping loop. Do I have to define two separate m matrices?

However, it is not clear to me how I would go about working with two trial functions and two test functions.
My weak form is:



and I am hoping to solve for A and B simultaneously using H-curl elements in a 3D cube.

I apologize if the solution to my confusion is trivial, I am still trying to figure NGSolve out. I attempted this using FEniCS by following their tutorial here: fenicsproject.org/pub/tutorial/html/._ftut1010.html (and I made a functional program).

I would appreciate any advice. I understand that my equations might be cryptic and not even be well-posed, but this is mainly an exercise of understanding NGSolve functionality, to me. This is in preparation for research on more-realistic problems.
Last edit: 4 years 7 months ago by Thauwa. Reason: fixed image
More
4 years 7 months ago #1875 by mneunteufel
Hi Thauwa,

in the Navier-Stokes example in the documentation an IMEX scheme with two unknowns is described.

The mass matrices m appear after the time derivative is discretized:
(d/dt A)*dA -> 1/tau*(A-A_old)*dA
yielding the mass matrix A*dA after putting -A_old*dA to the right-hand side and multiplying with tau.

I would recommend doing this on paper and then defining the write BilinearForms and mstar matrix.
Another more quick, but less efficient possibility is to write down the system of equations directly into a BilinearForm and then solve it with Newton's method (which converges after one step for a linear problem).

Attached, you'll find this illustrated using your system of equations (with dummy parameters)

Best,
Michael

File Attachment:

File Name: imp_eul_two_var.py
File Size:1 KB
The following user(s) said Thank You: Thauwa
More
4 years 7 months ago #1888 by Thauwa
Hi Michael,
Thank you so very much for your advice and response!
Time to create page: 0.137 seconds