- Thank you received: 0
Behaviour of TensorProductFESpace
- JanWesterdiep
- Topic Author
- Offline
- Junior Member
Less
More
5 years 1 month ago - 5 years 1 month ago #1956
by JanWesterdiep
Behaviour of TensorProductFESpace was created by JanWesterdiep
Hello!
I am building a spacetime formulation of the heat equation, on a tensor product "prism"-like mesh (simplices in space, intervals in time). For now, I am focussing on 1+1 and 1+2 dimensions.
I found some (mostly undocumented) files regarding tensor product meshes and -FEspaces in the directory "ngsolve/py_tutorials/TensorProduct". However, whenever I try to use these objects, I get very unexpected behaviour.
First example, where the mesh on Y is just 1-dimensional (as opposed to 1+2-dimensional as I was hoping) and the matrix A contains far less nonzero entries than what I had expected:
Secondly, when I create a compound FESpace from these TensorProductFESpace's (or even just *one*), I get segfaults:
Lastly, when I use this compound FESpace "as intended", I get an error indicating "not implemented":
Is there any way I can get around this, maybe by *not* using a TensorProductFESpace, but rather specifying the FESpace (L2 in the time-direction, H1 in the space-direction) on the tensorproduct mesh directly?
I am building a spacetime formulation of the heat equation, on a tensor product "prism"-like mesh (simplices in space, intervals in time). For now, I am focussing on 1+1 and 1+2 dimensions.
I found some (mostly undocumented) files regarding tensor product meshes and -FEspaces in the directory "ngsolve/py_tutorials/TensorProduct". However, whenever I try to use these objects, I get very unexpected behaviour.
First example, where the mesh on Y is just 1-dimensional (as opposed to 1+2-dimensional as I was hoping) and the matrix A contains far less nonzero entries than what I had expected:
Code:
from ngsolve import Mesh, x, y, GridFunction, H1
from netgen.geom2d import unit_square
from ngsolve.TensorProductTools import *
from ngsolve.comp import *
import scipy.sparse as sp
time_mesh = Mesh(SegMesh(20, 0, 1))
space_mesh = Mesh(unit_square.GenerateMesh(maxh=0.1))
Y = TensorProductFESpace([L2(time_mesh), H1(space_mesh)])
A = BilinearForm(Y)
u, v = Y.TnT()
A += u * v * dx
A.Assemble()
Amat = sp.csr_matrix(A.mat.CSR())
print(Amat.nnz)
print(Y.mesh.dim)
Draw(Y.mesh)
Secondly, when I create a compound FESpace from these TensorProductFESpace's (or even just *one*), I get segfaults:
Code:
from ngsolve import Mesh, x, y, GridFunction, H1
from netgen.geom2d import unit_square
from ngsolve.TensorProductTools import *
from ngsolve.comp import *
import scipy.sparse as sp
time_mesh = Mesh(SegMesh(20, 0, 1))
space_mesh = Mesh(unit_square.GenerateMesh(maxh=0.1))
Y = TensorProductFESpace([L2(time_mesh), H1(space_mesh)])
compound_fes = FESpace([Y])
A = BilinearForm(Y)
u, v = Y.TnT()
A += u * v * dx
A.Assemble()
Lastly, when I use this compound FESpace "as intended", I get an error indicating "not implemented":
Code:
from ngsolve import Mesh, x, y, GridFunction, H1
from netgen.geom2d import unit_square
from ngsolve.TensorProductTools import *
from ngsolve.comp import *
import scipy.sparse as sp
time_mesh = Mesh(SegMesh(20, 0, 1))
space_mesh = Mesh(unit_square.GenerateMesh(maxh=0.1))
Y = TensorProductFESpace([L2(time_mesh), H1(space_mesh)])
compound_fes = FESpace([Y])
A = BilinearForm(compound_fes)
(u, ), (v, ) = compound_fes.TnT()
A += u * v * dx
A.Assemble()
$ netgen mwe.py
<snip>
catch in AssembleBilinearform 2: 4 not implemented
Traceback (most recent call last):
File "<string>", line 15, in <module>
netgen.libngpy._meshing.NgException: 4 not implementedin Assemble BilinearForm 'biform_from_py'
Is there any way I can get around this, maybe by *not* using a TensorProductFESpace, but rather specifying the FESpace (L2 in the time-direction, H1 in the space-direction) on the tensorproduct mesh directly?
Last edit: 5 years 1 month ago by JanWesterdiep. Reason: Added another example of things going wrong
Time to create page: 0.116 seconds