Commit 13964135 authored by Lambert Theisen's avatar Lambert Theisen 🚀

Merge branch 'develop' into 'master'

Update to version 1.1

See merge request !5
parents f8714e44 a351b322
Pipeline #219163 failed with stages
in 28 minutes and 11 seconds
[run]
include =
*/src/*
\ No newline at end of file
*/fenicsR13/*
\ No newline at end of file
......@@ -40,6 +40,7 @@
"ms-python.python",
"ms-vscode.cpptools",
"lextudio.restructuredtext",
"ms-azuretools.vscode-docker"
"ms-azuretools.vscode-docker",
"ritwickdey.liveserver"
]
}
......@@ -41,4 +41,7 @@ tests/**/*.pdf
examples/**/*.pdf
# Ignore matrices
*.mat
\ No newline at end of file
*.mat
# Ignore pip folder
*egg-info/*
\ No newline at end of file
......@@ -20,13 +20,14 @@ stages:
build:environment:
stage: build
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- docker pull $CI_REGISTRY_IMAGE:latest || true
- docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --tag $CI_REGISTRY_IMAGE:latest .
# - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA # no need
- docker push $CI_REGISTRY_IMAGE:latest
when: manual # skips 15min, but has to be done manually if Dockerfile changes
- docker pull $CI_REGISTRY_IMAGE:latest || true
- docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --tag $CI_REGISTRY_IMAGE:latest .
# - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA # no need
- docker push $CI_REGISTRY_IMAGE:latest
only:
- tags # skips 15min, but has to be done manually if Dockerfile changes
build:doc:
stage: build
......@@ -35,11 +36,11 @@ build:doc:
entrypoint: [""]
script:
- cd ${DOCS_DIRECTORY}
- sphinx-apidoc -o source/src ../src
- sphinx-apidoc -o source/tests/heat ../tests/heat
- sphinx-apidoc -o source/tests/stress ../tests/stress
- sphinx-apidoc -o source/tests/r13 ../tests/r13
- sphinx-apidoc -o source/examples ../examples
- sphinx-apidoc -f -o source/fenicsR13 ../fenicsR13
- sphinx-apidoc -f -o source/tests/heat ../tests/heat
- sphinx-apidoc -f -o source/tests/stress ../tests/stress
- sphinx-apidoc -f -o source/tests/r13 ../tests/r13
- sphinx-apidoc -f -o source/examples ../examples
- make html
- make latex
artifacts:
......@@ -54,6 +55,8 @@ build:doc:
.test: # dot means "hidden", acts as base class
stage: test
before_script:
- pip install .
image:
name: $CI_REGISTRY_IMAGE:latest # use prebuilt image in Gitlab's registry
entrypoint: [""] # == Repo. Has to be done if Dockerfile has own entrypoint
......@@ -61,10 +64,10 @@ build:doc:
test:pytest:
extends: .test
script:
- cd ${APP_DIRECTORY}
- pytest
- mkdir convergence_plots
- cp tests/*/*/convergence_plot* convergence_plots/
- cd ${APP_DIRECTORY}
- pytest
- mkdir convergence_plots
- cp tests/*/*/convergence_plot* convergence_plots/
artifacts:
paths:
- ${APP_DIRECTORY}/convergence_plots
......@@ -90,6 +93,8 @@ deploy:latex:
paths:
- ${DOCS_DIRECTORY}/_build/latex/${DOCS_LATEX_NAME}.pdf
expire_in: 6 month
only:
- master
pages:
stage: deploy
......@@ -99,4 +104,6 @@ pages:
- mv ${DOCS_DIRECTORY}/_build/html/ ${CI_PROJECT_DIR}/public/
artifacts:
paths:
- public
\ No newline at end of file
- public
only:
- master
\ No newline at end of file
Change log
----------
1.1 (2019-12-15)
~~~~~~~~~~~~~~~~
- Symmetrize system
- Scale the equations to match
- Introduce subfunctionals
- Subfunctionals are equal for off-diagonal entries
- Resolve stf-terms using orthogonality
- Make r13 as default in formulation rather than decoupled
- Refactor CIP as separate subfunctionals
- Add antisymm ring, not used for now but can improve convergence
- Create package
- Move files into separate folder and add setup.py
- CI is changed
- Installation through "pip install ." in toplevel
- Clean repository
1.0 (2019-09-23)
~~~~~~~~~~~~~~~~
......
......@@ -37,6 +37,10 @@ RUN \
COPY requirements.txt /tmp/
RUN pip install --requirement /tmp/requirements.txt
# Install the fenicsR13 package (puts it into the PATH)
COPY . /tmp/
RUN pip install --editable /tmp/.
# Replace default FEniCS Docker WELCOME screen with custom WELCOME screen
COPY WELCOME .
RUN echo "Built: $(date)" >> WELCOME
\ No newline at end of file
include README.rst
\ No newline at end of file
......@@ -50,6 +50,8 @@ Make sure you installed Docker and it is running on your system. You can start t
# Run (and possibly pull) fenicsr13_release service
docker-compose run --rm fenicsr13_release
# Only for developers, install the lastest version using pipeline
# pip install -e .
When you run this for the first time, docker will pull (download and extract) the container image from our repository which is roughly 800MB and the download may require some patience. After the initial download the docker image will be stored (2-3 GB) on your system and any new run will start the container immediately.
......@@ -77,7 +79,7 @@ To run a simulation execute the solver main program ``fenicsR13.py`` (which is l
.. code-block:: bash
# Run program with given input file:
python3 ../../src/fenicsR13.py input.yml
fenicsR13 input.yml
Output files will be written to a folder which is named after the ``output_folder`` keyword of the ``input.yml``. For immediate inspection the output folder contains simple visualizations in PDF files for each of the fields (temperature, pressure,...).
......@@ -103,7 +105,7 @@ We provide a simple example of a flow through a finite-length channel in 2D.
# Create mesh:
./create_mesh.sh
# Run program with given input file:
python3 ../../src/fenicsR13.py input.yml
fenicsR13 input.yml
In the output folder the results can be post-processed to demonstrate the `Knudsen paradox`_ in a simple table.
......@@ -130,7 +132,7 @@ We can test the convergence of the R13 discretization on a simple double-cylindr
# Meshes are already in Git:
ls ../mesh
# Run program with given input file:
python3 ../../src/fenicsR13.py inputs/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_stab.yml
fenicsR13 inputs/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_stab.yml
# Go to folder with simulation results (=casename in input.yml)
cd r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_stab
# Open errors:
......@@ -150,7 +152,7 @@ FEniCS allows simple parallelization using MPI
# Parallel execution ("-u" to flash stdout)
# Usage: mpirun -n <numberOfProcesses> <serialCommand>
# E.g.: mpirun -n 4 python3 -u ../../src/fenicsR13.py input.yml
# E.g.: mpirun -n 4 fenicsR13 input.yml
Building the Docker Image Locally
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......@@ -207,7 +209,7 @@ Developer Tips
.. code-block:: bash
htop -p `{ python3 ../../src/fenicsR13.py inputs/1_coeffs_nosources_norot_inflow_p1p1p1p1p1_stab.yml > /dev/null & } && echo $!`
htop -p `{ fenicsR13 inputs/1_coeffs_nosources_norot_inflow_p1p1p1p1p1_stab.yml > /dev/null & } && echo $!`
- Use doctest with ``python3 -m doctest -v src/meshes.py``
- Run ``pydocstyle`` once in a while
......@@ -256,7 +258,7 @@ Python notes
Create new version tag
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Add CHANGELOG entry
2. Adapt version in `conf.py` for docs
2. Adapt version in `conf.py` for docs and `setup.py` for package
3. Change badge in ``README.rst``
4. Change version in program information printing
......@@ -317,7 +319,7 @@ Further Installation Tips
**Interactive Jupyter Notebooks with Microsoft's Visual Studio Code**
This is may be a convenient solution.
Run a file with ``%run ../../src/fenicsr13.py``
Run a file with ``%run ../../fenicsr13/fenicsr13.py``
**X11 Window Forwarding on OSX**
......@@ -379,7 +381,7 @@ Contact
:target: https://git.rwth-aachen.de/lamboo/fenicsR13/pipelines
:alt: Test coverage
.. |version| image:: https://img.shields.io/badge/version-v1.0-blue.svg
.. |version| image:: https://img.shields.io/badge/version-v1.1-blue.svg
:target: https://git.rwth-aachen.de/lamBOO/fenicsR13/-/tags
:alt: Documentation Website
......
......@@ -12,7 +12,7 @@
#
import os
import sys
sys.path.insert(0, os.path.abspath('../src'))
sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath('../tests/heat'))
sys.path.insert(0, os.path.abspath('../tests/stress'))
sys.path.insert(0, os.path.abspath('../tests/r13'))
......@@ -25,7 +25,7 @@ copyright = '2019'
author = 'Lambert Theisen'
# The full version, including alpha/beta/rc tags
release = '1.0'
release = '1.1'
# -- General configuration ---------------------------------------------------
......
......@@ -17,8 +17,8 @@ Contents
.. toctree::
:glob:
source/src/modules.rst
source/fenicsR13/modules.rst
source/tests/heat/modules.rst
source/tests/stress/modules.rst
source/tests/r13/modules.rst
source/examples/modules.rst
\ No newline at end of file
source/examples/modules.rst
fenicsR13 package
=================
Submodules
----------
fenicsR13.fenicsR13 module
--------------------------
.. automodule:: fenicsR13.fenicsR13
:members:
:undoc-members:
:show-inheritance:
fenicsR13.geoToH5 module
------------------------
.. automodule:: fenicsR13.geoToH5
:members:
:undoc-members:
:show-inheritance:
fenicsR13.input module
----------------------
.. automodule:: fenicsR13.input
:members:
:undoc-members:
:show-inheritance:
fenicsR13.meshes module
-----------------------
.. automodule:: fenicsR13.meshes
:members:
:undoc-members:
:show-inheritance:
fenicsR13.postprocessor module
------------------------------
.. automodule:: fenicsR13.postprocessor
:members:
:undoc-members:
:show-inheritance:
fenicsR13.solver module
-----------------------
.. automodule:: fenicsR13.solver
:members:
:undoc-members:
:show-inheritance:
fenicsR13.tensoroperations module
---------------------------------
.. automodule:: fenicsR13.tensoroperations
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: fenicsR13
:members:
:undoc-members:
:show-inheritance:
src
===
fenicsR13
=========
.. toctree::
:maxdepth: 4
fenicsR13
input
meshes
postprocessor
solver
tensoroperations
geoToH5
fenicsR13 module
================
.. automodule:: fenicsR13
:members:
:undoc-members:
:show-inheritance:
geoToH5 module
==============
.. automodule:: geoToH5
:members:
:undoc-members:
:show-inheritance:
input module
============
.. automodule:: input
:members:
:undoc-members:
:show-inheritance:
meshes module
=============
.. automodule:: meshes
:members:
:undoc-members:
:show-inheritance:
postprocessor module
====================
.. automodule:: postprocessor
:members:
:undoc-members:
:show-inheritance:
solver module
=============
.. automodule:: solver
:members:
:undoc-members:
:show-inheritance:
tensoroperations module
=======================
.. automodule:: tensoroperations
:members:
:undoc-members:
:show-inheritance:
#!/bin/bash
python3 ../../src/geoToH5.py channel.geo channel5.h5 "-setnumber p 5"
\ No newline at end of file
geoToH5 channel.geo channel5.h5 "-setnumber p 5"
\ No newline at end of file
......@@ -48,14 +48,12 @@ stabilization:
# ======================
# - nsd: Number of spatial dimensions == 2
# - mode: Formulation mode, one of heat, stress, r13
# - use_coeffs: Use real R13 coefficients, False only valid in mode==heat
# - kn: Knudsen number
# - xi_tilde: Refaction coefficient in Maxwell accomodation model
# - heat_source: Heat source function for mode==heat||r13
# - mass_source: Mass source function for mode==stress||r13
nsd: 2
mode: r13
use_coeffs: True
kn: 1.0
xi_tilde: 1.0
heat_source: 0
......
#!/bin/bash
python3 ../../src/geoToH5.py knudsen_pump.geo knudsen_pump4.h5 "-setnumber p 4"
\ No newline at end of file
geoToH5 knudsen_pump.geo knudsen_pump4.h5 "-setnumber p 4"
\ No newline at end of file
......@@ -49,14 +49,12 @@ stabilization:
# ======================
# - nsd: Number of spatial dimensions == 2
# - mode: Formulation mode, one of heat, stress, r13
# - use_coeffs: Use real R13 coefficients, False only valid in mode==heat
# - kn: Knudsen number
# - xi_tilde: Refaction coefficient in Maxwell accomodation model
# - heat_source: Heat source function for mode==heat||r13
# - mass_source: Mass source function for mode==stress||r13
nsd: 2
mode: r13
use_coeffs: True
kn: 0.1
xi_tilde: 1.0
heat_source: 0
......
#!/bin/bash
python3 ../../src/geoToH5.py lid.geo lid5.h5 "-setnumber p 5"
\ No newline at end of file
geoToH5 lid.geo lid5.h5 "-setnumber p 5"
\ No newline at end of file
......@@ -48,14 +48,12 @@ stabilization:
# ======================
# - nsd: Number of spatial dimensions == 2
# - mode: Formulation mode, one of heat, stress, r13
# - use_coeffs: Use real R13 coefficients, False only valid in mode==heat
# - kn: Knudsen number
# - xi_tilde: Refaction coefficient in Maxwell accomodation model
# - heat_source: Heat source function for mode==heat||r13
# - mass_source: Mass source function for mode==stress||r13
nsd: 2
mode: r13
use_coeffs: True
kn: 0.08
xi_tilde: 1.0
heat_source: 0
......
......@@ -14,7 +14,7 @@ class TestExamples(object):
All tests are compared against reference errors.
"""
solver_path = "../../src/fenicsR13.py"
solver_path = "fenicsR13"
def run_solver(self, inputfile, working_dir_):
"""
......@@ -23,7 +23,7 @@ class TestExamples(object):
Test fails if subprocess return Exception or error.
"""
subprocess.check_call([
"python3", self.solver_path, inputfile
self.solver_path, inputfile
], cwd=working_dir_)
# @pytest.fixture(scope="module", autouse=True)
......
# pylint: disable=invalid-name,missing-module-docstring
from .fenicsR13 import *
from .geoToH5 import *
from .input import *
from .meshes import *
from .postprocessor import *
from .solver import *
from .tensoroperations import *
......@@ -15,10 +15,10 @@ import sys
import gc
import dolfin as df
import meshes
from input import Input
from solver import Solver
from postprocessor import Postprocessor
from fenicsR13.meshes import H5Mesh
from fenicsR13.input import Input
from fenicsR13.solver import Solver
from fenicsR13.postprocessor import Postprocessor
def print_information():
r"""
......@@ -28,7 +28,7 @@ def print_information():
.. code-block:: text
-> Version: v1.0
-> Version: v1.1
-> Contact: Lambert Theisen <lambert.theisen@rwth-aachen.de>
-> Contact: Manuel Torrilhon <mt@mathcces.rwth-aachen.de>
-> Repository: <https://git.rwth-aachen.de/lamBOO/fenicsR13>
......@@ -40,7 +40,7 @@ def print_information():
|_| \___|_| |_|_|\___|___/_| \_\_|____/
"""
print(r"""-> Version: v1.0
print(r"""-> Version: v1.1
-> Contact: Lambert Theisen <lambert.theisen@rwth-aachen.de>
-> Contact: Manuel Torrilhon <mt@mathcces.rwth-aachen.de>
-> Repository: <https://git.rwth-aachen.de/lamBOO/fenicsR13>
......@@ -63,10 +63,13 @@ def main():
.. code-block:: bash
# Install fenicsR13
pip install .
# Usage: <path_to_program> <input_file>
# Goto case folder:
cd tests/r13
python3 ../../src/fenicsR13.py inputs/ \
fenicsR13 inputs/ \
r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_stab.yml
"""
......@@ -108,7 +111,7 @@ def main():
mesh_name = mesh_names[p]
current_mesh = meshes.H5Mesh(mesh_name)
current_mesh = H5Mesh(mesh_name)
solver = Solver(params, current_mesh, p)
solver.assemble()
......
......@@ -5,13 +5,19 @@
"""
Converter from geo-format to a mesh in h5-format.
Installation:
.. code-block:: bash
pip install .
Usage:
.. code-block:: bash
Usage: python3 <path_to_geoToH5.py> <geo_file> <h5_file> \
[<gmsh cli arguments>]
E.g.: python3 ../../src/geoToH5.py lid.geo lid5.h5 "-setnumber p 5"
E.g.: geoToH5 lid.geo lid5.h5 "-setnumber p 5"
"""
import os
......@@ -29,7 +35,7 @@ def geo_to_h5():
if not 3 <= len(sys.argv) <= 4:
print("""
Usage: python3 <path_to_geoToH5.py> <geo_file> <h5_file> [<gmsh cli arguments>]
E.g.: python3 ../../src/geoToH5.py lid.geo lid5.h5 "-setnumber p 5"
E.g.: geoToH5 lid.geo lid5.h5 "-setnumber p 5"
""")
return
......@@ -68,10 +74,3 @@ E.g.: python3 ../../src/geoToH5.py lid.geo lid5.h5 "-setnumber p 5"
file.write(mesh, "/mesh")
file.write(subdomains, "/subdomains")
file.write(boundaries, "/boundaries")
def main():
"Execute the converter."
geo_to_h5()
if __name__ == '__main__':
main()
......@@ -78,14 +78,12 @@ class Input:
# ======================
# - nsd: Number of spatial dimensions == 2
# - mode: Formulation mode, one of heat, stress, r13
# - use_coeffs: Use real R13 coefficients, False only valid in heat
# - kn: Knudsen numberkn
# - xi_tilde: Refaction coefficient in Maxwell accomodation model
# - heat_source: Heat source function for mode==heat||r13
# - mass_source: Mass source function for mode==stress||r13
nsd: 2
mode: r13
use_coeffs: True
kn: 1.0
xi_tilde: 1.0
heat_source: 0
......@@ -166,8 +164,12 @@ class Input:
def __init__(self, yaml_file):
"""Construct the Input class."""
with open(yaml_file, "r") as stream:
self.dict = yaml.safe_load(stream)
try:
with open(yaml_file, "r") as stream:
self.dict = yaml.safe_load(stream)
except FileNotFoundError:
print(f"[Error] The input file {yaml_file} is not found.\n")
raise
val = Validator()
input_schema = {
......@@ -186,10 +188,6 @@ class Input:
"required": True,
"allowed": ["heat", "stress", "r13"]
},
"use_coeffs": {
"type": "boolean",
"required": True,
},
"kn": {
"type": "float",
"required": True,
......
This diff is collapsed.
......@@ -80,7 +80,7 @@ def stf3d3(rank3_3d):
.. math::
A_{\langle i j k\rangle}=A_{(i j k)}-\frac{1}{5}\left[A_{(i l)}
A_{\langle i j k\rangle}=A_{(i j k)}-\frac{1}{5}\left[A_{(i l l)}
\delta_{j k}+A_{(l j l)} \delta_{i k}+A_{(l l k)} \delta_{i j}\right]
A gradient :math:`\frac{\partial S_{\langle i j}}{\partial x_{k \rangle}}`
......
{
"schemaVersion": 1,
"label": "tag",
"message": "v0.3",
"color": "orange"
}
[pytest]
testpaths = src examples/test_examples.py tests
testpaths = fenicsR13 tests examples/test_examples.py
addopts = --doctest-modules --cov --cov-report=term --cov-report=html
"Setup file"
from setuptools import setup
def readme(): # pylint: disable=missing-function-docstring
with open('README.rst') as file:
return file.read()
setup(
name="fenicsR13",
version="1.1",
description="FEniCS (FEM) Solver for Non.-Eq.-Gases Based on R13 Equations",
long_description=readme(),
url="https://git.rwth-aachen.de/lamBOO/fenicsR13",
author="Lambert Theisen, Manuel Torrilhon",
author_email="lambert.theisen@rwth-aachen.de, mt@mathcces.rwth-aachen.de",
license="None",
packages=["fenicsR13"],
zip_safe=False,
entry_points={
"console_scripts": [
"fenicsR13=fenicsR13.fenicsR13:main",
"geoToH5=fenicsR13.geoToH5:geo_to_h5"
],
}
)
......@@ -55,14 +55,12 @@ stabilization:
# ======================
# - nsd: Number of spatial dimensions == 2
# - mode: Formulation mode, one of heat, stress, r13
# - use_coeffs: Use real R13 coefficients, False only valid in mode==heat
# - kn: Knudsen numberkn
# - xi_tilde: Refaction coefficient in Maxwell accomodation model
# - heat_source: Heat source function for mode==heat||r13
# - mass_source: Mass source function for mode==stress||r13
nsd: 2
mode: heat
use_coeffs: True
kn: 0.1
xi_tilde: 1.0
heat_source: 2.0 - 1.0 * pow(sqrt(pow(x[0],2)+pow(x[1],2)),2)
......
......@@ -55,14 +55,12 @@ stabilization:
# ======================
# - nsd: Number of spatial dimensions == 2
# - mode: Formulation mode, one of heat, stress, r13
# - use_coeffs: Use real R13 coefficients, False only valid in mode==heat
# - kn: Knudsen numberkn
# - xi_tilde: Refaction coefficient in Maxwell accomodation model
# - heat_source: Heat source function for mode==heat||r13
# - mass_source: Mass source function for mode==stress||r13
nsd: 2
mode: heat
use_coeffs: True
kn: 0.1
xi_tilde: 1.0
heat_source: 2.0 - 1.0 * pow(sqrt(pow(x[0],2)+pow(x[1],2)),2)
......
......@@ -55,14 +55,12 @@ stabilization:
# ======================
# - nsd: Number of spatial dimensions == 2
# - mode: Formulation mode, one of heat, stress, r13
# - use_coeffs: Use real R13 coefficients, False only valid in mode==heat
# - kn: Knudsen numberkn
# - xi_tilde: Refaction coefficient in Maxwell accomodation model
# - heat_source: Heat source function for mode==heat||r13
# - mass_source: Mass source function for mode==stress||r13
nsd: 2
mode: heat
use_coeffs: True
kn: 0.1
xi_tilde: 1.0
heat_source: 2.0 - 1.0 * pow(sqrt(pow(x[0],2)+pow(x[1],2)),2)
......
# General
# =======
# - output_folder: Used as output folder
output_folder: heat_01_nocoeffs_p1p2_nostab
# Meshes
# ======
# - meshes: List of input meshes in h5 format to run simulations on