From 8a9583af50715b8284029c58c099ffcdc009f347 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Thu, 17 Oct 2024 22:52:47 -0300 Subject: [PATCH] Update README.md --- README.md | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 866b355..7bc0500 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[foamlib](https://github.com/gerlero/foamlib) +[foamlib](https://github.com/gerlero/foamlib) [![Documentation](https://img.shields.io/readthedocs/foamlib)](https://foamlib.readthedocs.io/) [![CI](https://github.com/gerlero/foamlib/actions/workflows/ci.yml/badge.svg)](https://github.com/gerlero/foamlib/actions/workflows/ci.yml) @@ -14,18 +14,20 @@ [![Docker](https://github.com/gerlero/foamlib/actions/workflows/docker.yml/badge.svg)](https://github.com/gerlero/foamlib/actions/workflows/docker.yml) [![Docker image](https://img.shields.io/badge/docker%20image-microfluidica%2Ffoamlib-0085a0)](https://hub.docker.com/r/microfluidica/foamlib/) +## ๐Ÿ‘‹ Basics + **foamlib** provides a simple, modern and ergonomic Python interface for interacting with [OpenFOAM](https://www.openfoam.com). -It offers the following classes: +It offers the following Python classes: * [`FoamFile`](https://foamlib.readthedocs.io/en/stable/files.html#foamlib.FoamFile) (and [`FoamFieldFile`](https://foamlib.readthedocs.io/en/stable/files.html#foamlib.FoamFieldFile)): read-write access to OpenFOAM configuration and field files as if they were Python `dict`s, using `foamlib`'s own parser. Supports ASCII and binary field formats (with or without compression). * [`FoamCase`](https://foamlib.readthedocs.io/en/stable/cases.html#foamlib.FoamCase): a class for configuring, running, and accessing the results of OpenFOAM cases. * [`AsyncFoamCase`](https://foamlib.readthedocs.io/en/stable/cases.html#foamlib.AsyncFoamCase): variant of `FoamCase` with asynchronous methods for running multiple cases at once. * [`AsyncSlurmFoamCase`](https://foamlib.readthedocs.io/en/stable/cases.html#foamlib.AsyncSlurmFoamCase): subclass of `AsyncFoamCase` used for running cases on a Slurm cluster. -## Get started +## โ˜‘๏ธ Get started -### Install +### ๐Ÿ“ฆ Install * With [pip](https://pypi.org/project/pip/): @@ -39,7 +41,7 @@ It offers the following classes: conda install -c conda-forge foamlib ``` -### Clone a case +### ๐Ÿ‘ Clone a case ```python import os @@ -51,13 +53,13 @@ pitz_tutorial = FoamCase(Path(os.environ["FOAM_TUTORIALS"]) / "incompressible/si my_pitz = pitz_tutorial.clone("myPitz") ``` -### Run the case +### ๐Ÿƒ Run the case ```python my_pitz.run() ``` -### Access the results +### ๐Ÿ”Ž Access the results ```python latest_time = my_pitz[-1] @@ -69,19 +71,19 @@ print(p.internal_field) print(U.internal_field) ``` -### Clean the case +### ๐Ÿงน Clean the case ```python my_pitz.clean() ``` -### Edit the `controlDict` file +### โš™๏ธ Edit the `controlDict` file ```python my_pitz.control_dict["writeInterval"] = 10 ``` -### Make multiple file reads and writes in a single go +### ๐Ÿ“ Make multiple file reads and writes in a single go ```python with my_pitz.fv_schemes as f: @@ -89,7 +91,7 @@ with my_pitz.fv_schemes as f: f["snGradSchemes"]["default"] = "uncorrected" ``` -### Run a case asynchronously +### โณ Run a case asynchronously ```python import asyncio @@ -102,7 +104,7 @@ async def run_case(): asyncio.run(run_case()) ``` -### Parse a field using the [`FoamFieldFile`](https://foamlib.readthedocs.io/en/stable/#foamlib.FoamFieldFile) class directly +### ๐Ÿ”ข Parse a field using the [`FoamFieldFile`](https://foamlib.readthedocs.io/en/stable/#foamlib.FoamFieldFile) class directly ```python from foamlib import FoamFieldFile @@ -112,7 +114,7 @@ U = FoamFieldFile(Path(my_pitz) / "0/U") print(U.internal_field) ``` -### Run an optimization loop in parallel +### ๐Ÿ” Run an optimization loop in parallel ```python import os @@ -132,7 +134,7 @@ async def cost(x): result = differential_evolution(cost, bounds=[(-1, 1)], workers=AsyncFoamCase.map, polish=False) ``` -### Use it to create a `run` (or `clean`) script +### ๐Ÿ“„ Use it to create a `run` (or `clean`) script ```python #!/usr/bin/env python3 @@ -144,6 +146,6 @@ case = FoamCase(Path(__file__).parent) case.run() ``` -## Documentation +## ๐Ÿ“˜ Documentation For more information, check out the [documentation](https://foamlib.readthedocs.io/).