{"id":21323393,"url":"https://github.com/sag2021/crump","last_synced_at":"2026-01-03T07:06:07.992Z","repository":{"id":260977519,"uuid":"876551347","full_name":"sag2021/crump","owner":"sag2021","description":"Potential field module","archived":false,"fork":false,"pushed_at":"2024-11-06T01:50:18.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T12:11:38.845Z","etag":null,"topics":["cartesian","finite-difference","fortran2003","magnetic-field","modernfortran","potential-fields","science-research","successive-over-relaxation"],"latest_commit_sha":null,"homepage":"","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sag2021.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-22T06:56:01.000Z","updated_at":"2024-11-06T01:50:21.000Z","dependencies_parsed_at":"2025-01-22T12:11:23.356Z","dependency_job_id":"af3a2cbd-c3c6-42ef-b41a-281d4a3f075f","html_url":"https://github.com/sag2021/crump","commit_stats":null,"previous_names":["sag2021/crump"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sag2021%2Fcrump","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sag2021%2Fcrump/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sag2021%2Fcrump/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sag2021%2Fcrump/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sag2021","download_url":"https://codeload.github.com/sag2021/crump/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243801687,"owners_count":20350108,"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","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":["cartesian","finite-difference","fortran2003","magnetic-field","modernfortran","potential-fields","science-research","successive-over-relaxation"],"created_at":"2024-11-21T20:23:43.115Z","updated_at":"2026-01-03T07:06:07.954Z","avatar_url":"https://github.com/sag2021.png","language":"Fortran","readme":"# Overview \n\nCheckerboard Relaxation Method Used for Potential field reconstructions (CRUMP). The code computes the current-free (potential) magnetic field in a domain that matches the normal component of a specified magnetic field\non the boundary. The domain is a Cartesian box and the boundary is the six planar faces of the box. For a fixed normal component, the potential field represents a minimum energy state \nfor the magnetic field. The potential magnetic field is found from the gradient of a scalar potential using a checkerboard Successive Over-Relaxation (SOR) method for the solution of Laplace's equation. The code has a Python frontend and Fortran backend. This code was written as a quick way to perform a specific calculation, so it's not particularly versatile. \n\nA previous version of this code was used in Mastrano, Wheatland, and Gilchrist (2018)[^1].\nThe difference between this version and that one is superficial. The original was designed to be called from IDL, whereas this version\nhas a Python frontend. \n\nMore information on the method of SOR in general can be found in most text books on numerical methods e.g. Press et al. [^2].\n\n[^1]: Mastrano, A., Wheatland, M.S., and Gilchrist, S.A.:2018, Solar Physics,293,130 (doi:10.1007/s11207-018-1351-0).\n[^2]: Press, W.H. Teukolsky, S.A., Vetterling, W.T., Flannery, B.P.: 2007,Numerical Recipes 3rd Edition: The Art of Scientific Computing,Cambridge University Press,ISBN:9780521880688\n\n# Neumann boundary conditions \n\nWhen the normal component is specified on all boundaries, the scalar potential, u, is only unique up to a constant. Hence, CRUMP enforces the additional\ncondition $\\langle u \\rangle = 0$ in the volume, which resolves this ambiguity. This choice doesn't affect the magnetic field. \n\nIn addition, when $\\mathbf B$ normal is fixed on all the boundaries, an additional compatibility condition comes into play. Specifically, the net magnetic \nflux must balance when integrated over all six faces of the box. If this isn't the case, then $\\nabla\\cdot\\mathbf B = 0$ can't be achieved in the volume. \n\n# Code details\n\nThe code takes a given magnetic field, $\\mathbf B$,in a Cartesian box and computes a potential field based on the value of the normal component of B on each of the six boundaries.  \nIt returns both the magnetic field and the magnetic scalar potential. Everything is computed in non-dimensional units. \n\nThe calculation is performed using a second-order-finite-difference scheme. Successive Over-Relaxation (SOR) is used to solve the finite-difference system. \nHence, the truncation error should scaled as $E \\sim h^2$, where $h$ is the mesh spacing. The run time will scale as $t \\sim N^4$, where $N$ is the number of mesh points in a given dimension (and therefore $N^3$ in total). \n\nThe Fortran backend is written in Fortran 2003 and parallelized for shared memory parallel computers using OpenMP. \n\n# Usage\n\nFirst compile the shared library. This has been tested under gfortran. \n\nSee the test.py script for how to use the Python frontend and the docstring for crump.solve. \n\n# Mesh\n\nThe mesh spacing is assumed to be uniform, i.e. $dx=dy=dz$. The mesh spacing is not passed as an argument, instead dx is inferred from the array shape\nas $dx = 1/(nx-1)$, where nx = shape[-1]. In other words, the domain is always assumed to have a non-dimensional length of 1 in the x direction. This\nassumption is pretty restrictive, but the code was designed to solve one particular problem on a uniform mesh, not be a general method.\n\n# REAL and INTEGER types\n\nThere are three basic types used by CRUMP: REAL(FP),INTEGER(IT), and INTEGER(C_INT). \nThe former two are used in calculations. They may be set in the CRUMP_MOD module. By default they \nare C_DOUBLE and C_INT64_T. Setting these to different types (e.g. single) won't break the Fortran module, but\nCRUMP can no longer be called by the Python module: crump.py expects double and int64.\n\nSome integers are also C_INT. These correspond to positions in the options vector and function return types indended to be\ncalled from Python. \n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsag2021%2Fcrump","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsag2021%2Fcrump","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsag2021%2Fcrump/lists"}