|
[Sponsors] |
setExprFields example to generate an initial velocity field for LES of channel flow |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 20, 2020, 23:34 |
setExprFields example to generate an initial velocity field for LES of channel flow
|
#1 |
Senior Member
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 19 |
As you know, perturbU utility [1] can be used
to generate an initial velocity field for large eddy simulation of channel flow. This utility is not included in the official release version but we can substitute setExprFields utility [2] for it. The settings of setExprFields utility are specified in system/setExprFieldsDict file. The following code is an implementation of perturbU by setExprFields utility for the tutorial incompressible/pimpleFoam/LES/channel395. You can play around with the tutorial by changing its mesh resolution. Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v2006 | | \\ / A nd | Website: www.openfoam.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object setExprFieldsDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // expressions ( U { field U; dimensions [0 1 -1 0 0 0 0]; // constants // { // } variables ( "Retau = 395" "Ubar = 0.1335" "nu = 2e-05" "h = 1" "utau = Retau*nu/h" "y = (pos().y() <= h) ? pos().y() : 2.0*h - pos().y()" "yPlus = y*Retau/h" "xPlus = pos().x()*Retau/h" "zPlus = pos().z()*Retau/h" "duPlus = Ubar*0.25/utau" "betaPlus = 2.0*pi()/200.0" "sigma = 0.00055" "alphaPlus = 2.0*pi()/500.0" "epsilon = Ubar/200.0" "deviation = pos().x()/pos().x() + 0.4*(rand() - 0.5)" ); condition #{ (pos().x() > -10) #}; expression #{ vector ( 1.5*Ubar*pos().y()*(2.0*h - pos().y()) + (utau*duPlus/2.0)*(yPlus/40.0)*exp(-sigma*sqr(yPlus) + 0.5)*cos(betaPlus*zPlus)*deviation, 0.0, epsilon*sin(alphaPlus*xPlus)*yPlus*exp(-sigma*sqr(yPlus))*deviation ) #}; } ); // ************************************************************************* // https://twitter.com/ennovacfd/status...96828440895488 [1] https://github.com/wyldckat/perturbU [2] https://www.openfoam.com/documentati...xprFields.html Hope this helps, Fumiya
__________________
[Personal]
|
|
September 22, 2020, 02:16 |
An additional note
|
#2 |
Senior Member
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 19 |
The setExprFields utility in OpenFOAM v2006 does not work if the entry "condition" is empty as shown below:
Code:
condition #{ #};
__________________
[Personal]
|
|
April 1, 2021, 03:46 |
|
#3 | |
Member
ESI
Join Date: Sep 2017
Posts: 46
Rep Power: 8 |
Quote:
thank you |
||
April 1, 2021, 03:48 |
|
#4 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,695
Rep Power: 40 |
||
April 1, 2021, 06:01 |
|
#5 | |
Member
ESI
Join Date: Sep 2017
Posts: 46
Rep Power: 8 |
Quote:
I have run both the case. case 1 that is a tutorial available in Openfoam chanel395 and another case (case 2) I run with create fluctuation velocity with this code. But I get the result different about velocity mean and R11. Could you tell me how to run with the code more correct result? case2: Run with code to create fluctuation. velocity mean magnitu UPrime2Mean_XX (R11) Case 1: chanel395 velocity mean magnitude UPrime2Mean_XX (R11) |
||
April 14, 2021, 03:38 |
|
#6 | |
Member
ESI
Join Date: Sep 2017
Posts: 46
Rep Power: 8 |
Quote:
|
||
January 20, 2022, 20:30 |
|
#7 | |
Senior Member
|
Quote:
If you do not need a condition, then condition block should be commented out, otherwise, it gives a syntax error. The following does not work Code:
condition #{ //(pos().y() > -10) && (pos().z() > -10) #}; Code:
// condition // #{ // (pos().y() > -10) && (pos().z() > -10) // #}; |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
laplacianFoam with source term | Herwig | OpenFOAM Running, Solving & CFD | 17 | November 19, 2019 13:47 |
Segmentation fault when using reactingFOAM for Fluids | Tommy Floessner | OpenFOAM Running, Solving & CFD | 4 | April 22, 2018 12:30 |
chtMultiRegionSimpleFoam turbulent case | Aditya Patil | OpenFOAM Running, Solving & CFD | 6 | April 24, 2017 22:13 |
Floating point exception error | lpz_michele | OpenFOAM Running, Solving & CFD | 53 | October 19, 2015 02:50 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 06:20 |