Skip to content
Draft
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
61 changes: 60 additions & 1 deletion tests/test_dll.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from pathlib import Path
import subprocess
import pytest
import numpy as np

from cadet import Cadet

Expand Down Expand Up @@ -177,6 +178,16 @@ def setup_model(
}
}
)

if model == 'MULTI_CHANNEL_TRANSPORT':
cadet_model.root.input.model.unit_001.update({
'n_channel': 2,
'exchange_matrix': np.array([
[[0.0], [1e-4]],
[[0.0], [0.0]],
])
})

# if we don't save and re-load the model we get windows access violations.
# Interesting case for future tests, not what I want to test now.
cadet_model.save()
Expand Down Expand Up @@ -395,6 +406,11 @@ def run_simulation_with_options(use_dll, model_options, solution_recorder_option
'include_sensitivity': False,
}

mct_template = {
'model': 'MULTI_CHANNEL_TRANSPORT',
'ncol' :10,
}


# %% Solution recorder templates

Expand Down Expand Up @@ -1229,6 +1245,48 @@ def __repr__(self):
},
)

#TODO: Fill in expected solution for MCT
mct = Case(
name='mct',
model_options=mct_template,
solution_recorder_options=no_split,
expected_results={
'solution_times': (1501,),
'last_state_y': (92,),
'last_state_ydot': (92,),
'coordinates_unit_000': {
'axial_coordinates': (10,),
},
'coordinates_unit_001': {},
'solution_unit_000': {
'last_state_y': (84,),
'last_state_ydot': (84,),

'solution_inlet': (1501, 4),
'solution_outlet': (1501, 4),
'solution_bulk': (1501, 10, 4),
'solution_solid': (1501, 10, 4),

'soldot_inlet': (1501, 4),
'soldot_outlet': (1501, 4),
'soldot_bulk': (1501, 10, 4),
'soldot_solid': (1501, 10, 4),
},
'solution_unit_001': {
'last_state_y': (4,),
'last_state_ydot': (4,),

'solution_inlet': (1501, 4),
'solution_outlet': (1501, 4),

'soldot_inlet': (1501, 4),
'soldot_outlet': (1501, 4),

},
},
)




# %% Testing utils
Expand Down Expand Up @@ -1315,7 +1373,8 @@ def assert_shape(array_shape, expected_shape, context, key, unit_id=None):
grm_par_types,
_2dgrm,
_2dgrm_split_ports,
_2dgrm_split_all
_2dgrm_split_all,
mct
]


Expand Down
Loading