### Can FENICS use 4D meshes and elements - eg. for space-time

437
views
2
10 months ago by
UPDATED with minimum working example of a 2D_space + Time -_> 3D problem with time as the third dimension., hopefully that makes the intention of the question clearer?

Can FENICS use 4D meshes and elements - eg for space-time?

I am thinking of something like below (I see that there is currently no code for that)
mesh=dolfin.HyperCubeMesh(dimensions=4)​

I guess this is not on the roadmap?

If hypercubes are not on the roadmap then are there any work arounds that can be done, to treat the time dimension as another variable of the form rather than the usual Method Of (vertical) Lines or Rothe approaches to time.

For example, here is an attempt at a minimum working example of a Poisson equation in 2D (in this case "X" and "Y")  in which one of the boundary conditions is dependent on the second derivative of time , the time dependence is represented by the 3rd dimension - in this case "Z" (the formatting might not work - I tried to use tex)

Weak form in the 2D domain\;
${\int_0^T {\int_{\Omega_{space}} ({ du^2 \over dx^2} +{ du^2 \over dy^2} )v ds}dt}$

The weak form of the time dependent boundary condition is:
${\int_0^T {\int_{\Gamma_2} { {du^2} \over {dt}} v ds}dt} +{\int_0^T {\int_{\Gamma_2} Â {du \over dz} v ds} dt} =0$

There is one time dependent Neumann BC:
${du \over dx} -f(x,t)=0$

integrating the second order terms by parts gives:
${\int_{\Omega} { du \over dx} { dv \over dx} + { du \over dy} { dv \over dy} ds} \\$
$-{\int_{\Gamma_2} { du \over dt} {dv \over dt} ds} + {\int_{\Gamma_2} [ { u_T (x) \over dt} v(x,T) - { u_0 (x) \over dt} v(x,0) ] ds} + { \int_{\Gamma_2} g {du \over dz} v ds} =0$
$-{\int_{\Gamma_{Neumann}} f v ds}$

Fenics can't easily do an integral over codimension 2 so to avoid that apply Dirichlet conditions on  the surfaces T=0 and T=T then the middle term of the second line above vanishes

python code below

from dolfin import *

class BoundaryNeumann(SubDomain):
def inside(self, x, on_boundary):
return on_boundary  and near(x[0], 0)
class BoundaryBCtime(SubDomain):
def inside(self, x, on_boundary):
return on_boundary  and near(x[1], 0)
class BoundaryTime0(SubDomain):
def inside(self, x, on_boundary):
return on_boundary  and near(x[2], 0)
class BoundaryTimeT(SubDomain):
def inside(self, x, on_boundary):
return on_boundary  and near(x[2], T)

L=W=T=10.
mesh=BoxMesh(Point(0., -W, 0),  Point(L, 0, T),  50, 50, 10)

boundaries=  FacetFunction('size_t', mesh)
BoundaryNeumann().mark(boundaries,1); BoundaryBCtime().mark(boundaries,2)
BoundaryTime0().mark(boundaries,3);   BoundaryTimeT().mark(boundaries,4)

ds  = Measure('ds')(domain=mesh,subdomain_data=boundaries)

V   = FunctionSpace ( mesh , FiniteElement("Lagrange", mesh.ufl_cell(), 1))
u,v = TrialFunction(V), TestFunction(V);

bcs=[DirichletBC(V,Constant(0),BoundaryTime0()), DirichletBC(V, Constant(0),BoundaryTimeT())]

a=(u.dx(0)*v.dx(0) + u.dx(1) *v.dx(1))* dx -u.dx(2) *v.dx(2)* ds(2)+Constant(1)*u.dx(1)*v*ds(2)
L=-Expression("sin(x[2])/x[1]", degree=2)*v*ds(1)

u1 = Function(V)
solve(a== L, u1, bcs)

File("/scratch/u.pvd")  <<u1
File("/scratch/dudt.pvd") <<project(grad(u1), VectorFunctionSpace(mesh, 'Lagrange', 1),solver_type='mumps').split(deepcopy=True) [2]


Thanks for any help and I apologise if this question has been asked before  ... I did look.

Thomas

Community: FEniCS Project

3
10 months ago by
Simple answer is no. It is feasible, but not something anyone is working on.
Many thanks Chris, much appreciated.

For info I have found that GetFem supports isotopes of arbitrary dimension and mfem has a development branch with 4d support (from Martin Neumüller) , I haven't had chance to look at either of them in detail yet but in principle they are capable of this approach.

written 10 months ago by Thomas
1
I would say that it is inefficient for hyperbolic problems. If you have a time-dependent equation, then you generally do not have a boundary value problem in the time direction. Hence, although it can be nice for adaptivity, you use a lot more memory than you need to, which limits the size of problem that you can solve.
written 10 months ago by Chris Richardson