Skip to content

Commit 4e98f59

Browse files
author
IAntonau
committed
fine meshes
1 parent 128ca9c commit 4e98f59

66 files changed

Lines changed: 45872 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import KratosMultiphysics as Kratos
2+
from KratosMultiphysics.StructuralMechanicsApplication.structural_mechanics_analysis import StructuralMechanicsAnalysis
3+
import KratosMultiphysics.OptimizationApplication as KratosOA
4+
5+
class CustomStructuralMechanicsAnalysis(StructuralMechanicsAnalysis):
6+
def FinalizeSolutionStep(self):
7+
for element in self._GetSolver().GetComputingModelPart().Elements:
8+
element.SetValue(Kratos.YOUNG_MODULUS, element.Properties[Kratos.YOUNG_MODULUS])
9+
10+
if __name__ == "__main__":
11+
model = Kratos.Model()
12+
13+
with open("PrimalParametersCase2A.json", "r") as file_input:
14+
parameters = Kratos.Parameters(file_input.read())
15+
16+
analysis = CustomStructuralMechanicsAnalysis(model, parameters)
17+
analysis.Run()
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
{
2+
"problem_data": {
3+
"problem_name": "solve_forward_problem_system_identification",
4+
"parallel_type": "OpenMP",
5+
"echo_level": 0,
6+
"start_time": 0.0,
7+
"end_time": 1.0
8+
},
9+
"solver_settings": {
10+
"solver_type": "Static",
11+
"model_part_name": "Structure",
12+
"domain_size": 3,
13+
"echo_level": 0,
14+
"analysis_type": "linear",
15+
"model_import_settings": {
16+
"input_type": "mdpa",
17+
"input_filename": "../../prep_mdpa/Structure_fine"
18+
},
19+
"material_import_settings": {
20+
"materials_filename": "StructuralMaterials.json"
21+
},
22+
"time_stepping": {
23+
"time_step": 1.0
24+
},
25+
"solving_strategy_settings": {
26+
"line_search": false
27+
},
28+
"move_mesh_flag": false,
29+
"convergence_criterion": "residual_criterion",
30+
"displacement_relative_tolerance": 0.0001,
31+
"displacement_absolute_tolerance": 1e-9,
32+
"residual_relative_tolerance": 0.0001,
33+
"residual_absolute_tolerance": 1e-9,
34+
"max_iteration": 20,
35+
"rotation_dofs": true,
36+
"volumetric_strain_dofs": false
37+
},
38+
"processes": {
39+
"constraints_process_list": [
40+
{
41+
"python_module": "assign_vector_variable_process",
42+
"kratos_module": "KratosMultiphysics",
43+
"help": "This process fixes the selected components of a given vector variable",
44+
"process_name": "AssignVectorVariableProcess",
45+
"Parameters": {
46+
"model_part_name": "Structure.left_fixed",
47+
"variable_name": "DISPLACEMENT",
48+
"value": [
49+
0.0,
50+
0.0,
51+
0.0
52+
],
53+
"constrained": [
54+
true,
55+
true,
56+
true
57+
],
58+
"interval": [
59+
0.0,
60+
"End"
61+
]
62+
}
63+
}
64+
],
65+
"loads_process_list": [
66+
{
67+
"python_module": "assign_vector_by_direction_to_condition_process",
68+
"kratos_module": "KratosMultiphysics",
69+
"help": "This process sets a vector variable value over a condition",
70+
"check": "DirectorVectorNonZero direction",
71+
"process_name": "AssignModulusAndDirectionToConditionsProcess",
72+
"Parameters": {
73+
"model_part_name": "Structure.right_force",
74+
"variable_name": "LINE_LOAD",
75+
"modulus": 500000.0,
76+
"direction": [
77+
1.0,
78+
0.0,
79+
0.0
80+
],
81+
"interval": [
82+
0.0,
83+
"End"
84+
]
85+
}
86+
}
87+
],
88+
"list_other_processes": []
89+
},
90+
"output_processes": {
91+
"sensor_output": [
92+
{
93+
"Parameters": {
94+
"model_part_name": "Structure",
95+
"output_file_name": "measured_data.csv",
96+
"@include_json": "../sensor_placement/sensor_data.json"
97+
},
98+
"kratos_module": "KratosMultiphysics.SystemIdentificationApplication.processes",
99+
"process_name": "SensorOutputProcess",
100+
"python_module": "sensor_output_process"
101+
}
102+
],
103+
"vtk_output": [
104+
{
105+
"Parameters": {
106+
"condition_data_value_variables": [],
107+
"element_data_value_variables": [
108+
"YOUNG_MODULUS"
109+
],
110+
"file_format": "binary",
111+
"model_part_name": "Structure",
112+
"nodal_data_value_variables": [],
113+
"nodal_solution_step_data_variables": [
114+
"DISPLACEMENT",
115+
"REACTION",
116+
"ROTATION"
117+
],
118+
"gauss_point_variables_extrapolated_to_nodes": [
119+
"VON_MISES_STRESS"
120+
],
121+
"output_control_type": "step",
122+
"output_interval": 1,
123+
"output_path": "Output",
124+
"output_precision": 7,
125+
"output_sub_model_parts": true,
126+
"save_output_files_in_folder": true
127+
},
128+
"help": "This process writes postprocessing files for Paraview",
129+
"kratos_module": "KratosMultiphysics",
130+
"process_name": "VtkOutputProcess",
131+
"python_module": "vtk_output_process"
132+
}
133+
]
134+
},
135+
"analysis_stage": "KratosMultiphysics.StructuralMechanicsApplication.structural_mechanics_analysis"
136+
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"properties": [
3+
{
4+
"model_part_name": "Structure.main",
5+
"properties_id": 1,
6+
"Material": {
7+
"constitutive_law": {
8+
"name": "LinearElasticPlaneStress2DLaw"
9+
},
10+
"Variables": {
11+
"THICKNESS": 0.0025,
12+
"DENSITY": 1.0,
13+
"YOUNG_MODULUS": 210e9,
14+
"POISSON_RATIO": 0.29
15+
},
16+
"Tables": {}
17+
}
18+
},
19+
{
20+
"model_part_name": "Structure.damage_1",
21+
"properties_id": 6,
22+
"Material": {
23+
"constitutive_law": {
24+
"name": "LinearElasticPlaneStress2DLaw"
25+
},
26+
"Variables": {
27+
"THICKNESS": 0.0025,
28+
"DENSITY": 1.0,
29+
"YOUNG_MODULUS": 210e9,
30+
"POISSON_RATIO": 0.29
31+
},
32+
"Tables": {}
33+
}
34+
},
35+
{
36+
"model_part_name": "Structure.damage_2",
37+
"properties_id": 2,
38+
"Material": {
39+
"constitutive_law": {
40+
"name": "LinearElasticPlaneStress2DLaw"
41+
},
42+
"Variables": {
43+
"THICKNESS": 0.0025,
44+
"DENSITY": 1.0,
45+
"YOUNG_MODULUS": 210e9,
46+
"POISSON_RATIO": 0.29
47+
},
48+
"Tables": {}
49+
}
50+
},
51+
{
52+
"model_part_name": "Structure.damage_3",
53+
"properties_id": 3,
54+
"Material": {
55+
"constitutive_law": {
56+
"name": "LinearElasticPlaneStress2DLaw"
57+
},
58+
"Variables": {
59+
"THICKNESS": 0.0025,
60+
"DENSITY": 1.0,
61+
"YOUNG_MODULUS": 210e9,
62+
"POISSON_RATIO": 0.29
63+
},
64+
"Tables": {}
65+
}
66+
},
67+
{
68+
"model_part_name": "Structure.damage_4",
69+
"properties_id": 4,
70+
"Material": {
71+
"constitutive_law": {
72+
"name": "LinearElasticPlaneStress2DLaw"
73+
},
74+
"Variables": {
75+
"THICKNESS": 0.0025,
76+
"DENSITY": 1.0,
77+
"YOUNG_MODULUS": 210e9,
78+
"POISSON_RATIO": 0.29
79+
},
80+
"Tables": {}
81+
}
82+
},
83+
{
84+
"model_part_name": "Structure.damage_5",
85+
"properties_id": 5,
86+
"Material": {
87+
"constitutive_law": {
88+
"name": "LinearElasticPlaneStress2DLaw"
89+
},
90+
"Variables": {
91+
"THICKNESS": 0.0025,
92+
"DENSITY": 1.0,
93+
"YOUNG_MODULUS": 50e9,
94+
"POISSON_RATIO": 0.29
95+
},
96+
"Tables": {}
97+
}
98+
}
99+
]
100+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
cd damaged_system
4+
# Check if MainKratos.py exists
5+
if [ ! -f "MainKratos.py" ]; then
6+
echo "MainKratos.py not found!"
7+
exit 1
8+
fi
9+
10+
# Run MainKratos.py with Python and output the log to a file with tee
11+
python MainKratos.py | tee ../Optimization_Results/log.txt
12+
13+
cd ../system_identification
14+
15+
# delete log.txt and abs_error.csv before running the code
16+
rm -r Optimization_Results/
17+
mkdir Optimization_Results
18+
19+
# Check if MainKratos.py exists
20+
if [ ! -f "MainKratos.py" ]; then
21+
echo "MainKratos.py not found!"
22+
exit 1
23+
fi
24+
25+
sleep 1
26+
# Run MainKratos.py with Python and output the log to a file with tee
27+
python MainKratos.py | tee Optimization_Results/log.txt
Binary file not shown.

0 commit comments

Comments
 (0)