diff --git a/INSTALL.rst b/INSTALL.rst index 9810407..9349921 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -1,7 +1,13 @@ Installation ============ -Recommended way is to install a package in the virtual environment. +Base package +------------ + +Via virtual environment (recommended) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +A recommended way is to install a package in the virtual environment. Just create and activate python virtual environment: .. code-block:: bash @@ -16,49 +22,74 @@ and run pip inside (upgrade pip if you need): (env) $ python -m pip install --upgrade pip (env) $ python -m pip install . +User installation +~~~~~~~~~~~~~~~~~ + +Same but without the virtual environment: + +.. code-block:: bash + + $ python -m pip install --upgrade pip + $ python -m pip install . + + External applications --------------------- -Anisotropy project requires ``Salome`` and ``OpenFOAM`` executables be ``PATH``. +Anisotropy project requires ``Salome`` executable and ``OpenFOAM`` ``bashrc`` script be in ``PATH``. +You can choose your way by following one of the next step. -1. For simple way you can use next commands (each time): +* You can use next commands directly (each time): .. code-block:: bash - $ export PATH="${PATH}:${HOME}/PATH/TO/SALOME/DIRECTORY" + $ export PATH="${HOME}/PATH/TO/SALOME/DIRECTORY:${PATH}" $ source "${HOME}/PATH/TO/OPENFOAM/DIRECTORY/etc/bashrc" -2. Or modify file ``conf/bashrc`` in project directory (example) +* Or modify file ``anisotropy/config/bashrc`` in project directory (example, ``bash``) .. code-block:: bash - export PATH="${PATH}:${HOME}/programs/salome/SALOME-9.7.0-MPI" + export PATH="${HOME}/programs/salome/SALOME-9.7.0-MPI:${PATH}" source "${HOME}/programs/OpenFOAM/OpenFOAM-v2012/etc/bashrc" and source it (each time): .. code-block:: bash - $ source conf/bashrc + $ source anisotropy/config/bashrc -3. The best way is modify file like in step 2 and append it to virtual environment activate script: +* The best way is to modify ``anisotropy/config/bashrc`` like in step 2 and append it to the virtual environment ``activate`` script: .. code-block:: bash - $ cat conf/bashrc | tee -a env/bin/activate + $ cat anisotropy/config/bashrc | tee -a env/bin/activate So next time you just need to ``source env/bin/activate`` and you completely ready. +* You should add paths to ``~/.bashrc`` (``bash``) if you installed ``anisotropy`` in user path: + +.. code-block:: bash + + $ cat anisotropy/config/bashrc | tee -a ~/.bashrc + + Building documentaion --------------------- -For building documentaion you must sure that all requirements installed. -Project uses ``Sphinx`` and ``make`` for building: +For building a documentaion you should install a documentaion requirements: .. code-block:: bash $ source env/bin/activate + (env) $ python -m pip install "../anisotropy[documentaion]" + + +Then just run ``make`` with your best format option: + +.. code-block:: bash + (env) $ cd docs (env) $ make html - +For more information about options you can read ``Sphinx`` documentaion or run ``make help``. diff --git a/README.rst b/README.rst index 7505851..71ec902 100644 --- a/README.rst +++ b/README.rst @@ -1,20 +1,96 @@ anisotropy ========== -Requirements +.. figure:: docs/source/static/simple.png + :scale: 50% + :align: center + :alt: + + +.. figure:: static/simple.png + :scale: 50% + :align: center + :alt: + +anisotropy is a ``Python`` package that is the result of science-research work +on the anisotropy of permeability in the periodic porous media. +A project uses own wrappers around external applications +for constructing a shapes and meshes (``Salome``) and computing a flow (``OpenFOAM``). + +Dependencies ------------ -.. csv-table:: Requirements +.. csv-table:: :header: "Software", "Used version", "Recommended version" - "Python", "3.9.6", "> 3.6" - "Salome", "9.7.0", "> 9.6.0" - "OpenFOAM", "v2012", "" + "`Python `_", "3.9.6", ">= 3.8" + "`Salome `_", "9.7.0", ">= 9.6.0" + "`OpenFOAM `_", "v2012", "" Installation ------------ -For installation guide see ``INSTALL``. +.. toctree:: + :maxdepth: 2 + + INSTALL + +Getting Started +--------------- + +Initializing a new anisotropy project +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To create a new anisotropy project, you'll use the ``anisotropy init`` command. +``anisotropy init`` is a one-time command you use during the initial setup of a new project. + +Example: + +.. code-block:: bash + + $ mkdir ~/aproject + $ cd ~/aproject + $ anisotropy init + +Executing this command will create a new ``anisotropy.db``, ``anisotropy.toml`` files in your +current working directory. This will also create ``build`` and ``logs`` directories for output files. + +Database ``anisotropy.db`` is used for storing current values and results. +With ``anisotropy.toml`` you can configure all an initial values. + +Computing +~~~~~~~~~ + +To start a computation, you'll use the ``anisotropy compute`` command. Using flag ``--stage`` you can +control what you need to compute (mesh or flow). Using flag ``--param`` you can specify which +structure/direction/theta you need to compute. + +Example: + +.. code-block:: bash + + $ anisotropy compute --stage mesh --param type=simple --param direction="[1.0, 0.0, 0.0]" --param theta=0.01 + +.. attention:: + + * You can't compute a flow without mesh (if you didn't it before succesfully). + * ``type``, ``direction`` and ``theta`` is control parameters. If you aren't specifying it than default range of values will be used from ``anisotropy.toml``. + +Post-processing +~~~~~~~~~~~~~~~ + +To use post-processing tools, you'll use the ``anisotropy postprocessing`` command. + +Example: + +.. code-block:: bash + + $ anisotropy postprocessing permeability + +Additional help +~~~~~~~~~~~~~~~ + +You always can use ``--help`` flag with any of ``anistropy`` command to get more information. License ------- diff --git a/anisotropy/config/bashrc b/anisotropy/config/bashrc new file mode 100644 index 0000000..b3b941c --- /dev/null +++ b/anisotropy/config/bashrc @@ -0,0 +1,3 @@ +# Example of anisotropy bashrc entries (modify it) +export PATH="${HOME}/programs/salome/SALOME-9.7.0-MPI:${PATH}" +source "${HOME}/programs/OpenFOAM/OpenFOAM-v2012/etc/bashrc" diff --git a/bin/anisotropy b/bin/anisotropy deleted file mode 100755 index ce892d0..0000000 --- a/bin/anisotropy +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env bash -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.." -cd ${DIR} - -anisotropy-help() -{ - echo "Usage:" - echo " anisotropy [options]" - echo "" - echo "Commands:" - echo " clean Clean project directory via git (.gitignore)." - echo " init Activate environment and install dependencies." - echo " run Start calculations and etc." - echo " kill Kill current process by pid" - echo " help Show help for commands." - echo "" - echo "Options:" - echo " -c, --config Use custom configuration file." - echo " -s, --safe Safe mode (skip successfuly computed mesh/flow)" - echo " -a, --all All mode (overwrites everything)" -} - -case $1 in - clean) - git clean -fdx - ;; - - init) - python -m venv env - source env/bin/activate - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - deactivate - ;; - - run) - source ${OPENFOAM} - source env/bin/activate - - mkdir "${DIR}/build" - echo $$ >"${DIR}/build/anisotropy.pid" - - python "${DIR}/anisotropy/anisotropy.py" ${@:2} - deactivate - - rm "${DIR}/build/anisotropy.pid" - ;; - - kill) - pkill -TERM -P $(cat "${DIR}/build/anisotropy.pid") - rm "${DIR}/build/anisotropy.pid" - ;; - - help) - anisotropy-help - exit 1 - ;; - - *) - echo "Unknown command." - anisotropy-help - exit 1 - ;; -esac diff --git a/conf/bashrc b/conf/bashrc deleted file mode 100644 index 8aa1874..0000000 --- a/conf/bashrc +++ /dev/null @@ -1,2 +0,0 @@ -export PATH="${PATH}:${HOME}/programs/salome/SALOME-9.7.0-MPI" -source "${HOME}/programs/OpenFOAM/OpenFOAM-v2012/etc/bashrc" diff --git a/conf/config.toml b/conf/config.toml deleted file mode 100644 index daa9c4a..0000000 --- a/conf/config.toml +++ /dev/null @@ -1,50 +0,0 @@ -[base] -simple = false -bodyCentered = false -faceCentered = true - -[[structures]] - name = "simple" - - [structures.geometry] - theta = [0.01, 0.28, 0.01] - - [structures.mesh] - viscousLayers = true - thickness = [0.01, 0.005] - - [structures.submesh.strips] - growthRate = 0.2 - nbSegPerEdge = 2 - nbSegPerRadius = 3 - -[[structures]] - name = "bodyCentered" - - [structures.geometry] - theta = [0.01, 0.17, 0.01] - - [structures.mesh] - viscousLayers = true - thickness = [0.005, 0.0005] - - [structures.submesh.strips] - growthRate = 0.2 - nbSegPerEdge = 2 - nbSegPerRadius = 3 - -[[structures]] - name = "faceCentered" - - [structures.geometry] - theta = [0.01, 0.13, 0.01] - - [structures.mesh] - viscousLayers = true - thickness = [0.001, 0.0005] - - [structures.submesh.strips] - growthRate = 0.2 - nbSegPerEdge = 2 - nbSegPerRadius = 3 - diff --git a/docs/=source/static/er-diagram.png b/docs/=source/static/er-diagram.png new file mode 100644 index 0000000..b748659 Binary files /dev/null and b/docs/=source/static/er-diagram.png differ diff --git a/docs/Makefile b/docs/Makefile index d0c3cbf..e9e0887 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -5,8 +5,10 @@ # from the environment for the first two. SPHINXOPTS ?= SPHINXBUILD ?= sphinx-build +SPHINXAPIDOC ?= sphinx-apidoc SOURCEDIR = source BUILDDIR = build +PROJECTDIR = .. # Put it first so that "make" without argument is like "make help". help: @@ -18,3 +20,12 @@ help: # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +update: + @$(SPHINXAPIDOC) -f -o "$(SOURCEDIR)" "$(PROJECTDIR)" + rm -vf "$(SOURCEDIR)/modules.rst" "$(SOURCEDIR)/tests.rst" "$(SOURCEDIR)/setup.rst" + sed -i 's/:maxdepth: 4/:maxdepth: 1/' "$(SOURCEDIR)/anisotropy.rst" + cp -vf "$(PROJECTDIR)/README.rst" "$(SOURCEDIR)/" + cp -vf "$(PROJECTDIR)/INSTALL.rst" "$(SOURCEDIR)/" + peewee-erd -o="$(SOURCEDIR)/static/er-diagram.png" --main-color="#333333" --bg-color="#eeeeee" --font-size="12" "$(PROJECTDIR)/anisotropy/core/models.py" + pydeps "$(PROJECTDIR)/anisotropy" --max-bacon 2 --cluster -o "$(SOURCEDIR)/static/structure.png" -T png --noshow diff --git a/docs/make.bat b/docs/make.bat deleted file mode 100644 index 6247f7e..0000000 --- a/docs/make.bat +++ /dev/null @@ -1,35 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=source -set BUILDDIR=build - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% - -:end -popd diff --git a/docs/source/INSTALL.rst b/docs/source/INSTALL.rst index 9810407..9349921 100644 --- a/docs/source/INSTALL.rst +++ b/docs/source/INSTALL.rst @@ -1,7 +1,13 @@ Installation ============ -Recommended way is to install a package in the virtual environment. +Base package +------------ + +Via virtual environment (recommended) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +A recommended way is to install a package in the virtual environment. Just create and activate python virtual environment: .. code-block:: bash @@ -16,49 +22,74 @@ and run pip inside (upgrade pip if you need): (env) $ python -m pip install --upgrade pip (env) $ python -m pip install . +User installation +~~~~~~~~~~~~~~~~~ + +Same but without the virtual environment: + +.. code-block:: bash + + $ python -m pip install --upgrade pip + $ python -m pip install . + + External applications --------------------- -Anisotropy project requires ``Salome`` and ``OpenFOAM`` executables be ``PATH``. +Anisotropy project requires ``Salome`` executable and ``OpenFOAM`` ``bashrc`` script be in ``PATH``. +You can choose your way by following one of the next step. -1. For simple way you can use next commands (each time): +* You can use next commands directly (each time): .. code-block:: bash - $ export PATH="${PATH}:${HOME}/PATH/TO/SALOME/DIRECTORY" + $ export PATH="${HOME}/PATH/TO/SALOME/DIRECTORY:${PATH}" $ source "${HOME}/PATH/TO/OPENFOAM/DIRECTORY/etc/bashrc" -2. Or modify file ``conf/bashrc`` in project directory (example) +* Or modify file ``anisotropy/config/bashrc`` in project directory (example, ``bash``) .. code-block:: bash - export PATH="${PATH}:${HOME}/programs/salome/SALOME-9.7.0-MPI" + export PATH="${HOME}/programs/salome/SALOME-9.7.0-MPI:${PATH}" source "${HOME}/programs/OpenFOAM/OpenFOAM-v2012/etc/bashrc" and source it (each time): .. code-block:: bash - $ source conf/bashrc + $ source anisotropy/config/bashrc -3. The best way is modify file like in step 2 and append it to virtual environment activate script: +* The best way is to modify ``anisotropy/config/bashrc`` like in step 2 and append it to the virtual environment ``activate`` script: .. code-block:: bash - $ cat conf/bashrc | tee -a env/bin/activate + $ cat anisotropy/config/bashrc | tee -a env/bin/activate So next time you just need to ``source env/bin/activate`` and you completely ready. +* You should add paths to ``~/.bashrc`` (``bash``) if you installed ``anisotropy`` in user path: + +.. code-block:: bash + + $ cat anisotropy/config/bashrc | tee -a ~/.bashrc + + Building documentaion --------------------- -For building documentaion you must sure that all requirements installed. -Project uses ``Sphinx`` and ``make`` for building: +For building a documentaion you should install a documentaion requirements: .. code-block:: bash $ source env/bin/activate + (env) $ python -m pip install "../anisotropy[documentaion]" + + +Then just run ``make`` with your best format option: + +.. code-block:: bash + (env) $ cd docs (env) $ make html - +For more information about options you can read ``Sphinx`` documentaion or run ``make help``. diff --git a/docs/source/README.rst b/docs/source/README.rst new file mode 100644 index 0000000..71ec902 --- /dev/null +++ b/docs/source/README.rst @@ -0,0 +1,100 @@ +anisotropy +========== + +.. figure:: docs/source/static/simple.png + :scale: 50% + :align: center + :alt: + + +.. figure:: static/simple.png + :scale: 50% + :align: center + :alt: + +anisotropy is a ``Python`` package that is the result of science-research work +on the anisotropy of permeability in the periodic porous media. +A project uses own wrappers around external applications +for constructing a shapes and meshes (``Salome``) and computing a flow (``OpenFOAM``). + +Dependencies +------------ + +.. csv-table:: + :header: "Software", "Used version", "Recommended version" + + "`Python `_", "3.9.6", ">= 3.8" + "`Salome `_", "9.7.0", ">= 9.6.0" + "`OpenFOAM `_", "v2012", "" + +Installation +------------ + +.. toctree:: + :maxdepth: 2 + + INSTALL + +Getting Started +--------------- + +Initializing a new anisotropy project +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To create a new anisotropy project, you'll use the ``anisotropy init`` command. +``anisotropy init`` is a one-time command you use during the initial setup of a new project. + +Example: + +.. code-block:: bash + + $ mkdir ~/aproject + $ cd ~/aproject + $ anisotropy init + +Executing this command will create a new ``anisotropy.db``, ``anisotropy.toml`` files in your +current working directory. This will also create ``build`` and ``logs`` directories for output files. + +Database ``anisotropy.db`` is used for storing current values and results. +With ``anisotropy.toml`` you can configure all an initial values. + +Computing +~~~~~~~~~ + +To start a computation, you'll use the ``anisotropy compute`` command. Using flag ``--stage`` you can +control what you need to compute (mesh or flow). Using flag ``--param`` you can specify which +structure/direction/theta you need to compute. + +Example: + +.. code-block:: bash + + $ anisotropy compute --stage mesh --param type=simple --param direction="[1.0, 0.0, 0.0]" --param theta=0.01 + +.. attention:: + + * You can't compute a flow without mesh (if you didn't it before succesfully). + * ``type``, ``direction`` and ``theta`` is control parameters. If you aren't specifying it than default range of values will be used from ``anisotropy.toml``. + +Post-processing +~~~~~~~~~~~~~~~ + +To use post-processing tools, you'll use the ``anisotropy postprocessing`` command. + +Example: + +.. code-block:: bash + + $ anisotropy postprocessing permeability + +Additional help +~~~~~~~~~~~~~~~ + +You always can use ``--help`` flag with any of ``anistropy`` command to get more information. + +License +------- + +GNU GPLv3 + +For more information see ``LICENSE``. diff --git a/docs/source/anisotropy.rst b/docs/source/anisotropy.rst index 9e7eb87..255eea7 100644 --- a/docs/source/anisotropy.rst +++ b/docs/source/anisotropy.rst @@ -1,4 +1,4 @@ -Anisotropy package +anisotropy package ================== Subpackages diff --git a/docs/source/index.rst b/docs/source/index.rst index c6807b0..04a352d 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -10,11 +10,10 @@ Welcome to anisotropy's documentation! :maxdepth: 2 :caption: Contents: - INSTALL anisotropy notes -.. include:: ../../README.rst +.. include:: README.rst Indices and tables ================== diff --git a/docs/source/notes/database.rst b/docs/source/notes/database.rst index ab7dce8..aea9d16 100644 --- a/docs/source/notes/database.rst +++ b/docs/source/notes/database.rst @@ -3,4 +3,5 @@ Database hierarchy Current anisotropy database hierarchy: -.. image:: ../static/er-diagram.png +.. figure:: ../static/er-diagram.png + :align: center diff --git a/docs/source/notes/structure.rst b/docs/source/notes/structure.rst index 0f2147c..8711be6 100644 --- a/docs/source/notes/structure.rst +++ b/docs/source/notes/structure.rst @@ -3,4 +3,5 @@ Anisotropy package structure Current anisotropy project structure: -.. image:: ../static/structure.png +.. figure:: ../static/structure.png + :align: center diff --git a/docs/source/static/deps.png b/docs/source/static/deps.png new file mode 100644 index 0000000..ebc0bae Binary files /dev/null and b/docs/source/static/deps.png differ diff --git a/docs/source/static/er-diagram b/docs/source/static/er-diagram deleted file mode 100644 index 0c8f58b..0000000 --- a/docs/source/static/er-diagram +++ /dev/null @@ -1,591 +0,0 @@ -digraph erd { - fontname = "Helvetica" - fontsize = 12 - splines = true - node [ - shape = "plaintext" - ] - - "BaseModel" - [label=< - - - - ''' - -
- - BaseModel -
- id - - AutoField -
- >] - - "Flow" - [label=< - - - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - -
- - Flow -
- flow_id - - AutoField -
- structure_id - - ForeignKeyField -
- scale - - ListField -
- pressure - - JSONField -
- velocity - - JSONField -
- transportProperties - - JSONField -
- >] - - "FlowApproximation" - [label=< - - - - ''' - - ''' - - ''' - - ''' - - ''' - -
- - FlowApproximation -
- flow_approximation_id - - AutoField -
- flow_id - - ForeignKeyField -
- pressure - - JSONField -
- velocity - - JSONField -
- transportProperties - - JSONField -
- >] - - "FlowResult" - [label=< - - - - ''' - - ''' - - ''' - - ''' - - ''' - -
- - FlowResult -
- flowresult_id - - AutoField -
- flow_id - - ForeignKeyField -
- flowRate - - FloatField -
- status - - TextField -
- calculationTime - - TimeField -
- >] - - "Mesh" - [label=< - - - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - -
- - Mesh -
- mesh_id - - AutoField -
- structure_id - - ForeignKeyField -
- maxSize - - FloatField -
- minSize - - FloatField -
- fineness - - IntegerField -
- growthRate - - FloatField -
- nbSegPerEdge - - FloatField -
- nbSegPerRadius - - FloatField -
- chordalErrorEnabled - - BooleanField -
- chordalError - - FloatField -
- secondOrder - - BooleanField -
- optimize - - BooleanField -
- quadAllowed - - BooleanField -
- useSurfaceCurvature - - BooleanField -
- fuseEdges - - BooleanField -
- checkChartBoundary - - BooleanField -
- viscousLayers - - BooleanField -
- thickness - - FloatField -
- numberOfLayers - - IntegerField -
- stretchFactor - - FloatField -
- isFacesToIgnore - - BooleanField -
- facesToIgnore - - ListField -
- extrusionMethod - - TextField -
- >] - - "MeshResult" - [label=< - - - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - -
- - MeshResult -
- meshresult_id - - AutoField -
- mesh_id - - ForeignKeyField -
- surfaceArea - - FloatField -
- volume - - FloatField -
- elements - - IntegerField -
- edges - - IntegerField -
- faces - - IntegerField -
- volumes - - IntegerField -
- tetrahedrons - - IntegerField -
- prisms - - IntegerField -
- pyramids - - IntegerField -
- status - - TextField -
- calculationTime - - TimeField -
- >] - - "Structure" - [label=< - - - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - -
- - Structure -
- structure_id - - AutoField -
- type - - TextField -
- direction - - ListField -
- theta - - FloatField -
- r0 - - FloatField -
- L - - FloatField -
- radius - - FloatField -
- filletsEnabled - - BooleanField -
- fillets - - FloatField -
- >] - - "SubMesh" - [label=< - - - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - - ''' - -
- - SubMesh -
- submesh_id - - AutoField -
- mesh_id - - ForeignKeyField -
- name - - TextField -
- maxSize - - FloatField -
- minSize - - FloatField -
- fineness - - IntegerField -
- growthRate - - FloatField -
- nbSegPerEdge - - FloatField -
- nbSegPerRadius - - FloatField -
- chordalErrorEnabled - - BooleanField -
- chordalError - - FloatField -
- secondOrder - - BooleanField -
- optimize - - BooleanField -
- quadAllowed - - BooleanField -
- useSurfaceCurvature - - BooleanField -
- fuseEdges - - BooleanField -
- checkChartBoundary - - BooleanField -
- >] - - - "Flow":"structure_id" -> "Structure":"structure_id" - [arrowhead=empty, arrowtail=none, dir=both]; - - "FlowApproximation":"flow_id" -> "Flow":"flow_id" - [arrowhead=empty, arrowtail=none, dir=both]; - - "FlowResult":"flow_id" -> "Flow":"flow_id" - [arrowhead=empty, arrowtail=none, dir=both]; - - "Mesh":"structure_id" -> "Structure":"structure_id" - [arrowhead=empty, arrowtail=none, dir=both]; - - "MeshResult":"mesh_id" -> "Mesh":"mesh_id" - [arrowhead=empty, arrowtail=none, dir=both]; - - "SubMesh":"mesh_id" -> "Mesh":"mesh_id" - [arrowhead=empty, arrowtail=none, dir=both]; - - -} diff --git a/docs/source/static/er-diagram.svg b/docs/source/static/er-diagram.svg deleted file mode 100644 index 3c0a830..0000000 --- a/docs/source/static/er-diagram.svg +++ /dev/null @@ -1,587 +0,0 @@ - - - - - - -erd - - - -BaseModel - - -             -            BaseModel             -             -id -             -             -AutoField -             - - - -Flow - - -             -            Flow             -             -flow_id -             -             -AutoField -             -             -structure_id -             -             -ForeignKeyField -             -             -scale -             -             -ListField -             -             -pressure -             -             -JSONField -             -             -velocity -             -             -JSONField -             -             -transportProperties -             -             -JSONField -             - - - -Structure - - -             -            Structure             -             -structure_id -             -             -AutoField -             -             -type -             -             -TextField -             -             -direction -             -             -ListField -             -             -theta -             -             -FloatField -             -             -r0 -             -             -FloatField -             -             -L -             -             -FloatField -             -             -radius -             -             -FloatField -             -             -filletsEnabled -             -             -BooleanField -             -             -fillets -             -             -FloatField -             - - - -Flow:structure_id->Structure:structure_id - - - - - -FlowApproximation - - -             -            FlowApproximation             -             -flow_approximation_id -             -             -AutoField -             -             -flow_id -             -             -ForeignKeyField -             -             -pressure -             -             -JSONField -             -             -velocity -             -             -JSONField -             -             -transportProperties -             -             -JSONField -             - - - -FlowApproximation:flow_id->Flow:flow_id - - - - - -FlowResult - - -             -            FlowResult             -             -flowresult_id -             -             -AutoField -             -             -flow_id -             -             -ForeignKeyField -             -             -flowRate -             -             -FloatField -             -             -status -             -             -TextField -             -             -calculationTime -             -             -TimeField -             - - - -FlowResult:flow_id->Flow:flow_id - - - - - -Mesh - - -             -            Mesh             -             -mesh_id -             -             -AutoField -             -             -structure_id -             -             -ForeignKeyField -             -             -maxSize -             -             -FloatField -             -             -minSize -             -             -FloatField -             -             -fineness -             -             -IntegerField -             -             -growthRate -             -             -FloatField -             -             -nbSegPerEdge -             -             -FloatField -             -             -nbSegPerRadius -             -             -FloatField -             -             -chordalErrorEnabled -             -             -BooleanField -             -             -chordalError -             -             -FloatField -             -             -secondOrder -             -             -BooleanField -             -             -optimize -             -             -BooleanField -             -             -quadAllowed -             -             -BooleanField -             -             -useSurfaceCurvature -             -             -BooleanField -             -             -fuseEdges -             -             -BooleanField -             -             -checkChartBoundary -             -             -BooleanField -             -             -viscousLayers -             -             -BooleanField -             -             -thickness -             -             -FloatField -             -             -numberOfLayers -             -             -IntegerField -             -             -stretchFactor -             -             -FloatField -             -             -isFacesToIgnore -             -             -BooleanField -             -             -facesToIgnore -             -             -ListField -             -             -extrusionMethod -             -             -TextField -             - - - -Mesh:structure_id->Structure:structure_id - - - - - -MeshResult - - -             -            MeshResult             -             -meshresult_id -             -             -AutoField -             -             -mesh_id -             -             -ForeignKeyField -             -             -surfaceArea -             -             -FloatField -             -             -volume -             -             -FloatField -             -             -elements -             -             -IntegerField -             -             -edges -             -             -IntegerField -             -             -faces -             -             -IntegerField -             -             -volumes -             -             -IntegerField -             -             -tetrahedrons -             -             -IntegerField -             -             -prisms -             -             -IntegerField -             -             -pyramids -             -             -IntegerField -             -             -status -             -             -TextField -             -             -calculationTime -             -             -TimeField -             - - - -MeshResult:mesh_id->Mesh:mesh_id - - - - - -SubMesh - - -             -            SubMesh             -             -submesh_id -             -             -AutoField -             -             -mesh_id -             -             -ForeignKeyField -             -             -name -             -             -TextField -             -             -maxSize -             -             -FloatField -             -             -minSize -             -             -FloatField -             -             -fineness -             -             -IntegerField -             -             -growthRate -             -             -FloatField -             -             -nbSegPerEdge -             -             -FloatField -             -             -nbSegPerRadius -             -             -FloatField -             -             -chordalErrorEnabled -             -             -BooleanField -             -             -chordalError -             -             -FloatField -             -             -secondOrder -             -             -BooleanField -             -             -optimize -             -             -BooleanField -             -             -quadAllowed -             -             -BooleanField -             -             -useSurfaceCurvature -             -             -BooleanField -             -             -fuseEdges -             -             -BooleanField -             -             -checkChartBoundary -             -             -BooleanField -             - - - -SubMesh:mesh_id->Mesh:mesh_id - - - - - diff --git a/docs/source/static/simple.png b/docs/source/static/simple.png new file mode 100644 index 0000000..d07ed98 Binary files /dev/null and b/docs/source/static/simple.png differ diff --git a/docs/source/static/structure.png b/docs/source/static/structure.png index 5d0dc5b..ebc0bae 100644 Binary files a/docs/source/static/structure.png and b/docs/source/static/structure.png differ diff --git a/extra/fillet-radius.py b/extra/fillet-radius.py deleted file mode 100644 index a64ba27..0000000 --- a/extra/fillet-radius.py +++ /dev/null @@ -1,70 +0,0 @@ -import matplotlib.pyplot as plt -from math import sqrt -import sys - -if __name__ == "__main__": - - try: - stype = sys.argv[1] - - except IndexError: - print("python fillet-radius.py [simple|bodyCentered|faceCentered]") - - exit(1) - - - if stype == "simple": - r0 = 1.0 - - C1, C2 = 0.8, 0.5 - theta1, theta2 = 0.01, 0.28 - - delta = 0.2 - - elif stype == "bodyCentered": - L = 1.0 - r0 = L * sqrt(3) / 4 - - C1, C2 = 0.3, 0.2 - theta1, theta2 = 0.01, 0.18 - - delta = 0.02 - - elif stype == "faceCentered": - L = 1.0 - r0 = L * sqrt(2) / 4 - - C1, C2 = 0.3, 0.2 - theta1, theta2 = 0.01, 0.13 - - delta = 0.012 - - else: - print("python fillet-radius.py [simple|bodyCentered|faceCentered]") - - exit(1) - - - Cf = lambda theta: C1 + (C2 - C1) / (theta2 - theta1) * (theta - theta1) - fillet = lambda theta: delta - Cf(theta) * (r0 / (1 - theta) - r0) - - tocount = lambda num: int(num * 100) - - theta = [ 0.01 * n for n in range(tocount(theta1), tocount(theta2) + 1) ] - coeffs = [ Cf(n) for n in theta ] - radiuses = [ fillet(n) for n in theta ] - - plt.figure(1) - - plt.subplot(211) - plt.plot(theta, coeffs, "o") - plt.grid(True) - plt.ylabel("Cf") - - plt.subplot(212) - plt.plot(theta, radiuses, "o") - plt.grid(True) - plt.ylabel("Radius") - plt.xlabel("Theta") - - plt.show() diff --git a/extra/theta-flowrate.py b/extra/theta-flowrate.py deleted file mode 100644 index 26e2bed..0000000 --- a/extra/theta-flowrate.py +++ /dev/null @@ -1,79 +0,0 @@ -import matplotlib.pyplot as plt -from math import sqrt -import sys, os - -if __name__ == "__main__": - - BUILD = "../build" - postProcessing = "postProcessing/flowRatePatch(name=outlet)/0/surfaceFieldValue.dat" - - #structures = [ - # "simple", - # #"bodyCentered", - # #"faceCentered" - #] - - theta = [c * 0.01 for c in range(1, 28 + 1)] - directions = [ - [1, 0, 0], - [0, 0, 1], - [1, 1, 1] - ] - flowrate = [ [] for n in range(3) ] - - #nu = 1e-06 - #p = [1e-03, 0] - - for num, d in enumerate(directions): - for t in theta: - path = os.path.join( - BUILD, - "simple", - "direction-{}{}{}".format(*d), - "theta-{}".format(t), - postProcessing - ) - - with open(path, "r") as io: - lastLine = io.readlines()[-1] - - value = lastLine.replace(" ", "").replace("\n", "").split("\t")[1] - flowrate[num].append(float(value)) - - k2, k3 = [], [] - - for n, _ in enumerate(flowrate[0]): - k2.append(2 * flowrate[1][n] / flowrate[0][n]) - k3.append(2 * flowrate[2][n] / flowrate[0][n]) - - - plt.figure(1) - - ax = plt.subplot(211) - line, = ax.plot(theta, flowrate[0], "o") - line.set_label("[1, 0, 0]") - - line, = ax.plot(theta, flowrate[1], "o") - line.set_label("[0, 0, 1]") - - line, = plt.plot(theta, flowrate[2], "o") - line.set_label("[1, 1, 1]") - - ax.set_yscale("log") - - plt.legend() - plt.grid(True) - plt.xlabel("theta") - plt.ylabel("flowRate") - - ax = plt.subplot(212) - line, = ax.plot(theta, k2, "o") - line.set_label("k2") - line, = ax.plot(theta, k3, "o") - line.set_label("k3") - plt.legend() - plt.grid(True) - plt.xlabel("theta") - plt.ylabel("k") - - plt.show() diff --git a/requirements.txt b/requirements.txt index 10bfc5e..dd56a31 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,10 +4,6 @@ pyquaternion toml peewee pandas -Sphinx -sphinx-rtd-theme Click -peewee-erd -pydeps matplotlib pyqt5 diff --git a/setup.py b/setup.py index e24761c..1ffd437 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,7 @@ # This file is part of anisotropy. # License: GNU GPL version 3, see the file "LICENSE" for details. +import os from setuptools import setup import anisotropy @@ -15,6 +16,11 @@ def read(filename, split = False): return content.strip().split("\n") if split else content +def findall(directory): + return [ + os.path.join(directory, f) for f in os.listdir(directory) + if os.path.isfile(os.path.join(directory, f)) + ] def main(): setup( @@ -37,13 +43,20 @@ def main(): "Environment :: Console", "Operating System :: POSIX", "Operating System :: Unix", + "Intended Audience :: Developers", "Intended Audience :: Science/Research", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Programming Language :: Python :: 3.9" ], + data_files = [ + ("share/doc/anisotropy", findall("docs")) + ], + package_data = { "anisotropy": [ - "config/default.toml" + "config/default.toml", + "config/bashrc" ] }, packages = ( @@ -54,9 +67,12 @@ def main(): "anisotropy.salomepl", "anisotropy.samples" ), - + python_requires = ">=3.6", install_requires = read("requirements.txt", True), + extras_require = { + "documentation": ["Sphinx", "sphinx-rtd-theme", "pydeps", "peewee-erd" ] + }, entry_points = { "console_scripts": [ "anisotropy=anisotropy.core.cli:anisotropy" diff --git a/tests/anisotropy-cli.py b/tests/anisotropy-cli.py deleted file mode 100644 index 2f848fa..0000000 --- a/tests/anisotropy-cli.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -import os, sys -sys.path.append(os.path.join(os.path.dirname(__file__), "..")) - -from anisotropy.core.cli import anisotropy - -anisotropy() - - diff --git a/tests/test_anisotropy.py b/tests/test_anisotropy.py index 2f769a7..d7ccefe 100644 --- a/tests/test_anisotropy.py +++ b/tests/test_anisotropy.py @@ -3,6 +3,7 @@ import unittest unittest.TestLoader.sortTestMethodsUsing = None +# TODO: update tests class TestAnisotropy(unittest.TestCase): def setUp(self): from anisotropy.core.main import Anisotropy @@ -11,7 +12,7 @@ class TestAnisotropy(unittest.TestCase): def test_01_create_db(self): self.model.db.setup() path = os.path.join(self.model.env["db_path"], "anisotropy.db") - + self.assertTrue(os.path.exists(path)) def test_02_load_from_scratch(self): @@ -19,21 +20,21 @@ class TestAnisotropy(unittest.TestCase): try: paramsAll = self.model.loadFromScratch() - + for entry in paramsAll: self.model.update(entry) - + except Exception as e: passed = False print(e) - + self.assertTrue(passed) def test_03_load_db(self): self.model.load("simple", [1.0, 0.0, 0.0], 0.01) self.assertEqual(self.model.params["structure"]["type"], "simple") - + def tearDown(self): #os.removedirs(self.model.env["BUILD"]) #os.removedirs(self.model.env["LOG"])