← Back to team overview

dolfin team mailing list archive

[Bug 701709] [NEW] Local refinement scales poorly

 

Public bug reported:

Bug reported by Glenn Terje Lines.

Local refinement seems to be n^3 in the number of cells.

Can be reproduced with the following code:

from dolfin import *
import numpy
import time
import random

mesh = UnitCube(10,10,10)


for i in range(10):
    mf = MeshFunction("bool", mesh, 3)
    k = 0
    for cell in mesh.cells():
        mf.values()[k] = (random.random()>0.5)
        k += 1
    t0 = time.time();
    mesh = refine(mesh,mf);
    dt = time.time() - t0;
    print i, dt, k, k/dt

Results:

# results
P = numpy.array([
[0,0.144922018051,6000,41401.5763835],
[1,0.398217916489,11904,29893.1803596],
[2,0.88475394249,22928,25914.5496831],
[3,2.46636891365,47190,19133.3906857],
[4,10.5502009392,94930,8997.93288747],
[5,39.3473289013,184088,4678.53867442],
[6,302.216933966,379850,1256.87861039],
[7,2436.17705512,760484,312.162861234]])
n = P[:,2];

import pylab
pylab.loglog(n,P[:,1],n,4e-5*n,n,1e-9*n**2,n,1e-14*n**3)
pylab.show()

** Affects: dolfin
     Importance: Medium
     Assignee: Anders Logg (logg)
         Status: Confirmed

** Changed in: dolfin
       Status: New => Confirmed

** Changed in: dolfin
     Assignee: (unassigned) => Anders Logg (logg)

** Changed in: dolfin
   Importance: Undecided => Medium

-- 
You received this bug notification because you are a member of DOLFIN
Team, which is subscribed to DOLFIN.
https://bugs.launchpad.net/bugs/701709

Title:
  Local refinement scales poorly

Status in DOLFIN:
  Confirmed

Bug description:
  Bug reported by Glenn Terje Lines.

  Local refinement seems to be n^3 in the number of cells.

  Can be reproduced with the following code:

  from dolfin import *
  import numpy
  import time
  import random

  mesh = UnitCube(10,10,10)

  
  for i in range(10):
      mf = MeshFunction("bool", mesh, 3)
      k = 0
      for cell in mesh.cells():
          mf.values()[k] = (random.random()>0.5)
          k += 1
      t0 = time.time();
      mesh = refine(mesh,mf);
      dt = time.time() - t0;
      print i, dt, k, k/dt

  Results:

  # results
  P = numpy.array([
  [0,0.144922018051,6000,41401.5763835],
  [1,0.398217916489,11904,29893.1803596],
  [2,0.88475394249,22928,25914.5496831],
  [3,2.46636891365,47190,19133.3906857],
  [4,10.5502009392,94930,8997.93288747],
  [5,39.3473289013,184088,4678.53867442],
  [6,302.216933966,379850,1256.87861039],
  [7,2436.17705512,760484,312.162861234]])
  n = P[:,2];

  import pylab
  pylab.loglog(n,P[:,1],n,4e-5*n,n,1e-9*n**2,n,1e-14*n**3)
  pylab.show()





Follow ups

References