{"id":23701319,"url":"https://github.com/p-costa/snac","last_synced_at":"2026-02-08T18:02:36.444Z","repository":{"id":41175674,"uuid":"267328587","full_name":"p-costa/SNaC","owner":"p-costa","description":"A multi-block solver for massively parallel direct numerical simulations (DNS) of fluid flows","archived":false,"fork":false,"pushed_at":"2023-02-02T15:18:08.000Z","size":587,"stargazers_count":43,"open_issues_count":13,"forks_count":12,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-30T18:12:54.848Z","etag":null,"topics":["cfd","computational-fluid-dynamics","fluid-dynamics","fluid-simulation","fortran","high-performance-computing","turbulence"],"latest_commit_sha":null,"homepage":"","language":"Fortran","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/p-costa.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":"2020-05-27T13:36:09.000Z","updated_at":"2025-05-27T05:39:49.000Z","dependencies_parsed_at":"2023-02-17T21:30:51.727Z","dependency_job_id":null,"html_url":"https://github.com/p-costa/SNaC","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/p-costa/SNaC","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p-costa%2FSNaC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p-costa%2FSNaC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p-costa%2FSNaC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p-costa%2FSNaC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/p-costa","download_url":"https://codeload.github.com/p-costa/SNaC/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p-costa%2FSNaC/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267605947,"owners_count":24114619,"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-07-28T02:00:09.689Z","response_time":68,"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":["cfd","computational-fluid-dynamics","fluid-dynamics","fluid-simulation","fortran","high-performance-computing","turbulence"],"created_at":"2024-12-30T09:36:38.320Z","updated_at":"2026-02-08T18:02:36.355Z","avatar_url":"https://github.com/p-costa.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Synopsis\n\n**SNaC** is [**CaNS**](https://github.com/p-costa/CaNS) spelled backwards, and is a multi-block code for massively parallel direct numerical simulations (DNS) of fluid flows. *SNaC* aims at combining the versatility of a multi-block DNS solver, with the FFT-based acceleration used in CaNS.\n\nThe solver is able to simulate the flow in any three-dimensional multi-block structured Cartesian grid. However, if the geometry has one homogeneous, 'extruded' direction with constant grid spacing, SNaC can use a very fast solver that exploits FFTs in this direction. This is SNaC's *warp drive* :rocket:, as it yields a huge speedup in wall-clock time per time step.\n\n**Reference**\n\nP. Costa. *A FFT-accelerated multi-block finite-difference solver for massively parallel simulations of incompressible flows*.\nComput. Phys. Commun. 271 : 108194 (2022) [[DOI:10.1016/j.cpc.2021.108194]](https://doi.org/10.1016/j.cpc.2021.108194) [[arXiv:2106.03583]](https://arxiv.org/pdf/2106.03583.pdf).\n\n## News\n[08/07/2022] The input files describing the block geometry (under `geo/block.???`) have been simplified. Now, instead of prescribing the lower and upper extents of each block `lo(:)` and `hi(:)`, the number of grid points `ng(:)` is prescribed. This change makes it much easier to refine the grid, since one does not need to correct extents of neighboring blocks. See the updated [`src/INFO_INPUT.md`](src/INFO_INPUT.md) for more details.\n\n## Features\n\nSome features are:\n\n * Multi-block, three-dimensional parallelization\n * Hybrid MPI/OpenMP parallelization\n * FFT-based synthesis of the Poissonn equation along one direction\n * HYPRE library used to solve Poisson/Helmholtz equations\n * Parallel I/O using MPI I/O\n * A different canonical flow can be simulated just by changing the input files\n\n## Motivation\n\n*SNaC* is meant to serve as a multi-block DNS code for fast, massively-parallel simulations of single-phase flows, and as a solid base solver on top of which more complex phenomena can be implemented, such as numerical methods for multiphase flows.\n\n## Method\n\nThe fluid flow is solved with a standard second-order finite-difference/-volume pressure correction scheme. Time is advanced with a three-step low storage Runge-Kutta scheme. Optionally, for increased stability at low Reynolds numbers, at the price of higher computational demand, the diffusion term can be treated implicitly.\n\n## Usage\n\n### Input files\n\nThe input files `dns.in` sets the physical and computational parameters, while the block files `geo/block.???` setup block-specific parameters. In the `examples/` folder are examples of input files for several canonical flows. See [`src/INFO_INPUT.md`](src/INFO_INPUT.md) for a detailed description of the input files.\n\nFiles `out1d.h90`, `out2d.h90` and `out3d.h90` in `src/` set which data are written in 1-, 2-, and 3-dimensional output files, respectively. *The code should be recompiled after editing out?d.h90 files*.\n\n### Build\n\nThe code should be compiled in `src/`. The prerequisites are the following:\n\n * MPI\n * [*HYPRE*](https://github.com/hypre-space/hypre)\n * OpenMP (optional)\n * *FFTW* (optional, in case FFT acceleration is used)\n\nThe Makefile in `src/` should be modified in agreement to the installation paths of each library. Also, the following preprocessor options are available:\n\n * `-D_TIMING`           : wall-clock time per time step is computed\n * `-D_IMPDIFF`          : diffusion term of the N-S equations is integrated in time with an implicit discretization (thereby improving the stability of the numerical algorithm for viscous-dominated flows)\n * `-D_SINGLE_PRECISION` : calculation will be carried out in single precision (the default precision is double)\n * `-D_FFT_?`, with `?` being `X`, `Y` or `Z`: will use FFTs to solve the Poisson equation in the direction in question.\n\nTyping `make run` will compile the code and copy the executable `snac` and input file `dns.in` to a `run/` folder.\n\n### Running the code\n\nRun the executable with `mpirun` with a number of tasks and shared threads complying to what has been set in the input file `dns.in` (or in the `geo/block.???` files in case of multi-block). Data will be written by default in a folder named `data/`, which must be located where the executable is run.\n\n### Visualizing field data\n\nSee [`src/INFO_VISU.md`](src/INFO_VISU.md).\n\n## Notes\n\nI appreciate any feedback that can improve the code. Also, feel free to send case files pertaining to flows not listed in the examples folder.\n\nPlease read the `LICENSE` file.\n\n## Contributors\n\nPedro Costa (p.simoes.costa@gmail.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp-costa%2Fsnac","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fp-costa%2Fsnac","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp-costa%2Fsnac/lists"}