CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[OpenFOAM] Take derivative of mean velocity in paraFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Bernhard

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 30, 2014, 02:28
Default Take derivative of mean velocity in paraFoam
  #1
Senior Member
 
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13
hiuluom is on a distinguished road
I run LES simulation with pisoFoam and it's finish. And now, I would like to calculate derivative of mean velocity in parafoam also paraview.
\frac{\partial^2 \langle u_i\rangle}{\partial x_j^2}
\frac{\partial \langle u_i\rangle}{\partial x_j}
<u> it means umean.
I computed umean by fieldAverage in OpenFOAM and now I want to compute derivative above.

Anyone can help me how to get it in parafoam?

Thanks your help.
hiuluom is offline   Reply With Quote

Old   January 30, 2014, 04:30
Default
  #2
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22
Bernhard is on a distinguished road
Why not using the FOAM framework for this with utilities foamCalc and foamCalcEx?
Bernhard is offline   Reply With Quote

Old   January 30, 2014, 05:04
Default
  #3
Senior Member
 
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13
hiuluom is on a distinguished road
Quote:
Originally Posted by Bernhard View Post
Why not using the FOAM framework for this with utilities foamCalc and foamCalcEx?
Hi Bernhard,

I see in command foamCalc has div function.But \frac{\partial^2 \langle u_i\rangle}{\partial x_j^2} is the laplacian, which is div(grad(umean)).
and about first derivative of umean?

I use OpenFOAm 2.1.1, I don't see foamCalcEx as you said. Could you show me clearly?

Thank you,
Thanh
hiuluom is offline   Reply With Quote

Old   January 30, 2014, 05:43
Default
  #4
Senior Member
 
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13
hiuluom is on a distinguished road
Hi Bernhard,

I saw your code extended of foamCalcEx on google. Thank you so much your code.

Best regards,
Thanh.
hiuluom is offline   Reply With Quote

Old   January 30, 2014, 12:07
Default
  #5
Senior Member
 
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13
hiuluom is on a distinguished road
When I used command foamCalc or foamCalcEx to calculate div(U) and grad(U) but I meet error. Can anyone check help me?
Code:
Selecting calcType div
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 2.1.1-221db2718bbb
Exec   : foamCalc div U
Date   : Jan 30 2014
Time   : 23:03:37
Host   : "compeng"
PID    : 7276
Case   : /home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Time = 0
    Reading U
    Calculating divU
--> FOAM Warning : 
--> FOAM FATAL IO ERROR: 
keyword div(U) is undefined in dictionary "/home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes"

file: /home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes from line 36 to line 45.

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 400.

Time = 0.01
    Reading U
    Calculating divU
--> FOAM Warning : 
--> FOAM FATAL IO ERROR: 
keyword div(U) is undefined in dictionary "/home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes"

file: /home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes from line 36 to line 45.

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 400.

Time = 0.02
    Reading U
    Calculating divU
--> FOAM Warning : 
--> FOAM FATAL IO ERROR: 
keyword div(U) is undefined in dictionary "/home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes"

file: /home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes from line 36 to line 45.

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 400.

Time = 0.03
    Reading U
    Calculating divU
--> FOAM Warning : 
--> FOAM FATAL IO ERROR: 
keyword div(U) is undefined in dictionary "/home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes"

file: /home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes from line 36 to line 45.

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 400.

Time = 0.04
    Reading U
    Calculating divU
--> FOAM Warning : 
--> FOAM FATAL IO ERROR: 
keyword div(U) is undefined in dictionary "/home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes"

file: /home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes from line 36 to line 45.

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 400.

Time = 0.05
    Reading U
    Calculating divU
--> FOAM Warning : 
--> FOAM FATAL IO ERROR: 
keyword div(U) is undefined in dictionary "/home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes"

file: /home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes from line 36 to line 45.

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 400.

Time = 0.06
    Reading U
    Calculating divU
--> FOAM Warning : 
--> FOAM FATAL IO ERROR: 
keyword div(U) is undefined in dictionary "/home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes"

file: /home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes from line 36 to line 45.

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 400.

Time = 0.07
    Reading U
    Calculating divU
--> FOAM Warning : 
--> FOAM FATAL IO ERROR: 
keyword div(U) is undefined in dictionary "/home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes"

file: /home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes from line 36 to line 45.

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 400.

Time = 0.08
    Reading U
    Calculating divU
--> FOAM Warning : 
--> FOAM FATAL IO ERROR: 
keyword div(U) is undefined in dictionary "/home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes"

file: /home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes from line 36 to line 45.

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 400.

Time = 0.09
    Reading U
    Calculating divU
--> FOAM Warning : 
--> FOAM FATAL IO ERROR: 
keyword div(U) is undefined in dictionary "/home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes"

file: /home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes from line 36 to line 45.

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 400.

Time = 0.1
    Reading U
    Calculating divU
--> FOAM Warning : 
--> FOAM FATAL IO ERROR: 
keyword div(U) is undefined in dictionary "/home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes"

file: /home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes from line 36 to line 45.

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 400.

Time = 0.10001
    Reading U
    Calculating divU
--> FOAM Warning : 
--> FOAM FATAL IO ERROR: 
keyword div(U) is undefined in dictionary "/home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes"

file: /home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes from line 36 to line 45.

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 400.

Time = 0.11
    Reading U
    Calculating divU
--> FOAM Warning : 
--> FOAM FATAL IO ERROR: 
keyword div(U) is undefined in dictionary "/home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes"

file: /home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes from line 36 to line 45.

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 400.

Time = 0.12
    Reading U
    Calculating divU
--> FOAM Warning : 
--> FOAM FATAL IO ERROR: 
keyword div(U) is undefined in dictionary "/home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes"

file: /home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes from line 36 to line 45.

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 400.

Time = 0.13
    Reading U
    Calculating divU
--> FOAM Warning : 
--> FOAM FATAL IO ERROR: 
keyword div(U) is undefined in dictionary "/home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes"

file: /home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily/system/fvSchemes::divSchemes from line 36 to line 45.

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 400.

End
hiuluom is offline   Reply With Quote

Old   February 1, 2014, 09:48
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

To answer the original question: there is a filter named "Compute Derivatives", but it doesn't seem to be able to calculate the laplacian.
edit: In the Python Calculator, it does seem possible to use the "laplacian" function: http://www.paraview.org/Wiki/ParaVie...hon_Calculator


As for the latest post: the "div(U)" entry is missing from the file "system/fvSchemes". You can find several examples for such an entry by running this command:
Code:
find $FOAM_TUTORIALS -name "fvSchemes" | xargs grep "div(U)"
If you have a look into the file "compressible/rhoPimpleFoam/ras/cavity/system/fvSchemes" on the tutorials folder, you'll see this block of code:
Code:
divSchemes
{
    default none;
    div(phi,U) Gauss limitedLinearV 1;
    div(phid,p) Gauss limitedLinear 1;
    div(phi,K) Gauss linear;
    div(phi,h) Gauss limitedLinear 1;
    div(phi,k) Gauss limitedLinear 1;
    div(phi,epsilon) Gauss limitedLinear 1;
    div(phi,R) Gauss limitedLinear 1;
    div(phi,omega) Gauss limitedLinear 1;
    div((rho*R)) Gauss linear;
    div(R) Gauss linear;
    div(U) Gauss linear;
    div((muEff*dev2(T(grad(U))))) Gauss linear;
}
If you look carefully, you'll see the line that starts with "div(U)". You need to add that line to the file "system/fvSchemes" in your case, inside the same block "divSchemes".

Best regards,
Bruno
__________________

Last edited by wyldckat; February 1, 2014 at 17:55. Reason: see "edit:"
wyldckat is offline   Reply With Quote

Old   February 2, 2014, 12:42
Default
  #7
Senior Member
 
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13
hiuluom is on a distinguished road
Hi Bruno,

I thank you so much about this guide, I can calculate div(U) but grad(U) can not compute. In fvscheme has defined grad(U):
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.x                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

ddtSchemes
{
    default backward;
}

d2dt2Schemes
{
}

gradSchemes
{
    default         Gauss linear;

    grad(nuTilda)   cellLimited Gauss linear 1;
    grad(U)         cellLimited Gauss linear 1;
}

divSchemes
{
    default         none;

    div(phi,U)      Gauss LUST unlimitedGrad(U);
    //div(phi,U)      Gauss linearUpwind unlimitedGrad(U);
    //div(phi,k)      Gauss limitedLinear 1;
    //div(phi,k)      Gauss upwind;
    div(phi,k)       Gauss SFCD;
    div(phi,nuTilda) Gauss limitedLinear 1;
	div(U)          Gauss linear;
    div((nuEff*dev(T(grad(U))))) Gauss linear;
}

laplacianSchemes
{
    default         Gauss linear limited 0.33;
}

interpolationSchemes
{
    default         linear;
}

snGradSchemes
{
    default         limited 0.33;
}

fluxRequired
{
    default         no;
    p;
}

// ************************************************************************* //
And this is error.
Code:
Selecting calcType grad
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 2.1.1-221db2718bbb
Exec   : foamCalcEx grad U
Date   : Feb 02 2014
Time   : 23:33:44
Host   : "compeng"
PID    : 2674
Case   : /home/huynh/OpenFOAM/huynh-2.1.1/run/pitzDaily
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Time = 0


--> FOAM FATAL ERROR: 
Unable to process U
No call to grad for fields of type volVectorField
I really want to calculate \frac{\partial \langle u_i\rangle}{\partial x_j}= grad(UMean) and \frac{\partial^2 \langle u_i\rangle}{\partial x_j^2} =laplacian(UMean) = div(grad(UMean)). I only have computed div(UMean) up to now. Could you show me my error?
hiuluom is offline   Reply With Quote

Old   February 2, 2014, 14:22
Default
  #8
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Huynh,

foamCalcEx is missing the ability to handle "grad(U)" and "div(gradU)".
I've finished doing a bug report and respective patch for this here: http://code.google.com/p/foamcalcex/issues/detail?id=2

Download the patch file "changes.patch" from that bug report and place the file inside the folder "foamCalcEx". Then run:
Code:
patch -p1 < changes.patch
./Allwmake
Now go into your case folder and run:
Code:
foamCalcEx grad U
foamCalcEx div gradU
It will likely complain about the missing "div(gradU)", but I think you now know what to do


WARNING: I have not checked if the results given are correct. I simply did what seemed logical in the source code... and the results seemed sane enough.

Best regards,
Bruno
__________________

Last edited by wyldckat; February 3, 2014 at 06:12. Reason: "I simply did you seemed logical" -> "I simply did what seemed logical"
wyldckat is offline   Reply With Quote

Old   February 3, 2014, 02:03
Default
  #9
Senior Member
 
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13
hiuluom is on a distinguished road
Hi Bruno,

It worked very good. I thank you so much.

Best regards,
Thanh.
hiuluom is offline   Reply With Quote

Old   February 3, 2014, 04:54
Default
  #10
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22
Bernhard is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
WARNING: I have not checked if the results given are correct. I simply did you seemed logical in the source code... and the results seemed sane enough.
That's why we didn't include it in the utility up till now, following the Gschaider-philosophy to implement what you need. Anton is working on including your patch.

Thanh, can you let us know your experience with using this patch?
Bernhard is offline   Reply With Quote

Old   February 3, 2014, 05:54
Default
  #11
Senior Member
 
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13
hiuluom is on a distinguished road
Quote:
Originally Posted by Bernhard View Post
Thanh, can you let us know your experience with using this patch?
Actually I am proving the variance of pressure equation:
\begin{split}
\frac{1}{2\rho}\frac{\partial\langle p'^2\rangle}{\partial x_i} &=\nu\langle p\frac{\partial^2 u_i}{x_j^2}\rangle -\nu\langle p\rangle\frac{\partial^2\langle u_i\rangle}{\partial x_j^2} \\
& \quad -\langle pu_j\frac{\partial u_i}{\partial x_j}\rangle + \langle p\rangle\langle u_j\rangle\frac{\partial\langle u_i\rangle}{\partial x_j} + \langle p\rangle\frac{\partial\langle u'_iu'_j\rangle}{\partial x_j}\\
& \quad-\langle p\frac{\partial u_i}{\partial t}\rangle
\end{split}
I have average of all these terms above by edit pisoFoam. I only prove left hand side equal to the right hand side of equation by using paraFoam, but gradient and laplacian of mean velocity does not have. So I must calculate it and using parafoam insert equation above.

About the patch of Bruno, I only did following the guide of him. I added command div(U) and div(grad(U)) in fvscheme.

Best regards,
Thanh.
hiuluom is offline   Reply With Quote

Old   February 3, 2014, 06:04
Default
  #12
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22
Bernhard is on a distinguished road
foamCalcEx was mainly designed for quick and dirty calculation of single operations. If you want to do whole expressions like this, I would recommend funkyDoCalc.
wyldckat likes this.
Bernhard is offline   Reply With Quote

Old   February 4, 2014, 06:46
Default
  #13
Senior Member
 
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13
hiuluom is on a distinguished road
Quote:
Originally Posted by Bernhard View Post
foamCalcEx was mainly designed for quick and dirty calculation of single operations. If you want to do whole expressions like this, I would recommend funkyDoCalc.
Thanks Bermhard. I will try funkyDoCalc.
hiuluom is offline   Reply With Quote

Old   April 26, 2016, 07:44
Default "grad(phi) undefined" error
  #14
New Member
 
Join Date: Jul 2015
Posts: 5
Rep Power: 11
FlorisvdBeek is on a distinguished road
Hi guys!

[EDIT]: Pffff my bad, lack of reading the error message properly.. It was referring to the multiRegion fvScheme file (in system/FluidRegion1), not the original file (system/fvScheme) which I had not defined at all yet. So, problem solved!

I am quite new to OpenFOAM (so I hope this is a piece of cake for you guys ) and Im modifying the electrostaticsFoam into a multiRegion solver, but Im running into a similar problem as reported. Im trying to calculate the electric field (just as they do in the original electrostaticsFoam) during createField initialization. Compiling goes well, but when I run a case I get the following error:

Code:
$ electrostaticMultiRegionFoam 

/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  3.0.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 3.0.1-119cac7e8750
Exec   : electrostaticMultiRegionFoam
Date   : Apr 26 2016
Time   : 12:29:04
Host   : "floris-SATELLITE-L850-184"
PID    : 5875
Case   : /home/floris/OpenFOAM/floris-3.0.1/run/dischargeCase/electrostaticFoam/02_opposingConductorsMultiRegion
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create fluid mesh for region Fluid1 for time = 0

Create solid mesh for region Solid1 for time = 0

Reading physicalProperties

*** Reading fluid mesh thermophysical properties for region Fluid1

    Adding to rho

    Adding to phi

    Calculating field magE



--> FOAM FATAL IO ERROR: 
keyword grad(phi) is undefined in dictionary "/home/floris/OpenFOAM/floris-3.0.1/run/dischargeCase/electrostaticFoam/02_opposingConductorsMultiRegion/system/Fluid1/fvSchemes.gradSchemes"

file: /home/floris/OpenFOAM/floris-3.0.1/run/dischargeCase/electrostaticFoam/02_opposingConductorsMultiRegion/system/Fluid1/fvSchemes.gradSchemes

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 442.

FOAM exiting
I am calculating the electric field magnitude magE in "createField.H" accordingly:

Code:
// Initialise fluid field pointer lists


PtrList<volScalarField> rhoFluid(fluidRegions.size());
PtrList<volScalarField> phiFluid(fluidRegions.size());
PtrList<surfaceScalarField> rhoFluxFluid(fluidRegions.size());
PtrList<volScalarField> magEFluid(fluidRegions.size());
PtrList<volVectorField> EFluid(fluidRegions.size());
PtrList<dimensionedScalar> kFluid(fluidRegions.size());
PtrList<dimensionedScalar> epsilon0Fluid(fluidRegions.size());


// Populate fluid field pointer lists
forAll(fluidRegions, i)
{
        Info<< "Reading physicalProperties\n" << endl;

    IOdictionary physicalProperties
    (
        IOobject
        (
            "physicalProperties",
            runTime.constant(),
            fluidRegions[i],
            IOobject::MUST_READ_IF_MODIFIED,
            IOobject::NO_WRITE
        )
    );
    
        dimensionedScalar epsilon0
    (
        physicalProperties.lookup("epsilon0")
    );

    dimensionedScalar k
    (
        physicalProperties.lookup("k")
    );
    
    Info<< "*** Reading fluid mesh thermophysical properties for region "
        << fluidRegions[i].name() << nl << endl;
        
    Info<< "    Adding to rho\n" << endl;
        rhoFluid.set
        (
            i,
            new volScalarField
            (
                IOobject
                (
                    "rho",
                    runTime.timeName(),
                    fluidRegions[i],
                    IOobject::MUST_READ,
                    IOobject::AUTO_WRITE
                ),
                fluidRegions[i]
            )
        );
    
    Info<< "    Adding to phi\n" << endl;
        phiFluid.set
        (
            i,
            new volScalarField
            (
                IOobject
                (
                    "phi",
                    runTime.timeName(),
                    fluidRegions[i],
                    IOobject::MUST_READ,
                    IOobject::AUTO_WRITE
                ),
                fluidRegions[i]
            )
        );
    
    
    Info<< "    Calculating field magE\n" << endl;
        magEFluid.set
        (
            i,
            new volScalarField
            (
                IOobject
                (
                    "magE",
                    runTime.timeName(),
                    fluidRegions[i],
                    IOobject::NO_READ,
                    IOobject::AUTO_WRITE
                ),
                mag(fvc::grad(phiFluid[i]))
            )
        );
    
    Info<< "    Calculating field E\n" << endl;
        EFluid.set
        (
            i,
            new volVectorField
            (
                IOobject
                (
                    "E",
                    runTime.timeName(),
                    fluidRegions[i],
                    IOobject::NO_READ,
                    IOobject::AUTO_WRITE
                ),
                -fvc::grad(phiFluid[i])
            )
        );
    
    Info<< "    Calculating field rhoFlux\n" << endl;            
    rhoFluxFluid.set
        (
            i,
            new surfaceScalarField
            (
                IOobject
                (
                    "rhoFlux",
                    runTime.timeName(),
                    fluidRegions[i],
                    IOobject::NO_READ,
                    IOobject::NO_WRITE
                ),
         -k*fluidRegions[i].magSf()*fvc::snGrad(phiFluid[i])
            )
        );
}
I should have the grad operator defined properly in fvSchemes:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  3.0.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

ddtSchemes
{
    default         Euler;
}

gradSchemes
{
    default         leastSquares;
    grad(phi)       leastSquares;
    grad(phiFluid[i])       leastSquares;
    grad(phiFluid)       leastSquares;
}

divSchemes
{
    default         none;
    div(rhoFlux,rho) Gauss upwind;
}

laplacianSchemes
{
    default         none;
    laplacian(phi)  Gauss linear corrected;
}

interpolationSchemes
{
    default         linear;
}

snGradSchemes
{
    default         corrected;
    snGrad(phi)     corrected;
}


// ************************************************************************* //
I have tried playing around with the fvSchemes input, but haven't found a solution yet.

Anyone any idea what may go wrong here ?

Thanks,
Floris
FlorisvdBeek is offline   Reply With Quote

Reply


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
kindly help me .. i have and error at line number 147.. m zubair Fluent UDF and Scheme Programming 0 February 10, 2019 12:25
derivative definition of velocity IN CFX aja1345 CFX 9 April 22, 2016 07:21
VELOCITY vs VELOCITY IN STN FRAME vs RELATIVE VELOCITY everest20 FLUENT 1 July 13, 2015 09:35
WSS and normal velocity gradient for the slanted pipe wanna88 FLUENT 2 October 1, 2012 23:34
what the result is negatif pressure at inlet chong chee nan FLUENT 0 December 29, 2001 06:13


All times are GMT -4. The time now is 23:35.