Structure until now: -------------------- grdchk_main: - save unperturbed cost function fcref = fc - choose an index -> done by equidistant loop do icomp = nbeg, nend, nstep ichknum = (icomp - nbeg)/nstep + 1 - grdchk_loc: determine entry within given field, i.e. 1-dim array, determined by * ctrlvarindex * ncvargrd (ctrlvarindex) * ncvarnrmax (ctrlvarindex) * ncvarrecs (ctrlvarindex) -> determine * icvrec * jtile * itile * layer - grdchk_getxx: get control variable component from file -> only relevant for optimcycle > 0, i.e. when xx_... has values .NE. 0 - grdchk_setxx: * get control variable component (read from file) * add perturbation * write perturbed field back to file - want to reset perturbation component after grad. check