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
14 changes: 8 additions & 6 deletions src/compas_fea2/UI/viewer/primitives.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from compas.geometry import Box
from compas.geometry import Circle
from compas.geometry import Cone
from compas.geometry import Cylinder
from compas.geometry import Frame
from compas.geometry import Plane

Expand Down Expand Up @@ -102,12 +101,15 @@ class RollerBCShape(_BCShape):
The scale factor to apply when drawing. Default is 1.
"""

def __init__(self, xyz, direction=[1, 0, 0], scale=1):
def __init__(self, xyz, direction=[0, 0, 1], scale=1):
super(RollerBCShape, self).__init__(xyz, direction, scale)
self.height = 800 * self.scale
p = Plane([self.x, self.y, self.z / 2], [0, 1, 0])
c = Circle(plane=p, radius=self.height / 2)
self.shape = Cylinder(circle=c, height=self.height)
self.height = 400 * self.scale
self.diameter = 400 * self.scale
# FIXME this is wrong because it should follow the normal
self.plane = Plane([self.x, self.y, self.z - self.height], direction)
self.circle = Circle(frame=Frame.from_plane(self.plane), radius=self.diameter / 2)
self.shape = Cone(radius=self.circle.radius, height=self.height, frame=Frame.from_plane(self.plane))



class MomentShape(_BCShape):
Expand Down
5 changes: 5 additions & 0 deletions src/compas_fea2/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
_Element3D,
TetrahedronElement,
HexahedronElement,
Face
)
from .materials.material import (
_Material,
ElasticIsotropic,
ThermalElasticIsotropic,
ElasticOrthotropic,
ElasticPlastic,
Stiff,
Expand Down Expand Up @@ -123,6 +125,8 @@
HardContactNoFriction,
LinearContactFrictionPenalty,
HardContactRough,
SurfaceConvection,
SurfaceRadiation
)

__all__ = [
Expand Down Expand Up @@ -152,6 +156,7 @@
"ConcreteSmearedCrack",
"ConcreteDamagedPlasticity",
"ElasticIsotropic",
"ThermalElasticIsotropic",
"Stiff",
"ElasticOrthotropic",
"ElasticPlastic",
Expand Down
55 changes: 55 additions & 0 deletions src/compas_fea2/model/bcs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Dict
from typing import Optional

from compas_fea2.base import FEAData

Expand Down Expand Up @@ -35,6 +36,8 @@
Restrain rotations around the y axis.
zz : bool
Restrain rotations around the z axis.
temp : float (False otherwise)
Imposed temperature for heat analysis.
components : dict
Dictionary with component-value pairs summarizing the boundary condition.
axes : str
Expand All @@ -56,6 +59,7 @@ def __init__(self, axes: str = "global", **kwargs):
self._xx = False
self._yy = False
self._zz = False
self._temp = False

@property
def x(self) -> bool:
Expand All @@ -80,6 +84,10 @@ def yy(self) -> bool:
@property
def zz(self) -> bool:
return self._zz

@property
def temp(self) -> bool:
return self._temp

@property
def axes(self) -> str:
Expand All @@ -104,6 +112,7 @@ def __data__(self) -> dict:
"xx": self._xx,
"yy": self._yy,
"zz": self._zz,
"temp": self._temp,
}

@classmethod
Expand Down Expand Up @@ -302,3 +311,49 @@ def __init__(self, **kwargs):
super().__init__(**kwargs)
self._x = False
self._z = False

#===================================================================
# HEAT ANALYSIS
#===================================================================

class _ThermalBoundaryCondition(FEAData):
"""Base class for temperature boundary conditions."""

__doc__ += docs

def __init__(self, temp: float = None, **kwargs):
super().__init__(**kwargs)
self._temp = None

@property
def temp(self) -> Optional[float]:
return self._temp

@property
def __data__(self) -> Dict[str, any]:
return {
"class": self.__class__.__base__.__name__,
"temp": self._temp,
}

@classmethod
def __from_data__(cls, data: Dict[str, any]):
return cls(
temp=data.get("temp", None)
)

class ImposedTemperature(_ThermalBoundaryCondition):
"""Imposed temperature conidtion for heat analysis.

Additional Parameters
---------------------
temperature : float
Value of imposed temperature applied
"""

__doc__ += docs

def __init__(self, temperature, **kwargs):
super().__init__(**kwargs)
self._temp = temperature

Loading