Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ PYBIND11_MODULE(KratosStructuralMechanicsApplication,m)

// Nodal variables for harmonic analysis
KRATOS_REGISTER_IN_PYTHON_VARIABLE(m, DISPLACEMENT_IMAGINARY)
KRATOS_REGISTER_IN_PYTHON_VARIABLE(m, ROTATION_IMAGINARY)

// Cross section
KRATOS_REGISTER_IN_PYTHON_VARIABLE(m, SHELL_CROSS_SECTION_OUTPUT_PLY_ID )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,37 +699,49 @@ class DirectHarmonicAnalysisStrategy

for (auto& r_node : r_model_part.Nodes()) {

// initialize the full vector to zero first
// Initialize imaginary displacement
auto& r_displacement_imaginary = r_node.FastGetSolutionStepValue(DISPLACEMENT_IMAGINARY);
r_displacement_imaginary[0] = 0.0;
r_displacement_imaginary[1] = 0.0;
r_displacement_imaginary[2] = 0.0;
auto& r_rotation_imaginary = r_node.FastGetSolutionStepValue(ROTATION_IMAGINARY);

r_displacement_imaginary = ZeroVector(3);
r_rotation_imaginary = ZeroVector(3);

auto& r_node_dofs = r_node.GetDofs();

for (auto it_dof = r_node_dofs.begin(); it_dof != r_node_dofs.end(); ++it_dof) {

auto& p_dof = *it_dof;
const auto& r_var = p_dof->GetVariable();

if (!p_dof->IsFixed()) {

const std::size_t eq_id = p_dof->EquationId();
const ComplexType u = rSolution[eq_id];

const double u_real = std::real(u);
const double u_imag = std::imag(u);

// real part -> actual displacement DOF value
// Store real part
p_dof->GetSolutionStepValue() = u_real;

// imaginary part -> MESH_DISPLACEMENT vector
// Store imaginary part
if (r_var == DISPLACEMENT_X) {
r_displacement_imaginary[0] = u_imag;
} else if (r_var == DISPLACEMENT_Y) {
r_displacement_imaginary[1] = u_imag;
} else if (r_var == DISPLACEMENT_Z) {
r_displacement_imaginary[2] = u_imag;
} else if (r_var == ROTATION_X) {
r_rotation_imaginary[0] = u_imag;
} else if (r_var == ROTATION_Y) {
r_rotation_imaginary[1] = u_imag;
} else if (r_var == ROTATION_Z) {
r_rotation_imaginary[2] = u_imag;
}

} else {

// Fixed DOFs
p_dof->GetSolutionStepValue() = 0.0;

if (r_var == DISPLACEMENT_X) {
Expand All @@ -738,6 +750,12 @@ class DirectHarmonicAnalysisStrategy
r_displacement_imaginary[1] = 0.0;
} else if (r_var == DISPLACEMENT_Z) {
r_displacement_imaginary[2] = 0.0;
} else if (r_var == ROTATION_X) {
r_rotation_imaginary[0] = 0.0;
} else if (r_var == ROTATION_Y) {
r_rotation_imaginary[1] = 0.0;
} else if (r_var == ROTATION_Z) {
r_rotation_imaginary[2] = 0.0;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def AddVariables(self):
self.main_model_part.AddNodalSolutionStepVariable(
StructuralMechanicsApplication.DISPLACEMENT_IMAGINARY
)
self.main_model_part.AddNodalSolutionStepVariable(
StructuralMechanicsApplication.ROTATION_IMAGINARY
)
self.main_model_part.AddNodalSolutionStepVariable(
StructuralMechanicsApplication.POINT_LOAD_IMAGINARY
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ void KratosStructuralMechanicsApplication::Register() {

// Harmonic analysis
KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(DISPLACEMENT_IMAGINARY)
KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(ROTATION_IMAGINARY)

// Geometrical
KRATOS_REGISTER_VARIABLE(AXIAL_FORCE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ KRATOS_CREATE_VARIABLE(Matrix, SHELL_ORTHOTROPIC_LAYERS)

// Nodal variables for harmonic analysis
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(DISPLACEMENT_IMAGINARY)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(ROTATION_IMAGINARY)

// Nodal stiffness for the nodal concentrated element
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(NODAL_INITIAL_DISPLACEMENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ namespace Kratos

// Nodal variables for harmonic analysis
KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(STRUCTURAL_MECHANICS_APPLICATION, DISPLACEMENT_IMAGINARY )
KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(STRUCTURAL_MECHANICS_APPLICATION, ROTATION_IMAGINARY )

// Nodal stiffness for the nodal concentrated element
KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(STRUCTURAL_MECHANICS_APPLICATION, NODAL_INITIAL_DISPLACEMENT )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def _add_variables(self, mp):
mp.AddNodalSolutionStepVariable(StructuralMechanicsApplication.POINT_LOAD)
mp.AddNodalSolutionStepVariable(StructuralMechanicsApplication.POINT_LOAD_IMAGINARY)
mp.AddNodalSolutionStepVariable(StructuralMechanicsApplication.DISPLACEMENT_IMAGINARY)
mp.AddNodalSolutionStepVariable(StructuralMechanicsApplication.ROTATION_IMAGINARY)


def _add_dofs(self, mp):
vu = KratosMultiphysics.VariableUtils()
Expand Down
Loading