CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

customRegExp Problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 18, 2017, 04:29
Question customRegExp Problem
  #1
New Member
 
Ajeje Brazov
Join Date: Apr 2017
Posts: 14
Rep Power: 9
Bernoulli666 is on a distinguished road
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
Bernoulli666 is offline   Reply With Quote

Old   May 18, 2017, 04:31
Default
  #2
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 21
floquation will become famous soon enough
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.
floquation is offline   Reply With Quote

Old   May 18, 2017, 04:41
Default
  #3
New Member
 
Ajeje Brazov
Join Date: Apr 2017
Posts: 14
Rep Power: 9
Bernoulli666 is on a distinguished road
Quote:
Originally Posted by floquation View Post
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.
Bernoulli666 is offline   Reply With Quote

Old   May 18, 2017, 04:49
Default
  #4
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 21
floquation will become famous soon enough
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.
floquation is offline   Reply With Quote

Old   May 18, 2017, 05:00
Default
  #5
New Member
 
Ajeje Brazov
Join Date: Apr 2017
Posts: 14
Rep Power: 9
Bernoulli666 is on a distinguished road
I used \ as you suggested but it still doesn't work. My expr now is:

expr "Cd : (%f%) \(pressure: (%f%) viscous: (%f%)\)"
Bernoulli666 is offline   Reply With Quote

Old   May 18, 2017, 05:12
Default
  #6
New Member
 
Ajeje Brazov
Join Date: Apr 2017
Posts: 14
Rep Power: 9
Bernoulli666 is on a distinguished road
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.
Bernoulli666 is offline   Reply With Quote

Old   May 18, 2017, 05:32
Default
  #7
New Member
 
Ajeje Brazov
Join Date: Apr 2017
Posts: 14
Rep Power: 9
Bernoulli666 is on a distinguished road
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.
Bernoulli666 is offline   Reply With Quote

Old   September 27, 2018, 00:22
Default
  #8
Senior Member
 
Elham
Join Date: Oct 2009
Posts: 184
Rep Power: 17
Elham is on a distinguished road
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
Elham is offline   Reply With Quote

Reply

Tags
drag coefficient, lift coefficient, pyfoam customregexp


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
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 05:43
Gambit - meshing over airfoil wrapping (?) problem JFDC FLUENT 1 July 11, 2011 06:59
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 07:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 20:13
Is this problem well posed? Thomas P. Abraham Main CFD Forum 5 September 8, 1999 15:52


All times are GMT -4. The time now is 17:55.