From 26420a88d77a20beff2fd9bd8bf01a7af85cd4cc Mon Sep 17 00:00:00 2001 From: Vaggelis Papoutsis Date: Thu, 2 Feb 2023 13:46:18 +0200 Subject: [PATCH] BUG: extraConvection in ATC missing a multiplication with ATClimiter In the 'standard' and 'UaGradU' options for the ATC term of the adjoint equations, there is an option to add 'aritificial dissipation', by adding and subtracting a multiple of the adjoint convection term with different discretizations. The implicit part was not multiplied with the ATClimiter whereas the explicit one was, leading to mismatched contributions in the areas affected by the ATClimiter, which could affect the sensitivity derivatives. --- .../adjoint/ATCModel/ATCUaGradU/ATCUaGradU.C | 9 ++++----- .../adjoint/ATCModel/ATCstandard/ATCstandard.C | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/optimisation/adjointOptimisation/adjoint/ATCModel/ATCUaGradU/ATCUaGradU.C b/src/optimisation/adjointOptimisation/adjoint/ATCModel/ATCUaGradU/ATCUaGradU.C index 660a697ee2..62048a5e95 100644 --- a/src/optimisation/adjointOptimisation/adjoint/ATCModel/ATCUaGradU/ATCUaGradU.C +++ b/src/optimisation/adjointOptimisation/adjoint/ATCModel/ATCUaGradU/ATCUaGradU.C @@ -5,8 +5,8 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2007-2021 PCOpt/NTUA - Copyright (C) 2013-2021 FOSS GP + Copyright (C) 2007-2023 PCOpt/NTUA + Copyright (C) 2013-2023 FOSS GP Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License @@ -86,10 +86,9 @@ void ATCUaGradU::addATC(fvVectorMatrix& UaEqn) if (extraConvection_ > 0) { // Implicit part added to increase diagonal dominance - // Note: Maybe this needs to be multiplied with the ATClimiter ?? - UaEqn += extraConvection_*fvm::div(-phi, Ua); + UaEqn += ATClimiter_*extraConvection_*fvm::div(-phi, Ua); - // correct rhs due to implicitly augmenting the adjoint convection + // Correct rhs due to implicitly augmenting the adjoint convection ATC_ += extraConvection_*(fvc::grad(UaForATC(), "gradUaATC")().T() & U); } diff --git a/src/optimisation/adjointOptimisation/adjoint/ATCModel/ATCstandard/ATCstandard.C b/src/optimisation/adjointOptimisation/adjoint/ATCModel/ATCstandard/ATCstandard.C index 9ad646fe88..2bda6fdb42 100644 --- a/src/optimisation/adjointOptimisation/adjoint/ATCModel/ATCstandard/ATCstandard.C +++ b/src/optimisation/adjointOptimisation/adjoint/ATCModel/ATCstandard/ATCstandard.C @@ -5,8 +5,8 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2007-2021 PCOpt/NTUA - Copyright (C) 2013-2021 FOSS GP + Copyright (C) 2007-2023 PCOpt/NTUA + Copyright (C) 2013-2023 FOSS GP Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License @@ -90,10 +90,9 @@ void ATCstandard::addATC(fvVectorMatrix& UaEqn) if (extraConvection_ > 0) { // Implicit part added to increase diagonal dominance - // Note: Maybe this needs to be multiplied with the ATClimiter ?? - UaEqn += extraConvection_*fvm::div(-phi, Ua); + UaEqn += ATClimiter_*extraConvection_*fvm::div(-phi, Ua); - // correct rhs due to implicitly augmenting the adjoint convection + // Correct rhs due to implicitly augmenting the adjoint convection ATC_ += extraConvection_*(fvc::grad(Ua, "gradUaATC")().T() & U); }