Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #16 from OpenSEMBA/dev
Browse files Browse the repository at this point in the history
Preparing release.
  • Loading branch information
lmdiazangulo authored Apr 19, 2024
2 parents c95ff9c + 09dd65d commit 680f047
Show file tree
Hide file tree
Showing 37 changed files with 965 additions and 1,659 deletions.
90 changes: 45 additions & 45 deletions .github/workflows/ubuntu-gnu.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
name: ubuntu-gnu

permissions:
actions: write

on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev

jobs:
builds-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Setup ninja
uses: seanmiddleditch/gha-setup-ninja@master

- name: Build application
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
- name: Run fdtd unit tests
run: |
build/bin/fdtd_tests
- name: Install python wrapper requirements
run: |
python -m pip install -r requirements.txt
- name: Run wrapper tests
run: |
python -m pytest test
name: ubuntu-gnu

permissions:
actions: write

on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev

jobs:
builds-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Setup ninja
uses: seanmiddleditch/gha-setup-ninja@master

- name: Build application
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
- name: Run fdtd unit tests
run: |
build/bin/fdtd_tests
- name: Install python wrapper requirements
run: |
python -m pip install -r requirements.txt
- name: Run wrapper tests
run: |
python -m pytest test
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu-intelLLVM.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ jobs:
- name: exclude unused files from cache
if: steps.cache-install.outputs.cache-hit != 'true'
run: sh -c .github/workflows/oneapi_cache_exclude_linux.sh
run: sh -c .github/workflows/oneapi_cache_exclude_linux.sh
6 changes: 3 additions & 3 deletions .github/workflows/windows-intelLLVM.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
shell: bash
run: |
.github/workflows/build_windows.bat
- name: Install python wrapper requirements
run: |
python -m pip install -r requirements.txt
Expand All @@ -63,9 +63,9 @@ jobs:
shell: bash
run: |
.github/workflows/run_tests_windows.bat
- name: exclude unused files from cache
if: steps.cache-install.outputs.cache-hit != 'true'
shell: bash
run: .github/workflows/oneapi_cache_exclude_windows.sh
run: .github/workflows/oneapi_cache_exclude_windows.sh
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.18)

ENABLE_LANGUAGE(Fortran)
enable_language (CXX Fortran)
project(semba-fdtd Fortran)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
Expand Down Expand Up @@ -49,6 +49,7 @@ if (CompileExecutable)
"src_main_pub/magneticdispersive.F90"
"src_main_pub/maloney_nostoch.F90"
"src_main_pub/mpicomm.F90"
"src_main_pub/nfde_rotate.F90"
"src_main_pub/nodalsources.F90"
"src_main_pub/observation.F90"
"src_main_pub/planewaves.F90"
Expand All @@ -63,19 +64,20 @@ if (CompileExecutable)
"src_main_pub/version.F90"
"src_wires_pub/wires_types.F90"
"src_wires_pub/wires.F90"
"src_wires_pub/wires_mtln.F90"
)
target_link_libraries(semba-fdtd semba-types smbjson)
target_link_libraries(semba-fdtd semba-types smbjson mtlnsolver ngspice_interface ${NGSPICE_LIB})
include_directories(${CMAKE_BINARY_DIR}/mod)
endif()

if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
message(STATUS "Gfortran found...")
set(CMAKE_Fortran_FLAGS "-ffree-form -ffree-line-length-none -fdec -fcheck=bounds")
set(CMAKE_Fortran_FLAGS "-ffree-form -ffree-line-length-none -fdec -fcheck=bounds -fopenmp")
add_definitions(-DCompileWithIncludeMpifh)
endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
message(STATUS "INTEL FORTRAN found...")
set(CMAKE_Fortran_FLAGS "-fpp -check all,nouninit -debug full -traceback ")
set(CMAKE_Fortran_FLAGS "-fpp -check all,nouninit -debug full -traceback")
endif()

if (CompileWithHDF)
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ IEEE Transactions on Electromagnetic Compatibility. 2016. https://doi.org/10.110

# Usage

## Compilation
## Compilation and testing

Tests must be run from the root folder. `python` wrapper test assumes that `semba-fdtd` has been compiled successfully and is located in folder `build/bin/`. For intel compilation it also assumes that the intel runtime libraries are accessible.

## Running cases

Expand Down
4 changes: 4 additions & 0 deletions doc/smbjson.md
Original file line number Diff line number Diff line change
Expand Up @@ -592,12 +592,16 @@ If not `magnitudeFile` is specified and only one `source` is defined, the `magni
#### `movie`

Probes of type `movie` record a vector field in a volume region indicated by `elementIds`. `[field]` can be `electric`, `magnetic`, or `currentDensity`; defaults to `electric`.
`currentDensity` will store only the surface density currents on `pec` or lossy surfaces.
The stored values can be selected using `[components]`, which stores an array of the following labels `x`, `y`, `z`, or `magnitude`; if no components are specified, defaults to `magnitude`.

An example follows:
```json
{
"name": "electric_field_movie",
"type": "movie",
"field": "electric",
"components": ["x"],
"elementIds": [4]
}
```
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pytest
numpy
matplotlib
pandas
3 changes: 3 additions & 0 deletions src_json_parser/labels_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module labels_mod
character (len=*), parameter :: J_DIR_X = "x"
character (len=*), parameter :: J_DIR_Y = "y"
character (len=*), parameter :: J_DIR_Z = "z"
character (len=*), parameter :: J_DIR_M = 'magnitude'

character (len=*), parameter :: J_FIELD = "field"
character (len=*), parameter :: J_FIELD_ELECTRIC = "electric"
Expand Down Expand Up @@ -139,6 +140,8 @@ module labels_mod

character (len=*), parameter :: J_PR_POINT_DIRECTIONS = "directions"

character (len=*), parameter :: J_PR_MOVIE_COMPONENTS = "components"

character (len=*), parameter :: J_PR_FAR_FIELD_THETA = "theta"
character (len=*), parameter :: J_PR_FAR_FIELD_PHI = "phi"
character (len=*), parameter :: J_PR_FAR_FIELD_DIR_INITIAL = "initial"
Expand Down
46 changes: 26 additions & 20 deletions src_json_parser/nfdetypes_extension.F90
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ subroutine initializeProblemDescription(pD)

allocate(pD%BloquePrb)
allocate(pD%BloquePrb%bp(0))

allocate(pD%VolPrb)
allocate(pD%VolPrb%collection(0))
!
allocate(pD%tWires)
allocate(pD%tWires%tw(0))
Expand Down Expand Up @@ -766,28 +768,28 @@ elemental logical function abstractSonda_eq(a, b) result(res)
res = .false.

if (a%n_FarField /= b%n_FarField) return
if (a%n_Electric /= b%n_Electric) return
if (a%n_Magnetic /= b%n_Magnetic) return
if (a%n_NormalElectric /= b%n_NormalElectric) return
if (a%n_NormalMagnetic /= b%n_NormalMagnetic) return
if (a%n_SurfaceElectricCurrent /= b%n_SurfaceElectricCurrent) return
if (a%n_SurfaceMagneticCurrent /= b%n_SurfaceMagneticCurrent) return
! if (a%n_Electric /= b%n_Electric) return
! if (a%n_Magnetic /= b%n_Magnetic) return
! if (a%n_NormalElectric /= b%n_NormalElectric) return
! if (a%n_NormalMagnetic /= b%n_NormalMagnetic) return
! if (a%n_SurfaceElectricCurrent /= b%n_SurfaceElectricCurrent) return
! if (a%n_SurfaceMagneticCurrent /= b%n_SurfaceMagneticCurrent) return

if (.not. associated(a%FarField) .or. .not. associated(b%FarField)) return
if (.not. associated(a%Electric) .or. .not. associated(b%Electric)) return
if (.not. associated(a%Magnetic) .or. .not. associated(b%Magnetic)) return
if (.not. associated(a%NormalElectric) .or. .not. associated(b%NormalElectric)) return
if (.not. associated(a%NormalMagnetic) .or. .not. associated(b%NormalMagnetic)) return
if (.not. associated(a%SurfaceElectricCurrent) .or. .not. associated(b%SurfaceElectricCurrent)) return
if (.not. associated(a%SurfaceMagneticCurrent) .or. .not. associated(b%SurfaceMagneticCurrent)) return
! if (.not. associated(a%Electric) .or. .not. associated(b%Electric)) return
! if (.not. associated(a%Magnetic) .or. .not. associated(b%Magnetic)) return
! if (.not. associated(a%NormalElectric) .or. .not. associated(b%NormalElectric)) return
! if (.not. associated(a%NormalMagnetic) .or. .not. associated(b%NormalMagnetic)) return
! if (.not. associated(a%SurfaceElectricCurrent) .or. .not. associated(b%SurfaceElectricCurrent)) return
! if (.not. associated(a%SurfaceMagneticCurrent) .or. .not. associated(b%SurfaceMagneticCurrent)) return

if (any(.not. a%FarField == b%FarField)) return
if (any(.not. a%Electric == b%Electric)) return
if (any(.not. a%Magnetic == b%Magnetic)) return
if (any(.not. a%NormalElectric == b%NormalElectric)) return
if (any(.not. a%NormalMagnetic == b%NormalMagnetic)) return
if (any(.not. a%SurfaceElectricCurrent == b%SurfaceElectricCurrent)) return
if (any(.not. a%SurfaceMagneticCurrent == b%SurfaceMagneticCurrent)) return
! if (any(.not. a%Electric == b%Electric)) return
! if (any(.not. a%Magnetic == b%Magnetic)) return
! if (any(.not. a%NormalElectric == b%NormalElectric)) return
! if (any(.not. a%NormalMagnetic == b%NormalMagnetic)) return
! if (any(.not. a%SurfaceElectricCurrent == b%SurfaceElectricCurrent)) return
! if (any(.not. a%SurfaceMagneticCurrent == b%SurfaceMagneticCurrent)) return

res = .true.
end function abstractSonda_eq
Expand Down Expand Up @@ -915,8 +917,8 @@ end function bloqueprobes_eq

elemental logical function volprobe_eq(a, b)
type(VolProbe), intent(in) :: a, b
volprobe_eq = &
all(a%cordinates == b%cordinates(1:b%len_cor)) .and. &
volprobe_eq = all(a%cordinates == b%cordinates)
volprobe_eq = volprobe_eq .and. &
(a%tstart == b%tstart) .and. &
(a%tstop == b%tstop) .and. &
(a%tstep == b%tstep) .and. &
Expand All @@ -931,6 +933,10 @@ end function volprobe_eq

elemental logical function volprobes_eq(a, b)
type(VolProbes), intent(in) :: a, b
if (.not. associated(a%collection) .or. .not. associated(b%collection)) then
volprobes_eq = .false.
return
end if
volprobes_eq = &
(a%length == b%length) .and. &
(a%length_max == b%length_max) .and. &
Expand Down
Loading

0 comments on commit 680f047

Please sign in to comment.