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

CFX juction box routine on slave partitions

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 10, 2017, 09:56
Default CFX juction box routine on slave partitions
  #1
New Member
 
Dmitry
Join Date: Feb 2013
Posts: 29
Rep Power: 13
techtuner is on a distinguished road
Hello to everyone.
Currently I'm making subroutine for reading data from file and writing it to CFX MemoryManagementSystem (MMS). I have done it and it works well in serial mode. But in parallel mode my routine starts on all cores only in the mode "First call". In the Juction Box location "Start of Timestep" routine starts only on the master process. This mean that data are reading only by master process and only master process may work with actual data (for example, boundary conditions) that were written in file. And this is the problem.
Does anyone know how I may to start subroutine on slave processes at the start of the everyone timestep, or, maybe, record actual data from master process direct to the MMS of everyone process?
techtuner is offline   Reply With Quote

Old   August 10, 2017, 09:58
Default
  #2
New Member
 
Dmitry
Join Date: Feb 2013
Posts: 29
Rep Power: 13
techtuner is on a distinguished road
My subroutine below:
#include "cfx5ext.h"
dllexport(jcb_routine)
SUBROUTINE JCB_ROUTINE ( CZ,DZ,IZ,LZ,RZ )
implicit none
#include "MMS.h"
#include "stack_point.h"
#include "parallel_partitioning.h"
#include "cfd_memory_stacks.h"
#include "cfd_constants.h"
CHARACTER*15 CFROMR
EXTERNAL CFROMR
CHARACTER*(MXPNAM) CFX_INPUT_FILE_PATH
CHARACTER*4 CRESLT
integer :: i,j,k
integer :: IOSTATUS
REAL :: InModelingTime,InPower
INTEGER ILOC
__stack_point__ pOINT

C Executable statements
! print message if slave process has started the routine
if (PARMOD.NE.__master__) then
CALL MESAGE( 'WRITE',
& 'slave process: state machine')
endif
! initialization of user parameters
CFX_INPUT_FILE_PATH='/lustre/'
! reading of data file path
CALL PSHDIR ('/','SKIP',CRESLT)
CALL PEEKCS ('/USER/CFX_INPUT_FILE_PATH',
& CFX_INPUT_FILE_PATH,'SKIP',CRESLT,CZ)
CALL POPDIR ('SKIP',CRESLT)

! initializing of data
InModelingTime=0.01
InPower=0.01

! writing standart "subroutine start" text to master host
CALL MESAGE( 'WRITE',
& 'SUBROUTINE_has_been_started')

! reading of data file
open (unit=1,
& file=CFX_INPUT_FILE_PATH,
& status='unknown',buffered='no')
read (1,*,IOSTAT=IOSTATUS) InModelingTime
read (1,*,IOSTAT=IOSTATUS) InPower
close (1)

! intermediate output to cfx_solver of data file content
CALL MESAGE( 'WRITE','InModelingTime ='
& //CFROMR(InModelingTime))
CALL MESAGE( 'WRITE','InPower ='
& //CFROMR(InPower))

! reserving of memory for data in stack
CALL CHGDIR ('/','SKIP',CRESLT)
CALL CHMDIR ('/USERDAT','SKIP',CRESLT)
CALL MAKDAT ('INMODTIME','REAL',
& 'SKIP',1,pOINT,CRESLT)
CALL MAKDAT ('INPOWER','REAL',
& 'SKIP',1,pOINT,CRESLT)
CALL CHGDIR ('..','SKIP',CRESLT)

! writing of variables to MemoryManagementSystem
CALL POKER ('/USERDAT/INMODTIME',1,InModelingTime,
& 'SKIP',CRESLT,RZ)
CALL POKER ('/USERDAT/INPOWER',1,InPower,
& 'SKIP',CRESLT,RZ)

! "end of subroutine" output text
CALL MESAGE( 'WRITE',
& 'SUBROUTINE_has_been_finished')


END ! end of subroutine


Sent from my M040 using CFD Online Forum mobile app
techtuner is offline   Reply With Quote

Old   August 10, 2017, 10:44
Default
  #3
Senior Member
 
Join Date: Jun 2009
Posts: 1,865
Rep Power: 33
Opaque will become famous soon enough
From the documentation:

Quote:
18.2.3. Reading Data with the User Input Option

The User Input option for Junction Box Location enables you to read in your own data stored in files using arbitrary data formats. An example of data you may want to read in is any kind of data table (for example, profile boundary condition) when the data is read during a CFX-Solver run, a special MMS data area called /USER_DATA is created before the user input call. In a parallel run, this call is made only on the master process. After the call, any data found in /USER_DATA will be automatically copied from the master to the slave processes, so it becomes available to all subroutines on all processes. Use of this MMS data area requires calls to basic CFX MMS routines. For details, see CFX Memory Management System (MMS).

In a parallel run, Start of Run calls are made on every partition, while User Input calls are made only by the master process.
Similarly, there is a

Quote:
User Input Start of Timestep: Called at the start of each timestep. Works identically to the User Input location but is called at the beginning of each timestep in a transient run.
Hope the above helps
Opaque is offline   Reply With Quote

Old   August 10, 2017, 13:50
Default
  #4
New Member
 
Dmitry
Join Date: Feb 2013
Posts: 29
Rep Power: 13
techtuner is on a distinguished road
In theory, User Input Start of Timestep must copy /USER_DATA from master to slave processes automatically. But in my case it didn't. And "Start of Timestep" it didn't too. It's quite strange.
Anyway, I have changed the method of data files reading and temporary data storage. Now I'm read data file straight from User Functions. Problem with multiple reading by many processes of only file has been resolved by logical operators. Storage of temporary data was organized by SAVE Fortran operator.
techtuner is offline   Reply With Quote

Old   August 10, 2017, 16:46
Default
  #5
Senior Member
 
Join Date: Jun 2009
Posts: 1,865
Rep Power: 33
Opaque will become famous soon enough
From your source code, I can only see data being stored under

/USERDAT

which is not

/USER_DATA

Therefore, it will not be copied. In fact, it is ignored by the software and only your source code is aware of its existence.
Opaque is offline   Reply With Quote

Old   August 11, 2017, 09:30
Default
  #6
New Member
 
Dmitry
Join Date: Feb 2013
Posts: 29
Rep Power: 13
techtuner is on a distinguished road
Yes, really so. Thank a lot!
I supposed it should work, but with USER_DATA my model is crashed with MPI error and Segmentation fault during start of computation. And I have remembered that it was the reason why I change USER_DATA on USERDAT earlier, but I didn't suppose, that data do not be copied from master to slave automatically.
Anyway treating of this problem through User Function and without MMS usage works well with the same performance.

Sent from my M040 using CFD Online Forum mobile app
techtuner 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
Difference between Junction BOX routine & CEL expression in a 1 way FSI vmlxb6 CFX 1 March 1, 2011 09:50
openfoam 1.6 on debian etch romant OpenFOAM Installation 9 May 6, 2010 03:26
[blockMesh] BlockMeshmergePatchPairs hjasak OpenFOAM Meshing & Mesh Conversion 11 August 15, 2008 08:36
CFX 10 User Sub Routine Claudia CFX 6 February 15, 2006 09:32
CFX 5.7 error by routine PEEKCS and MEMRR H.L. CFX 3 October 25, 2004 10:01


All times are GMT -4. The time now is 21:25.