Skip to content

Commit

Permalink
Update ordering of multi-dimensional data
Browse files Browse the repository at this point in the history
Fixes issue with flux
  • Loading branch information
schmoelder authored and ronald-jaepel committed Apr 23, 2024
1 parent fcf79e7 commit 466cc4b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
13 changes: 7 additions & 6 deletions cadet/cadet_dll.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,16 @@ def _process_data(
dims = []

# Ordering of multi-dimensional arrays, all possible dimensions:
# Example: Outlet [nTime, nPort, nComp]
# Bulk [nTime, nAxialCells, nRadialCells, nComp] if 2D model
# Bulk [nTime, nAxialCells, nComp] if 1D model
# bulk: 'nTime', ('nAxialCells',) ('nRadialCells' / 'nPorts',) 'nComp'
# particle_liquid: 'nTime', ('nParTypes',) ('nAxialCells',) ('nRadialCells' / 'nPorts',) ('nParShells',) 'nComp'
# particle_solid: 'nTime', ('nParTypes',) ('nAxialCells',) ('nRadialCells' / 'nPorts',) ('nParShells',) 'nComp', 'nBound'
# flux: 'nTime', ('nParTypes',) ('nAxialCells',) ('nRadialCells' / 'nPorts',) 'nComp'
dimensions = [
'nTime',
'nPort',
'nParTypes',
'nAxialCells',
'nPort',
'nRadialCells',
'nParTypes',
'nParShells',
'nComp',
'nBound',
Expand All @@ -252,7 +253,7 @@ def _process_data(
return

if 'data' in call_outputs:
if 'nParShells' in dims:
if 'nParShells' in dims:
nParShells = call_outputs['nParShells'].value
if nParShells == 1:
shape.pop(dims.index('nParShells'))
Expand Down
36 changes: 18 additions & 18 deletions tests/test_dll.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,13 +457,13 @@ def __repr__(self):
'last_state_y': (164,),
'last_state_ydot': (164,),
'soldot_bulk': (1501, 10, 4),
'soldot_flux': (1501, 10, 1, 4),
'soldot_flux': (1501, 1, 10, 4),
'soldot_inlet': (1501, 4),
'soldot_outlet': (1501, 4),
'soldot_particle': (1501, 10, 4),
'soldot_solid': (1501, 10, 4),
'solution_bulk': (1501, 10, 4),
'solution_flux': (1501, 10, 1, 4),
'solution_flux': (1501, 1, 10, 4),
'solution_inlet': (1501, 4),
'solution_outlet': (1501, 4),
'solution_particle': (1501, 10, 4),
Expand Down Expand Up @@ -498,13 +498,13 @@ def __repr__(self):
'last_state_y': (404,),
'last_state_ydot': (404,),
'soldot_bulk': (1501, 10, 4),
'soldot_flux': (1501, 10, 1, 4),
'soldot_flux': (1501, 1, 10, 4),
'soldot_inlet': (1501, 4),
'soldot_outlet': (1501, 4),
'soldot_particle': (1501, 10, 4, 4),
'soldot_solid': (1501, 10, 4, 4),
'solution_bulk': (1501, 10, 4),
'solution_flux': (1501, 10, 1, 4),
'solution_flux': (1501, 1, 10, 4),
'solution_inlet': (1501, 4),
'solution_outlet': (1501, 4),
'solution_particle': (1501, 10, 4, 4),
Expand Down Expand Up @@ -539,7 +539,7 @@ def __repr__(self):
'last_state_y': (404,),
'last_state_ydot': (404,),
'soldot_bulk': (1501, 10, 4),
'soldot_flux': (1501, 10, 1, 4),
'soldot_flux': (1501, 1, 10, 4),
'soldot_inlet_port_000_comp_000': (1501,),
'soldot_inlet_port_000_comp_001': (1501,),
'soldot_inlet_port_000_comp_002': (1501,),
Expand All @@ -551,7 +551,7 @@ def __repr__(self):
'soldot_particle': (1501, 10, 4, 4),
'soldot_solid': (1501, 10, 4, 4),
'solution_bulk': (1501, 10, 4),
'solution_flux': (1501, 10, 1, 4),
'solution_flux': (1501, 1, 10, 4),
'solution_inlet_port_000_comp_000': (1501,),
'solution_inlet_port_000_comp_001': (1501,),
'solution_inlet_port_000_comp_002': (1501,),
Expand Down Expand Up @@ -604,13 +604,13 @@ def __repr__(self):
'last_state_y': (404,),
'last_state_ydot': (404,),
'soldot_bulk': (1501, 10, 4),
'soldot_flux': (1501, 10, 1, 4),
'soldot_flux': (1501, 1, 10, 4),
'soldot_inlet': (1501, 4),
'soldot_outlet': (1501, 4),
'soldot_particle': (1501, 10, 4, 4),
'soldot_solid': (1501, 10, 4, 4),
'solution_bulk': (1501, 10, 4),
'solution_flux': (1501, 10, 1, 4),
'solution_flux': (1501, 1, 10, 4),
'solution_inlet': (1501, 4),
'solution_outlet': (1501, 4),
'solution_particle': (1501, 10, 4, 4),
Expand All @@ -626,13 +626,13 @@ def __repr__(self):
},
'sens_param_000_unit_000': {
'sensdot_bulk': (1501, 10, 4),
'sensdot_flux': (1501, 10, 1, 4),
'sensdot_flux': (1501, 1, 10, 4),
'sensdot_inlet': (1501, 4),
'sensdot_outlet': (1501, 4),
'sensdot_particle': (1501, 10, 4, 4),
'sensdot_solid': (1501, 10, 4, 4),
'sens_bulk': (1501, 10, 4),
'sens_flux': (1501, 10, 1, 4),
'sens_flux': (1501, 1, 10, 4),
'sens_inlet': (1501, 4),
'sens_outlet': (1501, 4),
'sens_particle': (1501, 10, 4, 4),
Expand Down Expand Up @@ -666,15 +666,15 @@ def __repr__(self):
'last_state_y': (764,),
'last_state_ydot': (764,),
'soldot_bulk': (1501, 10, 4),
'soldot_flux': (1501, 10, 2, 4),
'soldot_flux': (1501, 2, 10, 4),
'soldot_inlet': (1501, 4),
'soldot_outlet': (1501, 4),
'soldot_particle_partype_000': (1501, 10, 4, 4),
'soldot_particle_partype_001': (1501, 10, 4, 4),
'soldot_solid_partype_000': (1501, 10, 4, 4),
'soldot_solid_partype_001': (1501, 10, 4, 4),
'solution_bulk': (1501, 10, 4),
'solution_flux': (1501, 10, 2, 4),
'solution_flux': (1501, 2, 10, 4),
'solution_inlet': (1501, 4),
'solution_outlet': (1501, 4),
'solution_particle_partype_000': (1501, 10, 4, 4),
Expand Down Expand Up @@ -711,13 +711,13 @@ def __repr__(self):
'last_state_y': (1212,),
'last_state_ydot': (1212,),
'soldot_bulk': (1501, 10, 3, 4),
'soldot_flux': (1501, 10, 3, 1, 4),
'soldot_flux': (1501, 1, 10, 3, 4),
'soldot_inlet': (1501, 3, 4),
'soldot_outlet': (1501, 3, 4),
'soldot_particle': (1501, 10, 3, 4, 4),
'soldot_solid': (1501, 10, 3, 4, 4),
'solution_bulk': (1501, 10, 3, 4),
'solution_flux': (1501, 10, 3, 1, 4),
'solution_flux': (1501, 1, 10, 3, 4),
'solution_inlet': (1501, 3, 4),
'solution_outlet': (1501, 3, 4),
'solution_particle': (1501, 10, 3, 4, 4),
Expand Down Expand Up @@ -753,7 +753,7 @@ def __repr__(self):
'last_state_y': (1212,),
'last_state_ydot': (1212,),
'soldot_bulk': (1501, 10, 3, 4),
'soldot_flux': (1501, 10, 3, 1, 4),
'soldot_flux': (1501, 1, 10, 3, 4),
'soldot_inlet_port_000': (1501, 4),
'soldot_inlet_port_001': (1501, 4),
'soldot_inlet_port_002': (1501, 4),
Expand All @@ -763,7 +763,7 @@ def __repr__(self):
'soldot_particle': (1501, 10, 3, 4, 4),
'soldot_solid': (1501, 10, 3, 4, 4),
'solution_bulk': (1501, 10, 3, 4),
'solution_flux': (1501, 10, 3, 1, 4),
'solution_flux': (1501, 1, 10, 3, 4),
'solution_inlet_port_000': (1501, 4),
'solution_inlet_port_001': (1501, 4),
'solution_inlet_port_002': (1501, 4),
Expand Down Expand Up @@ -803,7 +803,7 @@ def __repr__(self):
'last_state_y': (1212,),
'last_state_ydot': (1212,),
'soldot_bulk': (1501, 10, 3, 4),
'soldot_flux': (1501, 10, 3, 1, 4),
'soldot_flux': (1501, 1, 10, 3, 4),
'soldot_inlet_port_000_comp_000': (1501,),
'soldot_inlet_port_000_comp_001': (1501,),
'soldot_inlet_port_000_comp_002': (1501,),
Expand Down Expand Up @@ -831,7 +831,7 @@ def __repr__(self):
'soldot_particle': (1501, 10, 3, 4, 4),
'soldot_solid': (1501, 10, 3, 4, 4),
'solution_bulk': (1501, 10, 3, 4),
'solution_flux': (1501, 10, 3, 1, 4),
'solution_flux': (1501, 1, 10, 3, 4),
'solution_inlet_port_000_comp_000': (1501,),
'solution_inlet_port_000_comp_001': (1501,),
'solution_inlet_port_000_comp_002': (1501,),
Expand Down

0 comments on commit 466cc4b

Please sign in to comment.