Skip to content

Add radial DG discretization#609

Open
jbreue16 wants to merge 21 commits into
cadet:masterfrom
Yuvraj2710:DGRadialFeature
Open

Add radial DG discretization#609
jbreue16 wants to merge 21 commits into
cadet:masterfrom
Yuvraj2710:DGRadialFeature

Conversation

@jbreue16

@jbreue16 jbreue16 commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

This PR adds an arbitrary order DG discretization for the radial flow models

Todo

  • Implementation of radial DG with its own convection dispersion operator, similar to FV
  • Incorporation of this operator in the ColumnModel1D unit
  • Incorporation of this operator in the LRM DG unit
  • Add tests
  • Add documentation

@jbreue16

jbreue16 commented Mar 9, 2026

Copy link
Copy Markdown
Contributor Author

Hi Yuvj, now that you have already implemented rLRMP and rGRM as separate units, I think you can first (EOC) test this in pyhton before refactoring into the ColumnModel1D.
Also, there are a couple of unrelated changes.

@Yuvraj2710

Copy link
Copy Markdown
Collaborator

CADET-Verification EOC tests for radial DG: Yuvraj2710/CADET-Verification@radialDG-verification

Tests radial DG convergence (polyDeg 2-5) with constant and variable dispersion (RADIAL_POWER_LAW) using the CADET-Verification framework. All polynomial degrees achieve expected convergence order.

@Yuvraj2710 Yuvraj2710 marked this pull request as ready for review March 31, 2026 07:25
@Yuvraj2710

Yuvraj2710 commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

Hi @jbreue16, I suppose this impl. of DG radial flow is working, and is ready for a review. I'll remove the rLRMP and rGRM which are as separate units currently, but there's also with ColumnModel1D.

@jbreue16 jbreue16 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi Yuvj, can you show me the convergence results and are they using a FV reference?

@Yuvraj2710

Yuvraj2710 commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

EOC Convergence Verification — Radial DG Bulk Transport

Ran EOC tests for radial DG (bulk transport only, rLRM no binding) using the CADET-Verification benchmark parameters (r_in=0.01, r_out=0.1, ε=1.0, D=1e-6, v=5e-5, rectangular pulse).

Time integrator tolerances: ABSTOL=1e-12, ALGTOL=1e-12, RELTOL=1e-10.

CADET-Core DG vs FV WENO3 reference (Z=262,144):

P1 (expected order 2):

nElem nDOFs L2 error Linf error Linf EOC
1 2 7.62e-02 1.65e-01
2 4 5.27e-02 1.19e-01 0.47
4 8 2.71e-02 7.41e-02 0.68
8 16 8.94e-03 2.72e-02 1.44
16 32 2.20e-03 7.02e-03 1.96
32 64 5.21e-04 1.68e-03 2.06
64 128 1.26e-04 4.06e-04 2.05
128 256 3.07e-05 9.96e-05 2.03

P2 (expected order 3):

nElem nDOFs L2 error Linf error Linf EOC
1 3 7.16e-02 1.56e-01
2 6 3.66e-02 8.69e-02 0.85
4 12 8.87e-03 2.44e-02 1.83
8 24 7.07e-04 2.28e-03 3.42
16 48 2.77e-05 9.40e-05 4.60
32 96 8.99e-07 3.03e-06 4.95
64 192 2.66e-08 8.90e-08 5.09
128 384 7.15e-10 2.55e-09 5.13

P3 (expected order 4):

nElem nDOFs L2 error Linf error Linf EOC
1 4 6.29e-02 1.77e-01
2 8 2.18e-02 5.66e-02 1.65
4 16 1.61e-03 4.94e-03 3.52
8 32 2.49e-05 8.02e-05 5.95
16 64 3.75e-07 1.18e-06 6.08
32 128 5.94e-09 1.79e-08 6.05
64 256 1.95e-10 4.18e-10 5.42
128 512 9.28e-10 2.57e-09 -2.62

P4 (expected order 5):

nElem nDOFs L2 error Linf error Linf EOC
1 5 5.31e-02 1.50e-01
2 10 1.08e-02 2.99e-02 2.33
4 20 1.83e-04 5.88e-04 5.67
8 40 9.01e-07 3.61e-06 7.35
16 80 4.50e-09 1.45e-08 7.96
32 160 1.06e-10 3.71e-10 5.29
64 320 6.77e-10 1.94e-09 -2.39
128 640 8.12e-10 2.18e-09 -0.16

P5 (expected order 6):

nElem nDOFs L2 error Linf error Linf EOC
1 6 4.29e-02 1.41e-01
2 12 4.57e-03 1.33e-02 3.41
4 24 2.35e-05 8.66e-05 7.26
8 48 3.95e-08 1.27e-07 9.42
16 96 1.78e-10 5.47e-10 7.86
32 192 1.78e-10 4.10e-10 0.41
64 384 9.95e-10 2.88e-09 -2.81
128 768 3.07e-10 9.75e-10 1.56

@jbreue16

Copy link
Copy Markdown
Contributor Author

Two things that are weird here: EOC is unexpectedly high sometimes, e.g. 8.34 for P4, and convergence stops at around 1e-8.
Did you check that the outlet profile is something meaningful? Otherwise I don't have an idea how the EOC can be that high.

But the most relevant issue is convergence stopping at 1e-8. Can you set time integration tolerances abstol=1e-12 and reltol=1e-10 and use a WENO FV reference with error <= 1e-10 ?

@Yuvraj2710

Yuvraj2710 commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

Yes I did took tolerances to ABSTOL=1e-12, RELTOL=1e-10. The ~4e-9 (L_2 error) floor is the FV Z=10,000 reference accuracy. I can generate a Z=100k FV reference if needed.

@jbreue16

jbreue16 commented Mar 31, 2026

Copy link
Copy Markdown
Contributor Author

radCOL1D_transport_1comp_WENO3_benchmark1_FV_Z262144.zip

I have attached a reference solution with at least 7e-11 accuracy (262.144 cells) which you can use as reference. You can fix cadet/CADET-Verification#110 first and then compute the EOC for DG again

@Yuvraj2710

Copy link
Copy Markdown
Collaborator

radCOL1D_transport_1comp_WENO3_benchmark1_FV_Z262144.zip

I have attached a reference solution with at least 7e-11 accuracy (262.144 cells) which you can use as reference. You can fix cadet/CADET-Verification#110 first and then compute the EOC for DG again

Just updated the EOC results

@jbreue16 jbreue16 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Im very happy to see the great progress here.
Just reviewing this large PR on GitHub wasn't enough so I went into the code and addressed some issues myself. This PR needs a lot of clean-up and some fixes and needs to be rebased, force pushed. Thus, I made a backup branch: https://github.com/cadet/CADET-Core/tree/back_up/DGRadialFeature
Please read through the changes I made below and tell me if you disagree with any of this

  • The commits were not separated cleanly, there was stuff all over the place. I think its best to create two big PR's out of this: 1) radial DG incorporated to ColumnModel1D and LumpedRateModelWithoutPoresDG, I think this can be merged fast. 2) adding variable coefficients, Ive seen some implementation issues here so that probably needs further refinement and we shouldn't wait with mergeing the rest, hence a separate PR.
  • I removed some unwanted changes like increase of default AD directions, PAR_DISC_TYPE was made optional. I suppose there was no clear intent behind those changes and they are artifacts from the long list of changes made.
  • I updated how the integration mode is handled, making this part more modular for the seamless use of another convDispOp: #644
  • #646 fix of input group for filmDiff parDep in LRMP_FV as independent PR, added fixed docs and test for surfDiff

@codecov

This comment was marked as spam.

@jbreue16

jbreue16 commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

Hi @Yuvraj2710 please don't force push with squashes unless we agree to clean things up, such froce-pushes once I've started reviewing make it impossible for me to review. The final squash into one commit will happen at the very end, probably through the GitHub interface, not from a force push.

Ive kept the changes you force pushed in 5bb4f16 and 01ee54d, except for 1) the changes made to the ConvDispOp, which reintroduced an ambiguous interface that I removed and 2) the changes which falsely incorporated the rLRM into the ColumnModel1D. The rLRM should become part of the LRM_DG unit operation which is defined in LumpedRateModelWithoutPoresDG. We decided against the unification of this unit since it is structurally very different. The code you added would not work that way.

@jbreue16 jbreue16 mentioned this pull request Apr 7, 2026
@Yuvraj2710 Yuvraj2710 force-pushed the DGRadialFeature branch 2 times, most recently from 9ba0937 to d9ac843 Compare April 13, 2026 08:41

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.

Pull request overview

This PR adds an arbitrary-order discontinuous Galerkin (DG) spatial discretization for CADET’s radial-flow column models by introducing a dedicated radial DG convection–dispersion operator, wiring it into radial unit operations, and extending tests and documentation to cover the new discretization.

Changes:

  • Implement radial DG transport support (including rho-weighted mass matrices and variable-coefficient handling) and expose it through the existing DG operator framework.
  • Generalize ColumnModel1D and LumpedRateModelWithoutPoresDG to support axial vs radial DG via templated convection–dispersion operators, and update model selection/registration accordingly.
  • Add radial DG regression/reference tests, helper utilities, and JSON benchmark models; update radial-flow documentation to include DG configuration options.

Reviewed changes

Copilot reviewed 29 out of 37 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
test/RadialLumpedRateModelWithPores.cpp Adds extensive radial LRMP_DG CI test coverage (benchmarks, Jacobians, sensitivity, CI comparisons vs FV references).
test/RadialLumpedRateModelWithoutPores.cpp Adds radial LRM_DG CI test coverage analogous to existing FV tests plus DG-vs-FV reference checks.
test/RadialGeneralRateModel.cpp Adds radial GRM_DG CI tests, including parameter-dependence Jacobian checks and DG-vs-FV reference benchmark.
test/ParticleHelper.hpp Extends arrowhead Jacobian helper API to accept a spatial method argument.
test/ParticleHelper.cpp Implements the new spatial-method-aware arrowhead Jacobian helper.
test/JsonTestModels.cpp Updates JSON model factories to correctly detect GRM/LRMP behavior for radial unit type strings and fixes frustum/radial parameter placement.
test/data/model_radLRMP_dynLin_1comp_sensbenchmark1.json Updates LRMP benchmark model to use DG discretization settings.
test/data/model_radLRMP_DG_noBnd_1comp_eocbenchmark.json Adds new DG model for EOC/benchmark comparisons (no binding).
test/data/model_radLRMP_DG_linBnd_1comp_eocbenchmark.json Adds new DG model for EOC/benchmark comparisons (linear binding).
test/data/model_radLRM_dynLin_1comp_sensbenchmark1.json Updates LRM benchmark model to use DG discretization settings.
test/data/model_radLRM_DG_noBnd_1comp_eocbenchmark.json Adds new radial LRM DG model for EOC/benchmark comparisons (no binding).
test/data/model_radLRM_DG_linBnd_1comp_eocbenchmark.json Adds new radial LRM DG model for EOC/benchmark comparisons (linear binding).
test/data/model_radGRM_dynLin_1comp_sensbenchmark1.json Refactors GRM benchmark JSON structure and preserves FV settings while aligning with updated unit-type detection.
test/data/model_radGRM_DG_noBnd_1comp_eocbenchmark.json Adds new radial GRM DG model for EOC/benchmark comparisons (no binding).
test/ColumnTests.hpp Declares new radial DG benchmark/convergence helper test APIs.
test/ColumnTests.cpp Implements radial DG vs FV reference comparison and self-convergence EOC helper.
test/ColumnModel1D.cpp Adds radial ColumnModel1D DG test matrix (Jacobian, sensitivities, particle-type coverage, variable coefficient checks).
src/libcadet/model/parts/DGToolbox.hpp Adds quadrature/node utilities (Chebyshev + Gauss) and radial DG helper declarations (weighted mass, radial dispersion matrix, basis derivative).
src/libcadet/model/parts/DGToolbox.cpp Implements new quadrature/node utilities and radial dispersion matrix integration helper.
src/libcadet/model/parts/ConvectionDispersionOperatorDG.hpp Introduces RadialConvectionDispersionOperatorBaseDG with radial DG residual/Jacobian scaffolding and flux handling.
src/libcadet/model/LumpedRateModelWithoutPoresDG.hpp Templates the DG LRM unit on the convection–dispersion operator and adds a radial DG identifier.
src/libcadet/model/LumpedRateModelWithoutPoresDG.cpp Refactors implementation to template form and explicitly instantiates axial + radial DG variants.
src/libcadet/model/ColumnModelBuilder.cpp Enables radial DG unit selection and registers axial/radial DG models under appropriate identifiers.
src/libcadet/model/ColumnModel1D.hpp Templates ColumnModel1D on the convection–dispersion operator, adds radial identifier mapping, and adds explicit extern template declarations.
src/libcadet/model/ColumnModel1D.cpp Refactors ColumnModel1D implementation to template form and explicitly instantiates axial + radial DG variants.
src/libcadet/model/ColumnModel1D-LinearSolver.cpp Updates linear solver methods to template form for the generalized ColumnModel1D.
src/libcadet/model/ColumnModel1D-InitialConditions.cpp Updates initial-condition and sensitivity initialization code to template form for the generalized ColumnModel1D.
doc/interface/unit_operations/radial_flow_column_1D_config.rst Documents DG as an available radial discretization method and adds DG-specific parameters and notes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/libcadet/model/parts/DGToolbox.hpp
Comment thread src/libcadet/model/parts/DGToolbox.cpp
Comment thread src/libcadet/model/parts/ConvectionDispersionOperatorDG.hpp
Comment on lines +1823 to +1827
std::vector<StateType> c_star(_nElem + 1);
std::vector<StateType> g_star(_nElem + 1);
std::vector<double> d_rad_i(_nElem + 1);

computeNumericalFluxesRadial<StateType, ParamType>(yBulk, d_rad, c_star, g_star, d_rad_i);
Comment on lines +1735 to +1737
* b. Scale g by (2/Δρ)
* c. Compute numerical fluxes c*, g*
* d. Compute main equation Dc via surface + volume integrals
Comment thread test/ColumnTests.cpp Outdated
refValues.push_back(ref_outlet[i]);
}
}

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

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants