Skip to content

Commit

Permalink
Merge pull request #10 from snek5000/prepare-0.4.0
Browse files Browse the repository at this point in the history
Prepare 0.4.0
  • Loading branch information
paugier authored Dec 6, 2022
2 parents e59c371 + 07722a1 commit ea28d3e
Show file tree
Hide file tree
Showing 19 changed files with 75 additions and 40 deletions.
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: check-added-large-files

- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
- repo: https://github.com/snakemake/snakefmt
rev: v0.7.0
hooks:
- id: snakefmt
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
hooks:
- id: mdformat
additional_dependencies:
- mdformat-tables
- mdformat-frontmatter
- mdformat-myst
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
# snek5000-phill

Nek5000 [phill
example](https://github.com/KTH-Nek5000/KTH_Examples/tree/master/phill_STAT)
executed via [snek5000](https://github.com/exabl/snek5000).
The [Nek5000 phill example] adapted for a workflow using [Snek5000].

## Install

## Quick start
```sh
pip install snek5000-phill
```

For more details, see https://snek5000.readthedocs.io/en/latest/install.html.

## Tests

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

[nek5000 phill example]: https://github.com/KTH-Nek5000/KTH_Examples/tree/master/phill_STAT
[snek5000]: https://github.com/exabl/snek5000
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package_dir=
=src
packages=find:
install_requires =
snek5000 >= 0.7.0b0
snek5000 >= 0.8.0rc1
setup_requires =
setuptools_scm

Expand Down
1 change: 1 addition & 0 deletions src/phill/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ from phill import short_name, Output

configfile: "config_simul.yml"


ensure_env()

# Necessary to pass configuration to other Snakemake modules
Expand Down
4 changes: 1 addition & 3 deletions src/phill/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
"""
from ._version import __version__ # noqa: F401

from .solver import Simul
from .output import Output

from .solver import Simul

short_name = "phill"
__all__ = ["Simul", "Output", "short_name"]
1 change: 0 additions & 1 deletion src/phill/etc/tetralith.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ MPIFC: mpiifort
MPIEXEC: "mpiexec"
CFLAGS: "-march=native"
FFLAGS: "-march=native -mcmodel=medium"

3 changes: 1 addition & 2 deletions src/phill/output.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from phill.templates import box, makefile_usr, size
from snek5000 import mpi
from snek5000.output.base import Output as OutputBase
from phill.templates import box, size, makefile_usr


class OutputPhill(OutputBase):

@property
def makefile_usr_sources(self):
"""
Expand Down
1 change: 0 additions & 1 deletion src/phill/phill.usr
Original file line number Diff line number Diff line change
Expand Up @@ -619,4 +619,3 @@ c-----------------------------------------------------------------------
end subroutine
!======================================================================
! vim: set ft=fortran

15 changes: 7 additions & 8 deletions src/phill/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ def _init_root(self):


class SimulPhill(SimulKTH):
"""A solver which compiles and runs using a Snakefile.
"""A solver which compiles and runs using a Snakefile."""

"""
InfoSolver = InfoSolverPhill

@classmethod
Expand Down Expand Up @@ -63,13 +62,13 @@ def create_default_params(cls):
general.stop_at = "num_steps"
general.num_steps = 20
general.dt = -2e-4
general.time_stepper = 'bdf3'
general.time_stepper = "bdf3"
general.variable_dt = False
general.target_cfl = 0.3
general.write_control = 'timestep'
general.write_control = "timestep"
general.write_interval = 100
general.dealiasing = True
general.filtering = 'explicit'
general.filtering = "explicit"
general.filter_weight = 0.02
general.filter_cutoff_ratio = 0.67

Expand All @@ -78,7 +77,7 @@ def create_default_params(cls):

params.nek.pressure.residual_tol = params.nek.velocity.residual_tol = 1e-8
params.nek.pressure.residual_proj = params.nek.velocity.residual_proj = 1e-8
params.nek.velocity.density = 1.
params.nek.velocity.density = 1.0
params.nek.velocity.viscosity = -700

# User parameters for KTH framework
Expand All @@ -97,8 +96,8 @@ def create_default_params(cls):
oper.ny = 16
oper.nz = 19

oper.Lx = oper.Ly = oper.Lz = 1.
oper.boundary = ['P', 'P', 'W', 'W', 'P', 'P']
oper.Lx = oper.Ly = oper.Lz = 1.0
oper.boundary = ["P", "P", "W", "W", "P", "P"]

# Set SIZE file parameters
# ------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/phill/toolbox/CHKPOINTD
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
$ chpt_step, chpt_step_id, chpt_set_o, chpt_set_i,
$ chpt_reset, chpt_stepc, chpt_istep, chpt_nstep

common /CHKPNTL/ chpt_ifinit, chpt_ifrst
common /CHKPNTL/ chpt_ifinit, chpt_ifrst
2 changes: 1 addition & 1 deletion src/phill/toolbox/FRAMELP
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
integer rpar_log ! logical vriable
parameter (rpar_log=3)
integer rpar_str ! string vriable
parameter (rpar_str=4)
parameter (rpar_str=4)
2 changes: 1 addition & 1 deletion src/phill/toolbox/IOTOOLD
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
! common blocks
common /iotooli/ io_id

common /io_iunit/ io_iunit_min, io_iunit_max
common /io_iunit/ io_iunit_min, io_iunit_max
2 changes: 1 addition & 1 deletion src/phill/toolbox/MNTRLOGD
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@

! string variables
common /MNTRLOGC/ mntr_wtimes, mntr_mod_name, mntr_mod_dscr


2 changes: 1 addition & 1 deletion src/phill/toolbox/MNTRTMRD
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
common /MNTRTMRL/ mntr_tmr_sum

common /MNTRTMRC/ mntr_tmr_name, mntr_tmr_dscr


19 changes: 10 additions & 9 deletions src/phill/toolbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
This directory contains the [turbulence statistics tools](https://github.com/KTH-Nek5000/KTH_Toolbox/).

## Tool list:
* [frame](https://kth-nek5000.github.io/KTH_Framework/group__frame.html) - backbone of the toolbox
* [monitor](https://kth-nek5000.github.io/KTH_Framework/group__monitor.html) - monitoring tool: logging and timing
* [runparam](https://kth-nek5000.github.io/KTH_Framework/group__runparam.html) - runtime parameters
* [io_tool](https://kth-nek5000.github.io/KTH_Framework/group__io__tools.html) - simple I/O tools
* [checkpoint](https://kth-nek5000.github.io/KTH_Framework/group__chkpoint.html) - checkpointing main interface
* [mstep](https://kth-nek5000.github.io/KTH_Framework/group__chkpoint__mstep.html) - multi-step checkpointing
* [math](https://kth-nek5000.github.io/KTH_Framework/group__math.html) - simple math tools
* [map2D] - 3D to 2D grid mapping for 2D-extruded meshes
* [stat] - turbulence statistics tool

- [frame](https://kth-nek5000.github.io/KTH_Framework/group__frame.html) - backbone of the toolbox
- [monitor](https://kth-nek5000.github.io/KTH_Framework/group__monitor.html) - monitoring tool: logging and timing
- [runparam](https://kth-nek5000.github.io/KTH_Framework/group__runparam.html) - runtime parameters
- [io_tool](https://kth-nek5000.github.io/KTH_Framework/group__io__tools.html) - simple I/O tools
- [checkpoint](https://kth-nek5000.github.io/KTH_Framework/group__chkpoint.html) - checkpointing main interface
- [mstep](https://kth-nek5000.github.io/KTH_Framework/group__chkpoint__mstep.html) - multi-step checkpointing
- [math](https://kth-nek5000.github.io/KTH_Framework/group__math.html) - simple math tools
- \[map2D\] - 3D to 2D grid mapping for 2D-extruded meshes
- \[stat\] - turbulence statistics tool
2 changes: 1 addition & 1 deletion src/phill/toolbox/RPRMD
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@
! string variables
common /RPRMC/ rprm_parfnm, rprm_sec_name, rprm_sec_dscr,
$ rprm_par_name, rprm_par_dscr, rprm_parv_str


2 changes: 0 additions & 2 deletions src/phill/toolbox/frame.f
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,3 @@ integer function frame_get_master()
return
end function
!=======================================================================


1 change: 0 additions & 1 deletion src/phill/toolbox/mntrtmr.f
Original file line number Diff line number Diff line change
Expand Up @@ -459,4 +459,3 @@ subroutine mntr_tmr_get_olist(olist,ierr)
return
end subroutine
!=======================================================================

1 change: 0 additions & 1 deletion src/phill/toolbox/stat_IO.f
Original file line number Diff line number Diff line change
Expand Up @@ -751,4 +751,3 @@ subroutine stat_mfo_crd2D
return
end subroutine
!=======================================================================

0 comments on commit ea28d3e

Please sign in to comment.