{"id":14989267,"url":"https://github.com/stefanmeili/fastfd","last_synced_at":"2025-04-12T00:32:02.511Z","repository":{"id":45389163,"uuid":"345477919","full_name":"stefanmeili/FastFD","owner":"stefanmeili","description":"A library for building finite difference simulations","archived":false,"fork":false,"pushed_at":"2021-04-22T21:43:51.000Z","size":63153,"stargazers_count":34,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-25T20:51:12.789Z","etag":null,"topics":["cupy","electromagnetic-simulation","engineering-design","engineering-tools","finite-difference","finite-difference-simulations","fluid-dynamics","heat-transfer","mechanical-engineering","partial-differential-equations","pde","pde-solver","physics-simulation","process-simulation","python","scipy","simulation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stefanmeili.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":"2021-03-07T23:32:30.000Z","updated_at":"2025-03-11T07:32:26.000Z","dependencies_parsed_at":"2022-07-13T22:50:30.783Z","dependency_job_id":null,"html_url":"https://github.com/stefanmeili/FastFD","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanmeili%2FFastFD","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanmeili%2FFastFD/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanmeili%2FFastFD/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanmeili%2FFastFD/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stefanmeili","download_url":"https://codeload.github.com/stefanmeili/FastFD/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501408,"owners_count":21114674,"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":["cupy","electromagnetic-simulation","engineering-design","engineering-tools","finite-difference","finite-difference-simulations","fluid-dynamics","heat-transfer","mechanical-engineering","partial-differential-equations","pde","pde-solver","physics-simulation","process-simulation","python","scipy","simulation"],"created_at":"2024-09-24T14:17:58.001Z","updated_at":"2025-04-12T00:32:02.217Z","avatar_url":"https://github.com/stefanmeili.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FastFD\nA finite differences simulation library.\n\nThis package lets you quickly build simple numerical simulations.\n\n## Features\n * Quickly build finite difference simulations with an arbitrary number of domains, scalars, dimensions and boundary conditions.\n * Concise, clear syntax.\n * Build models for CPU or GPU using Scipy or Cupy sparse libraries.\n * Arbitrary derivative order and approximation accuracy.\n * Partial model updates minimize overheads in iterative solutions.\n * Implicit transient simulation.\n\n## Installation\n```\npip install fastfd\n```\n\n## Usage\n```python\n# Import fastfd and select the scipy sparse library (or cupy for GPU support)\nimport fastfd as ffd\nffd.sparse_lib('scipy')\n\nimport numpy as np\n\n# Define axes\nx = ffd.LinearAxis('x', start = 0, stop = 1, num = 201)\ny = ffd.LinearAxis('y', start = 0, stop = 1, num = 201)\n\n# Define scalars\nT = ffd.Scalar('T', [x, y], accuracy = 4)\n\n# Define the model\nmodel = ffd.FDModel([T])\n\n# Set model governing equations (thermal diffusion)\nmodel.update_equations({\n    'Conductivity': ((T.d('x', 2) + T.d('y', 2)), 0),\n})\n\n# Set model boundary conditions\nmodel.update_bocos({\n    'Tx=1 adiabatic': (T.i[-1, :], T.d('x')[-1, :], 0),\n    'Ty=1 adiabatic': (T.i[:, -1], T.d('y')[:, -1], 0),\n    'Tx=0 sinewave': (T.i[0, :], T.i[0, :], 100 * np.sin(x.coords * 2*np.pi)),\n    'Ty=0 sinewave': (T.i[:, 0], T.i[:, 0], -100 * np.sin(y.coords * 2*np.pi)),\n})\n\n# Solve the model\nresult = model.solve()\n\n```\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"./docs/readme/example_result.png\" alt=\"Model Solution\" width=\"500\"/\u003e\n\u003c/p\u003e\n\n## GPU\nFastFD can be set to use the Cupyx sparse libraries, though support is still a little rough around the edges. The current\nversion of Cupy (8.5) only supports a least squares solver ('lsqr') which is much slower than the default 'spsolve'.\nHowever, spsolve will be implemented in the upcoming release of Cupy 9.0.\n\n\n## Example Notebooks\nSee example notebooks here: \u003ca href=\"./docs/examples\"\u003e ./docs/examples \u003c/a\u003e for a more detailed explanation of how to use.\n\n\u003cimg src=\"./docs/readme/heat_conduction_result.png\"\n    alt=\"Steady state heat conduction\" \n    style=\"float: left; margin-right: 10px;\"\n    width=\"265\"/\u003e \u003cimg src=\"./docs/readme/transient_wave_result.png\"\n    alt=\"Transient 1D wave propagation\"\n    style=\"float: left; margin-right: 10px;\"\n    width=\"325\"/\u003e \u003cimg src=\"./docs/readme/shoreline_waves_result.png\"\n    alt=\"Transient 2D wave propagation\"\n    style=\"float: left; margin-right: 10px;\"\n    width=\"232\"/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanmeili%2Ffastfd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefanmeili%2Ffastfd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanmeili%2Ffastfd/lists"}