Skip to content

Commit 014971d

Browse files
authored
Merge pull request #123 from OpenSEMBA/feature/sgbc
Feature/sgbc
2 parents ad33264 + c6b6e9b commit 014971d

File tree

10 files changed

+241
-105
lines changed

10 files changed

+241
-105
lines changed

src_main_pub/observation.F90

Lines changed: 145 additions & 89 deletions
Large diffs are not rendered by default.

src_main_pub/preprocess_geom.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ SUBROUTINE read_geomData (sgg,sggMtag,tag_numbers, sggMiNo,sggMiEx,sggMiEy,sggMi
284284
tag_numbers%edge%y(:,:,:) = 0
285285
tag_numbers%edge%z(:,:,:) = 0
286286
tag_numbers%face%x(:,:,:) = 0
287-
tag_numbers%face%x(:,:,:) = 0
288-
tag_numbers%face%x(:,:,:) = 0
287+
tag_numbers%face%y(:,:,:) = 0
288+
tag_numbers%face%z(:,:,:) = 0
289289
!todo sustrato por defecto
290290
sggmiNo (:, :, :) = 1
291291
sggmiEx (:, :, :) = 1

src_main_pub/timestepping.F90

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ subroutine launch_simulation(sgg,sggMtag,tag_numbers, sggMiNo,sggMiEx,sggMiEy,sg
10231023
endif
10241024

10251025
!!!!!!!sgg 121020 !rellena la matriz Mtag con los slots de una celda
1026-
call fillMtag(sgg, sggMiEx, sggMiEy, sggMiEz, sggMiHx, sggMiHy, sggMiHz,sggMtag, b)
1026+
call fillMtag(sgg, sggMiEx, sggMiEy, sggMiEz, sggMiHx, sggMiHy, sggMiHz,sggMtag, b, tag_numbers)
10271027
!!!!!!!fin
10281028

10291029
#ifdef CompileWithMPI
@@ -2806,7 +2806,7 @@ end subroutine XXXXfillMagnetic
28062806

28072807
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28082808
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2809-
subroutine fillMtag(sgg,sggMiEx, sggMiEy, sggMiEz, sggMiHx, sggMiHy, sggMiHz,sggMtag, b)
2809+
subroutine fillMtag(sgg,sggMiEx, sggMiEy, sggMiEz, sggMiHx, sggMiHy, sggMiHz,sggMtag, b, tag_numbers)
28102810

28112811
!------------------------>
28122812
type (SGGFDTDINFO), intent(IN) :: sgg
@@ -2818,6 +2818,7 @@ subroutine fillMtag(sgg,sggMiEx, sggMiEy, sggMiEz, sggMiHx, sggMiHy, sggMiHz,sgg
28182818
integer(kind = INTEGERSIZEOFMEDIAMATRICES), dimension ( 0 : b%sggMiEx%NX-1 , 0 : b%sggMiEx%NY-1 , 0 : b%sggMiEx%NZ-1 ) , intent( IN ) :: sggMiEx
28192819
integer(kind = INTEGERSIZEOFMEDIAMATRICES), dimension ( 0 : b%sggMiEy%NX-1 , 0 : b%sggMiEy%NY-1 , 0 : b%sggMiEy%NZ-1 ) , intent( IN ) :: sggMiEy
28202820
integer(kind = INTEGERSIZEOFMEDIAMATRICES), dimension ( 0 : b%sggMiEz%NX-1 , 0 : b%sggMiEz%NY-1 , 0 : b%sggMiEz%NZ-1 ) , intent( IN ) :: sggMiEz
2821+
type (taglist_t) :: tag_numbers
28212822
!------------------------> Variables locales
28222823
integer(kind = 4) :: i, j, k
28232824
integer(kind = INTEGERSIZEOFMEDIAMATRICES) :: medio1,medio2,medio3,medio4,medio5
@@ -2841,7 +2842,7 @@ subroutine fillMtag(sgg,sggMiEx, sggMiEy, sggMiEz, sggMiHx, sggMiHy, sggMiHz,sgg
28412842
mediois3= .true. !.not.((medio5==1).and.(((sggMiHx(i-1,j,k)/=1).or.(sggMiHx(i+1,j,k)/=1)))) !esta condicion en realidad no detecta alabeos de una celda que siendo slots son acoples de un agujerito solo en el peor de los casos
28422843
if ((mediois1.or.mediois2).and.(mediois3)) then
28432844
!solo lo hace con celdas de vacio porque en particular el mismo medio sgbc con diferentes orientaciones tiene distintos indices de medio y lo activaria erroneamente si lo hago para todos los medios
2844-
sggMtag(i,j,k)=-ibset(iabs(sggMtag(i,j,k)),3)
2845+
tag_numbers%face%x(i,j,k)=-ibset(iabs(tag_numbers%face%x(i,j,k)),3)
28452846
!ojo no cambiar: interacciona con observation tags 141020 !151020 a efectos de mapvtk el signo importa
28462847
endif
28472848
End do
@@ -2863,7 +2864,7 @@ subroutine fillMtag(sgg,sggMiEx, sggMiEy, sggMiEz, sggMiHx, sggMiHy, sggMiHz,sgg
28632864
mediois2= (medio5==1).and.(medio3/=1).and.(medio4/=1).and.(medio1==1).and.(medio2==1)
28642865
mediois3= .true. !.not.((medio5==1).and.(((sggMiHy(i,j-1,k)/=1).or.(sggMiHy(i,j+1,k)/=1))))
28652866
if ((mediois1.or.mediois2).and.(mediois3)) then
2866-
sggMtag(i,j,k)=-ibset(iabs(sggMtag(i,j,k)),4)
2867+
tag_numbers%face%y(i,j,k)=-ibset(iabs(tag_numbers%face%y(i,j,k)),4)
28672868
endif
28682869
End do
28692870
End do
@@ -2884,7 +2885,7 @@ subroutine fillMtag(sgg,sggMiEx, sggMiEy, sggMiEz, sggMiHx, sggMiHy, sggMiHz,sgg
28842885
mediois2= (medio5==1).and.(medio3/=1).and.(medio4/=1).and.(medio1==1).and.(medio2==1)
28852886
mediois3= .true. !.not.((medio5==1).and.(((sggMiHz(i,j,k-1)/=1).or.(sggMiHz(i,j,k+1)/=1))))
28862887
if ((mediois1.or.mediois2).and.(mediois3)) then
2887-
sggMtag(i,j,k)=-ibset(iabs(sggMtag(i,j,k)),5)
2888+
tag_numbers%face%z(i,j,k)=-ibset(iabs(tag_numbers%face%z(i,j,k)),5)
28882889
endif
28892890
End do
28902891
End do

test/pyWrapper/test_integration.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def test_tagnumbers_1_line(tmp_path):
159159
line_media_dict = createPropertyDictionary(vtkmapfile, celltype = 3, property = 'mediatype')
160160
assert line_media_dict[0.5] == 2 #PEC line
161161

162-
def test_tagnumbers_volume_and_surfacs(tmp_path):
162+
def test_tagnumbers_volume_and_surfaces(tmp_path):
163163
fn = CASES_FOLDER + 'tagNumber_mediaType/volume_and_surfaces.fdtd.json'
164164
solver = FDTD(input_filename=fn, path_to_exe=SEMBA_EXE,
165165
run_in_folder=tmp_path, flags=['-mapvtk'])
@@ -188,4 +188,23 @@ def test_tagnumbers_volume_and_surfacs(tmp_path):
188188
line_media_dict = createPropertyDictionary(vtkmapfile, celltype = 3, property = 'mediatype')
189189
assert line_media_dict[-0.5] == 4 #PMC line
190190
assert line_media_dict[0.5] == 1 #PEC line
191-
assert line_media_dict[3.5] == 3 #SGBC line
191+
assert line_media_dict[3.5] == 3 #SGBC line
192+
193+
def test_tagnumbers_count_bug(tmp_path):
194+
fn = CASES_FOLDER + 'tagNumber_mediaType/count_bug.fdtd.json'
195+
solver = FDTD(input_filename=fn, path_to_exe=SEMBA_EXE,
196+
run_in_folder=tmp_path, flags=['-mapvtk'])
197+
solver['general']['numberOfSteps'] = 1
198+
solver.run()
199+
200+
solver["materialAssociations"][0]["materialId"] = 3
201+
solver["materialAssociations"][1]["materialId"] = 1
202+
solver["materialAssociations"][2]["materialId"] = 3
203+
solver.cleanUp()
204+
solver.run()
205+
206+
solver["materialAssociations"][0]["materialId"] = 3
207+
solver["materialAssociations"][1]["materialId"] = 3
208+
solver["materialAssociations"][2]["materialId"] = 1
209+
solver.cleanUp()
210+
solver.run()

testData/cases/sgbcShieldingEffectiveness/shieldingEffectiveness.fdtd.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
],
5151

5252
"materialAssociations": [
53-
{"type": "surface", "materialId": 1, "elementIds": [4]}
53+
{"materialId": 1, "elementIds": [4]}
5454
],
5555

5656
"sources": [
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"format": "FDTD Input file",
3+
"__comments": "Example input with sgbc material",
4+
5+
"general": {
6+
"timeStep": 10e-12,
7+
"numberOfSteps": 2000
8+
},
9+
10+
"boundary": {
11+
"all": {"type": "mur"}
12+
},
13+
14+
"mesh": {
15+
"grid": {
16+
"numberOfCells": [10, 10, 10],
17+
"steps": { "x": [0.1], "y": [0.1], "z": [0.1] }
18+
},
19+
"elements": [
20+
{"id": 1, "type": "cell", "intervals": [ [ [3, 3, 3], [4, 4, 3] ] ]},
21+
{"id": 2, "type": "cell", "intervals": [ [ [3, 3, 4], [4, 4, 4] ] ]},
22+
{"id": 3, "type": "cell", "intervals": [ [ [3, 3, 3], [3, 4, 4] ] ]}
23+
]
24+
},
25+
26+
"materials": [
27+
{
28+
"type": "pec",
29+
"id": 1
30+
},
31+
{
32+
"name": "2-layers-composite",
33+
"type": "multilayeredSurface",
34+
"id": 2,
35+
"layers": [
36+
{"thickness": 1e-3, "relativePermittivity": 1.3, "electricConductivity": 2e-4},
37+
{"thickness": 5e-3, "relativePermittivity": 1.3}
38+
]
39+
},
40+
{
41+
"name": "3-layers-composite",
42+
"type": "multilayeredSurface",
43+
"id": 3,
44+
"layers": [
45+
{"thickness": 1e-3, "electricConductivity": 2e-4},
46+
{"thickness": 5e-3, "relativePermeability": 1.3},
47+
{"thickness": 1e-3, "magneticConductivity": 1e-4}
48+
]
49+
}
50+
],
51+
52+
"materialAssociations": [
53+
{
54+
"materialId": 1,
55+
"elementIds": [ 3 ]
56+
},
57+
{
58+
"materialId": 3,
59+
"elementIds": [ 1 ]
60+
},
61+
{
62+
"materialId": 3,
63+
"elementIds": [ 2 ]
64+
}
65+
]
66+
}

testData/cases/tagNumber_mediaType/three_surfaces.fdtd.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,10 @@
5555
"elementIds": [ 1 ]
5656
},
5757
{
58-
"type": "surface",
5958
"materialId": 2,
6059
"elementIds": [ 2 ]
6160
},
6261
{
63-
"type": "surface",
6462
"materialId": 3,
6563
"elementIds": [ 3 ]
6664
}

testData/input_examples/airplane.fdtd.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10719,7 +10719,6 @@
1071910719
],
1072010720
"materialAssociations": [
1072110721
{
10722-
"type": "surface",
1072310722
"materialId": 1,
1072410723
"elementIds": [
1072510724
7

testData/input_examples/large_airplane_mtln.fdtd.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46856,7 +46856,6 @@
4685646856
],
4685746857
"materialAssociations": [
4685846858
{
46859-
"type": "surface",
4686046859
"materialId": 1,
4686146860
"elementIds": [
4686246861
7,

testData/input_examples/sgbc.fdtd.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,10 @@
5555
"elementIds": [ 1 ]
5656
},
5757
{
58-
"type": "surface",
5958
"materialId": 2,
6059
"elementIds": [ 2 ]
6160
},
6261
{
63-
"type": "surface",
6462
"materialId": 3,
6563
"elementIds": [ 3 ]
6664
}

0 commit comments

Comments
 (0)