← Back to team overview

dolfin team mailing list archive

SU stabilization

 

Hi all

I am trying to solve (PyDolfin) a convection-diffusion problem with a
stabilization term (SU-Streamline Upwind). I define a SU class and an
instance tau.

...
class SU(Function):        # SU stabilization  
    def __init__(self, element, mesh, sigma, K):
        Function.__init__(self, element)
        self.sigma = sigma 
        self.K = K
    def eval(self, values, x):
        mh = MeshSize("triangle",mesh)
        mhx = mh.eval(x) 
        m = 1.0/3.0     # For linear elements only
        nv = self.sigma * sqrt(numpy.inner(vel, vel))
        Re = m*nv*mhx / (2.0*self.K)
        xi = min(Re, 1.0) 
        values[0] = mhx * xi / (2.0*nv)

tau = SU(scalar, mesh)   # SU stabilization  
a_K = K * dot(grad(v), grad(u))*dx
a_H = h * v*u*ds
a_C = sigma * v*dot(vel, grad(u))*dx
a_S = (tau * dot(vel,grad(v)) * dot(vel,grad(u)))*dx
a = a_K + a_H + a_C + a_S
A = assemble(a, mesh)
...

The following message appears:

Assembling matrix over cells (finished).
Plot active, press 'q' to continue.
Assembling matrix over cells (finished).
Traceback (most recent call last):
  File "/home/hpina/Desktop/Solar-Dolfin/conv-dif.py", line 169, in <module>
    A = assemble(a, mesh)
  File "/usr/lib/python2.5/site-packages/dolfin/assemble.py", line 107, in
assemble
    cell_domains, exterior_facet_domains, interior_facet_domains,
reset_tensor)
  File "/usr/lib/python2.5/site-packages/dolfin/dolfin.py", line 8084, in
cpp_assemble
    return _dolfin.cpp_assemble(*args)
RuntimeError: *** Error: Function contains no data.


When I drop the a_S term the program works fine. I am at a loss so any help
will be appreciated.

Best regards

  Heitor Pina

 

 

 

 


Follow ups