KratosMeshingApplication 10.4.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- KratosMultiphysics/.libs/KratosMeshingApplication.so +0 -0
- KratosMultiphysics/.libs/libKratosMeshingCore.dylib +0 -0
- KratosMultiphysics/MeshingApplication/__init__.py +14 -0
- KratosMultiphysics/MeshingApplication/gradual_variable_interpolation_process.py +79 -0
- KratosMultiphysics/MeshingApplication/mmg_process.py +953 -0
- KratosMultiphysics/MeshingApplication/modelers/convert_linear_tetrahedra_to_quadratic_modeler.py +94 -0
- KratosMultiphysics/MeshingApplication/modelers/mmg_modeler.py +67 -0
- KratosMultiphysics/MeshingApplication/multiscale_refining_process.py +192 -0
- KratosMultiphysics/MeshingApplication/python_registry_lists.py +11 -0
- kratosmeshingapplication-10.4.4.dist-info/METADATA +159 -0
- kratosmeshingapplication-10.4.4.dist-info/RECORD +16 -0
- kratosmeshingapplication-10.4.4.dist-info/WHEEL +6 -0
- kratosmeshingapplication.dylibs/libKratosCore.dylib +4 -0
- kratosmeshingapplication.dylibs/libgcc_s.1.1.dylib +0 -0
- kratosmeshingapplication.dylibs/libgomp.1.dylib +0 -0
- kratosmeshingapplication.dylibs/libstdc++.6.dylib +0 -0
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Application dependent names and paths
|
|
2
|
+
from KratosMultiphysics import _ImportApplication
|
|
3
|
+
from KratosMultiphysics import IsDistributedRun
|
|
4
|
+
if IsDistributedRun():
|
|
5
|
+
import KratosMultiphysics.mpi # importing the MPI-Core
|
|
6
|
+
from KratosMeshingApplication import *
|
|
7
|
+
application = KratosMeshingApplication()
|
|
8
|
+
application_name = "KratosMeshingApplication"
|
|
9
|
+
|
|
10
|
+
_ImportApplication(application, application_name)
|
|
11
|
+
|
|
12
|
+
from KratosMultiphysics import python_registry_utilities
|
|
13
|
+
from . import python_registry_lists
|
|
14
|
+
python_registry_utilities.RegisterAll("KratosMultiphysics.MeshingApplication", python_registry_lists)
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import KratosMultiphysics
|
|
2
|
+
import KratosMultiphysics.MeshingApplication as KratosMA
|
|
3
|
+
|
|
4
|
+
def Factory(settings, model):
|
|
5
|
+
if not isinstance(settings, KratosMultiphysics.Parameters):
|
|
6
|
+
raise Exception("expected input shall be a Parameters object, encapsulating a json string")
|
|
7
|
+
return GradualVariableInterpolationProcess(model, settings["Parameters"])
|
|
8
|
+
|
|
9
|
+
class GradualVariableInterpolationProcess(KratosMultiphysics.Process):
|
|
10
|
+
"""This class defines a process for gradually interpolating nodal values from one
|
|
11
|
+
model part to another, called the origin and destination model parts respectively.
|
|
12
|
+
The rate of interpolation can be controlled through an increment parameter 'alpha_rampup_increment'
|
|
13
|
+
or by specifying the total number of steps for the full interpolation 'steps_for_rampup'.
|
|
14
|
+
The list of variables to be interpolated is also user-definable."""
|
|
15
|
+
def __init__(self, model, settings):
|
|
16
|
+
KratosMultiphysics.Process.__init__(self)
|
|
17
|
+
|
|
18
|
+
default_settings = KratosMultiphysics.Parameters("""{
|
|
19
|
+
"origin_model_part_file_name" : "NameOfMDPAfile",
|
|
20
|
+
"destination_model_part_name" : "ModelPartName",
|
|
21
|
+
"interpolation_variables_list": [],
|
|
22
|
+
"constrain_variables": false,
|
|
23
|
+
"alpha_rampup_increment": 0.0,
|
|
24
|
+
"steps_for_rampup": 0.0
|
|
25
|
+
}""")
|
|
26
|
+
|
|
27
|
+
settings.ValidateAndAssignDefaults(default_settings)
|
|
28
|
+
|
|
29
|
+
self.model = model
|
|
30
|
+
self.settings = settings
|
|
31
|
+
self.constrain_variables = self.settings["constrain_variables"].GetBool()
|
|
32
|
+
self.alpha_rampup_increment = self.settings["alpha_rampup_increment"].GetDouble()
|
|
33
|
+
self.steps_for_rampup = self.settings["steps_for_rampup"].GetInt()
|
|
34
|
+
|
|
35
|
+
if not self.alpha_rampup_increment and not self.steps_for_rampup:
|
|
36
|
+
KratosMultiphysics.Logger.PrintWarning('GradualVariableInterpolationProcess', 'Neither alpha_rampup_increment nor steps_for_rampup was specified; defaulting to alpha_rampup_increment = 1.0')
|
|
37
|
+
self.alpha_rampup_increment = 1.0
|
|
38
|
+
elif self.alpha_rampup_increment and self.steps_for_rampup:
|
|
39
|
+
KratosMultiphysics.Logger.PrintWarning('GradualVariableInterpolationProcess', 'Both alpha_rampup_increment and steps_for_rampup were specified; using alpha_rampup_increment and ignoring steps_for_rampup')
|
|
40
|
+
elif self.alpha_rampup_increment:
|
|
41
|
+
if self.alpha_rampup_increment < 0 or self.alpha_rampup_increment > 1:
|
|
42
|
+
raise Exception("'alpha_rampup_increment' must be in the interval (0, 1].")
|
|
43
|
+
elif self.steps_for_rampup:
|
|
44
|
+
if self.steps_for_rampup <= 0:
|
|
45
|
+
raise Exception("'steps_for_rampup' must be a positive integer.")
|
|
46
|
+
else:
|
|
47
|
+
self.alpha_rampup_increment = 1.0 / self.steps_for_rampup
|
|
48
|
+
|
|
49
|
+
self.alpha = 0.0
|
|
50
|
+
self.expected_alpha = 1.0
|
|
51
|
+
self.interpolation_variables_list = self.settings["interpolation_variables_list"].GetStringArray()
|
|
52
|
+
|
|
53
|
+
def ExecuteInitialize(self):
|
|
54
|
+
origin_model_part_file_name = self.settings["origin_model_part_file_name"].GetString()
|
|
55
|
+
destination_model_part_name = self.settings["destination_model_part_name"].GetString()
|
|
56
|
+
self.destination_model_part = self.model.GetModelPart(destination_model_part_name)
|
|
57
|
+
|
|
58
|
+
# Import Origin Model Part
|
|
59
|
+
self.origin_model_part = self.model.CreateModelPart("OriginModelPart")
|
|
60
|
+
for variable in self.destination_model_part.GetHistoricalVariablesNames():
|
|
61
|
+
if KratosMultiphysics.KratosGlobals.HasVariable(variable):
|
|
62
|
+
self.origin_model_part.AddNodalSolutionStepVariable(KratosMultiphysics.KratosGlobals.GetVariable(variable))
|
|
63
|
+
else:
|
|
64
|
+
raise Exception(f"Variable '{variable}' does not exist or is not valid in KratosMultiphysics.")
|
|
65
|
+
|
|
66
|
+
model_part_io = KratosMultiphysics.ModelPartIO(origin_model_part_file_name)
|
|
67
|
+
model_part_io.ReadModelPart(self.origin_model_part)
|
|
68
|
+
|
|
69
|
+
self.domain_size = self.destination_model_part.ProcessInfo.GetValue(KratosMultiphysics.DOMAIN_SIZE)
|
|
70
|
+
|
|
71
|
+
KratosMA.GradualVariableInterpolationUtility.InitializeInterpolationAndConstraints(self.origin_model_part, self.destination_model_part, self.interpolation_variables_list, self.alpha_rampup_increment, self.domain_size, self.constrain_variables)
|
|
72
|
+
|
|
73
|
+
def ExecuteInitializeSolutionStep(self):
|
|
74
|
+
self.old_alpha = self.alpha
|
|
75
|
+
if self.old_alpha == 0.0:
|
|
76
|
+
self.old_alpha = self.alpha_rampup_increment
|
|
77
|
+
self.alpha += self.alpha_rampup_increment
|
|
78
|
+
if self.alpha <= self.expected_alpha:
|
|
79
|
+
KratosMA.GradualVariableInterpolationUtility.UpdateSolutionStepVariables(self.destination_model_part, self.interpolation_variables_list, self.alpha, self.old_alpha, self.constrain_variables)
|