add note 20251001

This commit is contained in:
2025-10-02 14:49:27 +08:00
parent 389fdea5ae
commit 394e8d0d76
4 changed files with 89 additions and 88 deletions

View File

@ -780,7 +780,7 @@
CALL READ_INPUT_FILE
IF ( LPRT ) CALL DEBUG_MSG( '### INVERSE: a READ_INPUT_FILE' )
! Read final iteration number from file
! Read final iteration number from file 先读入当前的迭代情况
OPEN( 65, file = 'ITER' )
READ( 65,*) N_CALC_STOP
READ ( 65,*) N_CALC_TOTAL
@ -802,7 +802,7 @@
IF (LADJ) CALL INIT_SETULB
! Initialize inverse modeling module
CALL INIT_INVERSE
CALL INIT_INVERSE ! 大概就是初始化了反演相关的数组
! Curent iteration
N_CALC = 0
@ -908,7 +908,7 @@
ENDDO
#endif
task = 'START'
task = 'START' ! 初始化当前过程为开始
! Mare array of scaling factors into a vector for optimization
CALL GET_X_FROM_SF
@ -942,7 +942,7 @@
print*, ' done setulb ' , TASK
CALL SAVE_WEAK_CONSTRAINT_FIELDS
CALL SAVE_WEAK_CONSTRAINT_FIELDS ! 如果是弱约束,会先输出一个弱约束场
ELSE
@ -959,55 +959,55 @@
ENDIF
! Force it to continue for FD tests, as cost func or gradients
! may be very small or zero (dkh, 02/11/11)
IF ( LFDTEST ) TASK(1:2) = 'FG'
! may be very small or zero (dkh, 02/11/11) 如果进行有限差分测试,则强制继续进行
IF ( LFDTEST ) TASK(1:2) = 'FG' ! 不对,可能是要避免迭代出结果的情况?
IF ( TASK(1:2) == 'FG' ) THEN
! Iteration diagnostics (zhe 11/28/10)
! Iteration diagnostics (zhe 11/28/10) 迭代诊断的输出
IF ( LITR ) THEN
IF ( N_CALC .GT. 0 ) CALL ITER_CONDITION( N_CALC )
LATF = .FALSE.
ENDIF
! The minimization routine has returned to request the
! function f and gradient g values at the current x
! function f and gradient g values at the current x 让梯度为 0 了
! Update iteration count
! Update iteration count 继续增加迭代次数
N_CALC = N_CALC + 1
! Resent cost function for this iteration
! Resent cost function for this iteration
COST_FUNC = 0.D0
IF ( N_CALC < N_CALC_STOP ) THEN
IF ( N_CALC < N_CALC_STOP ) THEN ! 如果在停止迭代之前,则从硬盘中读取相关数据
WRITE(6,*) 'READING SAVED DATA for N_CALC = ', N_CALC
! Read scaling factor values from disk
! Read scaling factor values from disk 读取缩放因子
CALL GET_SF_FROM_X
CALL DISPLAY_STUFF( 1 )
! Read gradients from disk
! Read gradients from disk 读取梯度结果
CALL READ_GDT_FILE
! Read cost function from disk
! Read cost function from disk 读取代价函数结果
CALL READ_CFN_FILE
! Put adjoints into GRADNT vector
! Put adjoints into GRADNT vector 将伴随放到向量中
CALL GET_GRADNT_FROM_ADJ
!mkeller: read gradients with respect to forcing terms
IF ( DO_WEAK_CONSTRAINT ) CALL READ_GDT_U_FILE
!Save the current adjoint in the finite difference test cell
! Initial conditions test
! Initial conditions test 意思是现在不能进行同时优化初始场和排放的有限差分测试?
IF ( LFDTEST .AND. LICS .AND. LADJ_EMS) THEN
PRINT*, 'WE HAVE A PROBLEM WITH STT_ADJ_FD when LICS &
& LADJ_EMS are both TRUE'
ELSEIF ( LFDTEST .AND. LICS ) THEN
ELSEIF ( LFDTEST .AND. LICS ) THEN ! STT_ADJ_FD 中
STT_ADJ_FD(N_CALC) = ICS_SF_ADJ(IFD,JFD,LFD,NFD)
@ -1049,7 +1049,7 @@
! Return to beginning of loop
ELSEIF ( N_CALC == N_CALC_STOP ) THEN
ELSEIF ( N_CALC == N_CALC_STOP ) THEN ! 达到迭代结束次数,结束迭代
! Done if we are just estimating inverse Hessian (dkh, 01/12/12, adj32_012)
IF ( LINVH ) THEN
@ -1057,20 +1057,20 @@
STOP
ENDIF
! UPDATE THE INITIAL CONDITIONS
! UPDATE THE INITIAL CONDITIONS 如果达到了最终迭代的条件,则更新初始条件
! If we're doing a finite difference test, reset to the orginal
! SF and augment by amount FD_DIFF. Don't use X in this case.
! old:
!IF ( ACTIVE_VARS == 'FDTEST' .AND. N_CALC == 2 ) THEN
! new: now support 2nd order FDTEST (MAKE_SAVE_FILE_2)
! new: now support 2nd order FDTEST (MAKE_SAVE_FILE_2) 做二阶有限差分的
IF ( LFDTEST .AND. N_CALC > 1 ) THEN
CALL SET_SF_FORFD
ELSEIF ( N_CALC == 1 ) THEN
! don't need to call this again ??
! don't need to call this again ?? 的是只做一次就行
!CALL SET_SF
#if defined ( LOG_OPT )
CALL SET_LOG_SF
@ -1080,7 +1080,7 @@
ELSE
! Update the scaling factors to the current X
! Update the scaling factors to the current X 更新缩放系数
CALL GET_SF_FROM_X
ENDIF
@ -1094,12 +1094,12 @@
!CALL READ_SF_FILE
!==============================================================
! FORWARD RUN
! FORWARD RUN 怎么又做了一次正向模拟
!==============================================================
CALL DO_GEOS_CHEM
!==============================================================
! ADJOINT CALCULATION
! ADJOINT CALCULATION 然后又做了一次伴随
!==============================================================
! For weak constraint 4D-Var (mkeller, 06/15)
@ -1109,7 +1109,7 @@
CALL DO_GEOS_CHEM_ADJ
! For finite difference test, we may or may not do adjoint
! For finite difference test, we may or may not do adjoint 哈哈哈哈哈哈哈笑死MAYBE_DO
ELSE
CALL MAYBE_DO_GEOS_CHEM_ADJ
@ -1117,31 +1117,31 @@
ENDIF
!==============================================================
! SAVE RESULTS TO DISK and EXIT OPTIMIZATION LOOP
! SAVE RESULTS TO DISK and EXIT OPTIMIZATION LOOP ,然后退出最优化循环
!==============================================================
! Zero the gradients of the species that we do not wish to optimize
! or in places that you don't want optimized
! or in places that you don't want optimized 为 0
CALL SET_OPT_RANGE
! Add to this Kumaresh's spatial filter
! Write gradients
! Write gradients 写入梯度文件
CALL MAKE_GDT_FILE
! Write scaling factors
! Write scaling factors 写入缩放因子
CALL MAKE_SF_FILE
! Write cost function
! Write cost function 写入代价函数
CALL MAKE_CFN_FILE
! For weak constraint 4D-Var (mkeller, 06/15)
! For weak constraint 4D-Var (mkeller, 06/15) 写入弱约束项
IF ( DO_WEAK_CONSTRAINT ) CALL MAKE_GDT_U_FILE
! mkeller: create HDF5 file for satellite diagnostics output
! mkeller: create HDF5 file for satellite diagnostics output 写入卫星诊断输出
IF ( LSAT_HDF_L2 .OR. LSAT_HDF_L3 .OR. LDCOSAT )
& CALL DO_SAT_DIAGS()
IF ( LEMS_ABS ) CALL MAKE_EMS_ADJ_FILE
IF ( LEMS_ABS ) CALL MAKE_EMS_ADJ_FILE ! 写入排放文件
! Write results to screen
CALL DISPLAY_STUFF( 4 )
@ -1164,7 +1164,7 @@
ELSE
! We terminate execution when TASK is neither FG nor NEW_X.
! We terminate execution when TASK is neither FG nor NEW_X. 好像明白了 FG 是什么,最终迭代么
! We print the information contained in the string TASK
! if the default output is not used and the execution is
! not stopped intentionally by the user.
@ -1179,7 +1179,7 @@
ENDIF
!=================================================================
! OPTIMIZATION loop ends here!
! OPTIMIZATION loop ends here! 结束最优化的过程
!=================================================================
ENDDO
WRITE( 6, '(a)' ) REPEAT( '=', 79 )
@ -1206,7 +1206,7 @@
ENDIF
#endif
! Clean up and quit
! Clean up and quit 清除一些中间文件
CALL CLOSE_FILES
CALL CLEANUP
CALL CLEANUP_ADJ
@ -1214,7 +1214,7 @@
! For weak constraint 4D-Var (mkeller, 06/15)
IF ( DO_WEAK_CONSTRAINT ) CALL CLEAN_WEAK_CONSTRAINT
! Remove all met files from temporary directory
! Remove all met files from temporary directory 清除气象场文件
IF ( LUNZIP ) THEN
CALL UNZIP_A3_FIELDS( 'remove all' )
CALL UNZIP_A6_FIELDS( 'remove all' )
@ -1231,7 +1231,7 @@
ENDIF
! Write the final iteration number for the next iteration to file
! Write the final iteration number for the next iteration to file 写入迭代文件的信息
OPEN( 65, file = 'ITER' )
WRITE( 65,*) N_CALC_STOP + 1
CLOSE( 65 )