예제 #1
0
    def __init__(self, settings, solver_name):
        # perform some initial checks
        if not settings.Has("coupling_sequence"):
            err_msg = 'No "coupling_sequence" was specified for coupled solver\n'
            err_msg += '"{}" of type "{}"'.format(solver_name,
                                                  self._ClassName())
            raise Exception(err_msg)

        if settings["coupling_sequence"].size() == 0:
            err_msg = '"coupling_sequence" is empty for coupled solver\n'
            err_msg += '"{}" of type "{}"'.format(solver_name,
                                                  self._ClassName())
            raise Exception(err_msg)

        if not settings.Has("solvers"):
            err_msg = 'No "solvers" are specified for coupled solver\n'
            err_msg += '"{}" of type "{}"'.format(solver_name,
                                                  self._ClassName())
            raise Exception(err_msg)

        if len(settings["solvers"].keys()) == 0:
            err_msg = '"solvers" is empty for coupled solver\n'
            err_msg += '"{}" of type "{}"'.format(solver_name,
                                                  self._ClassName())
            raise Exception(err_msg)

        super(CoSimulationCoupledSolver, self).__init__(settings, solver_name)

        self.solver_wrappers = self.__CreateSolverWrappers()

        self.coupling_sequence = self.__GetSolverCoSimulationDetails()

        for solver in self.solver_wrappers.values():
            solver.CreateIO(self.echo_level)
            # using the Echo_level of the coupled solver, since IO is needed by the coupling

        ### Creating the predictors
        self.predictors_list = cs_tools.CreatePredictors(
            self.settings["predictors"], self.solver_wrappers, self.echo_level)

        ### Creating the coupling operations
        self.coupling_operations_dict = cs_tools.CreateCouplingOperations(
            self.settings["coupling_operations"], self.solver_wrappers,
            self.echo_level)

        ### Creating the data transfer operators
        self.data_transfer_operators_dict = cs_tools.CreateDataTransferOperators(
            self.settings["data_transfer_operators"], self.echo_level)
    def __init__(self, settings, solver_name):
        super(CoSimulationCoupledSolver, self).__init__(settings, solver_name)

        self.solver_wrappers = self.__CreateSolverWrappers()
        self.coupling_sequence = self.__GetSolverCoSimulationDetails()

        ### Creating the predictors
        self.predictors_list = cs_tools.CreatePredictors(
            self.settings["predictors"], self.solver_wrappers, self.echo_level)

        ### Creating the coupling operations
        self.coupling_operations_dict = cs_tools.CreateCouplingOperations(
            self.settings["coupling_operations"], self.solver_wrappers,
            self.echo_level)

        ### Creating the data transfer operators
        self.data_transfer_operators_dict = cs_tools.CreateDataTransferOperators(
            self.settings["data_transfer_operators"], self.echo_level)