Example #1
0
    def __init__(self, propID, valueType, units, objectID=0, metaData={}):
        """
        Initializes the property.

        :param PropertyID propID: Property ID
        :param ValueType valueType: Type of a property, i.e. scalar, vector, tensor. Tensor is by default a tuple of 9 values, being compatible with Field's tensor.
        :param units: Property units or string
        :type units: Physics.PhysicalUnits or string
        :param int objectID: Optional ID of problem object/subdomain to which property is related, default = 0
        """
        MupifObject.MupifObject.__init__(self)

        self.propID = propID
        # self.units = units
        self.valueType = valueType
        self.objectID = objectID

        if PhysicalQuantities.isPhysicalUnit(units):
            self.unit = units
        else:
            self.unit = PhysicalQuantities.findUnit(units)

        self.setMetadata('Type', 'mupif.Property.Property')
        self.setMetadata('Type_ID', str(self.propID))
        self.setMetadata('Units', self.unit.name())
        self.setMetadata('ValueType', str(self.valueType))

        self.updateMetadata(metaData)
Example #2
0
    def __init__(self, propID, valueType, units, objectID=0):
        """
            Initializes the property.

            :param tuple value: A tuple (array) representing property value
            :param PropertyID propID: Property ID
            :param ValueType valueType: Type of a property, i.e. scalar, vector, tensor. Tensor is by default a tuple of 9 values, being compatible with Field's tensor.
            :param Physics.PhysicalQuantity time: Time
            :param units: Property units or string
            :type units: Physics.PhysicalUnits or string
            :param int objectID: Optional ID of problem object/subdomain to which property is related, default = 0
            """
        MupifObject.MupifObject.__init__(self)

        self.propID = propID
        #self.units = units
        self.valueType = valueType
        self.objectID = objectID

        if (PhysicalQuantities.isPhysicalUnit(units)):
            self.unit = units
        else:
            self.unit = PhysicalQuantities._findUnit(units)
Example #3
0
    def __init__(self, t, dt, targetTime, units=None, n=1):
        """
        Initializes time step.

        :param t: Time(time at the end of time step)
        :type t: PQ.PhysicalQuantity
        :param dt: Step length (time increment), type depends on 'units'
        :type dt: PQ.PhysicalQuantity
        :param targetTime: target simulation time (time at the end of simulation, not of a single TimeStep)
        :type targetTime: PQ.PhysicalQuantity. targetTime is not related to particular time step rather to the material model (load duration, relaxation spectra etc.)
        :param PQ.PhysicalUnit or str units: optional units for t, dt, targetTime if given as float values
        :param int n: Optional, solution time step number, default = 1
        """
        self.number = n  # solution step number, dimensionless

        if units is None:
            if not PQ.isPhysicalQuantity(t):
                raise TypeError(str(t) + ' is not physical quantity')

            if not PQ.isPhysicalQuantity(dt):
                raise TypeError(str(dt) + ' is not physical quantity')

            if not PQ.isPhysicalQuantity(targetTime):
                raise TypeError(str(targetTime) + ' is not physical quantity')

            self.time = t
            self.dt = dt
            self.targetTime = targetTime
        else:
            if PQ.isPhysicalUnit(units):
                units_temp = units
            else:
                units_temp = PQ.findUnit(units)

            self.time = PQ.PhysicalQuantity(t, units_temp)
            self.dt = PQ.PhysicalQuantity(dt, units_temp)
            self.targetTime = PQ.PhysicalQuantity(targetTime, units_temp)