Skip to content

AdvDiffSolver flow-solver upgrade + alternating-Schwarz ROM for SteadyNS#62

Open
dreamer2368 wants to merge 29 commits into
mainfrom
schwarz
Open

AdvDiffSolver flow-solver upgrade + alternating-Schwarz ROM for SteadyNS#62
dreamer2368 wants to merge 29 commits into
mainfrom
schwarz

Conversation

@dreamer2368

@dreamer2368 dreamer2368 commented Jan 15, 2026

Copy link
Copy Markdown
Collaborator

This PR bundles two related lines of work that have been developed sequentially. Both target the component-wise solver stack; the second sits on top of the first. Together they reflect the methodology demonstrated in our recent paper: https://onlinelibrary.wiley.com/doi/full/10.1002/nme.70314.

1. AdvDiffSolver update (originally branch advdiff_update)

Generalizes the flow solver inside AdvDiffSolver and hardens the sampling workflow so that failed parameter choices no longer abort sample generation.

Flow solver generalization

  • AdvDiffSolver now accepts either StokesSolver or SteadyNSSolver as its flow solver, selected by adv-diff/flow_solver/type (stokes or steady-ns). The member stokes_solver is renamed flow_solver.
  • New adv-diff/flow_solver/order option lets the flow solver use a different discretization order from the advection-diffusion solver.
  • GetFlowField now returns whether the flow solver converged, so the caller can react.

SetParameterizedProblem returns success

  • MultiBlockSolver::SetParameterizedProblem and all overrides (PoissonSolver, StokesSolver, LinElastSolver, UnsteadyNSSolver, AdvDiffSolver) now return bool.
  • GenerateSamples uses this signal: on random sampling, if SetParameterizedProblem fails, the workflow draws a new parameter set and retries instead of crashing. On non-random sampling, the failure is fatal as before. BuildROM, SingleRun, and PrintEQPCoords assert success.

Separate ROM solver tolerances

  • ROM linear/nonlinear solver options moved from the solver/... namespace to rom_solver/... (max_iter, relative_tolerance, absolute_tolerance, print_level, use_restart, initial_random_perturbation, jacobian/...). This decouples ROM and FOM solver settings, which were previously coupled and forced compromises during testing. Test inputs (steady_ns.base.yml, steady_ns.component.yml) updated to provide the new keys.

Misc

  • utils/gmsh2mfem: added -rs/--refine-serial option for serial uniform refinement at conversion time.

2. Alternating-Schwarz ROM for SteadyNS (branch schwarz)

Adds an alternating-Schwarz solve mode for the component-wise SteadyNS ROM, where the global N×N array is solved as overlapping M×M subdomain ROM problems iterated to convergence.

Subset topology

  • New ComponentTopologyHandler(global, i0, j0, N, M, subset_to_orig) constructor extracts an M×M subset starting at (i0, j0) from an N×N global component topology, preserving internal ports and promoting subset-facing internal interfaces to boundaries. Tracks a subset→original mesh mapping.
  • Mesh subset constructor also stores the subset-to-original mapping.

Solver-side hooks

  • MultiBlockSolver, StokesSolver, SteadyNSSolver, LinElastSolver constructors now accept an optional pre-built TopologyHandler*, enabling sub-solvers to share/own a subset topology.
  • New MultiBlockSolver::IsBdrTypeDefined() and PrintConfiguration() helpers.
  • StokesSolver::SetSubsetComplementaryFlux enforces incompressibility on a subset when all boundaries are velocity-Dirichlet (uses new subset_flux coefficient namespace).
  • LinElastSolver BC handling rewritten to switch explicitly on BoundaryType (now supports ZERO and treats undefined boundaries as homogeneous Neumann).

Schwarz driver

  • New src/steady_ns_solver_schwarz.cpp implementing SteadyNSSolver::SchwarzROM(M, N, problem, …, maxIter, threshold, plateau_track, plateau_range, use_restart, initial_tol). Builds (N-M+1)² overlapping sub-solvers, sets internal sub-boundaries to Dirichlet from the latest global iterate, and iterates with plateau detection. Optional relaxed initial_tol on the first iterations to avoid early stagnation.
  • New SingleSchwarzRun workflow entry point, gated on main/solver: steady-ns. Configured via new schwarz/ input section (local_size, global_size, maximum_iteration, threshold, plateau_track, plateau_range, initial_tolerance).
  • SteadyNSTensorROM::SaveOperator added for diagnostics (writes linear op + per-subdomain tensor to HDF5).

Misc

  • PrintBoundaryType() helper added to parameterized_problem.
  • New reference Poisson sketch sketches/phyml_poisson.cpp for the PhyML demo (piecewise-kappa diffusion with Gaussian forcing).

Test plan

  • Existing tests pass with updated rom_solver/* keys in test/inputs/steady_ns.*.yml.
  • AdvDiffSolver with flow_solver/type: stokes reproduces previous behavior.
  • AdvDiffSolver with flow_solver/type: steady-ns runs end-to-end.
  • GenerateSamples random mode recovers from a SetParameterizedProblem failure.
  • SingleSchwarzRun converges on the SteadyNS component-wise example used during development; record converged error and iteration count.
  • phyml_poisson sketch builds.

dreamer2368 and others added 28 commits December 19, 2025 10:51
@dreamer2368 dreamer2368 changed the title Schwarz AdvDiffSolver flow-solver upgrade + alternating-Schwarz ROM for SteadyNS Jun 9, 2026
@dreamer2368 dreamer2368 marked this pull request as ready for review June 9, 2026 23:05
@dreamer2368 dreamer2368 mentioned this pull request Jun 10, 2026
Comment thread src/component_topology_handler.cpp Outdated
Comment thread src/component_topology_handler.cpp Outdated
Comment thread src/component_topology_handler.cpp Outdated
Comment thread src/component_topology_handler.cpp Outdated
Comment thread include/component_topology_handler.hpp Outdated
Comment thread src/multiblock_solver.cpp
Comment thread src/steady_ns_solver_schwarz.cpp Outdated
Comment thread src/steady_ns_solver_schwarz.cpp Outdated
Comment thread src/stokes_solver.cpp Outdated
Comment thread src/stokes_solver.cpp Outdated
// External ports connecting to meshes outside the subset are excluded;
// their port attributes (formerly interior to the global domain) are
// registered into bdr_attributes as new global boundary attributes of the subset mesh.
// Subset mesh boundaries that lay on the global boundary inherit the

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lay -> lie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants