- changed component to adaptivity
Adapting LinearVariationalProblem causes segfaults when applying BCs
Issue #563
duplicate
Hi everybody,
I have a code [see #105] in which I have two LinearVariationalProbelms [Pu
, Pv
] that I solve in a loop, the second of which with an AdaptiveLinearVariationalSolver.
What I'm experiencing is this:
- I can solve
Pu
fine on the initial mesh - I solve
Pv
and get the adapted mesh - I call
adapt
to adaptPu
- I solve again
Pu
but I get a segfault, with this backtrace:
#0 0x00007ffff74dba80 in dolfin::FunctionSpace::dim() const () from /opt/fenics/bld/dolfin/psllep6i5jrg/lib/libdolfin.so.1.6
#1 0x00007ffff7451050 in dolfin::DirichletBC::check_arguments(dolfin::GenericMatrix*, dolfin::GenericVector*, dolfin::GenericVector const*) const ()
from /opt/fenics/bld/dolfin/psllep6i5jrg/lib/libdolfin.so.1.6
#2 0x00007ffff7456e84 in dolfin::DirichletBC::apply(dolfin::GenericMatrix*, dolfin::GenericVector*, dolfin::GenericVector const*) const ()
from /opt/fenics/bld/dolfin/psllep6i5jrg/lib/libdolfin.so.1.6
So something is wrong when applying BCs, in particular with the function space on which Pu
is defined.
I saw a similar bugreport, #322: could this be related?
Comments (4)
-
Account Deleted reporter -
This is caused by
#319.Workaround isadapt_wrapper_code = """ #include <dolfin/adaptivity/adapt.h> namespace dolfin { std::shared_ptr<MeshFunction<std::size_t>> adapt_wrapper( const MeshFunction<std::size_t>& mesh_function, std::shared_ptr<const Mesh> adapted_mesh) { std::shared_ptr<MeshFunction<std::size_t>> mf; mf = std::make_shared<MeshFunction<std::size_t>>(adapt(mesh_function, adapted_mesh)); return mf; } } """ adapt = compile_extension_module(adapt_wrapper_code).adapt_wrapper;
EDIT: This workaround is incorrect. Correct one is to never use returned value of any
adapt
function, see#319. -
- changed status to duplicate
Duplicate of
#319. -
- removed milestone
Removing milestone: 1.6 (automated comment)
- Log in to comment