Skip to content

Commit

Permalink
fix formatting and succesfully assigned correct element surfaces for …
Browse files Browse the repository at this point in the history
…test_surfaces.py. Now it must be understood and implemented
  • Loading branch information
Krande committed Oct 26, 2021
1 parent 900cbf1 commit be66a41
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
12 changes: 10 additions & 2 deletions src/ada/core/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
IFCCONVERT = Settings.tools_dir / "IfcConvert" / "IfcConvert.exe"
CODE_ASTER = Settings.tools_dir / "code_aster"
CALCULIX = Settings.tools_dir / "calculix"
PREPROMAX = Settings.tools_dir / "prepromax"


def download_tool(url, download_path):
Expand Down Expand Up @@ -56,6 +57,13 @@ def download_calculix_win(install_path=CALCULIX, calculix_cae_version="v0.8.0/ca
download_tool(url, download_path)


def download_prepromax_win(install_path=PREPROMAX):
download_path = install_path / "prepromax.zip"
url = "https://prepomax.fs.um.si/Files/Downloads/PrePoMax%20v1.1.1.zip"
download_tool(url, download_path)


if __name__ == "__main__":
download_calculix_win()
download_code_aster_win()
# download_calculix_win()
# download_code_aster_win()
download_prepromax_win()
3 changes: 2 additions & 1 deletion src/ada/fem/formats/code_aster/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
from ada.fem.containers import FemSections
from ada.fem.shapes import ElemShapeTypes
from ada.fem.utils import is_quad8_shell_elem, is_tri6_shell_elem

from ..utils import get_fem_model_from_assembly
from .common import abaqus_to_med_type
from .compatibility import check_compatibility
from .templates import el_convert_str, main_comm_str
from .write_loads import write_load
from ..utils import get_fem_model_from_assembly


def to_fem(assembly: Assembly, name, analysis_dir, metadata=None):
Expand Down
2 changes: 1 addition & 1 deletion src/ada/fem/sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class FemSet(FemBase):

TYPES = SetTypes

def __init__(self, name, members, set_type=None, metadata=None, parent=None):
def __init__(self, name, members: Union[None, List[Union[Elem, Node]]], set_type=None, metadata=None, parent=None):
super().__init__(name, metadata, parent)
if set_type is None:
set_type = eval_set_type_from_members(members)
Expand Down
13 changes: 9 additions & 4 deletions tests/fem/test_surfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,22 @@ def test_surface_box():
face_seq_indices[el] = i

if has_parallel_face is True:
elements.append(el)
if el not in elements:
elements.append(el)
# el_sets: List[ada.fem.FemSet] = []
# for el, face_seq_ref in face_seq_indices.items():
# side_name = f"S{face_seq_ref}"
#
# el_sets.append(fs_elem)

fs_elem = p.fem.add_set(ada.fem.FemSet("FrontElements", elements))
fs_elem_1 = p.fem.add_set(ada.fem.FemSet("_FrontElements_S1", [elements[0]]))
fs_elem_2 = p.fem.add_set(ada.fem.FemSet("_FrontElements_S2", [elements[1]]))

surface = p.fem.add_surface(
ada.fem.Surface("FrontSurfaceElem_1", ada.fem.Surface.TYPES.ELEMENT, fs_elem_1, face_id_label="S2")
)
surface = p.fem.add_surface(
ada.fem.Surface("FrontSurfaceElem", ada.fem.Surface.TYPES.ELEMENT, fs_elem, face_id_label="S2")
ada.fem.Surface("FrontSurfaceElem_2", ada.fem.Surface.TYPES.ELEMENT, fs_elem_2, face_id_label="S4")
)
step.add_load(ada.fem.LoadPressure("MyPressureLoad", 200, surface))
print(box)
Expand All @@ -56,4 +62,3 @@ def test_surface_box():
a.to_fem("MyFemBox_ca", "code_aster", overwrite=True)

# TODO: Specify surfaces on elements on the East and North side of this box and assign pressure and surface traction
# (or shear if you will)

0 comments on commit be66a41

Please sign in to comment.