|
[Sponsors] |
April 23, 2014, 22:10 |
exp() function not working?
|
#1 |
Member
CHARLES
Join Date: May 2013
Posts: 46
Rep Power: 13 |
Hello,
For some reason I don't think that exp() is doing anything... can you please tell me what you think is wrong? I have the following code: Code:
argf2 = sqr(k_)/(6.0*nu()*epsilon_); f2 = 1-2/9*Foam::exp(-1.0*sqr(argf2)); However, when I bring up f2 in paraview it just shows up as 1 everywhere. If I define f2 in the following way: Code:
f2 = 99-2/9*Foam::exp(-1.0*sqr(argf2)); If I define f2 in the following way: Code:
f2 = -2/9*Foam::exp(-1.0*sqr(argf2)); I have also tried to not use "Foam::" before exp() and it doesn't make a difference. Additionally, when I look at the f2 that was output to the time directory it looks like this: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0.001"; object f2; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 0 0 0 0]; internalField uniform 1; boundaryField { plate { type calculated; value uniform 1; } back { type empty; } front { type empty; } inlet { type calculated; value uniform 1; } outlet { type calculated; value uniform 1; } top { type calculated; value uniform 1; } symmetry { type symmetryPlane; } } // ************************************************************************* // Thank you! |
|
April 24, 2014, 05:31 |
|
#2 |
Senior Member
|
Hi,
Code:
1-2/9*Foam::exp(-1.0*sqr(argf2)) |
|
April 24, 2014, 14:30 |
|
#3 |
Member
CHARLES
Join Date: May 2013
Posts: 46
Rep Power: 13 |
Thank you Alexey!
Adding the ".0" to each integer made a difference. Instead of f2 being set to 1 everywhere, it is being set to 0.777778 (i.e.: 1.0 - 2.0/9.0). OpenFOAM still doesn't recognize the Code:
Foam::exp(-1.0*sqr(argf2)) Code:
f2 = 1-2.0*Foam::exp(-1.0*sqr(argf2))/9.0; Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0.001"; object f2; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 0 0 0 0]; internalField uniform 1; boundaryField { plate { type calculated; value uniform 0.777778; } back { type empty; } front { type empty; } inlet { type calculated; value uniform 1; } outlet { type calculated; value uniform 1; } top { type calculated; value uniform 1; } symmetry { type symmetryPlane; } } // ************************************************************************* // Do you think it may have something to do with the way I have initialized f2 and argf2? Code:
argf2 ( IOobject ( "argf2", runTime_.timeName(), mesh_, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh_, dimensionedScalar("argf2", dimless, 0.0) ), f2 ( IOobject ( "f2", runTime_.timeName(), mesh_, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh_, dimensionedScalar("f2", dimless, 1.0) ) Code:
argf2= sqr(k_)/(6.0*nu()*epsilon_); f2 = 1-2.0/9.0*Foam::exp(-1.0*sqr(argf2)); |
|
April 24, 2014, 14:56 |
|
#4 |
Senior Member
|
Hi!
Well, as I don't know other values in your problem, I'll try to guess Code:
argf2= sqr(k_)/(6.0*nu()*epsilon_); f2 = 1-2.0/9.0*Foam::exp(-1.0*sqr(argf2)); |
|
April 29, 2014, 14:07 |
|
#5 |
Member
CHARLES
Join Date: May 2013
Posts: 46
Rep Power: 13 |
Alexey,
My values for the internal field in the 0 folder are the following: k=2.16e-3 epsilon=6.27e-4 nu=1.53e-5 which would make argf2=(2.16e-3)^2/(6*1.53e-5*6.27e-4)=81.06 (based on initial conditions) Based on your argument, I can tell that f2 should in fact approach 0.77778! exp(-1.0*sqr(argf2)) = 0 -> f2=1.0-2.0/9.0 Thank you. Now the next question is why does OpenFOAM not create the nonuniform list <scalar>? Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0.001"; object f2; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 0 0 0 0]; internalField uniform 1; boundaryField { plate { type calculated; value uniform 0.777778; } back { type empty; } front { type empty; } inlet { type calculated; value uniform 1; } outlet { type calculated; value uniform 1; } top { type calculated; value uniform 1; } symmetry { type symmetryPlane; } } // ************************************************************************* // |
|
April 29, 2014, 14:24 |
|
#6 | ||
Senior Member
|
Hi,
Quote:
Code:
f2 = 1.0 - 2.0/9.0*exp(-sqr(argf2)) Quote:
|
|||
April 29, 2014, 14:50 |
|
#7 |
Member
CHARLES
Join Date: May 2013
Posts: 46
Rep Power: 13 |
Ooops!
My apologies, I was thinking of the value of argf2 at a solid boundary, which yields argf2=0, leading to f2=1-2.0/9.0.*1. Thank you for your help Alexey! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[blockMesh] non-orthogonal faces and incorrect orientation? | nennbs | OpenFOAM Meshing & Mesh Conversion | 7 | April 17, 2013 06:42 |
Can anybody help me to solve the list errors while compiling Openfoam 15 on Opensuse 103 32bit | coompressor | OpenFOAM Installation | 0 | November 12, 2008 20:53 |
Could you please help me about the VTKFoam | liugx212 | OpenFOAM Pre-Processing | 5 | February 13, 2008 12:31 |
Droplet Evaporation | Christian | Main CFD Forum | 2 | February 27, 2007 07:27 |
[OpenFOAM] Could you please help me | liugx212 | ParaView | 4 | December 22, 2005 17:55 |