Skip to content

Commit 3fd24e6

Browse files
authored
Merge pull request #22 from ukaea/dev-v1.2.1
v1.2.1 release
2 parents 53e16e7 + 2f3059c commit 3fd24e6

32 files changed

+535
-72
lines changed

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# CHANGELOG
22

3+
## v1.2.1, 2025-01-15
4+
5+
- Added an option to remove the logLei discontinuity in NRL formulary fit
6+
- Added more output to BDE integrator
7+
- Added more unary transforms
8+
- Added key for controlling BDE integrator consolidation
9+
- Added 0-length timestep at the start of all simulations to fix extractor manipulator bug
10+
- Added option to ignore Jacobian in diffusion stencil
11+
12+
### Breaking Changes
13+
14+
- N/A
15+
16+
### New Features
17+
18+
- New standard textbook option to remoge logLei discontinuity in NRL formularly fit by moving branch cutoff to e^2 * Z^2 eV
19+
- BDE integrator now outputs the current number of substeps and progress through those
20+
- New "step" unary transform. 1 if the node evaluates > 0, 0 otherwise.
21+
- New "filterWithin" unary transform. 0 if the value of the node is not within the first two passed realParams, otherwise no effect.
22+
- New "BDEConsolidationInterval" key to set the number of timesteps for the integrator to attempt consolidation after. Defaults to 50 (old hardcoded value).
23+
- Some generators now explicitly output information about terms as they are generated
24+
- "ignoreJacobian" now valid option for diffusion stencil JSON interface
25+
26+
### Bug Fixes
27+
28+
- Fixed extractor manipulator bug with CRM models by performing a 0 length timestep at the start of all simulations before any output
29+
- Added a call to update all modelbound data before the 0-length timestep to avoid some edge-case model failure
30+
- Fixed bug where unsorted ingoing states in some transitions lead to the wrong required density variables being identified in some generators
31+
- Fixed bug with integrators that allow time evolution incrementing time twice when there is only one integration step
32+
- Fixed bug where composite integrator global timestep's requested size is overwritten if a timestep controller is used, leading to performance issues if output-driven timestepping is used.
33+
334
## v1.2.0, 2024-09-19
435

536
- Added CVODE integrator as an option

docker/Dockerfile_mac.txt

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
FROM --platform=linux/arm64 ubuntu:latest
2+
LABEL maintainer="[email protected]"
3+
LABEL version="1.2.1"
4+
LABEL description="Docker container for ReMKiT1D CI"
5+
6+
# Disable Prompt During Packages Installation
7+
ARG DEBIAN_FRONTEND=noninteractive
8+
9+
RUN apt update && apt install software-properties-common -y
10+
11+
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
12+
13+
# Update and Installs Required Packages for ReMKiT1D and other Packages
14+
RUN apt update \
15+
&& apt install -y \
16+
gfortran-11 \
17+
g++-11 \
18+
python3 \
19+
python3-dev \
20+
pip \
21+
libblas-dev \
22+
libhdf5-dev \
23+
liblapack-dev \
24+
m4 \
25+
wget \
26+
git \
27+
gcovr \
28+
gcc-arm-linux-gnueabihf \
29+
build-essential \
30+
pkg-config
31+
32+
# Packages need to be Compiled and Installed Using Fortran-11
33+
# CMake Commands State the Required Compilers to use
34+
ENV FC=gfortran-11
35+
ENV CC=gcc-11
36+
ENV CXX=g++-11
37+
38+
WORKDIR /home
39+
40+
# ReMKiT1D Requires CMake-3.18.0 and pFUnit-4.2.2 has some Incompatibilities with Newer Versions of CMake (v3.25.0-rc1)
41+
RUN wget https://github.com/Kitware/CMake/releases/download/v3.18.0/cmake-3.18.0.tar.gz
42+
RUN tar -zvxf cmake-3.18.0.tar.gz
43+
44+
WORKDIR /home/cmake-3.18.0
45+
46+
RUN ./bootstrap -- -DCMAKE_USE_OPENSSL=OFF
47+
48+
RUN make
49+
RUN make install
50+
WORKDIR /home
51+
52+
# ReMKiT1D Requires MPI and mpich-3.4.2 has been Tested and is used in the main.yml Workflow Script
53+
RUN wget -O mpich.tar.gz https://www.mpich.org/static/downloads/3.4.2/mpich-3.4.2.tar.gz
54+
RUN tar xfz mpich.tar.gz
55+
56+
RUN mkdir mpich-install
57+
WORKDIR /home/mpich-3.4.2
58+
59+
# ReMKiT1D Requires gfortran-11, gcc-11 and g++-11. CMake Installs the Package to the mpich-install Folder
60+
RUN ./configure CC=gcc-11 CXX=g++-11 FC=gfortran-11 --prefix=/home/mpich-install FFLAGS=-fallow-argument-mismatch --with-device=ch3
61+
62+
RUN make
63+
RUN make install
64+
WORKDIR /home
65+
66+
# Include the mpich-install PATH for Compilation of ReMKiT1D
67+
ENV PATH=/home/mpich-install/bin:$PATH
68+
69+
# PETSc-3.17 is the Newest Release that has been Tested on ReMKiT1D (3.18 not Compatible)
70+
RUN git clone -b release-3.17 https://gitlab.com/petsc/petsc.git petsc
71+
72+
WORKDIR petsc/
73+
74+
#PETSc Requires MPI and PETSc is Told Where MPI (mpich-4.2.2) is Installed
75+
RUN ./configure --with-mpi-dir=/home/mpich-install --download-hypre=1 --download-fblaslapack=1 --with-debugging=0 COPTFLAGS=-O3 CXXOPTFLAGS=-O3 FOPTFLAGS=-O3
76+
RUN make PETSC_DIR=/home/petsc PETSC_ARCH=arch-linux-c-opt all check
77+
78+
WORKDIR /home
79+
80+
# pFUnit-4.2.2 is Installed for the use of Unit Testing
81+
RUN git clone -b v4.2.2 https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git
82+
WORKDIR pFUnit
83+
RUN mkdir build
84+
WORKDIR build
85+
86+
# ReMKiT1D Requires gfortran-11, gcc-11 and g++-11. CMake Installs the Package to the 'installs' Folder
87+
RUN cmake .. -DSKIP_OPENMP=yes -DCMAKE_Fortran_COMPILER=gfortran-11 -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_INSTALL_PREFIX=/home/installs/pFUnit
88+
RUN make install
89+
WORKDIR /home
90+
91+
# ReMKiT1D is Currently using json-fortran-8.2.5
92+
RUN git clone -b 8.2.5 https://github.com/jacobwilliams/json-fortran.git
93+
94+
WORKDIR json-fortran
95+
RUN mkdir build
96+
WORKDIR build
97+
98+
# ReMKiT1D Requires gfortran-11, gcc-11 and g++-11. CMake Installs the Package to the 'installs' Folder
99+
RUN cmake .. -DCMAKE_Fortran_COMPILER=gfortran-11 -DCMAKE_INSTALL_PREFIX=/home/installs/json-fortran -DSKIP_DOC_GEN=TRUE
100+
RUN make install
101+
102+
WORKDIR /home
103+
104+
# HDF5 is Required and HDF5-1.13.0 is used within the main.yml Workflow Script
105+
RUN git clone -b hdf5-1_13_0 https://github.com/HDFGroup/hdf5.git
106+
107+
WORKDIR hdf5
108+
RUN mkdir build
109+
WORKDIR build
110+
111+
# ReMKiT1D Requires gfortran-11, gcc-11 and g++-11. CMake Installs the Package to the 'installs' Folder
112+
RUN cmake .. -DCMAKE_Fortran_COMPILER=gfortran-11 -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DHDF5_BUILD_FORTRAN=ON -DCMAKE_INSTALL_PREFIX=/home/installs/hdf5
113+
114+
RUN make install
115+
WORKDIR /home
116+
117+
# ReMKiT1D v1.2.0+ requires sundials
118+
RUN git clone -b v7.2.1 https://github.com/LLNL/sundials.git
119+
WORKDIR sundials
120+
RUN mkdir build
121+
WORKDIR build
122+
123+
RUN cmake .. -DENABLE_MPI=ON -DCMAKE_INSTALL_PREFIX=/home/installs/sundials -DENABLE_LAPACK=ON -DBUILD_FORTRAN_MODULE_INTERFACE=ON -DCMAKE_C_COMPILER=gcc-11
124+
RUN make
125+
RUN make install
126+
127+
WORKDIR /home
128+
129+
RUN echo LD_LIBRARY_PATH=/home/mpich-install/lib:$LD_LIBRARY_PATH
130+
131+
# Add the PATH to assist CMake and Make Find the Required Compilation Files
132+
ENV PFUNIT_DIR=/home/installs/pFUnit
133+
ENV PETSC_DIR=/home/petsc
134+
ENV PETSC_ARCH=arch-linux-c-opt
135+
ENV PATH=$PATH:/home/installs/petsc
136+
ENV PATH=$PATH:/home/installs/hdf5
137+
ENV PATH=$PATH:/home/installs/json-fortran/jsonfortran-gnu-8.2.5
138+
ENV PATH=$PATH:/home/mpich-install/bin:$PATH
139+
ENV PATH=$PATH:/home/installs/sundials
140+
ENV LD_LIBRARY_PATH=/home/mpich-install/lib:$LD_LIBRARY_PATH
141+
ENV LD_LIBRARY_PATH=/home/sundials/lib:$LD_LIBRARY_PATH
142+
ENV SUNDIALS_DIR=/home/installs/sundials/lib/cmake/sundials

docs-pages/01-install.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Title: Building and Installing
22
Author: Stefan Mijin
3-
Date: 19.09.2024.
3+
Date: 27.02.2025.
44

55
## Prerequisites
66

docs-pages/02-run.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Title: Running
22
Author: Stefan Mijin
3-
Date: 19.09.2024.
3+
Date: 25.02.2025.
44

55
If the build process is successful, the executable will be in build/src/executables/ReMKiT1D.
66
ReMKiT1D requires a config.json file as input. Assuming a valid config file is available, the code can be run from the executable directory using, for example:

docs-pages/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Title: Documentation
22
Author: Stefan Mijin
3-
Date: 19.09.2024.
3+
Date: 27.02.2025.
44

55
# **Re**active **M**ultifluid and **Ki**netic **T**ransport in **1D**
66

7-
rEMKiT1D is a framework for building 1D multi-fluid models of the tokamak Scrape-Off Layer with support for kinetic electron effects and collisional-radiative modelling. The framework is controlled through a Python interface available [here](https://github.com/ukaea/ReMKiT1D-Python), where users can find high-level examples and documentation.
7+
ReMKiT1D is a framework for building 1D multi-fluid models of the tokamak Scrape-Off Layer with support for kinetic electron effects and collisional-radiative modelling. The framework is controlled through a Python interface available [here](https://github.com/ukaea/ReMKiT1D-Python), where users can find high-level examples and documentation.
88

99
For an overview of both the Fortran framework and the Python interface see the [code paper](https://www.sciencedirect.com/science/article/pii/S0010465524001188).

src/modules/abstract_model_builder/term_generator_abstract.f90

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ module term_generator_abstract_class
4848

4949
procedure ,public :: getNumImplicitTerms
5050
procedure ,public :: getNumGeneralTerms
51+
procedure ,public :: getGeneratorPrefix
5152

5253
procedure ,public :: moveTerms
5354

@@ -110,6 +111,14 @@ pure module function getNumGeneralTerms(this) result(numTerms)
110111
integer(ik) :: numTerms
111112

112113
end function getNumGeneralTerms
114+
!-----------------------------------------------------------------------------------------------------------------------------------
115+
pure module function getGeneratorPrefix(this) result(prefix)
116+
!! Get size of this%generalTerms
117+
118+
class(TermGenerator) ,intent(in) :: this
119+
character(:) ,allocatable :: prefix
120+
121+
end function getGeneratorPrefix
113122
!-----------------------------------------------------------------------------------------------------------------------------------
114123
module subroutine moveTerms(this,modelObj,impTermImpGroups,impTermGenGroups,genTermGroups)
115124
!! Move terms to modelObj
@@ -126,4 +135,4 @@ end subroutine moveTerms
126135
!-----------------------------------------------------------------------------------------------------------------------------------
127136
end module term_generator_abstract_class
128137
!-----------------------------------------------------------------------------------------------------------------------------------
129-
138+

src/modules/abstract_model_builder/term_generator_abstract_procedures.f90

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ pure module function getNumGeneralTerms(this) result(numTerms)
8282
numTerms = size(this%generalTerms)
8383

8484
end function getNumGeneralTerms
85+
!-----------------------------------------------------------------------------------------------------------------------------------
86+
pure module function getGeneratorPrefix(this) result(prefix)
87+
!! Get size of this%generalTerms
88+
89+
class(TermGenerator) ,intent(in) :: this
90+
character(:) ,allocatable :: prefix
91+
92+
prefix = this%generatorPrefix
93+
94+
end function getGeneratorPrefix
8595
!-----------------------------------------------------------------------------------------------------------------------------------
8696
module subroutine moveTerms(this,modelObj,impTermImpGroups,impTermGenGroups,genTermGroups)
8797
!! Move terms to modelObj

src/modules/basic_integrators/implicit_PicardBDE_integrator.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ module implicit_PicardBDE_integrator_class
4343

4444
integer(ik) :: maxRestarts = 3 !! Maximum number of consecutive solver restart attempts before critical failure is announced
4545

46+
integer(ik) :: consolidationInterval = 50 !! How many integration calls before currentNumSubsteps is again reduced to 1
47+
4648
integer(ik) :: hardMaxRestarts = 10 !! Maximum number of consecutive solver restart attempts before critical failure is announced regardless of whether consolidation happened or not
4749

4850
integer(ik) :: restartCount = 0 !! Counter for consecutive number of solver restars
49-
50-
integer(ik) :: consolidationInterval = 50 !! How many integration calls before currentNumSubsteps is again reduced to 1
5151
integer(ik) :: stepsSinceLastConsolidation = 0 !! Counter for steps since last consolidation to 1 substep
5252

5353
end type InternalControllerOptions

src/modules/basic_integrators/implicit_PicardBDE_integrator_procedures.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ function checkConvergence(oldVars,newVars,indicesToCheck,nonlinTol,absTol,use2No
218218

219219
end if
220220
varConverged(i) = relError < nonlinTol .or. absError < epsilon(absError)*absTol
221-
!if (.not. varConverged(i)) print*,i,varConverged(i),relError,absError
222221
if (.not. varConverged(i)) convergenceCounter(i) = convergenceCounter(i) + 1
223222
end do
224223

@@ -354,6 +353,9 @@ subroutine tryIntegrate(this,manipulatedModeller,outputVars,inputVars,numSteps,d
354353

355354
allocate(implicitVectorInit,source=this%implicitVectorOld)
356355
do i = 1, numSteps
356+
357+
call printNamedValue(this%integratorName//": Current number of substeps",numSteps)
358+
call printNamedValue(this%integratorName//": Starting substep",i)
357359
if (inputVars%isVarNameRegistered("time")) &
358360
this%buffer%variables(timeVarIndex)%entry(1) = this%buffer%variables(timeVarIndex)%entry(1) + dt(i)
359361
tolReached = .false.

src/modules/basic_support/physics_functions.f90

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ pure module function logLee(Te,ne) result(res)
3333

3434
end function logLee
3535
!-----------------------------------------------------------------------------------------------------------------------------------
36-
pure module function logLei(Te,ne,Z) result(res)
36+
pure module function logLei(Te,ne,Z,removeDisc) result(res)
3737
!! Calculate Coulomb logarithm for electron-ion collisions (NRL Formulary 2013 page 34 equation b). Assumes Te > Ti*Z*me/mi
3838

39-
real(rk) ,intent(in) :: Te !! Electron temperature in eV
40-
real(rk) ,intent(in) :: ne !! Electron density in m^{-3}
41-
real(rk) ,intent(in) :: Z !! Ion charge
42-
real(rk) :: res
39+
real(rk) ,intent(in) :: Te !! Electron temperature in eV
40+
real(rk) ,intent(in) :: ne !! Electron density in m^{-3}
41+
real(rk) ,intent(in) :: Z !! Ion charge
42+
logical ,intent(in), optional :: removeDisc !! Remove the discontinuity at 10eV by moving the branch switch to Te = Z**2 * e**2 eV. Defaults to .false.
43+
real(rk) :: res
4344

4445
end function logLei
4546
!-----------------------------------------------------------------------------------------------------------------------------------
@@ -135,4 +136,4 @@ end function simpleMoment
135136
end interface
136137
!-----------------------------------------------------------------------------------------------------------------------------------
137138
end module physics_functions
138-
!-----------------------------------------------------------------------------------------------------------------------------------
139+
!-----------------------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)