This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Computing integrals over moving subdomains

0 votes

Hello all,

I am trying to solve a problem where I have a circular sub-domain moving through a region in space, and I am trying to calculate an integral over this sub-domain (originating from a Lagrange multiplier constraint implementation). Right now the way I am doing this is to mark the domains using CellFunctions at every time step, then create a measure out of it, and then re-calculate the form for the integral.

 while time <= finalTime
    domains = CellFunction("size_t", mesh)
    domains.set_all(0)
    circle = Circle()
    circle = circle.mark(domains, 1)
    dx = Measure("dx")[domains]
    ... other lines of code ....
    intCircle = inner(lambda, v)*dx(1)

I am wondering whether it is needed for me to define the form for the integral inside the loop or defining it outside will work. Additionally, can I specify a deformation to dx(1). Since I know the velocity and position, I can specify a rigid-body transformation to the domain dx(1) in theory - but I don't know whether that can be done in FEniCs in practice.

Any help whatsoever will be appreciated.

asked Sep 24, 2014 by debmukh FEniCS Novice (880 points)
edited Sep 26, 2014 by debmukh

1 Answer

+1 vote

I recommend defining the domains and form outside the loop:

domains = CellFunction("size_t", mesh)
circle = Circle()
dx = Measure("dx", subdomain_data=domains)
intCircle = inner(lambda, v)*dx(1)

while time <= finalTime
    domains.set_all(0)
    circle = circle.mark(domains, 1)
    ... other lines of code ....

To deal with the deformation, a common approach is to reformulate the PDE on the reference domain. It's also possible to modify the coordinates of the mesh, however then you need to be careful to avoid intersecting cells etc. Check out the ale demo in dolfin and mesh.move(). If you really want to do that I recommend posting a separate question with a title that draws the interest of others who do this.

answered Oct 23, 2014 by martinal FEniCS User (2,800 points)
...