This repository has been archived by the owner on Apr 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #409 from simphony/update-metadata-502d4c71847f95a…
…202ccf1a29902e16f2f4d55a8 Updated against 502d4c71847f95a202ccf1a29902e16f2f4d55a8
- Loading branch information
Showing
9 changed files
with
240 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
from simphony.core import Default # noqa | ||
from .mixed_condition import MixedCondition | ||
from simphony.core.cuba import CUBA | ||
from simphony.cuds import meta_validation | ||
|
||
|
||
class InletOutletVelocity(MixedCondition): | ||
""" | ||
Inlet outlet boundary condition (outlet condition is zero | ||
gradient and inlet given variable value) | ||
""" | ||
cuba_key = CUBA.INLET_OUTLET_VELOCITY | ||
|
||
def __init__(self, velocity, material, description=Default, name=Default): | ||
super(InletOutletVelocity, self).__init__( | ||
material=material, description=description, name=name) | ||
self._init_models() | ||
self._init_variables() | ||
self._init_velocity(velocity) | ||
|
||
@classmethod | ||
def supported_parameters(cls): | ||
try: | ||
base_params = super(InletOutletVelocity, | ||
cls).supported_parameters() | ||
except AttributeError: | ||
base_params = () | ||
return tuple(set((CUBA.VELOCITY, ) + base_params)) | ||
|
||
def _init_models(self): | ||
self._models = self._default_models() # noqa | ||
|
||
@property | ||
def models(self): | ||
return self._models | ||
|
||
def _default_models(self): | ||
return ['CUBA.CONTINUUM'] # noqa | ||
|
||
def _default_definition(self): | ||
return "Inlet outlet boundary condition (outlet condition is zero gradient and inlet given variable value)" # noqa | ||
|
||
def _init_variables(self): | ||
self._variables = self._default_variables() # noqa | ||
|
||
@property | ||
def variables(self): | ||
return self._variables | ||
|
||
def _default_variables(self): | ||
return ['CUBA.VELOCITY'] # noqa | ||
|
||
def _init_velocity(self, value): | ||
if value is Default: | ||
value = self._default_velocity() | ||
|
||
self.velocity = value | ||
|
||
@property | ||
def velocity(self): | ||
return self.data[CUBA.VELOCITY] | ||
|
||
@velocity.setter | ||
def velocity(self, value): | ||
value = self._validate_velocity(value) | ||
self.data[CUBA.VELOCITY] = value | ||
|
||
def _validate_velocity(self, value): | ||
value = meta_validation.cast_data_type(value, 'VELOCITY') | ||
meta_validation.check_valid_shape(value, [1], 'VELOCITY') | ||
meta_validation.validate_cuba_keyword(value, 'VELOCITY') | ||
return value | ||
|
||
def _default_velocity(self): | ||
raise TypeError("No default for velocity") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
from simphony.core import Default # noqa | ||
from .mixed_condition import MixedCondition | ||
from simphony.core.cuba import CUBA | ||
from simphony.cuds import meta_validation | ||
|
||
|
||
class InletOutletVolumeFraction(MixedCondition): | ||
""" | ||
Inlet outlet boundary condition (outlet condition is zero | ||
gradient and inlet given variable value) | ||
""" | ||
cuba_key = CUBA.INLET_OUTLET_VOLUME_FRACTION | ||
|
||
def __init__(self, | ||
volume_fraction, | ||
material, | ||
description=Default, | ||
name=Default): | ||
super(InletOutletVolumeFraction, self).__init__( | ||
material=material, description=description, name=name) | ||
self._init_models() | ||
self._init_variables() | ||
self._init_volume_fraction(volume_fraction) | ||
|
||
@classmethod | ||
def supported_parameters(cls): | ||
try: | ||
base_params = super(InletOutletVolumeFraction, | ||
cls).supported_parameters() | ||
except AttributeError: | ||
base_params = () | ||
return tuple(set((CUBA.VOLUME_FRACTION, ) + base_params)) | ||
|
||
def _init_models(self): | ||
self._models = self._default_models() # noqa | ||
|
||
@property | ||
def models(self): | ||
return self._models | ||
|
||
def _default_models(self): | ||
return ['CUBA.CONTINUUM'] # noqa | ||
|
||
def _default_definition(self): | ||
return "Inlet outlet boundary condition (outlet condition is zero gradient and inlet given variable value)" # noqa | ||
|
||
def _init_variables(self): | ||
self._variables = self._default_variables() # noqa | ||
|
||
@property | ||
def variables(self): | ||
return self._variables | ||
|
||
def _default_variables(self): | ||
return ['CUBA.VOLUME_FRACTION'] # noqa | ||
|
||
def _init_volume_fraction(self, value): | ||
if value is Default: | ||
value = self._default_volume_fraction() | ||
|
||
self.volume_fraction = value | ||
|
||
@property | ||
def volume_fraction(self): | ||
return self.data[CUBA.VOLUME_FRACTION] | ||
|
||
@volume_fraction.setter | ||
def volume_fraction(self, value): | ||
value = self._validate_volume_fraction(value) | ||
self.data[CUBA.VOLUME_FRACTION] = value | ||
|
||
def _validate_volume_fraction(self, value): | ||
value = meta_validation.cast_data_type(value, 'VOLUME_FRACTION') | ||
meta_validation.check_valid_shape(value, [1], 'VOLUME_FRACTION') | ||
meta_validation.validate_cuba_keyword(value, 'VOLUME_FRACTION') | ||
return value | ||
|
||
def _default_volume_fraction(self): | ||
raise TypeError("No default for volume_fraction") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from simphony.core import Default # noqa | ||
from .condition import Condition | ||
from simphony.core.cuba import CUBA | ||
from simphony.cuds import meta_validation | ||
|
||
|
||
class MixedCondition(Condition): | ||
""" | ||
general mixed boundary condition | ||
""" | ||
cuba_key = CUBA.MIXED_CONDITION | ||
|
||
def __init__(self, material, description=Default, name=Default): | ||
super(MixedCondition, self).__init__( | ||
description=description, name=name) | ||
self._init_material(material) | ||
|
||
@classmethod | ||
def supported_parameters(cls): | ||
try: | ||
base_params = super(MixedCondition, cls).supported_parameters() | ||
except AttributeError: | ||
base_params = () | ||
return tuple(set((CUBA.MATERIAL, ) + base_params)) | ||
|
||
def _default_definition(self): | ||
return "general mixed boundary condition" # noqa | ||
|
||
def _init_material(self, value): | ||
if value is Default: | ||
value = self._default_material() | ||
|
||
self.material = value | ||
|
||
@property | ||
def material(self): | ||
return self.data[CUBA.MATERIAL] | ||
|
||
@material.setter | ||
def material(self, value): | ||
value = self._validate_material(value) | ||
self.data[CUBA.MATERIAL] = value | ||
|
||
def _validate_material(self, value): | ||
value = meta_validation.cast_data_type(value, 'MATERIAL') | ||
meta_validation.check_valid_shape(value, [1], 'MATERIAL') | ||
meta_validation.validate_cuba_keyword(value, 'MATERIAL') | ||
return value | ||
|
||
def _default_material(self): | ||
raise TypeError("No default for material") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters