CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

Using Batch file in combination with the workbench

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By ghorrocks

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 6, 2017, 04:32
Default Using Batch file in combination with the workbench
  #1
New Member
 
Join Date: Nov 2016
Posts: 2
Rep Power: 0
D0nT0m is on a distinguished road
Hi,

i´m using ansys cfx in the workbench. I´ve build a python script which is searching a velocity (tube flow) by minimizing some forces. The script executes many simulations in series.

For a better overview i number my past procedure (1) and what i´m trying to do (2):

1) I´m using the workbench command window and start the python script. Up to this point there is no problem.
My purpose is to run the script with various settings (without using design point studies) and let it work for a few days without crashing. If im starting the script, at some point (after 8h, 1d , ...depending on the mesh size) it crashes. My assumption is that there is not enough space left (temporary files?) after the simulations and it crashes.

2) Therefore i wanted to use a batch file which runs a few python scripts in a row to avoid running out of space (im not sure that it works). My assumption is that after each execution of single python script the temporary files (or whatever) will be removed?

1)+2) using "Platform MPI Local Parallel" with 4 Partitions as Run Mode.

The structure of the batch file:

set path=C:\Program Files\ANSYS Inc\v145\Framework\bin\Win64
RunWB2.exe -R d:\droeget\ansys\Python\Modell2\Modell2.py -I

The structure of Modell2.py:

#################################################
# encoding: utf-8
SetScriptVersion(Version="14.5")
Open(FilePath="D:/droeget/ansys/Modelle/Modell3/Vorlage.wbpj")

#The following code is the setup of the cfx solver using 4 Partitions and the execution of the simulation

solution1 = system1.GetContainer(ComponentName="Solution")
solution1.SetExecutionControl(CCL=r"""&replace SIMULATION CONTROL:
EXECUTION CONTROL:
EXECUTABLE SELECTION:
Double Precision = Off
END
INTERPOLATOR STEP CONTROL:
Runtime Priority = Standard
MEMORY CONTROL:
Memory Allocation Factor = 1.0
END
END
PARTITIONER STEP CONTROL:
Multidomain Option = Independent Partitioning
Runtime Priority = Standard
EXECUTABLE SELECTION:
Use Large Problem Partitioner = Off
END
MEMORY CONTROL:
Memory Allocation Factor = 1.0
END
PARTITIONING TYPE:
MeTiS Type = k-way
Option = MeTiS
Partition Size Rule = Automatic
END
END
RUN DEFINITION:
Run Mode = Full
Solver Input File = D:\droeget\ansys\Modelle\Modell3\Vorlage_files\dp0 \CFX\CFX\Vorlage.def
END
SOLVER STEP CONTROL:
Runtime Priority = Standard
MEMORY CONTROL:
Memory Allocation Factor = 1.0
END
PARALLEL ENVIRONMENT:
Number of Processes = 4
Start Method = Platform MPI Local Parallel
END
END
END
END
""")
component1.Update(Force=True)
solution1.Exit()

###############################################

When im using 4 partitions with the batch file this happens (Ansys CFX solver exited with return code 2).

Part of the out-File:

+--------------------------------------------------------------------+
| Partitioning Information |
+--------------------------------------------------------------------+

Partitioning information for domain: Default Domain

+------------------+------------------------+-----------------+
| Elements | Vertices | Faces |
+------+------------------+------------------------+-----------------+
| Part | Number % | Number % %Ovlp | Number % |
+------+------------------+------------------------+-----------------+
| Full | 217164 | 40253 | 15710 |
+------+------------------+------------------------+-----------------+
| 1 | 58239 26.1 | 11128 26.1 6.9 | 3986 24.7 |
| 2 | 54532 24.4 | 10369 24.3 3.9 | 4107 25.4 |
| 3 | 55291 24.8 | 10623 24.9 7.2 | 3942 24.4 |
| 4 | 55104 24.7 | 10467 24.6 3.9 | 4119 25.5 |
+------+------------------+------------------------+-----------------+
| Sum | 223166 100.0 | 42587 100.0 5.5 | 16154 100.0 |
+------+------------------+------------------------+-----------------+

+--------------------------------------------------------------------+
| Partitioning CPU-Time Requirements |
+--------------------------------------------------------------------+

- Preparations 1.560E-01 seconds
- Low-level mesh partitioning 3.100E-02 seconds
- Global partitioning information 0.000E+00 seconds
- Element and face partitioning information 1.600E-02 seconds
- Vertex partitioning information 0.000E+00 seconds
- Partitioning information compression 0.000E+00 seconds
- Summed CPU-time for mesh partitioning 2.180E-01 seconds

+--------------------------------------------------------------------+
| Job Information at End of Run |
+--------------------------------------------------------------------+

Host computer: SM-PC26 (PID:12368)
Job finished: Mon Feb 06 09:33:50 2017
Total CPU time: 6.230E-01 seconds
or: ( 0: 0: 0: 0.623 )
( Days: Hours: Minutes: Seconds )


Total wall clock time: 6.240E-01 seconds
or: ( 0: 0: 0: 0.624 )
( Days: Hours: Minutes: Seconds )


+--------------------------------------------------------------------+
| |
| Solver |
| |
+--------------------------------------------------------------------+


+--------------------------------------------------------------------+
| An error has occurred in cfx5solve: |
| |
| The ANSYS CFX solver could not be started, or exited with return |
| code 255: No such file or directory. No results file has been |
| created. |
+--------------------------------------------------------------------+


End of solution stage.

This run of the ANSYS CFX Solver has finished.

------------------------------------------------------------



This error doesnt occur if im using only "serial" as run mode for the solver (by using the batch file).

My final question after this long text (sorry):


Is there any possibility using a batch file which executes a series of python scripts AND execute the simulation with "Platform MPI Local Parallel" mode.

There is no possibility using codes like "cfx5solve -def Vorlage.def" because i have to use the python script in combination with the workbench (master thesis). The python script manages to find the velocity by vanishing radial and axial forces on the surface of a bubble.

I hope you´ve read up to this point and i was able to explain the problem

Best regards

Thomas
D0nT0m is offline   Reply With Quote

Old   February 6, 2017, 04:57
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,703
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Why are you running this with a python script to drive in inside workbench?

Normally you have two options:
1) Do it in workbench and use the workbench parametrisation and optimisation tools to do all this stuff

OR

2) Do it all yourself, but drive the solvers from the command line. This means it is easy to integrate your own scripts/python/perl/whatever to do parametrisation or optimisation.
ghorrocks is offline   Reply With Quote

Old   February 6, 2017, 05:16
Default
  #3
New Member
 
Join Date: Nov 2016
Posts: 2
Rep Power: 0
D0nT0m is on a distinguished road
I understand your point.

My task (master thesis) was (specification from my doctor) using the workbench and use the resulting forces (from the 1.simulation) for calculating the velocity (input for the 2.simulation) and using an iteratively "algorythm" to minimize the radial and axial forces.

-Build modell1 with bla bla assumption: it works
-Build modell2 ....: works
-Build modell3 ....: bigger mesh , works but crashes after several time

The problem grows.... im far away from using the workbench the right way (you´ve confirmed it ).

Is there a possibility using the command line (you mean the windows and not the workbench command line) and have access to the output values of the results( in my case i´ve wrote out the output parameter from the workbench), make some calculations with them by finding the new input parameter for the next simulation?
D0nT0m is offline   Reply With Quote

Old   February 6, 2017, 05:28
Default
  #4
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,703
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
There are command line tools to run just about all the ANSYS software. The only exception is Designmodeller and ANSYS mesh, they can't really be run from the command line. But you can solve, extract values, change solver inputs and rerun CFX quite easily. Have a look in the documentation on the command line options.
raj kumar saini likes this.
ghorrocks is offline   Reply With Quote

Reply


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
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 09:07
[swak4Foam] Problem installing swak_2.x for OpenFoam-2.4.0 towanda OpenFOAM Community Contributions 6 September 5, 2015 21:03
[swak4Foam] swak4foam building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 16:02
[swak4Foam] Error bulding swak4Foam sfigato OpenFOAM Community Contributions 18 August 22, 2013 12:41
"parabolicVelocity" in OpenFoam 2.1.0 ? sawyer86 OpenFOAM Running, Solving & CFD 21 February 7, 2012 11:44


All times are GMT -4. The time now is 00:57.