Skip to content

Commit

Permalink
Merge pull request #39 from OpenSEMBA/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
lmdiazangulo authored Jun 20, 2024
2 parents 0e37805 + e92e518 commit 9145040
Show file tree
Hide file tree
Showing 50 changed files with 28,529 additions and 22,583 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/automatic-release-ubuntu-gnu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ jobs:
build/bin/fdtd_tests
- name: Install python wrapper requirements
timeout-minutes: 60
run: |
python -m pip install -r requirements.txt
- name: Run wrapper tests
timeout-minutes: 60
run: |
python -m pytest test
Expand All @@ -54,7 +56,7 @@ jobs:
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest-ubuntu-gnu"
automatic_release_tag: "${{ steps.date.outputs.date }}-ubuntu-gnu"
prerelease: false
title: "${{ steps.date.outputs.date }} Ubuntu GNU dev. build"
files: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/automatic-release-windows-intelLLVM.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Run all tests
shell: bash
timeout-minutes: 30
timeout-minutes: 120
run: |
.github/workflows/run_tests_windows.bat
Expand All @@ -74,7 +74,7 @@ jobs:
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest-windows-intelLLVM"
automatic_release_tag: "${{ steps.date.outputs.date }}-windows-intelLLVM"
prerelease: false
title: "${{ steps.date.outputs.date }} Windows Intel LLVM dev. build"
files: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ubuntu-intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
cmake --build build -j
- name: Run fdtd unit tests
timeout-minutes: 10
timeout-minutes: 60
run: |
build/bin/fdtd_tests
Expand All @@ -77,7 +77,7 @@ jobs:
python -m pip install -r requirements.txt
- name: Run wrapper tests
timeout-minutes: 30
timeout-minutes: 60
run: |
python -m pytest test
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ubuntu-intelLLVM.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
cmake --build build -j
- name: Run fdtd unit tests
timeout-minutes: 10
timeout-minutes: 60
run: |
build/bin/fdtd_tests
Expand All @@ -75,7 +75,7 @@ jobs:
python -m pip install -r requirements.txt
- name: Run wrapper tests
timeout-minutes: 30
timeout-minutes: 60
run: |
python -m pytest test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-intelLLVM.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- name: Run all tests
shell: bash
timeout-minutes: 30
timeout-minutes: 120
run: |
.github/workflows/run_tests_windows.bat
Expand Down
4 changes: 4 additions & 0 deletions doc/smbjson.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ This object must always be present and contains general information regarding th
+ `<timeStep>`: A real number indicating the time step used by the solver, in seconds.
+ `<numberOfSteps>`: An integer for the number of steps which the solver will iterate.

Addtionally, it may contain the following optional entry:

+ `<mtlnProblem>` : A bool indicating whether the problem is a pure MTLN problem and will solved using only the MTLN solver. If it is not present, its default value is `false`

**Example:**

```json
Expand Down
2 changes: 2 additions & 0 deletions src_json_parser/labels_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ module labels_mod
character (len=*), parameter :: J_MAT_TRANSFER_IMPEDANCE_DIRECTION = "direction"
character (len=*), parameter :: J_MAT_TRANSFER_IMPEDANCE_POLES = "poles"
character (len=*), parameter :: J_MAT_TRANSFER_IMPEDANCE_RESIDUES = "residues"
character (len=*), parameter :: J_MAT_TRANSFER_IMPEDANCE_NUMBER_POLES = "numberOfPoles"

! -- Mesh and geometry.
character (len=*), parameter :: J_MESH = "mesh"
Expand All @@ -100,6 +101,7 @@ module labels_mod
character (len=*), parameter :: J_GENERAL = "general"
character (len=*), parameter :: J_GEN_TIME_STEP = "timeStep"
character (len=*), parameter :: J_GEN_NUMBER_OF_STEPS = "numberOfSteps"
character (len=*), parameter :: J_GEN_MTLN_PROBLEM = "mtlnProblem"


! type(Frontera)
Expand Down
113 changes: 95 additions & 18 deletions src_json_parser/smbjson.F90
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ module smbjson
!
procedure :: readMTLN
!
procedure :: getLogicalAt
procedure :: getIntAt
procedure :: getIntsAt
procedure :: getRealAt
Expand Down Expand Up @@ -269,6 +270,7 @@ function readGeneral(this) result (res)
type(NFDEGeneral) :: res
res%dt = this%getRealAt(this%root, J_GENERAL//'.'//J_GEN_TIME_STEP)
res%nmax = this%getRealAt(this%root, J_GENERAL//'.'//J_GEN_NUMBER_OF_STEPS)
res%mtlnProblem = this%GetLogicalAt(this%root, J_GENERAL//'.'//J_GEN_MTLN_PROBLEM, default = .false.)
end function

function readMediaMatrix(this) result(res)
Expand Down Expand Up @@ -661,10 +663,15 @@ function readMoreProbes(this) result (res)
type(MasSondas) :: res
type(json_value), pointer :: allProbes
type(json_value_ptr), dimension(:), allocatable :: ps

integer :: i
character (len=*), dimension(2), parameter :: validTypes = &
[J_PR_TYPE_POINT, J_PR_TYPE_WIRE]
character (len=*), dimension(1), parameter :: validFields = &
[J_FIELD_CURRENT]
logical :: found
character (len=:), allocatable :: fieldLbl
integer :: filtered_size, n

call this%core%get(this%root, J_PROBES, allProbes, found)
if (.not. found) then
Expand All @@ -676,9 +683,23 @@ function readMoreProbes(this) result (res)
end if

ps = this%jsonValueFilterByKeyValues(allProbes, J_TYPE, validTypes)
allocate(res%collection(size(ps)))

filtered_size = 0
do i=1, size(ps)
res%collection(i) = readProbe(ps(i)%p)
call this%core%get(ps(i)%p, J_FIELD, fieldLbl)
if (fieldLbl /= J_FIELD_VOLTAGE) then
filtered_size = filtered_size + 1
end if
end do

n = 1
allocate(res%collection(filtered_size))
do i=1, size(ps)
call this%core%get(ps(i)%p, J_FIELD, fieldLbl)
if (fieldLbl /= J_FIELD_VOLTAGE) then
res%collection(n) = readProbe(ps(i)%p)
n = n + 1
end if
end do

res%length = size(res%collection)
Expand All @@ -693,9 +714,12 @@ function readProbe(p) result (res)
type(pixel_t) :: pixel

integer, dimension(:), allocatable :: elemIds
logical :: elementIdsFound, typeLabelFound, dirLabelsFound, fieldLabelFound
logical :: elementIdsFound, typeLabelFound, dirLabelsFound, fieldLabelFound, nameFound

call this%core%get(p, J_NAME, outputName)
call this%core%get(p, J_NAME, outputName, found = nameFound)
if (.not. nameFound) then
write(error_unit, *) "ERROR: name entry not found for probe."
end if
res%outputrequest = trim(adjustl(outputName))
call setDomain(res, this%getDomain(p, J_PR_DOMAIN))

Expand Down Expand Up @@ -1449,6 +1473,7 @@ function readMTLN(this, grid) result (mtln_res)
mtln_res%connectors => readConnectors()
call addConnIdToConnectorMap(connIdToConnector, mtln_res%connectors)

if (countNumberOfMultiwires(cables) /= 0) mtln_res%has_multiwires = .true.

allocate (mtln_res%cables(countNumberOfWires(cables) + countNumberOfMultiwires(cables)))
block
Expand Down Expand Up @@ -1476,11 +1501,15 @@ function readMTLN(this, grid) result (mtln_res)
if (size(cables) /= 0) then
do i = 1, size(cables)
if (isMultiwire(cables(i)%p)) then
parentId = this%getIntAt(cables(i)%p, J_MAT_ASS_CAB_CONTAINED_WITHIN_ID)
call elemIdToCable%get(key(parentId), value=index)
mtln_res%cables(j)%parent_cable => mtln_res%cables(index)

mtln_res%cables(j)%conductor_in_parent = getParentPositionInMultiwire(parentId)
parentId = this%getIntAt(cables(i)%p, J_MAT_ASS_CAB_CONTAINED_WITHIN_ID, default=0)
if (parentId == 0) then
mtln_res%cables(j)%parent_cable => null()
mtln_res%cables(j)%conductor_in_parent = 0
else
call elemIdToCable%get(key(parentId), value=index)
mtln_res%cables(j)%parent_cable => mtln_res%cables(index)
mtln_res%cables(j)%conductor_in_parent = getParentPositionInMultiwire(parentId)
end if
else if (isWire(cables(i)%p)) then
mtln_res%cables(j)%parent_cable => null()
mtln_res%cables(j)%conductor_in_parent = 0
Expand Down Expand Up @@ -1888,6 +1917,7 @@ function readWireProbes() result(res)
type(node_t) :: node
type(cable_t), pointer :: cable_ptr
integer :: index
type(coordinate_t) :: node_coord
if (this%existsAt(this%root, J_PROBES)) then
call this%core%get(this%root, J_PROBES, probes)
else
Expand All @@ -1907,12 +1937,14 @@ function readWireProbes() result(res)
do i = 1, size(wire_probes)
elemIds = this%getIntsAt(wire_probes(i)%p, J_ELEMENTIDS)
node = this%mesh%getNode(elemIds(1))
node_coord = this%mesh%getCoordinate(node%coordIds(1))
do j = 1, size(polylines)
polylinecIds = this%getIntsAt(polylines(j)%p, J_COORDINATE_IDS)
position = findloc(polylinecIds, node%coordIds(1), dim=1)
if (position /= 0) then ! polyline found
res(k)%probe_type = readProbeType(wire_probes(i)%p)

res(k)%probe_name = readProbeName(wire_probes(i)%p)
res(k)%probe_position = node_coord%position
call elemIdToCable%get(key(this%getIntAt(polylines(j)%p, J_ID)), value=index)
cable_ptr => mtln_res%cables(index)
do while (associated(cable_ptr%parent_cable))
Expand Down Expand Up @@ -1966,6 +1998,16 @@ function readProbeType(probe) result(res)
end if
end function

function readProbeName(probe) result(res)
type(json_value), pointer :: probe
character(:), allocatable :: res
if (this%existsAt(probe, J_NAME)) then
res = this%getStrAt(probe, J_NAME)
else
res = ""
end if
end function

function findProbeIndex(polyline_cIds, node_position) result(res)
integer, dimension(:), intent(in) :: polyline_cIds
integer, intent(in) :: node_position
Expand Down Expand Up @@ -2376,7 +2418,6 @@ function readTransferImpedance(z) result(res)
type(json_value), pointer :: z
type(transfer_impedance_per_meter_t) :: res
character(len=:), allocatable :: direction

if (this%existsAt(z, J_MAT_TRANSFER_IMPEDANCE_RESISTANCE)) then
res%resistive_term = this%getRealAt(z,J_MAT_TRANSFER_IMPEDANCE_RESISTANCE)
end if
Expand All @@ -2398,10 +2439,34 @@ function readTransferImpedance(z) result(res)
else if (direction == "both") then
res%direction = TRANSFER_IMPEDANCE_DIRECTION_BOTH
end if
allocate(res%poles(0),res%residues(0))
!ToDo
! res%poles = this%getRealsAt(z,J_MAT_TRANSFER_IMPEDANCE_POLES)
! res%residues = this%getRealsAt(z,J_MAT_TRANSFER_IMPEDANCE_RESIDUES)

block
type(json_value), pointer :: poles, residues, p, r
integer :: i, n
real :: read_value
if (this%existsAt(z, J_MAT_TRANSFER_IMPEDANCE_POLES)) then
n = this%getIntAt(z, J_MAT_TRANSFER_IMPEDANCE_NUMBER_POLES)
allocate(res%poles(n),res%residues(n))
call this%core%get(z, J_MAT_TRANSFER_IMPEDANCE_POLES, poles)
call this%core%get(z, J_MAT_TRANSFER_IMPEDANCE_RESIDUES, residues)
do i = 1, n
call this%core%get_child(poles, i, p)
call this%core%get(p, '(1)', read_value)
res%poles(i)%re = read_value
call this%core%get(p, '(2)', read_value)
res%poles(i)%im = read_value

call this%core%get_child(residues, i, r)
call this%core%get(r, '(1)', read_value)
res%residues(i)%re = read_value
call this%core%get(r, '(2)', read_value)
res%residues(i)%im = read_value
end do
else
allocate(res%poles(0),res%residues(0))
end if

end block
end function

function noTransferImpedance() result(res)
Expand Down Expand Up @@ -2516,15 +2581,27 @@ logical function isWire(cable)
end function


function getLogicalAt(this, place, path, found, default) result(res)
logical :: res
class(parser_t) :: this
type(json_value), pointer :: place
character(len=*) :: path
logical, intent(out), optional :: found
logical, optional :: default

call this%core%get(place, path, res, found, default)
end function


function getIntAt(this, place, path, found) result(res)
function getIntAt(this, place, path, found, default) result(res)
integer :: res
class(parser_t) :: this
type(json_value), pointer :: place
character(len=*) :: path
logical, intent(out), optional :: found
call this%core%get(place, path, res, found)
integer, optional :: default

call this%core%get(place, path, res, found, default)
end function

function getIntsAt(this, place, path, found) result(res)
Expand Down Expand Up @@ -2699,4 +2776,4 @@ function getSingleVolumeInElementsIds(this, pw) result (res)
if (size(res) /= 1) &
write(error_unit, *) "Entity must contain a single cell region defining a volume."
end function
end module
end module
5 changes: 4 additions & 1 deletion src_main_pub/fdetypes.F90
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ module FDETYPES

integer(kind=4) :: quienmpi,tamaniompi
integer(kind=4) :: SUBCOMM_MPI

!240424 para que funcionen las sondas slice de conformal lo pongo como general. niapaa. algun dia hay que reahacer el conformal
!y esto debe desaparecer
integer(kind=4) :: SUBCOMM_MPI_conformal_probes,MPI_conformal_probes_root
!!!

#if (defined MaxCores)
integer(kind=4), parameter :: maxcores = MaxCores
Expand Down
Loading

0 comments on commit 9145040

Please sign in to comment.