|
[Sponsors] |
August 10, 2017, 09:56 |
CFX juction box routine on slave partitions
|
#1 |
New Member
Dmitry
Join Date: Feb 2013
Posts: 29
Rep Power: 13 |
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? |
|
August 10, 2017, 09:58 |
|
#2 |
New Member
Dmitry
Join Date: Feb 2013
Posts: 29
Rep Power: 13 |
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 |
|
August 10, 2017, 10:44 |
|
#3 | ||
Senior Member
Join Date: Jun 2009
Posts: 1,865
Rep Power: 33 |
From the documentation:
Quote:
Quote:
|
|||
August 10, 2017, 13:50 |
|
#4 |
New Member
Dmitry
Join Date: Feb 2013
Posts: 29
Rep Power: 13 |
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. |
|
August 10, 2017, 16:46 |
|
#5 |
Senior Member
Join Date: Jun 2009
Posts: 1,865
Rep Power: 33 |
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. |
|
August 11, 2017, 09:30 |
|
#6 |
New Member
Dmitry
Join Date: Feb 2013
Posts: 29
Rep Power: 13 |
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 |
|
|
|
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 |