Subject: [FEniCS-users] Empty MeshFunction in VariationalProblem

From: phil marinier <[email-masked]>
Date: Wed, 18 Nov 2009 14:34:54 -0500

I am trying to impose a neumann BC on one edge of a 2d rectangular domain. So far I have this:

            dolfin::MeshFunction<unsigned int> *empty;
            
            //mark sub domains
            dolfin::MeshFunction<unsigned int> CSD(*cathode, cathode->topology().dim() - 1);
            left->mark(CSD, 3);

            //set BC
            PhiInt.vector().set(phiInt);
            dolfin::DirichletBC bcInt(V, PhiInt, interface);
            std::vector<dolfin::BoundaryCondition *> bcs;
            bcs.push_back(&bcInt);
            
            //set neumann bc
            GradAvg.vector().set(gradAvg);
            L.g = GradAvg;
            
            //solve for Phi
            dolfin::VariationalProblem problem(a, L, bcs, empty, empty, &CSD);
            problem.solve(Phi);

I put the cathode subdomain (CSD) in the last spot in my VariationalProblem declaration because that's the spot for the exteror facet domains. I am trying to use an empty MeshFunction to fill in the spots I don't care about. I am trying to do it this way after reading this thread:
http://www.mail-archive.com/[email-masked]/msg02541.html
I get this error message:

forward: ./dolfin/mesh/MeshFunction.h:106: const T& dolfin::MeshFunction<T>::operator()(const dolfin::MeshEntity&) const [with T = unsigned int]: Assertion `_values' failed.

I assumed this means that I can't just pass in an empty pointer. I tried putting "0" in the spots I don't care about, and it didn't recongise a construtor that used "int." What should I be putting for my MeshFunction in the spots I don't care about?

Thanks for your help,

Phil