|
[Sponsors] |
[OpenFOAM] Take derivative of mean velocity in paraFoam |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 30, 2014, 02:28 |
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 |
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.
<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. |
|
January 30, 2014, 04:30 |
|
#2 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22 |
Why not using the FOAM framework for this with utilities foamCalc and foamCalcEx?
|
|
January 30, 2014, 05:04 |
|
#3 | |
Senior Member
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13 |
Quote:
I see in command foamCalc has div function.But 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 |
||
January 30, 2014, 05:43 |
|
#4 |
Senior Member
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13 |
Hi Bernhard,
I saw your code extended of foamCalcEx on google. Thank you so much your code. Best regards, Thanh. |
|
January 30, 2014, 12:07 |
|
#5 |
Senior Member
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13 |
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 |
|
February 1, 2014, 09:48 |
|
#6 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
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)" 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; } Best regards, Bruno
__________________
Last edited by wyldckat; February 1, 2014 at 17:55. Reason: see "edit:" |
|
February 2, 2014, 12:42 |
|
#7 |
Senior Member
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13 |
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; } // ************************************************************************* // 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 |
|
February 2, 2014, 14:22 |
|
#8 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
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 Code:
foamCalcEx grad U foamCalcEx div gradU 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" |
|
February 3, 2014, 02:03 |
|
#9 |
Senior Member
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13 |
Hi Bruno,
It worked very good. I thank you so much. Best regards, Thanh. |
|
February 3, 2014, 04:54 |
|
#10 | |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22 |
Quote:
Thanh, can you let us know your experience with using this patch? |
||
February 3, 2014, 05:54 |
|
#11 | |
Senior Member
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13 |
Quote:
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. |
||
February 3, 2014, 06:04 |
|
#12 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22 |
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.
|
|
February 4, 2014, 06:46 |
|
#13 |
Senior Member
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13 |
||
April 26, 2016, 07:44 |
"grad(phi) undefined" error
|
#14 |
New Member
Join Date: Jul 2015
Posts: 5
Rep Power: 11 |
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 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]) ) ); } 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; } // ************************************************************************* // Anyone any idea what may go wrong here ? Thanks, Floris |
|
|
|
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 |