Skip to content
Snippets Groups Projects
Commit 34aeb001 authored by Pierre Augier's avatar Pierre Augier
Browse files

Improve doc for 0.0.7

parent 45285f19
No related branches found
No related tags found
1 merge request!96Topic/default/prepare 0.0.7
Pipeline #68376 passed
......@@ -20,8 +20,9 @@
The `--all-extras` options installs more utilities for Fluidsimfoam developers.
```{admonition} Note on installing OpenFOAM on Ubuntu/Debian
:class: dropdown
---
class: dropdown
---
The official Ubuntu/Debian packages (installed with `sudo apt install
openfoam`) are quite broken but work better when the environment variable
`WM_PROJECT_DIR` is set to `/usr/share/openfoam`. If you can, use
......@@ -31,8 +32,9 @@
```
````{admonition} Note on activating OpenFOAM with Xonsh
:class: dropdown
---
class: dropdown
---
To activate OpenFOAM installed from
[openfoam.com](https://www.openfoam.com/news/main-news/openfoam-v2212), one
needs to run something like this horrible line:
......
......@@ -89,7 +89,7 @@
# 'special-members': '__init__',
"undoc-members": True,
"exclude-members": "__weakref__",
"inherited-members": True,
"inherited-members": False,
}
autodoc_mock_imports = ["IPython"]
......
......@@ -7,7 +7,8 @@
-c $FOAM_TUTORIALS/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater
```
See https://www.xsim.info/articles/OpenFOAM/en-US/tutorials/heatTransfer-chtMultiRegionFoam-snappyMultiRegionHeater.html
See
https://www.xsim.info/articles/OpenFOAM/en-US/tutorials/heatTransfer-chtMultiRegionFoam-snappyMultiRegionHeater.html
## Installation
......
......@@ -6,6 +6,7 @@
intersphinx_mapping = dict(
python=("https://docs.python.org/3", None),
jinja2=("https://jinja.palletsprojects.com/en/3.0.x", None),
invoke=("https://www.pyinvoke.org/", None),
fluiddyn=("https://fluiddyn.readthedocs.io/en/latest", None),
fluidsim=("https://fluidsim.readthedocs.io/en/latest", None),
)
......
......@@ -11,6 +11,7 @@
output
util
resources
invoke
.. rubric:: Modules
......@@ -22,7 +23,6 @@
init_fields
operators
log
tasks
testing
params
......
......@@ -5,6 +5,7 @@
import os
from pathlib import Path
from shutil import copytree, rmtree
from typing import Optional
import invoke.context
......@@ -13,4 +14,6 @@
class Context(invoke.context.Context):
"""Extended Invoke Context for OpenFOAM"""
time_as_str = time_as_str()
......@@ -16,4 +19,6 @@
time_as_str = time_as_str()
"""Time of Invoke call
"""
def __init__(self, *args, **kwargs):
self._set(path_run=Path.cwd())
......@@ -30,7 +35,13 @@
super().__init__(*args, **kwargs)
def run_appl(self, command, name_command=None, suffix_log=None):
def run_appl(
self,
command: str,
name_command: Optional[str] = None,
suffix_log: Optional[str] = None,
):
"""Run an OpenFOAM application and save the log"""
if name_command is None:
name_command = command.split()[0]
......@@ -47,12 +58,12 @@
def run_appl_once(
self,
command,
suffix_log=None,
dict_file=None,
check_dict_file=True,
force=False,
parallel_if_needed=False,
path_decompose_par_dict=None,
nsubdoms=None,
command: str,
suffix_log: Optional[str] = None,
dict_file: Optional[str] = None,
check_dict_file: bool = True,
force: bool = False,
parallel_if_needed: bool = False,
path_decompose_par_dict: Optional[str] = None,
nsubdoms: Optional[int] = None,
):
......@@ -58,4 +69,5 @@
):
"""Run an OpenFOAM application only once per simulation"""
command_name = command.split()[0]
if check_dict_file and not force:
......@@ -99,7 +111,8 @@
)
def save_0_dir(self):
"""Save ``0`` directory in ``O.orig``"""
print("Saving 0 to O.orig")
copytree("0", "O.orig", dirs_exist_ok=True)
def restore_0_dir(self):
......@@ -102,7 +115,8 @@
print("Saving 0 to O.orig")
copytree("0", "O.orig", dirs_exist_ok=True)
def restore_0_dir(self):
"""Restore ``0`` directory from ``O.orig``"""
print("Restoring 0 directory")
paths_0 = ["0"]
paths_0.extend(Path.cwd().glob("processor*/0"))
......
"""Invoke tasks to be used from the ``tasks.py`` file in the solvers"""
"""Invoke tasks to be used from the ``tasks.py`` file in the solvers
.. autodata:: clean
.. autodata:: block_mesh
.. autodata:: surface_feature_extract
.. autodata:: snappy_hex_mesh
.. autodata:: polymesh
.. autodata:: set_fields
.. autodata:: decompose_par
.. autodata:: run
"""
import re
from pathlib import Path
......@@ -18,6 +29,7 @@
@task
def clean(context):
"""clean with foamCleanTutorials"""
context.run("foamCleanTutorials", warn=True)
for path in Path(".").glob(".data_fluidsim/*_called*"):
path.unlink()
......@@ -25,8 +37,9 @@
@task
def block_mesh(context):
"""Run ``blockMesh``"""
context.run_appl_once("blockMesh")
@task
def surface_feature_extract(context):
......@@ -28,8 +41,9 @@
context.run_appl_once("blockMesh")
@task
def surface_feature_extract(context):
"""Run ``surfaceFeatureExtract``"""
context.run_appl_once("surfaceFeatureExtract")
......@@ -38,6 +52,7 @@
@task
def snappy_hex_mesh(context):
"""Run ``snappyHexMesh -overwrite``"""
context.run_appl_once(
"snappyHexMesh -overwrite",
parallel_if_needed=True,
......@@ -52,8 +67,9 @@
@task
def set_fields(context, force=False):
"""Run ``setFields``"""
context.run_appl_once("setFields")
@task
def decompose_par(context):
......@@ -55,8 +71,9 @@
context.run_appl_once("setFields")
@task
def decompose_par(context):
"""Run ``decomposePar``"""
context.run_appl_once("decomposePar")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment