{"id":34694857,"url":"https://github.com/geekysuavo/gpufield","last_synced_at":"2025-12-24T22:31:31.468Z","repository":{"id":21457325,"uuid":"24775757","full_name":"geekysuavo/gpufield","owner":"geekysuavo","description":"A CUDA-accelerated electromagnetostatics solver","archived":false,"fork":false,"pushed_at":"2021-07-04T15:15:52.000Z","size":33,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-03-21T17:32:06.775Z","etag":null,"topics":["cuda","magnetic-fields","magnetostatics"],"latest_commit_sha":null,"homepage":null,"language":"Cuda","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geekysuavo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-03T22:29:43.000Z","updated_at":"2024-03-21T17:32:06.776Z","dependencies_parsed_at":"2022-08-21T14:40:57.946Z","dependency_job_id":null,"html_url":"https://github.com/geekysuavo/gpufield","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/geekysuavo/gpufield","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geekysuavo%2Fgpufield","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geekysuavo%2Fgpufield/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geekysuavo%2Fgpufield/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geekysuavo%2Fgpufield/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geekysuavo","download_url":"https://codeload.github.com/geekysuavo/gpufield/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geekysuavo%2Fgpufield/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28010883,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cuda","magnetic-fields","magnetostatics"],"created_at":"2025-12-24T22:31:30.739Z","updated_at":"2025-12-24T22:31:31.456Z","avatar_url":"https://github.com/geekysuavo.png","language":"Cuda","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gpufield\n\nA CUDA-accelerated electromagnetostatics solver.\n\n## About GPUfield\n\nGPUfield is a small CUDA C program for calculating magnetic fields around\ndirect current electromagnets.\n\nGPUfield reads a pretty terse yet flexible scripting language that allows the\nuser to define coil geometries in 3D space, and then take 2D slices of the\nresulting magnetic fields. It's pretty quick and dirty, but useful enough\nfor designing coil geometries for earth's field NMR spectroscopy (EFNMR).\n\nAs an example, the following gpufield script computes the magnetic field around\nan 'infinitely' long wire:\n\n```\ncurrent 1\nmoveto 0 0 -1e6\nlineto 0 0 1e6\nmoveto 0 0 0\nfile 'field.dat'\ngrid z 1 1 256 256\nclear\nend\n```\n\nThe resulting file `field.dat` will contain nine columns of data:\n\n```\ni x y z Bx By Bz |B|\n```\n\nwhere the indices `i` and `j` will run from 0 to 255, `x` and `y` will run\nfrom -0.5 to 0.5, and `z` will equal 0. The components of the magnetic field\nwill be stored in `Bx`, `By` and `Bz`, and the magnitude of the field will be\nstored in `|B|`. (This is just a simple example, of course)\n\n## Inspiration for GPUfield\n\nThe GPUfield program was spawned out of my search for a faster way to compute\nmagnetic fields of direct current electromagnets than from the magnetic\nscalar potential. Finally, I ran across this paper:\n\n\u003e Rashdi Shah Ahmad, Amiruddin Bin Shaari, Chew Teong Han, _Magnetic Field\n\u003e Simulation of Golay Coil_, Journal of Fundamental Sciences, 2008.\n\nAfter seeing how much faster and simpler the computations could be, I had to\nwrite my own program. However, there's really no reason to burn CPU cycles on\nsuch an embarrassingly parallel problem, so I hooked into the NVIDIA CUDA API\nto accelerate the computations.\n\n## Valid commands in GPUfield\n\n### `current`\n\nSets the current for subsequent wires to 'i', in Amperes.\n\n```\ncurrent [i]\n```\n\n### `file`\n\nSets the filename for subsequent writes.\n\n```\nfile '[filename]'\n```\n\n### `moveto`\n\nMoves the wire tracer to (x,y,z).\n\n```\nmoveto [x] [y] [z]\n```\n\n### `lineto`\n\nTraces a line from the current location to (x,y,z).\n\n```\nlineto [x] [y] [z]\n```\n\n### `circle`\n\nDraws a circle of 'n' segments along 'dir'.\n\n```\ncircle [dir] [radius] [n]\n```\n\n### `arc`\n\nDraws an arc of 'n' segments from angles 't1' to 't2' along 'dir'.\n\n```\narc [dir] [radius] [t1] [t2] [n]\n```\n\n### `solenoid`\n\nDraws a solenoid of 'n' line segments along 'dir'.\n\n```\nsolenoid [dir] [radius] [pitch] [turns] [n]\n```\n\n### `helmholtz`\n\nDraws a helmholtz coil pair of 'n' segments along 'dir'.\n\n```\nhelmholtz [dir] [radius] [pitch] [turns] [n]\n```\n\n### `maxwell`\n\nDraws a maxwell coil triple of 'n' segments along 'dir'.\n\n```\nmaxwell [dir] [radius] [pitch] [turns] [n]\n```\n\n### `golay`\n\nDraws a golay coil of 'n' segments per arc with longitudinal axis +z and\ngradient axis 'dir'.\n\n```\ngolay [dir] [a] [b] [c] [theta] [radius] [pitch] [turns] [n]\n```\n\n### `traj`\n\nComputes the field along a straight line from the current point to (x,y,z),\nwith 'n' equally spaced points along the line.\n\n```\ntraj [x] [y] [z] [n]\n```\n\n### `grid`\n\nComputes the field over a two-way grid having constant-dimension 'dim'\nand second- and third- dimension extents (u,v) and counts (unum,vnum).\n\n```\ngrid [dim] [u] [v] [unum] [vnum]\n```\n\n### `wires`\n\nWrites the current wire list to the current filename.\n\n```\nwires\n```\n\n### `clear`\n\nClears the wire list.\n\n```\nclear\n```\n\n### `verbose`\n\nTurns on verbose messages.\n\n```\nverbose\n```\n\n### `quiet`\n\nTurns off verbose messages.\n\n```\nquiet\n```\n\n### `end`\n\nQuits the application.\n\n```\nend\nstop\nquit\nhalt\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeekysuavo%2Fgpufield","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeekysuavo%2Fgpufield","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeekysuavo%2Fgpufield/lists"}