Class: Ignis::Solver::AMGXConfig
- Inherits:
-
Object
- Object
- Ignis::Solver::AMGXConfig
- Defined in:
- lib/nvruby/solver/amgx_config.rb
Overview
Configuration builder for AMGX solver Provides preset configurations and custom config strings
Constant Summary collapse
- PRESETS =
Predefined solver configurations
{ # Classical AMG with V-cycle, Jacobi smoother classical_v_cycle: <<~CONFIG, config_version=2, solver(main)=AMG, main:algorithm=CLASSICAL, main:selector=PMIS, main:interpolator=D2, main:presweeps=2, main:postsweeps=2, main:max_iters=100, main:convergence=RELATIVE_INI_CORE, main:tolerance=1e-8, main:norm=L2, main:cycle=V, main:smoother=BLOCK_JACOBI, main:coarse_solver=DENSE_LU_SOLVER, main:max_levels=20 CONFIG # Aggregation AMG with V-cycle aggregation_v_cycle: <<~CONFIG, config_version=2, solver(main)=AMG, main:algorithm=AGGREGATION, main:selector=SIZE_2, main:presweeps=2, main:postsweeps=2, main:max_iters=100, main:convergence=RELATIVE_INI_CORE, main:tolerance=1e-8, main:norm=L2, main:cycle=V, main:smoother=MULTICOLOR_GS, main:coarse_solver=DENSE_LU_SOLVER CONFIG # PCG with AMG preconditioner pcg_amg: <<~CONFIG, config_version=2, solver(main)=PCG, main:preconditioner(amg)=AMG, main:max_iters=1000, main:convergence=RELATIVE_INI_CORE, main:tolerance=1e-10, main:norm=L2, amg:algorithm=CLASSICAL, amg:max_iters=1, amg:cycle=V, amg:smoother=BLOCK_JACOBI CONFIG # PBICGSTAB with AMG preconditioner pbicgstab_amg: <<~CONFIG, config_version=2, solver(main)=PBICGSTAB, main:preconditioner(amg)=AMG, main:max_iters=1000, main:convergence=RELATIVE_INI_CORE, main:tolerance=1e-10, main:norm=L2, amg:algorithm=AGGREGATION, amg:max_iters=1, amg:cycle=V CONFIG # Simple Jacobi iteration jacobi: <<~CONFIG, config_version=2, solver(main)=BLOCK_JACOBI, main:max_iters=1000, main:convergence=RELATIVE_INI_CORE, main:tolerance=1e-8 CONFIG # Gauss-Seidel gauss_seidel: <<~CONFIG config_version=2, solver(main)=MULTICOLOR_GS, main:max_iters=1000, main:convergence=RELATIVE_INI_CORE, main:tolerance=1e-8 CONFIG }.freeze
Instance Attribute Summary collapse
-
#config_string ⇒ String
readonly
Configuration string.
Class Method Summary collapse
-
.presets ⇒ Array<Symbol>
List available presets.
Instance Method Summary collapse
-
#initialize(preset: nil, custom: nil, **options) ⇒ AMGXConfig
constructor
Create configuration from preset or custom string.
- #to_s ⇒ String
Constructor Details
#initialize(preset: nil, custom: nil, **options) ⇒ AMGXConfig
Create configuration from preset or custom string
101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/nvruby/solver/amgx_config.rb', line 101 def initialize(preset: nil, custom: nil, **) if custom @config_string = custom elsif preset raise ArgumentError, "Unknown preset: #{preset}" unless PRESETS.key?(preset) @config_string = PRESETS[preset].gsub(/\s+/, "") else @config_string = PRESETS[:classical_v_cycle].gsub(/\s+/, "") end () unless .empty? end |
Instance Attribute Details
#config_string ⇒ String (readonly)
Returns Configuration string.
95 96 97 |
# File 'lib/nvruby/solver/amgx_config.rb', line 95 def config_string @config_string end |
Class Method Details
.presets ⇒ Array<Symbol>
List available presets
122 123 124 |
# File 'lib/nvruby/solver/amgx_config.rb', line 122 def self.presets PRESETS.keys end |
Instance Method Details
#to_s ⇒ String
116 117 118 |
# File 'lib/nvruby/solver/amgx_config.rb', line 116 def to_s @config_string end |