├── logos ├── thumbnail_ReMKiT1D_black.png └── thumbnail_ReMKiT1D_white.png ├── .gitignore ├── cmake └── ReMKiT1DConfig.cmake.in ├── codecov.yml ├── docs-pages ├── index.md └── 02-run.md ├── .github └── workflows │ ├── deploy-docs.yml │ └── CI.yml ├── src ├── executables │ ├── CMakeLists.txt │ └── ReMKiT1D │ │ └── CMakeLists.txt ├── CMakeLists.txt └── modules │ ├── parameters │ ├── data_kinds.f90 │ ├── runtime_constants.f90 │ ├── CMakeLists.txt │ └── physical_constants.f90 │ ├── modelbound_data │ ├── model_surrogate.f90 │ └── CMakeLists.txt │ ├── abstract_manipulators │ ├── modeller_surrogate.f90 │ └── CMakeLists.txt │ ├── CMakeLists.txt │ ├── basic_support │ ├── CMakeLists.txt │ └── god_objects_procedures.f90 │ ├── testing_support │ ├── test_operator_procedures.f90 │ ├── CMakeLists.txt │ ├── test_explicit_term_procedures.f90 │ ├── test_operator.f90 │ ├── test_matrix_term_procedures.f90 │ └── test_explicit_term.f90 │ ├── mpi_support │ └── CMakeLists.txt │ ├── normalization │ └── CMakeLists.txt │ ├── grid │ └── CMakeLists.txt │ ├── signals │ ├── CMakeLists.txt │ ├── constant_signal_procedures.f90 │ ├── constant_signal.f90 │ ├── hat_signal_procedures.f90 │ ├── cut_sine_signal_procedures.f90 │ ├── hat_signal.f90 │ ├── cut_sine_signal.f90 │ └── signal_abstract.f90 │ ├── variables │ ├── CMakeLists.txt │ ├── derivation_abstract.f90 │ └── mat_derivation_abstract.f90 │ ├── extrapolation_support │ └── CMakeLists.txt │ ├── solver_support │ └── CMakeLists.txt │ ├── terms │ ├── CMakeLists.txt │ ├── operator_abstract_procedures.f90 │ ├── term_abstract_procedures.f90 │ ├── operator_abstract.f90 │ └── jagged_array_generator_procedures.f90 │ ├── common_derivations │ ├── CMakeLists.txt │ └── calculation_tree_derivation_procedures.f90 │ ├── common_manipulators │ └── CMakeLists.txt │ ├── model │ └── CMakeLists.txt │ ├── integrator_abstractions │ ├── CMakeLists.txt │ └── timestep_controller_abstract.f90 │ ├── IO_support │ └── CMakeLists.txt │ ├── timeloop │ └── CMakeLists.txt │ ├── collisional_radiative_modelling │ └── CMakeLists.txt │ ├── general_terms │ └── CMakeLists.txt │ ├── fluid_terms │ └── CMakeLists.txt │ ├── kinetic_terms │ └── CMakeLists.txt │ ├── abstract_model_builder │ └── CMakeLists.txt │ ├── modeller │ └── CMakeLists.txt │ ├── modeller_assembly │ ├── CMakeLists.txt │ └── standard_modeller_assembly.f90 │ ├── fluid_models │ └── CMakeLists.txt │ ├── basic_integrators │ └── CMakeLists.txt │ ├── kinetic_models │ └── CMakeLists.txt │ ├── general_models │ └── CMakeLists.txt │ └── extended_support │ └── CMakeLists.txt ├── ford-docs.md ├── get_code_cov.sh ├── tests ├── test_grid │ ├── CMakeLists.txt │ ├── test_grid.pf │ ├── test_partition.pf │ ├── test_v_space.pf │ ├── test_variable_list.pf │ └── test_indexing.pf ├── test_basic_support │ ├── CMakeLists.txt │ ├── test_find.pf │ ├── test_god_objects.pf │ ├── test_coo_sparsity_pattern.pf │ ├── test_nd_data.pf │ ├── test_calculation_tree.pf │ └── test_sparse_row_data.pf ├── test_variables │ └── CMakeLists.txt ├── test_mpi │ └── CMakeLists.txt ├── test_json │ └── CMakeLists.txt ├── test_hdf5 │ └── CMakeLists.txt ├── test_solver_support │ ├── CMakeLists.txt │ └── test_petsc_prealloc_data.pf ├── test_terms │ ├── CMakeLists.txt │ └── test_stencil_generator1d.pf ├── test_inel_mapping │ ├── CMakeLists.txt │ └── test_inel_map.pf ├── test_common_derivations │ └── CMakeLists.txt ├── test_model │ └── CMakeLists.txt ├── test_fluid_terms │ └── CMakeLists.txt ├── test_extended_support │ └── CMakeLists.txt ├── test_kinetic_terms │ └── CMakeLists.txt ├── test_fluid_models │ └── CMakeLists.txt ├── test_kinetic_models │ └── CMakeLists.txt ├── test_timeloop │ └── CMakeLists.txt ├── test_modeller │ └── CMakeLists.txt └── CMakeLists.txt └── CONTRIBUTING.md /logos/thumbnail_ReMKiT1D_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ukaea/ReMKiT1D/HEAD/logos/thumbnail_ReMKiT1D_black.png -------------------------------------------------------------------------------- /logos/thumbnail_ReMKiT1D_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ukaea/ReMKiT1D/HEAD/logos/thumbnail_ReMKiT1D_white.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | debug 2 | build 3 | tests/*/*.F90 4 | .VSCodeCounter 5 | .vscode* 6 | ford_doc.md 7 | *mod 8 | *.json 9 | /doc/ 10 | .ssh 11 | .gitconfig 12 | *bash_history -------------------------------------------------------------------------------- /cmake/ReMKiT1DConfig.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | include(CMakeFindDependencyMacro) 4 | 5 | # Find any packages which will be needed by users of your projectd, e.g.: 6 | # find_package(Boost 1.55 REQUIRED COMPONENTS regex) 7 | 8 | if(NOT TARGET @PROJECT_NAME@::@PROJECT_NAME@) 9 | include("@PACKAGE_INSTALL_CONFIGDIR@/@PROJECT_NAME@Targets.cmake") 10 | endif() 11 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | round: up 3 | range: 50..80 4 | 5 | status: 6 | project: # settings affecting project coverage 7 | default: 8 | enabled: yes 9 | target: auto # auto % coverage target 10 | threshold: 5% # allow for 5% reduction of coverage without failing 11 | 12 | # do not run coverage on patch nor changes 13 | patch: 14 | default: 15 | enabled: false 16 | changes: no -------------------------------------------------------------------------------- /docs-pages/index.md: -------------------------------------------------------------------------------- 1 | Title: Documentation 2 | Author: Stefan Mijin 3 | Date: 27.02.2025. 4 | 5 | # **Re**active **M**ultifluid and **Ki**netic **T**ransport in **1D** 6 | 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. 8 | 9 | For an overview of both the Fortran framework and the Python interface see the [code paper](https://www.sciencedirect.com/science/article/pii/S0010465524001188). 10 | -------------------------------------------------------------------------------- /.github/workflows/deploy-docs.yml: -------------------------------------------------------------------------------- 1 | name: docs 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build-and-deploy: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | - uses: actions/setup-python@v4 15 | with: 16 | python-version: '3.x' 17 | - name: Install dependencies 18 | run: pip install ford 19 | - name: Build Documentation 20 | run: ford ford-docs.md 21 | - uses: JamesIves/github-pages-deploy-action@v4 22 | with: 23 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 24 | BRANCH: gh-pages 25 | FOLDER: doc/ford 26 | CLEAN: true 27 | -------------------------------------------------------------------------------- /docs-pages/02-run.md: -------------------------------------------------------------------------------- 1 | Title: Running 2 | Author: Stefan Mijin 3 | Date: 25.02.2025. 4 | 5 | If the build process is successful, the executable will be in build/src/executables/ReMKiT1D. 6 | 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: 7 | ``` 8 | mpirun -np [num_procs] ./ReMKiT1D 9 | ``` 10 | where [num_procs] should be set to the desired number of processes. An alternative path to the config file can be specified using the command line option 11 | 12 | ``` 13 | -with_config_path=/path/to/config/file.json 14 | ``` 15 | 16 | For more details on how to use the code together with the Python support modules, see [Python repo](https://github.com/ukaea/ReMKiT1D-Python) 17 | -------------------------------------------------------------------------------- /src/executables/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | project(executables Fortran) 12 | 13 | add_subdirectory(ReMKiT1D) 14 | 15 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | 11 | project(src Fortran) 12 | 13 | add_subdirectory(modules) 14 | add_subdirectory(executables) 15 | 16 | 17 | -------------------------------------------------------------------------------- /ford-docs.md: -------------------------------------------------------------------------------- 1 | src_dir: ./src/modules/ 2 | output_dir: ./doc/ford 3 | project: ReMKiT1D 4 | project_github: https://github.com/ukaea/ReMKiT1D 5 | summary: Reactive Multifluid and Kinetic Transport in 1D 6 | author: Stefan Mijin 7 | author_description: Domain Specialist at UKAEA 8 | github: https://github.com/SMijin 9 | email: stefan.mijin@ukaea.uk 10 | predocmark: > 11 | docmark_alt: # 12 | predocmark_alt: < 13 | source: false 14 | graph: false 15 | search: true 16 | license: by-nc 17 | extra_filetypes: sh # 18 | display: private 19 | protected 20 | public 21 | extra_vartypes: Vec 22 | Mat 23 | KSP 24 | PC 25 | KSPConvergedReason 26 | PetscInt 27 | PetscScalar 28 | exclude_dir: ./src/modules/testing_support 29 | page_dir: ./docs-pages 30 | 31 | ## Brief description 32 | 33 | ReMKiT1D is a framework for building 1D fluid and kinetic models with reactive multispecies capabilities, focused on Scrape-Off Layer 34 | plasmas. 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /get_code_cov.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This file is part of ReMKiT1D. 4 | # 5 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | # 7 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 8 | # 9 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 10 | # 11 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 12 | # 13 | LOCATION=$1 14 | ROOT_PATH=$2 15 | cd $ROOT_PATH 16 | find -name '*.f90' -or -name "*.F90" -exec cp -t $LOCATION {} + 17 | cd - 18 | find -name '*.gcno' -exec cp -t $LOCATION {} + 19 | find -name '*.gcda' -exec cp -t $LOCATION {} + 20 | cd $LOCATION 21 | find -name '*.f90*' -or -name "*.F90*" -exec gcov -pb {} \; -------------------------------------------------------------------------------- /tests/test_grid/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | project(test_grid Fortran) 12 | 13 | FILE(GLOB_RECURSE pf_files "*.pf") 14 | 15 | add_pfunit_ctest (${PROJECT_NAME} 16 | TEST_SOURCES ${pf_files} 17 | MAX_PES 4 18 | LINK_LIBRARIES ${MPI_Fortran_LIBRARIES} 19 | parameters 20 | basic_support 21 | grid 22 | ) 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/test_basic_support/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | PROJECT(test_basic_support Fortran) 12 | 13 | # Add unit tests 14 | FILE(GLOB_RECURSE pf_files "*.pf") 15 | 16 | add_pfunit_ctest(${PROJECT_NAME} 17 | TEST_SOURCES ${pf_files} 18 | MAX_PES 8 19 | LINK_LIBRARIES 20 | MPI::MPI_Fortran 21 | parameters 22 | basic_support 23 | ) 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/test_variables/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | project(test_variables Fortran) 12 | 13 | FILE(GLOB_RECURSE pf_files "*.pf") 14 | 15 | add_pfunit_ctest (${PROJECT_NAME} 16 | TEST_SOURCES ${pf_files} 17 | MAX_PES 4 18 | LINK_LIBRARIES ${MPI_Fortran_LIBRARIES} 19 | parameters 20 | basic_support 21 | grid 22 | variables 23 | ) 24 | 25 | 26 | -------------------------------------------------------------------------------- /tests/test_mpi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | project(test_mpi Fortran) 12 | 13 | FILE(GLOB_RECURSE pf_files "*.pf") 14 | 15 | add_pfunit_ctest (${PROJECT_NAME} 16 | TEST_SOURCES ${pf_files} 17 | MAX_PES 8 18 | LINK_LIBRARIES ${MPI_Fortran_LIBRARIES} 19 | parameters 20 | basic_support 21 | grid 22 | variables 23 | mpi_support 24 | ) 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/test_json/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | project(test_json Fortran) 12 | 13 | FILE(GLOB_RECURSE pf_files "*.pf") 14 | 15 | add_pfunit_ctest (${PROJECT_NAME} 16 | TEST_SOURCES ${pf_files} 17 | MAX_PES 8 18 | LINK_LIBRARIES ${MPI_Fortran_LIBRARIES} 19 | jsonfortran-static 20 | parameters 21 | basic_support 22 | mpi_support 23 | IO_support 24 | ) 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/test_hdf5/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | project(test_hdf5 Fortran) 12 | 13 | FILE(GLOB_RECURSE pf_files "*.pf") 14 | 15 | add_pfunit_ctest (${PROJECT_NAME} 16 | TEST_SOURCES ${pf_files} 17 | MAX_PES 8 18 | LINK_LIBRARIES ${MPI_Fortran_LIBRARIES} 19 | parameters 20 | basic_support 21 | grid 22 | variables 23 | mpi_support 24 | IO_support 25 | ) 26 | 27 | 28 | -------------------------------------------------------------------------------- /tests/test_solver_support/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | project(test_solver_support Fortran) 12 | 13 | FILE(GLOB_RECURSE pf_files "*.pf") 14 | 15 | add_pfunit_ctest (${PROJECT_NAME} 16 | TEST_SOURCES ${pf_files} 17 | MAX_PES 8 18 | LINK_LIBRARIES ${MPI_Fortran_LIBRARIES} 19 | parameters 20 | basic_support 21 | grid 22 | variables 23 | solver_support 24 | mpi_support 25 | ) 26 | 27 | 28 | -------------------------------------------------------------------------------- /tests/test_terms/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | project(test_terms Fortran) 12 | 13 | FILE(GLOB_RECURSE pf_files "*.pf") 14 | 15 | add_pfunit_ctest (${PROJECT_NAME} 16 | TEST_SOURCES ${pf_files} 17 | MAX_PES 4 18 | LINK_LIBRARIES ${MPI_Fortran_LIBRARIES} 19 | parameters 20 | basic_support 21 | grid 22 | variables 23 | solver_support 24 | terms 25 | testing_support 26 | ) 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/test_inel_mapping/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | project(test_inel_mapping Fortran) 12 | 13 | FILE(GLOB_RECURSE pf_files "*.pf") 14 | 15 | add_pfunit_ctest (${PROJECT_NAME} 16 | TEST_SOURCES ${pf_files} 17 | MAX_PES 4 18 | LINK_LIBRARIES ${MPI_Fortran_LIBRARIES} 19 | parameters 20 | basic_support 21 | grid 22 | variables 23 | terms 24 | modelbound_data 25 | collisional_radiative_modelling 26 | ) 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/test_common_derivations/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | PROJECT(test_common_derivations Fortran) 12 | 13 | FILE(GLOB_RECURSE pf_files "*.pf") 14 | 15 | add_pfunit_ctest (${PROJECT_NAME} 16 | TEST_SOURCES ${pf_files} 17 | MAX_PES 4 18 | LINK_LIBRARIES ${MPI_Fortran_LIBRARIES} 19 | parameters 20 | basic_support 21 | grid 22 | variables 23 | common_derivations 24 | extended_support 25 | extrapolation_support 26 | ) 27 | -------------------------------------------------------------------------------- /tests/test_model/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | project(test_model Fortran) 12 | 13 | FILE(GLOB_RECURSE pf_files "*.pf") 14 | 15 | add_pfunit_ctest (${PROJECT_NAME} 16 | TEST_SOURCES ${pf_files} 17 | MAX_PES 8 18 | LINK_LIBRARIES ${MPI_Fortran_LIBRARIES} 19 | parameters 20 | basic_support 21 | grid 22 | variables 23 | solver_support 24 | terms 25 | model 26 | testing_support 27 | mpi_support 28 | ) 29 | 30 | 31 | -------------------------------------------------------------------------------- /tests/test_fluid_terms/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | project(test_fluid_terms Fortran) 12 | 13 | FILE(GLOB_RECURSE pf_files "*.pf") 14 | 15 | add_pfunit_ctest (${PROJECT_NAME} 16 | TEST_SOURCES ${pf_files} 17 | MAX_PES 8 18 | LINK_LIBRARIES ${MPI_Fortran_LIBRARIES} 19 | parameters 20 | basic_support 21 | grid 22 | variables 23 | solver_support 24 | terms 25 | fluid_terms 26 | signals 27 | model 28 | ) 29 | 30 | 31 | -------------------------------------------------------------------------------- /tests/test_extended_support/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | project(test_extended_support Fortran) 12 | 13 | FILE(GLOB_RECURSE pf_files "*.pf") 14 | 15 | add_pfunit_ctest (${PROJECT_NAME} 16 | TEST_SOURCES ${pf_files} 17 | MAX_PES 8 18 | LINK_LIBRARIES ${MPI_Fortran_LIBRARIES} 19 | parameters 20 | basic_support 21 | grid 22 | variables 23 | extended_support 24 | IO_support 25 | mpi_support 26 | fluid_models 27 | modeller_assembly 28 | ) 29 | 30 | 31 | -------------------------------------------------------------------------------- /tests/test_kinetic_terms/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | project(test_kinetic_terms Fortran) 12 | 13 | FILE(GLOB_RECURSE pf_files "*.pf") 14 | 15 | add_pfunit_ctest (${PROJECT_NAME} 16 | TEST_SOURCES ${pf_files} 17 | MAX_PES 8 18 | LINK_LIBRARIES ${MPI_Fortran_LIBRARIES} 19 | parameters 20 | basic_support 21 | grid 22 | variables 23 | solver_support 24 | terms 25 | kinetic_terms 26 | extended_support 27 | general_terms 28 | fluid_terms 29 | model 30 | modelbound_data 31 | ) 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/test_fluid_models/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | project(test_fluid_models Fortran) 12 | 13 | FILE(GLOB_RECURSE pf_files "*.pf") 14 | 15 | add_pfunit_ctest (${PROJECT_NAME} 16 | TEST_SOURCES ${pf_files} 17 | MAX_PES 8 18 | LINK_LIBRARIES ${MPI_Fortran_LIBRARIES} 19 | parameters 20 | basic_support 21 | grid 22 | variables 23 | solver_support 24 | terms 25 | fluid_terms 26 | fluid_models 27 | extended_support 28 | IO_support 29 | normalization 30 | general_models 31 | ) 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/test_kinetic_models/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | project(test_kinetic_models Fortran) 12 | 13 | FILE(GLOB_RECURSE pf_files "*.pf") 14 | 15 | add_pfunit_ctest (${PROJECT_NAME} 16 | TEST_SOURCES ${pf_files} 17 | MAX_PES 8 18 | LINK_LIBRARIES ${MPI_Fortran_LIBRARIES} 19 | parameters 20 | basic_support 21 | grid 22 | variables 23 | solver_support 24 | terms 25 | extended_support 26 | IO_support 27 | normalization 28 | general_models 29 | kinetic_terms 30 | kinetic_models 31 | model 32 | extrapolation_support 33 | ) 34 | 35 | 36 | -------------------------------------------------------------------------------- /tests/test_timeloop/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | project(test_timeloop Fortran) 12 | 13 | FILE(GLOB_RECURSE pf_files "*.pf") 14 | 15 | add_pfunit_ctest (${PROJECT_NAME} 16 | TEST_SOURCES ${pf_files} 17 | MAX_PES 8 18 | LINK_LIBRARIES ${MPI_Fortran_LIBRARIES} 19 | parameters 20 | basic_support 21 | grid 22 | variables 23 | solver_support 24 | terms 25 | model 26 | testing_support 27 | mpi_support 28 | modeller 29 | basic_integrators 30 | abstract_manipulators 31 | integrator_abstractions 32 | extended_support 33 | timeloop 34 | ) 35 | 36 | 37 | -------------------------------------------------------------------------------- /tests/test_modeller/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | project(test_modeller Fortran) 12 | 13 | FILE(GLOB_RECURSE pf_files "*.pf") 14 | 15 | add_pfunit_ctest (${PROJECT_NAME} 16 | TEST_SOURCES ${pf_files} 17 | MAX_PES 8 18 | LINK_LIBRARIES ${MPI_Fortran_LIBRARIES} 19 | parameters 20 | basic_support 21 | grid 22 | variables 23 | solver_support 24 | terms 25 | model 26 | testing_support 27 | mpi_support 28 | modeller 29 | basic_integrators 30 | abstract_manipulators 31 | integrator_abstractions 32 | IO_support 33 | common_manipulators 34 | ) 35 | 36 | 37 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | project(tests Fortran) 12 | 13 | add_subdirectory(test_basic_support) 14 | add_subdirectory(test_grid) 15 | add_subdirectory(test_variables) 16 | add_subdirectory(test_solver_support) 17 | add_subdirectory(test_mpi) 18 | add_subdirectory(test_terms) 19 | add_subdirectory(test_model) 20 | add_subdirectory(test_modeller) 21 | add_subdirectory(test_hdf5) 22 | add_subdirectory(test_json) 23 | add_subdirectory(test_fluid_terms) 24 | add_subdirectory(test_inel_mapping) 25 | add_subdirectory(test_extended_support) 26 | add_subdirectory(test_kinetic_terms) 27 | add_subdirectory(test_fluid_models) 28 | add_subdirectory(test_kinetic_models) 29 | add_subdirectory(test_common_derivations) 30 | add_subdirectory(test_timeloop) 31 | -------------------------------------------------------------------------------- /src/modules/parameters/data_kinds.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | module data_kinds 15 | !! Houses kind data 16 | 17 | use, intrinsic :: iso_fortran_env, only: int32, real64 18 | 19 | integer, parameter :: rk = real64, & !! Default real kind 20 | ik = int32 !! Default integer kind 21 | 22 | !---------------------------------------------------------------------------------------------------------------------------------- 23 | end module data_kinds 24 | !---------------------------------------------------------------------------------------------------------------------------------- 25 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | This file is under active development. Please send any suggestions to stefan.mijin@ukaea.uk. 4 | 5 | - All feature development should be done in separate branches. Please use branch names of the format dev-\${userID}-\${featureName}, where \${userID} is best set to the main feature developer's GitHub username and \${featureName} is a short name for the feature. 6 | - Raise a relevant issue (if it doesn't exist) before creating your feature branch, and refer to the issue in the PR 7 | - All new features should include reasonable unit test coverage, especially if the feature is low level. Pull requests which fail CI tests will be automatically rejected. 8 | - Document all new features using FORD 9 | - Every PR must include corresponding changes in the CHANGELOG.md file 10 | - Ideally, all new features should conform to the Fortran 2018 standard, and should not be using standards older than Fortran 2003 (where compilers allow). 11 | 12 | 13 | - Coding style points: 14 | - All variables and functions should be camelCase 15 | - Names of classes/types should be PascalCase 16 | - Names of files/modules/submodules should be snake_case 17 | - Separate declaration and implementation into modules and submodules, with files containing submodules ending in _procedures.f90. However, it is acceptable that minor modules not containing classes have their declaration and implementation all in one file. 18 | - Subroutine based constructors are preferred to function constructors (i.e. `call newObject%init()` over `newObject=Class()`) 19 | - Use modern logical operators (< over .lt. etc.) 20 | 21 | -------------------------------------------------------------------------------- /tests/test_basic_support/test_find.pf: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | module test_find 14 | 15 | use pfunit 16 | use support_functions ,only: findIndices 17 | use data_kinds ,only: ik, rk 18 | implicit none 19 | 20 | contains 21 | 22 | @test 23 | subroutine test_find_matrix() 24 | integer(ik) :: M(3,3), indices(4,2) 25 | 26 | M = reshape([ 1, 0, 0, 1, 0, 0, 1, 0, 1 ], shape(M)) 27 | indices = reshape([ 1, 1, 1, 3, 1, 2, 3, 3 ], shape(indices)) 28 | @assertEqual(findIndices(M == 1),indices) 29 | 30 | 31 | end subroutine test_find_matrix 32 | 33 | @test 34 | subroutine test_find_vector() 35 | 36 | @assertEqual(findIndices([1,2,3,4,5,1] > 3),[4,5]) 37 | 38 | end subroutine test_find_vector 39 | 40 | end module test_find 41 | -------------------------------------------------------------------------------- /tests/test_basic_support/test_god_objects.pf: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | 14 | @test 15 | subroutine test_object_not_defined 16 | use pfunit 17 | use god_objects ,only: object 18 | use data_kinds ,only: ik, rk 19 | implicit none 20 | 21 | type,extends(object) :: testobject 22 | end type 23 | 24 | type(testobject) :: mytestobject 25 | 26 | @assertFalse(mytestobject%isDefined()) 27 | 28 | end subroutine test_object_not_defined 29 | 30 | @test 31 | subroutine test_object_defined 32 | use pfunit 33 | use god_objects ,only: object 34 | use data_kinds ,only: ik, rk 35 | implicit none 36 | 37 | type,extends(object) :: testobject 38 | end type 39 | 40 | type(testobject) :: mytestobject 41 | 42 | call mytestobject%makeDefined() 43 | 44 | @assertTrue(mytestobject%isDefined()) 45 | 46 | end subroutine test_object_defined -------------------------------------------------------------------------------- /src/modules/modelbound_data/model_surrogate.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | module model_surrogate_class 15 | !! author: Stefan Mijin 16 | !! 17 | !! Contains empty object extension type for use as workaround for Fortran circular referencing - for use with Model objects 18 | 19 | use god_objects ,only: Object 20 | 21 | implicit none 22 | private 23 | 24 | type, public, extends(Object) :: ModelSurrogate 25 | end type ModelSurrogate 26 | !----------------------------------------------------------------------------------------------------------------------------------- 27 | end module model_surrogate_class 28 | !----------------------------------------------------------------------------------------------------------------------------------- 29 | 30 | -------------------------------------------------------------------------------- /src/modules/abstract_manipulators/modeller_surrogate.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | module modeller_surrogate_class 15 | !! author: Stefan Mijin 16 | !! 17 | !! Contains empty Object extension type for use as a workaround for Fortran circular referencing - to be used for Modeller 18 | !! objects 19 | 20 | use god_objects ,only: Object 21 | 22 | implicit none 23 | private 24 | 25 | type, public, extends(Object) :: ModellerSurrogate 26 | end type ModellerSurrogate 27 | !----------------------------------------------------------------------------------------------------------------------------------- 28 | end module modeller_surrogate_class 29 | !----------------------------------------------------------------------------------------------------------------------------------- 30 | 31 | -------------------------------------------------------------------------------- /tests/test_grid/test_grid.pf: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | 14 | @test 15 | subroutine test_grid 16 | use pfunit 17 | use god_objects ,only: object 18 | use data_kinds ,only: ik, rk 19 | use grid_class 20 | implicit none 21 | 22 | type(grid) :: testGrid 23 | 24 | call testGrid%init(real([0.0,0.1,0.2,0.3],kind=rk),real([0.1,0.2,0.3],kind=rk),2,1) 25 | 26 | @assertEqual(testGrid%getXGrid(),real([0.0,0.1,0.2,0.3],kind=rk)) 27 | @assertEqual(testGrid%getVGrid(),real([0.1,0.2,0.3],kind=rk)) 28 | @assertEqual(testGrid%getMaxL(),2) 29 | @assertEqual(testGrid%getMaxM(),1) 30 | @assertEqual(testGrid%getNumH(),7) 31 | @assertEqual(testGrid%getNumX(),4) 32 | @assertEqual(testGrid%getNumV(),3) 33 | 34 | @assertEqual(testGrid%getLGrid(),[0,1,1,1,2,2,2]) 35 | @assertEqual(testGrid%getMGrid(),[0,0,1,1,0,1,1]) 36 | @assertEqual(testGrid%getHarmonicIm(),[0,0,0,1,0,0,1]>0) 37 | @assertEqual(testGrid%getH(2,1,.false.),6) 38 | 39 | 40 | end subroutine test_grid 41 | 42 | -------------------------------------------------------------------------------- /tests/test_grid/test_partition.pf: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | @test 14 | subroutine test_partition 15 | use pfunit 16 | use god_objects ,only: object 17 | use data_kinds ,only: ik, rk 18 | use partition_class 19 | implicit none 20 | 21 | type(partition) :: testPart ,testPart2 22 | integer(ik) :: i 23 | 24 | call testPart%initSimplePartition(4,3,12,6) 25 | 26 | @assertEqual(testPart%getLocNumX(),[(3, i=1,12)]) 27 | @assertEqual(testPart%getLocNumH(),[(2, i=1,12)]) 28 | @assertEqual(testPart%getMinX(),[1,1,1,4,4,4,7,7,7,10,10,10]) 29 | @assertEqual(testPart%getMaxX(),[3,3,3,6,6,6,9,9,9,12,12,12]) 30 | @assertEqual(testPart%getMinH(),[1,3,5,1,3,5,1,3,5,1,3,5]) 31 | @assertEqual(testPart%getMaxH(),[2,4,6,2,4,6,2,4,6,2,4,6]) 32 | 33 | @assertEqual(testPart%findProc(6,3),5) 34 | @assertEqual(testPart%findProc(3,5),3) 35 | 36 | call testPart2%init([1,1],[2,3],[1,1],[1,1]) 37 | @assertTrue(testPart2%isDefined()) 38 | @assertEqual(testPart2%getLocNumX(),[2,3]) 39 | end subroutine test_partition -------------------------------------------------------------------------------- /src/executables/ReMKiT1D/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(ReMKiT1D Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | # Define the executable in terms of the source files 22 | ADD_EXECUTABLE(${PROJECT_NAME} ${${PROJECT_NAME}_sources}) 23 | 24 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | grid 31 | variables 32 | solver_support 33 | modeller 34 | mpi_support 35 | IO_support 36 | extended_support 37 | timeloop 38 | modeller_assembly 39 | PRIVATE 40 | ${BUILD_TYPE_Fortran_FLAGS} 41 | ) 42 | 43 | INSTALL(TARGETS ${PROJECT_NAME} 44 | EXPORT ${PROJECT_NAME}_installation 45 | ARCHIVE DESTINATION ${LIBDIR} 46 | LIBRARY DESTINATION ${LIBDIR} 47 | PUBLIC_HEADER DESTINATION ${INCDIR} 48 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 49 | ) 50 | -------------------------------------------------------------------------------- /src/modules/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | project(modules Fortran) 12 | 13 | add_subdirectory(parameters) 14 | add_subdirectory(basic_support) 15 | add_subdirectory(grid) 16 | add_subdirectory(variables) 17 | add_subdirectory(solver_support) 18 | add_subdirectory(mpi_support) 19 | add_subdirectory(terms) 20 | add_subdirectory(modelbound_data) 21 | add_subdirectory(model) 22 | add_subdirectory(testing_support) 23 | add_subdirectory(abstract_manipulators) 24 | add_subdirectory(modeller) 25 | add_subdirectory(integrator_abstractions) 26 | add_subdirectory(basic_integrators) 27 | add_subdirectory(IO_support) 28 | add_subdirectory(abstract_model_builder) 29 | add_subdirectory(fluid_terms) 30 | add_subdirectory(normalization) 31 | add_subdirectory(collisional_radiative_modelling) 32 | add_subdirectory(kinetic_terms) 33 | add_subdirectory(extended_support) 34 | add_subdirectory(fluid_models) 35 | add_subdirectory(common_derivations) 36 | add_subdirectory(modeller_assembly) 37 | add_subdirectory(timeloop) 38 | add_subdirectory(signals) 39 | add_subdirectory(common_manipulators) 40 | add_subdirectory(general_terms) 41 | add_subdirectory(general_models) 42 | add_subdirectory(kinetic_models) 43 | add_subdirectory(extrapolation_support) 44 | 45 | 46 | -------------------------------------------------------------------------------- /.github/workflows/CI.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | workflow_dispatch: 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | container: 14 | image: smijin/remkit1d-ci:latest 15 | 16 | steps: 17 | - name: Check out the repo 18 | uses: actions/checkout@v4 19 | 20 | - name: Build ReMKiT1D 21 | run: | 22 | mkdir build 23 | cd build 24 | cmake .. -DCMAKE_Fortran_COMPILER=${FC} -DCMAKE_BUILD_TYPE=TESTING 25 | make -j$(nproc) 26 | 27 | - name: Tar build artifacts 28 | run: tar -cvf build.tar ./build/ 29 | 30 | - name: Upload build artifacts 31 | uses: actions/upload-artifact@v4 32 | with: 33 | name: ReMKiT1D-build 34 | path: build.tar 35 | retention-days: 1 36 | 37 | test: 38 | needs: build 39 | runs-on: ubuntu-latest 40 | container: 41 | image: smijin/remkit1d-ci:latest 42 | 43 | steps: 44 | - name: Check out the repo 45 | uses: actions/checkout@v4 46 | 47 | - name: Download build artifacts 48 | uses: actions/download-artifact@v4 49 | with: 50 | name: ReMKiT1D-build 51 | 52 | - name: Untar build artifacts 53 | run: tar -xvf build.tar 54 | 55 | - name: Run tests 56 | run: | 57 | cd build 58 | ctest --rerun-failed --output-on-failure 59 | make gcov 60 | lcov --c --d ./coverage --output-file ./coverage/main_coverage.txt 61 | 62 | - name: Upload code coverage 63 | uses: codecov/codecov-action@v3 64 | with: 65 | token: ${{ secrets.CODECOV_TOKEN }} 66 | files: ${{ github.workspace }}/build/coverage/main_coverage.txt 67 | fail_ci_if_error: true # optional (default = false) 68 | verbose: true # optional (default = false) 69 | -------------------------------------------------------------------------------- /src/modules/parameters/runtime_constants.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | module runtime_constants 15 | !!Houses runtime constants 16 | 17 | use data_kinds, only: rk, ik 18 | #ifdef DEBUG 19 | logical, parameter :: debugging = .true. 20 | logical, parameter :: assertions = .true. 21 | #else 22 | logical, parameter :: debugging = .false. 23 | logical, parameter :: assertions = .false. 24 | #endif 25 | 26 | integer(ik), parameter :: assertionLvl = 0 !! Sets assertion level. 0 is just the lowest cost assertions. When assertions = .true. it overrides this and all assertions are on 27 | 28 | !---------------------------------------------------------------------------------------------------------------------------------- 29 | end module runtime_constants 30 | !---------------------------------------------------------------------------------------------------------------------------------- 31 | -------------------------------------------------------------------------------- /tests/test_basic_support/test_coo_sparsity_pattern.pf: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | 14 | @test 15 | subroutine test_coo_sparsity_pattern 16 | use pfunit 17 | use coo_sparsity_pattern_class 18 | use data_kinds ,only: ik, rk 19 | implicit none 20 | 21 | type(cooSparsityPattern) :: testSP ,testSP2 22 | 23 | call testSP%init(15,15) 24 | 25 | @assertTrue(testSP%isDefined()) 26 | 27 | @assertFalse(testSP%hasIndices([1],[1])) 28 | 29 | call testSP%addEntry(2,1) 30 | call testSP%addEntry(4,2) 31 | call testSP%addEntry(5,11) 32 | 33 | @assertEqual(testSP%numNonZeros,3) 34 | @assertTrue(testSP%hasIndices([2,4,5],[1,2,11])) 35 | 36 | @assertEqual(testSP%findLocationOfIndices([4,5],[2,11]),[2,3]) 37 | 38 | call testSP2%init(15,15) 39 | call testSP2%addEntry(2,1) 40 | call testSP2%addEntry(4,3) 41 | call testSP2%addEntry(5,1) 42 | 43 | call testSP%addPattern(testSP2,[0,1,1],[0,0,0]) 44 | @assertEqual(testSP%numNonZeros,5) 45 | @assertEqual(testSP%rowIndex(1:5),[2,4,5,5,6]) 46 | @assertEqual(testSP%colIndex(1:5),[1,2,11,3,1]) 47 | 48 | end subroutine test_coo_sparsity_pattern -------------------------------------------------------------------------------- /src/modules/parameters/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(parameters Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE -cpp) 24 | 25 | IF(${CMAKE_BUILD_TYPE} MATCHES "DEBUG") 26 | TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PUBLIC DEBUG) 27 | ENDIF(${CMAKE_BUILD_TYPE} MATCHES "DEBUG") 28 | 29 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 30 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 31 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 32 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 33 | PUBLIC 34 | "$" 35 | "$") 36 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 37 | 38 | INSTALL(TARGETS ${PROJECT_NAME} 39 | EXPORT ${PROJECT_NAME}_installation 40 | ARCHIVE DESTINATION ${LIBDIR} 41 | LIBRARY DESTINATION ${LIBDIR} 42 | PUBLIC_HEADER DESTINATION ${INCDIR} 43 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 44 | ) 45 | INSTALL(DIRECTORY ${MODDIR}/ 46 | DESTINATION ${INCDIR}) -------------------------------------------------------------------------------- /src/modules/basic_support/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(basic_support Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 26 | PUBLIC 27 | parameters 28 | PRIVATE 29 | ${BUILD_TYPE_Fortran_FLAGS} 30 | ) 31 | 32 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 33 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 34 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 35 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 36 | PUBLIC 37 | "$" 38 | "$") 39 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 40 | 41 | INSTALL(TARGETS ${PROJECT_NAME} 42 | EXPORT ${PROJECT_NAME}_installation 43 | ARCHIVE DESTINATION ${LIBDIR} 44 | LIBRARY DESTINATION ${LIBDIR} 45 | PUBLIC_HEADER DESTINATION ${INCDIR} 46 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 47 | ) 48 | INSTALL(DIRECTORY ${MODDIR}/ 49 | DESTINATION ${INCDIR}) -------------------------------------------------------------------------------- /src/modules/testing_support/test_operator_procedures.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | submodule (test_operator_class) test_operator_procedures 15 | 16 | implicit none 17 | 18 | !----------------------------------------------------------------------------------------------------------------------------------- 19 | contains 20 | !----------------------------------------------------------------------------------------------------------------------------------- 21 | !----------------------------------------------------------------------------------------------------------------------------------- 22 | pure module function simpleActOn(input) result(output) 23 | 24 | real(rk) ,dimension(:) ,intent(in) :: input 25 | real(rk) ,allocatable ,dimension(:) :: output 26 | 27 | output = 2*input 28 | 29 | end function simpleActOn 30 | !----------------------------------------------------------------------------------------------------------------------------------- 31 | end submodule test_operator_procedures 32 | !----------------------------------------------------------------------------------------------------------------------------------- 33 | -------------------------------------------------------------------------------- /src/modules/mpi_support/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(mpi_support Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 24 | PUBLIC 25 | MPI::MPI_Fortran 26 | parameters 27 | basic_support 28 | grid 29 | variables 30 | PRIVATE 31 | ${BUILD_TYPE_Fortran_FLAGS} 32 | ) 33 | 34 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 35 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 36 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 37 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 38 | PUBLIC 39 | "$" 40 | "$") 41 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 42 | 43 | INSTALL(TARGETS ${PROJECT_NAME} 44 | EXPORT ${PROJECT_NAME}_installation 45 | ARCHIVE DESTINATION ${LIBDIR} 46 | LIBRARY DESTINATION ${LIBDIR} 47 | PUBLIC_HEADER DESTINATION ${INCDIR} 48 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 49 | ) 50 | INSTALL(DIRECTORY ${MODDIR}/ 51 | DESTINATION ${INCDIR}) 52 | -------------------------------------------------------------------------------- /src/modules/normalization/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(normalization Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | target_link_libraries(${PROJECT_NAME} 26 | PUBLIC 27 | parameters 28 | basic_support 29 | PRIVATE 30 | ${BUILD_TYPE_Fortran_FLAGS} 31 | ) 32 | 33 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 34 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 35 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 36 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 37 | PUBLIC 38 | "$" 39 | "$") 40 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 41 | 42 | INSTALL(TARGETS ${PROJECT_NAME} 43 | EXPORT ${PROJECT_NAME}_installation 44 | ARCHIVE DESTINATION ${LIBDIR} 45 | LIBRARY DESTINATION ${LIBDIR} 46 | PUBLIC_HEADER DESTINATION ${INCDIR} 47 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 48 | ) 49 | INSTALL(DIRECTORY ${MODDIR}/ 50 | DESTINATION ${INCDIR}) 51 | -------------------------------------------------------------------------------- /src/modules/grid/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(grid Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | PRIVATE 31 | ${BUILD_TYPE_Fortran_FLAGS} 32 | ) 33 | 34 | 35 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 36 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 37 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 38 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 39 | PUBLIC 40 | "$" 41 | "$") 42 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 43 | 44 | INSTALL(TARGETS ${PROJECT_NAME} 45 | EXPORT ${PROJECT_NAME}_installation 46 | ARCHIVE DESTINATION ${LIBDIR} 47 | LIBRARY DESTINATION ${LIBDIR} 48 | PUBLIC_HEADER DESTINATION ${INCDIR} 49 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 50 | ) 51 | INSTALL(DIRECTORY ${MODDIR}/ 52 | DESTINATION ${INCDIR}) 53 | -------------------------------------------------------------------------------- /src/modules/signals/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(signals Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | PRIVATE 31 | ${BUILD_TYPE_Fortran_FLAGS} 32 | ) 33 | 34 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 35 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 36 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 37 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 38 | PUBLIC 39 | "$" 40 | "$") 41 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 42 | 43 | INSTALL(TARGETS ${PROJECT_NAME} 44 | EXPORT ${PROJECT_NAME}_installation 45 | ARCHIVE DESTINATION ${LIBDIR} 46 | LIBRARY DESTINATION ${LIBDIR} 47 | PUBLIC_HEADER DESTINATION ${INCDIR} 48 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 49 | ) 50 | INSTALL(DIRECTORY ${MODDIR}/ 51 | DESTINATION ${INCDIR}) 52 | -------------------------------------------------------------------------------- /src/modules/parameters/physical_constants.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | module physical_constants 15 | !! Houses some useful physical/mathematical constants 16 | 17 | use data_kinds ,only: rk, ik 18 | 19 | real(rk), parameter :: pi = 4.d0 * atan(1.d0) 20 | real(rk), parameter :: epsilon0 = 8.854188d-12 !! Vacuum permittivity 21 | real(rk), parameter :: elMass = 9.10938d-31 !! Electron mass 22 | real(rk), parameter :: elCharge = 1.60218d-19 !! Electron charge 23 | real(rk), parameter :: bohrRadius = 5.291772d-11 24 | real(rk), parameter :: hPlanck = 6.62607004d-34 25 | real(rk), parameter :: mu0 = 4.00D00 * pi * 1d-17 !! Vacuum permeability 26 | real(rk), parameter :: protonMass = 1.67262d-27 27 | real(rk), parameter :: amu = 1.6605390666d-27 !! Atomic mass unit 28 | 29 | !---------------------------------------------------------------------------------------------------------------------------------- 30 | end module physical_constants 31 | !---------------------------------------------------------------------------------------------------------------------------------- 32 | -------------------------------------------------------------------------------- /src/modules/variables/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(variables Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | grid 31 | PRIVATE 32 | ${BUILD_TYPE_Fortran_FLAGS} 33 | ) 34 | 35 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 36 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 37 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 38 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 39 | PUBLIC 40 | "$" 41 | "$") 42 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 43 | 44 | INSTALL(TARGETS ${PROJECT_NAME} 45 | EXPORT ${PROJECT_NAME}_installation 46 | ARCHIVE DESTINATION ${LIBDIR} 47 | LIBRARY DESTINATION ${LIBDIR} 48 | PUBLIC_HEADER DESTINATION ${INCDIR} 49 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 50 | ) 51 | INSTALL(DIRECTORY ${MODDIR}/ 52 | DESTINATION ${INCDIR}) 53 | -------------------------------------------------------------------------------- /src/modules/modelbound_data/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(modelbound_data Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | variables 31 | PRIVATE 32 | ${BUILD_TYPE_Fortran_FLAGS} 33 | ) 34 | 35 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 36 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 37 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 38 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 39 | PUBLIC 40 | "$" 41 | "$") 42 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 43 | 44 | INSTALL(TARGETS ${PROJECT_NAME} 45 | EXPORT ${PROJECT_NAME}_installation 46 | ARCHIVE DESTINATION ${LIBDIR} 47 | LIBRARY DESTINATION ${LIBDIR} 48 | PUBLIC_HEADER DESTINATION ${INCDIR} 49 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 50 | ) 51 | INSTALL(DIRECTORY ${MODDIR}/ 52 | DESTINATION ${INCDIR}) 53 | -------------------------------------------------------------------------------- /src/modules/extrapolation_support/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(extrapolation_support Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | grid 31 | PRIVATE 32 | ${BUILD_TYPE_Fortran_FLAGS} 33 | ) 34 | 35 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 36 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 37 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 38 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 39 | PUBLIC 40 | "$" 41 | "$") 42 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 43 | 44 | INSTALL(TARGETS ${PROJECT_NAME} 45 | EXPORT ${PROJECT_NAME}_installation 46 | ARCHIVE DESTINATION ${LIBDIR} 47 | LIBRARY DESTINATION ${LIBDIR} 48 | PUBLIC_HEADER DESTINATION ${INCDIR} 49 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 50 | ) 51 | INSTALL(DIRECTORY ${MODDIR}/ 52 | DESTINATION ${INCDIR}) 53 | -------------------------------------------------------------------------------- /src/modules/abstract_manipulators/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | 16 | PROJECT(abstract_manipulators Fortran) 17 | 18 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 19 | 20 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 21 | 22 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 23 | 24 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | variables 31 | PRIVATE 32 | ${BUILD_TYPE_Fortran_FLAGS} 33 | ) 34 | 35 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 36 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 37 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 38 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 39 | PUBLIC 40 | "$" 41 | "$") 42 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 43 | 44 | INSTALL(TARGETS ${PROJECT_NAME} 45 | EXPORT ${PROJECT_NAME}_installation 46 | ARCHIVE DESTINATION ${LIBDIR} 47 | LIBRARY DESTINATION ${LIBDIR} 48 | PUBLIC_HEADER DESTINATION ${INCDIR} 49 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 50 | ) 51 | INSTALL(DIRECTORY ${MODDIR}/ 52 | DESTINATION ${INCDIR}) 53 | -------------------------------------------------------------------------------- /src/modules/solver_support/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(solver_support Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE -cpp) 24 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 25 | PUBLIC 26 | ${PETSC_LINK_LIBRARIES} 27 | parameters 28 | basic_support 29 | grid 30 | variables 31 | mpi_support 32 | PRIVATE 33 | ${BUILD_TYPE_Fortran_FLAGS} 34 | ) 35 | 36 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 37 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 38 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 39 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 40 | PUBLIC 41 | "$" 42 | "$") 43 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 44 | 45 | INSTALL(TARGETS ${PROJECT_NAME} 46 | EXPORT ${PROJECT_NAME}_installation 47 | ARCHIVE DESTINATION ${LIBDIR} 48 | LIBRARY DESTINATION ${LIBDIR} 49 | PUBLIC_HEADER DESTINATION ${INCDIR} 50 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 51 | ) 52 | INSTALL(DIRECTORY ${MODDIR}/ 53 | DESTINATION ${INCDIR}) 54 | -------------------------------------------------------------------------------- /src/modules/terms/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(terms Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 26 | PUBLIC 27 | parameters 28 | basic_support 29 | grid 30 | variables 31 | solver_support 32 | modelbound_data 33 | PRIVATE 34 | ${BUILD_TYPE_Fortran_FLAGS} 35 | ) 36 | 37 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 38 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 39 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 40 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 41 | PUBLIC 42 | "$" 43 | "$") 44 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 45 | 46 | INSTALL(TARGETS ${PROJECT_NAME} 47 | EXPORT ${PROJECT_NAME}_installation 48 | ARCHIVE DESTINATION ${LIBDIR} 49 | LIBRARY DESTINATION ${LIBDIR} 50 | PUBLIC_HEADER DESTINATION ${INCDIR} 51 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 52 | ) 53 | INSTALL(DIRECTORY ${MODDIR}/ 54 | DESTINATION ${INCDIR}) 55 | -------------------------------------------------------------------------------- /src/modules/common_derivations/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(common_derivations Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 26 | PUBLIC 27 | parameters 28 | basic_support 29 | grid 30 | variables 31 | extrapolation_support 32 | PRIVATE 33 | ${BUILD_TYPE_Fortran_FLAGS} 34 | ) 35 | 36 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 37 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 38 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 39 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 40 | PUBLIC 41 | "$" 42 | "$") 43 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 44 | 45 | INSTALL(TARGETS ${PROJECT_NAME} 46 | EXPORT ${PROJECT_NAME}_installation 47 | ARCHIVE DESTINATION ${LIBDIR} 48 | LIBRARY DESTINATION ${LIBDIR} 49 | PUBLIC_HEADER DESTINATION ${INCDIR} 50 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 51 | ) 52 | INSTALL(DIRECTORY ${MODDIR}/ 53 | DESTINATION ${INCDIR}) 54 | -------------------------------------------------------------------------------- /src/modules/common_manipulators/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(common_manipulators Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | variables 31 | abstract_manipulators 32 | modeller 33 | PRIVATE 34 | ${BUILD_TYPE_Fortran_FLAGS} 35 | ) 36 | 37 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 38 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 39 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 40 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 41 | PUBLIC 42 | "$" 43 | "$") 44 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 45 | 46 | INSTALL(TARGETS ${PROJECT_NAME} 47 | EXPORT ${PROJECT_NAME}_installation 48 | ARCHIVE DESTINATION ${LIBDIR} 49 | LIBRARY DESTINATION ${LIBDIR} 50 | PUBLIC_HEADER DESTINATION ${INCDIR} 51 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 52 | ) 53 | INSTALL(DIRECTORY ${MODDIR}/ 54 | DESTINATION ${INCDIR}) -------------------------------------------------------------------------------- /src/modules/testing_support/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(testing_support Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | grid 31 | variables 32 | solver_support 33 | terms 34 | PRIVATE 35 | ${BUILD_TYPE_Fortran_FLAGS} 36 | ) 37 | 38 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 39 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 40 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 41 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 42 | PUBLIC 43 | "$" 44 | "$") 45 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 46 | 47 | INSTALL(TARGETS ${PROJECT_NAME} 48 | EXPORT ${PROJECT_NAME}_installation 49 | ARCHIVE DESTINATION ${LIBDIR} 50 | LIBRARY DESTINATION ${LIBDIR} 51 | PUBLIC_HEADER DESTINATION ${INCDIR} 52 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 53 | ) 54 | INSTALL(DIRECTORY ${MODDIR}/ 55 | DESTINATION ${INCDIR}) -------------------------------------------------------------------------------- /src/modules/model/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(model Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | grid 31 | variables 32 | solver_support 33 | terms 34 | modelbound_data 35 | PRIVATE 36 | ${BUILD_TYPE_Fortran_FLAGS} 37 | ) 38 | 39 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 40 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 41 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 42 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 43 | PUBLIC 44 | "$" 45 | "$") 46 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 47 | 48 | INSTALL(TARGETS ${PROJECT_NAME} 49 | EXPORT ${PROJECT_NAME}_installation 50 | ARCHIVE DESTINATION ${LIBDIR} 51 | LIBRARY DESTINATION ${LIBDIR} 52 | PUBLIC_HEADER DESTINATION ${INCDIR} 53 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 54 | ) 55 | INSTALL(DIRECTORY ${MODDIR}/ 56 | DESTINATION ${INCDIR}) -------------------------------------------------------------------------------- /src/modules/integrator_abstractions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(integrator_abstractions Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | variables 31 | abstract_manipulators 32 | mpi_support 33 | PRIVATE 34 | ${BUILD_TYPE_Fortran_FLAGS} 35 | ) 36 | 37 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 38 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 39 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 40 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 41 | PUBLIC 42 | "$" 43 | "$") 44 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 45 | 46 | INSTALL(TARGETS ${PROJECT_NAME} 47 | EXPORT ${PROJECT_NAME}_installation 48 | ARCHIVE DESTINATION ${LIBDIR} 49 | LIBRARY DESTINATION ${LIBDIR} 50 | PUBLIC_HEADER DESTINATION ${INCDIR} 51 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 52 | ) 53 | INSTALL(DIRECTORY ${MODDIR}/ 54 | DESTINATION ${INCDIR}) 55 | -------------------------------------------------------------------------------- /src/modules/IO_support/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(IO_support Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | jsonfortran-static 29 | parameters 30 | basic_support 31 | variables 32 | mpi_support 33 | ${HDF5_Fortran_LIBRARIES} 34 | PRIVATE 35 | ${BUILD_TYPE_Fortran_FLAGS} 36 | ) 37 | 38 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 39 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 40 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 41 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 42 | PUBLIC 43 | "$" 44 | "$") 45 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 46 | 47 | INSTALL(TARGETS ${PROJECT_NAME} 48 | EXPORT ${PROJECT_NAME}_installation 49 | ARCHIVE DESTINATION ${LIBDIR} 50 | LIBRARY DESTINATION ${LIBDIR} 51 | PUBLIC_HEADER DESTINATION ${INCDIR} 52 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 53 | ) 54 | INSTALL(DIRECTORY ${MODDIR}/ 55 | DESTINATION ${INCDIR}) 56 | -------------------------------------------------------------------------------- /src/modules/timeloop/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(timeloop Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | grid 31 | variables 32 | mpi_support 33 | modeller 34 | IO_support 35 | extended_support 36 | PRIVATE 37 | ${BUILD_TYPE_Fortran_FLAGS} 38 | ) 39 | 40 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 41 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 42 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 43 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 44 | PUBLIC 45 | "$" 46 | "$") 47 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 48 | 49 | INSTALL(TARGETS ${PROJECT_NAME} 50 | EXPORT ${PROJECT_NAME}_installation 51 | ARCHIVE DESTINATION ${LIBDIR} 52 | LIBRARY DESTINATION ${LIBDIR} 53 | PUBLIC_HEADER DESTINATION ${INCDIR} 54 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 55 | ) 56 | INSTALL(DIRECTORY ${MODDIR}/ 57 | DESTINATION ${INCDIR}) 58 | -------------------------------------------------------------------------------- /src/modules/collisional_radiative_modelling/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(collisional_radiative_modelling Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 26 | PUBLIC 27 | parameters 28 | basic_support 29 | grid 30 | variables 31 | terms 32 | modelbound_data 33 | common_derivations 34 | PRIVATE 35 | ${BUILD_TYPE_Fortran_FLAGS} 36 | ) 37 | 38 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 39 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 40 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 41 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 42 | PUBLIC 43 | "$" 44 | "$") 45 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 46 | 47 | INSTALL(TARGETS ${PROJECT_NAME} 48 | EXPORT ${PROJECT_NAME}_installation 49 | ARCHIVE DESTINATION ${LIBDIR} 50 | LIBRARY DESTINATION ${LIBDIR} 51 | PUBLIC_HEADER DESTINATION ${INCDIR} 52 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 53 | ) 54 | INSTALL(DIRECTORY ${MODDIR}/ 55 | DESTINATION ${INCDIR}) 56 | -------------------------------------------------------------------------------- /src/modules/general_terms/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(general_terms Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | grid 31 | variables 32 | solver_support 33 | terms 34 | modelbound_data 35 | signals 36 | model 37 | PRIVATE 38 | ${BUILD_TYPE_Fortran_FLAGS} 39 | ) 40 | 41 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 42 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 43 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 44 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 45 | PUBLIC 46 | "$" 47 | "$") 48 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 49 | 50 | INSTALL(TARGETS ${PROJECT_NAME} 51 | EXPORT ${PROJECT_NAME}_installation 52 | ARCHIVE DESTINATION ${LIBDIR} 53 | LIBRARY DESTINATION ${LIBDIR} 54 | PUBLIC_HEADER DESTINATION ${INCDIR} 55 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 56 | ) 57 | INSTALL(DIRECTORY ${MODDIR}/ 58 | DESTINATION ${INCDIR}) 59 | -------------------------------------------------------------------------------- /src/modules/fluid_terms/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(fluid_terms Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | grid 31 | variables 32 | solver_support 33 | terms 34 | modelbound_data 35 | signals 36 | general_terms 37 | PRIVATE 38 | ${BUILD_TYPE_Fortran_FLAGS} 39 | ) 40 | 41 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 42 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 43 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 44 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 45 | PUBLIC 46 | "$" 47 | "$") 48 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 49 | 50 | INSTALL(TARGETS ${PROJECT_NAME} 51 | EXPORT ${PROJECT_NAME}_installation 52 | ARCHIVE DESTINATION ${LIBDIR} 53 | LIBRARY DESTINATION ${LIBDIR} 54 | PUBLIC_HEADER DESTINATION ${INCDIR} 55 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 56 | ) 57 | INSTALL(DIRECTORY ${MODDIR}/ 58 | DESTINATION ${INCDIR}) 59 | -------------------------------------------------------------------------------- /src/modules/signals/constant_signal_procedures.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | submodule (constant_signal_class) constant_signal_procedures 15 | !! author: Stefan Mijin 16 | !! 17 | !! Contains module procedures associated with the constant signal class 18 | 19 | implicit none 20 | 21 | !----------------------------------------------------------------------------------------------------------------------------------- 22 | contains 23 | !----------------------------------------------------------------------------------------------------------------------------------- 24 | module function calculateConst(this,time,period,params) result(res) 25 | 26 | class(ConstSignal) ,intent(inout) :: this 27 | real(rk) ,intent(in) :: time 28 | real(rk) ,intent(in) :: period 29 | real(rk) ,optional ,dimension(:) ,intent(in) :: params 30 | real(rk) :: res 31 | 32 | res = real(1,kind=rk) 33 | 34 | end function calculateConst 35 | !----------------------------------------------------------------------------------------------------------------------------------- 36 | end submodule constant_signal_procedures 37 | !----------------------------------------------------------------------------------------------------------------------------------- 38 | -------------------------------------------------------------------------------- /src/modules/kinetic_terms/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(kinetic_terms Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | grid 31 | variables 32 | solver_support 33 | terms 34 | modelbound_data 35 | collisional_radiative_modelling 36 | model 37 | PRIVATE 38 | ${BUILD_TYPE_Fortran_FLAGS} 39 | ) 40 | 41 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 42 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 43 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 44 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 45 | PUBLIC 46 | "$" 47 | "$") 48 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 49 | 50 | INSTALL(TARGETS ${PROJECT_NAME} 51 | EXPORT ${PROJECT_NAME}_installation 52 | ARCHIVE DESTINATION ${LIBDIR} 53 | LIBRARY DESTINATION ${LIBDIR} 54 | PUBLIC_HEADER DESTINATION ${INCDIR} 55 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 56 | ) 57 | INSTALL(DIRECTORY ${MODDIR}/ 58 | DESTINATION ${INCDIR}) -------------------------------------------------------------------------------- /src/modules/abstract_model_builder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(abstract_model_builder Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 26 | PUBLIC 27 | parameters 28 | basic_support 29 | variables 30 | terms 31 | model 32 | mpi_support 33 | model 34 | modeller 35 | IO_support 36 | modelbound_data 37 | PRIVATE 38 | ${BUILD_TYPE_Fortran_FLAGS} 39 | ) 40 | 41 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 42 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 43 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 44 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 45 | PUBLIC 46 | "$" 47 | "$") 48 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 49 | 50 | INSTALL(TARGETS ${PROJECT_NAME} 51 | EXPORT ${PROJECT_NAME}_installation 52 | ARCHIVE DESTINATION ${LIBDIR} 53 | LIBRARY DESTINATION ${LIBDIR} 54 | PUBLIC_HEADER DESTINATION ${INCDIR} 55 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 56 | ) 57 | INSTALL(DIRECTORY ${MODDIR}/ 58 | DESTINATION ${INCDIR}) -------------------------------------------------------------------------------- /src/modules/modeller/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(modeller Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | variables 31 | abstract_manipulators 32 | model 33 | solver_support 34 | mpi_support 35 | model 36 | integrator_abstractions 37 | IO_support 38 | PRIVATE 39 | ${BUILD_TYPE_Fortran_FLAGS} 40 | ) 41 | 42 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 43 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 44 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 45 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 46 | PUBLIC 47 | "$" 48 | "$") 49 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 50 | 51 | INSTALL(TARGETS ${PROJECT_NAME} 52 | EXPORT ${PROJECT_NAME}_installation 53 | ARCHIVE DESTINATION ${LIBDIR} 54 | LIBRARY DESTINATION ${LIBDIR} 55 | PUBLIC_HEADER DESTINATION ${INCDIR} 56 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 57 | ) 58 | INSTALL(DIRECTORY ${MODDIR}/ 59 | DESTINATION ${INCDIR}) 60 | -------------------------------------------------------------------------------- /tests/test_grid/test_v_space.pf: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | @test 14 | subroutine test_v_space 15 | use pfunit 16 | use god_objects ,only: object 17 | use data_kinds ,only: ik, rk 18 | use grid_class 19 | use v_space_class 20 | use physical_constants 21 | 22 | implicit none 23 | 24 | type(Grid) :: testGrid 25 | type(VSpace) :: testVSpace 26 | 27 | real(rk) ,allocatable ,dimension(:) :: testDist ,testMoment ,checkMoment ,testLinInterp 28 | 29 | integer(ik) :: i 30 | 31 | call testGrid%init(real([0.0,0.1,0.2,0.3],kind=rk),real([(0.1d0*i - 0.05d0, i=1,12)],kind=rk),2,0) 32 | 33 | call testVSpace%init(testGrid) 34 | 35 | @assertEqual(testVSpace%getVGrid(),testGrid%getVGrid()) 36 | @assertEqual(testVSpace%getVCellWidths(),[(0.1d0,i=1,12)],tolerance=1.0d-14) 37 | testLinInterp = [(0.5d0,i=1,12)] 38 | testLinInterp(12) = real(1,kind=rk) 39 | @assertEqual(testVSpace%getVLinInterp(),testLinInterp,tolerance=1.0d-14) 40 | 41 | allocate(testDist(4*12*3)) 42 | testDist = 0 43 | do i = 1,4 44 | testDist((i-1)*36+1:i*36) = real(0.1d0*i,kind=rk) 45 | end do 46 | 47 | testMoment = testVSpace%calculateMoment(testDist,1,1) 48 | allocate(checkMoment(4)) 49 | do i = 1,4 50 | checkMoment(i) = 4*pi*sum(real([(0.1d0*i - 0.05d0, i=1,12)],kind=rk) ** 3 * 0.1d0 * real(0.1d0*i,kind=rk)) 51 | end do 52 | 53 | @assertEqual(testMoment,checkMoment,tolerance=1.0d-14) 54 | @assertEqual(testVSpace%getNearestPoints(0.81d0),[8,9]) 55 | @assertEqual(testVSpace%getContainingVCell(0.81d0),9) 56 | end subroutine test_v_space 57 | 58 | -------------------------------------------------------------------------------- /tests/test_grid/test_variable_list.pf: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | @test 14 | subroutine test_variable_list 15 | use pfunit 16 | use god_objects ,only: object 17 | use data_kinds ,only: ik, rk 18 | use variable_list_class 19 | use support_types 20 | implicit none 21 | 22 | type(variableList) :: testList ,testList2, testList3 23 | type(stringArray) ,dimension(:) ,allocatable :: testNames 24 | 25 | call testList%init() 26 | 27 | @assertEqual(testList%getNumVars(),0) 28 | 29 | call testList%addVar("n") 30 | call testList%addVar("u") 31 | call testList%addVar("f",.true.) 32 | 33 | call testList2%init() 34 | 35 | call testList2%addVar("E") 36 | 37 | testList3 = testList%combineWith(testList2) 38 | @assertEqual(testList3%getNumVars(),4) 39 | 40 | testNames = testList3%getVarNames() 41 | 42 | @assertEqual(testNames(1)%string,"n") 43 | @assertEqual(testNames(2)%string,"u") 44 | @assertEqual(testNames(3)%string,"f") 45 | @assertEqual(testNames(4)%string,"E") 46 | 47 | @assertEqual(testList3%getVarName(1),testNames(1)%string) 48 | 49 | @assertFalse(testList3%isVarDist(1)) 50 | @assertFalse(testList3%isVarDist(2)) 51 | @assertTrue(testList3%isVarDist(3)) 52 | @assertFalse(testList3%isVarDist(4)) 53 | 54 | @assertEqual(testList3%getVarIndex("n"),1) 55 | @assertEqual(testList3%getVarIndex("u"),2) 56 | @assertEqual(testList3%getVarIndex("f"),3) 57 | @assertEqual(testList3%getVarIndex("E"),4) 58 | 59 | @assertFalse(testList3%isVarNameRegistered("b")) 60 | @assertTrue(testList3%isVarNameRegistered("n")) 61 | 62 | end subroutine test_variable_list -------------------------------------------------------------------------------- /src/modules/terms/operator_abstract_procedures.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | submodule (operator_abstract_class) operator_abstract_procedures 15 | !! author: Stefan Mijin 16 | !! 17 | !! Contains module procedures associated with the abstract operator class 18 | 19 | implicit none 20 | 21 | !----------------------------------------------------------------------------------------------------------------------------------- 22 | contains 23 | !----------------------------------------------------------------------------------------------------------------------------------- 24 | module subroutine noUpdate(this,varCont) 25 | !! Default operator update function - does nothing 26 | 27 | class(Operator) ,intent(inout) :: this 28 | type(VariableContainer) ,intent(in) :: varCont 29 | 30 | if (assertions) then 31 | call assert(this%isDefined(),"Attempted to update undefined operator bject") 32 | call assert(varCont%isDefined(),"Attempted to update operator object by passing undefined variable container") 33 | end if 34 | 35 | end subroutine noUpdate 36 | !----------------------------------------------------------------------------------------------------------------------------------- 37 | !----------------------------------------------------------------------------------------------------------------------------------- 38 | end submodule operator_abstract_procedures 39 | !----------------------------------------------------------------------------------------------------------------------------------- 40 | -------------------------------------------------------------------------------- /src/modules/modeller_assembly/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(modeller_assembly Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | grid 31 | variables 32 | solver_support 33 | terms 34 | fluid_terms 35 | modelbound_data 36 | abstract_model_builder 37 | model 38 | modeller 39 | mpi_support 40 | IO_support 41 | extended_support 42 | general_models 43 | integrator_abstractions 44 | PRIVATE 45 | ${BUILD_TYPE_Fortran_FLAGS} 46 | ) 47 | 48 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 49 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 50 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 51 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 52 | PUBLIC 53 | "$" 54 | "$") 55 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 56 | 57 | INSTALL(TARGETS ${PROJECT_NAME} 58 | EXPORT ${PROJECT_NAME}_installation 59 | ARCHIVE DESTINATION ${LIBDIR} 60 | LIBRARY DESTINATION ${LIBDIR} 61 | PUBLIC_HEADER DESTINATION ${INCDIR} 62 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 63 | ) 64 | INSTALL(DIRECTORY ${MODDIR}/ 65 | DESTINATION ${INCDIR}) 66 | -------------------------------------------------------------------------------- /src/modules/fluid_models/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(fluid_models Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | grid 31 | variables 32 | solver_support 33 | terms 34 | fluid_terms 35 | modelbound_data 36 | abstract_model_builder 37 | model 38 | modeller 39 | IO_support 40 | extended_support 41 | common_derivations 42 | signals 43 | collisional_radiative_modelling 44 | general_terms 45 | kinetic_models 46 | PRIVATE 47 | ${BUILD_TYPE_Fortran_FLAGS} 48 | ) 49 | 50 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 51 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 52 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 53 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 54 | PUBLIC 55 | "$" 56 | "$") 57 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 58 | 59 | INSTALL(TARGETS ${PROJECT_NAME} 60 | EXPORT ${PROJECT_NAME}_installation 61 | ARCHIVE DESTINATION ${LIBDIR} 62 | LIBRARY DESTINATION ${LIBDIR} 63 | PUBLIC_HEADER DESTINATION ${INCDIR} 64 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 65 | ) 66 | INSTALL(DIRECTORY ${MODDIR}/ 67 | DESTINATION ${INCDIR}) 68 | -------------------------------------------------------------------------------- /src/modules/basic_integrators/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(basic_integrators Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 24 | PUBLIC 25 | parameters 26 | basic_support 27 | variables 28 | abstract_manipulators 29 | integrator_abstractions 30 | modeller 31 | mpi_support 32 | IO_support 33 | MPI::MPI_Fortran 34 | SUNDIALS::cvode 35 | SUNDIALS::fcvode_mod 36 | SUNDIALS::core 37 | SUNDIALS::fcore_mod 38 | SUNDIALS::fnvecparallel_mod 39 | SUNDIALS::nvecparallel 40 | SUNDIALS::nvecserial 41 | SUNDIALS::fnvecserial_mod 42 | SUNDIALS::fsunlinsolspgmr_mod 43 | PRIVATE 44 | ${BUILD_TYPE_Fortran_FLAGS} 45 | ) 46 | 47 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 48 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 49 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 50 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 51 | PUBLIC 52 | "$" 53 | "$") 54 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 55 | 56 | INSTALL(TARGETS ${PROJECT_NAME} 57 | EXPORT ${PROJECT_NAME}_installation 58 | ARCHIVE DESTINATION ${LIBDIR} 59 | LIBRARY DESTINATION ${LIBDIR} 60 | PUBLIC_HEADER DESTINATION ${INCDIR} 61 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 62 | ) 63 | INSTALL(DIRECTORY ${MODDIR}/ 64 | DESTINATION ${INCDIR}) 65 | -------------------------------------------------------------------------------- /src/modules/kinetic_models/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(kinetic_models Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | grid 31 | variables 32 | solver_support 33 | terms 34 | kinetic_terms 35 | modelbound_data 36 | abstract_model_builder 37 | model 38 | modeller 39 | IO_support 40 | extended_support 41 | common_derivations 42 | signals 43 | collisional_radiative_modelling 44 | general_terms 45 | normalization 46 | fluid_terms 47 | PRIVATE 48 | ${BUILD_TYPE_Fortran_FLAGS} 49 | ) 50 | 51 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 52 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 53 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 54 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 55 | PUBLIC 56 | "$" 57 | "$") 58 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 59 | 60 | INSTALL(TARGETS ${PROJECT_NAME} 61 | EXPORT ${PROJECT_NAME}_installation 62 | ARCHIVE DESTINATION ${LIBDIR} 63 | LIBRARY DESTINATION ${LIBDIR} 64 | PUBLIC_HEADER DESTINATION ${INCDIR} 65 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 66 | ) 67 | INSTALL(DIRECTORY ${MODDIR}/ 68 | DESTINATION ${INCDIR}) 69 | -------------------------------------------------------------------------------- /src/modules/general_models/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(general_models Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 26 | PUBLIC 27 | parameters 28 | basic_support 29 | grid 30 | variables 31 | solver_support 32 | terms 33 | fluid_terms 34 | modelbound_data 35 | abstract_model_builder 36 | model 37 | modeller 38 | IO_support 39 | extended_support 40 | common_derivations 41 | signals 42 | collisional_radiative_modelling 43 | general_terms 44 | fluid_models 45 | kinetic_terms 46 | kinetic_models 47 | PRIVATE 48 | ${BUILD_TYPE_Fortran_FLAGS} 49 | ) 50 | 51 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 52 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 53 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 54 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 55 | PUBLIC 56 | "$" 57 | "$") 58 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 59 | 60 | INSTALL(TARGETS ${PROJECT_NAME} 61 | EXPORT ${PROJECT_NAME}_installation 62 | ARCHIVE DESTINATION ${LIBDIR} 63 | LIBRARY DESTINATION ${LIBDIR} 64 | PUBLIC_HEADER DESTINATION ${INCDIR} 65 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 66 | ) 67 | INSTALL(DIRECTORY ${MODDIR}/ 68 | DESTINATION ${INCDIR}) 69 | -------------------------------------------------------------------------------- /src/modules/extended_support/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of ReMKiT1D. 2 | # 3 | # ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 4 | # 5 | # ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | # 7 | # You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 8 | # 9 | # Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 10 | # 11 | # This file is adapted from cmake_fortran_template 12 | # 13 | # Copyright (c) 2018 Seth M. Morton 14 | # 15 | PROJECT(extended_support Fortran) 16 | 17 | FILE(GLOB_RECURSE ${PROJECT_NAME}_sources *.f90 *.F90) 18 | 19 | MESSAGE(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") 20 | 21 | ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) 22 | 23 | TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE ${DEFAULT_Fortran_FLAGS}) 24 | 25 | 26 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} 27 | PUBLIC 28 | parameters 29 | basic_support 30 | grid 31 | variables 32 | IO_support 33 | mpi_support 34 | solver_support 35 | normalization 36 | common_derivations 37 | basic_integrators 38 | integrator_abstractions 39 | signals 40 | modelbound_data 41 | collisional_radiative_modelling 42 | model 43 | common_manipulators 44 | abstract_manipulators 45 | extrapolation_support 46 | kinetic_terms 47 | PRIVATE 48 | ${BUILD_TYPE_Fortran_FLAGS} 49 | ) 50 | 51 | SET(MODDIR ${CMAKE_CURRENT_BINARY_DIR}/include) 52 | SET(INCDIR ${INCDIR}/${PROJECT_NAME}) 53 | SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY Fortran_MODULE_DIRECTORY ${MODDIR}) 54 | TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 55 | PUBLIC 56 | "$" 57 | "$") 58 | ADD_LIBRARY(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) 59 | 60 | INSTALL(TARGETS ${PROJECT_NAME} 61 | EXPORT ${PROJECT_NAME}_installation 62 | ARCHIVE DESTINATION ${LIBDIR} 63 | LIBRARY DESTINATION ${LIBDIR} 64 | PUBLIC_HEADER DESTINATION ${INCDIR} 65 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 66 | ) 67 | INSTALL(DIRECTORY ${MODDIR}/ 68 | DESTINATION ${INCDIR}) 69 | -------------------------------------------------------------------------------- /src/modules/terms/term_abstract_procedures.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | submodule (term_abstract_class) term_abstract_procedures 15 | !! author: Stefan Mijin 16 | !! 17 | !! Contains module procedures associated with the abstract term class 18 | 19 | implicit none 20 | 21 | !----------------------------------------------------------------------------------------------------------------------------------- 22 | contains 23 | !----------------------------------------------------------------------------------------------------------------------------------- 24 | module subroutine noUpdate(this,varCont,modelData,hostModel) 25 | !! Default Term update function - does nothing 26 | 27 | class(Term) ,intent(inout) :: this 28 | type(VariableContainer) ,intent(in) :: varCont 29 | class(ModelboundData) ,optional ,intent(in) :: modelData 30 | class(ModelSurrogate) ,optional ,intent(in) :: hostModel 31 | 32 | if (assertions) then 33 | call assert(this%isDefined(),"Attempted to update undefined term object") 34 | call assert(varCont%isDefined(),"Attempted to update term object by passing undefined variable container") 35 | end if 36 | 37 | end subroutine noUpdate 38 | !----------------------------------------------------------------------------------------------------------------------------------- 39 | !----------------------------------------------------------------------------------------------------------------------------------- 40 | end submodule term_abstract_procedures 41 | !----------------------------------------------------------------------------------------------------------------------------------- 42 | -------------------------------------------------------------------------------- /src/modules/testing_support/test_explicit_term_procedures.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | submodule (test_explicit_term_class) test_explicit_term_procedures 15 | 16 | implicit none 17 | 18 | !----------------------------------------------------------------------------------------------------------------------------------- 19 | contains 20 | !----------------------------------------------------------------------------------------------------------------------------------- 21 | pure module subroutine initTestExplicitTerm(this,evolvedVarName,varCont) 22 | 23 | class(TestExplicitTerm) ,intent(inout) :: this 24 | character(*) ,intent(in) :: evolvedVarName 25 | type(VariableContainer) ,intent(in) :: varCont 26 | 27 | real(rk) ,allocatable ,dimension(:) :: multConst 28 | 29 | call this%makeDefined() 30 | 31 | end subroutine initTestExplicitTerm 32 | !----------------------------------------------------------------------------------------------------------------------------------- 33 | module function testFun(this,varCont) result(res) 34 | 35 | class(TestExplicitTerm) ,intent(in) :: this 36 | type(VariableContainer) ,intent(in) :: varCont 37 | 38 | real(rk) ,allocatable ,dimension(:) :: res 39 | 40 | res=varCont%variables(varCont%getVarIndex(this%getVarName()))%entry 41 | 42 | end function testFun 43 | !----------------------------------------------------------------------------------------------------------------------------------- 44 | end submodule test_explicit_term_procedures 45 | !----------------------------------------------------------------------------------------------------------------------------------- 46 | -------------------------------------------------------------------------------- /src/modules/testing_support/test_operator.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | module test_operator_class 15 | 16 | use data_kinds ,only: rk 17 | use god_objects ,only: Object 18 | use variable_container_class ,only: VariableContainer 19 | use runtime_constants ,only: debugging, assertions 20 | use assertion_utility ,only: assert, assertIdentical, assertPure 21 | use operator_abstract_class ,only: Operator 22 | 23 | implicit none 24 | private 25 | 26 | type ,public ,extends(Operator) :: TestOperator 27 | 28 | contains 29 | 30 | procedure ,nopass ,public :: actOn => simpleActOn 31 | 32 | end type TestOperator 33 | !----------------------------------------------------------------------------------------------------------------------------------- 34 | interface 35 | !----------------------------------------------------------------------------------------------------------------------------------- 36 | pure module function simpleActOn(input) result(output) 37 | 38 | real(rk) ,dimension(:) ,intent(in) :: input 39 | real(rk) ,allocatable ,dimension(:) :: output 40 | 41 | end function simpleActOn 42 | !----------------------------------------------------------------------------------------------------------------------------------- 43 | end interface 44 | !----------------------------------------------------------------------------------------------------------------------------------- 45 | end module test_operator_class 46 | !----------------------------------------------------------------------------------------------------------------------------------- 47 | -------------------------------------------------------------------------------- /tests/test_basic_support/test_nd_data.pf: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | 14 | @test 15 | subroutine test_flatNDData 16 | use pfunit 17 | use data_kinds ,only: ik, rk 18 | use flat_nd_data_class,only: FlatNDData 19 | implicit none 20 | 21 | 22 | type(FlatNDData) :: testData1, testData2, testData3 ,testData4 23 | 24 | real(rk) ,allocatable ,dimension(:) :: testInput1 25 | real(rk) ,allocatable ,dimension(:,:) :: testInput2 26 | real(rk) ,allocatable ,dimension(:,:,:) :: testInput3 27 | 28 | integer(ik) :: i,j,k 29 | 30 | testInput1 = [1,2,3] 31 | allocate(testInput2(3,4)) 32 | do i = 1,size(testInput2,1) 33 | do j = 1,size(testInput2,2) 34 | testInput2(i,j) = 10*i + j 35 | end do 36 | end do 37 | 38 | allocate(testInput3(3,4,5)) 39 | 40 | do i = 1,size(testInput3,1) 41 | do j = 1,size(testInput3,2) 42 | do k = 1,size(testInput3,3) 43 | testInput3(i,j,k) = 100*i + 10*j + k 44 | end do 45 | end do 46 | end do 47 | 48 | call testData1%init(testInput1) 49 | call testData2%init(testInput2) 50 | call testData3%init(testInput3) 51 | 52 | @assertEqual(testData1%getValue([2]),real(2,kind=rk)) 53 | @assertEqual(testData2%getValue([2,3]),real(23,kind=rk)) 54 | @assertEqual(testData3%getValue([2,3,4]),real(234,kind=rk)) 55 | 56 | @assertEqual(testData2%get1DSlice([1],1),real([11,21,31],kind=rk)) 57 | @assertEqual(testData2%get1DSlice([1],2),real([11,12,13,14],kind=rk)) 58 | @assertEqual(testData3%get1DSlice([1,3],2),real([113,123,133,143],kind=rk)) 59 | 60 | call testData4%directInit(reshape(testInput3,[size(testInput3)]),shape(testInput3)) 61 | 62 | @assertEqual(testData4%get1DSlice([1,3],2),real([113,123,133,143],kind=rk)) 63 | 64 | @assertEqual(testData3%getDims(),[3,4,5]) 65 | 66 | end subroutine test_flatNDData -------------------------------------------------------------------------------- /src/modules/signals/constant_signal.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | module constant_signal_class 15 | !! author: Stefan Mijin 16 | !! 17 | !! Houses constant signal class - always returns 1 18 | 19 | use data_kinds ,only: rk 20 | use signal_abstract_class ,only: TimeSignal 21 | 22 | 23 | implicit none 24 | private 25 | 26 | type ,public ,extends(TimeSignal) :: ConstSignal 27 | !! Signal wrapper always returning 1 28 | 29 | contains 30 | 31 | procedure ,public :: calculate => calculateConst 32 | 33 | end type ConstSignal 34 | !----------------------------------------------------------------------------------------------------------------------------------- 35 | interface 36 | !----------------------------------------------------------------------------------------------------------------------------------- 37 | module function calculateConst(this,time,period,params) result(res) 38 | 39 | class(ConstSignal) ,intent(inout) :: this 40 | real(rk) ,intent(in) :: time 41 | real(rk) ,intent(in) :: period 42 | real(rk) ,optional ,dimension(:) ,intent(in) :: params 43 | real(rk) :: res 44 | 45 | 46 | end function calculateConst 47 | !----------------------------------------------------------------------------------------------------------------------------------- 48 | end interface 49 | !----------------------------------------------------------------------------------------------------------------------------------- 50 | end module constant_signal_class 51 | !----------------------------------------------------------------------------------------------------------------------------------- 52 | -------------------------------------------------------------------------------- /tests/test_inel_mapping/test_inel_map.pf: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | @test 14 | subroutine test_inel_map 15 | use pfunit 16 | use data_kinds ,only: ik, rk 17 | use inelastic_mapping 18 | use sparse_row_data_class 19 | use v_space_class ,only: VSpace 20 | use grid_class ,only: Grid 21 | 22 | implicit none 23 | 24 | 25 | type(Grid) :: testGrid 26 | type(VSpace) :: testVSpace 27 | type(SparseRowData) :: testW 28 | real(rk) :: E 29 | integer(ik) :: i ,j 30 | 31 | real(rk) ,allocatable ,dimension(:) :: partProduct, eProduct ,partRate ,eRate ,eGrid 32 | 33 | call testGrid%init(real([0.0,0.1,0.2,0.3],kind=rk),real([(i -0.5d0, i=1,10)],kind=rk),2,0) 34 | 35 | call testVSpace%init(testGrid) 36 | E = 3.5d0 37 | testW = inelWeights(testVSpace,E) 38 | eGrid = testVSpace%getVGrid()**2 39 | !Confirm conservation properties 40 | partProduct = eGrid * testVSpace%getVCellWidths() 41 | eProduct = eGrid**2 * testVSpace%getVCellWidths() 42 | allocate(partRate(size(partProduct))) 43 | allocate(eRate(size(partProduct))) 44 | partRate = 0 45 | eRate = 0 46 | do i = 1, size(testW%rowIndex) 47 | do j = 1,size(testW%columnVector(i)%entry) 48 | partRate(testW%columnVector(i)%entry(j)) = partRate(testW%columnVector(i)%entry(j)) + & 49 | testW%values(i)%entry(j) * partProduct(testW%rowIndex(i)) 50 | eRate(testW%columnVector(i)%entry(j)) = eRate(testW%columnVector(i)%entry(j)) + & 51 | testW%values(i)%entry(j) * eProduct(testW%rowIndex(i)) 52 | end do 53 | end do 54 | do i = 1,size(partProduct) 55 | if (partRate(i) > 0) partRate(i) = partRate(i) - partProduct(i) 56 | if (eRate(i) > 0) eRate(i) = eRate(i) - partProduct(i) * (eGrid(i) - E) 57 | end do 58 | 59 | !Normalize to remove floating point errors 60 | @assertTrue(all(partRate/partProduct < 1.0d-14)) 61 | @assertTrue(all(eRate/eProduct < 1.0d-14)) 62 | 63 | end subroutine test_inel_map -------------------------------------------------------------------------------- /src/modules/basic_support/god_objects_procedures.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | submodule (god_objects) god_objects_procedures 15 | !! author: Stefan Mijin 16 | !! 17 | !! Contains basic definition routines for base Object class 18 | 19 | implicit none 20 | 21 | !----------------------------------------------------------------------------------------------------------------------------------- 22 | contains 23 | !----------------------------------------------------------------------------------------------------------------------------------- 24 | pure module function isDefinedObject(this) result(defined) 25 | !! Getter for userDefined 26 | 27 | class(Object) ,intent(in) :: this 28 | logical :: defined 29 | 30 | defined = this%userDefined 31 | 32 | end function isDefinedObject 33 | !----------------------------------------------------------------------------------------------------------------------------------- 34 | pure module subroutine makeDefinedObject(this) 35 | !! Set userDefined to .true. 36 | 37 | class(Object) ,intent(inout) :: this 38 | 39 | this%userDefined = .true. 40 | 41 | end subroutine makeDefinedObject 42 | !----------------------------------------------------------------------------------------------------------------------------------- 43 | pure module subroutine makeUndefinedObject(this) 44 | !! Set userDefined to .false. 45 | 46 | class(Object) ,intent(inout) :: this 47 | 48 | this%userDefined = .false. 49 | 50 | end subroutine makeUndefinedObject 51 | !----------------------------------------------------------------------------------------------------------------------------------- 52 | end submodule god_objects_procedures 53 | !----------------------------------------------------------------------------------------------------------------------------------- 54 | -------------------------------------------------------------------------------- /tests/test_solver_support/test_petsc_prealloc_data.pf: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | @test 14 | subroutine test_petsc_prealloc_data 15 | use pfunit 16 | use god_objects ,only: object 17 | use data_kinds ,only: ik, rk 18 | use partition_class 19 | use grid_class 20 | use variable_list_class 21 | use indexing_class 22 | use petsc_preallocation_data_class 23 | use sparse_row_data_class 24 | use support_types 25 | implicit none 26 | 27 | type(partition) :: testPart 28 | type(grid) :: testGrid 29 | type(variableList) :: testList 30 | type(indexing) :: testIndexing 31 | type(petscPreallocationData) :: testPreallocData 32 | type(sparseRowData) ,dimension(2) :: testRowData 33 | integer(ik) ,dimension(:) ,allocatable :: rows 34 | type(intArray) ,dimension(:) ,allocatable :: colVecs 35 | 36 | integer(ik) :: i 37 | 38 | rows = [6,7,8,9,10] 39 | colVecs = [intArray([5,6]),intArray([6,7]),intArray([7,8]),intArray([8,9]),intArray([9,10])] 40 | 41 | call testRowData(1)%init(rows,colVecs) 42 | 43 | rows = [6,7,8,9,10] 44 | colVecs = [intArray([6,7]),intArray([7,8]),intArray([8,9]),intArray([9,10]),intArray([10,11])] 45 | 46 | call testRowData(2)%init(rows,colVecs) 47 | 48 | call testPart%initSimplePartition(4,1,20,1) 49 | call testGrid%init(real([(i,i=1,20)],kind=rk),real([(i,i=1,10)],kind=rk),0,0) 50 | 51 | call testList%init() 52 | 53 | call testList%addVar("n") 54 | 55 | call testIndexing%init(testPart,testGrid,testList) 56 | 57 | call testPreallocData%init(testIndexing,1) 58 | 59 | @assertFalse(testPreallocData%isAssembled()) 60 | 61 | call testPreallocData%addRowDataToPattern(testRowData(1)) 62 | call testPreallocData%addRowDataToPattern(testRowData(2)) 63 | 64 | call testPreallocData%assembleData() 65 | 66 | @assertTrue(testPreallocData%isAssembled()) 67 | 68 | @assertEqual(testPreallocData%getNumNonzerosDiag(),[2,3,3,3,2]) 69 | @assertEqual(testPreallocData%getNumNonzerosOffDiag(),[1,0,0,0,1]) 70 | 71 | end subroutine test_petsc_prealloc_data -------------------------------------------------------------------------------- /src/modules/signals/hat_signal_procedures.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | submodule (hat_signal_class) hat_signal_procedures 15 | !! author: Stefan Mijin 16 | !! 17 | !! Contains module procedures associated with the hat signal class 18 | 19 | implicit none 20 | 21 | !----------------------------------------------------------------------------------------------------------------------------------- 22 | contains 23 | !----------------------------------------------------------------------------------------------------------------------------------- 24 | module function calculateHat(this,time,period,params) result(res) 25 | 26 | class(HatSignal) ,intent(inout) :: this 27 | real(rk) ,intent(in) :: time 28 | real(rk) ,intent(in) :: period 29 | real(rk) ,optional ,dimension(:) ,intent(in) :: params 30 | real(rk) :: res 31 | 32 | if (assertions) then 33 | call assert(present(params),"calculateHat reguires parameter params to be present") 34 | call assert(size(params)>1,"calculateHat expects at least 2 params") 35 | call assert(params(1)>=0,"params(1) passed to calculateHat must be non-negative") 36 | call assert(params(2)>params(1),"params(2) passed to calculateHat must be greater than params(1)") 37 | call assert(params(2)<=real(1,kind=rk),"params(2) passed to calculateHat must be less than or equal to 1") 38 | call assert(period>0,"period argument passed to calculateHat must be positive") 39 | end if 40 | 41 | res = 0 42 | if (mod(time,period)>=params(1)*period .and. params(2)*period>mod(time,period)) res = real(1,kind=rk) 43 | 44 | end function calculateHat 45 | !----------------------------------------------------------------------------------------------------------------------------------- 46 | end submodule hat_signal_procedures 47 | !----------------------------------------------------------------------------------------------------------------------------------- 48 | -------------------------------------------------------------------------------- /tests/test_grid/test_indexing.pf: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | @test 14 | subroutine test_indexing 15 | use pfunit 16 | use god_objects ,only: object 17 | use data_kinds ,only: ik, rk 18 | use partition_class 19 | use grid_class 20 | use variable_list_class 21 | use indexing_class 22 | use support_types 23 | implicit none 24 | 25 | type(partition) :: testPart 26 | type(grid) :: testGrid 27 | type(variableList) :: testList 28 | type(indexing) :: testIndexing 29 | 30 | integer(ik) :: i 31 | integer(ik) ,dimension(12) :: indices 32 | 33 | call testPart%initSimplePartition(4,3,12,6) 34 | call testGrid%init(real([(i,i=1,12)],kind=rk),real([(i,i=1,10)],kind=rk),5,0) 35 | 36 | call testList%init() 37 | 38 | call testList%addVar("n") 39 | call testList%addVar("u") 40 | call testList%addVar("f",.true.) 41 | 42 | call testIndexing%init(testPart,testGrid,testList,xHaloWidth = 1) 43 | 44 | @assertEqual(testIndexing%getProcDoF(),[66,60,60,66,60,60,66,60,60,66,60,60]) 45 | 46 | @assertEqual(testIndexing%findIndex("u",1),2) 47 | @assertEqual(testIndexing%findIndex("n",6),231) 48 | @assertEqual(testIndexing%findIndex("f",8,3,5),463) 49 | 50 | @assertEqual(testIndexing%findIndex("n",6,local=.true.),45) 51 | @assertEqual(testIndexing%findIndex("f",8,3,5,local=.true.),25) 52 | 53 | indices = [74,75,76,84,85,86,94,95,96,104,105,106] 54 | 55 | @assertEqual(testIndexing%mapToGlobalIndices("u",[intArray([1,2])]),[2,24]) 56 | @assertEqual(testIndexing%mapToGlobalIndices("f",[intArray([1,2]),intArray([3,4]),intArray([8,9,10])]),indices) 57 | 58 | @assertEqual(testIndexing%findLocalXIndex(1,12),4) 59 | @assertEqual(testIndexing%findLocalXIndex(12,1),0) 60 | 61 | @assertEqual(testIndexing%findDistIndex(1,1,1,.true.,12),181) 62 | @assertEqual(testIndexing%findDistIndex(12,6,10,.true.,1),0) 63 | 64 | @assertEqual(size(testIndexing%getAllIndicesOfVar(1,1)),0) 65 | @assertEqual(testIndexing%getAllIndicesOfVar(1,3),[1,23,45]) 66 | @assertEqual(testIndexing%getAllIndicesOfVar(3,3),[[(i,i=3,22)],[(i,i=25,44)],[(i,i=47,66)]]) 67 | 68 | end subroutine test_indexing -------------------------------------------------------------------------------- /src/modules/testing_support/test_matrix_term_procedures.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | submodule (test_matrix_term_class) test_matrix_term_procedures 15 | 16 | implicit none 17 | 18 | !----------------------------------------------------------------------------------------------------------------------------------- 19 | contains 20 | !----------------------------------------------------------------------------------------------------------------------------------- 21 | pure module subroutine testRow(this,varCont,rowVals,indexingData) 22 | 23 | class(TestMatrixTerm) ,intent(inout) :: this 24 | type(VariableContainer) ,intent(in) :: varCont 25 | real(rk) ,dimension(:) ,intent(inout) :: rowVals 26 | type(MatrixTermIndexingData) ,intent(in) :: indexingData 27 | 28 | rowVals = varCont%variables(indexingData%rowReqVarIndices(1))%entry(indexingData%localRowIndices) *& 29 | varCont%variables(indexingData%rowReqVarIndices(2))%entry(indexingData%localRowIndices) 30 | 31 | end subroutine testRow 32 | !----------------------------------------------------------------------------------------------------------------------------------- 33 | pure module subroutine testCol(this,varCont,colVals,indexingData) 34 | 35 | class(TestMatrixTerm) ,intent(inout) :: this 36 | type(VariableContainer) ,intent(in) :: varCont 37 | type(RealArray) ,dimension(:) ,intent(inout) :: colVals 38 | type(MatrixTermIndexingData) ,intent(in) :: indexingData 39 | 40 | integer(ik) :: i 41 | 42 | do i = 1,size(colVals) 43 | colVals(i)%entry = varCont%variables(indexingData%colReqVarIndices(1))%entry(indexingData%localColIndices(i)%entry) 44 | end do 45 | 46 | end subroutine testCol 47 | !----------------------------------------------------------------------------------------------------------------------------------- 48 | end submodule test_matrix_term_procedures 49 | !----------------------------------------------------------------------------------------------------------------------------------- 50 | -------------------------------------------------------------------------------- /src/modules/terms/operator_abstract.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | module operator_abstract_class 15 | !! author: Stefan Mijin 16 | !! 17 | !! Houses abstract Operator class determining the update and actOn interfaces 18 | 19 | use data_kinds ,only: rk 20 | use god_objects ,only: Object 21 | use variable_container_class ,only: VariableContainer 22 | use runtime_constants ,only: debugging, assertions 23 | use assertion_utility ,only: assert, assertIdentical, assertPure 24 | use basic_interfaces ,only: realArrayFunction 25 | 26 | implicit none 27 | private 28 | 29 | type ,public ,extends(Object) ,abstract :: Operator 30 | !! Abstract operator class for use in explicit terms to transform real arrays 31 | 32 | contains 33 | 34 | procedure ,public :: update => noUpdate 35 | procedure(realArrayFunction) ,nopass ,deferred :: actOn 36 | 37 | end type Operator 38 | !----------------------------------------------------------------------------------------------------------------------------------- 39 | interface 40 | !----------------------------------------------------------------------------------------------------------------------------------- 41 | module subroutine noUpdate(this,varCont) 42 | !! Default operator update function - does nothing 43 | 44 | class(Operator) ,intent(inout) :: this 45 | type(VariableContainer) ,intent(in) :: varCont 46 | 47 | end subroutine noUpdate 48 | !----------------------------------------------------------------------------------------------------------------------------------- 49 | end interface 50 | !----------------------------------------------------------------------------------------------------------------------------------- 51 | end module operator_abstract_class 52 | !----------------------------------------------------------------------------------------------------------------------------------- 53 | -------------------------------------------------------------------------------- /src/modules/terms/jagged_array_generator_procedures.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | submodule (jagged_array_generator_class) jagged_array_generator_procedures 15 | !! author: Stefan Mijin 16 | !! 17 | !! Contains module procedures associated with the abstract jagged array generator class 18 | 19 | implicit none 20 | 21 | !----------------------------------------------------------------------------------------------------------------------------------- 22 | contains 23 | !----------------------------------------------------------------------------------------------------------------------------------- 24 | module function calculate(this,varCont,mbData,hostModel) result(res) 25 | !! Use in place version of stencil calculation to return values 26 | 27 | class(JaggedArrayGenerator) ,intent(inout) :: this 28 | type(VariableContainer) ,intent(in) :: varCont 29 | type(RealArray) ,allocatable ,dimension(:) :: res 30 | class(ModelboundData) ,optional ,intent(in) :: mbData 31 | class(ModelSurrogate) ,optional ,intent(in) :: hostModel 32 | 33 | if (present(mbData)) then 34 | if (present(hostModel)) then 35 | call this%calculateInPlace(varCont,res,mbData,hostModel) 36 | else 37 | call this%calculateInPlace(varCont,res,mbData) 38 | end if 39 | else 40 | if (present(hostModel)) then 41 | call this%calculateInPlace(varCont,res,hostModel=hostModel) 42 | else 43 | call this%calculateInPlace(varCont,res) 44 | end if 45 | end if 46 | 47 | end function calculate 48 | !----------------------------------------------------------------------------------------------------------------------------------- 49 | !----------------------------------------------------------------------------------------------------------------------------------- 50 | end submodule jagged_array_generator_procedures 51 | !----------------------------------------------------------------------------------------------------------------------------------- 52 | -------------------------------------------------------------------------------- /src/modules/signals/cut_sine_signal_procedures.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | submodule (cut_sine_signal_class) cut_sine_signal_procedures 15 | !! author: Stefan Mijin 16 | !! 17 | !! Contains module procedures associated with the cut sine signal class 18 | 19 | implicit none 20 | 21 | !----------------------------------------------------------------------------------------------------------------------------------- 22 | contains 23 | !----------------------------------------------------------------------------------------------------------------------------------- 24 | module function calculateCutSine(this,time,period,params) result(res) 25 | 26 | class(CutSineSignal) ,intent(inout) :: this 27 | real(rk) ,intent(in) :: time 28 | real(rk) ,intent(in) :: period 29 | real(rk) ,optional ,dimension(:) ,intent(in) :: params 30 | real(rk) :: res 31 | 32 | if (assertions) then 33 | call assert(present(params),"calculateCutSine reguires parameter params to be present") 34 | call assert(size(params)>1,"calculateCutSine expects at least 2 params") 35 | call assert(params(1)>=0,"params(1) passed to calculateCutSine must be non-negative") 36 | call assert(params(2)>params(1),"params(2) passed to calculateCutSine must be greater than params(1)") 37 | call assert(params(2)<=real(1,kind=rk),"params(2) passed to calculateCutSine must be less than or equal to 1") 38 | call assert(period>0,"period argument passed to calculateCutSine must be positive") 39 | end if 40 | 41 | res = 0 42 | 43 | if (mod(time,period)>=params(1)*period .and. params(2)*period>mod(time,period)) & 44 | res = sin(pi*(mod(time,period)-params(1)*period)/(period*(params(2)-params(1)))) 45 | 46 | end function calculateCutSine 47 | !----------------------------------------------------------------------------------------------------------------------------------- 48 | end submodule cut_sine_signal_procedures 49 | !----------------------------------------------------------------------------------------------------------------------------------- 50 | -------------------------------------------------------------------------------- /src/modules/variables/derivation_abstract.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | module derivation_abstract_class 15 | !! author: Stefan Mijin 16 | !! 17 | !! Houses abstract Derivation object definitions used to build rules for transforming evolved into derived variables 18 | 19 | use data_kinds ,only: rk ,ik 20 | use god_objects ,only: Object 21 | use support_types ,only: RealArray 22 | 23 | implicit none 24 | private 25 | 26 | type ,public :: DerivationContainer 27 | class(Derivation) ,allocatable :: entry 28 | end type DerivationContainer 29 | 30 | type ,public ,extends(Object), abstract :: Derivation 31 | !! Abstract derivation object defining the interface for calculating derived variables and data 32 | 33 | contains 34 | 35 | procedure(calculation) ,deferred :: calculate 36 | 37 | end type Derivation 38 | !----------------------------------------------------------------------------------------------------------------------------------- 39 | abstract interface 40 | !----------------------------------------------------------------------------------------------------------------------------------- 41 | function calculation(this,inputArray,indices) result(output) 42 | 43 | import :: ik ,rk ,RealArray ,Derivation 44 | 45 | class(Derivation) ,intent(inout) :: this 46 | type(RealArray) ,dimension(:) ,intent(in) :: inputArray 47 | integer(ik) ,dimension(:) ,intent(in) :: indices 48 | real(rk) ,allocatable ,dimension(:) :: output 49 | 50 | end function calculation 51 | !----------------------------------------------------------------------------------------------------------------------------------- 52 | end interface 53 | !----------------------------------------------------------------------------------------------------------------------------------- 54 | end module derivation_abstract_class 55 | !----------------------------------------------------------------------------------------------------------------------------------- 56 | -------------------------------------------------------------------------------- /src/modules/variables/mat_derivation_abstract.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | module mat_derivation_abstract_class 15 | !! author: Stefan Mijin 16 | !! 17 | !! Houses abstract MatDerivation object definitions used to calculate dense matrix quantities from data 18 | 19 | use data_kinds ,only: rk ,ik 20 | use god_objects ,only: Object 21 | use support_types ,only: RealArray 22 | 23 | implicit none 24 | private 25 | 26 | type ,public :: MatDerivationContainer 27 | class(MatDerivation) ,allocatable :: entry 28 | end type MatDerivationContainer 29 | 30 | type ,public ,extends(Object), abstract :: MatDerivation 31 | !! Abstract derivation object defining the interface for calculating dense matrix quantities 32 | 33 | contains 34 | 35 | procedure(calculation) ,deferred :: calculate 36 | 37 | end type MatDerivation 38 | !----------------------------------------------------------------------------------------------------------------------------------- 39 | abstract interface 40 | !----------------------------------------------------------------------------------------------------------------------------------- 41 | function calculation(this,inputArray,indices) result(output) 42 | 43 | import :: ik ,rk ,RealArray ,MatDerivation 44 | 45 | class(MatDerivation) ,intent(inout) :: this 46 | type(RealArray) ,dimension(:) ,intent(in) :: inputArray 47 | integer(ik) ,dimension(:) ,intent(in) :: indices 48 | real(rk) ,allocatable ,dimension(:,:) :: output 49 | 50 | end function calculation 51 | !----------------------------------------------------------------------------------------------------------------------------------- 52 | end interface 53 | !----------------------------------------------------------------------------------------------------------------------------------- 54 | end module mat_derivation_abstract_class 55 | !----------------------------------------------------------------------------------------------------------------------------------- 56 | -------------------------------------------------------------------------------- /tests/test_terms/test_stencil_generator1d.pf: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | module test_stencil_generator1d 14 | 15 | use pfunit 16 | use god_objects ,only: object 17 | use data_kinds ,only: ik, rk 18 | use partition_class 19 | use grid_class 20 | use variable_list_class 21 | use indexing_class 22 | use support_types 23 | use variable_container_class 24 | use support_functions 25 | use stencil1d_class 26 | use stencil_generator1d_class 27 | 28 | implicit none 29 | 30 | contains 31 | 32 | @test 33 | subroutine test_stencil1d_gen 34 | 35 | type(partition) :: testPart 36 | type(grid) :: testGrid 37 | type(variableList) :: testList,testListDerived 38 | type(indexing) :: testIndexing 39 | type(variableContainer) :: testVarCont1 40 | type(calculationRule) ,dimension(0) :: cRules 41 | type(RealArray) ,allocatable ,dimension(:) :: colVals ,testRes 42 | type(Stencil1D) :: testStencil 43 | type(StencilGenerator1D) :: testGen 44 | 45 | integer(ik) :: i ,j 46 | 47 | call testPart%initSimplePartition(4,2,12,2) 48 | 49 | call testGrid%init(real([(i,i=1,12)],kind=rk),real([(i,i=1,3)],kind=rk),1,0) 50 | 51 | call testList%init() 52 | 53 | call testListDerived%init() 54 | 55 | call testIndexing%init(testPart,testGrid,testList) 56 | 57 | call testVarCont1%init(testList,testListDerived,cRules,testIndexing,testPart,1,2) 58 | 59 | call testStencil%init([-1,0,1]) 60 | 61 | allocate(colVals(3)) 62 | 63 | do i =1,3 64 | colVals(i)%entry = [(real((i-1)*12+j,kind=rk),j=1,12)] 65 | end do 66 | 67 | call testGen%init(testStencil,colVals,coordInterval=[1,12]) 68 | 69 | call testGen%calculateInPlace(testVarCont1,testRes) 70 | 71 | @assertEqual(testRes(1)%entry,[colVals(2)%entry(1),colVals(3)%entry(1)],tolerance=1e-15) 72 | @assertEqual(testRes(12)%entry,[colVals(1)%entry(12),colVals(2)%entry(12)],tolerance=1e-15) 73 | 74 | do i = 2,11 75 | @assertEqual(testRes(i)%entry,[colVals(1)%entry(i),colVals(2)%entry(i),colVals(3)%entry(i)],tolerance=1e-15) 76 | end do 77 | 78 | end subroutine test_stencil1d_gen 79 | 80 | 81 | 82 | 83 | 84 | end module test_stencil_generator1d 85 | 86 | -------------------------------------------------------------------------------- /src/modules/signals/hat_signal.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | module hat_signal_class 15 | !! author: Stefan Mijin 16 | !! 17 | !! Houses hat signal class - periodic signal with passed period, interpeting params(1) and params(2) as the point in the period 18 | !! when the signal turns on/off 19 | 20 | use data_kinds ,only: rk 21 | use signal_abstract_class ,only: TimeSignal 22 | use runtime_constants ,only: debugging, assertions 23 | use assertion_utility ,only: assert, assertIdentical, assertPure 24 | 25 | implicit none 26 | private 27 | 28 | type ,public ,extends(TimeSignal) :: HatSignal 29 | !! Periodic signal where in params(1) and params(2) are between 0 and 1. Returns 1 if params(1) calculateHat 35 | 36 | end type HatSignal 37 | !----------------------------------------------------------------------------------------------------------------------------------- 38 | interface 39 | !----------------------------------------------------------------------------------------------------------------------------------- 40 | module function calculateHat(this,time,period,params) result(res) 41 | 42 | class(HatSignal) ,intent(inout) :: this 43 | real(rk) ,intent(in) :: time 44 | real(rk) ,intent(in) :: period 45 | real(rk) ,optional ,dimension(:) ,intent(in) :: params 46 | real(rk) :: res 47 | 48 | 49 | end function calculateHat 50 | !----------------------------------------------------------------------------------------------------------------------------------- 51 | end interface 52 | !----------------------------------------------------------------------------------------------------------------------------------- 53 | end module hat_signal_class 54 | !----------------------------------------------------------------------------------------------------------------------------------- 55 | -------------------------------------------------------------------------------- /src/modules/integrator_abstractions/timestep_controller_abstract.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | module timestep_controller_abstract_class 15 | !! author: Stefan Mijin 16 | !! 17 | !! Houses abstract interface for optional timestep controller object 18 | 19 | use data_kinds ,only: rk 20 | use runtime_constants ,only: debugging, assertions 21 | use god_objects ,only: Object 22 | use assertion_utility ,only: assert, assertIdentical, assertPure 23 | use variable_container_class ,only: VariableContainer 24 | 25 | implicit none 26 | private 27 | 28 | type ,public ,extends(Object) ,abstract:: TimestepController 29 | !! Abstract timestep controller object 30 | 31 | contains 32 | 33 | procedure(timestepCalc) ,deferred :: evaluateTimestep 34 | 35 | end type TimestepController 36 | !----------------------------------------------------------------------------------------------------------------------------------- 37 | abstract interface 38 | function timestepCalc(this,inputVars,currentTimestep) result(timestep) 39 | !! Calculate timestep in accordance with timestep controller rules and using current timestep and input variables 40 | 41 | import :: TimestepController ,VariableContainer ,rk 42 | 43 | class(TimestepController) ,intent(inout) :: this 44 | class(VariableContainer) ,intent(in) :: inputVars !! Variable container used to calculate timestep 45 | real(rk) ,intent(in) :: currentTimestep !! Current timestep to be used if the controller rescales timesteps 46 | real(rk) :: timestep 47 | 48 | end function timestepCalc 49 | !----------------------------------------------------------------------------------------------------------------------------------- 50 | end interface 51 | !----------------------------------------------------------------------------------------------------------------------------------- 52 | end module timestep_controller_abstract_class 53 | !----------------------------------------------------------------------------------------------------------------------------------- 54 | -------------------------------------------------------------------------------- /tests/test_basic_support/test_calculation_tree.pf: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | module test_calculation_tree 14 | 15 | use pfunit 16 | use calculation_tree_class 17 | use unary_transforms 18 | use support_types 19 | use basic_interfaces 20 | use data_kinds ,only: ik, rk 21 | 22 | implicit none 23 | 24 | contains 25 | 26 | @test 27 | subroutine test_tree 28 | 29 | type(CalculationNode) ,pointer :: nodePointer 30 | type(CalculationTree) :: testTree ,testTree2 31 | type(FlatTree) :: testFlatTree 32 | type(RealArray) ,allocatable ,dimension(:) :: testData 33 | real(rk) ,allocatable ,dimension(:) :: testVec ,checkVec 34 | 35 | integer(ik) :: i 36 | allocate(testData(3)) 37 | testData(1)%entry = real([1,2,3],kind=rk) 38 | testData(2)%entry = 2*real([1,2,3],kind=rk) 39 | testData(3)%entry = 3*real([1,2,3],kind=rk) 40 | 41 | call testTree%init(constant = real(2,kind=rk),unaryTransformTag="shift",unaryIntParams=[-1]) 42 | 43 | nodePointer => testTree%root 44 | 45 | call nodePointer%addChild(additiveMode=.true.,constant=real(0.5d0,kind=rk)) 46 | call nodePointer%addChild(constant=(real(0.25d0,kind=rk)),leafVarIndex=1) 47 | 48 | nodePointer => nodePointer%leftChild 49 | 50 | call nodePointer%addChild(leafVarIndex=2) 51 | call nodePointer%addChild(additiveMode=.true.) 52 | 53 | nodePointer => nodePointer%leftChild 54 | nodePointer => nodePointer%rightSibling 55 | 56 | call nodePointer%addChild(leafVarIndex=1,unaryTransformTag="ipow",unaryIntParams=[3]) 57 | call nodePointer%addChild(leafVarIndex=3) 58 | 59 | testVec = testTree%evaluate(testData) 60 | 61 | checkVec = ((testData(1)%entry**3 + testData(3)%entry) + (real(0.5d0,kind=rk) + testData(2)%entry))& 62 | *real(0.5d0,kind=rk)*testData(1)%entry 63 | 64 | 65 | @assertEqual(testVec(1:2),checkVec(2:3),tolerance=1e-15) 66 | @assertEqual(testVec(3),checkVec(1),tolerance=1e-15) 67 | 68 | testFlatTree = testTree%flatten() 69 | call testTree2%initFromFlatTree(testFlatTree) 70 | testVec = testTree2%evaluate(testData) 71 | 72 | @assertEqual(testVec(1:2),checkVec(2:3),tolerance=1e-15) 73 | @assertEqual(testVec(3),checkVec(1),tolerance=1e-15) 74 | 75 | end subroutine test_tree 76 | 77 | end module -------------------------------------------------------------------------------- /src/modules/testing_support/test_explicit_term.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | module test_explicit_term_class 15 | 16 | use data_kinds ,only: rk, ik 17 | use runtime_constants ,only: debugging, assertions 18 | use god_objects ,only: Object 19 | use assertion_utility ,only: assert, assertIdentical, assertPure 20 | use explicit_term_abstract_class ,only: ExplicitTerm 21 | use variable_container_class ,only: VariableContainer 22 | 23 | 24 | implicit none 25 | private 26 | 27 | type ,public ,extends(ExplicitTerm) :: TestExplicitTerm 28 | 29 | contains 30 | 31 | procedure ,public :: init => initTestExplicitTerm 32 | procedure ,public :: outerFun => testFun 33 | 34 | end type TestExplicitTerm 35 | !----------------------------------------------------------------------------------------------------------------------------------- 36 | interface 37 | !----------------------------------------------------------------------------------------------------------------------------------- 38 | pure module subroutine initTestExplicitTerm(this,evolvedVarName,varCont) 39 | 40 | class(TestExplicitTerm) ,intent(inout) :: this 41 | character(*) ,intent(in) :: evolvedVarName 42 | type(VariableContainer) ,intent(in) :: varCont 43 | 44 | end subroutine initTestExplicitTerm 45 | !----------------------------------------------------------------------------------------------------------------------------------- 46 | module function testFun(this,varCont) result(res) 47 | 48 | class(TestExplicitTerm) ,intent(in) :: this 49 | type(VariableContainer) ,intent(in) :: varCont 50 | 51 | real(rk) ,allocatable ,dimension(:) :: res 52 | 53 | end function testFun 54 | !----------------------------------------------------------------------------------------------------------------------------------- 55 | end interface 56 | !----------------------------------------------------------------------------------------------------------------------------------- 57 | end module test_explicit_term_class 58 | !----------------------------------------------------------------------------------------------------------------------------------- 59 | 60 | -------------------------------------------------------------------------------- /tests/test_basic_support/test_sparse_row_data.pf: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | 14 | @test 15 | subroutine test_sparse_row_data 16 | use pfunit 17 | use sparse_row_data_class 18 | use support_types 19 | use data_kinds ,only: ik, rk 20 | implicit none 21 | 22 | type(sparseRowData) :: testData ,testData2 23 | 24 | integer(ik) ,dimension(:) ,allocatable :: rows 25 | type(intArray) ,dimension(:) ,allocatable :: colVecs 26 | 27 | type(RealArray) ,dimension(:) ,allocatable :: testArray 28 | 29 | integer(ik) :: i 30 | 31 | rows = [1,2,3] 32 | colVecs = [intArray([1,2]),intArray([2,3]),intArray([3,4])] 33 | 34 | call testData%init(rows,colVecs) 35 | 36 | @assertEqual(testData%rowIndex,[1,2,3]) 37 | @assertEqual(size(testData%columnVector),3) 38 | @assertEqual(size(testData%values),3) 39 | 40 | @assertEqual(testData%columnVector(1)%entry,[1,2]) 41 | @assertEqual(testData%columnVector(2)%entry,[2,3]) 42 | @assertEqual(testData%columnVector(3)%entry,[3,4]) 43 | 44 | @assertTrue(all(abs(testData%values(1)%entry) <= 1.0d-14)) 45 | @assertTrue(all(abs(testData%values(2)%entry) <= 1.0d-14)) 46 | @assertTrue(all(abs(testData%values(3)%entry) <= 1.0d-14)) 47 | 48 | call testData%addRow(4,[4,5]) 49 | 50 | @assertEqual(testData%rowIndex,[1,2,3,4]) 51 | @assertEqual(size(testData%columnVector),4) 52 | @assertEqual(size(testData%values),4) 53 | 54 | @assertEqual(testData%columnVector(1)%entry,[1,2]) 55 | @assertEqual(testData%columnVector(2)%entry,[2,3]) 56 | @assertEqual(testData%columnVector(3)%entry,[3,4]) 57 | @assertEqual(testData%columnVector(4)%entry,[4,5]) 58 | 59 | @assertTrue(all(abs(testData%values(1)%entry) <= 1.0d-14)) 60 | @assertTrue(all(abs(testData%values(2)%entry) <= 1.0d-14)) 61 | @assertTrue(all(abs(testData%values(3)%entry) <= 1.0d-14)) 62 | @assertTrue(all(abs(testData%values(4)%entry) <= 1.0d-14)) 63 | 64 | do i = 1,4 65 | testData%values(i)%entry = real(i,kind=rk) 66 | end do 67 | 68 | 69 | testData2 = testData * testData 70 | 71 | @assertEqual(size(testData2%values),4) 72 | 73 | do i = 1,4 74 | @assertTrue(all(abs(testData2%values(i)%entry - real(i**2,kind=rk)) <= 1.0d-14)) 75 | end do 76 | 77 | testArray = testData%values * testData 78 | 79 | do i = 1,4 80 | @assertTrue(all(abs(testArray(i)%entry - real(i**2,kind=rk)) <= 1.0d-14)) 81 | end do 82 | 83 | end subroutine test_sparse_row_data -------------------------------------------------------------------------------- /src/modules/modeller_assembly/standard_modeller_assembly.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | module standard_modeller_assembly 15 | !! Contains various support routines used in data initialization 16 | 17 | use data_kinds ,only: rk, ik 18 | use runtime_constants ,only: debugging, assertions, assertionLvl 19 | use assertion_utility ,only: assert, assertIdentical, assertPure 20 | use json_controller_class ,only: JSONController 21 | use mpi_controller_class ,only: MPIController ,CommunicationData 22 | use normalization_abstract_class ,only: Normalization 23 | use composite_integrator_class ,only: CompositeIntegrator 24 | use basic_environment_wrapper ,only: EnvironmentWrapper 25 | use modeller_class ,only: Modeller 26 | use custom_model_builder_class ,only: CustomModelBuilder 27 | use composite_manipulator_class ,only: CompositeManipulator 28 | use status_printing 29 | use manipulator_support 30 | use initialization_support 31 | use support_types 32 | use key_names 33 | 34 | implicit none 35 | 36 | !----------------------------------------------------------------------------------------------------------------------------------- 37 | interface 38 | !----------------------------------------------------------------------------------------------------------------------------------- 39 | module subroutine initStandardModeller(modellerObj,envObj,normObj) 40 | !! Initialize standard modeller based on config file and normalization and environment objects 41 | 42 | type(Modeller) ,intent(inout) :: modellerObj 43 | class(EnvironmentWrapper) ,intent(inout) :: envObj 44 | class(Normalization) ,intent(in) :: normObj 45 | 46 | end subroutine initStandardModeller 47 | !----------------------------------------------------------------------------------------------------------------------------------- 48 | end interface 49 | !----------------------------------------------------------------------------------------------------------------------------------- 50 | end module standard_modeller_assembly 51 | !----------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------- /src/modules/signals/cut_sine_signal.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | module cut_sine_signal_class 15 | !! author: Stefan Mijin 16 | !! 17 | !! Houses cut sine signal class - periodic signal with passed period, interpeting params(1) and params(2) as the point in the period 18 | !! when the signal turns on/off, and is the shape of a half-sine 19 | 20 | use data_kinds ,only: rk 21 | use signal_abstract_class ,only: TimeSignal 22 | use runtime_constants ,only: debugging, assertions 23 | use assertion_utility ,only: assert, assertIdentical, assertPure 24 | use physical_constants ,only: pi 25 | 26 | implicit none 27 | private 28 | 29 | type ,public ,extends(TimeSignal) :: CutSineSignal 30 | !! Periodic signal where in params(1) and params(2) are between 0 and 1. Returns half-sine if params(1) calculateCutSine 36 | 37 | end type CutSineSignal 38 | !----------------------------------------------------------------------------------------------------------------------------------- 39 | interface 40 | !----------------------------------------------------------------------------------------------------------------------------------- 41 | module function calculateCutSine(this,time,period,params) result(res) 42 | 43 | class(CutSineSignal) ,intent(inout) :: this 44 | real(rk) ,intent(in) :: time 45 | real(rk) ,intent(in) :: period 46 | real(rk) ,optional ,dimension(:) ,intent(in) :: params 47 | real(rk) :: res 48 | 49 | 50 | end function calculateCutSine 51 | !----------------------------------------------------------------------------------------------------------------------------------- 52 | end interface 53 | !----------------------------------------------------------------------------------------------------------------------------------- 54 | end module cut_sine_signal_class 55 | !----------------------------------------------------------------------------------------------------------------------------------- 56 | -------------------------------------------------------------------------------- /src/modules/common_derivations/calculation_tree_derivation_procedures.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | submodule (calculation_tree_derivation_class) calculation_tree_derivation_procedures 15 | !! author: Stefan Mijin 16 | !! 17 | !! Contains module procedures associated with the calculation tree derivation class 18 | 19 | implicit none 20 | 21 | !----------------------------------------------------------------------------------------------------------------------------------- 22 | contains 23 | !----------------------------------------------------------------------------------------------------------------------------------- 24 | module subroutine initCalculationTreeDeriv(this,flattenedTree) 25 | !! Initialize calculation tree derivation using flattened tree 26 | 27 | class(CalculationTreeDerivation) ,intent(inout) :: this 28 | type(FlatTree) ,intent(in) :: flattenedTree 29 | 30 | this%flattenedTree = flattenedTree 31 | 32 | call this%makeDefined() 33 | 34 | end subroutine initCalculationTreeDeriv 35 | !----------------------------------------------------------------------------------------------------------------------------------- 36 | module function calculateTree(this,inputArray,indices) result(output) 37 | 38 | class(CalculationTreeDerivation) ,intent(inout) :: this 39 | type(RealArray) ,dimension(:) ,intent(in) :: inputArray 40 | integer(ik) ,dimension(:) ,intent(in) :: indices 41 | real(rk) ,allocatable ,dimension(:) :: output 42 | 43 | if (assertions) call assert(this%isDefined(),"calculateTree called on undefined CalculationTreeDerivation") 44 | 45 | if (.not. associated(this%testPointer)) then 46 | 47 | if (allocated(this%tree)) deallocate(this%tree) 48 | 49 | allocate(this%tree) 50 | call this%tree%initFromFlatTree(this%flattenedTree) 51 | allocate(this%testPointer) 52 | this%testPointer = 1 53 | 54 | end if 55 | 56 | output = this%tree%evaluate(inputArray) 57 | 58 | end function calculateTree 59 | !----------------------------------------------------------------------------------------------------------------------------------- 60 | end submodule calculation_tree_derivation_procedures 61 | !----------------------------------------------------------------------------------------------------------------------------------- 62 | -------------------------------------------------------------------------------- /src/modules/signals/signal_abstract.f90: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------------------------------------------------------------------- 2 | ! This file is part of ReMKiT1D. 3 | ! 4 | ! ReMKiT1D is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 5 | ! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 6 | ! 7 | ! ReMKiT1D is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 | ! 10 | ! You should have received a copy of the GNU General Public License along with ReMKiT1D. If not, see . 11 | ! 12 | ! Copyright 2023 United Kingdom Atomic Energy Authority (stefan.mijin@ukaea.uk) 13 | !----------------------------------------------------------------------------------------------------------------------------------- 14 | module signal_abstract_class 15 | !! author: Stefan Mijin 16 | !! 17 | !! Houses abstract signal class - a wrapper for explicit time dependence 18 | 19 | use data_kinds ,only: rk 20 | 21 | implicit none 22 | private 23 | 24 | type ,public :: TimeSignalData 25 | !! Container for time signal data used tu inject explicit time dependence 26 | real(rk) ,allocatable ,dimension(:) ,public :: tParams !! Parameters for tSignal 27 | real(rk) ,public :: tPeriod !! Period for tSignal 28 | class(TimeSignal) ,allocatable ,public :: tSignal !! Optional signal object used to inject explicit time dependence 29 | 30 | end type TimeSignalData 31 | 32 | type ,public ,abstract :: TimeSignal 33 | !! Abstract signal class wrapping explicit time dependence. NOTE: Not meant to be initializable, hence not an object 34 | 35 | contains 36 | 37 | procedure(signalCalculation) ,deferred :: calculate 38 | 39 | end type TimeSignal 40 | !----------------------------------------------------------------------------------------------------------------------------------- 41 | abstract interface 42 | !----------------------------------------------------------------------------------------------------------------------------------- 43 | function signalCalculation(this,time,period,params) result(res) 44 | 45 | import :: TimeSignal ,rk 46 | 47 | class(TimeSignal) ,intent(inout) :: this 48 | real(rk) ,intent(in) :: time 49 | real(rk) ,intent(in) :: period 50 | real(rk) ,optional ,dimension(:) ,intent(in) :: params 51 | real(rk) :: res 52 | 53 | 54 | end function signalCalculation 55 | !----------------------------------------------------------------------------------------------------------------------------------- 56 | end interface 57 | !----------------------------------------------------------------------------------------------------------------------------------- 58 | end module signal_abstract_class 59 | !----------------------------------------------------------------------------------------------------------------------------------- 60 | --------------------------------------------------------------------------------