Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
8b5f896
Register snek5000.solvers entry_point
ashwinvis Dec 11, 2020
12981b0
Simul param existing_path_run
ashwinvis Dec 14, 2020
2ec6c19
Create Postproc subpackage
ashwinvis Jan 18, 2021
8a9bca0
Move sanity check to test, post_init
ashwinvis Jan 18, 2021
9259396
Add postproc subpackage, spatial_means
ashwinvis Jan 18, 2021
8d16c38
Rename params -> params_simul.xml, name_solver injection for testing …
ashwinvis Jan 18, 2021
160cb35
Turn off coriolis and hard-code bulk velocity
ashwinvis Feb 2, 2021
ec8c1d3
Implement abl_penalty, untested and needs more work
ashwinvis Feb 8, 2021
10f4325
Rm generated files
ashwinvis Feb 8, 2021
7111e27
Density in par, types in usr files, disable abl_penalty subroutine
ashwinvis Feb 8, 2021
9e10da4
Quick convert tripping modules to penalty
ashwinvis Feb 22, 2021
3430b94
Simplified penalty_mini module and new mixing_len
ashwinvis Feb 28, 2021
951fffa
Change docs theme
ashwinvis Feb 28, 2021
5b7813a
Parameters
ashwinvis Mar 1, 2021
b33c1af
Cutoff mixing length viscosity
ashwinvis Mar 1, 2021
8235d08
WIP: try to calculate u_star with noslip BC
ashwinvis Mar 2, 2021
03a2a99
Track cli module
ashwinvis Mar 2, 2021
bf00752
Prepare runs for different penalty tiamp and higher region
ashwinvis Mar 5, 2021
b3a3ba7
Rm wrong and old abl_penalty subroutine
ashwinvis Mar 5, 2021
4ebe893
Adjust z0, Re, pen-region, useric eps
ashwinvis Mar 5, 2021
cd95d5a
Print mean dp_dx to spatial_means
ashwinvis Mar 5, 2021
ba17271
Debug mixing_len module (no common block, du_dy was thrown away)
ashwinvis Mar 5, 2021
98c4efe
Debug penalty_mini, issues found tiamp < 0 (fixed), npoints = 0 (todo)
ashwinvis Mar 5, 2021
6564605
Penalty nregions -> nregion, fix lcoord?
ashwinvis Mar 5, 2021
0e17869
Prefill pen_frcs array with 1.0 instead of zeros
ashwinvis Mar 5, 2021
61acc1e
Add penalty K var to common block
ashwinvis Mar 18, 2021
481cad8
Improve Ctags generation
ashwinvis Mar 18, 2021
f50d9d5
New CLI option `show config`, fix pen tiamp assert
ashwinvis Mar 18, 2021
cf79df1
Simple shell script launcher abl.sh
ashwinvis Mar 24, 2021
7084189
Instructions on how to install & use the package
ashwinvis Mar 24, 2021
d633c63
Print makefile_usr
ashwinvis Mar 24, 2021
4c2380d
Split penalty par file reg to another file
ashwinvis Mar 24, 2021
a371175
Fix output.params = params.output change
ashwinvis Mar 25, 2021
62ba3c6
Try compile_in_place parameter, click dependency
ashwinvis Mar 25, 2021
4355515
Penalty par file section sources
ashwinvis Mar 25, 2021
37a6e43
Git ignore static files too .a
ashwinvis Mar 25, 2021
9178469
Build a separate object for penalty par
ashwinvis Mar 25, 2021
fa68948
Turn penalty amplitude to 0 and add nrun rule (no-compile)
ashwinvis Mar 25, 2021
3cc0051
Try ccache
ashwinvis Mar 26, 2021
31f466c
Add bin to PATH, editorconfig for Fortran style
ashwinvis Mar 26, 2021
fb79755
Coloured make w/ unbuffer, use nekconfig instead of makenek
ashwinvis Mar 26, 2021
46999fd
Add pen_enabled parameter
ashwinvis Mar 26, 2021
fc8573f
Initialize u_star_max and compute area_bc with no-slip BC
ashwinvis Mar 28, 2021
b0ae1d1
Reduce Re, reenable penalty (slow?)
ashwinvis Mar 29, 2021
8802fa1
Small optimization to avoid pen_update with tdamp = 0
ashwinvis Mar 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Install apt packages
run: |
sudo apt-get update
sudo apt-get install gfortran libopenmpi-dev
sudo apt-get install gfortran libopenmpi-dev ccache

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Compiled Object files
*.slo
*.lo
*.o
# *.o
*.obj

# Precompiled Headers
Expand All @@ -23,7 +23,7 @@
# Compiled Static libraries
*.lai
*.la
*.a
# *.a
*.lib

# Executables
Expand Down Expand Up @@ -63,6 +63,7 @@ src/*/_version.py
pip-wheel-metadata
build/
.nox
.coverage

# Jupyter
.ipynb_checkpoints
Expand Down
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,25 @@

## Quick start

Install using Python 3.6+ as follows:

git clone --recursive https://github.com/exabl/snek5000-abl.git
cd snek5000-abl
pip install -e .

Activate necessary environment variables

source activate.sh

Use the command line tool to launch / set / inspect the simulation parameters

abl --help

## Tests
```sh
pip install -e '.[tests]'
# Run simple tests: including compilation
pytest
# Run slow tests: launches simulation
pytest --runslow
```
# Authors

* [Ashwin Vishnu Mohanan](mailto:[email protected])
* [Geert Brethouwer](mailto:[email protected])
* [Luigi Antonialli](mailto:[email protected])
8 changes: 8 additions & 0 deletions Snakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import os
from glob import iglob
from pathlib import Path

import snek5000
from snek5000.util.archive import tar_name, archive

PYTHON_DIRECTORIES = ["docs", "src", "tests"]
Expand Down Expand Up @@ -55,6 +59,8 @@ rule ctags:
input:
nek5000="lib/Nek5000/core",
abl="src/abl",
snek=Path(snek5000.__file__).parent,
py_env=os.getenv("VIRTUAL_ENV", os.getenv("CONDA_PREFIX", ""))
output:
".tags",
params:
Expand All @@ -68,13 +74,15 @@ rule ctags:
"logs",
"*.tar.gz",
"*.f?????",
"*.py",
)
)
),
shell:
"""
ctags --verbose -f {output} --language-force=Fortran -R {input.nek5000}
ctags --verbose -f {output} {params.excludes} --append --language-force=Fortran -R {input.abl}
ctags -f {output} --append --languages=Python -R {input.abl} {input.snek} {input.py_env}/lib
"""


Expand Down
4 changes: 2 additions & 2 deletions activate.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
DIR="$(pwd)"
DIR="$(pwd -P)"
export NEK_SOURCE_ROOT="$DIR/lib/Nek5000"
export PATH="$PATH:$NEK_SOURCE_ROOT/bin"
export PATH="$PATH:$NEK_SOURCE_ROOT/bin:$DIR/bin"

alias smake="snakemake"
# tarball utilities
Expand Down
13 changes: 13 additions & 0 deletions bin/abl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
# MESH=11; ROUGH=0.1
# MESH=212; ROUGH=0.1
# MESH=222; ROUGH=0.0001
MESH=12; ROUGH=0.0001

abl -d penalty -m $MESH -n penalty -o 1 -w 7-00:00:00 --in-place False \
-fw 0.05 -fc 0.75 -ft False -sb False \
-s mixing_len \
-b noslip \
-zw $ROUGH -z0 $ROUGH \
-p 1.0 \
$@
38 changes: 22 additions & 16 deletions bin/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,56 @@
from snek5000.clusters import Cluster

cluster = Cluster()
sub_dir = "november"
base_name_run = "hi"
sub_dir = "21march"
base_name_run = "pen"
sub_command = "launch"
# sub_command = "launch compile"
# sub_command = "launch release"; cluster.cmd_run = "echo"
# sub_command = "debug"
# sub_command = "show box"
dry_run = False
dry_run = True

for (
mesh_nb_nodes_walltime,
filter_weight,
filter_cutoff,
filter_temporal,
sgs_model,
sgs_boundary,
sgs_model,
boundary_cond,
z_wall,
z0,
pen_tiamp,
) in itertools.product(
zip([111], [1] * 1, [f"{days}-00:00:00" for days in (7,) * 1]),
zip([222], [1] * 1, [f"{days}-00:00:00" for days in (1,) * 1]),
[0.05],
[0.75],
# [0.], [1.],
[False],
["vreman", "constant", "shear_imp"],
# "dynamic"],
[False],
[0.1],
["mixing_len"],
# ["vreman", "constant", "shear_imp"],
# "dynamic"],
["noslip"],
[0.0001],
[0.001],
[-(10 ** p) for p in range(6)],
):
mesh, nb_nodes, walltime = mesh_nb_nodes_walltime


name_run = (
f"{base_name_run}-{sgs_model}-ft{int(filter_temporal)}-sb{int(sgs_boundary)}"
)
name_run = f"{base_name_run}-{sgs_model}-{pen_tiamp:07d}"
if filter_temporal and sgs_boundary:
print(f"skipping ... {name_run}")
continue

cmd = (
f"\n{sys.executable} ./simul.py "
f"\n{sys.executable} -m abl.cli "
f"-d {sub_dir} -m {mesh} -n {name_run} -o {nb_nodes} -w {walltime} "
f"-fw {filter_weight} -fc {filter_cutoff} -ft {filter_temporal} "
f"-s {sgs_model} -sb {sgs_boundary} "
f"-zw {z_wall} "
f"-b {boundary_cond} "
f"-zw {z_wall} -z0 {z0} "
f"-p {pen_tiamp} "
f"{sub_command}"
)
if dry_run:
Expand All @@ -66,6 +72,6 @@
email="[email protected]",
interactive=True,
omp_num_threads=None, # do not set
# NOTE: for small simulations
nb_cores_per_node=16,
)

# ./simple.py -m 2 -n geert -o 1 -w 7-00:00:00 -zw 0 -fw 0.05 -fc 0.75 show size
13 changes: 9 additions & 4 deletions docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.

PROJECT_NAME = "eTurb"
PROJECT_NAME = "abl"

# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
Expand Down Expand Up @@ -790,7 +790,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

INPUT = .. ../lib/Nek5000/core ../src/abl ../src/abl/toolbox ../src/abl/sgs
INPUT = .. ../lib/Nek5000/core ../src/abl ../src/abl/toolbox ../src/abl/sgs ../src/abl/bc ../src/abl/forcing

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down Expand Up @@ -909,7 +909,12 @@ FILE_PATTERNS = *.c \
MNTRLOGD \
MNTRTMRD \
RPRMD \
STATD
STATD \
PENALTY \
DYN \
SGS \
SGS_BC \
WMLES
# *.py \

# The RECURSIVE tag can be used to specify whether or not subdirectories should
Expand All @@ -925,7 +930,7 @@ RECURSIVE = NO
# Note that relative paths are relative to the directory from which doxygen is
# run.

EXCLUDE = ../lib/Nek5000/core/makenek.inc
EXCLUDE = ../lib/Nek5000/core/makenek.inc ../src/abl/forcing/penalty.f

# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
Expand Down
49 changes: 46 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def root(module):

version = ".".join(abl.__version__.split(".")[:3])
# The full version, including alpha/beta/rc tags
release = abl.__version__
release = version


# -- General configuration ---------------------------------------------------
Expand Down Expand Up @@ -157,14 +157,57 @@ def root(module):
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
html_theme = "sphinx_material"


# Set link name generated in the top bar.
html_title = "main docs"

html_sidebars = {
"*[!index]*": [
"logo-text.html",
"globaltoc.html",
"localtoc.html",
"searchbox.html",
]
}

html_favicon = "_static/favicon.ico"

# Material theme options (see theme.conf for more information)
html_theme_options = {
# Set the name of the project to appear in the navigation.
"nav_title": f"{project} documentation",
# ??
"touch_icon": html_favicon,
# Logo to the left of the title
"logo_icon": "&#x1F30A", # https://emojipedia.org/water-wave/
#
"nav_links": [
{"href": "doxygen/modules", "title": "fortran docs", "internal": True}
],
# Specify a base_url used to generate sitemap.xml. If not
# specified, then no sitemap will be built.
"base_url": f"https://exabl.github.io/{project}",
# Set the color and the accent color
"color_primary": "teal",
"color_accent": "dark-green",
# Set the repo location to get a badge with stats
"repo_url": f"https://github.com/exabl/{project}/",
"repo_name": project,
# Visible levels of the global TOC; -1 means unlimited
"globaltoc_depth": 1,
# If False, expand all TOC entries
"globaltoc_collapse": True,
# If True, show hidden TOC entries
"globaltoc_includehidden": False,
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

html_favicon = "_static/favicon.ico"

# -- Options for Intersphinx -------------------------------------------------

Expand Down
13 changes: 10 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
.. eturb documentation master file, created by
.. snek5000-abl documentation master file, created by
sphinx-quickstart on Wed Dec 25 01:55:26 2019.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Welcome to snek5000-*abl*'s documentation!
===========================================

The ABL_ project is an interdisciplinary effort to model the atmospheric
boundary layer using Nek5000_. This documentation describes the Fortran user
code and its Python interface made using snek5000_'s API.

.. raw:: html


Expand Down Expand Up @@ -58,9 +62,9 @@ Links
.. * :ref:`Upstream documentation for Nek5000 <nek:genindex>`
.. Strange intersphinx bug: WARNING: undefined label: nek:genindex (if the link has no caption the label must precede a section header)

* `Nek5000 documentation <https://nek5000.github.io/NekDoc/appendix.html>`_
* Nek5000_ documentation
* `KTH framework documentation <https://kth-nek5000.github.io/KTH_Framework>`_
* `snek5000 documentation <https://exabl.github.io/snek5000>`_
* snek5000_ documentation
* `pymech documentation <https://pymech.readthedocs.io>`_

Indices and tables
Expand All @@ -71,3 +75,6 @@ Indices and tables
* :ref:`search`
* `Documentation produced with Doxygen <doxygen/modules.html>`_

.. _ABL: https://e-science.se/people-and-research/projects/exabl/
.. _Nek5000: https://nek5000.github.io/NekDoc/appendix.html
.. _snek5000: https://snek5000.readthedocs.io
2 changes: 1 addition & 1 deletion lib/Nek5000
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

@nox.session(python=["3.6", "3.7", "3.8"])
def tests(session):
session.run("pytest")
session.run("pytest", "tests")
10 changes: 9 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,23 @@ packages=find:
install_requires =
snek5000 >= 0.4.0b1
pymech >= 1.3.0.post0
click
zstandard
setup_requires =
setuptools_scm

[options.entry_points]
console_scripts =
abl = abl.cli:main

snek5000.solvers =
abl = abl.solver

[options.extras_require]
docs =
sphinx
recommonmark
sphinx_rtd_theme
sphinx-material
breathe
setuptools_scm

Expand Down
3 changes: 3 additions & 0 deletions src/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[*.f]
indent_size = 3
trim_trailing_whitespace = true
Loading