Skip to content

Commit 7cff740

Browse files
committed
All necessary boxes and changes to create a simple structure.
1 parent 50654a7 commit 7cff740

13 files changed

Lines changed: 432 additions & 2 deletions

index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,14 @@
4949
<script type="text/javascript" src="js/nodes/output_view.js"></script>
5050
<script type="text/javascript" src="js/nodes/project_parameters.js"></script>
5151
<script type="text/javascript" src="js/nodes/problem_data.js"></script>
52+
<script type="text/javascript" src="js/nodes/structural_project_parameters.js"></script>
53+
5254

5355
<!-- Postprocess -->
5456
<script type="text/javascript" src="js/nodes/output_processes/gid_output.js"></script>
57+
<script type="text/javascript" src="js/nodes/output_processes/gid_output_structural.js"></script>
58+
<script type="text/javascript" src="js/nodes/output_processes/vtk_output_structural.js"></script>
59+
5560

5661
<!-- Solver settings for solvers -->
5762
<script type="text/javascript" src="js/nodes/solver_settings/fluid_monolithic_solver.js"></script>
@@ -68,6 +73,7 @@
6873
<!-- Materials -->
6974
<script type="text/javascript" src="js/nodes/materials/materials_list.js"></script>
7075
<script type="text/javascript" src="js/nodes/materials/material_newtonian.js"></script>
76+
<script type="text/javascript" src="js/nodes/materials/structural_material.js"></script>
7177
<script type="text/javascript" src="js/nodes/materials/material_writer.js"></script>
7278

7379
<!-- Processes nodes -->
@@ -76,6 +82,12 @@
7682
<script type="text/javascript" src="js/nodes/processes/inlet_by_function.js"></script>
7783
<script type="text/javascript" src="js/nodes/processes/outlet_process.js"></script>
7884
<script type="text/javascript" src="js/nodes/processes/no_slip_process.js"></script>
85+
<script type="text/javascript" src="js/nodes/processes/constraints_process_list.js"></script>
86+
<script type="text/javascript" src="js/nodes/processes/load_process_list.js"></script>
87+
<script type="text/javascript" src="js/nodes/processes/boolean_list.js"></script>
88+
<script type="text/javascript" src="js/nodes/processes/vector.js"></script>
89+
<script type="text/javascript" src="js/nodes/processes/interval.js"></script>
90+
7991

8092
<script type="text/javascript" src="js/demos.js"></script>
8193
<script type="text/javascript" src="js/code.js"></script>

js/nodes/materials/materials_list.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ class MaterialsList extends InputList{
55
this.input_type = "material";
66
this.output_type = "material_array";
77
}
8+
onExecute() {
9+
if (!this._value) {
10+
this._value = new Array();
11+
}
12+
this._value.length = this.inputs.length - 1;
13+
for (let i = 0; i < this.inputs.length - 1; ++i) {
14+
this._value[i] = this.getInputData(i);
15+
}
16+
17+
this.setOutputData(0, {"properties":this._value});
18+
}
19+
820
};
921

1022
MaterialsList.title = "Materials list";
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// TODO: Create a material base class
2+
class StructuralMaterial {
3+
constructor()
4+
{
5+
this.addInput("model_part_name","string");
6+
this.properties = {
7+
"model_part_name" : "Structure.Parts_Solid_Solid_Auto1",
8+
"properties_id" : 1,
9+
"Material" : {
10+
"constitutive_law" : {
11+
"name" : "LinearElasticPlaneStress2DLaw"
12+
},
13+
"Variables" : {
14+
"DENSITY" : 7850.0,
15+
"YOUNG_MODULUS" : 206900000000.0,
16+
"POISSON_RATIO" : 0.29,
17+
"THICKNESS" : 0.1
18+
},
19+
"Tables" : {}
20+
}
21+
};
22+
23+
this.properties_id = this.addWidget("combo","Properties_ID", 1, function(v){}, { values:[1, 2, 3, 4, 5]} );
24+
this.name = this.addWidget("text","Name", "LinearElasticPlaneStress2DLaw", function(v){}, function(v){}, {} );
25+
this.DENSITY= this.addWidget("number","Density", 7850.0, function(v){}, {});
26+
this.YOUNG_MODULUS = this.addWidget("number","Young_Modulus", 206900000000.0, function(v){}, {});
27+
this.POISSON_RATIO = this.addWidget("number","Poisson_Ratio", 0.29, function(v){}, {});
28+
this.THICKNESS = this.addWidget("number","Thinckness", 0.1, function(v){}, {});
29+
this.addInput("tables","process_array");
30+
this.addOutput("Material","material");
31+
32+
this.size = this.computeSize();
33+
}
34+
35+
onExecute()
36+
{
37+
this._value = Object.assign({}, this.properties);
38+
39+
// Current material model part
40+
this._value["model_part_name"] = this.getInputData(0)
41+
42+
// Table
43+
if (this.getInputData(7) != undefined) {
44+
this._value["Material"]["Table"] = this.getInputData(7)
45+
} else {
46+
this._value["Material"]["Table"]= this.properties["Table"]
47+
}
48+
this._value["properties_id"] = this.properties_id.value
49+
this._value["Material"]["constitutive_law"]["name"] = this.name.value
50+
this._value["Material"]["Variables"]["DENSITY"] = this.DENSITY.value
51+
this._value["Material"]["Variables"]["YOUNG_MODULUS"] = this.YOUNG_MODULUS.value
52+
this._value["Material"]["Variables"]["POISSON_RATIO"] = this.POISSON_RATIO.value
53+
this._value["Material"]["Variables"]["THICKNESS"] = this.THICKNESS.value
54+
55+
this.setOutputData(0, this._value);
56+
}
57+
}
58+
59+
StructuralMaterial.title = "Structural material";
60+
StructuralMaterial.desc = "Node to specify a Structurall material.";
61+
62+
LiteGraph.registerNodeType("materials/StructuralMaterial", StructuralMaterial);
63+
64+
console.log("StructuralMaterialNew node created"); //helps to debug
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
2+
//********************************************************************/
3+
//********************************************************************/
4+
//********************************************************************/
5+
//********************************************************************/
6+
function GiDStructural() {
7+
8+
this.addOutput("Process", "process");
9+
this.properties = {
10+
"python_module" : "gid_output_process",
11+
"kratos_module" : "KratosMultiphysics",
12+
"process_name" : "GiDOutputProcess",
13+
"help" : "This process writes postprocessing files for GiD",
14+
"Parameters" : {
15+
"model_part_name" : "Structure",
16+
"output_name" : "SWQ",
17+
"postprocess_parameters" : {
18+
"result_file_configuration" : {
19+
"gidpost_flags" : {
20+
"GiDPostMode" : "GiD_PostBinary",
21+
"WriteDeformedMeshFlag" : "WriteDeformed",
22+
"WriteConditionsFlag" : "WriteConditions",
23+
"MultiFileFlag" : "SingleFile"
24+
},
25+
"file_label" : "step",
26+
"output_control_type" : "step",
27+
"output_interval" : 1,
28+
"body_output" : true,
29+
"node_output" : false,
30+
"skin_output" : false,
31+
"plane_output" : [],
32+
"nodal_results" : ["DISPLACEMENT","REACTION"],
33+
"gauss_point_results" : ["VON_MISES_STRESS"],
34+
"nodal_nonhistorical_results" : []
35+
},
36+
"point_data_configuration" : []
37+
}
38+
}
39+
}
40+
this.model_part_name = this.addWidget("text","ModelPartName", "Structure", function(v){}, {} );
41+
this.output_name = this.addWidget("text","OutputName", "SWQ", function(v){}, {} );
42+
43+
this.size = this.computeSize();
44+
}
45+
46+
GiDStructural.title = "GiD structural";
47+
GiDStructural.desc = "Creates GiD structural";
48+
49+
GiDStructural.prototype.onExecute = function () {
50+
output = this.properties
51+
52+
output["Parameters"]["model_part_name"] = this.model_part_name.value;
53+
output["Parameters"]["output_name"] = this.output_name.value;
54+
55+
56+
this.setOutputData(0, output);
57+
};
58+
59+
LiteGraph.registerNodeType("output_processes/GiDStructural", GiDStructural);
60+
61+
console.log("GiD node created"); //helps to debug
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
//********************************************************************/
3+
//********************************************************************/
4+
//********************************************************************/
5+
//********************************************************************/
6+
function VTKStructural() {
7+
8+
this.properties = {
9+
"python_module" : "vtk_output_process",
10+
"kratos_module" : "KratosMultiphysics",
11+
"process_name" : "VtkOutputProcess",
12+
"help" : "This process writes postprocessing files for Paraview",
13+
"Parameters" : {
14+
"model_part_name" : "Structure",
15+
"output_control_type" : "step",
16+
"output_interval" : 1,
17+
"file_format" : "ascii",
18+
"output_precision" : 7,
19+
"output_sub_model_parts" : false,
20+
"folder_name" : "vtk_output",
21+
"save_output_files_in_folder" : true,
22+
"nodal_solution_step_data_variables" : ["DISPLACEMENT","REACTION"],
23+
"nodal_data_value_variables" : [],
24+
"element_data_value_variables" : [],
25+
"condition_data_value_variables" : [],
26+
"gauss_point_variables_extrapolated_to_nodes" : ["VON_MISES_STRESS"]
27+
}
28+
}
29+
this.addOutput("Process", "process");
30+
this.model_part_name = this.addWidget("text","ModelPartName", "Structure", function(v){}, {} );
31+
this.size = this.computeSize();
32+
}
33+
34+
VTKStructural.title = "VTK structural";
35+
VTKStructural.desc = "Creates VTK";
36+
37+
VTKStructural.prototype.onExecute = function () {
38+
output = this.properties
39+
40+
output["Parameters"]["model_part_name"] = this.model_part_name.value;
41+
42+
this.setOutputData(0, output);
43+
};
44+
45+
LiteGraph.registerNodeType("output_processes/VTK_structural", VTKStructural);
46+
47+
console.log("VTK node created"); //helps to debug

js/nodes/processes/boolean_list.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
function BooleanList (){
3+
this.addOutput("", "process_array");
4+
this.xposi = this.addWidget("toggle","x",true,);
5+
this.yposi = this.addWidget("toggle","y",true,);
6+
this.zposi = this.addWidget("toggle","z",true,);
7+
}
8+
BooleanList.title = "Boolean list";
9+
BooleanList.desc = "Merges several boolean into an array";
10+
11+
BooleanList.prototype.onExecute = function() {
12+
this.setOutputData(0, [this.xposi.value, this.yposi.value, this.zposi.value]);
13+
};
14+
15+
16+
LiteGraph.registerNodeType("processes/BooleanList", BooleanList);
17+
18+
console.log("BooleanList node created"); //helps to debug
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
function ConstraintsProcessList () {
2+
this.addInput("model_part_name","string");
3+
this.addInput("interval","process_array");
4+
this.addInput("constrained","process_array");
5+
this.addInput("value","process_array")
6+
7+
this.properties = {
8+
9+
"python_module" : "assign_vector_variable_process",
10+
"kratos_module" : "KratosMultiphysics",
11+
"process_name" : "AssignVectorVariableProcess",
12+
"Parameters" : {
13+
"model_part_name" : "Structure.DISPLACEMENT_Displacement_Auto1",
14+
"variable_name" : "DISPLACEMENT",
15+
"interval" : [0.0,"End"],
16+
"constrained" : [true,true,true],
17+
"value" : [0.0,0.0,0.0]
18+
}
19+
};
20+
var that = this;
21+
this.variable_name = this.addWidget("text","VariableName", "DISPLACEMENT", function(v){}, {} );
22+
23+
24+
this.addOutput("Process","process");
25+
26+
this.size = this.computeSize();
27+
this.serialize_widgets = true;
28+
29+
}
30+
31+
32+
ConstraintsProcessList.title = "Constraints process list";
33+
ConstraintsProcessList.desc = "Node to specify a boundary process.";
34+
35+
ConstraintsProcessList.prototype.onExecute = function() {
36+
myoutput = this.properties
37+
// model_part_name
38+
if (this.getInputData(0) != undefined) {
39+
myoutput["Parameters"]["model_part_name"] = this.getInputData(0)
40+
} else {
41+
myoutput["Parameters"]["model_part_name"] = this.properties["Parameters"]["model_part_name"]
42+
}
43+
// interval
44+
if (this.getInputData(1) != undefined) {
45+
myoutput["Parameters"]["interval"] = this.getInputData(1)
46+
} else {
47+
myoutput["Parameters"]["interval"] = this.properties["Parameters"]["interval"]
48+
}
49+
50+
// constrained
51+
if (this.getInputData(2) != undefined) {
52+
myoutput["Parameters"]["constrained"] = this.getInputData(2)
53+
} else {
54+
myoutput["Parameters"]["constrained"] = this.properties["Parameters"]["constrained"]
55+
}
56+
57+
// value
58+
if (this.getInputData(3) != undefined) {
59+
myoutput["Parameters"]["value"] = this.getInputData(3)
60+
} else {
61+
myoutput["Parameters"]["value"] = this.properties["Parameters"]["value"]
62+
}
63+
64+
65+
myoutput["Parameters"]["variable_name"] = this.variable_name.value
66+
67+
this.setOutputData(0, myoutput);
68+
};
69+
70+
LiteGraph.registerNodeType("processes/ConstraintsProcessList", ConstraintsProcessList );
71+
72+
console.log("ConstraintsProcessList node created"); //helps to debug

js/nodes/processes/interval.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
function Interval(){
3+
this.addOutput("", "process_array");
4+
this.widget_1 = this.addWidget("number","Initial", 0, function(v){}, {});
5+
this.widget_2 = this.addWidget("text","Final", "End", function(v){}, {});
6+
7+
8+
};
9+
10+
Interval.title = "Interval";
11+
Interval.desc = "Time interval";
12+
13+
Interval.prototype.onExecute = function() {
14+
this.setOutputData(0, [this.widget_1.value, this.widget_2.value])
15+
};
16+
17+
LiteGraph.registerNodeType("processes/interval", Interval);
18+
19+
console.log("Interval node created"); //helps to debug
20+
21+

0 commit comments

Comments
 (0)