-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convergence troubles #75
Comments
Hi Thilo, |
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. |
I don't think your variational forms are identical, so I don't understand how you can expect both methods to work? |
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. |
But I should be able to derive one from the other, and I can't. |
By use of the divergence theorem I was able to derive one form from the other. |
Hi Mikael, |
Hi Thilo, |
Hi Mikael, |
Hi Thilo,
then it should work for the latest version of 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. |
Well, this looks more like a regular bug:-) I'll check it out. |
With my version of shenfun it runs with:
|
Are you using the latest version of shenfun from github? I may have fixed the problem you see quite recently. |
I just cloned the latest version and now it works :) Thanks again! |
Hi Mikael,
I have been contacting you about half a year ago regarding the use of shenfun for solving problems in linear elasticity and linear gradient elasticity. I am facing some troubles while performing a convergence test with a manufactured solution. To keep it simple, I am only describing the case of standard linear elasticity. I would greatly appreciate it if you could take a look at the code for the problem described below and give us your opinion.
I have derived two different variational formulations for the spectral Galerkin method. The first one is based on the principle of virtual work which reads
Inserting Hooke's Law
yields the variational form
My manufactured solution only contains Dirichlet boundary conditions. Therefore, the test functions vanish on entire boundary and so the boundary integral.
The second variational formulation is based on the Lamé-Navier equations which reads
Through the integration by part the weak form is obtained as
For the manufactured solution (pure Dirichlet problem) the boundary terms again vanishes.
I think that both variational formulations are equivalent for a pure Dirichlet problem. In order to check that both formulations are working in shenfun, I performed a convergence test. I computed the integral error of the numerical w.r.t. the manufactured one. I found that the error goes down to 1e-15 for N=30 basis functions in case of the second version. For the principle of virtual power (first version), however, the error is still around 1e-3.
is working where as the first one does not. Maybe you could take a look at the attached code file and give me your opinion what goes wrong and how it could possibly be fixed.
The reason for considering the first version at all is that I want to study another problem which is not a pure Dirichlet problem. Instead it contains one homogeneous traction boundary condition. In this problem, the boundary integral above also vanishes but the second variational formulation is not correct since the boundary integral does not contain the (physically correct) traction.
The code below should explain the problem. Both variational forms are inplemented in the code.
Best regards,
Thilo
The text was updated successfully, but these errors were encountered: