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

How fvOptions guess the dimension of the equation ?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Voulet

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 6, 2021, 23:55
Question How fvOptions guess the dimension of the equation ?
  #1
Member
 
Join Date: Jun 2019
Posts: 41
Rep Power: 6
Voulet is on a distinguished road
Hello dear Foamers.

I'm still new to CFD and I hope this questions is not too stupid.

Considering this laplacian toy solver :

Code:
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | www.openfoam.com
     \\/     M anipulation  |
-------------------------------------------------------------------------------
    Copyright (C) 2011-2017 OpenFOAM Foundation
    Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
\*---------------------------------------------------------------------------*/

#include "fvCFD.H"
#include "fvOptions.H"
#include "simpleControl.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{

    #include "postProcess.H"
    #include "addCheckCaseOptions.H"
    #include "setRootCaseLists.H"
    #include "createTime.H"
    #include "createMesh.H"

    simpleControl simple(mesh);

    #include "createFields.H"

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    while (simple.loop())
    {
        Info<< "Time = " << runTime.timeName() << nl << endl;

        while (simple.correctNonOrthogonal())
        {
            fvScalarMatrix TEqn
            (
                fvm::laplacian(k, T) == fvOptions(T)
            );

            fvOptions.constrain(TEqn);
            TEqn.solve();
            fvOptions.correct(T);

        }

        #include "write.H"

        runTime.printExecutionTime(Info);
    }
    return 0;
}
// ************************************************************************* //
with k a dimensionedScalar defined in a dictionnary as :
Code:
k              k [0 2 0 0 0 0 0] 1e3;
I get (with not yet any fvOptions file in system):
Code:
incompatible dimensions for operation 
    [T[0 0 0 1 0 0 0] ] == [T[0 0 -1 1 0 0 0] ]
I agree that in our physical world the thermal diffusion k dimension should be [0 2 -1 0 0 0 0] but why does OpenFaom doesn't allow me to do some strange things ?


TEqn is an equation of T [0 0 0 1 0 0 0].
Laplacian of T should be [0 -2 0 1 0 0 0]
and then fvm::laplacian(k, T) should be [0 0 0 1 0 0 0] with my k being [0 2 0 0 0 0 0].
Thus I would have [0 0 0 1 0 0 0] to he left hand side and I was hopping fvOptions(T) to be [0 0 0 1 0 0 0] on the right hand side but its dimensions are [0 0 -1 1 0 0 0]

Thus my question is : how does the fvOptions dimensions are chosen ? Is it always the dimension of the solved field divided by dimTime ?

Thanks for having reading me and have a nice week.






ApoorvGiriya likes this.
__________________
« Debugging is what CFD is about. 5 minutes to modify your code, 5 months to find why it does not work anymore. »
Voulet is offline   Reply With Quote

Old   January 24, 2022, 01:22
Default
  #2
Member
 
Join Date: Jun 2019
Posts: 41
Rep Power: 6
Voulet is on a distinguished road
Up. Anyone could give any advice ?
__________________
« Debugging is what CFD is about. 5 minutes to modify your code, 5 months to find why it does not work anymore. »
Voulet is offline   Reply With Quote

Old   January 24, 2022, 04:11
Default
  #3
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 736
Blog Entries: 1
Rep Power: 17
dlahaye is on a distinguished road
The constant k could either be the thermal conductivity (units W/(mK)) see https://en.wikipedia.org/wiki/Thermal_conductivity

or the thermal diffusivity (units m^2/s) see https://en.wikipedia.org/wiki/Thermal_diffusivity

fvOptions operates on T and retrieves physical units from T.
dlahaye is offline   Reply With Quote

Reply

Tags
dimensional error, fvoptions


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
Q-criterion in Tecplot360 john filippou Main CFD Forum 11 December 14, 2021 06:45
How can temperature e treated as a passive scalar be used in transport equation? granzer OpenFOAM Running, Solving & CFD 3 June 6, 2021 16:35
Derivation of the Temperature Equation Tobi OpenFOAM Programming & Development 21 April 10, 2018 22:15
Problem with Velocity Poisson Equation and Vector Potential Poisson Equation mykkujinu2201 Main CFD Forum 1 August 12, 2017 13:15
error message cuteapathy CFX 14 March 20, 2012 06:45


All times are GMT -4. The time now is 20:14.