On 10/21/2024 12:41 AM, Thomas Koenig wrote:
Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
I include all of my common blocks as files to stop typos.
That is surely an old technique, but only really works to 100%
if you adhere to some additional style constraints in your code.
Consider
foo.f:
DIMENSION A(10)
INCLUDE "common.inc"
bar.f:
INCLUDE "common.inc"
(without the DIMENSION)
common.inc:
COMMON /COMMON/ A
Here is one of my 197 common block include files, global.inc:
C global.inc
C
C
C 11/21/19 Lynn McGuire pmr 6299, add new ncp max used variable for chemtran
C 11/14/19 CPO PMR 6299 - Add global_aqueous_keyk
C 07/05/19 Lynn McGuire pmr 6036, add do not call solid isothermal flash
C 08/08/18 Lynn McGuire pmr 6308, add spreadsheet unit module
C 08/24/17 Lynn McGuire add max lkey constant
C 03/15/17 Lynn McGuire pmr 6265, add stream print around unit module calls
C 03/18/15 Lynn McGuire add next simulation time
C 09/30/14 CPO PMR 6090 - Add num_crude_streams
C 08/15/14 Lynn McGuire add max line segments parameter
C 07/18/14 Lynn McGuire move oneline to dii.inc
C 03/10/14 Lynn McGuire add new thermo failure logical
C 08/01/12 Lynn McGuire add stream specs to the common area
C 12/06/11 Lynn McGuire remove max_kvalue_methods
C 01/07/11 Lynn McGuire increase max equips to 56 for tank and add time variables
C 10/14/10 CPO Added logicals do_not_call_liqh, do_not_call_vaph.
C 10/05/10 CPO Added logicals do_not_call_threephs and do_not_call_flai.
C 12/29/09 CPO PMR 5486 - Added logical lrespect_user_pitch.
C 11/10/09 CPO Moved ne_did_not_converge and equipment_fail_count from
C global.inc to here so that we can use max_nodes to
C size the ne_did_not_converge array.
C 06/29/09 Michael McGuire removed SUBGL*
C 04/17/09 Lynn McGuire add new logicals for telling us when to use and
C when not to use lnolimit
C 11/20/08 Lynn McGuire add oneline
C 11/07/08 Lynn McGuire add max_kvalue_methods
C 08/11/08 Lynn McGuire add max_components and max_nodes
C 07/17/08 Colin Sturm PMR 4920 - increased max_equip_types (+1) to 55
C to make room for new equipment module steam ejector
C 07/17/08 Colin Sturm PMR 4213 - increased max_equip_types (+1) to 54
C to make room for new equipment module packed column
C 12/19/07 GDF Added LNOLIMIT which turns off ADBF initial limit tests
C for refine in FDATA, which calls ADBF.
C 07/23/07 Lynn McGuire change tblbnm to char*4
C 08/04/06 Lynn McGuire add max_equip_types
C 07/31/06 Binh Declared IDCOMSKD as integer
C 07/24/06 Binh Declared max_ncp as integer
C 09/24/04 Lynn McGuire cut global into two common blocks to get rid of alignment errors
C 03 Feb 04 GDF Added IDCOMSKD to common so available in LNCODE (set IDKINT)
C 22-Mar-89 W. E. Hensley, Jr. (PMR 2498)
C Equivalenced TBLBNM to NERZZZ for 386 DOS security code.
C 07/30/96 Lynn McGuire removed IFBL1, IFBL2, IFBL3 from here
C and from MKBL.F, AMOCO.F, EQUIP.F
C 07/20/00 Lynn McGuire added max_ncp
C 04/11/02 Lynn McGuire add globalfilenames common block
C 11/01/02 Lynn McGuire add streamfilename
C ne_did_not_converge - set in scan.f, and used to indicate failure of unit
C modules. There are a maximum of max_nodes unit
C modules allowed in DesignII.
C equipment_fail_count - the number of equipment modules that have failed.
C thermo_init_failed - true if thermo_init_failed and should stop calculations
C print_streams_for_each_unit - print curent inlet and outlet stream conditions
C before and after each unit module call
C max_lkey - this is for the LKEY bank size
integer MAX_NCP
PARAMETER (MAX_NCP = 1000)
integer max_equip_types
parameter (max_equip_types = 57)
integer max_components
parameter (max_components = 9999)
integer max_nodes
parameter (max_nodes = 9999)
integer max_lkey
parameter (max_lkey = 32)
C aqueous phase thermo kvalue, used in flai, adbf, and threephs
C 20 is apisou, the current number
integer global_aqueous_keyk
parameter (global_aqueous_keyk = 20)
COMMON / GLOBAL / KTRACE, NCP, SETSTP, NDYNER, NERQQQ, LNOLIMIT,
* do_not_call_pivf, do_not_call_adbf,
* ne_did_not_converge, equipment_fail_count,
* lrespect_user_pitch, do_not_call_threephs,
* do_not_call_flai, do_not_call_liqh,
* do_not_call_vaph, thermo_init_failed,
* num_crude_streams, print_streams_for_each_unit,
* do_not_call_solid_isothermal_flash,
* ncp_max_used
integer KTRACE
integer NCP
logical SETSTP
integer NDYNER
integer NERQQQ
integer num_crude_streams
logical LNOLIMIT
logical do_not_call_pivf
logical do_not_call_adbf
logical lrespect_user_pitch
logical do_not_call_threephs
logical do_not_call_flai
logical do_not_call_liqh
logical do_not_call_vaph
logical thermo_init_failed
logical print_streams_for_each_unit
logical do_not_call_solid_isothermal_flash
C this is to record the ncp max used for chemtran since it changes ncp on the fly
integer ncp_max_used
COMMON / GLOBAL1 / TBLBNM, IDCOMSKD
character*4 TBLBNM
integer IDCOMSKD
integer ne_did_not_converge (max_nodes)
integer equipment_fail_count
COMMON / GlobalFilenames / ChemTranDataFile, StreamDataFile,
1 RefineRestartFile
Character*1024 ChemTranDataFile
Character*1024 StreamDataFile
Character*1024 RefineRestartFile
common / globalTimeSettings / current_simulation_time,
* maximum_simulation_time,
* simulation_time_step,
* last_simulation_time,
* next_simulation_time
C current time in hours
double precision current_simulation_time
C the last current time in hours
double precision last_simulation_time
C maxium time in hours
double precision maximum_simulation_time
C time step in hours
double precision simulation_time_step
C the next time step in hours
double precision next_simulation_time
common / feed_stream_specs /
* num_saturate_feed_streams, feed_streams_to_saturate,
* num_print_summary_streams, print_summary_streams,
* num_print_ionic_streams, print_ionic_streams
integer num_saturate_feed_streams
integer feed_streams_to_saturate (max_nodes)
integer num_print_summary_streams
integer print_summary_streams (max_nodes)
integer num_print_ionic_streams
integer print_ionic_streams (max_nodes)
integer max_line_segments
parameter ( max_line_segments = 1000 )
Thanks,
Lynn