Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ git_info.txt

.venv/build2/
build2/
.venv/
4 changes: 3 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@
// Testing
"matepek.vscode-catch2-test-adapter",
"fredericbonnet.cmake-test-adapter",
"ms-python.python",

// Git
"mhutchie.git-graph",
"github.vscode-pull-request-github",

// GitHub Copilot
"github.copilot",
"github.copilot-chat"
"github.copilot-chat",
"ms-toolsai.jupyter"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [
Expand Down
4 changes: 2 additions & 2 deletions doc/fdtdjson.md
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,6 @@ This entry stores associations between `materials` and `elements` using their re
+ `<materialId>`: A single integer indicating the `id` of a material which must be present in the `materials` list.
+ `<elementIds>`: A list of `id`s of the elements to which this material will be associated.


Material associations with bulk or surface materials such as `pec`, `pmc` or `isotropic` can be assigned to one or many elements of type `cell`. If the `cell` contains `intervals` representing points, these will be ignored.

```json
Expand All @@ -573,8 +572,9 @@ Associations with cables can contain the following inputs:
+ `<initialTerminalId>` and `<endTerminalId>` which must be present within the `materials` list of type. These entries indicate the lumped circuits connected at the ends of the cable.
+ `[initialConnectorId]` and `[endConnectorId]` entries which must point to materials of type `connector` and are assigned to the last segments of the corresponding ends of the cable.
+ Its `materialId` must point to a [`wire`](#wire), a [`shieldedMultiwire`](#shieldedMultiwire) or an [`unshieldedMultiwire`](#unshieldedMultiwire) material. If it points to a `shieldedMultiwire`, it must also contain an entry named `<containedWithinElementId>` which indicates the `polyline` in which this `shieldedMultiwire` is embedded.
+ For the case of `shieldedMultiwire` and `unshieldedMultiwire`, the size of `elementIds` must match the number of conductors in the multiwire. The element pointed by these ids must be of type `polyline`. These polylines must use coordinates which are in the same places and in the same order but have different ids; this is necessary to specify the different joints.

**Example:**
**Example of an `unshieldedMultiwire` composed by a single wire:**

```json
{
Expand Down
4 changes: 2 additions & 2 deletions scripts/install-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ sudo apt install -y \


echo "=== Installing Python packages ==="
pip3 install --break-system-packages fortls
pip3 install --break-system-packages -r requirements.txt

COMPILER_VERSION="2025.1"

echo "=== Adding Intel oneAPI apt repository ==="
COMPILER_VERSION="2025.1"
KEY="GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB"
curl -fsSL "https://apt.repos.intel.com/intel-gpg-keys/$KEY" \
| sudo apt-key add -
Expand Down
63 changes: 63 additions & 0 deletions test/pyWrapper/test_full_system.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from utils import *
from typing import Dict
from pathlib import Path
import os
from sys import platform
from scipy import signal
Expand Down Expand Up @@ -1528,3 +1529,65 @@ def test_bulk_current_outputs(tmp_path):
assert probeBulkZPlane.direction == 'z'
assert probeBulkYPoint.direction == 'y'
assert probeBulkZVolume.direction == 'z'

@no_mtln_skip
@pytest.mark.mtln
def test_conductors_forming_y_on_panel_holland_vs_mtln(tmp_path):
def get_probe_file(solver, probe_name):
folder = Path(solver.getFolder())
case_name = solver.getCaseName()
files = sorted(folder.glob(f'{case_name}_{probe_name}*.dat'))
assert files, f'Probe {probe_name} not found in {folder}'
return files[0]

holland_run = tmp_path / 'holland'
mtln_run = tmp_path / 'mtln'
holland_run.mkdir()
mtln_run.mkdir()

holland_solver = FDTD(
input_filename=CASES_FOLDER + 'conductors_forming_y_on_panel/Conductors_Holland_50ohm_terminals.fdtd.json',
path_to_exe=SEMBA_EXE,
run_in_folder=holland_run
)
holland_solver.run()

mtln_solver = FDTD(
input_filename=CASES_FOLDER + 'conductors_forming_y_on_panel/Conductors_MTLN_50ohm_terminals.fdtd.json',
path_to_exe=SEMBA_EXE,
run_in_folder=mtln_run
)
mtln_solver.run()

holland_yplus = Probe(get_probe_file(holland_solver, "curr_yplus"))
holland_yminus = Probe(get_probe_file(holland_solver, "curr_yminus"))
holland_joined_1 = Probe(get_probe_file(holland_solver, "curr_joined_1"))
holland_joined_2 = Probe(get_probe_file(holland_solver, "curr_joined_2"))

mtln_yplus = Probe(get_probe_file(mtln_solver, "curr_yplus"))
mtln_yminus = Probe(get_probe_file(mtln_solver, "curr_yminus"))
mtln_joined = Probe(get_probe_file(mtln_solver, "curr_joined"))

corr_yplus = corrcoef_on_common_time(
holland_yplus['time'].to_numpy(), holland_yplus['current'].to_numpy(),
mtln_yplus['time'].to_numpy(), mtln_yplus['current'].to_numpy(),
)
corr_yminus = corrcoef_on_common_time(
holland_yminus['time'].to_numpy(), holland_yminus['current'].to_numpy(),
mtln_yminus['time'].to_numpy(), mtln_yminus['current'].to_numpy(),
)

# MTLN joined probe contains two current columns for the two conductors.
corr_j1 = corrcoef_on_common_time(
holland_joined_1['time'].to_numpy(), holland_joined_1['current'].to_numpy(),
mtln_joined['time'].to_numpy(), mtln_joined['current_0'].to_numpy(),
)
corr_j2 = corrcoef_on_common_time(
holland_joined_2['time'].to_numpy(), holland_joined_2['current'].to_numpy(),
mtln_joined['time'].to_numpy(), mtln_joined['current_1'].to_numpy(),
)

assert corr_yplus > 0.999
assert corr_yminus > 0.999
assert corr_j1 > 0.999
assert corr_j2 > 0.999
9 changes: 9 additions & 0 deletions test/pyWrapper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,12 @@ def compute_impedance(probe_path, time_exc, voltage_exc, freqs):
V_f = dtft(V_interp, time_I, freqs)
Z = V_f / I_f
return time_I, current, Z

def corrcoef_on_common_time(t_ref, y_ref, t_cmp, y_cmp):
t_ini = max(t_ref[0], t_cmp[0])
t_end = min(t_ref[-1], t_cmp[-1])
mask = (t_ref >= t_ini) & (t_ref <= t_end)
t_common = t_ref[mask]
y_ref_common = y_ref[mask]
y_cmp_interp = np.interp(t_common, t_cmp, y_cmp)
return np.corrcoef(y_ref_common, y_cmp_interp)[0, 1]
Loading
Loading