Thursday, 4 June 2015

flopy

install:
pip install flopy --upgrade

i got stuck to set the path for modflow execution.
it seems that the executional file


>>> mf = flopy.modflow.Modflow(modelname, exe_name='mf2005')
>>> success, buff = mf.run_model()
FloPy is using the following executable to run the model: mf2005
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/flopy/mbase.py", line 375, in run_model
    stdout=sp.PIPE, cwd=self.model_ws)
  File "/usr/lib64/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception


OSError: [Errno 2] No such file or directory



Monday, 18 May 2015

swmmout study

swmmout

swmmtoolbox catalog sydney_sps.out

get all the variables in the outfile

swmmtoolbox extract sydney_sps.out link,link597,1 >> link597.txt
swmmtoolbox extract sydney_sps.out link,link597,1 link,link597,2 link,link597,3 link,link597,4 >link597




0--flow rate
1--height
2--flow
3-- froud number
4--capacity


in dropdown,

listdetail
 getdata        DEPRECATED: Use 'extract' instead.







swmmtoolbox listdetail sydney_sps.out node





swmmtoolbox extract sydney_sps.out node,nodeSPS0067,1 >nodeSPS0067_1

0. depth_above_invert
1. hydraulic head
2. volume_storeded_ponded
3.lateral inflow
4. total inflow
5. flow lost_flooding

swmmtoolbox extract sydney_sps.out node,nodeSPS0067,2 node,nodeSPS0067,3 node,nodeSPS0067,4 node,nodeSPS0067,5  >nodeSPS0067_2

Tuesday, 5 May 2015

slurm study

/usr/share/doc/slurm-llnl-doc/

slurm-llnl-doc install

the location is at /usr/share/doc/slurm-llnl-doc/html


http://sphaleron.blogspot.com.au/2011/08/really-super-quick-start-guide-to.html

Really Super Quick Start Guide to Setting Up SLURM
SLURM is the awesomely-named Simple Linux Utility for Resource Management written by the good people at LLNL. It's basically a smart task queuing system for clusters. My cluster has always run Sun Grid Engine, but it looks like SGE is more or less dead in the post-Oracle Sun software apocalypse. In light of this and since SGE recently looked at me the wrong way, I'm hoping to ditch it for SLURM. I like pop culture references and software that works.

The "Super Quick Start Guide" for LLNL SLURM has a lot of words, at least one of which is "make." If you're lazy like me, just do this:

0. Be using Ubuntu
1. Install: # apt-get install slurm-llnl
2. Create key for MUNGE authentication: /usr/sbin/create-munge-key
3a. Make config file: https://computing.llnl.gov/linux/slurm/configurator.html
3b. Put config file in: /etc/slurm-llnl/slurm.conf
4. Start master: # slurmctld
5. Start node: # slurmd
6. Test that fool: $ srun -N1 /bin/hostname

service slurm-llnl restart


 cat slurmctld.log 
[2015-05-06T13:36:48] Job accounting information stored, but details not gathered
[2015-05-06T13:36:48] error: open /var/log/slurm_jobacct.log: Permission denied
[2015-05-06T13:36:48] error: Couldn't load specified plugin name for accounting_storage/filetxt: Plugin init() callback failed
[2015-05-06T13:36:48] error: cannot resolve acct_storage plugin operations
[2015-05-06T13:36:48] slurmctld version 2.3.2 started on cluster cluster
[2015-05-06T13:36:48] error: open /var/log/slurm_jobacct.log: Permission denied
[2015-05-06T13:36:48] error: Couldn't load specified plugin name for accounting_storage/filetxt: Plugin init() callback failed
[2015-05-06T13:36:48] error: cannot resolve acct_storage plugin operations
[2015-05-06T13:36:48] fatal: failed to initialize accounting_storage plugin



https://paolobertasi.wordpress.com/2011/05/24/how-to-install-slurm-on-debian/

  • /etc/init.d/slurm-llnl start

Wednesday, 8 April 2015

git study

git rev-list HEAD --count
display the number of commits 


put version into git repo




 git log --oneline   get a list of commited result.



git log --oneline --graph --decorate --all
see the whole tree of the current code.
see  [http://stackoverflow.com/questions/5361019/viewing-full-version-tree-in-git]


echo "#define GIT_REF \"`git show-ref refs/heads/master | cut -d " " -f 1 | cut -c 31-40`\"" >
put one line in sutra to demonstrate the version number
[http://stackoverflow.com/questions/2696975/how-do-i-add-revision-and-build-date-to-source]


git checkout 5b01926d4bdc850de431ae3cc1d6098168288826
go to another version. do not worry about the possible update you make, because if you have modification, you checkout will be aborted.


git clean -f examples/  delete all the redundant files

Wednesday, 25 March 2015

segmentation fault

After refining the mesh for p3, the program ends up with segmetation fault.
after debugging using idb, it is found it crashes at a line that writes result into file. apparently it is not casued by this line simply. the problem can be reproduced by using gfortran.
I was suggested by changing the stack size by

   ulimit -s 4000000

the way to get around is to compile the source code by windows. at least the program is now working.


case 2

the second time i see segmentation fault is that one of the files are not properly transfered from source to sub functions.


say: call aaa(a,b,c)

in aaa :
aaa(a,b)
c=12

this may cause segmentation fault

gdb (gefortran --debug) debug

  Intel fortran on linux is no longer free, which is annoying as a fortran user. I dicided to change to gfortran instead.
  to creat a executable file that can debug, one can use  '-g' flag
TBH, at the very beginning, it is quite annoying to use command interface to do the debugging, but

gfortran -g a.F90 -o ab

1.  use gdb (15-06-29) 
if gdb does not diplay the line properly, use -ggdb flag instead.
it is also found that the files has to be compiled by the same compiler in the same machine to ensure the readability of the code.
gfortran -ggdb a.f -o a.out

then use the following command to start debug processes.

gdb ab

other useful command:

break main

run  [r]

step [s]  (step into the subroutine)

print a [p a]

where

quit

next (n) go to the next line without step into subfunctions just over the current
n 5   go to the next for 5 times
2.  Info command
info b   see all the breaking points info breakpoints check all of the breakpoints
info line  shows where current script is stoped at



delete 1 delete break point 1 from list info b
disable 1 
enable  1

disable disable all break points

break sutra.f:333    %stop at line 333 of file sutra.f

frame   display current line

finish  stepout



https://www.google.com.au/url?sa=t&rct=j&q=&esrc=s&source=web&cd=5&ved=0CDcQFjAE&url=http%3A%2F%2Fdarkdust.net%2Ffiles%2FGDB%2520Cheat%2520Sheet.pdf&ei=HH4zVZnBO4PsmAXPz4HoCQ&usg=AFQjCNHCDpbVUfxmJyacITfnesZ0PKBKqg&sig2=ImgMp83YjaeYNoztPgTw-w&bvm=bv.91071109,d.dGY&cad=rja

http://stackoverflow.com/questions/501486/getting-gdb-to-save-a-list-of-breakpoints
save breakpoints a.txt

how to load break points --
source a.txt


Error: Dummy argument 'cherin' of procedure 'readif' at (1) has an attribute that requires an explicit interface for this procedure


set breakpoint pending on


No symbol table is loaded.  Use the "file" command.


2.  Correct the program. (15-06-29)
TIPS:
  (1) if something is wrong in the source code. one does not need to quit gdb. instead, just correct the file, make it with debug flag, and rerun simulation in gdb using r.

  1. Start the program being debugged.Example 1. The program is printch, which can take an optional command line argument. Start it running with no command line argument.
    (gdb) r
    
    Example 2. Start printch running with command line argument A.
    (gdb) r A
    
  2. Execute a single statement. If the statement is a function call, just single step into the function.
    (gdb) s
    
  3. Execute a single statement. If the statement is a function call, execute the entire function and return to the statement just after the call; that is, step over the function.
    (gdb) n
    
  4. Execute from the current point up to the next breakpoint if there is one, otherwise execute until the program terminates.
    (gdb) c
    
  5. Execute the rest of the current function; that is, step out of the function.
    (gdb) finish


Sunday, 15 February 2015

mflab -- malab read excel using xlsread slow down problem

1. it is the second time i found matlab is doing dodgy things.
Specifically, It is found that mflab in some machines are extremetly slow. the main slow down script
turns out,
line 88 h=feval(['COM.' convertedProgID], 'server', machinename, interface);
at 
C:\Program Files\MATLAB\R2012b\toolbox\matlab\winfun\actxserver.m
or
C:\Program Files\MATLAB\R2014a\toolbox\matlab\winfun\actxserver.m

is the problematic file. just change it into

line 88 h=feval([convertedProgID], 'server', machinename, interface);
solves the slow down problem

2. aera object not working.
2015-02-16 change fdm3.m file into the old one will make area object working

1. et doesn't work, no matter how many time i have checked the input.
solution. reboot matlab, and use mflab in southern folder.
10/03/15

rect_2 is designed to make very small et and start from low, now i am trying to make et very low at the beginning.
apparently the flow one does not work at all!!!



There is a tricky part for the volumetric flow given by budget, particularly at the cell where water table locates. the front or right side flux is not calculated by volumetric flow on cross section area of the cell, but volumetric flow on wetting area of the CELL!!!




Comment 1:  if there is only one layer of cell, the first layer SHOULD be set as unconfied rather than varying cells. so that the result is correct. a experience from changing one layer from  modflow_no_leak
and modflow_rect_dd_1



Comment 2: if the time-variant specified head is not working properly, particularly the cells above the time variant hydraulic head is not wetted again, one should always make sure the cell abve the manipulated cell wet. This can be done either by moving the manipulated cell downward, or change the bottom hydraulic head that is manipulating.


example study:

mf2005\TerwisschaPE     lots of stress periods. theis equation is considered
mf2005\DutchTop\RainLens very good chd package, but the simulation is not working. needs to find out the way to get it running. perhaps git back to the previous versions.


an further analyze has indicated that mf2005 is performing better than mf2000 in terms of handling wetting and drying functions. specifically when WETDRY is positive, meaning cells from all directions can make the dry cell rewetted, mf2005 is able to deliver nice results while mf2000 can not get converged.



 *** ERROR OPENING FILE "Q2.HDS" ON UNIT    51
       SPECIFIED FILE STATUS: UNKNOWN
       SPECIFIED FILE FORMAT: BINARY
       SPECIFIED FILE ACCESS: SEQUENTIAL
       SPECIFIED FILE ACTION: READWRITE
  -- STOP EXECUTION (SGWF2BAS7OPEN)

solution:
1. download modflow for unix (
2. in openspec.inc, comment  DATA FORM/'BINARY'/ and uncomment   DATA FORM/'UNFORMATTED'/.
3. make the binary file




mf2kgmg.h: In function ‘MF2KGMG_BIGH’:
mf2kgmg.h:448:29: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
pcgn2.f90:26.6:
  USE PCG_MAIN
      1
Fatal Error: Can't open module file 'pcg_main.mod' for reading at (1): No such file or directory
utl7.f:234.14:
         IF ( LVAL.EQ. .FALSE. ) THEN                                
              1
Error: Logicals at (1) must be compared with .eqv. instead of .eq.
utl7.f:263.14:
         IF ( LVAL.EQ. .FALSE. ) THEN                                
              1
Error: Logicals at (1) must be compared with .eqv. instead of .eq.


(1) improve quiver object
$ grep -r -i --include *.m quiver ~/Projects/mflab/trunk/examples/
/home/chenming/Projects/mflab/trunk/examples/Analytic/GGOR/Analytic04.m:if isphi==0 % if averag seepage from second aquiver is given
/home/chenming/Projects/mflab/trunk/examples/mf2k/Qanats/TafiletMdl/mfiles/mf_analyze.m:%gr.quiver(B,1,'k','power',0.5);
/home/chenming/Projects/mflab/trunk/examples/mf2k/Qanats/TafiletMdl/SCENARIOS/mf_analyze.m:%gr.quiver(B,1,'k','power',0.5);