← Back to team overview

dolfin team mailing list archive

[Bug 698229] Re: Applying boundary condition to vector crashes

 

Does it work with

    Constant zero(0.0);

?

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

Title:
  Applying boundary condition to vector crashes

Status in DOLFIN:
  Confirmed

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





References