Comments (16)
Hi Thilo,
Thanks for reporting this bug. I did some checking and found a rather deep error that had to do with the inhomogeneous boundary conditions and the non-standard domain sizes you are using. I will push a fix as soon as possible. If you're using the shenfun source code, then you can fix it by replacing this line with scb=sc
.
from shenfun.
I just realised that fixing the bug did not actually fix your code. It just fixed all other problems that used inhomogeneous boundary conditions and non-standard domain. Which may have been a recently introduced bug if you did managed to solve your problem for one of the cases above. I guess I will have to look some more.
from shenfun.
I don't think your variational forms are identical, so I don't understand how you can expect both methods to work?
from shenfun.
For the pure Dirichlet problem both variational forms should be valid because in both cases the boundary integral vanishes as the test function vanishes on the entire boundary.
from shenfun.
But I should be able to derive one from the other, and I can't.
from shenfun.
By use of the divergence theorem I was able to derive one form from the other.
from shenfun.
Hi Mikael,
in the following image I derived the equivalence of the two weak forms. Maybe you could take a look at it. The notation is a little different, I hope that is not a problem.
from shenfun.
Hi Mikael,
do you think that the two forms are equivalent? If you find some time to look into it, please let me know.
from shenfun.
Hi Thilo,
Sorry, forgot about it. There are some issues with your note that I don't believe are correct and I don't really have time to look closely into it. Do you by any chance have a supervisor or someone to discuss these derivations with? For one,
from shenfun.
Hi Mikael,
I discussed the equivalence of the two variational forms with my supervisor and we both agreed that the two forms seem to be equivalent. I have changed the derivation in my comment above to index notation so it is now a bit more readable. If you find some time, I would be grateful if you could take a look at it.
from shenfun.
Hi Thilo,
I'm sorry for having been reluctant to look into this. It's very difficult and timeconsuming to find bugs when the reproducing code is 200 lines, and when it's not even obvious that it is a shenfun issue. However, I did have a look and quickly isolated the problem to the div div terms like inner(lambd*div(u), div(v))
. There was an error in the precomputed matrices, and if you comment out line 1336
#((SD, 1), (SD, 0)): functools.partial(CSDSDmat, scale=-1.),
then it should work for the latest version of shenfun.
Actually, I realised this has deeper roots and will have to be fixed in inner
. So great that you found and reported the error:-)
from shenfun.
Hi Mikael,
first of all thanks for taking the time to review this.
I tried commenting out the line
shenfun/shenfun/legendre/matrices.py
Line 1353 in ddb335c
that you were referring to. However, with the latest version of shenfun I wasn't able to run the test code from my initial comment at all. As far as I can tell the error that I get when running the test code has to do with the inhomogeneous boundary conditions that I am using:
File "/home/student01/Dokumente/Projects/convergence_problem.py", line 61, in <module>
vector_tensor_spaces.append(TensorProductSpace(comm, tuple(tensor_spaces)))
File "/home/student01/Dokumente/Projects/shenfun/shenfun/tensorproductspace.py", line 322, in __init__
base.bc.set_tensor_bcs(base, self)
File "/home/student01/Dokumente/Projects/shenfun/shenfun/tensorproductspace.py", line 1602, in set_tensor_bcs
b_hat = T.forward(b).copy()
File "/home/student01/anaconda3/lib/python3.7/site-packages/mpi4py_fft/mpifft.py", line 73, in __call__
self._xfftn[-1](**kw)
File "/home/student01/Dokumente/Projects/shenfun/shenfun/spectralbase.py", line 1389, in __call__
return self.func(input_array, output_array, **kw)
File "/home/student01/Dokumente/Projects/shenfun/shenfun/spectralbase.py", line 1389, in __call__
return self.func(input_array, output_array, **kw)
File "/home/student01/Dokumente/Projects/shenfun/shenfun/spectralbase.py", line 262, in forward
self.bc.add_mass_rhs(self.forward.output_array)
File "/home/student01/Dokumente/Projects/shenfun/shenfun/tensorproductspace.py", line 1678, in add_mass_rhs
self.set_boundary_dofs(u)
File "/home/student01/Dokumente/Projects/shenfun/shenfun/tensorproductspace.py", line 1718, in set_boundary_dofs
u[self.base.si[-(M)+i]] = self.bcs[i]
File "/home/student01/anaconda3/lib/python3.7/site-packages/sympy/core/expr.py", line 358, in __float__
raise TypeError("can't convert expression to float")
TypeError: can't convert expression to float
If you find some time, please let me know if you can successfully run the script with the latest version of shenfun.
from shenfun.
Well, this looks more like a regular bug:-) I'll check it out.
from shenfun.
With my version of shenfun it runs with:
error (analytical solution): 2.5716607593388476e-16
from shenfun.
Are you using the latest version of shenfun from github? I may have fixed the problem you see quite recently.
from shenfun.
I just cloned the latest version and now it works :) Thanks again!
from shenfun.
Related Issues (20)
- Dx not working with 1D mixed function space HOT 4
- Issue on Stokes equations with doubly periodic boundary conditions. HOT 2
- Error when evaluating derivatives for nonstandard domain HOT 7
- Installation problem: error in "cimport fastgl_wrap" HOT 2
- Old shenfun script for 2D Poisson equation dosn't work with new version HOT 2
- 1d poisson HOT 1
- Bug in FunctionSpace with bc as dictionary HOT 4
- Solve DGL with non-constant (discrete) variable? HOT 5
- AttributeError: 'tuple' object has no attribute 'copy' HOT 1
- Install problem HOT 1
- problems in solving 2D Allen Cahn equation HOT 2
- Two questions in the demo MixedPoisson.py HOT 7
- How to compute the numerical solution on the general points HOT 4
- 1. Solver for multidimensional problem 2. Product with variable coefficients HOT 4
- Two questions about the Legendre-Galerkin method for the Cahn-Hilliard equation HOT 2
- How to compute the integral about the nonlinear term in the Navier-Stokes equation? HOT 2
- How to assemble the right-hand side vector? HOT 3
- Understanding the chebyshev solver in poisson2ND.py HOT 3
- Time dependent boundary conditions in segments for Rayleigh-Benard 2D HOT 2
- Implementing the one-dimensional Kuramoto-Sivashinsky system HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shenfun.