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
151 changes: 151 additions & 0 deletions RFEM/TypesForNodes/nodalMeshRefinement.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,98 @@
from RFEM.initModel import Model, clearAtributes
from RFEM.enums import NodalMeshRefinementType
from enum import Enum

class FElengthArrangement(Enum):
LENGTH_ARRANGEMENT_RADIAL, LENGTH_ARRANGEMENT_GRADUALLY, LENGTH_ARRANGEMENT_COMBINED = range(3)

class NodalMeshRefinement():
def __init__(self,
no: int = 1,
type = NodalMeshRefinementType.TYPE_CIRCULAR,
mesh_parameters: list = None,
apply_on_selected_surfaces: bool = False,
comment: str = '',
params: dict = None,
model = Model):
"""
Nodal Mesh Refinement

Args:
no (int, optional): Number
type (_type_, optional): TYPE_CIRCULAR or TYPE_RECTANGULAR
mesh_parameters (list, optional): _description_. Defaults to None.
if TYPE_CIRCULAR:
(circular_radius, circular_target_inner_length, circular_target_outer_length, circular_length_arrangement)
(2.5, 0.1, 0.5, FElengthArrangement.LENGTH_ARRANGEMENT_RADIAL)
elif TYPE_RECTANGULAR:
(rectangular_side, rectangular_target_inner_length)
(0.5, 0.1)
comment (str, optional): Comment
params (dict, optional): Any WS Parameter relevant to the object and its value in form of a dictionary
model (_type_, optional): Model instance
"""

# Client model | Nodal Mesh Refinement
clientObject = model.clientModel.factory.create('ns0:nodal_mesh_refinement')

# Clears object atributes | Sets all atributes to None
clearAtributes(clientObject)

# Nodal Mesh Refinement No.
clientObject.no = no

# Nodal Mesh Refinement Type
clientObject.type = type.name

# Mesh Parameters
if type == NodalMeshRefinementType.TYPE_CIRCULAR:
clientObject.circular_radius = mesh_parameters[0]
clientObject.circular_target_inner_length = mesh_parameters[1]
clientObject.circular_target_outer_length = mesh_parameters[2]
clientObject.circular_length_arrangement = mesh_parameters[3].name
elif type == NodalMeshRefinementType.TYPE_RECTANGULAR:
clientObject.rectangular_side = mesh_parameters[0]
clientObject.rectangular_target_inner_length = mesh_parameters[1]

# Apply Only on Selected Surfaces
clientObject.apply_only_on_selected_surfaces = apply_on_selected_surfaces

# Comment
clientObject.comment = comment

# Adding optional parameters via dictionary
if params:
for key in params:
clientObject[key] = params[key]

# Add Nodal Mesh Refinement to client model
model.clientModel.service.set_nodal_mesh_refinement(clientObject)

@staticmethod
def Circular(
no: int = 1,
circular_radius: float = 2.5,
circular_target_inner_length: float = 0.1,
circular_target_outer_length: float = 0.5,
circular_length_arrangement = FElengthArrangement.LENGTH_ARRANGEMENT_RADIAL,
apply_on_selected_surfaces: bool = False,
comment: str = '',
params: dict = None,
model = Model):
"""
Circular Nodal Mesh Refinement

Args:
no (int, optional): Number
circular_radius (float, optional): Radius
circular_target_inner_length (float, optional): Inner target FE length
circular_target_outer_length (float, optional): Outer target FE length
circular_length_arrangement (_type_, optional): FE length arrangenemt
apply_on_selected_surfaces (bool, optional): Apply only on surfaces
comment (str, optional): Comment
params (dict, optional): Any WS Parameter relevant to the object and its value in form of a dictionary
model (_type_, optional): Model instance
"""

# Client model | Nodal Mesh Refinement
clientObject = model.clientModel.factory.create('ns0:nodal_mesh_refinement')
Expand All @@ -16,6 +103,70 @@ def __init__(self,
# Nodal Mesh Refinement No.
clientObject.no = no

# Nodal Mesh Refinement Type
clientObject.type = NodalMeshRefinementType.TYPE_CIRCULAR.name

# Mesh Parameters
clientObject.circular_radius = circular_radius
clientObject.circular_target_inner_length = circular_target_inner_length
clientObject.circular_target_outer_length = circular_target_outer_length
clientObject.circular_length_arrangement = circular_length_arrangement.name

# Apply Only on Selected Surfaces
clientObject.apply_only_on_selected_surfaces = apply_on_selected_surfaces

# Comment
clientObject.comment = comment

# Adding optional parameters via dictionary
if params:
for key in params:
clientObject[key] = params[key]

# Add Nodal Mesh Refinement to client model
model.clientModel.service.set_nodal_mesh_refinement(clientObject)

@staticmethod
def Rectangular(
no: int = 1,
rectangular_side: float = 2.5,
rectangular_target_inner_length: float = 0.1,
apply_on_selected_surfaces: bool = False,
comment: str = '',
params: dict = None,
model = Model):
"""
Rectangular Nodal Mesh Refinement

Args:
no (int, optional): Number
rectangular_side (float, optional): Side length
rectangular_target_inner_length (float, optional): Inner target FE length
apply_on_selected_surfaces (bool, optional): Apply only on surfaces
comment (str, optional): Comment
params (dict, optional): Any WS Parameter relevant to the object and its value in form of a dictionary
model (_type_, optional): Model instance
"""

# Client model | Nodal Mesh Refinement
clientObject = model.clientModel.factory.create('ns0:nodal_mesh_refinement')

# Clears object atributes | Sets all atributes to None
clearAtributes(clientObject)

# Nodal Mesh Refinement No.
clientObject.no = no

# Nodal Mesh Refinement Type
clientObject.type = NodalMeshRefinementType.TYPE_RECTANGULAR.name

# Mesh Parameters
clientObject.rectangular_side = rectangular_side
clientObject.rectangular_target_inner_length = rectangular_target_inner_length

# Apply Only on Selected Surfaces
clientObject.apply_only_on_selected_surfaces = apply_on_selected_surfaces

# Comment
clientObject.comment = comment

Expand Down
207 changes: 113 additions & 94 deletions RFEM/TypesForNodes/nodalSupport.py
Original file line number Diff line number Diff line change
@@ -1,94 +1,113 @@
from RFEM.initModel import Model, clearAtributes, ConvertToDlString
from RFEM.dataTypes import inf
from RFEM.enums import NodalSupportType

def setNodalSupportConditions(clientObject,
C_u_X: float,
C_u_Y: float,
C_u_Z: float,
C_phi_X: float,
C_phi_Y: float,
C_phi_Z: float):
'''
Sets nodal support conditions

Params:
clientObject: Client model object | Nodal support
C_u_X,Y,Z: Translational support conditions in respected direction
C_phi_X,Y,Z: Rotational support conditions about respected axis
comment: Comment

Returns:
clientObject: Initialized client model object | Nodal Support
'''

clientObject.spring_x = C_u_X
clientObject.spring_y = C_u_Y
clientObject.spring_z = C_u_Z

clientObject.rotational_restraint_x = C_phi_X
clientObject.rotational_restraint_y = C_phi_Y
clientObject.rotational_restraint_z = C_phi_Z

return clientObject

class NodalSupport():
def __init__(self,
no: int = 1,
nodes_no: str = '1 2',
support_type = NodalSupportType.HINGED,
comment: str = '',
params: dict = None,
model = Model):

# Client model | Nodal Support
clientObject = model.clientModel.factory.create('ns0:nodal_support')

# Clears object atributes | Sets all atributes to None
clearAtributes(clientObject)

# Nodal Support No.
clientObject.no = no

# Nodes No. (e.g. "5 6 7 12")
clientObject.nodes = ConvertToDlString(nodes_no)

# Nodal Support Conditions
if support_type == NodalSupportType.FIXED:
# FIXED 'xxx xxx'
clientObject = setNodalSupportConditions(clientObject, inf, inf, inf, inf, inf, inf)

elif support_type == NodalSupportType.HINGED:
# HINGED 'xxx --x'
clientObject = setNodalSupportConditions(clientObject, inf, inf, inf, 0.0, 0.0, inf)

elif support_type == NodalSupportType.ROLLER:
# ROLLER '--x --x'
clientObject = setNodalSupportConditions(clientObject, 0.0, 0.0, inf, 0.0, 0.0, inf)

elif support_type == NodalSupportType.ROLLER_IN_X:
# ROLLER_IN_X '-xx --x'
clientObject = setNodalSupportConditions(clientObject, 0.0, inf, inf, 0.0, 0.0, inf)

elif support_type == NodalSupportType.ROLLER_IN_Y:
# ROLLER_IN_Y 'x-x --x'
clientObject = setNodalSupportConditions(clientObject, inf, 0.0, inf, 0.0, 0.0, inf)

elif support_type == NodalSupportType.ROLLER_IN_Z:
# ROLLER_IN_Z 'xx- --x'
clientObject = setNodalSupportConditions(clientObject, inf, inf, 0.0, 0.0, 0.0, inf)

elif support_type == NodalSupportType.FREE:
# FREE '--- ---'
clientObject = setNodalSupportConditions(clientObject, 0, 0, 0, 0, 0, 0)

# Comment
clientObject.comment = comment

# Adding optional parameters via dictionary
if params:
for key in params:
clientObject[key] = params[key]

# Add Nodal Support to client model
model.clientModel.service.set_nodal_support(clientObject)
from RFEM.initModel import Model, clearAtributes, ConvertToDlString
from RFEM.dataTypes import inf
from RFEM.enums import NodalSupportType

def setNodalSupportConditions(clientObject,
C_u_X: float,
C_u_Y: float,
C_u_Z: float,
C_phi_X: float,
C_phi_Y: float,
C_phi_Z: float):
'''
Sets nodal support conditions

Params:
clientObject: Client model object | Nodal support
C_u_X,Y,Z: Translational support conditions in respected direction
C_phi_X,Y,Z: Rotational support conditions about respected axis

Returns:
clientObject: Initialized client model object | Nodal Support
'''

clientObject.spring_x = C_u_X
clientObject.spring_y = C_u_Y
clientObject.spring_z = C_u_Z

clientObject.rotational_restraint_x = C_phi_X
clientObject.rotational_restraint_y = C_phi_Y
clientObject.rotational_restraint_z = C_phi_Z

return clientObject

class NodalSupport():
def __init__(self,
no: int = 1,
nodes_no: str = '1 2',
support = NodalSupportType.HINGED,
comment: str = '',
params: dict = None,
model = Model):
"""
Nodal Support

Args:
no (int, optional): Number
nodes_no (str, optional): Assigned to nodes
support (enum or list, optional): Support definition
comment (str, optional): Commment
params (dict, optional): Any WS Parameter relevant to the object and its value in form of a dictionary
model (_type_, optional): Model instance

Raises:
ValueError: 'Support parameter can be enum or list with 6 items.'
"""

# Client model | Nodal Support
clientObject = model.clientModel.factory.create('ns0:nodal_support')

# Clears object atributes | Sets all atributes to None
clearAtributes(clientObject)

# Nodal Support No.
clientObject.no = no

# Nodes No. (e.g. "5 6 7 12")
clientObject.nodes = ConvertToDlString(nodes_no)

# Nodal Support Conditions
if support == NodalSupportType.FIXED:
# FIXED 'xxx xxx'
clientObject = setNodalSupportConditions(clientObject, inf, inf, inf, inf, inf, inf)

elif support == NodalSupportType.HINGED:
# HINGED 'xxx --x'
clientObject = setNodalSupportConditions(clientObject, inf, inf, inf, 0.0, 0.0, inf)

elif support == NodalSupportType.ROLLER:
# ROLLER '--x --x'
clientObject = setNodalSupportConditions(clientObject, 0.0, 0.0, inf, 0.0, 0.0, inf)

elif support == NodalSupportType.ROLLER_IN_X:
# ROLLER_IN_X '-xx --x'
clientObject = setNodalSupportConditions(clientObject, 0.0, inf, inf, 0.0, 0.0, inf)

elif support == NodalSupportType.ROLLER_IN_Y:
# ROLLER_IN_Y 'x-x --x'
clientObject = setNodalSupportConditions(clientObject, inf, 0.0, inf, 0.0, 0.0, inf)

elif support == NodalSupportType.ROLLER_IN_Z:
# ROLLER_IN_Z 'xx- --x'
clientObject = setNodalSupportConditions(clientObject, inf, inf, 0.0, 0.0, 0.0, inf)

elif support == NodalSupportType.FREE:
# FREE '--- ---'
clientObject = setNodalSupportConditions(clientObject, 0, 0, 0, 0, 0, 0)

elif isinstance(support, list) and len(support) == 6:
clientObject = setNodalSupportConditions(clientObject, support[0], support[1], support[2], support[3], support[4], support[5])

else:
raise ValueError('Support parameter can be enum or list with 6 items.')

# Comment
clientObject.comment = comment

# Adding optional parameters via dictionary
if params:
for key in params:
clientObject[key] = params[key]

# Add Nodal Support to client model
model.clientModel.service.set_nodal_support(clientObject)
6 changes: 6 additions & 0 deletions RFEM/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -1784,6 +1784,12 @@ class SolidContactParallelType(Enum):
FAILURE_IF_CONTACT_PERPENDICULAR_TO_SURFACES_FAILED, FULL_FORCE_TRANSMISSION, RIGID_FRICTION, RIGID_FRICTION_LIMIT, \
ELASTIC_FRICTION, ELASTIC_FRICTION_LIMIT, ELASTIC_SOLID = range(7)

class NodalMeshRefinementType(Enum):
'''
Nodal Mesh Refinement
'''
TYPE_CIRCULAR, TYPE_RECTANGULAR = range(2)

class ActionCategoryType(Enum):
'''
Load Case Action Category
Expand Down
Loading