Add support for multiple reactor types (CSTR and PFR) with corresponding properties (Dichelet BC for now)

This commit is contained in:
2025-06-23 16:58:02 +02:00
parent 62b034fb76
commit 70531a3a59
3 changed files with 204 additions and 23 deletions

View File

@@ -4,7 +4,10 @@
color: "#c4cce0",
defaults: {
name: { value: "" },
volume: { value: 0., required: true},
reactor_type: { value: "CSTR", required: true },
volume: { value: 0., required: true },
length: { value: 0.},
resolution_L: { value: 0.},
n_inlets: { value: 1, required: true},
kla: { value: null },
S_O_init: { value: 0., required: true },
@@ -45,6 +48,32 @@
type:"num",
types:["num"]
});
$("#node-input-reactor_type").typedInput({
types: [
{
value: "CSTR",
options: [
{ value: "CSTR", label: "CSTR"},
{ value: "PFR", label: "PFR"}
]
}
]
})
$("#node-input-reactor_type").on("change", function() {
const type = $("#node-input-reactor_type").typedInput("value");
if (type === "CSTR") {
$(".PFR").hide();
} else {
$(".PFR").show();
}
});
// Set initial visibility on dialog open
const initialType = $("#node-input-reactor_type").typedInput("value");
if (initialType === "CSTR") {
$(".PFR").hide();
} else {
$(".PFR").show();
}
},
oneditsave: function() {
let volume = parseFloat($("#node-input-volume").typedInput("value"));
@@ -65,10 +94,22 @@
<input type="text" id="node-input-name" placeholder="Name">
</div>
<h2> Reactor properties </h2>
<div class="form-row">
<label for="node-input-reactor_type"><i class="fa fa-tag"></i> Reactor type</label>
<input type="text" id="node-input-reactor_type">
</div>
<div class="form-row">
<label for="node-input-volume"><i class="fa fa-tag"></i> Fluid volume [m3]</label>
<input type="text" id="node-input-volume" placeholder="m3">
</div>
<div class="form-row PFR">
<label for="node-input-length"><i class="fa fa-tag"></i> Reactor length [m]</label>
<input type="text" id="node-input-length" placeholder="m">
</div>
<div class="form-row PFR">
<label for="node-input-resolution_L"><i class="fa fa-tag"></i> Resolution</label>
<input type="text" id="node-input-resolution_L" placeholder="#">
</div>
<div class="form-row">
<label for="node-input-n_inlets"><i class="fa fa-tag"></i> Number of inlets</label>
<input type="text" id="node-input-n_inlets" placeholder="#">