Re: [Libmesh-users] Complex boundary

2009-10-28 Thread Roy Stogner
On Wed, 28 Oct 2009, Joa Ljungvall wrote: > Since I produce the first mesh inside my code, using OpenCASCADE+Gmsh I'm > thinking maybe I can let Gmsh regenerate a mesh for at each iteration, with > the refined mesh of libmesh as a background mesh... If by "each iteration" you mean each refinemen

Re: [Libmesh-users] Complex boundary

2009-10-28 Thread Joa Ljungvall
Hm... I almost giving up on this one... Looping through the elements, and moving nodes on the boundaries, it is not too difficult to make sure that the element I'm looking at isn't modified in a bad way. However, that node also belongs to a hole line of other elements, that might get destroyed. On

Re: [Libmesh-users] Complex boundary

2009-10-26 Thread Roy Stogner
On Mon, 26 Oct 2009, Joa Ljungvall wrote: > What I'm trying to do is: > > 1) Refine the mesh > 2) Find and store hanging nodes > 3) Move points on boundary to the "real" boundary > then I do a do{...}While() including > 4) Check that Jacobian>0, if not switch node 0 and 2 (the pointers in the >

Re: [Libmesh-users] Complex boundary

2009-10-26 Thread Joa Ljungvall
Hi, I've tried to get this running, but still have some problems... What I'm trying to do is: 1) Refine the mesh 2) Find and store hanging nodes 3) Move points on boundary to the "real" boundary then I do a do{...}While() including 4) Check that Jacobian>0, if not switch node 0 and 2 (the pointe

Re: [Libmesh-users] Complex boundary

2009-10-15 Thread Joa Ljungvall
Hi, Yes, it looks like the thing we need, expect that it only works for QUAD4... But I guess I could use it as a model and write a function in my program. If it works we add it to the svn version. Thanks for all the help. I think I understood the problem and how to fix it. I'll get back with new

Re: [Libmesh-users] Complex boundary

2009-10-14 Thread Roy Stogner
On Wed, 14 Oct 2009, Derek Gaston wrote: > I thought I ran into similar problems when I did mesh redistribution / > smoothing + adaptivity. I was able to go in and "fix" the hanging > nodes somehow... But I don't remember where I did it ( I thought it > was down inside the library and I committ

Re: [Libmesh-users] Complex boundary

2009-10-14 Thread Derek Gaston
I thought I ran into similar problems when I did mesh redistribution / smoothing + adaptivity. I was able to go in and "fix" the hanging nodes somehow... But I don't remember where I did it ( I thought it was down inside the library and I committed it back). I'm not near a computer right now whe

Re: [Libmesh-users] Complex boundary

2009-10-14 Thread Roy Stogner
On Wed, 14 Oct 2009, Joa Ljungvall wrote: > So returning to the "fix" using the constraint equations... I don't quite > understand the idea behind this. If my hanging node no longer is at the right > position, my mesh is broken, no? Not quite. If your hanging node is no longer at the right posi

Re: [Libmesh-users] Complex boundary

2009-10-14 Thread Joa Ljungvall
So returning to the "fix" using the constraint equations... I don't quite understand the idea behind this. If my hanging node no longer is at the right position, my mesh is broken, no? So fixing this with the constraint equations is a way of making the calculations go on, assuming that the error we

Re: [Libmesh-users] Complex boundary

2009-10-14 Thread Roy Stogner
On Wed, 14 Oct 2009, Joa Ljungvall wrote: > When I loop over the nodes, find a face that is on the boundary, and > then move the nodes the problem is, if I understood it correct, that > I might move a hanging node out of the line between the nodes of the > not so refined neighbour. This is not t

Re: [Libmesh-users] Complex boundary

2009-10-14 Thread Joa Ljungvall
Hi again, When I loop over the nodes, find a face that is on the boundary, and then move the nodes the problem is, if I understood it correct, that I might move a hanging node out of the line between the nodes of the not so refined neighbour. But I can check if this is the case, and instead of mo

Re: [Libmesh-users] Complex boundary

2009-10-14 Thread David Knezevic
That'll work out of the box, but you can't coarsen the "base" mesh that you load in to libmesh --- you can only refine the base mesh and then subsequently coarsen the elements that have been refined by libmesh. But if you can represent the geometry with a coarser mesh than is required to resolv

Re: [Libmesh-users] Complex boundary

2009-10-14 Thread Joa Ljungvall
I've been running in devel mode. Things start to look complicated... What about this as an approach, escentially what was proposed to me in the beginning. 1) Use gmsh to generate a mesh that is fine enough to describe the geometry to the precision it is known 2) Solve the equations 3) Refine

Re: [Libmesh-users] Complex boundary

2009-10-13 Thread Roy Stogner
On Tue, 13 Oct 2009, Roy Stogner wrote: > Anyway, the solution is probably to, after you've looped over all > nodes, loop over all constraint equations in the dof map and apply > them to nodes' xyz coordinates. Thinking about it again, this is an oversimplification. For it to work, you'd need

Re: [Libmesh-users] Complex boundary

2009-10-13 Thread Roy Stogner
On Tue, 13 Oct 2009, Joa Ljungvall wrote: > #5 0x7fff81116bfc in __cxa_throw () > #6 0x00010512afa4 in RemoteElem::n_nodes () > #7 0x00010510acf4 in DofMap::dof_indices () > #8 0x00010510e2d9 in DofMap::add_neighbors_to_send_list () > > This I don't understand at all... Hmm..

Re: [Libmesh-users] Complex boundary

2009-10-13 Thread Joa Ljungvall
The problem with a negative jacobian seems solved. It was indeed a node that was moved in the wrong way by my code. Now the program iterates two times but then I get (running in gdb) EquationSystems n_systems()=1 System "Laplace" Type "LinearImplicit" Variables="u" Finite Elemen

Re: [Libmesh-users] Complex boundary

2009-10-13 Thread Roy Stogner
On Tue, 13 Oct 2009, Joa Ljungvall wrote: > As for getting inverted element, this means I've moved a node to the other > side of the opposite face of my tet? This could very well be a bug in my > code. I can, and will, check that I don't move nodes in an unreasnoble way. If you're sticking to f

Re: [Libmesh-users] Complex boundary

2009-10-13 Thread Joa Ljungvall
Hi again, Ok. Seems sensible to me. Now, I'm a nuclear physicist so FEM is not quite what I do for a living, but presently I'm giving it a try to see if it can improve some detector simulations we are doing, presently done with finite difference solvers, so bare with me even if I'm not 100% on tar

Re: [Libmesh-users] Complex boundary

2009-10-13 Thread Roy Stogner
On Tue, 13 Oct 2009, Joa Ljungvall wrote: > If I change the locations of the new nodes when they are made, i.e. somewhere > deep down in the MeshRefinement class, can I do what I would like to do? I don't think that would make any difference. If moving nodes eventually gives you an inverted ele

Re: [Libmesh-users] Complex boundary

2009-10-13 Thread Joa Ljungvall
Hmmm... If I change the locations of the new nodes when they are made, i.e. somewhere deep down in the MeshRefinement class, can I do what I would like to do? If I've understood everything correct a tet is subdivided by adding vertices halfway between the old ones. But there is nothing magic abou

Re: [Libmesh-users] Complex boundary

2009-10-13 Thread Roy Stogner
> 3) Copies all active elements to a new mesh, i.e. my new mesh have the right > nodes locations etc. but no "refinement" (is this true if I do it right?) This won't work if there's any adaptive refinement in the original mesh - libMesh relies on the parent element hierarchy to figure out hangi

Re: [Libmesh-users] Complex boundary

2009-10-13 Thread Joa Ljungvall
Hi again, If I: 0) Solve the equations one time... 1) Refine my mesh 2) Move my nodes 3) Copies all active elements to a new mesh, i.e. my new mesh have the right nodes locations etc. but no "refinement" (is this true if I do it right?) 4) I change mesh in my equation system 5) build my matrix

Re: [Libmesh-users] Complex boundary

2009-10-13 Thread Roy Stogner
On Tue, 13 Oct 2009, John Peterson wrote: > On Tue, Oct 13, 2009 at 11:40 AM, Joa Ljungvall wrote: >> It is quite possible that I move the wrong nodes the wrong way, but is my >> problem ;). The general question is, is this a possible route to take? I call >> this routine after refinement and c

Re: [Libmesh-users] Complex boundary

2009-10-13 Thread John Peterson
On Tue, Oct 13, 2009 at 11:40 AM, Joa Ljungvall wrote: > It is quite possible that I move the wrong nodes the wrong way, but is my > problem ;). The general question is, is this a possible route to take? I call > this routine after refinement and coursening, before > equation_systems.reinit(). I

Re: [Libmesh-users] Complex boundary

2009-10-13 Thread Joa Ljungvall
Hi again, during the day I been working a bit on the problem: Currently I have the exact geometry inside my program (implemented via CGS and GEANT4). What I have tried is to, after the refinement move the new boundary points using a code like this one (it tries to move all nodes on a boundary to

Re: [Libmesh-users] Complex boundary

2009-10-13 Thread John Peterson
On Tue, Oct 13, 2009 at 10:36 AM, Joa Ljungvall wrote: > Hi, > > The problem is that I have to solve my equation on the same domain with > very different boundary conditions, making a uniform refinement very > inefficient and a waste of time, and worse in my case, RAM. So I do need > to start with

Re: [Libmesh-users] Complex boundary

2009-10-13 Thread Joa Ljungvall
Hi, The problem is that I have to solve my equation on the same domain with very different boundary conditions, making a uniform refinement very inefficient and a waste of time, and worse in my case, RAM. So I do need to start with a very course mesh and refine. cheers Joa On Tue, Oct 13, 2

Re: [Libmesh-users] Complex boundary

2009-10-13 Thread Joa Ljungvall
Hi, I'm not sure I understood the answer. I want to start with a very course mesh, and refine it based on the solution on the course(r) mesh, i.e. adaptive refinment. So using gmsh I would have to communicate the solution in each step and tell gmsh which regions to refine, or? And if so, how? Fu

Re: [Libmesh-users] Complex boundary

2009-10-13 Thread David Knezevic
If you generate a mesh in gmsh that is sufficiently fine that a mesh of second order elements captures the geometry well enough, then you can read that mesh into libMesh, and just use libMesh's adaptive refinement as in the examples. In that situation, libMesh's adaptive refinement will interpo

Re: [Libmesh-users] Complex boundary

2009-10-13 Thread David Knezevic
I think the simplest thing to do is use second order elements in gmsh. Then when you refine the new nodes will interpolate the quadratic approximation to the boundary of your domain. - Dave Joa Ljungvall wrote: > Hi all, > > I would like to use libmesh to solve a rather simple equation > (Lap

[Libmesh-users] Complex boundary

2009-10-13 Thread Joa Ljungvall
Hi all, I would like to use libmesh to solve a rather simple equation (Laplace/poisson) but in a domain with a somewhat funny shape of the boundary. To do this I created a mesh using gmsh, modified example 14 a bit so it reads my mesh instead of the l-shaped domain. My problem is that when I refi