Applying boundary condition to vector crashes

Bug #698229 reported by Marie Rognes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
DOLFIN
Fix Released
High
Unassigned

Bug Description

The following code crashes with

PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range

It runs in revision no 5445, but crashes in 5446.

----

#include <dolfin.h>
#include "NavierStokes.h"

using namespace dolfin;

class Noslip : public SubDomain
{
  bool inside(const Array<double>& x, bool on_boundary) const
  {
    return (x[1] < DOLFIN_EPS);
  }
};

int main() {

  UnitSquare mesh(2, 2);
  NavierStokes::FunctionSpace W(mesh);
  Noslip noslip;

  // Define bc on subspace
  SubSpace S(W, 0);
  Function zero(S);
  DirichletBC bc(S, zero, noslip);

  // Apply bc to vector
  Function z(W);
  bc.apply(z.vector()); // Fails!

  return 0;
}

and NavierStokes.h is generated from

V = VectorElement("CG", "triangle", 2)
Q = FiniteElement("CG", "triangle", 1)
element = V * Q

Changed in dolfin:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Garth Wells (garth-wells) wrote :

Does it work with

    Constant zero(0.0);

?

Anders Logg (logg)
Changed in dolfin:
milestone: none → 0.9.10
Revision history for this message
Garth Wells (garth-wells) wrote :

It does work with

  Constant zero(0.0, 0.0);

Revision history for this message
Garth Wells (garth-wells) wrote :

Fixed here:

   http://bazaar.launchpad.net/~dolfin-core/dolfin/main/revision/5702

The problem is with creating a Function using a SubSpace. This doesn't really make sense unless the FunctionSpace has been collapse.

Solution is to throw an error.

Changed in dolfin:
status: Confirmed → Fix Committed
Anders Logg (logg)
Changed in dolfin:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.