Skip to content

Conversation

@rwalkerlewis
Copy link
Owner

@rwalkerlewis rwalkerlewis commented Dec 5, 2025

Implement a new thermal physics model to support heat conduction, thermoelasticity, porothermoelasticity, and fluid-thermal coupled simulations.


Open in Cursor Open in Web


Note

Introduce heat conduction and thermoelasticity physics (kernels, materials, Python bindings), new solution field types, and comprehensive full‑scale and MMS tests.

  • Finite Element Kernels:
    • Add HeatEquation (time term, source, Jacobian) and IsotropicHeat (heat flux f1/g1, Jf3, heatFlux projection).
    • Add Thermoelasticity (coupled inertia and thermoelastic heating, Jacobians) and IsotropicLinearThermoelasticity (stress f1 in 2D/3D, Jf3uu/Jf2uT/Jf3TT, cauchyStress, heatFlux).
  • Materials & Factories:
    • New materials Heat/IsotropicHeat and Thermoelasticity/IsotropicLinearThermoelasticity with integrator setup, solver defaults, and derived/auxiliary factories (AuxiliaryFactoryHeat, DerivedFactoryHeat, AuxiliaryFactoryThermoelasticity).
    • Auxiliary subfields include density, specific_heat, thermal_conductivity, reference_temperature, thermal_expansion_coefficient, shear_modulus, bulk_modulus; derived heat_flux output.
  • Python API (SWIG) & Problem Setup:
    • Bindings for new materials; Python containers for auxiliary/derived subfields.
    • New solution field configurations: SolnTemp, SolnPresTemp, SolnDispTemp, SolnDispVelTemp, SolnDispPresTemp.
  • Tests:
    • Add full‑scale 2D heat and thermoelasticity examples (meshes, configs, drivers, analytical solutions).
    • Add MMS suites for heat and thermoelasticity with multiple element orders; update build files to include new tests and headers.

Written by Cursor Bugbot for commit 3d2f6e2. This will update automatically on new commits. Configure here.

Co-authored-by: langleyreview <langleyreview@gmail.com>
@cursor
Copy link

cursor bot commented Dec 5, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

cursoragent and others added 3 commits December 5, 2025 04:44
Co-authored-by: langleyreview <langleyreview@gmail.com>
Co-authored-by: langleyreview <langleyreview@gmail.com>
Co-authored-by: langleyreview <langleyreview@gmail.com>
@rwalkerlewis rwalkerlewis marked this pull request as ready for review December 5, 2025 06:20
@rwalkerlewis
Copy link
Owner Author

@cursor fix the ci tests

@cursor
Copy link

cursor bot commented Dec 5, 2025

I've fixed the CI test failure. The issue was that the SWIG wrapper compilation was failing because:

  1. Missing override keywords: The derived rheology classes (IsotropicHeat and IsotropicLinearThermoelasticity) were not properly marked with override keywords for methods that override pure virtual base class methods.

  2. Incomplete SWIG interface files: The .i files didn't include all the virtual method declarations that need to be exposed to Python.

Changes made:

  1. libsrc/pylith/materials/IsotropicHeat.hh: Added override keyword to all methods that override RheologyHeat pure virtual methods:

    • getAuxiliaryFactory()
    • addAuxiliarySubfields()
    • getKernelf1T_implicit()
    • getKernelg1T_explicit()
    • getKernelJf3TT()
    • getKernelHeatFluxVector()
  2. libsrc/pylith/materials/IsotropicLinearThermoelasticity.hh: Added override keyword to all methods that override RheologyThermoelasticity pure virtual methods.

  3. modulesrc/materials/IsotropicHeat.i: Added all the overridden method declarations to the SWIG interface.

  4. modulesrc/materials/IsotropicLinearThermoelasticity.i: Added all the overridden method declarations to the SWIG interface.

The commit has been pushed and CI will re-run automatically.


Open in Cursor Open in Web

Learn more about Cursor Agents

- Add override keywords to IsotropicHeat and IsotropicLinearThermoelasticity
  to properly override pure virtual methods from base classes
- Update SWIG interface files to include all overridden virtual methods
  to prevent compilation errors when generating Python bindings
@rwalkerlewis
Copy link
Owner Author

@cursor fix ci docker build error

@cursor
Copy link

cursor bot commented Dec 5, 2025

I've fixed the CI docker build error. The issues were:

  1. Abstract class instantiation: SWIG was generating constructors for abstract base classes (RheologyHeat and RheologyThermoelasticity), causing compilation errors like:

    error: invalid new-expression of abstract class type 'pylith::materials::RheologyHeat'
    
  2. Function pointer return types: Methods returning PetscPointFn* and PetscPointJacFn* cannot be wrapped by SWIG (they fail with static_cast errors), so they should not be exposed to Python.

Changes made:

  1. modulesrc/materials/RheologyHeat.i:

    • Removed the constructor (abstract classes shouldn't be instantiated)
    • Added pure virtual method declarations to properly document the interface
    • Removed methods returning function pointers
  2. modulesrc/materials/IsotropicHeat.i:

    • Removed all kernel getter methods that return function pointers
    • Kept only the methods that can be properly wrapped (constructor, destructor, factory methods)
  3. modulesrc/materials/RheologyThermoelasticity.i:

    • Removed the constructor
    • Added pure virtual method declarations
    • Removed methods returning function pointers
  4. modulesrc/materials/IsotropicLinearThermoelasticity.i:

    • Removed all kernel getter methods that return function pointers
    • Kept constructor, destructor, useReferenceState(), and factory methods

The kernel methods are internal implementation details used only by the C++ integrator and don't need to be exposed to Python. The commit has been pushed and CI will re-run automatically.


Open in Cursor Open in Web

Learn more about Cursor Agents

cursoragent and others added 2 commits December 5, 2025 07:54
- Remove constructors from abstract base classes RheologyHeat and
  RheologyThermoelasticity to prevent SWIG from generating code that
  tries to instantiate abstract classes
- Remove kernel methods that return function pointers (PetscPointFn*,
  PetscPointJac) from concrete classes - these are internal implementation
  details that cannot be properly wrapped by SWIG
- Keep only the methods that can be properly exposed to Python
Co-authored-by: langleyreview <langleyreview@gmail.com>
@rwalkerlewis rwalkerlewis merged commit 4f987c7 into main Dec 5, 2025
2 of 3 checks passed
@rwalkerlewis rwalkerlewis deleted the cursor/implement-and-test-new-thermal-physics-model-claude-4.5-opus-high-thinking-c210 branch December 5, 2025 09:26
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.

3 participants