当前位置: 首页>>代码示例>>Python>>正文


Python NonlinearSolver.process_conf方法代码示例

本文整理汇总了Python中sfepy.solvers.solvers.NonlinearSolver.process_conf方法的典型用法代码示例。如果您正苦于以下问题:Python NonlinearSolver.process_conf方法的具体用法?Python NonlinearSolver.process_conf怎么用?Python NonlinearSolver.process_conf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfepy.solvers.solvers.NonlinearSolver的用法示例。


在下文中一共展示了NonlinearSolver.process_conf方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: process_conf

# 需要导入模块: from sfepy.solvers.solvers import NonlinearSolver [as 别名]
# 或者: from sfepy.solvers.solvers.NonlinearSolver import process_conf [as 别名]
    def process_conf( conf ):
        """
        Missing items are left to scipy defaults. Unused options are ignored.
        
        Example configuration, all items::
        
            solver_1 = {
                'name' : 'broyden',
                'kind' : 'nls.scipy_broyden_like',

                'method'  : 'broyden3',
                'i_max'   : 10,
                'alpha'   : 0.9,
                'M'       : 5,
                'w0'      : 0.1,
                'verbose' : True,
            }
        """
        get = conf.get_default_attr

        method = get( 'method', 'broyden3' )
        i_max = get( 'i_max' )
        alpha = get( 'alpha' )
        M = get( 'M' )
        w0 = get( 'w0' )
        verbose = get( 'verbose' )

        common = NonlinearSolver.process_conf( conf )
        return Struct( **locals() ) + common
开发者ID:olivierverdier,项目名称:sfepy,代码行数:31,代码来源:nls.py

示例2: process_conf

# 需要导入模块: from sfepy.solvers.solvers import NonlinearSolver [as 别名]
# 或者: from sfepy.solvers.solvers.NonlinearSolver import process_conf [as 别名]
    def process_conf(conf, kwargs):
        """
        Missing items are left to scipy defaults. Unused options are ignored.

        Example configuration, all items::

            solver_1 = {
                'name' : 'broyden',
                'kind' : 'nls.scipy_broyden_like',

                'method'  : 'broyden3',
                'i_max'   : 10,
                'alpha'   : 0.9,
                'M'       : 5,
                'w0'      : 0.1,
                'verbose' : True,
            }
        """
        get = make_get_conf(conf, kwargs)
        common = NonlinearSolver.process_conf(conf)

        return Struct(method=get('method', 'broyden3'),
                      i_max=get('i_max', 10),
                      alpha=get('alpha', 0.9),
                      M=get('M', 5),
                      w0=get('w0', 0.1),
                      verbose=get('verbose', False)) + common
开发者ID:mikegraham,项目名称:sfepy,代码行数:29,代码来源:nls.py

示例3: process_conf

# 需要导入模块: from sfepy.solvers.solvers import NonlinearSolver [as 别名]
# 或者: from sfepy.solvers.solvers.NonlinearSolver import process_conf [as 别名]
    def process_conf(conf, kwargs):
        """
        Missing items are set to default values.

        Example configuration, all items::

            solver_1 = {
                'name' : 'oseen',
                'kind' : 'nls.oseen',

                'needs_problem_instance' : True,
                'stabil_mat' : 'stabil',

                'adimensionalize' : False,
                'check_navier_stokes_rezidual' : False,

                'i_max'      : 10,
                'eps_a'      : 1e-8,
                'eps_r'      : 1.0,
                'macheps'    : 1e-16,
                'lin_red'    : 1e-2, # Linear system error < (eps_a * lin_red).
                'log'        : {'text' : 'oseen_log.txt',
                                'plot' : 'oseen_log.png'},
            }
        """
        get = make_get_conf(conf, kwargs)
        common = NonlinearSolver.process_conf(conf)

        # Compulsory.
        needs_problem_instance = get('needs_problem_instance', True)
        if not needs_problem_instance:
            msg = 'set solver option "needs_problem_instance" to True!'
            raise ValueError(msg)

        stabil_mat = get('stabil_mat', None, 'missing "stabil_mat" in options!')

        # With defaults.
        adimensionalize = get('adimensionalize', False)
        if adimensionalize:
            raise NotImplementedError

        check = get('check_navier_stokes_rezidual', False)

        log = get_logging_conf(conf)
        log = Struct(name='log_conf', **log)
        is_any_log = (log.text is not None) or (log.plot is not None)

        return Struct(needs_problem_instance=needs_problem_instance,
                      stabil_mat=stabil_mat,
                      adimensionalize=adimensionalize,
                      check_navier_stokes_rezidual=check,
                      i_max=get('i_max', 1),
                      eps_a=get('eps_a', 1e-10),
                      eps_r=get('eps_r', 1.0),
                      macheps=get('macheps', nm.finfo(nm.float64).eps),
                      lin_red=get('lin_red', 1.0),
                      lin_precision=get('lin_precision', None),
                      log=log,
                      is_any_log=is_any_log) + common
开发者ID:andy-c-huang,项目名称:sfepy,代码行数:61,代码来源:oseen.py

示例4: process_conf

# 需要导入模块: from sfepy.solvers.solvers import NonlinearSolver [as 别名]
# 或者: from sfepy.solvers.solvers.NonlinearSolver import process_conf [as 别名]
    def process_conf(conf, kwargs):
        """
        Missing items are set to default values for a linear problem.

        Example configuration, all items::

            solver_1 = {
                'name' : 'newton',
                'kind' : 'nls.newton',

                'i_max' : 2,
                'eps_a' : 1e-8,
                'eps_r' : 1e-2,
                'macheps' : 1e-16,
                'lin_red' : 1e-2, # Linear system error < (eps_a * lin_red).
                'lin_precision' : None,
                'ls_red' : 0.1,
                'ls_red_warp' : 0.001,
                'ls_on' : 0.99999,
                'ls_min' : 1e-5,
                'give_up_warp' : False,
                'check' : 0,
                'delta' : 1e-6,
                'is_plot' : False,
                'log' : None, # 'nonlinear' or 'linear' (ignore i_max)
                'problem' : 'nonlinear',
            }
        """
        get = make_get_conf(conf, kwargs)
        common = NonlinearSolver.process_conf(conf)

        log = get_logging_conf(conf)
        log = Struct(name="log_conf", **log)
        is_any_log = (log.text is not None) or (log.plot is not None)

        return (
            Struct(
                i_max=get("i_max", 1),
                eps_a=get("eps_a", 1e-10),
                eps_r=get("eps_r", 1.0),
                macheps=get("macheps", nm.finfo(nm.float64).eps),
                lin_red=get("lin_red", 1.0),
                lin_precision=get("lin_precision", None),
                ls_red=get("ls_red", 0.1),
                ls_red_warp=get("ls_red_warp", 0.001),
                ls_on=get("ls_on", 0.99999),
                ls_min=get("ls_min", 1e-5),
                give_up_warp=get("give_up_warp", False),
                check=get("check", 0),
                delta=get("delta", 1e-6),
                is_plot=get("is_plot", False),
                problem=get("problem", "nonlinear"),
                log=log,
                is_any_log=is_any_log,
            )
            + common
        )
开发者ID:taldcroft,项目名称:sfepy,代码行数:59,代码来源:nls.py

示例5: process_conf

# 需要导入模块: from sfepy.solvers.solvers import NonlinearSolver [as 别名]
# 或者: from sfepy.solvers.solvers.NonlinearSolver import process_conf [as 别名]
    def process_conf( conf ):
        """
        Missing items are set to default values.
        
        Example configuration, all items::
        
            solver_1 = {
                'name' : 'oseen',
                'kind' : 'nls.oseen',

                'needs_problem_instance' : True,
                'stabilization_hook' : 'create_stabil_mat',

                'adimensionalize' : False,
                'check_navier_stokes_rezidual' : False,

                'i_max'      : 10,
                'eps_a'      : 1e-8,
                'eps_r'      : 1.0,
                'macheps'    : 1e-16,
                'lin_red'    : 1e-2, # Linear system error < (eps_a * lin_red).
                'is_plot'    : False,
                'log'        : {'text' : 'oseen_log.txt',
                                'plot' : 'oseen_log.png'},
            }
        """
        get = conf.get_default_attr

        # Compulsory.
        needs_problem_instance = get('needs_problem_instance', True)
        if not needs_problem_instance:
            msg = 'set solver option "needs_problem_instance" to True!'
            raise ValueError(msg)
        
        stabilization_hook = get('stabilization_hook', None,
                                 'missing "stabilization_hook" in options!')

        # With defaults.
        adimensionalize = get( 'adimensionalize', False )
        check_navier_stokes_rezidual = get( 'check_navier_stokes_rezidual',
                                            False )
        i_max = get( 'i_max', 1 )
        eps_a = get( 'eps_a', 1e-10 )
        eps_r = get( 'eps_r', 1.0 )
        macheps = get( 'macheps', nm.finfo( nm.float64 ).eps )
        lin_red = get( 'lin_red', 1.0 )
        is_plot = get( 'is_plot', False )

        log = get_logging_conf(conf)
        log = Struct(name='log_conf', **log)
        is_any_log = (log.text is not None) or (log.plot is not None)

        common = NonlinearSolver.process_conf( conf )
        return Struct( **locals() ) + common
开发者ID:olivierverdier,项目名称:sfepy,代码行数:56,代码来源:oseen.py

示例6: process_conf

# 需要导入模块: from sfepy.solvers.solvers import NonlinearSolver [as 别名]
# 或者: from sfepy.solvers.solvers.NonlinearSolver import process_conf [as 别名]
    def process_conf( conf ):
        """
        Missing items are set to default values.
        
        Example configuration, all items:
        
        solver_1 = {
            'name' : 'oseen',
            'kind' : 'nls.oseen',

            'adimensionalize' : False,
            'check_navier_stokes_rezidual' : False,

            'fluid_mat_name' : 'fluid',
            'stabil_mat_name' : 'stabil',
            'lin_convect_eq_name' : 'balance',
            'div_eq_name' : 'incompressibility',

            'i_max'      : 10,
            'eps_a'      : 1e-8,
            'eps_r'      : 1.0,
            'macheps'   : 1e-16,
            'lin_red'    : 1e-2, # Linear system error < (eps_a * lin_red).
            'is_plot'    : False,
        }
        """
        get = conf.get_default_attr

        # Compulsory.
        fluid_mat_name = get( 'fluid_mat_name', None,
                              'missing "fluid_mat_name" in options!' )
        stabil_mat_name = get( 'stabil_mat_name', None,
                               'missing "stabil_mat_name" in options!' )
        lin_convect_eq_name = get( 'lin_convect_eq_name', None,
                                   'missing "lin_convect_eq_name" in options!' )
        div_eq_name = get( 'div_eq_name', None,
                           'missing "div_eq_name" in options!' )

        # With defaults.
        adimensionalize = get( 'adimensionalize', False )
        check_navier_stokes_rezidual = get( 'check_navier_stokes_rezidual',
                                            False )
        i_max = get( 'i_max', 1 )
        eps_a = get( 'eps_a', 1e-10 )
        eps_r = get( 'eps_r', 1.0 )
        macheps = get( 'macheps', nm.finfo( nm.float64 ).eps )
        lin_red = get( 'lin_red', 1.0 )
        is_plot = get( 'is_plot', False )

        common = NonlinearSolver.process_conf( conf )
        return Struct( **locals() ) + common
开发者ID:certik,项目名称:sfepy,代码行数:53,代码来源:oseen.py

示例7: process_conf

# 需要导入模块: from sfepy.solvers.solvers import NonlinearSolver [as 别名]
# 或者: from sfepy.solvers.solvers.NonlinearSolver import process_conf [as 别名]
    def process_conf(conf):
        """
        Missing items are set to default values.
        
        Example configuration, all items::

            solver_1 = {
                'name' : 'semismooth_newton',
                'kind' : 'nls.semismooth_newton',

                'semismooth' : True,

                'i_max'      : 10,
                'eps_a'      : 1e-8,
                'eps_r'      : 1e-2,
                'macheps'   : 1e-16,
                'lin_red'    : 1e-2, # Linear system error < (eps_a * lin_red).
                'ls_red_reg' : 0.1,
                'ls_red_alt' : 0.01,
                'ls_red_warp' : 0.001,
                'ls_on'      : 0.9,
                'ls_min'     : 1e-10,
                'log'        : {'plot' : 'convergence.png'},
            }
        """
        get = conf.get_default_attr

        semismooth = get('semismooth', True)

        i_max = get('i_max', 1)
        eps_a = get('eps_a', 1e-10)
        eps_r = get('eps_r', 1.0)
        macheps = get('macheps', nm.finfo(nm.float64).eps)
        lin_red = get('lin_red', 1.0)
        ls_red = {'regular' : get('ls_red_reg', 0.1),
                  'steepest_descent' : get('ls_red_alt', 0.01)}
        ls_red_warp = get('ls_red_warp', 0.001)
        ls_on = get('ls_on', 0.99999)
        ls_min = get('ls_min', 1e-5)

        log = get_logging_conf(conf)
        log = Struct(name='log_conf', **log)
        is_any_log = (log.text is not None) or (log.plot is not None)

        common = NonlinearSolver.process_conf(conf)
        return Struct(**locals()) + common
开发者ID:olivierverdier,项目名称:sfepy,代码行数:48,代码来源:semismooth_newton.py

示例8: process_conf

# 需要导入模块: from sfepy.solvers.solvers import NonlinearSolver [as 别名]
# 或者: from sfepy.solvers.solvers.NonlinearSolver import process_conf [as 别名]
    def process_conf(conf, kwargs):
        """
        Missing items are set to default values.

        Example configuration, all items::

            solver_1 = {
                'name' : 'semismooth_newton',
                'kind' : 'nls.semismooth_newton',

                'semismooth' : True,

                'i_max'      : 10,
                'eps_a'      : 1e-8,
                'eps_r'      : 1e-2,
                'macheps'   : 1e-16,
                'lin_red'    : 1e-2, # Linear system error < (eps_a * lin_red).
                'ls_red_reg' : 0.1,
                'ls_red_alt' : 0.01,
                'ls_red_warp' : 0.001,
                'ls_on'      : 0.9,
                'ls_min'     : 1e-10,
                'log'        : {'plot' : 'convergence.png'},
            }
        """
        get = make_get_conf(conf, kwargs)
        common = NonlinearSolver.process_conf(conf)

        log = get_logging_conf(conf)
        log = Struct(name='log_conf', **log)
        is_any_log = (log.text is not None) or (log.plot is not None)

        return Struct(semismooth=get('semismooth', True),
                      i_max=get('i_max', 1),
                      eps_a=get('eps_a', 1e-10),
                      eps_r=get('eps_r', 1.0),
                      macheps=get('macheps', nm.finfo(nm.float64).eps),
                      lin_red=get('lin_red', 1.0),
                      ls_red=get('ls_red', 0.1),
                      ls_red_warp=get('ls_red_warp', 0.001),
                      ls_on=get('ls_on', 0.99999),
                      ls_min=get('ls_min', 1e-5),
                      log=log,
                      is_any_log=is_any_log) + common
开发者ID:AshitaPrasad,项目名称:sfepy,代码行数:46,代码来源:semismooth_newton.py


注:本文中的sfepy.solvers.solvers.NonlinearSolver.process_conf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。