Closed xk-y closed 4 years ago
Hi @xiaoky97 , thanks for your question - hopefully we can get you up and running soon.
Firstly, could you please repeat Step 4 of §2.4, and check that (a) there are no errors from that step, and (b) run step 5 afterwards and confirm that you see the same behaviour. Please send us the full output of both those steps.
After that, can you confirm whether you've made any changes, however minor, to any of the data files, such as the .fac, or any .config files?
Finally, in order to check what's happened, we'd need to please see a copy of your mechanism_test.fac
file, and your photolysisConstants.config
and photolysisConstrained.config
.
Thanks!
Step 4:
call mech_converter.py /home/atchem/atchem/mcm Running fix_fac_file on /home/atchem/atchem/mcm/mechanism_test.fac /home/atchem/atchem/mcm/mechanism_test.fac: file read in 255 items 0 corrections made - now removing old Reading input file looping over inputted RO2s adding RO2 to ./model/configuration//mechanism.ro2
make sharedlib gfortran -c model/configuration/mechanism.f90 -ffree-form -fimplicit-none -Wall -Wpedantic -Wno-unused-dummy-argument -fcheck=all -fPIC -shared -o model/configuration/mechanism.o -Jobj gfortran -shared -o model/configuration/mechanism.so model/configuration/mechanism.o => shared library directory: ./model/configuration/
make base executable gfortran -o atchem2 -Jobj -Iobj src/dataStructures.f90 src/argparse.f90 src/interpolationFunctions.f90 src/configFunctions.f90 src/inputFunctions.f90 src/outputFunctions.f90 src/atmosphereFunctions.f90 src/solarFunctions.f90 src/constraintFunctions.f90 src/solverFunctions.f90 src/parameterModules.f90 src/atchem2.f90 -fprofile-arcs -ftest-coverage -ffree-form -fimplicit-none -Wall -Wpedantic -fcheck=all -fPIC -L/usr/lib/atchem-lib/cvode/lib/ -L/usr/lib/atchem-lib/openlibm-0.4.1/ -Wl,-R,/usr/lib/:/usr/lib/atchem-lib/cvode/lib/:/usr/lib/atchem-lib/openlibm-0.4.1/ -lopenlibm -lsundials_fcvode -lsundials_cvode -lsundials_fnvecserial -lsundials_nvecserial -ldl src/configFunctions.f90:155:0:
155 | allSpecies = getSpeciesList() |
---|
Warning: ‘allspecies.offset’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/configFunctions.f90:155:0: Warning: ‘allspecies.dim[0].lbound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/configFunctions.f90:155:0: Warning: ‘allspecies.dim[0].ubound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/inputFunctions.f90:1083:0:
1083 | speciesNames = getSpeciesList() |
---|
Warning: ‘speciesnames.offset’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/inputFunctions.f90:1083:0: Warning: ‘speciesnames.dim[0].lbound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/inputFunctions.f90:1083:0: Warning: ‘speciesnames.dim[0].ubound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:353:0:
353 | arrayOfConcs = getSubsetOfConcs( allSpeciesConcs, specOutReqNames ) |
---|
Warning: ‘arrayofconcs.offset’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:353:0: Warning: ‘arrayofconcs.dim[0].lbound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:353:0: Warning: ‘arrayofconcs.dim[0].ubound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:353:0:
353 | arrayOfConcs = getSubsetOfConcs( allSpeciesConcs, specOutReqNames ) |
---|
Warning: ‘arrayofconcs.dim[0].lbound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:353:0: Warning: ‘arrayofconcs.dim[0].ubound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:353:0: Warning: ‘arrayofconcs.dim[0].lbound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:353:0: Warning: ‘arrayofconcs.dim[0].ubound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:353:0: Warning: ‘arrayofconcs.dim[0].ubound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:353:0: Warning: ‘arrayofconcs.dim[0].lbound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:353:0: Warning: ‘arrayofconcs.dim[0].lbound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:353:0: Warning: ‘arrayofconcs.dim[0].lbound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:353:0: Warning: ‘arrayofconcs.dim[0].ubound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:353:0: Warning: ‘arrayofconcs.dim[0].ubound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:353:0: Warning: ‘arrayofconcs.dim[0].lbound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:353:0: Warning: ‘arrayofconcs.dim[0].ubound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:353:0:
353 | arrayOfConcs = getSubsetOfConcs( allSpeciesConcs, specOutReqNames ) |
---|
Warning: ‘arrayofconcs.dim[0].lbound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:353:0: Warning: ‘arrayofconcs.dim[0].ubound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:353:0: Warning: ‘arrayofconcs.dim[0].ubound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:353:0: Warning: ‘arrayofconcs.dim[0].lbound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:272:0:
272 | speciesNames = getSpeciesList() |
---|
Warning: ‘speciesnames.offset’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:272:0: Warning: ‘speciesnames.dim[0].lbound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:272:0: Warning: ‘speciesnames.dim[0].ubound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:272:0:
272 | speciesNames = getSpeciesList() |
---|
Warning: ‘speciesnames.dim[0].lbound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:272:0: Warning: ‘speciesnames.dim[0].ubound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:272:0: Warning: ‘speciesnames.dim[0].ubound’ may be used uninitialized in this function [-Wmaybe-uninitialized] src/outputFunctions.f90:272:0: Warning: ‘speciesnames.dim[0].lbound’ may be used uninitialized in this function [-Wmaybe-uninitialized]
Step 5: AtChem2 v1.2
Model directory is: model Output directory is: model/output Reaction Rates directory is: model/output/reactionRates Configuration directory is: model/configuration Constraints directory is: model/constraints Environment Constraints directory is: model/constraints/environment Photolysis Constraints directory is: model/constraints/photolysis Species Constraints directory is: model/constraints/species MCM directory is: mcm Shared library is: model/configuration/mechanism.so
Number of Species = 29 Number of Reactions = 71
Size of lhs = 114 Size of rhs = 100
Reading reactants (lhs) from mechanism.reac... Reading products (rhs) from mechanism.prod... Finished reading lhs and rhs data.
Reading species names from mechanism.species... Finished reading species names.
Reading initial concentrations... 1 CH4 4.900E+13 ... 4 NO2 2.400E+11 Finished reading initial concentrations.
Reading which species require detailed rate output...
1 OH
2 HO2
Finished reading which species require detailed rate output.
Species requiring detailed rate output (number of species found): 2
atol: 1.000E-03
rtol: 1.000E-04
deltaMain: 1.000E-04
lookBack: 100
maxStep: 1.000E+02
Finished reading solver parameters from file.
number of steps: 48
step size: 0.900E+03
species interpolation method: piecewise linear
conditions interpolation method: piecewise linear
rates output step size, ROPA/RODA: 3600
model start time: 0
jacobian output step size: 0
latitude: 0.515E+02
longitude: 0.130E+00
reaction rates output step size: 1800
day/month/year: 21/ 6/2010
Finished reading model parameters from file.
Reading concentration output from file...
Finished reading concentration output from file.
Output required for concentration of 8 species:
1 CH4
...
8 CH3O2
Reading photolysis numbers from file... 1 ... 61 Finished reading photolysis numbers. Number of photolysis numbers: 35 Looking for photolysis constants file... Checking that photolysis constants exist in file... Photolysis constants file is empty. No photolysis constants applied, so trying constrained photolysis rates file... Looking for photolysis constraints file... Checking that photolysis constraints exist in file... Photolysis constraint file is empty, so all photolysis rates will be calculated. Reading all photolysis rates from file... 1 6.073E-05 1.743E+00 4.740E-01 J1 1.000E+00 ... 61 7.537E-04 4.990E-01 2.660E-01 J61 1.000E+00 Finished reading all photolysis rates. Number of all photolysis rates: 35
Reading environment variables... Number of environment variables: 10 1 TEMP 298.15 2 PRESS 1013.25 3 RH NOTUSED 4 H2O 3.91e+17 5 DEC 0.41 6 BLHEIGHT NOTUSED 7 DILUTE NOTUSED 8 JFAC NOTUSED 9 ROOF OPEN Finished reading environment variables.
Checking for constrained environment variables... Finished checking for constrained environment variables.
Counting the variable-concentration species to be constrained (in file speciesConstrained.config)... Finished counting the names of variable-concentration constrained species. Number of names of variable-concentration constrained species: 0 Counting the fixed-concentration species to be constrained (in file speciesConstant.config)... Finished counting the names of fixed-concentration constrained species. Number of names of fixed-concentration constrained species: 0 Setting size of constraint arrays, n = 0 Skipped reading the names of variable-concentration constrained species Reading concentration data for variable-concentration constrained species... Reading in the names and concentration of the fixed constrained species (in file speciesConstant.config)... Finished reading in the names and concentration of fixed-concentration species. Finished reading constrained species. Initialising concentrations of constrained species... Finished initialising concentrations of constrained species.
neq = 29
numberOfConstrainedSpecies = 0 t0 = 0.000E+00
setting maxnumsteps ier = 0 setting maxstep ier = 0
At line 243 of file src/solverFunctions.f90 Fortran runtime error: Index '61' of dimension 1 of array 'j' above upper bound of 60
Error termination. Backtrace:
### I did not make any change to the data file.
I have never encountered all those warning messages at compilation. @spco do you think that is the issue?
I'm hoping to take a look at this soon. No those compiler warnings are dependent on the compiler and settings - I see them and they can be safely ignored.
hi, It seems there is an index error in array j.
I am not an expert in this field but I can avoid this problem by changing the line: https://github.com/AtChem/AtChem2/blob/e18a0341a11b4a9f7d57e46c2fd0a7c01cc18d85/src/inputFunctions.f90#L297 to
call allocate_photolysis_j( maxval(photoNumbers)+1 )
to allocate more space to j.
Hi @xiaoky97 - I'm currently unable to replicate this behaviour on my machine, and the code looks like it should be working. @vinthony's fix would work, but it doesn't make any sense why it should be necessary, and so using that fix is likely to be glossing over the real issue.
Could you confirm which exact commit you are using, and the compiler version and OS? Also the openlibm and cvode versions. Thank you.
At this stage beyond that all I can recommend is that you completely remove AtChem and reinstall anew - there may be some inadvertent change to the data file that you haven't noticed.
Hi @spco I have tried to compile and run it on another machine, and it worked successfully. I also followed what @vinthony mentioned, made a change in the upper limit of the array j, and now it works well on the old machine :) Thanks a lot!
The compiler I am using is gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0, and the OS is Ubuntu 20.04 LTS 64bit. The lib version is: sundials-2.7.0, openlibm-0.4.1.
One thing is that on the new machine, nothing have been changed with the array j but it works well. I am not sure whether another issue would happen if the array j is changed.
@xiaoky97 hi, are these two machines produce the same results when you fix the code as mentioned?
My solution just avoids this problem from the viewpoint of programming so I can not guarantee this change works also.
@vinthony Hi, the only difference is in the final statistics:
When the j array is changed, the results are:
final statistics
No. steps = 513 No. f-s = 543 No. J-s = 704 No. LU-s = 55
No. nonlinear iterations = 540
No. nonlinear convergence failures = 0
No. error test failures = 4
Runtime = 0
Deallocating memory.
On another machine, where j is not changed, the results are:
final statistics
No. steps = 603 No. f-s = 699 No. J-s = 1003 No. LU-s = 100
No. nonlinear iterations = 696
No. nonlinear convergence failures = 0
No. error test failures = 28
Runtime = 0
Deallocating memory.
Hi both,
Very glad to hear that your install on another machine was successful.
I can't recommend using @vinthony's solution, because that is just hiding the true issue. The change in iteration counts slightly worries me that it will be having undesirable effects.
At this point, my advice would be to completely wipe AtChem2 from the first machine (delete the whole directory) and run a fresh install. It may be that there's been an inadvertent change to a data file which is causing this problem. I'd be interested to know whether that fixes the issue.
Thanks, Sam
I can't reproduce the issue either. It seems to me it is a machine-specific issue, for whatever reason. I propose to close this issue with the recommendation for @xiaoky97 to reinstall on the "old machine" and/or use the "new machine".
In case this happens again we can investigate it further, keeping in mind the workaround proposed by @vinthony.
Is everybody happy with this?
This should have now been fixed by #438 - please let me know whether it does so. I will close this issue for now, but please reopen if it still doesn't work. Thanks!
Hi! I followed the manual chapter 2 to install Atchem and run the example mechanism. When I ran ./atchem2, the folling error happened. Could you please give me some help about this? Thanks a lot.
Model run
At line 243 of file src/solverFunctions.f90 Fortran runtime error: Index '61' of dimension 1 of array 'j' above upper bound of 60
Error termination. Backtrace:
0 0x7f0a0e6aed0a
1 0x7f0a0e6af819
2 0x7f0a0e6afe96
3 0x56120d15b815
4 0x56120d16287c
5 0x56120d16fb13
6 0x56120d1711ea
7 0x7f0a0e97fc41
8 0x7f0a0e97f89f
9 0x7f0a0e97d8fa
10 0x56120d170b81
11 0x56120d16cee3
12 0x56120d16efeb
13 0x7f0a0e4c20b2
14 0x56120d11698d
15 0xffffffffffffffff