|
[Sponsors] |
I can't understand some terms in SpalartAllmaras (coding wise) |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
Member
Eren
Join Date: Aug 2018
Posts: 92
Rep Power: 9 ![]() |
Hi everyone!
I need to sum the production-destruction terms and form a new field in the SpalartAllmaras model, but I always get different errors. So, there are few things I can't understand. Such as: Code:
tmp<fvScalarMatrix> nuTildaEqn ( fvm::ddt(alpha, rho, nuTilda_) // transient + fvm::div(alphaRhoPhi, nuTilda_) // u*div(nuTilda) - fvm::laplacian(alpha*rho*DnuTildaEff(), nuTilda_) // (nu+nuTilda) term, DnuTilda=(nutilda+nu)/sigmanu - Cb2_/sigmaNut_*alpha*rho*magSqr(fvc::grad(nuTilda_)) // cb2 term == Cb1_*alpha()*rho()*Stilda*nuTilda_() // (1-ft2) abd cb1*ft2/k^2 term is not present - fvm::Sp(Cw1_*alpha()*rho()*fw(Stilda)*nuTilda_()/sqr(y_), nuTilda_) // cw1*fw*nuTilda^2/d^2 + fvOptions(alpha, rho, nuTilda_) ); Here rho and the nuTilda_ are volScalarFields, y_, Stilda, fw are volScalarField::Internal. In OF implementation, they can multiply these as you can see in the code, but when I create a new volScalarField it gives error because of these internalFields due to mismatch. such as: Code:
error: conversion from ‘Foam::tmp<Foam::Field<double> >’ to non-scalar type ‘Foam::volScalarField’ {aka ‘Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>’} requested 436 | volScalarField dif = Cw1_*rho*fw(Stilda)*sqr(nuTilda_)/sqr(y_); I know I'm missing something fundamental here, if anyone can point it I'll be glad. Best wishes, Eren. |
|
![]() |
![]() |
![]() |
![]() |
#2 | |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 825
Rep Power: 16 ![]() |
Quote:
Code:
//- Return a const-reference to the dimensioned internal field // Useful in the formulation of source-terms for FV equations inline const Internal& operator()() const; That explains the first part of your question, but does not fix your error. Have you tried defining dif1 as volScalarField::Internal? I can see that OF might struggle if the end result of your calculation, an volScalarField::Internal, is then assigned to a full volScalarField (what does it do for the boundary info, for example). |
||
![]() |
![]() |
![]() |
![]() |
#3 | ||
Member
Eren
Join Date: Aug 2018
Posts: 92
Rep Power: 9 ![]() |
Quote:
Quote:
looking at here: https://www.openfoam.com/documentati...pi/fvc_8H.html I can use fvc::Sup("terms"). Defining the terms internal definetely works in the turbulenceModel itself, but when I call them on my solver with turbulence->SourceTerm(), it causes another mismatch, because I need to use these terms like SolverTerm += turbulence->SourceTerm() in my solver. Where SolverTerm is defined in the createFields and it is a volScalarField. Since these are source terms, they should have no contribution to the boundary anyway. If I can add ::internalField to a volScalarField that would also work. |
|||
![]() |
![]() |
![]() |
![]() |
#4 | |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 825
Rep Power: 16 ![]() |
I don't think that the following is possible:
Quote:
|
||
![]() |
![]() |
![]() |
![]() |
#5 | |
Member
Eren
Join Date: Aug 2018
Posts: 92
Rep Power: 9 ![]() |
Quote:
Thing is I need to define these in turbulence model and use them in my solver. These terms will go into the B of the Ax=B, and since I need to substract diagonal (of the fields) from the B, it is already volScalarField and not internal. That is causing the main problem in here. Another question for you, when I define new field (or let's say I want to call DnuTildaEff() in the original solver for convinience) in the turbulence as public (<tmp>volScalarField) what is the best way to call it in the solver? I defined terms() field in TurbulenceModel.H because it is where thermo/transport fields are defined (nu, alpha) and they can be called in the solver. But when I use turbulence->Terms(); I'm getting: Code:
symbol lookup error: /depo/users/home/t33286/OpenFOAM/t33286-v2206/platforms/linux64GccDPInt32Opt/lib/libhisaModule.so: undefined symbol: _ZNK4Foam18ThermalDiffusivityINS_27CompressibleTurbulenceModelINS_11fluidThermoEEEE10SourceSinkEv And compressible library is already in the make file so I'm clueless right now. |
||
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Question in definition of terms in solve | titio | OpenFOAM Running, Solving & CFD | 0 | March 19, 2009 16:02 |
User coding on NT w2k | Philip Jones | Siemens | 0 | November 26, 2001 03:43 |
K-Epsilon model? | Brindaban Ghosh | Main CFD Forum | 2 | June 24, 2000 04:22 |