|
[Sponsors] | |||||
Problem replacing fvm::laplacian with fvm::div(fvc::grad) in divDevRhoReff |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|
|
#1 |
|
Member
Rishikesh
Join Date: Apr 2016
Posts: 63
Rep Power: 11 ![]() |
I am working to change the default divDevRhoReff() defined in turbulenceModels/linearViscousStress.C. The change requires replacing the laplacian(U) operation with div(grad(U)). I change the content of divDevRhoReff(U) as follows:
Code:
template<class BasicTurbulenceModel>
Foam::tmp<Foam::fvVectorMatrix>
Foam::linearViscousStress<BasicTurbulenceModel>::divDevRhoReff
(
volVectorField& U
) const
{
/*
//first change
Info<<"broken into two: nu + nut" <<endl;
return
(
- fvc::div((this->alpha_*this->rho_*this->nu())*dev2(T(fvc::grad(U)))) //split
- fvc::div((this->alpha_*this->rho_*this->nut())*dev2(T(fvc::grad(U)))) //split
- fvm::laplacian(this->alpha_*this->rho_*this->nu(), U) //not changed
- fvm::laplacian(this->alpha_*this->rho_*this->nut(), U)
);
//no issues as expected; some overhead due to repeated grad calculations.
*/
//second change
Info<<"changed fvm::laplacian to fvm::div(fvc::grad) for nut term" <<endl;
const volTensorField A = fvc::grad(U); //to create type required by fvm::div
const surfaceScalarField N = fvc::interpolate(this->nut()); //surfacescalarField required by fvm::div, created out of volScalarField nut
return
(
// - fvc::div((this->alpha_*this->rho_*this->nu())*dev2(T(fvc::grad(U)))) //split
// - fvc::div((this->alpha_*this->rho_*this->nut())*dev2(T(fvc::grad(U)))) //split
// - fvm::laplacian(this->alpha_*this->rho_*this->nu(), U) //not changed
- fvm::div(N, fvc::grad(U)()) // changed, removed alpha,rho to remove clutter.
// - fvm::div(this->alpha_*this->rho_*(fvc::interpolate(this->nut())),A) //changed to div(grad(U)) instead of laplacian(U) , same as above
);
}
Code:
../turbulenceModels/lnInclude/linearViscousStress.C:120:5: error: could not convert ‘Foam::operator-(const Foam::tmp<Foam::fvMatrix<Type> >&) [with Type = Foam::Tensor<double>]()’ from ‘Foam::tmp<Foam::fvMatrix<Foam::Tensor<double> > >’ to ‘Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > >’ PS: The reason I need to do this is because I need to carry out some operations on the grad(U) before calculating its final divergence. In other words, my nu cannot be taken out of the second derivative directly, so I cannot use laplacian(nut,U). |
|
|
|
|
|
|
|
|
#2 |
|
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 15 ![]() |
Hi!
First of all I think you should read about fvc and fvm. fvc is an explicit operator, while fmv is an implicit and based on your code I guess that you are not familiar with these. Instead of fvm::div(fvc::grad(<your stuff>)) you should use: fvc::div(fvc::grad(<your stuff>)) and treat this term explicitly. |
|
|
|
|
|
|
|
|
#3 | |
|
Senior Member
Santiago Lopez Castano
Join Date: Nov 2012
Posts: 354
Rep Power: 17 ![]() |
Quote:
|
||
|
|
|
||
|
|
|
#4 | |
|
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 15 ![]() |
Quote:
I guess this is not his "final" code since he wrote: "The reason I need to do this is because I need to carry out some operations on the grad(U) before calculating its final divergence."
|
||
|
|
|
||
|
|
|
#5 |
|
Senior Member
Santiago Lopez Castano
Join Date: Nov 2012
Posts: 354
Rep Power: 17 ![]() |
then first what you need to manipulate is the snGrad class, and then use surfaceIntegrate to obtain the divergenge of said snGrad
|
|
|
|
|
|
![]() |
| Tags |
| fvm::div, fvm::laplacian, fvmatrix |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SU2-7.0.1 on ubuntu 18.04 | hyunko | SU2 Installation | 7 | March 16, 2020 05:37 |
| natural convection problem for a CHT problem | Se-Hee | CFX | 2 | June 10, 2007 07:29 |
| Adiabatic and Rotating wall (Convection problem) | ParodDav | CFX | 5 | April 29, 2007 20:13 |
| Periodic flow boundary condition problem | sudha | FLUENT | 3 | April 28, 2004 09:40 |
| extremely simple problem... can you solve it properly? | Mikhail | Main CFD Forum | 40 | September 9, 1999 10:11 |