CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Openfoam 11 fvc::ddt

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By GaspA

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 10, 2025, 05:51
Default Openfoam 11 fvc::ddt
  #1
New Member
 
GaspA
Join Date: Jan 2023
Location: Switzerland - Valais
Posts: 13
Rep Power: 4
GaspA is on a distinguished road
Hello,


I am trying to convert the code implementing the kOmegaSSTCC (curvature correction) model to Openfoam 11. The original code is intended for OF5.
Original code: https://github.com/ancolli/kOmegaSSTCC/tree/master
line 504 of kOmegaSSTCC/kOmegaSSTCC.C


Code:
// Compute rTilda 
    volScalarField D(sqrt(max(symInnerProduct, 0.09*omega_*omega_)));
    tmp<volSymmTensorField> divS =
    (
        fvc::ddt(tSymm())
       +fvc::div
        (
            alphaRhoPhi, tSymm()
        )
    );
The modification is going pretty well except that the fvc::ddt function doesn't seem to work.


The error obtained during compilation is:


Code:
 ../momentumTransportModels/lnInclude/kOmegaSSTCCBase.C:506:14: error: ‘ddt’ is not a member of ‘Foam::fvc’; did you mean ‘Foam::fvm::ddt’?
506 | fvc::ddt(tSymm())
The variable tSymm() = symm(fvc::grad(U)) and is of type tmp<volSymmTensorField>
What is surprising is that the function fvc::div works correctly (by compilation). Tested by commenting out the term fvc::ddt(tSymm())



Do you have an answer to this?


Many Thanks in advance.
GaspA is offline   Reply With Quote

Old   March 10, 2025, 12:19
Default
  #2
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 825
Rep Power: 16
Tobermory will become famous soon enough
I think I understand why the error occurs - from a cursory glance, there is no fvc::ddt( tmp<volField>), i.e. no ddt function that takes a tmp<volField> as a parameter. There is one that takes a volField, but not a tmp<volField> - check out https://cpp.openfoam.org/v11/fvcDdt_8H_source.html.

The fvc::div works because it has both - check out https://cpp.openfoam.org/v11/fvcDiv_8H_source.html.
Tobermory is offline   Reply With Quote

Old   March 10, 2025, 15:39
Default
  #3
New Member
 
GaspA
Join Date: Jan 2023
Location: Switzerland - Valais
Posts: 13
Rep Power: 4
GaspA is on a distinguished road
Hello Tobermory


Thank you very much for this answer.
This seems quite logical to me. I did not think to check if a tmp was accepted.

The code is here, line 504:
https://github.com/ancolli/kOmegaSST.../kOmegaSSTCC.C


And here is the problematic part:

Code:
 tmp<volTensorField> tgradU = fvc::grad(U);
    tmp<volTensorField> tSkew = skew(tgradU()); // tmp<volTensorField> tSkew = skew(fvc::grad(U)); 
    tmp<volSymmTensorField> tSymm = symm(tgradU());  // tmp<volSymmTensorField> tSymm = symm(fvc::grad(U));
    volScalarField S2(2*magSqr(tSymm()));         //volScalarField S2(2*magSqr(symm(tgradU())));
//
    volScalarField::Internal GbyNu(dev(twoSymm(tgradU()())) && tgradU()());
    volScalarField::Internal G(this->GName(), nut()*GbyNu);
    tgradU.clear();

///////////////// curvature correction

// Compute rStar
    volScalarField symInnerProduct(2.0*tSymm() && tSymm()); 
    volScalarField asymInnerProduct
    (
        max(2.0*tSkew() && tSkew(),
        dimensionedScalar("0", dimensionSet(0, 0, -2, 0, 0), 0.0))
    );
    volScalarField w
    (
        atan(dimensionedScalar("4",dimensionSet(0,0,2,0,0),1.0e-02)*asymInnerProduct)*2.0/(constant::mathematical::pi)*(asymInnerProduct-symInnerProduct)+symInnerProduct
    );
    volScalarField rStar(sqrt(symInnerProduct/max(w, dimensionedScalar("minw", w.dimensions(), SMALL)))); //avoiding dividing by zero    volScalarField rStar(sqrt(symInnerProduct/w));
     
    // Compute rTilda 
    volScalarField D(sqrt(max(symInnerProduct, 0.09*omega_*omega_)));
    tmp<volSymmTensorField> divS =
    (
        fvc::ddt(tSymm())
       +fvc::div
        (
            alphaRhoPhi, tSymm()
        )
    );
Do you have any idea how to get around this problem?
Can we simply declare tSymm() in volSymmTensorField and not in tmp<volSymmTensorField>?


Best regards
GaspA is offline   Reply With Quote

Old   March 11, 2025, 03:13
Default
  #4
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 825
Rep Power: 16
Tobermory will become famous soon enough
You could try replacing

Code:
fvc::ddt(tSymm())
with

Code:
0.5*fvc::ddt( fvc::grad(U) + fvc::grad(U).T() )
and see if that works.
Tobermory is offline   Reply With Quote

Old   March 11, 2025, 06:43
Default
  #5
New Member
 
GaspA
Join Date: Jan 2023
Location: Switzerland - Valais
Posts: 13
Rep Power: 4
GaspA is on a distinguished road
Hello Tobermory,

Thank you very much for this answer. Unfortunately it does not work. The error is identical.

After performing a search in the files invoked by this one, it appeared that the function fvc::ddt is never used!

This implies that this function is not known in this script, as surprising as it may seem.

Solution:
By adding #include "fvcDdt.H" in the header, everything works correctly with fvc::ddt(tSymm())

Thanks for your help.
Tobermory likes this.
GaspA is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Frequently Asked Questions about Installing OpenFOAM wyldckat OpenFOAM Installation 3 November 14, 2023 11:58
How to develop OpenFOAM with CMake and popular IDEs cosscholar OpenFOAM Programming & Development 0 March 16, 2022 15:17
OpenFOAM Training, London, Chicago, Munich, Sep-Oct 2015 cfd.direct OpenFOAM Announcements from Other Sources 2 August 31, 2015 13:36
Suggestion for a new sub-forum at OpenFOAM's Forum wyldckat Site Help, Feedback & Discussions 20 October 28, 2014 09:04
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 18:07


All times are GMT -4. The time now is 13:38.