13
13
_2DGRM
14
14
)
15
15
16
+ from CADETPythonSimulator .rejection import StepCutOff
16
17
17
18
# %% Unit Operation Fixtures
18
19
class TwoComponentFixture (CPSComponentSystem ):
19
20
def __init__ (self , * args , ** kwargs ):
20
21
super ().__init__ (* args , ** kwargs )
21
22
22
- self .add_component ('A' , molecular_weight = 1e3 , density = 1e3 )
23
- self .add_component ('B' , molecular_weight = 10e3 , density = 1e3 )
23
+ self .add_component ('A' , molecular_weight = 1e3 , density = 1e3 , molecular_volume = 1 )
24
+ self .add_component ('B' , molecular_weight = 10e3 , density = 1e3 , molecular_volume = 1 )
24
25
25
26
26
27
class UnitOperationFixture (UnitOperationBase ):
@@ -76,14 +77,18 @@ def __init__(self,
76
77
component_system = None ,
77
78
name = 'dead_end_filtration' ,
78
79
membrane_area = 1 ,
79
- membrane_resistance = 1e-9 ,
80
+ membrane_resistance = 1 ,
81
+ specific_cake_resistance = 1 ,
82
+ rejection = StepCutOff (cutoff_weight = 0 ),
80
83
* args ,
81
84
** kwargs
82
85
):
83
86
super ().__init__ (component_system , name , * args , ** kwargs )
84
87
85
88
self .membrane_area = membrane_area
86
89
self .membrane_resistance = membrane_resistance
90
+ self .specific_cake_resistance = specific_cake_resistance
91
+ self .rejection = rejection
87
92
88
93
89
94
class CrossFlowFiltrationFixture (UnitOperationFixture , CrossFlowFiltration ):
@@ -355,35 +360,35 @@ def test_initialize(self, unit_operation: UnitOperationBase, expected: dict):
355
360
(
356
361
CstrFixture (),
357
362
{
358
- 'states' : {
359
- 'inlet' : {
360
- 'c' : np .array ([7 , 8 ]),
361
- 'viscosity' : [3 ]
363
+ 'states' : {
364
+ 'inlet' : {
365
+ 'c' : np .array ([7 , 8 ]),
366
+ 'viscosity' : [3 ]
362
367
},
363
- 'bulk' : {
364
- 'c' : np .array ([1 , 2 ]),
365
- 'Volume' : 1
368
+ 'bulk' : {
369
+ 'c' : np .array ([1 , 2 ]),
370
+ 'Volume' : 1
366
371
}
367
372
},
368
- 'state_derivatives' : {
369
- 'inlet' : {
370
- 'c' : [6 , 7 ]
373
+ 'state_derivatives' : {
374
+ 'inlet' : {
375
+ 'c' : [6 , 7 ]
371
376
},
372
- 'bulk' : {
373
- 'c' : np .array ([4 , 5 ]),
374
- 'Volume' : 2
377
+ 'bulk' : {
378
+ 'c' : np .array ([4 , 5 ]),
379
+ 'Volume' : 2
375
380
}
376
381
},
377
- 'Q_in' : [3 ],
378
- 'Q_out' : [4 ]
382
+ 'Q_in' : [3 ],
383
+ 'Q_out' : [4 ]
379
384
},
380
385
[
381
386
("calculate_residual_concentration_cstr" ,
382
387
lambda c , c_dot , V , V_dot , Q_in , Q_out , c_in :
383
388
c_dot * V + V_dot * c - Q_in * c_in + Q_out * c
384
389
),
385
390
("calculate_residual_visc_cstr" ,
386
- lambda * args :
391
+ lambda * args :
387
392
0
388
393
),
389
394
("calculate_residual_volume_cstr" ,
@@ -392,23 +397,69 @@ def test_initialize(self, unit_operation: UnitOperationBase, expected: dict):
392
397
)
393
398
],
394
399
{
395
- 'inlet' : {
396
- 'c' : np .array ([7 , 8 ]),
400
+ 'inlet' : {
401
+ 'c' : np .array ([7 , 8 ]),
397
402
'viscosity' : 0
398
403
},
399
- 'bulk' : {
400
- 'c' : np .array ([- 11 ,- 7 ]),
401
- 'Volume' : 3
404
+ 'bulk' : {
405
+ 'c' : np .array ([- 11 ,- 7 ]),
406
+ 'Volume' : 3
402
407
}
403
408
}
404
409
),
405
- # (
406
- # DeadEndFiltrationFixture(),
407
- # {
408
- # 'expected_residual': {
409
- # },
410
- # },
411
- # ),
410
+ (
411
+ DeadEndFiltrationFixture (),
412
+ {
413
+ 'states' : {
414
+ 'cake' : {
415
+ 'c' : np .array ([0.5 , 0.5 ]),
416
+ 'viscosity' : 1 ,
417
+ 'pressure' : 1 ,
418
+ 'cakevolume' : 1 ,
419
+ 'permeate' : 1 ,
420
+ },
421
+ 'permeate' : {
422
+ 'c' : np .array ([0.5 , 0.5 ]),
423
+ 'viscosity' : 1 ,
424
+ 'Volume' : 1 ,
425
+ }
426
+ },
427
+ 'state_derivatives' : {
428
+ 'cake' : {
429
+ 'c' : np .array ([0.5 , 0.5 ]),
430
+ 'viscosity' : 1 ,
431
+ 'pressure' : 1 ,
432
+ 'cakevolume' : 1 ,
433
+ 'permeate' : 1 ,
434
+ },
435
+ 'permeate' : {
436
+ 'c' : np .array ([0.5 , 0.5 ]),
437
+ 'viscosity' : 1 ,
438
+ 'Volume' : 1 ,
439
+ }
440
+ },
441
+ 'Q_in' : [1 ],
442
+ 'Q_out' : [1 ]
443
+ },
444
+ [
445
+ ('CPSComponentSystem.molecular_weights' , [1 , 1 ]),
446
+ ('CPSComponentSystem.molecular_volumes' , [1 , 1 ])
447
+ ],
448
+ {
449
+ 'cake' : {
450
+ 'c' : np .array ([0.5 , 0.5 ]),
451
+ 'viscosity' : 0 ,
452
+ 'pressure' : 1 ,
453
+ 'cakevolume' : 0 ,
454
+ 'permeate' : 1 ,
455
+ },
456
+ 'permeate' : {
457
+ 'c' : np .array ([1.5 , 1.5 ]),
458
+ 'viscosity' : 0 ,
459
+ 'Volume' : 1 ,
460
+ }
461
+ }
462
+ ),
412
463
# (
413
464
# CrossFlowFiltrationFixture(),
414
465
# {
0 commit comments