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.

Plotting two solutions on two domains

More
3 years 11 months ago #2680 by grinver
Hello,

I couldn't find documentation for the following situation, so any feedback is appreciated.

Let's say I have a mesh Omega, divided in two subdomains Omega1 and Omega2. Then I decide to solve for u1 on Omega1 (defining fes1 on material of Omega1) and for u2 on Omega2 (defining fes2 on material of Omega2).
I am able to plot u1 and u2 separately, but I want to be able to plot u1 and u2 at the same time to see their difference at the interface for a convergence scheme I am studying, preferably restricting each solution to its respective subdomain. Is something like this possible?
More
3 years 11 months ago #2681 by mneunteufel
Hi grinver,

assume that u1 lives on the subdomain "left_dom" and u2 on "right_dom". Then you can combine both as one CoefficientFunction by
Code:
u = CoefficientFunction( [u1 if mat == "left_dom" else u2 for mat in mesh.GetMaterials()] ) Draw(u, mesh, "u")

Attached you'll find a minimal example.

Best
Michael

File Attachment:

File Name: plot_two_domains.py
File Size:1 KB
Time to create page: 0.141 seconds