dougshidong / PHiLiP

Parallel High-Order Library for PDEs through hp-adaptive Discontinuous Galerkin methods
Other
45 stars 36 forks source link

AD Strong DG - Implicit Inviscid - Computes Jacobians #261

Open AlexanderCicchino opened 2 months ago

AlexanderCicchino commented 2 months ago

Strong DG now uses AD to compute Jacobians for dR/du and dR/dX for pdes that don't have diffusion. Implicit strong DG implemented for convective pdes. Operators templated.

Implementation Changes: -Operators: removed the real template and instead templated the function calls, like matrix_vector_mult. This change was made because the class doesn't need to know the template since the basis functions are double, and the template only needs to be used when the operator is applied on a vector. -DG Structure: The tape was pulled out of the functions in DGWeak into DGBase. The tape is defined in assemble_cell_residual_and_ad_derivatives, with sensitivities computed in assemble_volume_codi_taped_derivatives_ad, and face and boundary terms. For DGStrong, we reuse the metric terms from the interior cell on the face, so we set the tape position and compute the terms before the volume residual call in build_volume_metric_operators. -DGStrong/Weak: The functions left are the residual evaluations, which are templated by real2 in DGWeak or adtype in DGStrong. -Small changes: dealii::FullMatrix doesn't accept an AD argument so I changed the structure for the Hadamard products etc in DGStrong to use an std:::vector.

AlexanderCicchino commented 2 months ago

Currently running full ctest and will post log file when it is completed.

AlexanderCicchino commented 2 months ago

Added finite difference vs Ad Jacobian unit tests. dR/dU works/validated, but dR/dX does not pass for strong currently.

AlexanderCicchino commented 2 months ago

dR/dX works now for dg strong and added sensitivity unit tests verifying. Also added unit tests for d2R

PranshulThakur commented 2 months ago

dR/dX works now for dg strong and added sensitivity unit tests verifying. Also added unit tests for d2R

Thanks @AlexanderCicchino . The current PR of computing sensitivities with strong DG will facilitate several future avenues for research. There is currently an issue on narval with cmake when compiling master and is not specific to this PR. I will post the results of running ctest on narval soon once the issue is fixed.

cpethrick commented 2 months ago

I just tried compiling in debug mode and there are some issues with the Assert statements and it doesn't build. Commenting so that the issue is recorded!

Thanks for the description of the implementation changes, @AlexanderCicchino, they are quite helpful :)

AlexanderCicchino commented 2 months ago

I just tried compiling in debug mode and there are some issues with the Assert statements and it doesn't build. Commenting so that the issue is recorded!

Thanks for the description of the implementation changes, @AlexanderCicchino, they are quite helpful :)

Fixed the debug mode Assert issues.