question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

piecewise-definition of coefficients on subdomains

See original GitHub issue

Consider a Laplace equation with variable coefficient, ∇⋅ (ku) = 0, with k piecewise-constant on ‘regions’ or ‘subdomains’; e.g. steady conduction of heat between two blocks of different thermal conductivity (with no thermal contact resistance).

I think that such problems could also be done with mortar methods (which I see from ex04 are implemented, at least for two-dimensional problems, via InterfaceMesh1D); however, monolithic approaches can be convenient too. The issue here is to assign different values to k depending on which submesh an element belongs to, e.g. as defined in Gmsh as Physical Surface (in two dimensions). Should k be defined with ElementTriP0? And then populated using the cell_data returned by pygmsh.generate_mesh or the .cell_data attribute of the meshio.Mesh returned by meshio.read—I don’t think skfem.mesh.from_meshio currently does this, it only looks for tags on facets, e.g. for mixed boundary conditions.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
kinnalacommented, Nov 10, 2018

Sure, I’ve been actually planning to write a short article on the adaptive finite element solution of problems where we have multiple subdomains with different diffusion coefficients. It might be interesting to compare the standard adaptive approach and adaptive Nitsche coupling: Nitsche might end up in better accuracy with less DOF’s in some specific cases.

My PhD thesis (https://aaltodoc.aalto.fi/handle/123456789/31486) was heavily based on the use of MeshInterface1d but I’m still not happy with the interface, especially when having more than two subdomains. I’ve been planning to address this problem at some point.

1reaction
kinnalacommented, Nov 9, 2018

Yes, I can see why one would like to have all data outputted by meshio accessible.

I propose that we create a single attribute Mesh.external or Mesh.ext which contains all the field data, cell data, etc. of the respective meshio object (e.g. Mesh.ext.cell_data) and where the word external or ext emphasizes that we aim not to document its contents within scikit-fem since it might depend on the format.

Still, I will probably at some point improve the wrapper from_meshio to create Submesh-objects from subdomains since I find them to be convenient regarding my future plans. I’ll probably move the gmsh-specific parts of from_meshio into a separate method at some point.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lesson Explainer: Piecewise Functions
A piecewise function is a function that consists of multiple subfunctions, with each subfunction defined over an interval of the main function's domain,...
Read more >
Coefficient defined by two functions, one for each ...
Coefficient defined by two functions, one for each subdomain (with a piecewise function to identify domains) ... It works, except for nodes that ......
Read more >
Example on piecewise linear finite element functions
This means that the domain is split into subdomains and the function is a ... it means that most of the elements in...
Read more >
Defining efficiently subdomain-dependent expressions
I am implementing the solution to an elliptic PDE for which the diffusion coefficient has a different expression in different subdomains. In ...
Read more >
Plotting a piecewise function with strange subdomains
When q±=0, you get q±log2q±=0⋅(−∞) which is indeterminate. You can define your own function f[x_] := Piecewise[{{x Log[2, x], x > 0}, {0,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found