Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structural Mechanics Cases #7

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
aef86d5
A new structural solver box
WeiqSun97 May 27, 2021
9abec2a
Enable the new box created to be detected
WeiqSun97 May 27, 2021
50654a7
A change of the name of the solver_type
WeiqSun97 May 28, 2021
068c2f4
To type filename correctly
WeiqSun97 May 29, 2021
7fbce47
Enables new boxes to be detected
WeiqSun97 May 29, 2021
9b8335d
Set output name
WeiqSun97 May 29, 2021
c24496c
To define structural material properties
WeiqSun97 May 29, 2021
a752602
To define new outputs
WeiqSun97 May 29, 2021
d3c1c57
To merge several boolean into an array
WeiqSun97 May 29, 2021
d821956
To define boundary conditions
WeiqSun97 May 29, 2021
b0352c5
To define a time interval
WeiqSun97 May 29, 2021
eba8a6b
To define a constant load
WeiqSun97 May 29, 2021
263722d
To define a vector as an array
WeiqSun97 May 29, 2021
6bc5f6e
To be able typing input filename
WeiqSun97 May 29, 2021
a77ca0a
Project parameters for structural mechanics cases
WeiqSun97 May 29, 2021
03bc2c1
An example
WeiqSun97 May 29, 2021
50ee40f
Correction of the filename
WeiqSun97 May 31, 2021
d998d8a
Relocation
WeiqSun97 May 31, 2021
d95a9d7
Modification of the description
WeiqSun97 May 31, 2021
9d4ddb1
Correction of the filename, title and registration.
WeiqSun97 May 31, 2021
5823155
Rename the function
WeiqSun97 May 31, 2021
06cd5aa
Correction of the filename, title and registration.
WeiqSun97 May 31, 2021
3f7970b
Rename the function
WeiqSun97 May 31, 2021
d2aebf8
Correction of the description
WeiqSun97 May 31, 2021
2ec3e33
Merge remote-tracking branch 'origin/StructuralMechanicsWorkFlow' int…
WeiqSun97 May 31, 2021
fed6253
Delete merged code
WeiqSun97 Jun 1, 2021
be2a39d
Modification of a box due to a change of the box name
WeiqSun97 Jun 1, 2021
a34de81
Hyper reduced order model example
WeiqSun97 Jul 15, 2021
1b84156
New node to assign scalar variable to conditions process
WeiqSun97 Jul 15, 2021
37c9f18
Download file with correct extension
WeiqSun97 Jul 25, 2021
bff6599
Change of module name and node name
WeiqSun97 Jul 26, 2021
ad20de9
Add new force node
WeiqSun97 Jul 28, 2021
d85fdd9
More possible problem types
WeiqSun97 Jul 28, 2021
2724d7f
Add another problem type
WeiqSun97 Jul 28, 2021
c5e59d2
Actualization of the example
WeiqSun97 Jul 28, 2021
993a938
A new example
WeiqSun97 Jul 28, 2021
8f71882
No initializing the input filename
WeiqSun97 Jul 28, 2021
51f1d15
No initializing module names
WeiqSun97 Jul 28, 2021
efdd6ef
A new force node
WeiqSun97 Jul 28, 2021
dd021fd
Add a new possible model part name
WeiqSun97 Jul 28, 2021
2f0b06a
Erasing unused files
Rbravo555 Oct 13, 2021
d0086ef
Add an extra output from the Parsed Model Part: the file name.
Rbravo555 Oct 13, 2021
71a142b
Accept the file name as an input to the model import settings box
Rbravo555 Oct 13, 2021
47c6d85
adding default values in processes
Rbravo555 Oct 13, 2021
2eb96f4
Erasing some examples that still need more work
Rbravo555 Oct 14, 2021
d9b9f9d
Updating Structural Mechanics example
Rbravo555 Oct 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,17 @@
<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>
Comment on lines +56 to +57
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need specific nodes for the structural output?


<!-- Solver settings for solvers -->
<script type="text/javascript" src="js/nodes/solver_settings/fluid_monolithic_solver.js"></script>
<script type="text/javascript" src="js/nodes/solver_settings/structural_mechanics_solver.js"></script>


<!-- Auxiliary nodes required by solver settings -->
<!-- Other nodes -->
Expand All @@ -66,6 +71,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 @@ -74,6 +80,14 @@
<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_pressure.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>

<!-- Input -->
<script type="text/javascript" src="js/nodes/input/interval.js"></script>

<script type="text/javascript" src="js/demos.js"></script>
<script type="text/javascript" src="js/code.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion js/nodes/download_problem.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DownloadProblem {
zip.file("ProjectParameters.json", new Blob([str]));

Object.entries(problem_files["materials"]).forEach(([key, value]) => {
zip.file(value["name"]+".json", new Blob([JSON.stringify(value["data"])]));
zip.file(value["name"], new Blob([JSON.stringify(value["data"])]));
});

// var img = zip.folder("images");
Expand Down
21 changes: 21 additions & 0 deletions js/nodes/input/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


2 changes: 1 addition & 1 deletion js/nodes/materials/material_writer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class MaterialWriter {
constructor()
{
this.material_file_name = this.addWidget("string","Materials Filenae", "Materials");
this.material_file_name = this.addWidget("string","Materials Filenae", "Materials.json");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this.material_file_name = this.addWidget("string","Materials Filenae", "Materials.json");
this.material_file_name = this.addWidget("string","Materials Filename", "Materials.json");

Typo

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are commenting on an outdated file, as the specific file material_writer.js has been modified in this PR.

this.addInput("Material List","material_array");
this.addOutput("Material","string");
this.size = this.computeSize();
Expand Down
11 changes: 11 additions & 0 deletions js/nodes/materials/materials_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ 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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must be an input.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rubenzorrilla these are the defaults, assignments are done in onExecute function.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I missed the part in which the claw is chosen. I thought it was hardcoded in the defaults.

},
"Variables" : {
"DENSITY" : 7850.0,
"YOUNG_MODULUS" : 206900000000.0,
"POISSON_RATIO" : 0.29,
"THICKNESS" : 0.1
Comment on lines +14 to +17
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and these would depend on the input above. Just pointing it out as this most probably affects the design.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mm that's interesting, if we want to to this probably we should refactor the whole constitutive law as you say. There is no pretty way to make the variables change dynamically in a node, but we could create an additional node per CL with let the user adjust the variables and their values.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd go for the second one, create a node per each constitutive law. In my opinion, this would have the next advantages:

  1. Keep everything required for a constitutive law to work encapsulated in a single node. This also allow us to set custom defaults for each claw.
  2. Makes much easier the addition of new constitutive laws for developers that are not familiar with the flowgraph.

},
"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.VISUALIZE_HROM", 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 AssignVectorVariableProcess () {
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;

}


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

AssignVectorVariableProcess.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", AssignVectorVariableProcess );

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