nonzero natural conditions in 1-D
See original GitHub issueI can’t figure out how to impose nonzero natural conditions on a one-dimensional problem.
Essential conditions are easy, same as in higher dimensions.
Consider u’’ = 0 with u(0) = 0 and u’(1) = 1 so that the exact solution is u = x.
I can solve this as trivially two-dimensional problem (∇v, ∇u) = [v, n . ∇u]|(x=1) = [v, 1]|(x=1):
m = MeshQuad.init_tensor(*(np.linspace(0., 1.),)*2)
e = ElementQuad1()
ib = InteriorBasis(m, e)
fb = FacetBasis(m, e)
@linear_form
def boundary_flux(v, dv, w):
return v * (w.x[0] == 1.)
n = m.p.shape[-1]
L = asm(laplace, ib)
b = asm(boundary_flux, fb)
u, D = ib.find_dofs(lambda x, y: x == 0.)
I = ib.dofnum.complement_dofs(D) # noqa E741
u = np.zeros_like(b)
u[I] = solve(*condense(L, b, I=I)) # noqa E741
but trying the same thing with the minimal modifications to drop the dimension from two to one
m = MeshLine(np.linspace(0., 1.))
e = ElementLineP1()
fails at FacetBasis
with
NotImplementedError: The given mesh type is not supported!
I think that this is merely the proximate cause, raised by get_quadrature
, but on inspection MeshLine
appears incomplete, lacking attributes facets
, t2f
, f2t
.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Heat Equation with Non-Zero Temperature Boundaries
In this section we take a quick look at solving the heat equation in which the boundary conditions are fixed, non-zero temperature.
Read more >Heat equation with non-zero boundary condition
I have the following PDE with initial+boundary conditions: Ut=−Uxx. U(x,0)=0 for x>0 , U(0,t)=1 , U(1,t)=0.
Read more >Nonzero Neumann boundary condition - YouTube
Course materials: https://learning-modules.mit.edu/class/index.html?uuid=/course/16/fa17/16.920.
Read more >Weak form with nonzero Dirichlet boundary condition - YouTube
Course materials: https://learning-modules.mit.edu/class/index.html?uuid=/course/16/fa17/16.920.
Read more >Traveling waves for some nonlocal 1D Gross-Pitaevskii ...
The nonzero boundary condition (1) arises as a background density. This model appears naturally in several areas of quantum physics, for ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I sort of saw these challenges when I reimplemented the 1D support but forgot to do anything about it. Let us try to find a fix so that the implementation is as similar as in higher dimensions.
Closing this after adding some 1D tests.