Virtual Polywell

Discuss how polywell fusion works; share theoretical questions and answers.

Moderators: tonybarry, MSimon

drmike
Posts: 825
Joined: Sat Jul 14, 2007 11:54 pm
Contact:

Post by drmike »

I guess that kind of explains the number of software packages devoted to number crunching. It is not as easy as it looks to just plug and play - some times it is easier to roll your own. So everybody does!

MSimon
Posts: 14335
Joined: Mon Jul 16, 2007 7:37 pm
Location: Rockford, Illinois
Contact:

Post by MSimon »

To quote Gandalf sort of:

The problems are subtle and can quickly lead to danger.
Engineering is the art of making what you want from what you can get at a profit.

drmike
Posts: 825
Joined: Sat Jul 14, 2007 11:54 pm
Contact:

Post by drmike »

Some problems are not subtle, they are just bugs! I got a crude way to visualize the data and began to realize I'd have to debug the visualization program to fully understand what was happening. So I'll stick with raw numbers while I debug the electron blob tracking.

Found a couple and fixed them already - stupid book keeping and counting problems were sending pointers out of bounds, so that explains my file dump at the end of the program. Next problem to fix is the particles near the MaGrid - the acceleration is way too big so that in one time step the particles get ejected from the vacuum chamber (the numbers are 10 times the radius in one time step - way past light speed!!)

It's gonna be slow slogging, or at least feel like it. But I think this should be computable in a reasonable time with the hardware I've got. Once I get something that seems to work, I'll post it.

MSimon
Posts: 14335
Joined: Mon Jul 16, 2007 7:37 pm
Location: Rockford, Illinois
Contact:

Post by MSimon »

I always hated C for its opaque handling of pointers.

Very prone to errors or as C people prefer the more benign sounding "memory leaks". Which are not benign at all (unless the memory is not occupied).
Engineering is the art of making what you want from what you can get at a profit.

wisnij
Posts: 12
Joined: Sun Mar 16, 2008 1:57 pm
Location: a planet called Erp

Post by wisnij »

MSimon wrote:I always hated C for its opaque handling of pointers.

Very prone to errors or as C people prefer the more benign sounding "memory leaks". Which are not benign at all (unless the memory is not occupied).
The irony is, given the relative inefficiency of most malloc implementations, a garbage-collected memory system would probably not perform much worse on average, and would certainly save a lot of programmer headaches. It's just not a big part of the C mindset, unfortunately. :?

drmike
Posts: 825
Joined: Sat Jul 14, 2007 11:54 pm
Contact:

Post by drmike »

I've never had much luck with malloc or it's cousins alloc or calloc. I just create fixed buffers and use indexing or pointers plus indexing. Usually it's my book keeping on indexing that screws me up - I just can't count! Setting aside 100MB at run time for a few variables always works - I seem to be jinxed with malloc.

So instead of memory leaks, I usually clobber the OS and kernel space. Modern MMU's save my butt and core dump the process. It usually doesn't take that long to find the bug, the major advantage is that it is never subtle.

drmike
Posts: 825
Joined: Sat Jul 14, 2007 11:54 pm
Contact:

Post by drmike »

I just uploaded a debugging in process version of electron_phase.c where I've fixed a problem with "zone swapping". Since I'm only tracking 1/48 of the total volume, once a particle leaves that volume I've got to put back it's mirror copy from another section.

The major bug I've got to fix next is the velocity change. A blob is going way too far for a nanosecond equivelent time scale. Like 5 times light speed! Hopefully I'll get a chance to figure that out over the next day or so.

MSimon
Posts: 14335
Joined: Mon Jul 16, 2007 7:37 pm
Location: Rockford, Illinois
Contact:

Post by MSimon »

drmike wrote:I just uploaded a debugging in process version of electron_phase.c where I've fixed a problem with "zone swapping". Since I'm only tracking 1/48 of the total volume, once a particle leaves that volume I've got to put back it's mirror copy from another section.

The major bug I've got to fix next is the velocity change. A blob is going way too far for a nanosecond equivelent time scale. Like 5 times light speed! Hopefully I'll get a chance to figure that out over the next day or so.
You have invented the Warp Drive. Don't let the guys from New Energy find out. :-)
Engineering is the art of making what you want from what you can get at a profit.

drmike
Posts: 825
Joined: Sat Jul 14, 2007 11:54 pm
Contact:

Post by drmike »

MSimon wrote:
You have invented the Warp Drive. Don't let the guys from New Energy find out. :-)
:D

drmike
Posts: 825
Joined: Sat Jul 14, 2007 11:54 pm
Contact:

Post by drmike »

OK - fixed the "light speed" bug - I was multiplying the x component of the E field by a scale factor twice and not the z component at all. So now at least the motion seems ok - except another bug showed up and it looks like some kind of division by zero sending me back to 100 times light speed again. But it's converging! Instead of all the particles zooming off, it's only one....
:)

drmike
Posts: 825
Joined: Sat Jul 14, 2007 11:54 pm
Contact:

Post by drmike »

Found a couple more bugs, and now it behaves "rationally". The more blobs I introduce, the slower I have to run the time steps or it blows up too fast.

I'm a touch confused about the sign of the force from each field - I need to double check that the electron source pushes the blobs away and the grid pulls them in. It looks that way in my crude plots, but my graphics suck big time. I'll try to set up an overnight run some time and see what happens - probably a huge mess!

TallDave
Posts: 3141
Joined: Wed Jul 25, 2007 7:12 pm
Contact:

Post by TallDave »

That's some geeked out code. I gotta find a compiler and test it out sometime.

drmike
Posts: 825
Joined: Sat Jul 14, 2007 11:54 pm
Contact:

Post by drmike »

I would expect someone who has spent time actually writing code would do a lot better. I just write enough code to help me figure out how to build stuff. :)

drmike
Posts: 825
Joined: Sat Jul 14, 2007 11:54 pm
Contact:

Post by drmike »

For the last couple of days I've tried to do a quick and dirty analytical model of looking at the electron emitter into a coil as a "tube" problem. Getting the basic fields was easy, and figuring out the max current from either a hot or field emission cathode was easy, but putting it all together is turning into a huge mess. Even the simplest things are really complicated....

Oh well - at least it is fun! Hopefully I will have something to write up before I get dragged off to higher priority stuff (like helping my kids study for finals...)

drmike
Posts: 825
Joined: Sat Jul 14, 2007 11:54 pm
Contact:

Post by drmike »

I have not had time to write anything up, so I tried an experiment of putting my notes up directly. Kinda hard to read, but better than nothing. I need to work on centering and focus for picture taking.

But the idea of "quick and dirty" doesn't apply without a lot of assumptions. I think it will actually be easier to do a brute force calculation than to pursue an analytical solution. But I think over the long run both need to be done along with experiments for a full picture to emerge.

With luck in a month or so I'll be able to write this up correctly.

Post Reply