Last edited [[Timestamp]] = ''' Direct Model Changes ''' = == Introduction == Some modifications and additions are compulsory to integrate the Tangent and Adjoint Module to NEMO. They mainly consist in: * changing subroutines or parameters declaration from Private to Public for: * initialization * re-use * adding a subroutine to save the trajectory * adding parameters * updating namelist == 1 - Non-Linear Trajectory == To evaluate the tangent and/or the adjoint at a time t, some actual parameters of the direct model are needed at the corresponding time t. To fulfill this purpose a subroutine, ''tamtrj_wri'' is added to write the trajectory. It is controlled with one logical parameter: ''ln_trjwri''. The trajectory is saved upon a given frequency "nittrjfrq" only if the logical parameter is set to TRUE. === Subroutine: tam_trj_wri === A new subdirectory is created into /OPA/ named '''TAM'''. The file is '''tamtrj.F90'''. The purpose of this routine is to write to file the model state trajectory for use with 4DVar. It is called in ''opa_model'' routine to initialize tamtrj routine TAM and at in the ''stp'' routine. Currently the following parameters are saved: || '''Parameters''' || '''Associated ccp keys''' || ||emp || || ||emps || || ||un || || ||vn || || ||tn || || ||sn || || ||ta || || ||sa || || ||tb || || ||sb || || ||avmu || || ||avmv || || ||aeiu || lk_traldf_eiv || ||aeiv || lk_traldf_eiv || ||aeiw || lk_traldf_eiv || ||uslp || key_ldfslp || ||vslp || key_ldfslp || ||wslpi || key_ldfslp || ||wslpj || key_ldfslp || ||avs || key_zdfddm || ||strdmp || key_tradmp || ||hmlp || key_tradmp || === Specific management of the initial state === For the initial state of the model, we call the tam_trj_wri in 'step' routine just before the tracer block. We,then, have access to some parameters (tke and sbc for instance) as they are not yet computed in opa (outside 'step'). === Linear Interpollation === For efficiency matters, the whole trajectory is of course not saved. Only a predefined steptime frequency is saved. The frequency ''nittrjfrq'' is controlled by namelist. The intermediate steptime will be estimated in TAM by linear interpollation. === Namelist === Parameters related to the model state saving is controlled by the namelist '''namtam''' with: * ln_trjwri: Logical switch for writing out state trajectory * nittrjfrq: saving frequency of the trajectory == 2 - Routine modification == * '''opa.F90''': * include initilialization of trajectory saving handling (USE tamtrj) * '''step.F90''': * include calls for trajectory saving (CALL tam_trj_wri) * add temporary variables (zta, zsa) to save ta/sa (used as workspace in dynamic block) == 3 - Declaration Changes == The following table describes the change from PRIVATE to PUBLIC of some routines and parameters. || '''Modules''' || '''Routines''' || '''parameters''' || ||dynadv || dyn_adv_ctl || || ||daymod || day_mth || || ||lib_mpp || || mpi_comm_opa || ||par_oce || || jpni,jpnj,jpnij || ||zdftke || tke_rst || || ||eosbn2 || || neos_init|| ||tradmp || cofdis, dtacof, dtacof_zoom || || || || ||strdmp, ttrdmp, resto || ||traqsr || ||nksr, gdsr ||