docs: Update and extending README

build: Set internal variables to new project name

ci: Use new CMake variables as basis
This commit is contained in:
Max Lübke 2022-08-23 11:35:08 +02:00
parent 40f37bf104
commit c96655241f
10 changed files with 2710 additions and 73 deletions

View File

@ -15,7 +15,7 @@ build_release:
expire_in: 100s expire_in: 100s
script: script:
- mkdir build && cd build - mkdir build && cd build
- cmake -DCMAKE_BUILD_TYPE=Release -DBTCS_ENABLE_TESTING=ON .. - cmake -DCMAKE_BUILD_TYPE=Release -DTUG_ENABLE_TESTING=ON ..
- make -j$(nproc) - make -j$(nproc)
test: test:
@ -29,5 +29,5 @@ lint:
stage: static_analyze stage: static_analyze
script: script:
- mkdir lint && cd lint - mkdir lint && cd lint
- cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_CLANG_TIDY="clang-tidy;-checks=cppcoreguidelines-*,clang-analyzer-*,performance-*,readability-*, modernize-*" -DBTCS_ENABLE_TESTING=OFF .. - cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_CLANG_TIDY="clang-tidy;-checks=cppcoreguidelines-*,clang-analyzer-*,performance-*,readability-*, modernize-*" -DTUG_ENABLE_TESTING=OFF ..
- make BTCSDiffusion - make tug

View File

@ -1,7 +1,7 @@
#debian stable (currently bullseye) #debian stable (currently bullseye)
cmake_minimum_required(VERSION 3.18) cmake_minimum_required(VERSION 3.18)
project(BTCSDiffusion CXX) project(tug CXX)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
@ -9,7 +9,7 @@ find_package(Eigen3 REQUIRED NO_MODULE)
find_package(OpenMP) find_package(OpenMP)
## SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -mfma") ## SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -mfma")
option(BTCS_USE_OPENMP "Compile with OpenMP support" ON) option(TUG_USE_OPENMP "Compile with OpenMP support" ON)
set(CMAKE_CXX_FLAGS_GENERICOPT "-O3 -march=native" CACHE STRING set(CMAKE_CXX_FLAGS_GENERICOPT "-O3 -march=native" CACHE STRING
"Flags used by the C++ compiler during opt builds." "Flags used by the C++ compiler during opt builds."
@ -19,22 +19,22 @@ set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel GenericOpt." "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel GenericOpt."
FORCE) FORCE)
option(BTCS_USE_UNSAFE_MATH_OPT option(TUG_USE_UNSAFE_MATH_OPT
"Use compiler options to break IEEE compliances by "Use compiler options to break IEEE compliances by
oenabling reordering of instructions when adding/multiplying of floating oenabling reordering of instructions when adding/multiplying of floating
points." points."
OFF) OFF)
if(BTCS_USE_UNSAFE_MATH_OPT) if(TUG_USE_UNSAFE_MATH_OPT)
add_compile_options(-ffast-math) add_compile_options(-ffast-math)
endif() endif()
option(BTCS_ENABLE_TESTING option(TUG_ENABLE_TESTING
"Run tests after succesfull compilation" "Run tests after succesfull compilation"
OFF) OFF)
add_subdirectory(src) add_subdirectory(src)
if(BTCS_ENABLE_TESTING) if(TUG_ENABLE_TESTING)
add_subdirectory(test) add_subdirectory(test)
endif() endif()

View File

@ -1,33 +1,33 @@
#+TITLE: BTCSDiffusion #+TITLE: TUG: a C++ framework to solve Transport on Uniform Grids
#+BEGIN_CENTER [[./doc/images/tug_logo_small.png]]
A framework solving diffusion problems using BTCS approach.
#+END_CENTER =tug= implements different numerical approaches for transport
problems, notably diffusion with implicit BTCS (Backward Time, Central
Space) Euler and parallel 2D ADI (Alternating Direction Implicit).
* About * About
This project aims to provide a library for solving diffusion problems using the This project aims to provide a library for solving transport
backward Euler method (BTCS) implemented in C++. problems - diffusion, advection - on uniform grids implemented in C++.
The library is built on top of [[https://eigen.tuxfamily.org/index.php?title=Main_Page][Eigen]], providing easy access to its
optimized data structures and linear equation solvers.
The library is built on top of [[https://eigen.tuxfamily.org/index.php?title=Main_Page][Eigen]], providing easy access to data structures We designed the API to be as flexible as possible. Nearly every
and the linear equation solver. built-in, framework or third-party data structure can be used to model
a problem, as long a pointer to continuous memory can be provided. We
also provide parallelization using [[https://www.openmp.org/][OpenMP]], which can be easily turned
on/off at compile time.
We designed the API to be as much flexible as possible. Nearly every built-in, At the current state, both 1D and 2D diffusion problems on a regular
framework or third-party data structure can be used to model a problem, as long grid with constant alpha for all grid cells can be solved reliably.
a pointer to continious memory can be providided.
Also we provide basic parallelization by using [[https://www.openmp.org/][OpenMP]], which can be easily
turned on/off during generation of makefiles.
At the current state, both 1D and @D diffusion problems on a regular grid with
constant alpha for all grid cells can be solved reliably.
* Getting started * Getting started
As this diffusion module is designed as a framework library and makefile =tug= is designed as a framework library and it relies on [[https://cmake.org/][CMake]] for
generation is done by [[https://cmake.org/][CMake]], you're good to go to also use CMake as your build building. If you already use =CMake= as your build toolkit for your
toolkit. If you decide to not use CMake, you need to manually link your application, you're good to go. If you decide not to use =CMake=, you
application/library to BTCSDiffusion. need to manually link your application/library to =tug=.
1. Create project directory. 1. Create project directory.
@ -36,48 +36,54 @@ application/library to BTCSDiffusion.
#+END_SRC #+END_SRC
2. Clone this repository into path of choice project directory 2. Clone this repository into path of choice project directory
- with =ssh=:
#+BEGIN_SRC #+BEGIN_SRC
$ git clone git@git.gfz-potsdam.de:mluebke/diffusion.git $ git clone git@git.gfz-potsdam.de:sec34/tug.git
#+END_SRC
- with =https=:
#+BEGIN_SRC
$ git clone https://git.gfz-potsdam.de/sec34/tug.git
#+END_SRC #+END_SRC
3. Add the following line into =CMakeLists.txt= file: 3. Add the following line into =CMakeLists.txt= file:
#+BEGIN_SRC #+BEGIN_SRC
add_subdirectory(path_to_diffusion_module EXCLUDE_FROM_ALL) add_subdirectory(path_to_tug EXCLUDE_FROM_ALL)
#+END_SRC #+END_SRC
4. Write application/library using API of =BTCSDiffusion=. 4. Write application/library using =tug='s API, notably including
relevant headers (see examples).
5. Link target application/library against =BTCSDiffusion=. Do this by adding 5. Link target application/library against =tug=. Do this by adding
into according =CMakeLists.txt= file: into according =CMakeLists.txt= file:
#+BEGIN_SRC #+BEGIN_SRC
target_link_libraries(your_libapp BTCSDiffusion) target_link_libraries(your_libapp tug)
#+END_SRC #+END_SRC
6. Build your application/library with CMake. 6. Build your application/library with =CMake=.
* Usage * Usage in an application
Setting up an enviroment to use the =BTCSDiffusion= module is divided into the Using =tug= can be summarized into the following steps:
following steps:
1. Defining dimension of diffusion problem. 1. Define problem dimensionality
2. Set grid sizes in according dimensions. 2. Set grid sizes for each dimension
3. Set the timestep to simulate. 3. Set the timestep
4. Defining boundary conditions. 4. Define boundary conditions
5. Run the simulation! 5. Run the simulation!
This will run a simulation on the defined grid for one species. See the source This will run a simulation on the defined grid for one species. See
code documentation of =BTCSDiffusion= and the examples in the =app/= directory the source code documentation of =tug= and the examples in the
for more information. =examples/= directory for more details.
* Roadmap * Roadmap
- [X] 1D diffusion - [X] 1D diffusion using BTCS
- [X] 2D diffusion - [X] 2D diffusion with ADI
- [ ] 3D diffusion (?) - [ ] 3D diffusion (?)
- [X] R-API (see [[https://git.gfz-potsdam.de/sec34/rcppbtcs][RcppBTCS]]) - [X] R-API (see [[https://git.gfz-potsdam.de/sec34/rcppbtcs][RcppBTCS]])
- [-] Python-API (?) - [-] Python-API (?)
@ -86,30 +92,33 @@ for more information.
* Contributing * Contributing
** *PLEASE NOTE* ** *PLEASE NOTE*
Starting with the preparations of v0.2 we would like to use more meaningful Starting from version v0.2 we would like to use more meaningful commit
commit messages. A good practice can be found [[https://www.conventionalcommits.org/en/v1.0.0/][here]]. messages. An overview of good practices and conventions can be found
[[https://www.conventionalcommits.org/en/v1.0.0/][here]].
** Workflow ** Workflow
In this early stage of development every help is welcome. To do so, there are In this early stage of development every help is welcome. To do so,
currently the following options: there are currently the following options:
Given you have an account for this GFZ git instance: Given you have an account for GFZ's =gitlab= instance:
1. Fork this project, create a branch and push your changes. If your changes are 1. Fork this project, create a branch and push your changes. If your
done or you feel the need for some feedback create a merge request with the changes are done or you feel the need for some feedback create a
destination set to the *main* branch of this project. merge request with the destination set to the *main* branch of this
2. Ask for access to this repository. You most likelz will get access as a project.
developer which allows you to create branches and merge requests inside this 2. Ask for access to this repository. You most likely will get access
repository. as a developer which allows you to create branches and merge
requests inside this repository.
If can't get access to this git instance: If you can't get access to this =gitlab= instance:
3. Download this repository and note down the SHA of the downloaded commit. 3. Download this repository and note down the SHA of the downloaded
Apply your changes and send a mail to [[mailto:mluebke@gfz-potsdam.de][mluebke@gfz-potsdam.de]] or commit. Apply your changes and send a mail to
[[mailto:delucia@gfz-potsdam.de][delucia@gfz-potsdam.de]] with the patch/diff compared to your starting point. [[mailto:mluebke@gfz-potsdam.de][mluebke@gfz-potsdam.de]] or [[mailto:delucia@gfz-potsdam.de][delucia@gfz-potsdam.de]] with the
Please split different patch types (feature, fixes, improvements ...) into patch/diff compared to your starting point. Please split different
seperate files. Also provide us the SHA of the commit you've downloaded. patch types (feature, fixes, improvements ...) into seperate files.
Also provide us the SHA of the commit you've downloaded.
Thank you for your contributions in advance! Thank you for your contributions in advance!

View File

@ -19,7 +19,7 @@ The 1D diffusion equation is:
We aim at numerically solving [[eqn:1]] on a spatial grid such as: We aim at numerically solving [[eqn:1]] on a spatial grid such as:
[[./grid_pqc.pdf]] [[./images/grid_pqc.pdf]]
The left boundary is defined on $x=0$ while the center of the first The left boundary is defined on $x=0$ while the center of the first
cell - which are the points constituting the finite difference nodes - cell - which are the points constituting the finite difference nodes -
@ -94,7 +94,6 @@ C_n^{t+1} = C_n^{t} + \frac{\alpha \cdot \Delta t}{\Delta x^2} \cdot (C^t_{n-1}
\end{equation} \end{equation}
A similar treatment can be applied to the BTCS implicit scheme. A similar treatment can be applied to the BTCS implicit scheme.
** Implicit BTCS scheme ** Implicit BTCS scheme

2629
doc/images/tug_logo.svg Normal file

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View File

@ -1,9 +1,9 @@
add_library(BTCSDiffusion BTCSDiffusion.cpp grid/BoundaryCondition.cpp) add_library(tug BTCSDiffusion.cpp grid/BoundaryCondition.cpp)
target_link_libraries(BTCSDiffusion Eigen3::Eigen) target_link_libraries(tug Eigen3::Eigen)
if(BTCS_USE_OPENMP AND OpenMP_CXX_FOUND) if(TUG_USE_OPENMP AND OpenMP_CXX_FOUND)
target_link_libraries(BTCSDiffusion OpenMP::OpenMP_CXX) target_link_libraries(tug OpenMP::OpenMP_CXX)
endif() endif()
target_include_directories(BTCSDiffusion PUBLIC ../include) target_include_directories(tug PUBLIC ../include)

View File

@ -12,4 +12,4 @@ FetchContent_MakeAvailable(DocTest)
#target_include_directories(doctest INTERFACE doctest) #target_include_directories(doctest INTERFACE doctest)
add_executable(test setup.cpp testBoundaryCondition.cpp testDiffusion.cpp) add_executable(test setup.cpp testBoundaryCondition.cpp testDiffusion.cpp)
target_link_libraries(test doctest BTCSDiffusion) target_link_libraries(test doctest tug)