Skip to content

Change divercont behaviour in structure new - #3

Closed
rjoussen wants to merge 23 commits into
mainfrom
change-DIVERCONT-behaviour-in-structure-new
Closed

Change divercont behaviour in structure new#3
rjoussen wants to merge 23 commits into
mainfrom
change-DIVERCONT-behaviour-in-structure-new

Conversation

@rjoussen

Copy link
Copy Markdown
Owner

Description and Context

Related Issues and Pull Requests

Disclosure of AI assistance

Groundwork for boundary conditions whose value depends on more than the
current time. No behaviour change.

Bundle the state an evaluator may depend on into an AssemblyContext
instead of passing a bare time, so that adding a dependency does not
touch every evaluator signature. The context is built by
update_residual_vector() and update_jacobian() rather than by their
callers, so that a caller cannot pass state that disagrees with the
container.

Give the Jacobian evaluator the same state as the residual evaluator:
the pipeline already re-invokes it per Newton iteration and already
holds the dofs, so a condition whose value depends on the current
iterate can contribute off-diagonal entries without further plumbing.
Make the early-out on a filled matrix a per-model property rather than a
blanket assumption, so that such a condition is not silently skipped
once the graph is built; rename assemble_diagonal_jacobian() to
assemble_unit_diagonal_jacobian() and record that insert_my_values() is
what ties it to an unfilled matrix.

Factor the shared residual loop into apply_dirichlet_residual().
Replace the boundary condition type used for duplicate detection with a
ConstrainedVariable enum, so that types sharing a constrained variable
are rejected on the same node, and select the constrained dof from that
variable rather than from the type.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@rjoussen rjoussen closed this Aug 20, 2026
@rjoussen rjoussen reopened this Aug 20, 2026
@rjoussen
rjoussen force-pushed the change-DIVERCONT-behaviour-in-structure-new branch 7 times, most recently from 082d94f to 344382a Compare August 22, 2026 23:27
@rjoussen
rjoussen requested a lite review from Copilot August 22, 2026 23:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

There are confirmed inconsistencies/misleading contracts (time-step control defaults vs. spec, and incorrect/incomplete API/error documentation) that should be corrected to avoid surprising runtime behavior and confusing diagnostics.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR refactors structural time-loop error handling by replacing the legacy convergence status flow with an explicit StepStatus/StepAction contract, and introduces reusable time-step control utilities (with tests) that are integrated into the new structure time integrator. It also updates/extends regression test inputs to reflect the new divergence/time-step-control behavior and adds dedicated time-step-control YAML test cases.

Changes:

  • Introduce Solid::StepStatus/Solid::StepAction and propagate them through structure adapters, time loops, and coupled drivers.
  • Add TimeStepping::TimeStepControlSettings plus helper functions and new unit tests for time-step reduction/increase logic.
  • Update many test input YAMLs (notably removing explicit DIVERCONT) and add three new structure YAML tests for time-step control behavior.
File summaries
File Description
tests/list_of_tests.cmake Registers new structure time-step-control YAML tests.
tests/input_files/tsi_meshtying_nurbs.4C.yaml Removes explicit DIVERCONT to rely on updated defaults/handling.
tests/input_files/thermo3D_meshtying_nurbs.4C.yaml Removes explicit DIVERCONT to rely on updated defaults/handling.
tests/input_files/solid_hex8_time_step_control_increase_blocked.4C.yaml New regression test for blocked time-step increase.
tests/input_files/solid_hex8_time_step_control_decrease_to_max_time.4C.yaml New regression test for reducing dt to hit MAXTIME exactly.
tests/input_files/solid_hex8_time_step_control_decrease_after_newton_failure.4C.yaml New regression test for dt reduction after Newton failure.
tests/input_files/sohex8_disp_altgeogeneration.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/mixture_muscle_weickenmeier_hex.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/mixture_muscle_giantesio_hex.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/meshtying2D_inf_plate_quad_lin.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/meshtying2D_inf_plate_quad_lin_new_struct.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/meshtying2D_inf_plate_quad_const.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/mat_muscle_weickenmeier_hex.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/mat_muscle_giantesio_hex.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/mat_muscle_combo_hex.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/mat_muscle_combo_hex_act_map_interpolation.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/mat_muscle_combo_hex_act_map_every_timestep.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/fsi_dc3D_part_ait_ga_ost_xwall.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/fbi_meshtying_smat.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/fbi_meshtying_bmat.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/ehl3d_mixed.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/ehl3d_cyl_part.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/ehl3d_cyl_mono.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/ehl3d_cyl_mono_averaged.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/ehl3D_block_sqz.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/ehl2D_block_sqz.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/ehl_bearing_roeland.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/ehl_bearing_barus.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/contact3D_nurbs27_pg.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/beam3wk_line3rot_static_test1_adaptstep.4C.yaml Updates steps/results to validate time/dt reporting under adapt-step runs.
tests/input_files/beam3sk_line3rot_static_test1_adaptstep.4C.yaml Updates steps/results to validate time/dt reporting under adapt-step runs.
tests/input_files/beam3r_line5_static_test1_adaptstep.4C.yaml Updates results to validate time/dt reporting under adapt-step runs.
tests/input_files/beam3r_herm2line3_static_LJ_singlelengthspec_smallsepapprox_simple_regularization_linextpol_twocrossedbeams_pulloff_FAD.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/beam3r_herm2line3_static_LJ_singlelengthspec_smallsepapprox_regularization_linextpol_twocrossedbeams_pulloff.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/beam3r_herm2line3_backweuler_browndyn_vanderWaals_singlelengthspec_smallsepapprox_twocrossedbeams.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/beam3r_herm2line3_backweuler_browndyn_vanderWaals_doublelengthspec_smallsepapprox_regularization_linextpol_twocrossedbeams.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/beam3r_herm2line3_backweuler_browndyn_vanderWaals_doublelengthspec_smallsepapprox_regularization_constextpol_twocrossedbeams.4C.yaml Removes explicit DIVERCONT to align with new behavior.
tests/input_files/beam3r_herm2line3_backweuler_browndyn_repLJ_singlelengthspec_smallsepapprox_twocrossedbeams.4C.yaml Removes explicit DIVERCONT to align with new behavior.
src/tsi/4C_tsi_partitioned.cpp Checks structure solve status and asserts on failure via StepStatus.
src/timestepping/tests/CMakeLists.txt Adds CMake entry to auto-discover timestepping unit tests.
src/timestepping/tests/4C_timestepping_time_step_control_test.cpp Adds unit tests for time-step control settings and dt update logic.
src/timestepping/4C_timestepping_time_step_control.hpp Declares time-step control settings and helper APIs.
src/timestepping/4C_timestepping_time_step_control.cpp Implements input spec + dt reduction/increase computations.
src/structure/4C_structure_timint.hpp Adapts legacy structure timint interfaces to StepStatus/StepAction and void integrates.
src/structure/4C_structure_timint.cpp Maps failure handling to StepAction results.
src/structure/4C_structure_timint_impl.hpp Updates legacy implicit timint impl interface signatures to new status/action types.
src/structure/4C_structure_timint_impl.cpp Converts solver return codes into StepStatus and updates adapt-step logic signature.
src/structure/4C_structure_timint_expleuler.hpp Updates explicit integrator interface to void step integration.
src/structure/4C_structure_timint_expleuler.cpp Removes obsolete return-code plumbing in explicit step integration.
src/structure/4C_structure_timint_expl.hpp Updates explicit base integrator to return StepStatus::success.
src/structure/4C_structure_timint_centrdiff.hpp Updates explicit integrator interface to void step integration.
src/structure/4C_structure_timint_centrdiff.cpp Removes obsolete return-code plumbing in explicit step integration.
src/structure/4C_structure_timint_ab2.hpp Updates explicit integrator interface to void step integration.
src/structure/4C_structure_timint_ab2.cpp Removes obsolete return-code plumbing in explicit step integration.
src/structure/4C_structure_timada.hpp Changes adaptive integrator integrate signature to void.
src/structure/4C_structure_timada.cpp Removes placeholder error-code return from adaptive integrator.
src/structure_new/src/utils/4C_structure_new_resulttest.cpp Adds special-result support for time and time_step_size.
src/structure_new/src/predict/4C_structure_new_predict_factory.cpp Includes exception header (supporting updated error handling).
src/structure_new/src/nonlinear_solver/4C_structure_new_nln_solver_nox.hpp Updates NOX solver interface to return StepStatus.
src/structure_new/src/nonlinear_solver/4C_structure_new_nln_solver_nox.cpp Maps NOX status to StepStatus.
src/structure_new/src/nonlinear_solver/4C_structure_new_nln_solver_generic.hpp Updates solver interface to return StepStatus.
src/structure_new/src/input/4C_structure_new_input.hpp Removes old ConvergenceStatus enum from new-structure input.
src/structure_new/src/input/4C_structure_new_input.cpp Adds TIME STEP CONTROL group spec; removes MAXDIVCONREFINEMENTLEVEL.
src/structure_new/src/implicit/4C_structure_new_timint_implicit.hpp Adds time-step control state and new status/action method signatures.
src/structure_new/src/implicit/4C_structure_new_timint_implicit.cpp Implements retry/stop behavior via StepAction and integrates time-step control updates.
src/structure_new/src/implicit/4C_structure_new_impl_statics.hpp Includes exception header (supporting updated error handling).
src/structure_new/src/explicit/4C_structure_new_timint_explicit.hpp Updates explicit timint interface to StepStatus and void integrate/step.
src/structure_new/src/explicit/4C_structure_new_timint_explicit.cpp Asserts on explicit solve failure using StepStatus.
src/structure_new/src/explicit/4C_structure_new_expl_abx.hpp Includes exception header (supporting updated error handling).
src/structure_new/src/4C_structure_new_timint_basedatasdyn.hpp Stores TimeStepControlSettings and removes legacy adapt-step bookkeeping.
src/structure_new/src/4C_structure_new_timint_basedatasdyn.cpp Initializes time-step control settings from input.
src/structure_new/src/4C_structure_new_timint_basedataio.hpp Adjusts includes to match refactor.
src/structure_new/src/4C_structure_new_timint_base.hpp Adds finalize hook and updates step integration signature.
src/structure_new/src/4C_structure_new_timint_base.cpp Implements finalize hook (including dynamic rebalance).
src/ssi/4C_ssi_partitioned_2wc.cpp Checks structure solve status and asserts on failure via StepStatus.
src/ssi/4C_ssi_partitioned_1wc.cpp Checks structure solve status and asserts on failure via StepStatus.
src/porofluid_pressure_based_elast/4C_porofluid_pressure_based_elast_partitioned.cpp Checks structure solve status and asserts on failure via StepStatus.
src/porofluid_pressure_based_elast_scatra/4C_porofluid_pressure_based_elast_scatra_partitioned.cpp Checks structure solve status and asserts on failure via StepStatus.
src/poroelast/4C_poroelast_partitioned.cpp Checks structure solve status and asserts on failure via StepStatus.
src/pasi/4C_pasi_partitioned.cpp Checks structure solve status and asserts on failure via StepStatus.
src/fsi/src/partitioned/model_evaluator/4C_fsi_dirichletneumannslideale.cpp Checks structure solve status and asserts on failure via StepStatus.
src/fsi/src/partitioned/model_evaluator/4C_fsi_dirichletneumann_vel.cpp Checks structure solve status and asserts on failure via StepStatus.
src/fsi/src/partitioned/model_evaluator/4C_fsi_dirichletneumann_disp.cpp Checks structure solve status and asserts on failure via StepStatus.
src/ehl/4C_ehl_partitioned.cpp Checks structure solve status and asserts on failure via StepStatus.
src/adapter/4C_adapter_str_wrapper.hpp Updates adapter to new solve/prepare status and void integrate.
src/adapter/4C_adapter_str_timint_adaptive.hpp Updates adaptive timint adapter integrate signature to void.
src/adapter/4C_adapter_str_timint_adaptive.cpp Updates adaptive timint adapter integrate signature to void.
src/adapter/4C_adapter_str_timeloop.hpp Updates structure time loop integrate signature and removes unused problem_ member.
src/adapter/4C_adapter_str_timeloop.cpp Refactors time loop to use StepStatus/StepAction and finalize hook.
src/adapter/4C_adapter_str_timeada.hpp Updates adaptive time loop integrate signature and error action to StepAction.
src/adapter/4C_adapter_str_timeada.cpp Updates adaptive time loop integrate signature and error action to StepAction.
src/adapter/4C_adapter_str_structure.hpp Introduces StepStatus/StepAction, new prepare-with-status hook, and finalize hook in the core structure adapter.
src/adapter/4C_adapter_str_structure_new.hpp Updates new-structure adapter solve/integrate signatures.
src/adapter/4C_adapter_str_constr_merged.hpp Updates merged constraint adapter integrate signature to void.
Review details
  • Files reviewed: 94/94 changed files
  • Comments generated: 5
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/adapter/4C_adapter_str_structure.hpp
Comment thread src/adapter/4C_adapter_str_structure.hpp Outdated
Comment thread src/structure_new/src/nonlinear_solver/4C_structure_new_nln_solver_nox.cpp Outdated
Comment thread src/timestepping/4C_timestepping_time_step_control.hpp Outdated
Comment thread src/timestepping/4C_timestepping_time_step_control.cpp
@rjoussen
rjoussen force-pushed the change-DIVERCONT-behaviour-in-structure-new branch 4 times, most recently from a6d46e0 to 74de4bb Compare August 23, 2026 21:10
maxiludwig and others added 2 commits August 24, 2026 10:08
Prescribe the pressure of a boundary node from the total volume of all
terminal units, following a normalized linear-exponential curve. Only
the Frozen coupling is implemented: it reads the volume of the last
converged timestep, so the value is constant during a Newton solve and
the equation stays a Dirichlet row.

Model how the value is produced with a ValueModel variant on
BoundaryConditionModel, the way TerminalUnitModel already models its
elasticity and rheology. This replaces the boundary condition Type
enum, which conflated the constrained variable with the data the value
comes from, and the loose function/pleural-pressure members of which
only one was ever meaningful. The alternatives are named after what
distinguishes them: a value following a function of time serves both
ends of the tree, at the trachea and at the pleura, while a
volume-dependent pleural pressure can only be a pleural pressure. Each
alternative is a prescribed_value() overload, bound to a model by
make_residual_evaluator() in a single visit, so assembly never inspects
the variant again. The pleural overload switches on its coupling, so a
further coupling is a compile error rather than something that silently
evaluates as if it were frozen.

Give each input list its own definition struct instead of sharing one
that carries a variant. The list a definition sits in then determines
what it may prescribe, which makes a mismatch unrepresentable rather
than something to validate after parsing. Check that ids and function
ids are positive in the input specs, so the error names the offending
line of the input file; only the check relating total_lung_capacity to
residual_volume stays behind, since the spec system validates single
values and not pairs of them. Cover both id checks with spec tests,
which the equivalent hand-written checks never had.

Group conditions per definition rather than folding definitions that
happen to share a function, so the grouping key is the definition id
alone. The id is therefore constant across a model and moves out of the
per-entry arrays. Resolving the input yields the models themselves, so
a definition is described by one type rather than copied through an
intermediate.

Refresh the total terminal unit volume once per timestep, before the
Newton solve and collectively on all ranks, and skip the reduction
entirely when no condition asks for it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Cover the volume-dependent pleural pressure boundary condition from the
input file down, which the unit tests cannot do: they construct the
parameters directly and so skip parsing the definition out of the
one_of. The case omits 'coupling' so the Frozen default is exercised.

It reuses the bifurcation mesh, whose 'bc_id' array already assigns one
shared id to both terminal unit outlets, so a single definition drives
two nodes. Running it on one and three ranks covers the collective
volume reduction, which has to be reached by every rank while the model
itself only lives on the rank owning the attached element. Two
timesteps are used so that the second one evaluates the curve at the
volume the first one produced.

The Reduced_Lung problem type has no result test support, so this only
asserts that the case parses and runs to completion. The value of the
pressure-volume curve itself is pinned by the unit tests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@rjoussen
rjoussen force-pushed the change-DIVERCONT-behaviour-in-structure-new branch 2 times, most recently from 81a39b9 to e7dc0b0 Compare August 24, 2026 10:05
…lume-dependent-pleural-pressure-bc

Reduced lung: Volume dependent pleural pressure bc
@rjoussen
rjoussen force-pushed the change-DIVERCONT-behaviour-in-structure-new branch 4 times, most recently from abc580b to 5535e94 Compare August 24, 2026 14:38
Bumps [dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact) from 21 to 24.
- [Release notes](https://github.com/dawidd6/action-download-artifact/releases)
- [Commits](dawidd6/action-download-artifact@v21...v24)

---
updated-dependencies:
- dependency-name: dawidd6/action-download-artifact
  dependency-version: '24'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@rjoussen
rjoussen force-pushed the change-DIVERCONT-behaviour-in-structure-new branch from eab236b to bd950a4 Compare August 24, 2026 16:21
- make integrate methods void. Their return types were either unused or
  ignored by callers.
- perform_error_action base implementation is moved to
  adapter_str_structure
- Remove some doxygen comments of inherited methods
- ConvergenceStatus is renamed to StepStatus, converted to an enum
  class, moved to the adapter_str_stucture header and the field names
  are renamed to be more precise
- Mark Structure::solve() as nodiscard to enforce status handling.
  Partitioned solvers that ignored the return of solve() are updated and
  assert success
…ot/github_actions/dot-github/actions/chunk_test_suite/dawidd6/action-download-artifact-24

Bump dawidd6/action-download-artifact from 21 to 24 in /.github/actions/chunk_test_suite
@rjoussen
rjoussen force-pushed the change-DIVERCONT-behaviour-in-structure-new branch from bd950a4 to 8db1596 Compare August 24, 2026 16:51
dependabot Bot and others added 2 commits August 24, 2026 16:57
Bumps [dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact) from 21 to 24.
- [Release notes](https://github.com/dawidd6/action-download-artifact/releases)
- [Commits](dawidd6/action-download-artifact@v21...v24)

---
updated-dependencies:
- dependency-name: dawidd6/action-download-artifact
  dependency-version: '24'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
…ot/github_actions/dot-github/workflows/dawidd6/action-download-artifact-24

Bump dawidd6/action-download-artifact from 21 to 24 in /.github/workflows
@rjoussen
rjoussen force-pushed the change-DIVERCONT-behaviour-in-structure-new branch from 8db1596 to c323da0 Compare August 25, 2026 07:59
lkoeglmeier and others added 8 commits August 25, 2026 13:23
to "volfrac_multiphase" to make it more evident what the
quantity describes.
…tatus-handling

Improve solid time-step status handling
- Add last time_step_size, total_time and total_num_steps to result
quantities. Appropriate tests are added to all tests making use
of non-constant time-step sizes.

- Remove DIVERCONT != stop from all tests that do not need it.
Reason: The only place it was used could not
reach it except due to a programming error.
Also, such an error would only end up in the nox
interface where it leads to an untyped exception.
…-output-for-structporo-materials

Add porosity output for StructPoro* materials
…-error-flag

Remove `ele_eval_error_flag`
…nt-tests

Tighten solid `DIVERCONT` tests
@rjoussen
rjoussen force-pushed the change-DIVERCONT-behaviour-in-structure-new branch from c323da0 to 7dd62ed Compare August 25, 2026 13:47
…formation_solid_tutorial

[tutorial] Update solid tutorial after removal of wall time print
@rjoussen
rjoussen force-pushed the change-DIVERCONT-behaviour-in-structure-new branch from 7dd62ed to 555a02e Compare August 25, 2026 14:00
@rjoussen
rjoussen force-pushed the change-DIVERCONT-behaviour-in-structure-new branch from 555a02e to 58cccab Compare August 25, 2026 14:58
…eval-error-flag

Remove old integration eval-error-flag
@rjoussen
rjoussen force-pushed the change-DIVERCONT-behaviour-in-structure-new branch from 58cccab to e2e7992 Compare August 25, 2026 16:16
Since continue is a keyword, it is renamed to ignore.
- adapt_step now changes the time-step size based on the time step
  control input section. It also does not alter end step anymore.
- Introduce timestep control input section and move associated  math
  into the timestepping module (with unittests)
- Split StepStatus from the action taken by the time loop into two
  distinct enums.
- Call perform_error_action unconditionally in the timeloop.
- Move post output task into finalize_successful_step()
- Add regression tests for time-step decrease, clipping and (blocked)
  increase.
- Increase the NUMSTEPS input of some beam test that use adaptstep. The
  new mechanism now requires that they have that. the brownian dynamic
  test previously had time-step recovery whcih has slightly different
  behaviour now. This requires specifying reduce to max time now. Since
  the time-step size sequence changed and this matters in a stochastic
  forces test, there is a small result drift.
@rjoussen
rjoussen force-pushed the change-DIVERCONT-behaviour-in-structure-new branch from e2e7992 to c660fd9 Compare August 25, 2026 16:18
@rjoussen rjoussen closed this Aug 25, 2026
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.

5 participants