Skip to content

Commit 1dd2abc

Browse files
authored
Merge pull request #213 from OpenSEMBA/dev
Dev
2 parents 7bb8990 + 75f979a commit 1dd2abc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+4893
-1577
lines changed

doc/smbjson.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -527,26 +527,29 @@ As with the rest of terminations, SPICE terminations have to be equivalents to 2
527527
### `connector`
528528

529529
The `connector` represents the physical connection of a bundle to a structure. `connector` assigns properties to the initial or last segment of a `wire`, a `shieldedMultiwire` or an `unshieldedMultiwire`.
530-
This `wire` can be either a single wire or the outermost conductor of a `cable` bundle. The `conector` can have the following properties:
530+
This `wire` can be either a single wire or the outermost conductor of a `cable` bundle. The `connector` can have the following properties:
531531

532-
+ `[resistances]`, an array of $N$ real numbers which will be converted to resistances per unit length and will replace the resistancePerMeter of that segment.
533-
+ `[transferImpedancePerMeter]`, described in the same way as explained in the [shieldedMultiwire](#shieldedMultiwire) section. Only valid in a `connector` associated with `shieldedMultiwire`.
532+
+ `[resistances]`, an array of real numbers which will be converted to resistances per unit length and will replace the resistancePerMeter of that segment.
533+
+ `[transferImpedancesPerMeter]`, an array of [transferImpedancePerMeter], as described in the [shieldedMultiwire](#shieldedMultiwire) section.
534534

535+
The most common situation will be having the connector of a shielded bundle. In that case, the arrays have a single component. However, the `connector` can describe the connections of a (unshielded) bundle of $N$ shielded conductors. In that case, the `connector` has to describe the connections, if any, of the $N$ shielded conductors.
535536

536537

537538
**Example:**
538539

539540
```json
540541
{
541-
"name": "SegmentConnector1",
542+
"name": "SegmentConnector",
542543
"id": 204,
543544
"type": "connector",
544-
"resistance": 100e-3,
545-
"transferImpedancePerMeter" : {
545+
"resistances": [100e-3],
546+
"transferImpedancesPerMeter" : [
547+
{
546548
"resistiveTerm" : 3.33,
547549
"inductiveTerm" : 2.6e-9,
548550
"direction" : "inwards"
549-
}
551+
}
552+
]
550553
}
551554
```
552555

src_json_parser/smbjson.F90

Lines changed: 12 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2427,10 +2427,10 @@ subroutine stopOnRepeteadName(cable, cables, n)
24272427

24282428
function readConnectors() result(res)
24292429
type(connector_t), dimension(:), pointer :: res
2430-
type(json_value), pointer :: mat, z
2430+
type(json_value), pointer :: mat, z, zs
24312431
logical :: materialsFound
24322432
type(json_value_ptr), dimension(:), allocatable :: connectors
2433-
integer :: i, id
2433+
integer :: i, j, id, n
24342434

24352435
call this%core%get(this%root, J_MATERIALS, mat, materialsFound)
24362436
if (.not. materialsFound) then
@@ -2449,11 +2449,17 @@ function readConnectors() result(res)
24492449
allocate(res(i)%resistances(0))
24502450
end if
24512451

2452-
if (this%existsAt(connectors(i)%p, J_MAT_CONN_TRANSFER_IMPEDANCE)) then
2453-
call this%core%get(connectors(i)%p, J_MAT_MULTIWIRE_TRANSFER_IMPEDANCE, z)
2454-
res(i)%transfer_impedance_per_meter = readTransferImpedance(z)
2452+
if (this%existsAt(connectors(i)%p, J_MAT_CONN_TRANSFER_IMPEDANCES)) then
2453+
call this%core%get(connectors(i)%p, J_MAT_CONN_TRANSFER_IMPEDANCES, zs)
2454+
n = this%core%count(zs)
2455+
allocate(res(i)%transfer_impedances_per_meter(n))
2456+
do j = 1, n
2457+
call this%core%get_child(zs, j, z)
2458+
res(i)%transfer_impedances_per_meter(j) = readTransferImpedance(z)
2459+
end do
24552460
else
2456-
res(i)%transfer_impedance_per_meter = noTransferImpedance()
2461+
allocate(res(i)%transfer_impedances_per_meter(0))
2462+
! res(i)%transfer_impedance_per_meter = noTransferImpedance()
24572463
end if
24582464

24592465
end do
@@ -3289,43 +3295,6 @@ function buildTransferImpedance(mat) result(res)
32893295
end if
32903296
end function
32913297

3292-
!needs correction
3293-
function buildConnector(j_cable, side) result(res)
3294-
type(json_value), pointer :: j_cable
3295-
character(*), intent(in) :: side
3296-
type(connector_t), pointer :: res
3297-
type(connector_t), target :: res_conn
3298-
type(json_value_ptr) :: conn
3299-
type(json_value), pointer :: z
3300-
type(json_value), pointer :: c_ptr
3301-
3302-
logical :: found
3303-
character(:), allocatable :: name, type
3304-
integer :: id
3305-
real, dimension(:), allocatable :: rs
3306-
if (this%existsAt(j_cable, side)) then
3307-
conn = this%matTable%getId(this%getIntAt(j_cable, side))
3308-
3309-
if (this%existsAt(conn%p, J_MAT_CONN_RESISTANCES)) then
3310-
res_conn%resistances = this%getRealsAt(conn%p, J_MAT_CONN_RESISTANCES)
3311-
else
3312-
allocate(res_conn%resistances(0))
3313-
call WarnErrReport("Error reading connector: no resistances label found")
3314-
end if
3315-
3316-
if (this%existsAt(conn%p, J_MAT_MULTIWIRE_TRANSFER_IMPEDANCE)) then
3317-
call this%core%get(conn%p, J_MAT_MULTIWIRE_TRANSFER_IMPEDANCE, z)
3318-
res_conn%transfer_impedance_per_meter = readTransferImpedance(z)
3319-
else
3320-
res_conn%transfer_impedance_per_meter = noTransferImpedance()
3321-
call WarnErrReport("Error reading connector: no transferImpedancePerMeter label found")
3322-
end if
3323-
res => res_conn
3324-
else
3325-
res => null()
3326-
end if
3327-
end function
3328-
33293298
subroutine assignPULProperties(res, mat, n)
33303299
type(shielded_multiwire_t), intent(inout) :: res
33313300
type(json_value_ptr) :: mat

src_json_parser/smbjson_labels.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ module smbjson_labels_mod
119119

120120
! -- connector
121121
character (len=*), parameter :: J_MAT_CONN_RESISTANCES = "resistances"
122-
character (len=*), parameter :: J_MAT_CONN_TRANSFER_IMPEDANCE = "transferImpedancePerMeter"
122+
character (len=*), parameter :: J_MAT_CONN_TRANSFER_IMPEDANCES = "transferImpedancesPerMeter"
123123

124124
! -- transferImpedancePerMeter
125125
character (len=*), parameter :: J_MAT_TRANSFER_IMPEDANCE_RESISTANCE = "resistiveTerm"

src_main_pub/anisotropic.F90

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,11 @@ module Anisotropic
6262
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6363
! Subroutine to initialize the parameters
6464
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
65-
subroutine InitAnisotropic(sgg,sggmiex,sggmiey,sggmiez,sggMiHx ,sggMiHy ,sggMiHz,ThereAreAnisotropic,ThereAreThinSlot,eps00,mu00)
65+
subroutine InitAnisotropic(sgg,media,ThereAreAnisotropic,ThereAreThinSlot,eps00,mu00)
6666
REAL (KIND=RKIND) :: eps00,mu00
6767
type (SGGFDTDINFO), intent(IN) , target :: sgg
68+
type(media_matrices_t), intent(in) :: media
6869
!!!
69-
integer (KIND=INTEGERSIZEOFMEDIAMATRICES), intent(in) :: &
70-
sggMiEx(sgg%alloc(iEx)%XI : sgg%alloc(iEx)%XE,sgg%alloc(iEx)%YI : sgg%alloc(iEx)%YE,sgg%alloc(iEx)%ZI : sgg%alloc(iEx)%ZE), &
71-
sggMiEy(sgg%alloc(iEy)%XI : sgg%alloc(iEy)%XE,sgg%alloc(iEy)%YI : sgg%alloc(iEy)%YE,sgg%alloc(iEy)%ZI : sgg%alloc(iEy)%ZE), &
72-
sggMiEz(sgg%alloc(iEz)%XI : sgg%alloc(iEz)%XE,sgg%alloc(iEz)%YI : sgg%alloc(iEz)%YE,sgg%alloc(iEz)%ZI : sgg%alloc(iEz)%ZE), &
73-
sggMiHx(sgg%alloc(iHx)%XI : sgg%alloc(iHx)%XE,sgg%alloc(iHx)%YI : sgg%alloc(iHx)%YE,sgg%alloc(iHx)%ZI : sgg%alloc(iHx)%ZE), &
74-
sggMiHy(sgg%alloc(iHy)%XI : sgg%alloc(iHy)%XE,sgg%alloc(iHy)%YI : sgg%alloc(iHy)%YE,sgg%alloc(iHy)%ZI : sgg%alloc(iHy)%ZE), &
75-
sggMiHz(sgg%alloc(iHz)%XI : sgg%alloc(iHz)%XE,sgg%alloc(iHz)%YI : sgg%alloc(iHz)%YE,sgg%alloc(iHz)%ZI : sgg%alloc(iHz)%ZE)
76-
7770

7871
type (Anisotropic_t), pointer :: DummyAnisProp,dummyAnisShared
7972

@@ -123,7 +116,7 @@ subroutine InitAnisotropic(sgg,sggmiex,sggmiey,sggmiez,sggMiHx ,sggMiHy ,sggMiHz
123116
Do k1=sgg%SINPMLSweep(iEx)%ZI,sgg%SINPMLSweep(iEx)%ZE
124117
Do j1=sgg%SINPMLSweep(iEx)%YI,sgg%SINPMLSweep(iEx)%YE
125118
Do i1=sgg%SINPMLSweep(iEx)%XI,sgg%SINPMLSweep(iEx)%XE
126-
if ((sggMiEx(i1,j1,k1)) == tempindex) conta=conta+1
119+
if ((media%sggMiEx(i1,j1,k1)) == tempindex) conta=conta+1
127120
end do
128121
end do
129122
end do
@@ -140,7 +133,7 @@ subroutine InitAnisotropic(sgg,sggmiex,sggmiey,sggmiez,sggMiHx ,sggMiHy ,sggMiHz
140133
Do k1=sgg%SINPMLSweep(iEx)%ZI,sgg%SINPMLSweep(iEx)%ZE
141134
Do j1=sgg%SINPMLSweep(iEx)%YI,sgg%SINPMLSweep(iEx)%YE
142135
Do i1=sgg%SINPMLSweep(iEx)%XI,sgg%SINPMLSweep(iEx)%XE
143-
if ((sggMiEx(i1,j1,k1))==tempindex) then
136+
if ((media%sggMiEx(i1,j1,k1))==tempindex) then
144137
conta=conta+1
145138
AniMed%info(jmed)%Ex_Shared(conta)%times = 1
146139
AniMed%info(jmed)%Ex_i(conta)=i1
@@ -155,7 +148,7 @@ subroutine InitAnisotropic(sgg,sggmiex,sggmiey,sggmiez,sggMiHx ,sggMiHy ,sggMiHz
155148
Do k1=sgg%SINPMLSweep(iEy)%ZI,sgg%SINPMLSweep(iEy)%ZE
156149
Do j1=sgg%SINPMLSweep(iEy)%YI,sgg%SINPMLSweep(iEy)%YE
157150
Do i1=sgg%SINPMLSweep(iEy)%XI,sgg%SINPMLSweep(iEy)%XE
158-
if ((sggMiEy(i1,j1,k1)) == tempindex) conta=conta+1
151+
if ((media%sggMiEy(i1,j1,k1)) == tempindex) conta=conta+1
159152
end do
160153
end do
161154
end do
@@ -172,7 +165,7 @@ subroutine InitAnisotropic(sgg,sggmiex,sggmiey,sggmiez,sggMiHx ,sggMiHy ,sggMiHz
172165
Do k1=sgg%SINPMLSweep(iEy)%ZI,sgg%SINPMLSweep(iEy)%ZE
173166
Do j1=sgg%SINPMLSweep(iEy)%YI,sgg%SINPMLSweep(iEy)%YE
174167
Do i1=sgg%SINPMLSweep(iEy)%XI,sgg%SINPMLSweep(iEy)%XE
175-
if ((sggMiEy(i1,j1,k1))==tempindex) then
168+
if ((media%sggMiEy(i1,j1,k1))==tempindex) then
176169
conta=conta+1
177170
AniMed%info(jmed)%Ey_Shared(conta)%times = 1
178171
AniMed%info(jmed)%Ey_i(conta)=i1
@@ -187,7 +180,7 @@ subroutine InitAnisotropic(sgg,sggmiex,sggmiey,sggmiez,sggMiHx ,sggMiHy ,sggMiHz
187180
Do k1=sgg%SINPMLSweep(iEz)%ZI,sgg%SINPMLSweep(iEz)%ZE
188181
Do j1=sgg%SINPMLSweep(iEz)%YI,sgg%SINPMLSweep(iEz)%YE
189182
Do i1=sgg%SINPMLSweep(iEz)%XI,sgg%SINPMLSweep(iEz)%XE
190-
if ((sggMiEz(i1,j1,k1)) == tempindex) conta=conta+1
183+
if ((media%sggMiEz(i1,j1,k1)) == tempindex) conta=conta+1
191184
end do
192185
end do
193186
end do
@@ -204,7 +197,7 @@ subroutine InitAnisotropic(sgg,sggmiex,sggmiey,sggmiez,sggMiHx ,sggMiHy ,sggMiHz
204197
Do k1=sgg%SINPMLSweep(iEz)%ZI,sgg%SINPMLSweep(iEz)%ZE
205198
Do j1=sgg%SINPMLSweep(iEz)%YI,sgg%SINPMLSweep(iEz)%YE
206199
Do i1=sgg%SINPMLSweep(iEz)%XI,sgg%SINPMLSweep(iEz)%XE
207-
if ((sggMiEz(i1,j1,k1))==tempindex) then
200+
if ((media%sggMiEz(i1,j1,k1))==tempindex) then
208201
conta=conta+1
209202
AniMed%info(jmed)%Ez_Shared(conta)%times = 1
210203
AniMed%info(jmed)%Ez_i(conta)=i1
@@ -220,7 +213,7 @@ subroutine InitAnisotropic(sgg,sggmiex,sggmiey,sggmiez,sggMiHx ,sggMiHy ,sggMiHz
220213
Do k1=sgg%SINPMLSweep(iHx)%ZI,sgg%SINPMLSweep(iHx)%ZE
221214
Do j1=sgg%SINPMLSweep(iHx)%YI,sgg%SINPMLSweep(iHx)%YE
222215
Do i1=sgg%SINPMLSweep(iHx)%XI,sgg%SINPMLSweep(iHx)%XE
223-
if ((sggMiHx(i1,j1,k1)) == tempindex) conta=conta+1
216+
if ((media%sggMiHx(i1,j1,k1)) == tempindex) conta=conta+1
224217
end do
225218
end do
226219
end do
@@ -237,7 +230,7 @@ subroutine InitAnisotropic(sgg,sggmiex,sggmiey,sggmiez,sggMiHx ,sggMiHy ,sggMiHz
237230
Do k1=sgg%SINPMLSweep(iHx)%ZI,sgg%SINPMLSweep(iHx)%ZE
238231
Do j1=sgg%SINPMLSweep(iHx)%YI,sgg%SINPMLSweep(iHx)%YE
239232
Do i1=sgg%SINPMLSweep(iHx)%XI,sgg%SINPMLSweep(iHx)%XE
240-
if ((sggMiHx(i1,j1,k1))==tempindex) then
233+
if ((media%sggMiHx(i1,j1,k1))==tempindex) then
241234
conta=conta+1
242235
AniMed%info(jmed)%Hx_Shared(conta)%times = 1
243236
AniMed%info(jmed)%Hx_i(conta)=i1
@@ -252,7 +245,7 @@ subroutine InitAnisotropic(sgg,sggmiex,sggmiey,sggmiez,sggMiHx ,sggMiHy ,sggMiHz
252245
Do k1=sgg%SINPMLSweep(iHy)%ZI,sgg%SINPMLSweep(iHy)%ZE
253246
Do j1=sgg%SINPMLSweep(iHy)%YI,sgg%SINPMLSweep(iHy)%YE
254247
Do i1=sgg%SINPMLSweep(iHy)%XI,sgg%SINPMLSweep(iHy)%XE
255-
if ((sggMiHy(i1,j1,k1)) == tempindex) conta=conta+1
248+
if ((media%sggMiHy(i1,j1,k1)) == tempindex) conta=conta+1
256249
end do
257250
end do
258251
end do
@@ -269,7 +262,7 @@ subroutine InitAnisotropic(sgg,sggmiex,sggmiey,sggmiez,sggMiHx ,sggMiHy ,sggMiHz
269262
Do k1=sgg%SINPMLSweep(iHy)%ZI,sgg%SINPMLSweep(iHy)%ZE
270263
Do j1=sgg%SINPMLSweep(iHy)%YI,sgg%SINPMLSweep(iHy)%YE
271264
Do i1=sgg%SINPMLSweep(iHy)%XI,sgg%SINPMLSweep(iHy)%XE
272-
if ((sggMiHy(i1,j1,k1))==tempindex) then
265+
if ((media%sggMiHy(i1,j1,k1))==tempindex) then
273266
conta=conta+1
274267
AniMed%info(jmed)%Hy_Shared(conta)%times = 1
275268
AniMed%info(jmed)%Hy_i(conta)=i1
@@ -284,7 +277,7 @@ subroutine InitAnisotropic(sgg,sggmiex,sggmiey,sggmiez,sggMiHx ,sggMiHy ,sggMiHz
284277
Do k1=sgg%SINPMLSweep(iHz)%ZI,sgg%SINPMLSweep(iHz)%ZE
285278
Do j1=sgg%SINPMLSweep(iHz)%YI,sgg%SINPMLSweep(iHz)%YE
286279
Do i1=sgg%SINPMLSweep(iHz)%XI,sgg%SINPMLSweep(iHz)%XE
287-
if ((sggMiHz(i1,j1,k1)) == tempindex) conta=conta+1
280+
if ((media%sggMiHz(i1,j1,k1)) == tempindex) conta=conta+1
288281
end do
289282
end do
290283
end do
@@ -301,7 +294,7 @@ subroutine InitAnisotropic(sgg,sggmiex,sggmiey,sggmiez,sggMiHx ,sggMiHy ,sggMiHz
301294
Do k1=sgg%SINPMLSweep(iHz)%ZI,sgg%SINPMLSweep(iHz)%ZE
302295
Do j1=sgg%SINPMLSweep(iHz)%YI,sgg%SINPMLSweep(iHz)%YE
303296
Do i1=sgg%SINPMLSweep(iHz)%XI,sgg%SINPMLSweep(iHz)%XE
304-
if ((sggMiHz(i1,j1,k1))==tempindex) then
297+
if ((media%sggMiHz(i1,j1,k1))==tempindex) then
305298
conta=conta+1
306299
AniMed%info(jmed)%Hz_Shared(conta)%times = 1
307300
AniMed%info(jmed)%Hz_i(conta)=i1

src_main_pub/borderscpml.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ subroutine DestroyCPMLBorders
518518
do REGION=back,front
519519
if (associated(regBF(region)%Psi_Ezx)) deallocate (regBF(region)%Psi_Ezx,regBF(region)%Psi_Eyx,regBF(region)%Psi_Hzx,regBF(region)%Psi_Hyx)
520520
end do
521-
521+
if (allocated(dxe)) deallocate(dxe, dye,dze,dxh,dyh,dzh)
522522
return
523523
end subroutine DestroyCPMLBorders
524524

0 commit comments

Comments
 (0)