c subroutine chflds(ifhis,nfhis,iftot,nftot,ifdep,nfdep,iset, + flab,iprnt) integer ifhis(nfhis),iftot(nftot),ifdep(nfhis,nfdep) character*(*) flab(nftot) c c--------------------------------------------------------------------- c c nfhis = max number of fields on a history c ifhis(nfhis) = flags for fields to get from or are available on c a history (0 or 1) (may be changed on output if iset=1) c nftot = total number of fields for processor (> nfhis) c iftot(nftot) = flags for requested fields from processor (0 or 1) c (may be changed on output if iset=0) c nfdep = number of "extra" fields (i.e., nftot-nfhis) c ifdep(nfhis,nfdep) = field dependencies for each "extra" field c (e.g., if (ifdep(i,ii) > 0) then "extra" field ii is dependent c on the existence of history field i) c c if iset > 0 then: c Set ifhis(i) if iftot(i) is set (i.e., any history fields requested c for plotting are also requested fromthe history) c Check that all dependent fields in ifhis are set according to c requested "extra" fields (i.e., if extra field ii is requested, c make sure the dependent fields in ifhis are set) c c if iset <= 0 then: c Unset any requested fields (iftot) that are not available on c the history (ifhis) c Unset any "extra" requested fields in iftot that depend on fields c that are not set (not available on history) in ifhis c c This routine is used in two cases: c 1) An "extra" field has been requested, and we need to get its c dependencies from the history (iset = 1, generally called c from getinp after reading requested fields flags) c 2) We have determined that certain fields are not available on the c history (e.g., non-dynamo run, secondary history, etc), so we c need to "unset" any "extra" fields that were requested but c depended on these unavailble fields (iset = 0, generally called c after gettimes, which reads the histories) c--------------------------------------------------------------------- c c Request fields from history that have been flagged for plotting: c if (iset.gt.0) then do i=1,nfhis if (iftot(i).gt.0) ifhis(i) = 1 enddo c c Unset fields that have been flagged for plotting, but are apparently c unavailable from the history: c else do i=1,nfhis if (iftot(i).gt.0.and.ifhis(i).le.0) then iftot(i) = 0 if (iprnt.gt.0) + write(6,"('>>> Warning: field ',a,' apparently ', + 'not available (turning plot flag off)')") flab(i) endif enddo endif c c Check dependencies: c do i=1,nfdep if (iftot(nfhis+i).gt.0) then do ii=1,nfhis if (ifdep(ii,i).gt.0.and.ifhis(ii).le.0) then c c If an "extra" field is requested, make sure the fields it is dependent c upon are acquired from history: c if (iset.gt.0) then ifhis(ii) = 1 if (iprnt.gt.0) + write(6,"('Requesting field ',a,' from the ', + 'history because it is needed for ',a)") + flab(ii),flab(nfhis+i) c c If an "extra" field was requested but one or more of its dependent c fields was not available, turn off the requested extra field: c else iftot(nfhis+i) = 0 if (iprnt.gt.0) + write(6,"('Will NOT plot field ',a, + ' because history field ',a,' is not available')") + flab(nfhis+i),flab(ii) endif endif enddo endif enddo return end