TXT-File Export with FlexPDE7n.exe

General discussions about how to formulate a script for FlexPDE.

TXT-File Export with FlexPDE7n.exe

Postby awFaber on Thu Apr 20, 2017 9:23 am

Hello guys,

I am conducting parameter studies with flexPDE. To streamline and automate the process, I call flexPDE 7 v7.04 from a Python script. The descriptor file down below gets modified via string manipulation, it is then fed to flexPDE and the resulting TXT-files are being collected and further analyzed by the Python logic.

However, I noticed that the non-graphical version, my preferred way of calling flexPDE, fails to produce the "SUMMARY EXPORT FILE" - TXT file when the problem is run. Is there any error on my side I am overlooking or is this a bug of the FLEXPDE7n.exe? I am currently using flexPDE 7.04 Full Professional (30 days Trial). On Version 6.40 (n), the TXT export worked flawlessly.

As a workaround/quick fix I am using the graphical version with the command line switches "-S" "-T4". This works only most of the time, the headless version is much preferred as seemingly random the flexPDE flexpde7.ini resets itself. In that case a Licence Accept/Deny dialog pops up and interrupts my automated usage of flexPDE. Furthermore, flexPDE then re-enables the "consolidate output" option unauthorized on its own, I already disabled the option manually multiple times. Setting the flexpde7.ini on read-mode-only inhibits flexPDE from working properly. As I am runnng the felxPDE Problem up to multiple thousand times I have to process the TXT-results in-place by the Python logic. Therefore the randomly activated "consolidate output" option nukes my automated script. Is there any way to stop this behaviour?

TL;DR: Is there any option to use the FLEXPDE7n.exe with the descriptor below and get the specified TXT output files without a Licence dialog popping up randomly?

Many thanks in advance for potential help!

Code: Select all
TITLE 'Random dispersed spheres distribution test'     { the problem identification }

COORDINATES cartesian2  { coordinate system, 1D,2D,3D, etc }

VARIABLES        { system variables }
Temp

SELECT

NGRID = 75

DEFINITIONS
k
kMatrix = 0.01
kInlay = 1
Q = 0             

xLen = 1.0         
yLen = 0.1         
tHi = 50
tLo = 10
delT = abs(tHi - tLo) 


{Modifikation Beginn}
stagenum = 3
number = 3
xOff = array(-0.499362343658,0.801816471002,0.589196652035)
yOff = array(0.0403622870593,-0.0344594557089,-0.0302667786849)
volFrac=0.05
run = 10
{Modifikation Ende}





meshArea = 4 * xLen * yLen                     
totInlayArea = meshArea * volFrac / number
inRad = sqrt(totInlayArea / 3.14152926)


EQUATIONS
k*div(-grad(Temp)) = Q

BOUNDARIES

REGION 1     'Matrixebene'
k = kMatrix
START(-xLen , -yLen)
VALUE(Temp) = tHi                 LINE TO (xLen , -yLen)
NATURAL(Temp) = 0                  LINE TO (xLen , yLen)
VALUE(Temp) = tLo                  LINE TO (-xLen , yLen)
NATURAL(Temp) = 0                  LINE TO CLOSE

REGION 2 'Kugelebene'
k = kInlay
repeat i = 1 by 1 to number
START(xOff[i] - inRad, yOff[i]) ARC(CENTER = xOff[i], yOff[i]) ANGLE = 360 TO CLOSE
endrepeat

FEATURE
START 'SurfKalt' ( -xLen , -yLen) LINE TO (xLen , -yLen)
START 'SurfWarm' (-xLen , yLen) LINE TO (xLen , yLen)

MONITORS

SUMMARY EXPORT FILE = "Sim_Info_" + $stagenum + "_avgrun=" + $run + ".txt"
REPORT(" ")
REPORT(" ")
REPORT("Report data")
REPORT('-----')
REPORT (LINE_INTEGRAL((normal(-k*grad(Temp))), 'SurfWarm') + LINE_INTEGRAL(normal(k*grad(Temp)), 'SurfKalt'))/2/delT*yLen/xLen as 'Mittlere Waermeleitfaehigkeit des Compound-Materials'
REPORT volFrac as 'Volume Fraction'
REPORT inRad as 'Inlay Radius'
REPORT number as '# Inlays/filler particles'

END

awFaber
 
Posts: 3
Joined: Sun Apr 16, 2017 1:37 pm

Re: TXT-File Export with FlexPDE7n.exe

Postby moderator on Thu Apr 20, 2017 12:36 pm

We will look into this. What OS are you running?
moderator
 
Posts: 686
Joined: Tue Jan 11, 2011 1:45 pm

Re: TXT-File Export with FlexPDE7n.exe

Postby awFaber on Thu Apr 20, 2017 1:43 pm

I am using a Windows 10 system.

I really like your product so far but encountered another unexpected behaviour. In my simulation runs (as described above), I randomly distribute spheres in a cuboid base mesh. The position data is generated by a Python script externally and then run with flexPDE. I do some statistical evaulation with the resulting data, but I had problems with some position data not being run/simulated with flexPDE randomly. This problem only occurs in maybe 10 to 15 of approx. 12000 simulation runs with differing sphere distributions in flexPDE. It seems that sometimes the mesh generation is sensible to the NGRID value. Crashing script:

Code: Select all
TITLE 'Random dispersed spheres distribution test'     { the problem identification }

COORDINATES cartesian2  { coordinate system, 1D,2D,3D, etc }

VARIABLES        { system variables }
Temp

SELECT

NGRID = 100   !Crashes with 100, but not with 101 or 99

DEFINITIONS
k
kMatrix = 0.01
kInlay = 1
Q = 0             

xLen = 1.0
yLen = 0.1
tHi = 50
tLo = 10
delT = abs(tHi - tLo)


{Modifikation Beginn}
stagenum = 7
number = 11
xOff = array(-0.46082523239,-0.220955057384,0.849612894687,0.351706571907,-0.84846261354,0.537128201088,0.131703067401,0.663488049349,-0.618867468533,-0.0565239326678,-0.336797341775)
yOff = array(0.0070427289739,0.028320953656,-0.0178591230337,-0.0068958166222,-0.0276488104398,0.0065735254396,-0.0182951924,-0.0174390360647,0.0192620623572,0.0209511601287,-0.0266391810126)
volFrac = 0.3
run = 36
{Modifikation Ende}



meshArea = 4 * xLen * yLen                     
totInlayArea = meshArea * volFrac / number
inRad = sqrt(totInlayArea / 3.14152926)



EQUATIONS
k*div(-grad(Temp)) = Q

BOUNDARIES

REGION 1     'Matrixebene'
k = kMatrix
START(-xLen , -yLen)
VALUE(Temp) = tHi                 LINE TO (xLen , -yLen)
NATURAL(Temp) = 0                  LINE TO (xLen , yLen)
VALUE(Temp) = tLo                  LINE TO (-xLen , yLen)
NATURAL(Temp) = 0                  LINE TO CLOSE

REGION 2 'Kugelebene'
k = kInlay
repeat i = 1 by 1 to number
START(xOff[i] - inRad, yOff[i]) ARC(CENTER = xOff[i], yOff[i]) ANGLE = 360 TO CLOSE
endrepeat

FEATURE
START 'SurfKalt' ( -xLen , -yLen) LINE TO (xLen , -yLen)
START 'SurfWarm' (-xLen , yLen) LINE TO (xLen , yLen)

MONITORS

SUMMARY EXPORT FILE = "Sim_Info_" + $stagenum + "_avgrun=" + $run + ".txt"
REPORT(" ")
REPORT(" ")
REPORT("Report data")
REPORT('-----')
REPORT (LINE_INTEGRAL((normal(-k*grad(Temp))), 'SurfWarm') + LINE_INTEGRAL(normal(k*grad(Temp)), 'SurfKalt'))/2/delT*yLen/xLen as 'Mittlere Waermeleitfaehigkeit des Compound-Materials'
REPORT volFrac as 'Volume Fraction'
REPORT inRad as 'Inlay Radius'
REPORT number as '# Inlays/filler particles'

END


Running this code does not work as the problem blows up during mesh genration. The resulting mesh is wierdly deformed for NGRID=100. Surprisingly, changing the NGRID value to 99 or 101 solves the problem and the software performs its duty flawlessly. I attached the debug file to this post for the crashing NGRID=100 (memory protection fault) and the working NGRID=101.
Attachments
Standard_Descriptor_debug_NGRID101.txt
Working debug log
(9.43 KB) Downloaded 47 times
Standard_Descriptor_debug_NGRID100.txt
Crashing debug log
(4.8 KB) Downloaded 51 times
awFaber
 
Posts: 3
Joined: Sun Apr 16, 2017 1:37 pm

Re: TXT-File Export with FlexPDE7n.exe

Postby moderator on Thu Apr 20, 2017 5:39 pm

The problem is that you have stated this SUMMARY as a MONITOR. Monitors are for viewing and are ignored in the non-graphical mode. (This is true for version 6 as well, so you must have run a different script when you saw that - I ran this script on v6.40n and it does not export the file either.)

You can solve this simply by putting the SUMMARY inside the PLOT section instead of the MONITOR section :
PLOTS
SUMMARY EXPORT ...

You could also use SELECT HARDMONITOR. This selector makes FlexPDE treat all monitors as plots. This could be undesirable if you have other monitors you do not want written to the .pg7 file.

We have not yet looked at your other issues but will try to do so soon.
moderator
 
Posts: 686
Joined: Tue Jan 11, 2011 1:45 pm

Re: TXT-File Export with FlexPDE7n.exe

Postby moderator on Thu Apr 20, 2017 6:18 pm

We have not been able to recreate the error you are having with the ini file resetting. But the behavior you report would be consistent with FlexPDE not being able to find/open the ini file. Both the consolidation of output and the display of the license agreement are the default settings for FlexPDE when there is no ini file (and is therefore creating it - "resetting").

Is it possible that your driver is running multiple FlexPDE instances so quickly that the first one still has the ini file open when the second tries to run? That would cause the second instance to fail to open it and create a new one.

Can you try putting in a small delay between FlexPDE finishing one run and starting the next? A 1 sec delay would be more than enough for machines these days. Possibly 100 msec. Just enough to ensure that the previous instance has closed before starting the next. This is just a guess based on the behavior you report.
moderator
 
Posts: 686
Joined: Tue Jan 11, 2011 1:45 pm

Re: TXT-File Export with FlexPDE7n.exe

Postby awFaber on Fri Apr 21, 2017 6:35 am

Thank you very much for your help so far.

Indeed the script calls flexPDE without any delay after closing whatsoever. It is even "more critical": To speed up the whole simulation process I distribute the simulation jobs among multiple Python processes via the Python "multiproccessing" module. The child processes are spawned by one master / main process and work on their separate chunk of the problem. They run their own -sometimes expensive- position generation code and then spawn their own instance of flexPDE. I had good results so far, but sometimes the INI reseted or gets rewritten because of the reasons you stated, as multiple flexPDE instances try to access it. So, the INI file gets accessed not only in quick succession but also asynchrously and randomly by the multiple flexPDE processes!

Today I ran a problem with 21300 different sphere configurations distributed among 5 processes with the same amount of independent restarts of flexPDE, and the INI problem did not occur. It is not that common but when it does, it nukes my wrapping script :)

I hope I can find a solution to the problem. Is it maybe possible to give every process its "own" INI via a command line parameter while calling the EXE?
Again thank you for your help!
awFaber
 
Posts: 3
Joined: Sun Apr 16, 2017 1:37 pm

Re: TXT-File Export with FlexPDE7n.exe

Postby moderator on Fri Apr 21, 2017 5:38 pm

There is no way to specify an ini file. However, we will look into the possibility of adding a command line switch that will let you set the consolidate option (we can't do it with a selector in the script because the files have already been created). That would allow you to tell FlexPDE not to consolidate even if the ini file is not available.
moderator
 
Posts: 686
Joined: Tue Jan 11, 2011 1:45 pm

Re: TXT-File Export with FlexPDE7n.exe

Postby moderator on Fri Apr 21, 2017 5:42 pm

As for your gridding problem, indeed there was a tiny window of NGRID that exposed a flaw in the gridder. We have modified the gridder to avoid this error and it will be available in the next formal release (v7.05). Probably a month or so. If you would like a developmental version before that, let me know and I will have one posted for you.
moderator
 
Posts: 686
Joined: Tue Jan 11, 2011 1:45 pm

Re: TXT-File Export with FlexPDE7n.exe

Postby moderator on Mon Apr 24, 2017 10:58 am

We have added a command line switch in v7.05 that will allow you to set the consolidate option, similar to the threads switch. -NC for No Consolidation.
moderator
 
Posts: 686
Joined: Tue Jan 11, 2011 1:45 pm


Return to FlexPDE Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron