Skip to content

Commit

Permalink
All necessary boxes and changes to create a simple structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqSun97 committed May 28, 2021
1 parent 50654a7 commit 7cff740
Show file tree
Hide file tree
Showing 13 changed files with 432 additions and 2 deletions.
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,14 @@
<script type="text/javascript" src="js/nodes/output_view.js"></script>
<script type="text/javascript" src="js/nodes/project_parameters.js"></script>
<script type="text/javascript" src="js/nodes/problem_data.js"></script>
<script type="text/javascript" src="js/nodes/structural_project_parameters.js"></script>


<!-- Postprocess -->
<script type="text/javascript" src="js/nodes/output_processes/gid_output.js"></script>
<script type="text/javascript" src="js/nodes/output_processes/gid_output_structural.js"></script>
<script type="text/javascript" src="js/nodes/output_processes/vtk_output_structural.js"></script>


<!-- Solver settings for solvers -->
<script type="text/javascript" src="js/nodes/solver_settings/fluid_monolithic_solver.js"></script>
Expand All @@ -68,6 +73,7 @@
<!-- Materials -->
<script type="text/javascript" src="js/nodes/materials/materials_list.js"></script>
<script type="text/javascript" src="js/nodes/materials/material_newtonian.js"></script>
<script type="text/javascript" src="js/nodes/materials/structural_material.js"></script>
<script type="text/javascript" src="js/nodes/materials/material_writer.js"></script>

<!-- Processes nodes -->
Expand All @@ -76,6 +82,12 @@
<script type="text/javascript" src="js/nodes/processes/inlet_by_function.js"></script>
<script type="text/javascript" src="js/nodes/processes/outlet_process.js"></script>
<script type="text/javascript" src="js/nodes/processes/no_slip_process.js"></script>
<script type="text/javascript" src="js/nodes/processes/constraints_process_list.js"></script>
<script type="text/javascript" src="js/nodes/processes/load_process_list.js"></script>
<script type="text/javascript" src="js/nodes/processes/boolean_list.js"></script>
<script type="text/javascript" src="js/nodes/processes/vector.js"></script>
<script type="text/javascript" src="js/nodes/processes/interval.js"></script>


<script type="text/javascript" src="js/demos.js"></script>
<script type="text/javascript" src="js/code.js"></script>
Expand Down
12 changes: 12 additions & 0 deletions js/nodes/materials/materials_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ class MaterialsList extends InputList{
this.input_type = "material";
this.output_type = "material_array";
}
onExecute() {
if (!this._value) {
this._value = new Array();
}
this._value.length = this.inputs.length - 1;
for (let i = 0; i < this.inputs.length - 1; ++i) {
this._value[i] = this.getInputData(i);
}

this.setOutputData(0, {"properties":this._value});
}

};

MaterialsList.title = "Materials list";
Expand Down
64 changes: 64 additions & 0 deletions js/nodes/materials/structural_material.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// TODO: Create a material base class
class StructuralMaterial {
constructor()
{
this.addInput("model_part_name","string");
this.properties = {
"model_part_name" : "Structure.Parts_Solid_Solid_Auto1",
"properties_id" : 1,
"Material" : {
"constitutive_law" : {
"name" : "LinearElasticPlaneStress2DLaw"
},
"Variables" : {
"DENSITY" : 7850.0,
"YOUNG_MODULUS" : 206900000000.0,
"POISSON_RATIO" : 0.29,
"THICKNESS" : 0.1
},
"Tables" : {}
}
};

this.properties_id = this.addWidget("combo","Properties_ID", 1, function(v){}, { values:[1, 2, 3, 4, 5]} );
this.name = this.addWidget("text","Name", "LinearElasticPlaneStress2DLaw", function(v){}, function(v){}, {} );
this.DENSITY= this.addWidget("number","Density", 7850.0, function(v){}, {});
this.YOUNG_MODULUS = this.addWidget("number","Young_Modulus", 206900000000.0, function(v){}, {});
this.POISSON_RATIO = this.addWidget("number","Poisson_Ratio", 0.29, function(v){}, {});
this.THICKNESS = this.addWidget("number","Thinckness", 0.1, function(v){}, {});
this.addInput("tables","process_array");
this.addOutput("Material","material");

this.size = this.computeSize();
}

onExecute()
{
this._value = Object.assign({}, this.properties);

// Current material model part
this._value["model_part_name"] = this.getInputData(0)

// Table
if (this.getInputData(7) != undefined) {
this._value["Material"]["Table"] = this.getInputData(7)
} else {
this._value["Material"]["Table"]= this.properties["Table"]
}
this._value["properties_id"] = this.properties_id.value
this._value["Material"]["constitutive_law"]["name"] = this.name.value
this._value["Material"]["Variables"]["DENSITY"] = this.DENSITY.value
this._value["Material"]["Variables"]["YOUNG_MODULUS"] = this.YOUNG_MODULUS.value
this._value["Material"]["Variables"]["POISSON_RATIO"] = this.POISSON_RATIO.value
this._value["Material"]["Variables"]["THICKNESS"] = this.THICKNESS.value

this.setOutputData(0, this._value);
}
}

StructuralMaterial.title = "Structural material";
StructuralMaterial.desc = "Node to specify a Structurall material.";

LiteGraph.registerNodeType("materials/StructuralMaterial", StructuralMaterial);

console.log("StructuralMaterialNew node created"); //helps to debug
61 changes: 61 additions & 0 deletions js/nodes/output_processes/gid_output_structural.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

//********************************************************************/
//********************************************************************/
//********************************************************************/
//********************************************************************/
function GiDStructural() {

this.addOutput("Process", "process");
this.properties = {
"python_module" : "gid_output_process",
"kratos_module" : "KratosMultiphysics",
"process_name" : "GiDOutputProcess",
"help" : "This process writes postprocessing files for GiD",
"Parameters" : {
"model_part_name" : "Structure",
"output_name" : "SWQ",
"postprocess_parameters" : {
"result_file_configuration" : {
"gidpost_flags" : {
"GiDPostMode" : "GiD_PostBinary",
"WriteDeformedMeshFlag" : "WriteDeformed",
"WriteConditionsFlag" : "WriteConditions",
"MultiFileFlag" : "SingleFile"
},
"file_label" : "step",
"output_control_type" : "step",
"output_interval" : 1,
"body_output" : true,
"node_output" : false,
"skin_output" : false,
"plane_output" : [],
"nodal_results" : ["DISPLACEMENT","REACTION"],
"gauss_point_results" : ["VON_MISES_STRESS"],
"nodal_nonhistorical_results" : []
},
"point_data_configuration" : []
}
}
}
this.model_part_name = this.addWidget("text","ModelPartName", "Structure", function(v){}, {} );
this.output_name = this.addWidget("text","OutputName", "SWQ", function(v){}, {} );

this.size = this.computeSize();
}

GiDStructural.title = "GiD structural";
GiDStructural.desc = "Creates GiD structural";

GiDStructural.prototype.onExecute = function () {
output = this.properties

output["Parameters"]["model_part_name"] = this.model_part_name.value;
output["Parameters"]["output_name"] = this.output_name.value;


this.setOutputData(0, output);
};

LiteGraph.registerNodeType("output_processes/GiDStructural", GiDStructural);

console.log("GiD node created"); //helps to debug
47 changes: 47 additions & 0 deletions js/nodes/output_processes/vtk_output_structural.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

//********************************************************************/
//********************************************************************/
//********************************************************************/
//********************************************************************/
function VTKStructural() {

this.properties = {
"python_module" : "vtk_output_process",
"kratos_module" : "KratosMultiphysics",
"process_name" : "VtkOutputProcess",
"help" : "This process writes postprocessing files for Paraview",
"Parameters" : {
"model_part_name" : "Structure",
"output_control_type" : "step",
"output_interval" : 1,
"file_format" : "ascii",
"output_precision" : 7,
"output_sub_model_parts" : false,
"folder_name" : "vtk_output",
"save_output_files_in_folder" : true,
"nodal_solution_step_data_variables" : ["DISPLACEMENT","REACTION"],
"nodal_data_value_variables" : [],
"element_data_value_variables" : [],
"condition_data_value_variables" : [],
"gauss_point_variables_extrapolated_to_nodes" : ["VON_MISES_STRESS"]
}
}
this.addOutput("Process", "process");
this.model_part_name = this.addWidget("text","ModelPartName", "Structure", function(v){}, {} );
this.size = this.computeSize();
}

VTKStructural.title = "VTK structural";
VTKStructural.desc = "Creates VTK";

VTKStructural.prototype.onExecute = function () {
output = this.properties

output["Parameters"]["model_part_name"] = this.model_part_name.value;

this.setOutputData(0, output);
};

LiteGraph.registerNodeType("output_processes/VTK_structural", VTKStructural);

console.log("VTK node created"); //helps to debug
18 changes: 18 additions & 0 deletions js/nodes/processes/boolean_list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

function BooleanList (){
this.addOutput("", "process_array");
this.xposi = this.addWidget("toggle","x",true,);
this.yposi = this.addWidget("toggle","y",true,);
this.zposi = this.addWidget("toggle","z",true,);
}
BooleanList.title = "Boolean list";
BooleanList.desc = "Merges several boolean into an array";

BooleanList.prototype.onExecute = function() {
this.setOutputData(0, [this.xposi.value, this.yposi.value, this.zposi.value]);
};


LiteGraph.registerNodeType("processes/BooleanList", BooleanList);

console.log("BooleanList node created"); //helps to debug
72 changes: 72 additions & 0 deletions js/nodes/processes/constraints_process_list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
function ConstraintsProcessList () {
this.addInput("model_part_name","string");
this.addInput("interval","process_array");
this.addInput("constrained","process_array");
this.addInput("value","process_array")

this.properties = {

"python_module" : "assign_vector_variable_process",
"kratos_module" : "KratosMultiphysics",
"process_name" : "AssignVectorVariableProcess",
"Parameters" : {
"model_part_name" : "Structure.DISPLACEMENT_Displacement_Auto1",
"variable_name" : "DISPLACEMENT",
"interval" : [0.0,"End"],
"constrained" : [true,true,true],
"value" : [0.0,0.0,0.0]
}
};
var that = this;
this.variable_name = this.addWidget("text","VariableName", "DISPLACEMENT", function(v){}, {} );


this.addOutput("Process","process");

this.size = this.computeSize();
this.serialize_widgets = true;

}


ConstraintsProcessList.title = "Constraints process list";
ConstraintsProcessList.desc = "Node to specify a boundary process.";

ConstraintsProcessList.prototype.onExecute = function() {
myoutput = this.properties
// model_part_name
if (this.getInputData(0) != undefined) {
myoutput["Parameters"]["model_part_name"] = this.getInputData(0)
} else {
myoutput["Parameters"]["model_part_name"] = this.properties["Parameters"]["model_part_name"]
}
// interval
if (this.getInputData(1) != undefined) {
myoutput["Parameters"]["interval"] = this.getInputData(1)
} else {
myoutput["Parameters"]["interval"] = this.properties["Parameters"]["interval"]
}

// constrained
if (this.getInputData(2) != undefined) {
myoutput["Parameters"]["constrained"] = this.getInputData(2)
} else {
myoutput["Parameters"]["constrained"] = this.properties["Parameters"]["constrained"]
}

// value
if (this.getInputData(3) != undefined) {
myoutput["Parameters"]["value"] = this.getInputData(3)
} else {
myoutput["Parameters"]["value"] = this.properties["Parameters"]["value"]
}


myoutput["Parameters"]["variable_name"] = this.variable_name.value

this.setOutputData(0, myoutput);
};

LiteGraph.registerNodeType("processes/ConstraintsProcessList", ConstraintsProcessList );

console.log("ConstraintsProcessList node created"); //helps to debug
21 changes: 21 additions & 0 deletions js/nodes/processes/interval.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

function Interval(){
this.addOutput("", "process_array");
this.widget_1 = this.addWidget("number","Initial", 0, function(v){}, {});
this.widget_2 = this.addWidget("text","Final", "End", function(v){}, {});


};

Interval.title = "Interval";
Interval.desc = "Time interval";

Interval.prototype.onExecute = function() {
this.setOutputData(0, [this.widget_1.value, this.widget_2.value])
};

LiteGraph.registerNodeType("processes/interval", Interval);

console.log("Interval node created"); //helps to debug


Loading

0 comments on commit 7cff740

Please sign in to comment.