Open Deadevilgrounds opened 7 years ago
This kind of thing is easy to do via the C++ or python APIs, which allow this sort of flexibility in organizing calculations. If it would be helpful, I could provide an example.
Alternatively, the scuff-static
command-line code already has an option called --SolutionFile
that allows you to save and retrieve the solution to an electrostatics problem. It wouldn't be too hard to modify this to save the factorized BEM matrix. Then you could run scuff-static
32 times with different potential files and get 32 output files, with runs 2-32 being fast compared to run 1 as they would omit the calculation of the BEM matrix.
Another option would be to add an option --SingleConductorFields
that would automatically do the calculation you want, i.e. loop over all N conductors in the geometry and compute the fields with 1V on that conductor and the others grounded, yielding N output files that you could combine with appropriate weights as a post-processing step.
Which of these do you prefer?
Thank you for your response.
Ultimately I would love to do the calculation in C++ or Python, I went for just generating bash scripts as it was quicker to implement without having to delve into the working on scuffem. So I would love some kind of tutorial of how to do this with C++ and Python.
Option three would also be great for us, esp members of our group who have no programming experience as it would give us exactly what we need in a single pass.
I can also imagine option two being useful for more generic cases where you can define any voltages multiple times for difference results or perhaps as part of an optimization loop.
So is it too bold of me to ask for all three options hehe but option three first :D I look forward to having ultimately some C tutorial as personally, I would love to add this functionality to larger projects.
Once again thanks for this great piece of software and all your hard work.
Could I use your geometry, or a facsimile of your geometry, to make a worked example for the SCUFF-STATIC documentation? It's nice to have real-world application examples. I will show how to do the calculation both via the command line and via the C++/python interface.
Here are the files for the real trap layout. I have also included the scuffgeo file and one of the voltage files. The gmsh geo file is fully parameterized so you can reduce the number of electrodes if that helps with testing.
Thanks again.
Thanks for contributing this example. I've used it as the basis for this new tutorial:
http://homerreid.github.io/scuff-em-documentation/examples/PaulTrap/PaulTrap
This actually illustrates several new features I have added over the past month, including
the ability to solve multiple electrostatics problems (with different excitation stimulus) in a single run without having to recompute the BEM matrix by specifying an --ExcitationFile.
This was the original feature you requested.
improved detection of identical objects to allow reuse of BEM matrix blocks; the code was already capable of reusing diagonal matrix blocks (object self-interactions) for identical objects, but the new feature is that now it detects identical pairs of objects and reuses off-diagonal blocks as well. This can lead to major speedups in geometries---like yours---containing many copies of identical structures. In the tutorial I explain and demonstrate how the .scuffgeo
file can be written properly for your geometry to maximize these efficiencies.
improved options for visualization of potential/field data as a postprocessing step. As a preview, here's a diorama shot of the electrostatic potential in the vicinity of your structure with electrodes at fixed potentials and external sources present.
http://homerreid.github.io/scuff-em-documentation/examples/PaulTrap/KitchenSink.png
All of these features are in the most recent repository commits. I haven't tested very extensively and would be grateful for your help on that. In any event, I hope you find this useful---let me know what you think. Also, I'd be happy to update the text with more information about your application and/or a link to your group if you'd like a little more recognition/publicity.
It would be really helpful to have the BEM matrices cached, if possible, for multi electrode runs where the same mesh and voltage is applied in the static solver multiple times.
To describe the problem: We are simulating a Paul surface ion trap which has 32 DC electrodes plus 2 RF and 1 ground. The ground is always grounded but we want to export the field data when 1V is being applied to each electrode in turn, while all other electrodes are grounded. These data files we then combine in mathematica and multiply by the correct constants to scale the fields to define trapping parameters.
So multiple times the electrode/mesh is being defined as 0V and only once is it being defined as 1V.
So if you could cache the BEM generation and anything else that remains constant. Also if the cache could not be cleared but stored when the voltage changes so when we go back to 0V it can reuse the data.
Thanks