-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1280 lines (1188 loc) · 55.2 KB
/
Copy pathindex.html
File metadata and controls
1280 lines (1188 loc) · 55.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CentrifCalc — Centrifugal Compressor Design Tool</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap" rel="stylesheet">
<style>
:root {
--bg: #0d0f12;
--bg2: #13161b;
--bg3: #1a1e25;
--bg4: #21262f;
--border: #2a3040;
--border2: #3a4455;
--text: #e2e8f0;
--text2: #8896aa;
--text3: #556070;
--accent: #3b82f6;
--accent2: #60a5fa;
--green: #22c55e;
--green2: #86efac;
--amber: #f59e0b;
--amber2: #fcd34d;
--red: #ef4444;
--red2: #fca5a5;
--purple: #a78bfa;
--teal: #2dd4bf;
--mono: 'Space Mono', monospace;
--sans: 'DM Sans', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
background: var(--bg);
color: var(--text);
font-family: var(--sans);
font-size: 14px;
line-height: 1.6;
min-height: 100vh;
}
/* ── HEADER ── */
header {
background: var(--bg2);
border-bottom: 1px solid var(--border);
padding: 0 2rem;
display: flex;
align-items: center;
justify-content: space-between;
height: 56px;
position: sticky;
top: 0;
z-index: 100;
}
.logo {
font-family: var(--mono);
font-size: 15px;
font-weight: 700;
color: var(--text);
letter-spacing: -.02em;
display: flex;
align-items: center;
gap: 10px;
}
.logo-mark {
width: 28px; height: 28px;
border: 2px solid var(--accent);
border-radius: 50%;
display: flex; align-items: center; justify-content: center;
position: relative;
}
.logo-mark::after {
content: '';
width: 8px; height: 8px;
background: var(--accent);
border-radius: 50%;
}
.logo-sub {
font-family: var(--mono);
font-size: 10px;
color: var(--text3);
font-weight: 400;
letter-spacing: .08em;
text-transform: uppercase;
}
.header-right {
display: flex; align-items: center; gap: 16px;
}
.version-badge {
font-family: var(--mono);
font-size: 10px;
color: var(--text3);
border: 1px solid var(--border);
padding: 3px 8px;
border-radius: 4px;
letter-spacing: .06em;
}
/* ── LAYOUT ── */
.layout {
display: grid;
grid-template-columns: 260px 1fr 280px;
min-height: calc(100vh - 56px);
}
/* ── LEFT SIDEBAR — inputs ── */
.sidebar {
background: var(--bg2);
border-right: 1px solid var(--border);
padding: 1.5rem 1.25rem;
overflow-y: auto;
height: calc(100vh - 56px);
position: sticky;
top: 56px;
}
.sidebar-section {
margin-bottom: 1.75rem;
}
.sidebar-section-title {
font-family: var(--mono);
font-size: 10px;
letter-spacing: .12em;
text-transform: uppercase;
color: var(--text3);
margin-bottom: 12px;
display: flex; align-items: center; gap: 8px;
}
.sidebar-section-title::after {
content: '';
flex: 1; height: 1px;
background: var(--border);
}
.input-group {
margin-bottom: 14px;
}
.input-label {
display: flex;
justify-content: space-between;
align-items: baseline;
margin-bottom: 5px;
}
.input-label span:first-child {
font-size: 12px;
color: var(--text2);
}
.input-label .val {
font-family: var(--mono);
font-size: 11px;
color: var(--accent2);
font-weight: 700;
}
input[type=range] {
width: 100%;
height: 4px;
-webkit-appearance: none;
appearance: none;
background: var(--bg4);
border-radius: 2px;
outline: none;
cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
width: 14px; height: 14px;
border-radius: 50%;
background: var(--accent);
border: 2px solid var(--bg2);
cursor: pointer;
transition: background .15s, transform .1s;
}
input[type=range]::-webkit-slider-thumb:hover { background: var(--accent2); transform: scale(1.2); }
input[type=range]::-moz-range-thumb {
width: 14px; height: 14px;
border-radius: 50%;
background: var(--accent);
border: 2px solid var(--bg2);
cursor: pointer;
}
select {
width: 100%;
background: var(--bg3);
border: 1px solid var(--border);
color: var(--text);
font-family: var(--sans);
font-size: 12px;
padding: 7px 10px;
border-radius: 6px;
outline: none;
cursor: pointer;
appearance: none;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238896aa' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 10px center;
}
select:focus { border-color: var(--accent); }
/* ── MAIN CONTENT ── */
.main {
padding: 1.75rem 2rem;
overflow-y: auto;
}
/* ── TABS ── */
.tabs {
display: flex;
gap: 2px;
margin-bottom: 1.5rem;
background: var(--bg2);
border: 1px solid var(--border);
border-radius: 8px;
padding: 4px;
}
.tab-btn {
flex: 1;
padding: 7px 4px;
background: none;
border: none;
color: var(--text3);
font-family: var(--mono);
font-size: 10px;
letter-spacing: .06em;
text-transform: uppercase;
cursor: pointer;
border-radius: 5px;
transition: all .15s;
white-space: nowrap;
}
.tab-btn:hover { color: var(--text2); background: var(--bg3); }
.tab-btn.active { background: var(--bg4); color: var(--text); border: 1px solid var(--border2); }
.panel { display: none; }
.panel.active { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
/* ── CARDS ── */
.card {
background: var(--bg2);
border: 1px solid var(--border);
border-radius: 10px;
padding: 1.25rem;
margin-bottom: 12px;
}
.card-title {
font-family: var(--mono);
font-size: 10px;
letter-spacing: .1em;
text-transform: uppercase;
color: var(--text3);
margin-bottom: 14px;
display: flex; align-items: center; gap: 8px;
}
.card-title::before {
content: '';
width: 3px; height: 12px;
background: var(--accent);
border-radius: 2px;
}
/* ── METRIC GRIDS ── */
.g2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.g3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.g4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.metric {
background: var(--bg3);
border: 1px solid var(--border);
border-radius: 8px;
padding: 12px 14px;
position: relative;
overflow: hidden;
}
.metric::before {
content: '';
position: absolute;
top: 0; left: 0; right: 0;
height: 2px;
border-radius: 8px 8px 0 0;
}
.metric.good::before { background: var(--green); }
.metric.warn::before { background: var(--amber); }
.metric.bad::before { background: var(--red); }
.metric.info::before { background: var(--accent); }
.metric.purple::before { background: var(--purple); }
.metric .ml { font-size: 11px; color: var(--text3); margin-bottom: 4px; font-family: var(--mono); }
.metric .mv { font-size: 20px; font-weight: 500; color: var(--text); line-height: 1.1; font-family: var(--mono); }
.metric .mu { font-size: 11px; color: var(--text3); margin-left: 2px; }
/* ── ALERTS ── */
.alert {
font-size: 12px;
padding: 8px 12px 8px 34px;
border-radius: 6px;
margin-bottom: 6px;
position: relative;
line-height: 1.5;
}
.alert::before {
position: absolute;
left: 12px; top: 9px;
font-size: 13px;
}
.alert.ok { background: rgba(34,197,94,.1); color: var(--green2); border: 1px solid rgba(34,197,94,.2); }
.alert.ok::before { content: '✓'; }
.alert.cau { background: rgba(245,158,11,.1); color: var(--amber2); border: 1px solid rgba(245,158,11,.2); }
.alert.cau::before { content: '⚠'; }
.alert.err { background: rgba(239,68,68,.1); color: var(--red2); border: 1px solid rgba(239,68,68,.2); }
.alert.err::before { content: '✕'; }
.alert.inf { background: rgba(59,130,246,.1); color: var(--accent2); border: 1px solid rgba(59,130,246,.2); }
.alert.inf::before { content: 'i'; font-family: var(--mono); font-weight: 700; }
/* ── DATA TABLE ── */
.dtable { width: 100%; border-collapse: collapse; font-size: 12px; }
.dtable tr { border-bottom: 1px solid var(--border); }
.dtable tr:last-child { border-bottom: none; }
.dtable td { padding: 6px 2px; }
.dtable td:first-child { color: var(--text2); }
.dtable td:last-child { text-align: right; font-family: var(--mono); font-size: 11px; color: var(--accent2); }
/* ── BAR CHARTS ── */
.bar-row {
display: flex; align-items: center; gap: 8px;
margin-bottom: 5px;
padding: 3px 6px;
border-radius: 5px;
transition: background .1s;
}
.bar-row:hover { background: var(--bg3); }
.bar-row.selected { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.2); }
.bar-label { font-family: var(--mono); font-size: 11px; color: var(--text3); min-width: 76px; text-align: right; }
.bar-stack { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.bar-track { background: var(--bg4); border-radius: 2px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 2px; transition: width .25s ease; }
.bar-val { font-family: var(--mono); font-size: 10px; min-width: 80px; color: var(--text2); }
/* ── SCORECARD BADGES ── */
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.badge {
font-family: var(--mono);
font-size: 10px;
padding: 4px 10px;
border-radius: 20px;
letter-spacing: .04em;
font-weight: 700;
display: flex; align-items: center; gap: 5px;
}
.badge::before { font-size: 10px; }
.badge.g { background: rgba(34,197,94,.15); color: var(--green2); border: 1px solid rgba(34,197,94,.3); }
.badge.g::before { content: '●'; color: var(--green); }
.badge.w { background: rgba(245,158,11,.15); color: var(--amber2); border: 1px solid rgba(245,158,11,.3); }
.badge.w::before { content: '●'; color: var(--amber); }
.badge.r { background: rgba(239,68,68,.15); color: var(--red2); border: 1px solid rgba(239,68,68,.3); }
.badge.r::before { content: '●'; color: var(--red); }
/* ── RIGHT SIDEBAR — quick ref ── */
.ref-sidebar {
background: var(--bg2);
border-left: 1px solid var(--border);
padding: 1.5rem 1.25rem;
overflow-y: auto;
height: calc(100vh - 56px);
position: sticky;
top: 56px;
}
.ref-title {
font-family: var(--mono);
font-size: 10px;
letter-spacing: .12em;
text-transform: uppercase;
color: var(--text3);
margin-bottom: 12px;
display: flex; align-items: center; gap: 8px;
}
.ref-title::after { content:''; flex:1; height:1px; background:var(--border); }
.ref-rule {
background: var(--bg3);
border: 1px solid var(--border);
border-left: 3px solid var(--border2);
border-radius: 0 6px 6px 0;
padding: 8px 10px;
margin-bottom: 7px;
font-size: 11px;
color: var(--text2);
line-height: 1.5;
}
.ref-rule strong {
font-family: var(--mono);
font-size: 10px;
color: var(--teal);
display: block;
margin-bottom: 2px;
font-weight: 700;
}
.ref-rule.accent { border-left-color: var(--accent); }
.ref-rule.green { border-left-color: var(--green); }
.ref-rule.amber { border-left-color: var(--amber); }
.ref-rule.red { border-left-color: var(--red); }
.ref-rule.purple { border-left-color: var(--purple); }
.eq {
font-family: var(--mono);
font-size: 11px;
background: var(--bg4);
border: 1px solid var(--border);
border-radius: 4px;
padding: 6px 10px;
color: var(--purple);
margin-bottom: 6px;
line-height: 1.8;
}
.divider { height: 1px; background: var(--border); margin: 14px 0; }
/* ── FOOTER ── */
footer {
border-top: 1px solid var(--border);
background: var(--bg2);
padding: 12px 2rem;
display: flex;
align-items: center;
justify-content: space-between;
font-family: var(--mono);
font-size: 10px;
color: var(--text3);
}
/* ── SCROLLBARS ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }
/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
.layout { grid-template-columns: 240px 1fr; }
.ref-sidebar { display: none; }
}
@media (max-width: 720px) {
.layout { grid-template-columns: 1fr; }
.sidebar { height: auto; position: static; border-right: none; border-bottom: 1px solid var(--border); }
.g4 { grid-template-columns: repeat(2,1fr); }
.g3 { grid-template-columns: repeat(2,1fr); }
}
</style>
</head>
<body>
<header>
<div class="logo">
<div class="logo-mark"></div>
<div>
CentrifCalc
<div class="logo-sub">Centrifugal Compressor Design Tool</div>
</div>
</div>
<div class="header-right">
<span class="version-badge">v1.0</span>
</div>
</header>
<div class="layout">
<!-- ══════════ LEFT SIDEBAR ══════════ -->
<aside class="sidebar">
<div class="sidebar-section">
<div class="sidebar-section-title">Primary Geometry</div>
<div class="input-group">
<div class="input-label"><span>Outer (tip) diameter D₂</span><span class="val" id="D2v">40 mm</span></div>
<input type="range" min="20" max="120" step="1" value="40" id="D2" oninput="calc()">
</div>
<div class="input-group">
<div class="input-label"><span>Axial blade width b₂</span><span class="val" id="b2v">20 mm</span></div>
<input type="range" min="4" max="50" step="1" value="20" id="b2" oninput="calc()">
</div>
<div class="input-group">
<div class="input-label"><span>Inducer / tip ratio</span><span class="val" id="drv">0.55</span></div>
<input type="range" min="0.35" max="0.70" step="0.01" value="0.55" id="dr" oninput="calc()">
</div>
<div class="input-group">
<div class="input-label"><span>Hub / inducer ratio</span><span class="val" id="hrv">0.35</span></div>
<input type="range" min="0.20" max="0.55" step="0.01" value="0.35" id="hr" oninput="calc()">
</div>
<div class="input-group">
<div class="input-label"><span>Tip clearance</span><span class="val" id="clrv">0.15 mm</span></div>
<input type="range" min="0.05" max="0.50" step="0.01" value="0.15" id="clr" oninput="calc()">
</div>
</div>
<div class="sidebar-section">
<div class="sidebar-section-title">Operating Point</div>
<div class="input-group">
<div class="input-label"><span>Shaft speed</span><span class="val" id="rpmv">32 krpm</span></div>
<input type="range" min="5" max="200" step="1" value="32" id="rpm" oninput="calc()">
</div>
<div class="input-group">
<div class="input-label"><span>Flow coefficient φ</span><span class="val" id="phiv">0.22</span></div>
<input type="range" min="0.10" max="0.35" step="0.01" value="0.22" id="phi" oninput="calc()">
</div>
<div class="input-group">
<div class="input-label"><span>Isentropic efficiency η_c</span><span class="val" id="etacv">62%</span></div>
<input type="range" min="0.40" max="0.85" step="0.01" value="0.62" id="etac" oninput="calc()">
</div>
</div>
<div class="sidebar-section">
<div class="sidebar-section-title">Blade Design</div>
<div class="input-group">
<div class="input-label"><span>Backsweep angle β₂</span><span class="val" id="beta2v">35°</span></div>
<input type="range" min="0" max="55" step="1" value="35" id="beta2" oninput="calc()">
</div>
<div class="input-group">
<div class="input-label"><span>Inducer blade angle β₁</span><span class="val" id="beta1v">35°</span></div>
<input type="range" min="20" max="60" step="1" value="35" id="beta1" oninput="calc()">
</div>
<div class="input-group">
<div class="input-label"><span>Full blade count</span><span class="val" id="nbv">7</span></div>
<input type="range" min="4" max="14" step="1" value="7" id="nb" oninput="calc()">
</div>
<div class="input-group">
<div class="input-label"><span>Blade thickness t</span><span class="val" id="btv">0.8 mm</span></div>
<input type="range" min="0.3" max="3.0" step="0.1" value="0.8" id="bt" oninput="calc()">
</div>
<div class="input-group">
<div class="input-label"><span>Splitter blades</span><span class="val" id="splv">Off</span></div>
<input type="range" min="0" max="1" step="1" value="0" id="spl" oninput="calc()">
</div>
<div class="input-group">
<div class="input-label"><span>Min printable passage</span><span class="val" id="minpv">2.5 mm</span></div>
<input type="range" min="0.5" max="6.0" step="0.1" value="2.5" id="minp" oninput="calc()">
</div>
<div class="input-group">
<div class="input-label"><span>Diffuser recovery Cp</span><span class="val" id="cpdiffv">0.60</span></div>
<input type="range" min="0.40" max="0.80" step="0.01" value="0.60" id="cpdiff" oninput="calc()">
</div>
</div>
<div class="sidebar-section">
<div class="sidebar-section-title">Volute Design</div>
<div class="input-group">
<div class="input-label"><span>Tongue clearance ratio</span><span class="val" id="tcv">0.07</span></div>
<input type="range" min="0.03" max="0.15" step="0.005" value="0.07" id="tc" oninput="calc()">
</div>
<div class="input-group">
<div class="input-label"><span>Volute velocity ratio Kv</span><span class="val" id="kvv">0.35</span></div>
<input type="range" min="0.20" max="0.60" step="0.01" value="0.35" id="kv" oninput="calc()">
</div>
<div class="input-group">
<div class="input-label"><span>Cross-section shape</span></div>
<select id="vshape" onchange="calc()">
<option value="circle">Circular</option>
<option value="rect">Rectangular</option>
<option value="trap">Trapezoidal</option>
</select>
</div>
<div class="input-group">
<div class="input-label"><span>Exit diffuser half-angle</span><span class="val" id="diffav">8°</span></div>
<input type="range" min="3" max="20" step="1" value="8" id="diffa" oninput="calc()">
</div>
<div class="input-group">
<div class="input-label"><span>Exit duct area ratio</span><span class="val" id="earv">2.5</span></div>
<input type="range" min="1.2" max="5.0" step="0.1" value="2.5" id="ear" oninput="calc()">
</div>
<div class="input-group">
<div class="input-label"><span>Wall thickness (housing)</span><span class="val" id="wthv">2.0 mm</span></div>
<input type="range" min="0.8" max="8.0" step="0.2" value="2.0" id="wth" oninput="calc()">
</div>
</div>
<div class="sidebar-section">
<div class="sidebar-section-title">Structural</div>
<div class="input-group">
<div class="input-label"><span>Material</span></div>
<select id="mat" onchange="calc()">
<option value="petg">PETG (FDM printed)</option>
<option value="pla">PLA (FDM printed)</option>
<option value="abs">ABS (FDM printed)</option>
<option value="alu">Aluminium 6061</option>
<option value="alu7">Aluminium 7075-T6</option>
<option value="ti">Ti-6Al-4V</option>
<option value="inc">Inconel 718</option>
</select>
</div>
<div class="input-group">
<div class="input-label"><span>Safety factor target</span><span class="val" id="sfv">2.0×</span></div>
<input type="range" min="1.2" max="4.0" step="0.1" value="2.0" id="sf" oninput="calc()">
</div>
</div>
</aside>
<!-- ══════════ MAIN CONTENT ══════════ -->
<main class="main">
<div class="tabs">
<button class="tab-btn active" onclick="showTab('geo',this)">Geometry</button>
<button class="tab-btn" onclick="showTab('aero',this)">Aerodynamics</button>
<button class="tab-btn" onclick="showTab('blade',this)">Blades</button>
<button class="tab-btn" onclick="showTab('struct',this)">Structural</button>
<button class="tab-btn" onclick="showTab('summary',this)">Summary</button>
<button class="tab-btn" onclick="showTab('volute',this)">Volute</button>
</div>
<!-- GEOMETRY -->
<div class="panel active" id="tab-geo">
<div class="card">
<div class="card-title">Key dimensions</div>
<div class="g4" id="geo-metrics"></div>
</div>
<div class="card">
<div class="card-title">Constraint checks</div>
<div id="geo-alerts"></div>
</div>
<div class="card">
<div class="card-title">Full dimensional reference</div>
<table class="dtable" id="geo-table"></table>
</div>
</div>
<!-- AERODYNAMICS -->
<div class="panel" id="tab-aero">
<div class="card">
<div class="card-title">Performance outputs</div>
<div class="g3" id="aero-metrics"></div>
</div>
<div class="card">
<div class="card-title">Aerodynamic checks</div>
<div id="aero-alerts"></div>
</div>
<div class="card">
<div class="card-title">Velocity triangle & cycle data</div>
<table class="dtable" id="aero-table"></table>
</div>
</div>
<!-- BLADES -->
<div class="panel" id="tab-blade">
<div class="card">
<div class="card-title">Passage width vs. blade count — tip (blue) / inducer (colored)</div>
<div id="blade-bars"></div>
<p style="font-size:11px;color:var(--text3);margin-top:8px;font-family:var(--mono);">Highlighted row = currently selected count · Green = both printable · Amber = inducer tight · Red = inducer too narrow</p>
</div>
<div class="card">
<div class="card-title">Selected configuration</div>
<div class="g3" id="blade-metrics"></div>
<div style="margin-top:10px;" id="blade-alerts"></div>
</div>
</div>
<!-- STRUCTURAL -->
<div class="panel" id="tab-struct">
<div class="card">
<div class="card-title">Stress estimates</div>
<div class="g3" id="struct-metrics"></div>
</div>
<div class="card">
<div class="card-title">Structural checks</div>
<div id="struct-alerts"></div>
</div>
<div class="card">
<div class="card-title">Material & loading summary</div>
<table class="dtable" id="struct-table"></table>
</div>
</div>
<!-- SUMMARY -->
<div class="panel" id="tab-summary">
<div class="card">
<div class="card-title">Design scorecard</div>
<div class="badges" id="summary-badges"></div>
<div class="g4" id="summary-key"></div>
</div>
<div class="card">
<div class="card-title">Recommendations</div>
<div id="summary-recs"></div>
</div>
<div class="card">
<div class="card-title">Complete parameter table</div>
<table class="dtable" id="summary-table"></table>
</div>
</div>
<!-- VOLUTE -->
<div class="panel" id="tab-volute">
<div class="card">
<div class="card-title">Volute key outputs</div>
<div class="g4" id="vol-metrics"></div>
</div>
<div class="card">
<div class="card-title">Spiral area schedule — throat area vs. wrap angle</div>
<div id="vol-spiral" style="overflow-x:auto;"></div>
<p style="font-size:11px;color:var(--text3);margin-top:8px;font-family:var(--mono);">Area grows from 0 at tongue to A_exit at 360°. Each cell = 30° increment.</p>
</div>
<div class="card">
<div class="card-title">Constraint checks</div>
<div id="vol-alerts"></div>
</div>
<div class="card">
<div class="card-title">Full volute reference</div>
<table class="dtable" id="vol-table"></table>
</div>
</div>
</main>
<!-- ══════════ RIGHT SIDEBAR — quick ref ══════════ -->
<aside class="ref-sidebar">
<div class="ref-title">Key Equations</div>
<div class="eq">π = (1 + η·W/cpT₀)^(γ/γ-1)</div>
<div class="eq">W = U₂·Cu₂ (Euler)</div>
<div class="eq">U₂ = ω·r₂</div>
<div class="eq">σ = ρ·U₂²</div>
<div class="eq">A(θ) = (θ/2π)·Q/Vθ</div>
<div class="eq">r_tongue = r₂·(1 + Kc)</div>
<div class="eq">V_exit = √(2·Cp·ΔT_diff)</div>
<div class="divider"></div>
<div class="ref-title">Rules of Thumb</div>
<div class="ref-rule accent">
<strong>Backsweep angle</strong>
35–45° for best surge margin and stable operating range. Radial (0°) gives max PR but narrow stability.
</div>
<div class="ref-rule green">
<strong>Tip clearance</strong>
Target < 1.5% of blade width. Each 0.1mm costs ~1–2% isentropic efficiency at this scale.
</div>
<div class="ref-rule amber">
<strong>Tip Mach number</strong>
Keep below 0.85 to avoid compressibility losses. Above 1.0 = severe shock losses.
</div>
<div class="ref-rule amber">
<strong>Inducer rel. Mach</strong>
Keep below 0.85–0.9 to avoid choke at inducer throat.
</div>
<div class="ref-rule purple">
<strong>De Haller number</strong>
Keep W₂/W₁ > 0.72. Below this, flow separates off blade suction surface.
</div>
<div class="ref-rule accent">
<strong>Blade count</strong>
Use Pfleiderer formula: 6.5·sin(β_avg)·ln(r₂/r₁). Splitters improve guidance without choking inducer.
</div>
<div class="ref-rule green">
<strong>Inducer / tip ratio</strong>
0.50–0.58 optimal. Higher chokes annulus; lower under-uses disk area.
</div>
<div class="ref-rule red">
<strong>Reynolds number</strong>
Below 60k = deep viscous regime. Surface finish (Ra < 1.6µm) critical. Below 30k expect large efficiency drop.
</div>
<div class="ref-rule amber">
<strong>FDM printed parts</strong>
Inter-layer tensile ~40–60% of bulk UTS. Orient blade roots for circumferential layer lines. Always balance statically before spin-up.
</div>
<div class="divider"></div>
<div class="ref-title">Volute Design</div>
<div class="ref-rule accent">
<strong>Tongue clearance</strong>
5–10% of tip radius. Closer = more noise and pressure pulsation. Further = wasted casing volume.
</div>
<div class="ref-rule green">
<strong>Velocity ratio Kv</strong>
0.30–0.45 typical. Sets the volute reference velocity as a fraction of tip speed. Lower = larger casing, lower losses.
</div>
<div class="ref-rule amber">
<strong>Exit diffuser angle</strong>
7–10° half-angle optimal. Above 12° risks separation. Below 5° recovers well but adds length.
</div>
<div class="ref-rule purple">
<strong>Area ratio</strong>
1.5–3.0× throat to exit. Higher recovery but longer diffuser. Match to available envelope.
</div>
<div class="ref-rule green">
<strong>Cross-section shape</strong>
Circular = lowest friction, best for FDM. Rectangular = easier to machine from billet. Trapezoidal = compromise.
</div>
<div class="ref-rule red">
<strong>Volute sizing</strong>
At this scale, total casing OD = impeller OD + 2×(tongue clearance + max throat radius + wall thickness).
</div>
<div class="divider"></div>
<div class="ref-title">Material Limits</div>
<div class="ref-rule">
<strong>PETG</strong>
UTS ~50 MPa · Tg ~80°C · Max tip speed ~180 m/s
</div>
<div class="ref-rule">
<strong>Al 7075-T6</strong>
UTS ~572 MPa · Max tip speed ~450 m/s
</div>
<div class="ref-rule">
<strong>Ti-6Al-4V</strong>
UTS ~950 MPa · Max tip speed ~600 m/s
</div>
<div class="ref-rule">
<strong>Inconel 718</strong>
UTS ~1375 MPa · Survives 1000°C+ · Hot section use
</div>
</aside>
</div>
<footer>
<span>CentrifCalc — centrifugal compressor parametric design tool</span>
<span>All calculations are estimates for preliminary design — validate with CFD before fabrication</span>
</footer>
<script>
const MATS = {
petg: { name:'PETG (FDM)', rho:1270, uts:50e6, tg:80 },
pla: { name:'PLA (FDM)', rho:1240, uts:65e6, tg:60 },
abs: { name:'ABS (FDM)', rho:1050, uts:40e6, tg:100 },
alu: { name:'Al 6061', rho:2700, uts:310e6, tg:660 },
alu7: { name:'Al 7075-T6', rho:2810, uts:572e6, tg:660 },
ti: { name:'Ti-6Al-4V', rho:4430, uts:950e6, tg:1600 },
inc: { name:'Inconel 718',rho:8190, uts:1375e6, tg:1300 },
};
function showTab(id, btn) {
document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
document.querySelectorAll('.panel').forEach(p => p.classList.remove('active'));
btn.classList.add('active');
document.getElementById('tab-' + id).classList.add('active');
}
function mc(label, val, unit, cls='info') {
return `<div class="metric ${cls}"><div class="ml">${label}</div><div class="mv">${val}<span class="mu">${unit ? ' ' + unit : ''}</span></div></div>`;
}
function al(msg, cls) { return `<div class="alert ${cls}">${msg}</div>`; }
function row(a, b) { return `<tr><td>${a}</td><td>${b}</td></tr>`; }
function calc() {
const D2 = +document.getElementById('D2').value / 1000;
const b2 = +document.getElementById('b2').value / 1000;
const dr = +document.getElementById('dr').value;
const hr = +document.getElementById('hr').value;
const rpm = +document.getElementById('rpm').value * 1000;
const clr = +document.getElementById('clr').value / 1000;
const beta2 = +document.getElementById('beta2').value * Math.PI / 180;
const beta1 = +document.getElementById('beta1').value * Math.PI / 180;
const phi = +document.getElementById('phi').value;
const eta_c = +document.getElementById('etac').value;
const cp_diff= +document.getElementById('cpdiff').value;
const nb = +document.getElementById('nb').value;
const spl = +document.getElementById('spl').value;
const bt = +document.getElementById('bt').value / 1000;
const minp = +document.getElementById('minp').value / 1000;
const sf_target = +document.getElementById('sf').value;
const mat = MATS[document.getElementById('mat').value];
// Update display values
document.getElementById('D2v').textContent = Math.round(D2*1000) + ' mm';
document.getElementById('b2v').textContent = Math.round(b2*1000) + ' mm';
document.getElementById('drv').textContent = dr.toFixed(2);
document.getElementById('hrv').textContent = hr.toFixed(2);
document.getElementById('clrv').textContent = (clr*1000).toFixed(2) + ' mm';
document.getElementById('rpmv').textContent = Math.round(rpm/1000) + ' krpm';
document.getElementById('phiv').textContent = phi.toFixed(2);
document.getElementById('etacv').textContent = Math.round(eta_c*100) + '%';
document.getElementById('beta2v').textContent= Math.round(+document.getElementById('beta2').value) + '°';
document.getElementById('beta1v').textContent= Math.round(+document.getElementById('beta1').value) + '°';
document.getElementById('nbv').textContent = nb;
document.getElementById('btv').textContent = (+document.getElementById('bt').value).toFixed(1) + ' mm';
document.getElementById('splv').textContent = spl ? 'On' : 'Off';
document.getElementById('minpv').textContent = (+document.getElementById('minp').value).toFixed(1) + ' mm';
document.getElementById('cpdiffv').textContent = cp_diff.toFixed(2);
document.getElementById('sfv').textContent = sf_target.toFixed(1) + '×';
// Physics constants
const T0=288, P0=101325, gamma=1.4, cp=1005, R=287, mu=1.81e-5;
const omega = rpm * 2 * Math.PI / 60;
// Geometry
const D1 = D2 * dr, D_hub = D2 * dr * hr;
const r2 = D2/2, r1 = D1/2, r_hub = D_hub/2;
const U2 = omega * r2, U1 = omega * r1;
const a0 = Math.sqrt(gamma * R * T0);
const A_ann = Math.PI * (r1*r1 - r_hub*r_hub);
const rho0 = P0 / (R * T0);
// Aero
const slip = Math.min(0.94, Math.max(0.78,
1 - (Math.PI * Math.cos(beta2)) / (nb * (1 - phi * Math.tan(beta2)))));
const Cu2 = slip * U2 * (1 - phi * Math.tan(beta2));
const W_euler = U2 * Cu2;
const Cx1 = phi * U2;
const W1_rel = Math.sqrt(Cx1*Cx1 + U1*U1);
const T02 = T0 + W_euler / cp;
const pr = Math.pow(1 + eta_c * W_euler / (cp * T0), gamma/(gamma-1));
const mdot = rho0 * A_ann * Cx1 * 0.92;
const M_tip = U2 / a0;
const M_ind_rel = W1_rel / a0;
const dH_rat = (U2 * 0.5) / W1_rel;
const Re_blade = rho0 * U2 * b2 / mu;
const clr_pct = clr / b2 * 100;
const clr_penalty = clr_pct * 0.012;
const eta_actual = Math.max(0, eta_c - clr_penalty);
const T_comp_exit = T02 - 273;
// Blade passages
const C_tip = Math.PI * D2, C_ind = Math.PI * D1;
const eff_tip = spl ? nb : nb;
const eff_ind = spl ? Math.ceil(nb/2) : nb;
const pw_tip = (C_tip - eff_tip * bt) / eff_tip;
const pw_ind = (C_ind - eff_ind * bt) / eff_ind;
const solidity_tip = (eff_tip * bt) / C_tip;
const solidity_ind = (eff_ind * bt) / C_ind;
const pfl = Math.max(4, Math.round(6.5 * Math.sin((beta1+beta2)/2) * Math.log(r2/r1)));
// Structural
const hoop_stress = mat.rho * U2 * U2;
const disk_stress = 0.75 * mat.rho * U2 * U2;
const blade_stress = mat.rho * U2 * U2 * (b2/D2) * 2.0;
const sf_hoop = mat.uts / hoop_stress;
const sf_disk = mat.uts / disk_stress;
const sf_blade = mat.uts / blade_stress;
const sfmin = Math.min(sf_hoop, sf_disk, sf_blade);
const lim_mode = sf_hoop < sf_disk && sf_hoop < sf_blade ? 'Hoop (rim)' : sf_disk < sf_blade ? 'Disk burst' : 'Blade root bending';
// ── GEO TAB ──
document.getElementById('geo-metrics').innerHTML = [
mc('Tip diameter', Math.round(D2*1000), 'mm', 'info'),
mc('Inducer diameter', (D1*1000).toFixed(1), 'mm', 'info'),
mc('Hub diameter', (D_hub*1000).toFixed(1), 'mm', 'info'),
mc('Clearance / width', clr_pct.toFixed(1), '%', clr_pct < 1.5 ? 'good' : clr_pct < 3 ? 'warn' : 'bad'),
].join('');
const ga = [];
if (clr_pct > 2) ga.push(al(`Tip clearance ${(clr*1000).toFixed(2)} mm = ${clr_pct.toFixed(1)}% of blade width — high. Target < 1.5% for best efficiency.`, 'cau'));
else ga.push(al(`Tip clearance ${(clr*1000).toFixed(2)} mm = ${clr_pct.toFixed(1)}% blade width — good.`, 'ok'));
if (dr > 0.62) ga.push(al('High inducer ratio restricts annulus area — consider reducing to 0.50–0.58.', 'cau'));
if (hr > 0.45) ga.push(al('Large hub blocks significant inducer area. Hub/inducer ratio < 0.40 preferred.', 'cau'));
else ga.push(al(`Hub/inducer ratio ${hr.toFixed(2)} — good annulus area available.`, 'ok'));
document.getElementById('geo-alerts').innerHTML = ga.join('');
document.getElementById('geo-table').innerHTML = [
row('Tip radius r₂', (r2*1000).toFixed(2) + ' mm'),
row('Inducer radius r₁', (r1*1000).toFixed(2) + ' mm'),
row('Hub radius', (r_hub*1000).toFixed(2) + ' mm'),
row('Inducer annulus area', (A_ann*1e6).toFixed(2) + ' mm²'),
row('Tip circumference', C_tip.toFixed(1) + ' mm'),
row('Inducer circumference', C_ind.toFixed(1) + ' mm'),
row('Clearance / blade width', clr_pct.toFixed(2) + '%'),
row('Clearance η penalty (est.)', (clr_penalty*100).toFixed(1) + '% pts'),
row('Aspect ratio b₂/D₂', (b2/D2).toFixed(3)),
].join('');
// ── AERO TAB ──
document.getElementById('aero-metrics').innerHTML = [
mc('Pressure ratio π', pr.toFixed(3), ':1', pr > 2 ? 'good' : pr > 1.4 ? 'warn' : 'bad'),
mc('Tip speed U₂', Math.round(U2), 'm/s', U2 < 450 ? 'good' : U2 < 550 ? 'warn' : 'bad'),
mc('Euler work', Math.round(W_euler/1000), 'kJ/kg', 'info'),
mc('Exit total temp', Math.round(T02), 'K', T02 < (mat.tg + 273) ? 'good' : 'bad'),
mc('Mass flow', (mdot*1000).toFixed(2), 'g/s', 'info'),
mc('Slip factor σ', (slip*100).toFixed(1), '%', slip > 0.85 ? 'good' : 'warn'),
mc('Tip Mach', M_tip.toFixed(3), '', M_tip < 0.85 ? 'good' : M_tip < 1.0 ? 'warn' : 'bad'),
mc('Inducer rel. Mach', M_ind_rel.toFixed(3), '', M_ind_rel < 0.85 ? 'good' : M_ind_rel < 1.0 ? 'warn' : 'bad'),
mc('Actual η (w/ clearance)', Math.round(eta_actual*100), '%', eta_actual > 0.65 ? 'good' : eta_actual > 0.55 ? 'warn' : 'bad'),
].join('');
const aa = [];
if (pr < 1.3) aa.push(al('Pressure ratio below 1.3 — very low. Increase RPM substantially.', 'err'));
else if (pr < 2.0) aa.push(al(`PR ${pr.toFixed(2)} — marginal for engine cycle use. Target 2.5+ by increasing RPM or diameter.`, 'cau'));
else aa.push(al(`PR ${pr.toFixed(2)} — good single-stage result for this scale.`, 'ok'));
if (M_tip > 1.0) aa.push(al(`Tip Mach ${M_tip.toFixed(2)} — supersonic. Severe shock losses expected. Reduce RPM.`, 'err'));
else if (M_tip > 0.85) aa.push(al(`Tip Mach ${M_tip.toFixed(2)} — transonic. Compressibility losses building.`, 'cau'));
if (M_ind_rel > 0.9) aa.push(al(`Inducer relative Mach ${M_ind_rel.toFixed(2)} — choke risk at inducer throat.`, 'cau'));
if (+document.getElementById('beta2').value < 25) aa.push(al('Backsweep below 25° — narrow surge margin. Recommend 35–45° for stable operation.', 'cau'));
if (Re_blade < 60000) aa.push(al(`Blade Re = ${Math.round(Re_blade/1000)}k — deep viscous regime. Surface finish critical (Ra < 1.6 µm).`, 'err'));
else if (Re_blade < 150000) aa.push(al(`Blade Re = ${Math.round(Re_blade/1000)}k — transitional regime. Expect elevated losses vs. larger machines.`, 'cau'));
else aa.push(al(`Blade Re = ${Math.round(Re_blade/1000)}k — acceptable.`, 'ok'));
if (T_comp_exit > mat.tg * 0.75) aa.push(al(`Compressor exit ${Math.round(T_comp_exit)}°C is approaching material Tg (${mat.tg}°C). Thermal risk.`, 'cau'));
else aa.push(al(`Compressor exit ${Math.round(T_comp_exit)}°C — well below material Tg (${mat.tg}°C).`, 'ok'));
document.getElementById('aero-alerts').innerHTML = aa.join('');
document.getElementById('aero-table').innerHTML = [
row('Axial velocity Cx₁', Math.round(Cx1) + ' m/s'),
row('Inducer tip speed U₁', Math.round(U1) + ' m/s'),
row('Inducer relative velocity W₁', Math.round(W1_rel) + ' m/s'),
row('Whirl velocity Cu₂', Math.round(Cu2) + ' m/s'),
row('Head coefficient ψ = W/U₂²', (W_euler/(U2*U2)).toFixed(3)),
row('Flow coefficient φ = Cx/U₂', phi.toFixed(3)),
row('De Haller approx.', dH_rat.toFixed(3)),
row('Diffuser pressure recovery Cp', cp_diff.toFixed(2)),
row('Compressor exit temp (total)', Math.round(T02) + ' K / ' + Math.round(T_comp_exit) + '°C'),
row('Compressor exit pressure', (P0*pr/1000).toFixed(2) + ' kPa'),
row('Compressor exit pressure (bar)', (P0*pr/1e5).toFixed(3) + ' bar'),
row('Blade Re', Math.round(Re_blade/1000) + 'k'),
].join('');
// ── BLADE TAB ──
let barsHtml = '';
for (let n = 4; n <= 14; n++) {
const et = spl ? n : n, ei = spl ? Math.ceil(n/2) : n;
const pt = (C_tip - et*bt)/et;
const pi = (C_ind - ei*bt)/ei;
const sel = n === nb;
const pc = pi < minp ? '#ef4444' : pi < minp*1.5 ? '#f59e0b' : '#22c55e';