|
[Sponsors] |
February 1, 2019, 10:28 |
Implementation of adjoint equation
|
#1 |
New Member
Alexis Courtais
Join Date: Feb 2018
Posts: 3
Rep Power: 8 |
Hi everyone,
I am trying to implement the following equation within OpenFOAM (Ua is the adjoint velocity) : - Ua+Ua U- ( Ua) U + pa = -2 U I tried the following implementation but I'm not sure it computes the adjoint equation above Code:
volTensorField gradU (fvc::grad(U)); volVectorField adjointTransposeConvection2(gradU.T() & Ua); tmp<fvVectorMatrix> tUaEqn ( fvm::div(-phi, Ua) +fvm::Sp(fvc::div(phi),Ua) + adjointTransposeConvection2 +turbulence->divDevReff(Ua) == fvOptions(Ua) ); fvVectorMatrix& UaEqn = tUaEqn.ref(); UaEqn.relax(); fvOptions.constrain(UaEqn); solve(UaEqn == -fvc::grad(pa)-2*tau*fvc::laplacian(nu,U)); Thanks in advance. Berilmun |
|
February 1, 2019, 12:02 |
|
#2 |
Senior Member
Andrew Somorjai
Join Date: May 2013
Posts: 175
Rep Power: 13 |
Quote:
|
|
February 3, 2019, 12:18 |
|
#3 |
New Member
Alexis Courtais
Join Date: Feb 2018
Posts: 3
Rep Power: 8 |
||
February 3, 2019, 15:59 |
|
#4 | |
Senior Member
Andrew Somorjai
Join Date: May 2013
Posts: 175
Rep Power: 13 |
Quote:
Code:
template<class BasicTurbulenceModel> Foam::tmp<Foam::fvVectorMatrix> Foam::linearViscousStress<BasicTurbulenceModel>::divDevRhoReff ( volVectorField& U ) const { return ( - fvc::div((this->alpha_*this->rho_*this->nuEff())*dev2(T(fvc::grad(U)))) - fvm::laplacian(this->alpha_*this->rho_*this->nuEff(), U) ); } nuEff() is the effective viscosity. dev2 is line 115 from https://www.openfoam.com/documentati...8C_source.html Just use -fvm::laplacian(nu, Ua). |
||
February 3, 2019, 17:21 |
|
#5 | |
New Member
Alexis Courtais
Join Date: Feb 2018
Posts: 3
Rep Power: 8 |
Quote:
Do you have a tip to modeling the term ( Ua)U? |
||
February 4, 2019, 16:33 |
|
#6 |
Senior Member
Andrew Somorjai
Join Date: May 2013
Posts: 175
Rep Power: 13 |
Quote:
from here Understanding fvm::Sp() What exactly is that term by the way, is Ua the flux? |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Current conservation equation implementation | miguelmontenegro | Fluent UDF and Scheme Programming | 3 | July 3, 2024 08:21 |
Convective term in heat equation for rotating solids | vabishek | OpenFOAM Programming & Development | 8 | June 24, 2020 12:10 |
mass flow in is not equal to mass flow out | saii | CFX | 12 | March 19, 2018 06:21 |
Pressure distribution on a wall | darazsbence | CFX | 17 | October 6, 2015 11:38 |
Diffusion Equation | izardy amiruddin | Main CFD Forum | 2 | July 4, 2002 09:14 |