====================== TODO ======================= 2017-05-29 Name lookup case-insensitive maken? 2017-05-25 In xbeach_bmi: update. Wanneer 0 of een klein getal (3) wordt gespecificeerd voor de dt parameter: xbeach meldt dat de timestep explodeert en stopt. Het zou handig zijn toch een kleine dt te kunnen invoeren om de processen te synchroniseren. 2017-05-23 in params.F90, struct is defined. This name will be incorporated in the netcdf file. When running ncdump, and ncgen, using the dump file, an error is reported: the name struct is not allowed. Suggest to change the name of the variable into 'hardstruct'. 2017-05-15 in boundarycondtions, tegen het eind van wave_bc: #ifdef USEMPI call space_distribute ... ... #else ... s%ui(1,:) = uig s%zi(1,:) = zig s%wi(1,:) = wig s%dui(1,:) = duig #endif betekent dat in het mpi geval s%ui(1,:) nergens wordt gezet. Stel voor iets te doen met if (manage_lowx) then ... s%ui(1,:) = uig ... endif 2017-05-05 in initialize.F90: line 238 ev. zb wordt aangepast. De vorige zb is echter al naar proces 0 verstuurd. is dat ok? 2016-11-27 in spaceparams.F90, subroutine ranges_init: imin_uu is always 2 Is that correct? 2016-11-21 in flow_secondorder.F90 imin = 1 if (xmpi_islowx) then imin = 2 endif also for jmin, imax, jmax. Is this correct? I would think the opposite: imin = 2 if (xmpi_islowx) then imin = 1 endif but, perhaps line 582: if (xmpi_islowx) then wrk(1,:) = 0.0d0 endif explains it wave_instationary.F90 it seems that an if (manage_highx) is missing at the end of the file 2016-09-28 It seems that the 'toall' parameter of space_distribute is never used. So it would be better to remove some code. 2016-09-02 change template names in templates from x.f90 to x.tmpl or something like that, to avoid confusion with real fortran 90 codes. Also, these .f90 files are not valid fortran, you cannot compile them. The file variables.f90 should also be renamed: it is not compiled, and cannot be compiled: it is not valid fortran 90. 2016-09-28 Make the 'cyclic' parameter also work in the serial case. Should be possible by removing '#ifdef USEMPI' in the source and adapting some shift routines in xmpi.F90, to take care of the serial case. ==================== DONE ================================ 2017-12-22 Autoconf aangepakt. Direct gebruik van MPI zaken: MPI_Send, Bcast, MPI_MIn etc vervangen door xmpi_send etc, waardoor 'use mpi' alleen nog maar in xmpi.F90 en general_mpi.F90 voorkomt. 2017-12-06 version.def verhuisd naar templates als version.inc . make distcheck werkt nu en produceert een keurige tarball. De .inc files worden in bootstrap gegenereerd in src/xbeachlibrary . generate.py wordt nu alleen aangeroepen als er een verandering in templates wordt aangebracht. Na een update van bijvoorbeeld templates/get_var.f90 wordt automatisch een nieuwe get_var.inc geproduceerd met generate.py. Dus, voor de developer om een werkende versie te creeren: ./bootstrap Om een tarball te maken: mkdir build cd build export DISTCHECK_CONFIGURE_FLAGS='--with-mpi --with-netcdf --with-makedepo' export FCFLAGS='-O0 -I/usr/include' # -O0 : om het proces te versnellen # -I/usr/include : voor de netcdf.mod file ../configure --with-makedepo make distcheck -j4 Voor de gebruiker: svn co ..... #check out xbeach of tar xf xbeach...tar.gz # pak de tarball uit cd ..... # cd naar de uitgecheckte of uitgepakte directory mkdir build cd build export FCFLAGS='-I/usr/include' ../configure --prefix=$HOME --with-makedepo --with-mpi --with-netcdf make -j4 make install 2017-05-15 in wavedirections.F90: dtw=.5*minval(s%dsu(i:i+1,jmin_ee: ... dtw=min(dtw,.5*minval(s%dnv(i,jmin ... dtw=min(dtw,.5*s%dtheta/max(1.0d-6, ... de eerste twee regels uitgecomment, gaven een deling door 0, en zijn overbodig regel ca. 480: Herr=maxval(abs(Hprev(jmin_ee:jmax_ee)-s%H(i,jmin_ee:jmax_ee)),mask=s%wete(i,:)==1) veranderd in Herr=maxval(abs(Hprev(jmin_ee:jmax_ee)-s%H(i,jmin_ee:jmax_ee)),mask=s%wete(i,jmin_ee:jmax_ee)==1) ca regel 200: Er treedt een deling door 0 op. Het blijkt dat er 0 elementen in sinh2kh zitten. "opgelost" door where(sinh2kh .eq. 0) sinh2kh = 3000.d0 endwhere 2017-05-12 regel 221 in roelvink.F90: s%Qb(i,:) = 1 + 4/(3*sqrt(par%px)) * (R**3 + 3/2*R) * exp(-R**2) - xerf(R) veranderd in: s%Qb(i,:) = 1 + 4/(3*sqrt(par%px)) * (R**3 + 1.5d0*R) * exp(-R**2) - xerf(R) 2017-05-11 bmi is working now also for the parallel version. started the process to add 'private' to modules and make things explicitely public, and to use the 'only:' flag in the use statements. xmpi_module has now explicit public statements and a private statement. Files which contain 'use xmpi_module' are adapted to name only the things really used. Why? It becomes difficult to find where a thing is defined. Using the 'only:' concept, it is easy to find where something is defined. 2017-03-29 correct comment in distribution routines in general_mpi.F90 distribution is done with root (0) as source, and distribution is also done to the root process. Made code for matrix_distr_real8/integer more healthy looking by creating an internal subroutine in stead of plain code (see templates/genmpi_distr.f90) 2017-03-25 in general_mpi.F90: isleft, isright, istop, isbot are defined and used. Also in templates/genmpi_coll.f90 libxbeach.F90 spaceparamsdef.F90 spaceparams.F90 The following name changes are in order: isleft -> islowy isright -> ishighy isbot -> ishighx istop -> islowx and also some names and comments containing 'left' 'right' 'bot' 'bottom' 'top' 2017-03-11 Synced with trunk 5118 2017-03-03 11:10:11 remove unused declarations in compute_tide_zs0.F90 flow_timestep.F90 initialize.F90 2016-11-27 Changed code in spaceparams.F90, subroutine ranges_init, to make it more readable 2016-11-21 morphevolution.F90 probable bug: line 476: if (xmpi_istop) should be: if (xmpi_isbot) nonh.F90 Wm(1,:) = Wm(2,:) should be: Wm(:,1) = Wm(:,2) 2016-10-28 using mako, implemented other distribute_par in params.F90 template file is dispar.f90 added template to bcast arrays of strings in smpi.F90 2016-10-27 changed xmpi_(is)left into xmpi_(is)lowy xmpi_(is)right into xmpi_(is)highy xmpi_(is)bot into xmpi_(is)highx xmpi_(is)top into xmpi_(is)lowx adapted comments in xmpi.F90 removed unused private declarations from bedroughness.F90 and readkey.F90 better #ifdef in xmpi.F90 to determine if gnu compiler is able to do backtrace. added code in params.F90 to read in inner_lowx, inner_highx, inner_lowy, inner_highy inner = 1 sets all for to 1 2016-09-28 Fixed error in initialize.F90. change s%ntheta to s%ntheta_s in the following lines: else s%dtheta_s=2*par%px s%ntheta_s=0 allocate(s%theta_s(1:s%ntheta)) allocate(s%thet_s(1:s%nx+1,1:s%ny+1,1:s%ntheta)) allocate(s%costh_s(1:s%nx+1,1:s%ny+1,1:s%ntheta)) allocate(s%sinth_s(1:s%nx+1,1:s%ny+1,1:s%ntheta)) endif 2016-09-01 investigate if it is possible to put #ifdef USEMPI #endif in xmpi.F90, so that these macros are not needed in the xbach code. For example: subroutine xmpi_shift_r2(x,direction) implicit none real*8,dimension(:,:),intent(inout) :: x character(len=*),intent(in) :: direction #ifdef USEMPI the parallel code #endif end subroutine xmpi_shift_r2 So, in the serial case, these subroutines would be empty stubs. #2016-09-21 #removed s.inp and s.ind and all references (all were commented out, # of course) ======= Done. #2016-09-05 # ncoutput.F90: initialize xpii and ypii ca. line 964 # vsm_u_XB.f90: change singe precision constants into double # end change eg x**6. into x**6 # initialized some possibly not-initialized variables: difstok, delta, # Qwe, dhdy, dhdx # readkey.F90: initialize variable lines ca. line 1028 #2016-09-04 #added par%morfac = 1 in params.F90 to use as default value #added call to outputext() in xbeach_bmi.F90 to get netcdf output # from runs #2016-09-02 #changed generate.py: it can now take one or more parameters, like # python generate.py x.f90 y.f90 #generate.py will recreate x.inc and y.inc #Adapted Makefile.am to take advantage of that: if a #template is changed, the corresponding include file is #regenerated. When using makedepo or makedepon, this will #result in an automatic recompilation of the dependent sources. #2016-09-02 #makedepo takes only visible includefiles in consideration. #Adapted Makefile.am for this. #2016-09-01 #in morphevolution.F90: in a few places, the following code is used: #u(s%nx+1,:)=u(s%nx,:) #v(:,s%ny+1)=v(:,s%ny) #Added xmpi_shift to make sure that these rows or columns #are copied from neighbour if possible, like: ##ifdef USEMPI # call xmpi_shift(u,'m:') # call xmpi_shift(v,':m') ##endif # #2016-08-31 #in morphevolution.F90 (ca line 200+): last rows of ueu_sed and # veu_sed were not filled in. Corrected by: # ueu_sed(s%nx+1,:) = 0 # veu_sed(s%nx+1,:) = 0 #2016-08-30 #in trunk is veranderd: U src/xbeachlibrary/wave_functions.F90 U src/xbeachlibrary/initialize.F90 U src/xbeachlibrary/ncoutput.F90 U src/xbeachlibrary/xbeachlibrary.vfproj U src/xbeachlibrary/morphevolution.F90 U src/xbeachlibrary/params.F90 U src/xbeachlibrary/variables.f90 U src/xbeachlibrary/flow_timestep.F90 added: vsm_u_XB.f90 # #2016-08-27 #valgrind notices over-indexing an array in iso_c_utils.f90 #This is caused by not allocating space for the extra null byte #at the end of a c-string in introspection.F90. #Also some other minor points in introspection.F90. #This is corrected, here the diffs: :=-> svn diff iso_c_utils.f90 Index: iso_c_utils.f90 =================================================================== --- iso_c_utils.f90 (revision 74) +++ iso_c_utils.f90 (working copy) @@ -20,7 +20,6 @@ end do end function strlen - integer(c_int) pure function strcmp(char_array1, char_array2) character(c_char), intent(in) :: char_array1(MAXSTRINGLEN) character(c_char), intent(in) :: char_array2(MAXSTRINGLEN) @@ -59,14 +58,13 @@ end function char_array_to_string pure function string_to_char_array(string) result(char_array) - ! pass only trimmed strings to this one character(len=*), intent(in) :: string character(kind=c_char,len=1) :: char_array(MAXSTRINGLEN) integer :: i - do i = 1, len(string) + do i = 1, len_trim(string) char_array(i) = string(i:i) enddo - char_array(len(string)+1) = C_NULL_CHAR + char_array(len_trim(string)+1) = C_NULL_CHAR end function string_to_char_array end module iso_c_utils :=-> svn diff introspection.F90 Index: introspection.F90 =================================================================== --- introspection.F90 (revision 74) +++ introspection.F90 (working copy) @@ -61,6 +61,10 @@ module procedure get3ddoublearray_fortran end interface get3ddoublearray + interface get4ddoublearray + module procedure get4ddoublearray_fortran + end interface get4ddoublearray + interface get0dintarray module procedure get0dintarray_fortran end interface get0dintarray @@ -139,11 +143,12 @@ integer(c_int) function getparametername_fortran(index, name) integer(c_int), intent(in) :: index character(kind=c_char, len=*), intent(out) :: name - character(kind=c_char, len=1), pointer :: cname(:) + character(kind=c_char, len=1) :: cname(slen) integer :: length getparametername_fortran = getparametername_c(index, cname, length) name = char_array_to_string(cname) + end function getparametername_fortran @@ -157,9 +162,9 @@ getparametername_c = -1 ! These are the keys in fortran format. call getkeys(par, keys) - ! We need to conver them to C format (char1's) + ! We need to convert them to C format (char1's) key = keys(index) - length = len(trim(key)) + length = len_trim(key) name = string_to_char_array(key) getparametername_c = 0 end function getparametername_c @@ -173,11 +178,13 @@ character(kind=c_char,len=*),intent(in) :: name ! Transform name to a fortran character... - character(1), dimension(len(name)) :: cname + ! and add a 0 at the end... + character(1), dimension(len(name)+1) :: cname integer :: i - do i = 1,len(name) + do i = 1,len_trim(name) cname(i) = name(i:i) enddo + cname(len_trim(name)+1) = C_NULL_CHAR getdoubleparameter_fortran = getdoubleparameter_c(cname,value,len(name)) end function getdoubleparameter_fortran @@ -215,11 +222,12 @@ character(kind=c_char,len=*),intent(in) :: name ! Transform name to a fortran character... - character(1), dimension(len(name)) :: myname + character(1), dimension(len(name)+1) :: myname integer :: i - do i = 1,len(name) + do i = 1,len_trim(name) myname(i) = name(i:i) enddo + myname(len_trim(name)+1) = C_NULL_CHAR setdoubleparameter_fortran = setdoubleparameter_c(myname,value,len(name)) end function setdoubleparameter_fortran @@ -259,11 +267,12 @@ character(kind=c_char,len=*),intent(in) :: name ! Transform name to a fortran character... - character(1), dimension(len(name)) :: myname + character(1), dimension(len(name)+1) :: myname integer :: i do i = 1,len(name) myname(i) = name(i:i) enddo + myname(len(name)+1) = C_NULL_CHAR getintparameter_fortran = getintparameter_c(myname,value,len(name)) end function getintparameter_fortran @@ -310,7 +319,7 @@ ! Lookup the parameter by name getcharparameter_c = getkey(par, fname, myparam) if (getcharparameter_c .eq. -1) return - valuelength = len(trim(myparam%c0)) + valuelength = len_trim(myparam%c0) value = string_to_char_array(trim(myparam%c0)) getcharparameter_c = 0 end function getcharparameter_c @@ -326,7 +335,7 @@ integer(c_int) function getarrayname_fortran(index, name) integer(c_int), intent(in) :: index character(kind=c_char, len=*), intent(out) :: name - character(kind=c_char, len=1), pointer :: cname(:) + character(kind=c_char, len=1) :: cname(MAXSTRINGLEN) integer :: length getarrayname_fortran = getarrayname_c(index, cname, length) @@ -348,7 +357,7 @@ call indextos(s,index,array) ! We need to conver them to C format (char1's) key = array%name - length = len(trim(key)) + length = len_trim(key) name = string_to_char_array(key) getarrayname_c = 0 end function getarrayname_c @@ -360,7 +369,7 @@ ! and we need the string length .... integer(c_int) :: length - character(1), dimension(len(name)) :: cname + character(1), dimension(len(name)+1) :: cname length = len(name) cname = string_to_char_array(name) getarraytype_fortran = getarraytype_c(cname, typecode, length) @@ -378,6 +387,7 @@ getarraytype_c = -1 index = chartoindex(key) if (index .eq. -1) return + getarraytype_c = 0 call indextos(s,index,array) typecode = array%type end function getarraytype_c @@ -409,6 +419,7 @@ if (index .eq. -1) return call indextos(s,index,array) rank = array%rank + getarrayrank_c = 0 end function getarrayrank_c # # #2016-08-26 #valgrind shows that running nested_run/local, s%cfu is not #initialized. Fixed this by setting it to zero, along with #s%cfv in initialize.F90 # #valgrind shows that pbbedu is not initialized in morphevolution.F90 #Initialization loop is i=1,s%nx . i=s%nx+1 is untouched. #Same for pbbedv, but now s%ny #Fixed by setting untouched row/column to zero # #2016-08-25 # argument of sinh too large running 'local' from nested_run_zip # in morphevolution.F90: # detadxmax(i,j) = dudtmax*sinh(s%k(i,j)*s%hh(i,j))/max(max(s%c(i,j),sqrt(s%H(i,j)*par%g)),1d-10)/s%sigm(i,j) # the same argument for sinh is used a few lines later. # solved by: # khh = s%k(i,j)*s%hh(i,j) # if (abs(khh) > 50.0d0) khh=sign(50.0d0,khh) # and use khh as argument for sinh() # sinh(50) = 2.59235273E+21 # The culprit was hh(1,197): value 354.869 # # #2016-08-24 # the nested_run.zip I got from Dano crashed in line 272 # of wave_instationary.F90: # # s%ctheta(i,j,itheta)= & # s%sigm(i,j)/sinh2kh(i,j)*(dhdx(i,j)*sn-dhdy(i,j)*cs) + par%wci* & # ( cs*(sn*dudx(i,j) - cs*dudy(i,j)) + & # sn*(sn*dvdx(i,j) - cs*dvdy(i,j)) ) # #It appeared that sinh2kh(i,j) = 0 for i and j somewhere in between. #Resolved by adding: # # where(abs(sinh2kh) < 1.0d-10) ! added by wwvv # sinh2kh = 1.0d-10 # endwhere # # #long compile times for spaceparams.F90 and xbeach_bmi.F90 # solved using # --with-no_opt parameter for configure # spaceparams and xbeach_bmi do not need optimization # #conditional use of makedepo # --with-makedepo # can always be used: faster rebuild and automatic # dependencies plus parallel make possible # --with-makedepon # for ifort and gfortran: # idem plus: # ifort: faster, more parallel build # gfortran: idem plus build superfast rebuild #in src/xbeach/Makefile.am: # 2x $(builddir) vervangen door $(abs_builddir) ? #makedepo gebeuren ook in src/beach #test tegelijk specificeren --with-makedepo en --with-makedepon # # boundaryconditions.F90 # orig: (6 times) # m1 = s%pdisch(i,1) # new: # m1 = int(s%pdisch(i,1)) # # interp.F90: remove tabs # # libxbeach.F90: # orig: # #if 0 # new: # #if printsummary # # remove par parameter from call to space_alloc_arrays_dummies # remove parameters fro call to output_error # # logging.F90: # make definition of parameters t0 and t01 dependent on USEMPI # # ncoutput.F90: # definition of maxnamelen in #ifdef USEMPI block # add: line 846 # else # allocate(pointoutputs(0,0)) # add: line 1045 # else # allocate(runups(0,0)) ! wwvv just to convince the compiler these are available # ! later on # allocate(pointoutputs(0,0)) # # output.F90: # remove parameters fro output_error # # params.F90: # remove unused variables # # postprocess.F90: # line 278, 383: trivial change in logic # # readkey.F90: # # remove unused variables # remove tabs # # ship.F90: # ifdef USEMPI around logical toall # # spacecollect.F90: # added parameter force (needed with bmi) # corrected some indenting # # timestep.F90: # added j=0 to prevent warning # # vegetation.F90: # added totT = 0 to prevent warning # line 596: # orig: # n = size(y)-1.d0 # new: # n = int(size(y)-1.d0) # # wavedirections.F90: # removed save in some declarations, is already present in module # # waveparamsnew.F90: # removed save in some declarations, is already present in module # removed unused variables # # xmpi.F90: # removed tabs # USEMPI block around # integer ierr # # iso_c_utils.f90: # removed unused variables # xbeach_bmi.f90: # renamed to xbeach_bmi.F90 # adaptations in use of generated code # # templates/get_var.f90: # removed subroutine definition # # templates/mnemonic.f90: # slen -> maxnamelen # # templates/set_var.f90: # removed subroutine definition # # scripts/generate.py: # orig: # with open(os.path.join(srcdir, filename), 'w') as f: # new: # with open(filename, 'w') as f: # orig: # json.dump(jsondata, open(os.path.join(srcdir, 'extractedvariables.json'), 'w'), indent=4) # new: # json.dump(jsondata, open('extractedvariables.json', 'w'), indent=4) # this was needed for builds outside source tree #