How can I stop the solver gracefully from user Fortran in a transient run?
Set the logical data area /FLOW/ALGORITHM/CONTROL/NEXT_TSTEP to FALSE from user Fortran. A complete working example is provided, which demonstrates this method. See attached zip archive file and description below. FILES SUPPLIED README This file run.ccl CCL file for use with the -ccl option solvercontrol.def Definition file usr_stp_solver.F User Fortran source code DESCRIPTION This example demonstrates how to stop a transient run of the solver from user Fortran. In this case the criteria used to stop the solver is when a variable falls within a specified range. In principle however, any criteria could be used, the main purpose of the example being to demonstrate how to stop the solver. Stopping the solver in a transient run is actually very simple and is achieved by setting the following LOGICAL data area to FALSE: /FLOW/ALGORITHM/CONTROL/NEXT_TSTEP This data area controls whether the solver completes any more time steps and is set using a call to POKEL as follows: CALL POKEL('/FLOW/ALGORITHM/CONTROL/NEXT_TSTEP', & IONE,.FALSE.,'STOP',CRESLT,LZ) A working example is provided, which also writes a diagnostic message to the output file when the solver is stopped. The method outlined stops the solver 'gracefully'. It is sometimes necessary to stop the solver immediately (e.g. in case of an error), in which case the routine CFXSTP should be called. RUNNING THE EXAMPLE - Open a command prompt/shell. If running on a Windows based machine, obtain this from the CFX-5 launcher using 'Tools > Command Line'. - Use the cfx5mkext command to create a shared library from the user Fortran source code supplied with this example. cfx5mkext -name scontrol usr_stp_solver.F - Run the simulation using the CFX-5 solver. The command is: cfx5solve -def solvercontrol.def -ccl run.ccl Note that in this example, the library path is set to .. which is adequate for a simple example run sequentially. For real cases, particularly when running in parallel, it is strongly recommended to use an absolute path. Note also that a similar example is available showing how to stop a steady state simulation, which requires a slightly different procedure. **** Entered By: dsclarke @ 05/08/2007 02:43 PM **** |
||
|