Question #91692 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/91692

    Status: Open => Answered

Anders Logg proposed the following answer:
You should use the second argument (exterior_facet_domains) for
specifying Neumann boundaries.

Try

 VariationalProblem problem(a, L, bcs, 0, &ASD, 0);

and see if that helps.

--
Anders


On Wed, Nov 25, 2009 at 04:04:59PM -0000, Phil Marinier wrote:
> New question #91692 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/91692
>
> I am trying to apply an neumann BC on one edge of my 2d rectangular domain. 
> To do so, I made two MeshFunctions:
>
>                         dolfin::Mesh mesh(*anode);
>                       dim = mesh.topology().dim() - 1;
>                       dolfin::MeshFunction<unsigned int> ASD(mesh, dim);
>                       right->mark(ASD, 3);
>                       dolfin::MeshFunction<unsigned int> empty(mesh, dim);
>
> right is an instance of my own Edge class, which inherits from 
> dolfin::SubDomain. I use these MeshFunctions later like so:
>
>                         //solve for Phi
>                       dolfin::VariationalProblem problem(a, L, bcs, &empty, 
> &empty, &ASD);
>                       problem.solve(Phi);
>
> I do it this way because I couldn't get it to compile any other way. There is 
> a demo that uses "0" as in the integer value instead of my "empty" 
> MeshFunction, but when I tried that, I couldn't get it to compile. I put the 
> mesh function that I care about in the last position, because as I understand 
> it, that is the position for external facets. Which in this case, would be my 
> external edges. I can compile this code and it runs up until i try to call 
> "solve." I then get that assertion error. I was looking in the code, and it 
> seems like _dim is the dimension that is passed to the mesh function, and 
> entity.dim() is the dimension of the MeshEntity the MeshFunction is trying to 
> mark. So what I think is happening, is that the MeshFunction somehow thinks I 
> have a 3d domain.
>
> The full error message is as follows:
>
> Solving linear variational problem
>   Matrix of size 1251 x 1251 has 8551 nonzero entries.
> forward: ./dolfin/mesh/MeshFunction.h:108: const T& 
> dolfin::MeshFunction<T>::operator()(const dolfin::MeshEntity&) const [with T 
> = unsigned int]: Assertion `entity.dim() == _dim' failed.
> [wolf:24774] *** Process received signal ***
> [wolf:24774] Signal: Aborted (6)
> [wolf:24774] Signal code:  (-6)
> [wolf:24774] [ 0] [0xb7f5f410]
> [wolf:24774] [ 1] /lib/tls/i686/cmov/libc.so.6(abort+0x188) [0xb634f098]
> [wolf:24774] [ 2] /lib/tls/i686/cmov/libc.so.6(__assert_fail+0xee) 
> [0xb63465ce]
> [wolf:24774] [ 3] 
> /usr/local/lib/libdolfin.so.0(_ZN6dolfin9Assembler14assemble_cellsERNS_13GenericTensorERKNS_4FormERNS_3UFCEPKNS_12MeshFunctionIjEEPSt6vectorIdSaIdEE+0x53e)
>  [0xb7d6e2fe]
> [wolf:24774] [ 4] 
> /usr/local/lib/libdolfin.so.0(_ZN6dolfin9Assembler8assembleERNS_13GenericTensorERKNS_4FormEPKNS_12MeshFunctionIjEES9_S9_b+0xe2)
>  [0xb7d6f402]
> [wolf:24774] [ 5] 
> /usr/local/lib/libdolfin.so.0(_ZN6dolfin8assembleERNS_13GenericTensorERKNS_4FormEPKNS_12MeshFunctionIjEES8_S8_b+0x41)
>  [0xb7d5a691]
> [wolf:24774] [ 6] 
> /usr/local/lib/libdolfin.so.0(_ZN6dolfin18VariationalProblem12solve_linearERNS_8FunctionE+0x852)
>  [0xb7d94c32]
> [wolf:24774] [ 7] 
> /usr/local/lib/libdolfin.so.0(_ZN6dolfin18VariationalProblem5solveERNS_8FunctionE+0x2a)
>  [0xb7d955da]
> [wolf:24774] [ 8] 
> ./forward(_ZN7ASolver5solveEPdS0_S0_S0_S0_S0_ddP4Edge+0x466) [0x809c336]
> [wolf:24774] [ 9] ./forward(_ZN9Fiterator5solveEPdS0_S0_+0x7e1) [0x8086d31]
> [wolf:24774] [10] ./forward(main+0x7ec) [0x807294c]
> [wolf:24774] [11] /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe5) 
> [0xb6338775]
> [wolf:24774] [12] ./forward [0x8072051]
> [wolf:24774] *** End of error message ***
> Aborted
>
> My main is called forward, since this is the forward solution to my problem, 
> and hopefully I will also be doing the inverse later. I saw this thread:   
> http://www.mail-archive.com/dolfin-...@fenics.org/msg04158.html   and that's 
> why I use a copy constructor to make a new mesh that I for everything I 
> define. This way I can be absolutely sure that the program knows I'm using 
> the same mesh.
>
> Any help would be appreciated,
>
> Thank you very much,
>
> Phil
>

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.

_______________________________________________
Mailing list: https://launchpad.net/~dolfin
Post to     : dolfin@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dolfin
More help   : https://help.launchpad.net/ListHelp

Reply via email to