[docs]@register_api_implementation(core_class=HeatFlux)classHeatFluxSetup(LoadSetup,SourceTargetSettableMixin):""" The API handler for heat flux loads The following example shows how to create a heat flux using the API, it is assumed that these steps were performed in each of the examples for other methods in this class. .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> simulation_setup = api.create_simulation_setup() >>> lcc_setup = simulation_setup.create_load_case_container_setup().set_name(name='Example LCC') >>> lc_setup = lcc_setup.create_load_case_setup(lc_type='Thermal load case').set_name(name='Example LC') >>> load_setup = lc_setup.create_load_setup(load_type='Heat flux') .. >>> isinstance(load_setup, HeatFluxSetup) True >>> isinstance(load_setup._load, HeatFlux) True The next example shows how to get an API object for an already existing load. .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> simulation_setup = api.create_simulation_setup() >>> lcc_setup = simulation_setup.create_load_case_container_setup().set_name(name='Example LCC') >>> lc_setup = lcc_setup.create_load_case_setup(lc_type='Thermal load case').set_name(name='Example LC') .. >>> load_setup = lc_setup.create_load_setup(load_type='Heat flux') >>> load_setup = lc_setup.get_load_setup(index=0) # The load under this index must already exist .. >>> isinstance(load_setup, HeatFluxSetup) True >>> isinstance(load_setup._load, HeatFlux) True """
[docs]defset_target_value(self,value)->'HeatFluxSetup':""" Sets the 'target' value of the load vector See example at the top for how to create a heat flux setup object .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> load_setup = _heat_flux_api_setup(api) >>> load_setup = load_setup.set_target_value(value=10) .. >>> load_setup._load.generalized_force_vector.target == 10 True >>> load_setup.set_target_value(value='wrong value') Traceback (most recent call last): ... TypeError: ... Returns ------- self: HeatFluxSetup Raises ------ TypeError Raised if the supplied value is not a floating point number """self.set_dof_dict(dof_values_dict={'target':value})returnself
[docs]defset_source_value(self,value)->'HeatFluxSetup':""" Sets the 'source' value of the load vector See example at the top for how to create a heat flux setup object .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> load_setup = _heat_flux_api_setup(api) >>> load_setup = load_setup.set_source_value(value=10) .. >>> load_setup._load.generalized_force_vector.source == 10 True >>> load_setup.set_source_value(value='wrong value') Traceback (most recent call last): ... TypeError: ... Returns ------- self: HeatFluxSetup Raises ------ TypeError Raised if the supplied value is not a floating point number """self.set_dof_dict(dof_values_dict={'source':value})returnself
[docs]defset_dof_dict(self,dof_values_dict:typing.Dict[str,float])->'HeatFluxSetup':""" Sets the values of the load vector to those given in the dictionary See example at the top for how to create a heat flux setup object .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> load_setup = _heat_flux_api_setup(api) >>> load_setup = load_setup.set_dof_dict(dof_values_dict={'source': 5, 'target': 10}) .. >>> load_setup._load.generalized_force_vector.source == 5 True >>> load_setup._load.generalized_force_vector.target == 10 True >>> load_setup.set_dof_dict(dof_values_dict={'source': 'wrong value'}) Traceback (most recent call last): ... TypeError: ... >>> load_setup.set_dof_dict(dof_values_dict={'wrong dof': 10}) Traceback (most recent call last): ... more.api.exceptions.api_exception.NameNotFoundError: ... Returns ------- self: HeatFluxSetup Raises ------ TypeError Raised if the supplied value is not a floating point number NameNotFoundError Raised if a key in the supplied dictionary is not a recognized dof """self._load.generalized_force_vector.set_dof_dict(dof_values_dict=dof_values_dict)returnself
[docs]defset_link_by_name(self,link_name:str)->'HeatFluxSetup':""" Sets the link for the associated heat flux See example at the top for how to create a heat flux setup object .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> load_setup = _heat_flux_api_setup(api) >>> link = proj.comp.add_link(physics='therm') >>> link.name = 'example link' >>> load_setup = load_setup.set_link_by_name(link_name='example link') # The link with this name must already exist .. >>> load_setup._load.link_selector.selected_entity == link True >>> load_setup = load_setup.set_link_by_name(link_name='nonexistent name') Traceback (most recent call last): ... more.api.exceptions.api_exception.NameNotFoundError: ... Returns ------- self: HeatFluxSetup Raises ------ NameNotFoundError Raised if the given name is not a recognized link """self._load.link_selector.select_entity_by_name(name=link_name)returnself
[docs]defset_dof(self,dof_name,value)->'HeatFluxSetup':""" Sets the value of an element of the DOF vector See example at the top for how to create the setup object .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> heat_flux_setup = _heat_flux_api_setup(api) >>> heat_flux_setup = heat_flux_setup.set_dof(dof_name='target', value=10) .. >>> heat_flux_setup._load.generalized_force_vector.target == 10 True >>> heat_flux_setup.set_dof(dof_name='v', value='wrong value') Traceback (most recent call last): ... TypeError: ... >>> heat_flux_setup.set_dof(dof_name='wrong dof', value=10) Traceback (most recent call last): ... more.api.exceptions.api_exception.NameNotFoundError: ... Returns ------- self: HeatFluxSetup Raises ------ TypeError Raised if the supplied value is not a floating point number NameNotFoundError Raised if there is no DOF with the given name """returnself.set_dof_dict(dof_values_dict={dof_name:value})
[docs]defset_heat_flux(self,value):""" Deprecated version of :meth:`~.set_general_job_settings_parameter` .. admonition:: Deprecated :class: warning `set_heat_flux` will be removed in a future MORe release, it is split into two methods :meth:`~.set_target_value` and :meth:`~.set_source_value`: """logger.warning('Deprecation: \"set_heat_flux\" will be removed in a future MORe release, replace with \"set_target_value\" and \"set_source_value\"')self.set_target_value(value)returnself.set_source_value(value)
[docs]defset_target_heat_flux(self,value):""" Deprecated version of :meth:`~.set_target_value` .. admonition:: Deprecated :class: warning `set_target_heat_flux` will be removed in a future MORe release, it is replaced by :meth:`~.set_target_value` """logger.warning('Deprecation: \"set_target_heat_flux\" will be removed in a future MORe release, it is replaced by \"set_target_value\"')returnself.set_target_value(value)
[docs]defset_source_heat_flux(self,value):""" Deprecated version of :meth:`~.set_source_value` .. admonition:: Deprecated :class: warning `set_source_heat_flux` will be removed in a future MORe release, it is replaced by :meth:`~.set_source_value` """logger.warning('Deprecation: \"set_target_heat_flux\" will be removed in a future MORe release, it is replaced by \"set_target_value\"')returnself.set_source_value(value)
[docs]defset_link(self,link)->'HeatFluxSetup':""" Deprecated method .. admonition:: Deprecated :class: warning `set_link` will be removed in a future MORe release, it is replaced by :meth:`~.set_link_by_name` """logger.warning('Deprecation: \"set_link\" will be removed in a future MORe release, it is replaced by \"set_link_by_name\"')returnself.set_link_by_name(link_name=link.name)