- Thank you received: 0
Plotting two solutions on two domains
4 years 6 months ago #2680
by grinver
Plotting two solutions on two domains was created 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?
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?
- mneunteufel
- Offline
- Premium Member
Less
More
- Thank you received: 59
4 years 6 months ago #2681
by mneunteufel
Replied by mneunteufel on topic Plotting two solutions on two domains
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
Attached you'll find a minimal example.
Best
Michael
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
Attachments:
Time to create page: 0.100 seconds