Skip to content

Commit

Permalink
Upstream CheMFC infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
henryleberre committed Sep 15, 2024
1 parent b9e6875 commit 6f2de46
Show file tree
Hide file tree
Showing 40 changed files with 1,307 additions and 399 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/tests/**/* linguist-generated=true
/toolchain/mechanisms/* linguist-generated=true
9 changes: 2 additions & 7 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
name: Documentation

on:
push:
branches:
- master

workflow_dispatch:
on: [push, pull_request, workflow_dispatch]

jobs:
docs:
name: Build & Publish
runs-on: ubuntu-latest

if: github.repository == 'MFlowCode/MFC'
concurrency:
group: docs-publish
cancel-in-progress: true
Expand Down Expand Up @@ -53,6 +47,7 @@ jobs:
echo "excluded-count = ${{ steps.sitemap.outputs.excluded-count }}"
- name: Publish Documentation
if: github.repository == 'MFlowCode/MFC' && github.ref == 'refs/heads/master' && github.event_name == 'push'
run: |
set +e
git ls-remote "${{ secrets.DOC_PUSH_URL }}" -q
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ jobs:
- name: Setup MacOS
if: matrix.os == 'macos'
run: |
brew install coreutils python cmake fftw hdf5 gcc@14 open-mpi
brew install coreutils python cmake fftw hdf5 gcc@14 boost open-mpi
echo "FC=gfortran-14" >> $GITHUB_ENV
echo "BOOST_INCLUDE=/opt/homebrew/include/" >> $GITHUB_ENV
- name: Setup Ubuntu
if: matrix.os == 'ubuntu' && matrix.intel == false
Expand Down Expand Up @@ -138,4 +139,3 @@ jobs:
with:
name: logs
path: test-${{ matrix.device }}.out

1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ macro(HANDLE_SOURCES target useCommon)
-D MFC_${${target}_UPPER}
-D MFC_COMPILER="${CMAKE_Fortran_COMPILER_ID}"
-D MFC_CASE_OPTIMIZATION=False
-D chemistry=False
--line-numbering
--no-folding
"${fpp}" "${f90}"
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,20 @@ It's rather straightforward.
We'll give a brief intro. here for MacOS.
Using [brew](https://brew.sh), install MFC's dependencies:
```shell
brew install coreutils python cmake fftw hdf5 gcc open-mpi
brew install coreutils python cmake fftw hdf5 gcc boost open-mpi
```
You're now ready to build and test MFC!
Put it to a convenient directory via
```shell
git clone https://github.com/MFlowCode/MFC
cd MFC
```
and be sure MFC knows where to find Boost by appending to your dotfiles and sourcing them again
```shell
echo -e 'export BOOST_INCLUDE=/opt/homebrew/' | tee -a ~/.bash_profile ~/.zshrc
. ~/.bash_profile 2>/dev/null || . ~/.zshrc 2>/dev/null
! [ -z "${BOOST_INCLUDE+x}" ] && echo 'Environment is ready!' || echo 'Error: $BOOST_INCLUDE is unset. Please adjust the previous commands to fit with your environment.'
```
then you can build MFC and run the test suite!
```shell
./mfc.sh build -j $(nproc)
Expand Down
8 changes: 6 additions & 2 deletions docs/documentation/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,14 @@ You will also have access to the `.sln` Microsoft Visual Studio solution files f
<details>
<summary><h3>MacOS</h3></summary>

Using [Homebrew](https://brew.sh/) you can install the necessary dependencies:
Using [Homebrew](https://brew.sh/) you can install the necessary dependencies
before configuring your environment:

```shell
brew install coreutils python cmake fftw hdf5 gcc open-mpi
brew install coreutils python cmake fftw hdf5 gcc boost open-mpi
echo -e 'export BOOST_INCLUDE=/opt/homebrew/' | tee -a ~/.bash_profile ~/.zshrc
. ~/.bash_profile 2>/dev/null || . ~/.zshrc 2>/dev/null
! [ -z "${BOOST_INCLUDE+x}" ] && echo 'Environment is ready!' || echo 'Error: $BOOST_INCLUDE is unset. Please adjust the previous commands to fit with your environment.'
```

They will download the dependencies MFC requires to build itself.
Expand Down
6 changes: 6 additions & 0 deletions misc/fpp_to_fypp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

for file in $(find src -type f | grep -Ev 'autogen' | grep -E '\.fpp$'); do
echo "$file"
mv "$file" "$(echo "$file" | sed s/\.fpp/\.fypp/)"
done
18 changes: 10 additions & 8 deletions src/common/include/macros.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,19 @@
#endif
#:enddef

#:def PROHIBIT(*args)
#:set condition = args[0]
#:if len(args) == 1
#:set message = '""'
#:else
#:set message = args[1]
#:endif
#:def PROHIBIT(condition, message = None)
if (${condition}$) then
call s_prohibit_abort("${condition}$", ${message}$)
call s_prohibit_abort("${condition}$", ${message or '""'}$)
end if
#:enddef

#define t_vec3 real(kind(0d0)), dimension(1:3)
#define t_mat4x4 real(kind(0d0)), dimension(1:4,1:4)

#:def ASSERT(predicate, message = None)
if (.not. (${predicate}$)) then
call s_mpi_abort("${_FILE_.split('/')[-1]}$:${_LINE_}$: "// &
"Assertion failed: ${predicate}$. " &
//${message or '"No error description."'}$)
end if
#:enddef
18 changes: 17 additions & 1 deletion src/common/m_derived_types.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
!! types used in the pre-process code.
module m_derived_types

use m_constants !< Constants
use m_constants !< Constants
use m_thermochem !< Thermodynamic properties

implicit none

Expand Down Expand Up @@ -192,6 +193,7 @@ module m_derived_types
!! id for hard coded initial condition

real(kind(0d0)) :: cf_val !! color function value
real(kind(0d0)) :: Y(1:num_species)

end type ic_patch_parameters

Expand Down Expand Up @@ -300,4 +302,18 @@ module m_derived_types
end type ghost_point
!> Species parameters
type species_parameters
character(LEN=name_len) :: name !< Name of species
end type species_parameters
!> Chemistry parameters
type chemistry_parameters
character(LEN=name_len) :: cantera_file !< Path to Cantera file
logical :: advection
logical :: diffusion
logical :: reactions
end type chemistry_parameters
end module m_derived_types
Loading

0 comments on commit 6f2de46

Please sign in to comment.