Commit af195d08 authored by Lambert Theisen's avatar Lambert Theisen 🔥

Merge branch 'develop' into 'master'

Update to version 1.3

See merge request !7
parents 3c089a46 8c24499f
Pipeline #321179 canceled with stages
in 9 minutes and 50 seconds
image: docker:stable
variables:
DOCKER_TLS_CERTDIR: ""
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
APP_DIRECTORY: .
DOCS_DIRECTORY: ${APP_DIRECTORY}/docs
DOCS_LATEX_NAME: fenicsr13
services:
- docker:dind # docker in docker
stages:
- prepare
- build
- test
- deploy
# **************************************************************************** #
# build
# prepare
# **************************************************************************** #
build:environment:
stage: build
prepare:docker:
stage: prepare
before_script:
- 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
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA || true
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME || true
- docker build
--cache-from $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
--tag $CI_REGISTRY_IMAGE:latest
--tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
--tag $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME .
tags:
- shell
# **************************************************************************** #
# build
# **************************************************************************** #
build:doc:
build:docs:
stage: build
dependencies:
- prepare:docker
image:
name: $CI_REGISTRY_IMAGE:latest
name: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
entrypoint: [""]
script:
- cd ${DOCS_DIRECTORY}
......@@ -47,6 +52,8 @@ build:doc:
- ${DOCS_DIRECTORY}/_build/html/
- ${DOCS_DIRECTORY}/_build/latex/
expire_in: 6 month
tags:
- docker
# **************************************************************************** #
# test
......@@ -57,8 +64,16 @@ build:doc:
before_script:
- pip install -e . # local install to have right coverage
image:
name: $CI_REGISTRY_IMAGE:latest # use prebuilt image in Gitlab's registry
entrypoint: [""] # == Repo. Has to be done if Dockerfile has own entrypoint
name: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
entrypoint: [""]
tags:
- docker
test:flake8:
extends: .test
script:
- cd ${APP_DIRECTORY}
- flake8 fenicsR13 examples tests
test:pytest:
extends: .test
......@@ -77,6 +92,26 @@ test:pytest:
# deploy
# **************************************************************************** #
.deploy:docker:
stage: deploy
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
tags:
- shell
deploy:docker:dev:
extends: .deploy:docker
script:
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
deploy:docker:latest:
extends: .deploy:docker
script:
- docker push $CI_REGISTRY_IMAGE:latest
only:
- master
- tags
deploy:latex:
stage: deploy
image:
......@@ -84,7 +119,7 @@ deploy:latex:
name: aergus/latex:latest
entrypoint: [""]
dependencies:
- build:doc
- build:docs
script:
- cd ${DOCS_DIRECTORY}/_build/latex/
- make
......@@ -95,11 +130,13 @@ deploy:latex:
only:
- master
- tags
tags:
- shell
pages:
stage: deploy
dependencies:
- build:doc
- build:docs
script:
- mv ${DOCS_DIRECTORY}/_build/html/ ${CI_PROJECT_DIR}/public/
artifacts:
......@@ -107,4 +144,6 @@ pages:
- public
only:
- master
- tags
\ No newline at end of file
- tags
tags:
- shell
Change log
----------
1.3 (2020-08-18)
~~~~~~~~~~~~~~~~
- Add option to use Garlerkign Least Squares (GLS) stabilization
- Allow for different chi_tilde on boundaries
- Add option for multiple mesh regions:
- Allows for different Knudsen numbers in regions
- Add new example: Lid-driven cavity with two mesh regions
- Optimization of CI pipeline and scripts in Gitlab:
- Assert Flake8 compliance
- Add option to output solution vectors (for model order reduction experiments)
- Improve README with R13 equation set and list of features
1.2 (2020-02-17)
~~~~~~~~~~~~~~~~
......
......@@ -34,13 +34,14 @@ RUN \
# Install any needed packages specified in requirements.txt
# RUN pip install --trusted-host pypi.python.org -r requirements.txt
COPY requirements.txt /tmp/
RUN pip install --requirement /tmp/requirements.txt
WORKDIR /fenicsR13
ADD ./requirements.txt /fenicsR13/requirements.txt
RUN pip install -r /fenicsR13/requirements.txt
# Install the fenicsR13 package (puts it into the PATH)
COPY . /tmp/
RUN pip install --editable /tmp/.
ADD . /fenicsR13
RUN pip install --editable /fenicsR13/.
# Replace default FEniCS Docker WELCOME screen with custom WELCOME screen
COPY WELCOME .
RUN echo "Built: $(date)" >> WELCOME
\ No newline at end of file
ADD WELCOME .
RUN echo "Built: $(date)" >> WELCOME
......@@ -5,16 +5,35 @@
.. inclusion-marker
fenicsR13: A Tensorial Mixed Finite Element Solver for the Linear R13 Equations Using the FEniCS Computing Platform
================================================================================
===================================================================================================================
|pipeline| |coverage| |version| |zenodo| |website|
``#extendedGasDynamics`` ``#using`` ``#FEniCS``
Installation
.. math::
\scriptsize \nabla \cdot u \, & \scriptsize = \dot{m} \\ \scriptsize \nabla p + \nabla \cdot \sigma \, & \scriptsize = b \\ \scriptsize \nabla \cdot u + \nabla \cdot s \, & \scriptsize = r \\ \scriptsize \frac{4}{5} {(\nabla s)}_{\text{stf}} + 2 {(\nabla u)}_{\text{stf}} + \nabla \cdot m \, & \scriptsize = - \frac{1}{\mathbb{K}} \sigma \\ \scriptsize \frac{5}{2} \nabla \theta + \nabla \cdot \sigma + \frac{1}{2} \nabla \cdot R + \frac{1}{6} \nabla \Delta \, & \scriptsize = - \frac{1}{\mathbb{K}} \frac{2}{3} s \\ \scriptsize m \, & \scriptsize = - 2 \mathbb{K} {(\nabla\sigma)}_{\text{stf}} \\ \scriptsize R \, & \scriptsize = - \frac{24}{5} \mathbb{K} {(\nabla s)}_{\text{stf}} \\ \scriptsize \Delta \, & \scriptsize = - 12 \mathbb{K} \left( \nabla \cdot s \right)
Main Features
--------------------------------------------------------------------------------
This repository contains all main and auxiliary scripts to solve the linear R13 equations for rarefied gas flows with the `FEniCS`_ software in 2D, including examples and some convergence tests.
- Solving Steady 2D Linear R13 Equations in Normalized Form
- Stabilization with: Continous Interior Penalty (CIP) or Galerkin Least Squares (GLS)
- Option for convergence study with input for exact solution
- Output in XDMF_/HDF5 and PDF
- Arbitray finite element combinations (thanks to FEniCS_)
- Easy setup of parameter studies
- Structured/Documented YAML_ input file format
- Rarefied gas flow effects predictable: Knudsen paradox, Knudsen pump, ...
- Interface for Gmsh_ meshes
.. _FEniCS: https://fenicsproject.org/
.. _YAML: https://de.wikipedia.org/wiki/YAML
.. _XDMF: http://www.xdmf.org/index.php/XDMF_Model_and_Format
.. _Gmsh: http://gmsh.info/
Installation
--------------------------------------------------------------------------------
Download the repository as a `zip-file`_ and un-zip, or use `git`_ with
......@@ -49,7 +68,7 @@ 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 pip
# pip install -e .
# sudo 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.
......@@ -376,7 +395,7 @@ Contact
:target: https://git.rwth-aachen.de/lamboo/fenicsR13/pipelines
:alt: Test coverage
.. |version| image:: https://img.shields.io/badge/version-1.2-blue.svg
.. |version| image:: https://img.shields.io/badge/version-1.3-blue.svg
:target: https://git.rwth-aachen.de/lamBOO/fenicsR13/-/tags
:alt: Documentation Website
......
......@@ -25,7 +25,7 @@ copyright = '2020'
author = 'Lambert Theisen'
# The full version, including alpha/beta/rc tags
release = '1.2'
release = '1.3'
# -- General configuration ---------------------------------------------------
......
......@@ -15,12 +15,19 @@ meshes:
# - fields: List of FEM parameters (shape, degree)
# - shape: Element shape, e.g. Lagrange
# - degree: Element degree, e.g. 2
# - stabilization: Must contain cip
# - stabilization: Must contain cip and gls
# - cip: Collection of Continous Interior Penalty (CIP) parameters
# - enable: Enable CIP stabilization
# - delta_theta: Stabilization of grad(T)*grad(T_test) over edge
# - delta_u: Stabilization of grad(u)*grad(u_test) over edge
# - delta_p: Stabilization of grad(p)*grad(p_test) over edge
# - gls: Collection of Garlerkin Least Squares (GLS) parameters
# - enable: Enable GLS stabilization
# - tau_energy: Stabilization with energy eq. residual
# - tau_heatflux: Stabilization with heatflux eq. residual
# - tau_mass: Stabilization with mass eq. residual
# - tau_momentum: Stabilization with momentum eq. residual
# - tau_stress: Stabilization with stress eq. residual
elements:
theta:
shape: Lagrange
......@@ -43,28 +50,41 @@ stabilization:
delta_theta: 1.0
delta_u: 1.0
delta_p: 0.1
gls:
enable: False
tau_energy: 0.001
tau_heatflux: 0.001
tau_mass: 0.01
tau_momentum: 0.01
tau_stress: 0.01
# Formulation Parameters
# ======================
# - nsd: Number of spatial dimensions == 2
# - mode: Formulation mode, one of heat, stress, r13
# - kn: Knudsen number
# - chi_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
# - body_force: Body force for mode==stress||r13
nsd: 2
mode: r13
kn: 1.0
chi_tilde: 1.0
heat_source: 0
mass_source: 0
body_force: [1,0]
# Region Parameters
# =================
# - regs: Dictionary of all mesh regions
# - reg_id: Must contain the following parameters:
# - kn: Knudsen number
regs:
4000:
kn: 0.1
# Boundary Conditions
# ===================
# - bcs: Dictionary of all boundary IDs from mesh
# - bc_id: must contain theta_w, u_t_w, u_n_w, p_w, epsilon_w
# - bc_id: must contain the following parameters
# - chi_tilde: Refaction coefficient in Maxwell accomodation model
# - theta_w: Value for temperature at wall
# - u_t_w: Value for tangential velocity at wall
# - u_n_w: Value for normal velocity at wall
......@@ -72,24 +92,28 @@ body_force: [1,0]
# - epsilon_w: Inflow-model parameter <=> Weight of pressure prescription
bcs:
3001: # bot
chi_tilde: 1.0
theta_w: 1
u_t_w: 0
u_n_w: 0
p_w: 0 # No pressure gradient, flow shall be bodyforce-induced!
epsilon_w: pow(10,-3)
3002: # right
chi_tilde: 1.0
theta_w: 1
u_t_w: 0
u_n_w: 0 # No slip
p_w: 0
epsilon_w: pow(10,+3) # No slip
3003: # top
chi_tilde: 1.0
theta_w: 1
u_t_w: 0
u_n_w: 0
p_w: 0 # No pressure gradient, flow shall be bodyforce-induced!
epsilon_w: pow(10,-3)
3004: # left
chi_tilde: 1.0
theta_w: 1
u_t_w: 0
u_n_w: 0 # No slip
......@@ -115,9 +139,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing:
write_pdfs: True
write_vecs: False
massflow: [3002]
# Parameter Study
......@@ -127,5 +153,5 @@ postprocessing:
# - parameter_values: List of value for parameter, e.g. [0.01,0.1,1,10]
parameter_study:
enable: True
parameter_key: ["kn"]
parameter_values: [0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0]
\ No newline at end of file
parameter_key: ["regs", 4000, "kn"]
parameter_values: [0.03125, 0.0625, 0.125, 0.25, 0.5, 1.0, 2.0] # 2^-5 to 2^1
......@@ -10,7 +10,7 @@ if not gui:
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.plot(x,y, "-o", label="Channel Flow")
ax.plot(x, y, "-o", label="Channel Flow")
ax.set_xscale("log")
plt.xlabel("Knudsen number")
......
......@@ -2,10 +2,10 @@
rm table.csv
for KNUDSEN in 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
for KNUDSEN in 0.03125 0.0625 0.125 0.25 0.5 1.0 2.0
do
MASSFLOW=$(cat results_channel_flow_force$KNUDSEN/massflow_3002)
echo "$KNUDSEN, $MASSFLOW" >> table.csv
done
cat table.csv
\ No newline at end of file
cat table.csv
......@@ -15,12 +15,19 @@ meshes:
# - fields: List of FEM parameters (shape, degree)
# - shape: Element shape, e.g. Lagrange
# - degree: Element degree, e.g. 2
# - stabilization: Must contain cip
# - stabilization: Must contain cip and gls
# - cip: Collection of Continous Interior Penalty (CIP) parameters
# - enable: Enable CIP stabilization
# - delta_theta: Stabilization of grad(T)*grad(T_test) over edge
# - delta_u: Stabilization of grad(u)*grad(u_test) over edge
# - delta_p: Stabilization of grad(p)*grad(p_test) over edge
# - gls: Collection of Garlerkin Least Squares (GLS) parameters
# - enable: Enable GLS stabilization
# - tau_energy: Stabilization with energy eq. residual
# - tau_heatflux: Stabilization with heatflux eq. residual
# - tau_mass: Stabilization with mass eq. residual
# - tau_momentum: Stabilization with momentum eq. residual
# - tau_stress: Stabilization with stress eq. residual
elements:
theta:
shape: Lagrange
......@@ -43,28 +50,41 @@ stabilization:
delta_theta: 1.0
delta_u: 1.0
delta_p: 0.1
gls:
enable: False
tau_energy: 0.001
tau_heatflux: 0.001
tau_mass: 0.01
tau_momentum: 0.01
tau_stress: 0.01
# Formulation Parameters
# ======================
# - nsd: Number of spatial dimensions == 2
# - mode: Formulation mode, one of heat, stress, r13
# - kn: Knudsen number
# - chi_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
# - body_force: Body force for mode==stress||r13
nsd: 2
mode: r13
kn: 1.0
chi_tilde: 1.0
heat_source: 0
mass_source: 0
body_force: [0,0]
# Region Parameters
# =================
# - regs: Dictionary of all mesh regions
# - reg_id: Must contain the following parameters:
# - kn: Knudsen number
regs:
4000:
kn: 0.1
# Boundary Conditions
# ===================
# - bcs: Dictionary of all boundary IDs from mesh
# - bc_id: must contain theta_w, u_t_w, u_n_w, p_w, epsilon_w
# - bc_id: must contain the following parameters
# - chi_tilde: Refaction coefficient in Maxwell accomodation model
# - theta_w: Value for temperature at wall
# - u_t_w: Value for tangential velocity at wall
# - u_n_w: Value for normal velocity at wall
......@@ -72,24 +92,28 @@ body_force: [0,0]
# - epsilon_w: Inflow-model parameter <=> Weight of pressure prescription
bcs:
3001: # bot
chi_tilde: 1.0
theta_w: 1
u_t_w: 0
u_n_w: 0
p_w: 0
epsilon_w: pow(10,-3)
3002: # right
chi_tilde: 1.0
theta_w: 1
u_t_w: 0
u_n_w: 0
p_w: 0
epsilon_w: pow(10,+3)
3003: # top
chi_tilde: 1.0
theta_w: 1
u_t_w: 0
u_n_w: 0
p_w: 0
epsilon_w: pow(10,-3)
3004: # left
chi_tilde: 1.0
theta_w: 1
u_t_w: 0
u_n_w: 0
......@@ -115,9 +139,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing:
write_pdfs: True
write_vecs: False
massflow: [3002]
# Parameter Study
......@@ -127,5 +153,5 @@ postprocessing:
# - parameter_values: List of value for parameter, e.g. [0.01,0.1,1,10]
parameter_study:
enable: True
parameter_key: ["kn"]
parameter_values: [0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0]
\ No newline at end of file
parameter_key: ["regs", 4000, "kn"]
parameter_values: [0.03125, 0.0625, 0.125, 0.25, 0.5, 1.0, 2.0] # 2^-5 to 2^1
......@@ -10,7 +10,7 @@ if not gui:
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.plot(x,y, "-o", label="Channel Flow")
ax.plot(x, y, "-o", label="Channel Flow")
ax.set_xscale("log")
plt.xlabel("Knudsen number")
......
......@@ -2,10 +2,10 @@
rm table.csv
for KNUDSEN in 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
for KNUDSEN in 0.03125 0.0625 0.125 0.25 0.5 1.0 2.0
do
MASSFLOW=$(cat results_channel_flow_pressure$KNUDSEN/massflow_3002)
echo "$KNUDSEN, $MASSFLOW" >> table.csv
done
cat table.csv
\ No newline at end of file
cat table.csv
......@@ -16,12 +16,19 @@ meshes:
# - fields: List of FEM parameters (shape, degree)
# - shape: Element shape, e.g. Lagrange
# - degree: Element degree, e.g. 2
# - stabilization: Must contain cip
# - stabilization: Must contain cip and gls
# - cip: Collection of Continous Interior Penalty (CIP) parameters
# - enable: Enable CIP stabilization
# - delta_theta: Stabilization of grad(T)*grad(T_test) over edge
# - delta_u: Stabilization of grad(u)*grad(u_test) over edge
# - delta_p: Stabilization of grad(p)*grad(p_test) over edge
# - gls: Collection of Garlerkin Least Squares (GLS) parameters
# - enable: Enable GLS stabilization
# - tau_energy: Stabilization with energy eq. residual
# - tau_heatflux: Stabilization with heatflux eq. residual
# - tau_mass: Stabilization with mass eq. residual
# - tau_momentum: Stabilization with momentum eq. residual
# - tau_stress: Stabilization with stress eq. residual
elements:
theta:
shape: Lagrange
......@@ -44,28 +51,41 @@ stabilization:
delta_theta: 1.0
delta_u: 1.0
delta_p: 0.1
gls:
enable: False
tau_energy: 0.001
tau_heatflux: 0.001
tau_mass: 0.01
tau_momentum: 0.01
tau_stress: 0.01
# Formulation Parameters
# ======================
# - nsd: Number of spatial dimensions == 2
# - mode: Formulation mode, one of heat, stress, r13
# - kn: Knudsen number
# - chi_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
# - body_force: Body force for mode==stress||r13
nsd: 2
mode: r13
kn: 0.1
chi_tilde: 1.0
heat_source: 0
mass_source: 0
body_force: [0,0]
# Region Parameters
# =================
# - regs: Dictionary of all mesh regions
# - reg_id: Must contain the following parameters:
# - kn: Knudsen number
regs:
4000:
kn: 0.1
# Boundary Conditions
# ===================
# - bcs: Dictionary of all boundary IDs from mesh
# - bc_id: must contain theta_w, u_t_w, u_n_w, p_w, epsilon_w
# - bc_id: must contain the following parameters
# - chi_tilde: Refaction coefficient in Maxwell accomodation model
# - theta_w: Value for temperature at wall
# - u_t_w: Value for tangential velocity at wall
# - u_n_w: Value for normal velocity at wall
......@@ -73,48 +93,56 @@ body_force: [0,0]
# - epsilon_w: Inflow-model parameter <=> Weight of pressure prescription
bcs:
3010: # inner top
chi_tilde: 1.0
theta_w: 0.5 * x[0] + 1.0
u_t_w: 0
u_n_w: 0
p_w: 0
epsilon_w: 0
3011: # inner left
chi_tilde: 1.0
theta_w: -0.5 * (atan2(x[1],-(x[0] + 1.0)))/(M_PI/2.0) + 1.0
u_t_w: 0
u_n_w: 0
p_w: 0
epsilon_w: 0
3012: # inner bottom
chi_tilde: 1.0
theta_w: -0.5 * x[0] + 1.0
u_t_w: 0
u_n_w: 0
p_w: 0
epsilon_w: 0
3013: # inner right
chi_tilde: 1.0
theta_w: 0.5 * (atan2(x[1],(x[0]-1.0)))/(M_PI/2.0) + 1.0
u_t_w: 0
u_n_w: 0
p_w: 0
epsilon_w: 0
3020: # outer top
chi_tilde: 1.0
theta_w: 0.5 * x[0] + 1.0
u_t_w: 0
u_n_w: 0
p_w: 0
epsilon_w: 0
3021: # outer left