Skip to content

Commit

Permalink
minor tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
haykh committed Jun 25, 2024
1 parent 2c977ed commit 5e6f4b5
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 14 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ option(emit "Enable photon emission" OFF)
set(precision "single" CACHE STRING "Precision of the code (single or double)")
set(nghosts "2" CACHE STRING "Number of ghost cells (default 2)")
set(radiation "OFF" CACHE STRING "Radiation drag (or OFF)")
set(gca "OFF" CACHE STRING "Number of GCA iterations (or OFF)")

# -- additional configs for each option --
if (${mpi08} STREQUAL "ON")
Expand Down Expand Up @@ -239,7 +238,7 @@ message(NOTICE " Dim: ${dim}D")
message(NOTICE " ghost zones: ${nghosts}")
message(NOTICE " Load balancing: SLB=${slb} ALB=${alb}")
message(NOTICE " Particle downsampling: ${dwn}")
message(NOTICE " Particle pusher: Vay=${vay} GCA=${gca}")
message(NOTICE " Particle pusher: Vay=${vay}")
message(NOTICE " Particle payloads: ${payload}")
message(NOTICE "")
message(NOTICE "PHYSICS:")
Expand Down
35 changes: 28 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ On clusters typically all you need to do is to load the specific modules see [he

If you are, however, running on a local machine make sure to install the following prerequisites (assuming non-Intel compiler and `apt` package manager):

```shell
```sh
# gcc + openmpi
sudo apt install build-essential libopenmpi-dev
# hdf5
Expand All @@ -36,8 +36,26 @@ python3 configure.py --help
python3 configure.py -mpi08 -hdf5 --user=user_2d_rec -2d
# compile and link (-j compiles in parallel which is much faster)
make all -j
# run the code (on clusters need to do `srun`)
mpirun -np <NCORES> ./bin/tristan-mp2d -input ../inputs/input.2d_rec
# executable will be in the `bin/` directory
```

#### Cmake

Since `v2.8` we also support `cmake` for the code configuration.

```sh
# to configure the code (example)
cmake -B build -D mpi08=ON -D hdf5=ON -D user=user_2d_rec -D dim=2
# compile
cmake --build build -j
# executable will be in the `build/src/` directory (*.xc extension)
```

Running:

```sh
# run the code (on clusters need to do `srun`, or `irun` etc. depending on the cluster)
mpirun -np <NCORES> ./<EXECUTABLE> -input <INPUTFILE> -output <OUTPUTDIR>
```

#### `CMake` (experimental support)
Expand Down Expand Up @@ -95,7 +113,8 @@ The `dev/main` branch is the most up-to-date **tested** version of the code, and
### Development

Since `v2.4` code formatting policy is employed. To follow the proper formatting automatically we use the `fprettify` tool. To install `fprettify` in the local directory (via `pip`) one can use the `dev-requirements.txt` file, by running the following:
```shell

```sh
# create a local pip environment
python3 -m virtualenv venv
# activate it
Expand All @@ -105,7 +124,8 @@ pip install -r dev-requirements.txt
```

After that one can either use the tool in a stand-alone manner:
```shell

```sh
./venv/bin/fprettify -i 2 -w 4 --whitespace-assignment true --enable-decl --whitespace-decl true --whitespace-relational true --whitespace-logical true --whitespace-plusminus true --whitespace-multdiv true --whitespace-print true --whitespace-type true --whitespace-intrinsics true --enable-replacements -l 1000 [FILENAME.F90]
```
or in the VSCode environment (see the extension list in the `.vscode/settings.json` of the current repo).
Expand All @@ -131,8 +151,9 @@ or in the VSCode environment (see the extension list in the `.vscode/settings.js
__@TODO__

## Latest Releases
* `v2.8` __Jun 2024__
* `CMake` support (experimental)
* `v2.8` __Apr 2024__
* cmake support
* minor reformatting + bugfixes
* `v2.6.1` __Aug 2023__
* Fixed a buggy ordering of synchrotron cooling term and particle coordinate update (very minor correction)
* `v2.6` __Jan 2023__
Expand Down
1 change: 0 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ file(GLOB_RECURSE SOURCES *.F90)
add_executable(${executable} ${SOURCES} ${userfile})
target_include_directories(${executable} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/algorithms)
target_include_directories(${executable} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/algorithms/fieldsolvers)
target_include_directories(${executable} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/algorithms/gca)
target_include_directories(${executable} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/algorithms/vay)
target_include_directories(${executable} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/algorithms/boris)
target_include_directories(${executable} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tools)
Expand Down
9 changes: 5 additions & 4 deletions src/tools/helpers.F90
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ subroutine computeFluidVelocity(component, ds)
integer(kind=2), pointer, contiguous :: pt_xi(:), pt_yi(:), pt_zi(:)
real, pointer, contiguous :: pt_u(:), pt_v(:), pt_w(:), pt_wei(:)
integer(kind=2) :: pow, ds_, i, j, k, i1, i2, j1, j2, k1, k2
real :: contrib, comp = 0.0
real :: contrib, inv_gamma, comp = 0.0

if (.not. present(ds)) then
ds_ = 2_2
Expand Down Expand Up @@ -688,12 +688,13 @@ subroutine computeFluidVelocity(component, ds)
pt_w => species(s) % prtl_tile(ti, tj, tk) % w
do p = 1, species(s) % prtl_tile(ti, tj, tk) % npart_sp
! compute 3-velocity
inv_gamma = 1.0 / sqrt(1.0 + pt_u(p)**2 + pt_v(p)**2 + pt_w(p)**2)
if (component .eq. 0) then
comp = pt_u(p)
comp = pt_u(p) * inv_gamma
else if (component .eq. 1) then
comp = pt_v(p)
comp = pt_v(p) * inv_gamma
else if (component .eq. 2) then
comp = pt_w(p)
comp = pt_w(p) * inv_gamma
end if

i = pt_xi(p); j = pt_yi(p); k = pt_zi(p)
Expand Down

0 comments on commit 5e6f4b5

Please sign in to comment.