Oasis3 4.0.2
|
00001 SUBROUTINE prism_put_inquire_proto(id_port_id,kstep,kinfo) 00002 ! 00003 !* *** PRISM_put_inquire *** PRISM 1.0 00004 ! 00005 ! purpose: 00006 ! -------- 00007 ! 00008 ! interface: 00009 ! ---------- 00010 ! id_port_id : port number of the field 00011 ! kstep : current time in seconds 00012 ! kinfo : output status 00013 ! 00014 ! lib mp: 00015 ! ------- 00016 ! none 00017 ! 00018 ! author: 00019 ! ------- 00020 ! Sophie Valcke (08/03 - created from prism_put_proto) 00021 ! ---------------------------------------------------------------- 00022 USE mod_kinds_model 00023 USE mod_prism_proto 00024 USE mod_comprism_proto 00025 IMPLICIT NONE 00026 #if defined use_comm_MPI1 || defined use_comm_MPI2 00027 #include <mpif.h> 00028 #endif 00029 ! ---------------------------------------------------------------- 00030 INTEGER (kind=ip_intwp_p) kstep, kinfo, id_port_id 00031 ! ---------------------------------------------------------------- 00032 INTEGER (kind=ip_intwp_p) il_newtime 00033 INTEGER (kind=ip_intwp_p) iport 00034 ! ---------------------------------------------------------------- 00035 ! 00036 !* 0. Entering 00037 ! -------------- 00038 ! 00039 #ifdef __VERBOSE 00040 WRITE(nulprt,*) ' ' 00041 WRITE(nulprt,*)'| | | Entering routine prism_put_inquire_proto' 00042 CALL FLUSH(nulprt) 00043 #endif 00044 ! 00045 kinfo = PRISM_Ok 00046 ! 00047 !* 1. check for this port in my list 00048 ! --------------------------------- 00049 ! 00050 iport = -1 00051 ! Test if the field is defined in the namcouple and if its coupling period 00052 ! is not greater than the time of the simulation. 00053 IF (ig_def_freq(id_port_id) .eq. 0.or. & 00054 ig_def_freq(id_port_id) .gt. ig_ntime) THEN 00055 GOTO 1010 00056 ENDIF 00057 ! 00058 ! 00059 ! if a field exported at a certain time should match an import 00060 ! at a time+lag, add the lag here; the lag is given by the user 00061 ! in the namcouple at the end of the field 2nd line. 00062 IF (myport(1,id_port_id).eq.CLIM_Out) THEN 00063 iport=id_port_id 00064 il_newtime = kstep + ig_def_lag(iport) 00065 ENDIF 00066 IF (iport.lt.0) THEN 00067 WRITE(nulprt,FMT='(A,A)') & 00068 'Put - WARNING - Invalid port out: ', & 00069 cports(id_port_id) 00070 GO TO 1010 00071 ENDIF 00072 ! 00073 ! If the user indicated in the namcouple that the field must be 00074 ! accumulated or averaged (keyword 'AVERAGE' or 'ACCUMUL' at the 00075 ! end of the field 2nd line), do the local transformations. 00076 ! 00077 IF (ig_def_trans(iport) .eq. ip_average .or. & 00078 ig_def_trans(iport) .EQ. ip_accumul .OR. & 00079 ig_def_trans(iport) .EQ. ip_min .OR. & 00080 ig_def_trans(iport) .EQ. ip_max) THEN 00081 kinfo = PRISM_LocTrans 00082 ENDIF 00083 ! 00084 !* Test if field must be written to restart file i.e. 00085 !* - current time is time at the end of simulation + 00086 !* - lag of current field is greater than 0 00087 ! 00088 IF (il_newtime.EQ.ig_ntime.AND.ig_def_lag(iport).GT.0) THEN 00089 !ac 00090 IF (ig_def_state(iport) .NE. ip_output) THEN 00091 !ac 00092 ! 00093 !* Note: A model can have several restart files but same restart 00094 !* file can't be used by different models 00095 ! 00096 kinfo = PRISM_ToRest 00097 !ac 00098 ENDIF 00099 !ac 00100 ! Test if the current time is a coupling (or I/O) time 00101 IF (MOD(il_newtime,ig_def_freq(iport)).EQ.0) THEN 00102 #if !defined key_noIO 00103 !* If the user indicated in the namcouple that the field is 00104 !* a field output-to-file (keyword 'OUTPUT', 'IGNOUT' or 'EXPOUT' 00105 !* at the end of the field 1st line), do the writing to file here, e.g.: 00106 !ac 00107 IF (ig_def_state(iport) .EQ. ip_output ) THEN 00108 kinfo = PRISM_Output 00109 ELSE IF (ig_def_state(iport) .EQ. ip_expout .OR. ig_def_state(iport) .EQ. ip_ignout) THEN 00110 kinfo = PRISM_ToRestOut 00111 ENDIF 00112 !ac 00113 #endif 00114 ENDIF 00115 ELSE 00116 ! Test if the current time is a coupling (or I/O) time 00117 IF (MOD(il_newtime,ig_def_freq(iport)).EQ.0) THEN 00118 ! 00119 #if !defined key_noIO 00120 !* If the user indicated in the namcouple that the field is 00121 !* a field output-to-file (keyword 'OUTPUT', 'IGNOUT' or 'EXPOUT' 00122 !* at the end of the field 1st line), do the writing to file here, e.g.: 00123 IF (ig_def_state(iport) .EQ. ip_output .OR. & 00124 ig_def_state(iport) .EQ. ip_expout .OR. & 00125 ig_def_state(iport) .EQ. ip_ignout) THEN 00126 kinfo = PRISM_Output 00127 ENDIF 00128 #endif 00129 !* 00130 !* If the user indicated in the namcouple that the field is 00131 !* a coupling field (keyword EXPORTED','EXPOUT','IGNORED', 'IGNOUT' 00132 !* or 'AUXILARY' at the end of the field 1st line),do the export here. 00133 !* 00134 IF (ig_def_state(iport) .EQ. ip_expout .OR. & 00135 ig_def_state(iport) .eq. ip_exported .or. & 00136 ig_def_state(iport) .eq. ip_ignored .or. & 00137 ig_def_state(iport) .eq. ip_ignout .or. & 00138 ig_def_state(iport) .eq. ip_auxilary) THEN 00139 00140 IF (kinfo .EQ. PRISM_Output) THEN 00141 kinfo = PRISM_SentOut 00142 ELSE 00143 kinfo = PRISM_Sent 00144 ENDIF 00145 00146 ENDIF 00147 ENDIF 00148 ENDIF 00149 ! 00150 ! ---------------------------------------------------------------- 00151 ! 00152 1010 CONTINUE 00153 #ifdef __VERBOSE 00154 WRITE(nulprt,*)'| | | Leaving routine prism_put_inquire_proto' 00155 WRITE(nulprt,*)' ' 00156 #endif 00157 CALL FLUSH(nulprt) 00158 RETURN 00159 END SUBROUTINE prism_put_inquire_proto