# customRegExp Problem

 Register Blogs Members List Search Today's Posts Mark Forums Read

 May 18, 2017, 03:29 customRegExp Problem #1 New Member   Ajeje Brazov Join Date: Apr 2017 Posts: 14 Rep Power: 6 Hi, I am trying to plot runtime Cl and Cd coefficients with pyFoam. I know that I have to create a customRegExp file but I don't know exactly how to do it. My attempt is: forceCoeff { expr "Cd : (%f%) pressure: (%f%) viscous: (%f%) "; name forceCoeff; theTitle "Force Coefficients over simulation time"; titles ( "Drag coeffcient" ); type regular; grid on; autoscale; } and my log file is like this: Time = 2 DILUPBiCG: Solving for Ux, Initial residual = 0.002869770138220821, Final residual = 0.0001357318528722006, No Iterations 1 DILUPBiCG: Solving for Uz, Initial residual = 0.003088079211852372, Final residual = 0.0001757611794099855, No Iterations 1 DICPCG: Solving for p, Initial residual = 0.004518101709886009, Final residual = 4.425545073399058e-05, No Iterations 257 DICPCG: Solving for p, Initial residual = 6.484914641014207e-05, Final residual = 9.938644410614112e-07, No Iterations 220 time step continuity errors : sum local = 1.826300588277174e-07, global = 4.836550994773706e-10, cumulative = 1.448013136733958e-08 DILUPBiCG: Solving for omega, Initial residual = 0.2379849598823938, Final residual = 0.002890402057918726, No Iterations 1 DILUPBiCG: Solving for kl, Initial residual = 0.02000845435751553, Final residual = 0.0003626628549138197, No Iterations 2 bounding kl, min: -6.263186930189056e-12 max: 0.04597626869321963 average: 0.0005251168972862916 DILUPBiCG: Solving for kt, Initial residual = 0.2069146957936084, Final residual = 0.007573494860198234, No Iterations 1 bounding kt, min: -0.0001182717858011264 max: 0.005188559021131677 average: 0.001791225448621331 ExecutionTime = 3.2 s ClockTime = 3 s forceCoeffs forcesCoeff execute: Coefficients Cm : 16.19597892918553 (pressure: 16.18687635895121 viscous: 0.009102570234321211) Cd : 11.40483349113927 (pressure: 10.83725883229526 viscous: 0.5675746588440076) Cl : 30.13976085852525 (pressure: 30.27620377857635 viscous: -0.1364429200511035) Cl(f) : 31.26585935844816 Cl(r) : -1.126098499922907 forces Forces write: Sum of forces Total : (15598.51043114574 -2.692622858846829e-17 155547.3987531071) Pressure : (12767.67376730014 -1.127114060582343e-16 155474.1214542766) Viscous : (2830.836663845591 8.578517746976596e-17 73.27729883055481) Sum of moments Total : (-77773.69937655356 -78567.80939347015 7799.255215572868) Pressure : (-77737.06072713828 -78523.65219826213 6383.836883650072) Viscous : (-36.63864941527739 -44.15719520800762 1415.418331922795) Does anybody know where is my error? Thank you

 May 18, 2017, 03:31 #2 Senior Member     Kevin van As Join Date: Sep 2014 Location: TU Delft, The Netherlands Posts: 253 Rep Power: 17 You should compare your expression character-by-character with your Cd-line in your log file. You'll readily notice that you miss brackets: "(" before "pressure" and ")" after the viscous number.

May 18, 2017, 03:41
#3
New Member

Ajeje Brazov
Join Date: Apr 2017
Posts: 14
Rep Power: 6
Quote:
 Originally Posted by floquation You should compare your expression character-by-character with your Cd-line in your log file. You'll readily notice that you miss brackets: "(" before "pressure" and ")" after the viscous number.
I read in this post (https://www.cfd-online.com/Forums/op...tomregexp.html) that brackets cause errors. By the way, I tried also with brackets and it still doesn't work.

 May 18, 2017, 03:49 #4 Senior Member     Kevin van As Join Date: Sep 2014 Location: TU Delft, The Netherlands Posts: 253 Rep Power: 17 Brackets are not really a problem, as long as you deal with them as you're supposed to deal with them in regular expression. This was also described in the next post in your link. If you want a bracket "(", you should write "\(". Othewise "(" is interpreted as the start of a group; but you really mean a bracket, hence you need the "\" escape character.

 May 18, 2017, 04:00 #5 New Member   Ajeje Brazov Join Date: Apr 2017 Posts: 14 Rep Power: 6 I used \ as you suggested but it still doesn't work. My expr now is: expr "Cd : (%f%) \(pressure: (%f%) viscous: (%f%)\)"

 May 18, 2017, 04:12 #6 New Member   Ajeje Brazov Join Date: Apr 2017 Posts: 14 Rep Power: 6 I found the error. I added binData { nBin 90; // output data into 20 bins direction (1 0 0); // bin direction format gnuplot; cumulative yes; } in my object function and now it works. Thank you for your help floquation.

 May 18, 2017, 04:32 #7 New Member   Ajeje Brazov Join Date: Apr 2017 Posts: 14 Rep Power: 6 I have one more question. Is it possible to change the range of my Cd and Cl plots? I used the option autoscale, I don't know how to select a range.

 September 26, 2018, 23:22 #8 Senior Member   Elham Join Date: Oct 2009 Posts: 184 Rep Power: 13 Hi, It seems strange but I cannot see customRegexp file in my case directory when I execute the following: Code: `pyFoamRunner.py --progress --proc=11 interMixingFoam` or Code: `pyFoamRunner.py mpirun -np 11 interMixingFoam -parallel >log.pyFoamRunner` I use OpenFOAM2.3.1. Cheers, Elham

 Tags drag coefficient, lift coefficient, pyfoam customregexp