PV control variable code changes for ticket number 381

VarProg_CovPFstats

VarProg_CovPFstats.f90
  • USE variable PVcvScheme, line 133.
  • INCLUDE Var_LSVtheta, line 210.
  • INCLUDE Var_FillLSzm, line 211.
  • INCLUDE Var_AllocateLSzm, line 212.
  • INCLUDE Var_DeAllocateLSzm, line 213.
  • Add code to compute zonal mean linearisation states, line 480.
  • Add optional LSzmDealloc flag in call to Var_LSDeallocate to deallocate LSzm structure, lines 625, 693.
23/10/06

VarProg_AnalysePF

VarProg_AnalysePF.f90
  • USE variable PVcvScheme from VarMod_TransformInfo, line 188.
  • INCLUDE Var_LSVtheta, line 296.
  • INCLUDE Var_FillLSzm, line 297.
  • INCLUDE Var_AllocateLSzm, line 298.
  • Declare LocalFS and set to FieldStatus_global, line 357.
  • Add code to call Var_LSVtheta, Var_AllocateLSzm Var_FillLSzm and Var_LSDeallocate if PVcvScheme is switched on, lines 498 to 513.
  • Add optional LSzmDealloc flag in call to Var_LSDeallocate to deallocate LSzm structure, lines 844, 1341.
  • Add PVcvScheme in call to Var_Utransforms, line 991.
09/11/06, 01/02/07

VarMod_TransformInfo

VarMod_TransformInfo.f90
  • Declare logical variable PVcvScheme, line 271.
  • Declare logical variable LZzmMeanOption, line 275.
  • Declare integer variable LSzmIsoThermLevs, line 279.
  • Declare integer variable PV_GCR_restart_bal, line 284.
  • Declare integer variable PV_GCR_restart_unbal, line 285.
  • Declare integer variable PV_GCR_maxiter_bal, line 286.
  • Declare integer variable PV_GCR_maxiter_unbal, line 287.
  • Declare integer variable PV_GCR_diagnostics, line 288.
  • Declare real variable PV_GCR_Error_Tolerance, line 291.
  • Declare real variable PV_GCR_Abs_Tolerance, line 292.
  • Declare logical variable PV_GCR_use_Abs_Tol, line 293.
  • Declare logical variable PV_GCR_use_residual_Tol, line 294.
  • Declare integer variable PV_GCR_precon_option_bal, line 295.
  • Declare integer variable PV_GCR_precon_option_unbal, line 296.
  • Declare real variable PV_GCR_ADI_Mu_bal, line 299.
  • Declare real variable PV_GCR_ADI_Mu_unbal, line 300.
  • Declare integer variable PV_GCR_ADI_loops_bal, line 301.
  • Declare integer variable PV_GCR_ADI_loops_unbal, line 302.
  • Declare logical variable PV_GCR_MassWt_bal, line 303.
  • Declare logical variable PV_GCR_MassWt_unbal, line 304.
  • Add PVcvScheme, LZzmMeanOption, LSzmIsoThermLevs, PV_GCR_restart_bal, PV_GCR_restart_unbal, PV_GCR_maxiter_bal,PV_GCR_maxiter_unbal, PV_GCR_diagnostics, PV_GCR_Error_Tolerance, PV_GCR_Abs_Tolerance, PV_GCR_use_Abs_Tol, PV_GCR_use_residual_Tol, PV_GCR_precon_option_bal, PV_GCR_precon_option_unbal, PV_GCR_ADI_Mu_bal, PV_GCR_ADI_Mu_unbal, PV_GCR_ADI_loops_bal, PV_GCR_ADI_loops_unbal, PV_GCR_MassWt_bal, and PV_GCR_MassWt_unbal to namelist, line 704.
18/10/06

VarMod_LS

VarMod_LS.f90
  • Add new data type LSzm.
  • Definition, line 69.
  • Declaration inside LS_type, line 232.
20/10/06
Var_LSAllocate.f90
  • USE variable PVcvScheme, line 56.
  • INCLUDE Var_AllocateLSzm, line 64.
  • Add routine to call Var_AllocateLSzm, line 401.
20/10/06
Var_LSDeallocate.f90
  • Add optional logical parameter LSzmDealloc, line 3.
  • USE variable PVcvScheme, line 54.
  • INCLUDE Var_DeAllocateLSzm, line 61.
  • Declare LSzmDealloc, line 67.
  • Declare LSzmDealloc_local, line 75.
  • Allow for presence or non presence of LSzmDealloc, line 83.
  • Add routine to call Var_DeAllocateLSzm, line 518.
20/10/06
Var_AllocateLSzm.f90 NEW
  • Allocation of LSzm structure.
20/10/06
Var_DeAllocateLSzm.f90 NEW
  • Deallocation of LSzm structure.
20/10/06
Var_CancelLSzm.f90 NEW
  • Set 'calc' flags on each LSzm field to false to indicate that the zonal means are not calculated.
20/10/06
Var_FillLSzm.f90 NEW
  • Calculate LS zonal means from LS.
20/10/06
Var_ZonalMean.f90 NEW
  • Do zonal (or global) means, as required for LSzm fields.
20/10/06
Var_ZMSmoother.f90 NEW
  • Do 3-2-1 smoother in latitude (done after zonal mean of LS).
20/10/06
Var_ShowZM.f90 NEW
  • Print-out zonal means from each LSzm variable. Calls Var_ShowZM.
23/10/06
Var_ShowZM1.f90 NEW
  • Print-out zonal means for a given LSzm variable. Calls Var_ShowZM.
23/10/06

VarMod_Transforms

Var_InitTransforms.f90
  • USE variable FieldStatus_absent, line 54.
  • USE variable StatusFatal, line 58.
  • USE variable PVcvScheme, line 84.
  • INCLUDE Var_FillLSzm, line 120.
  • CALL Var_FillLSzm, line 317, including possibility of terminating program if LS % Vtheta is not precalculated.
23/10/06, 15/12/06.
I have commented-out these changes, as I am not sure if they are needed, 18/04/07. CHANGES NOW DELETED, 30/04/07.
Var_Transform_Test.f90
  • USE variable PVcvScheme, line 137.
  • Don't do inverse tests if using PV-based transforms (it takes FAR too long for a routine assimilation run), add IF lines 964-967, END IF, line 1120 and IF, lines 1125-1128 and END IF, line 1337.
  • Call extra Var_Utransform if PV scheme used to create a state PF2 which is needed by the adjoint test section, lines 1340-1350.
09/01/07
Var_Transform_Test_2.f90
  • USE PVcvScheme, line 76.
  • Add optional PV diagnostics parameter in call to Var_TpTransform, line 143.
  • Add optional PV diagnostics parameter in call to Var_UpTransform, line 232.
10/01/07
Var_Utransform.f90
  • Add optional argument PV_Diagnostics, line 9.
  • Declare PV_Diagnostics, line 104.
  • Declare local variable PV_Diagnostics1, line 122.
  • Set value of PV_Diagnostics1, lines 129-133.
  • Add PV_Diagnostics1 in call to Var_UpTransform, lines 228.
01/02/07
Var_Utransforms.f90
  • Add optional argument PV_Diagnostics, line 8.
  • Declare PV_Diagnostics, line 81.
  • Declare local variable PV_Diagnostics1, line 93.
  • Set value of PV_Diagnostics1, lines 99-103.
  • Add PV_Diagnostics1 in call to Var_Utransform, lines 117.
01/02/07

VarMod_Vp

Var_VpPsi_B.f90 NEW
  • Calculation of balanced streamfunction by PV inversion.
18/10/06
Var_VpPr_UnB.f90 NEW
  • Calculation of unbalanced pressure by antiPV inversion.
25/10/06

VarMod_TpTransform

Var_TpTransform.f90
  • Add optional argument PV_Residuals, line 9.
  • USE variable PVcvScheme, line 109.
  • INCLUDE Var_VpPsi_B, line 131.
  • INCLUDE Var_VpPr_UnB, line 132.
  • Declare parameter PV_Residuals, line 141.
  • Declare variable PV_Residuals1, line 157.
  • Set value of PV_Residuals1, lines 171-175.
  • Corrected message section numbers passed to Gen_Trace.
  • Add call to Var_VpPsi_B if PVcvScheme switch is set, line 217.
  • Add call to Var_VpPr_UnB if PVcvScheme switch is set, line 277.
24/10/06, 10/01/07
Var_CalcPVlszm.f90 NEW
  • Calculation of PV increment from PF (or equivalent) fields.
24/10/06
Var_Regression.f90 NEW
  • To do vertical regression (to remove small vertical modes from first guess streamfunction). This has been removed, 01/05/07.
24/10/06
Var_CalcAntiPVlszm.f90 NEW
  • Calculation of anti-PV increment from PF (or equivalent) fields.
25/10/06
Var_GCR_k_PV.f90 NEW
  • GCR solver tailored to the PV problem.
25/10/06
Var_PVscheme_Operator.f90 NEW
  • Calculates either PV or anti-PV.
26/10/06
Var_PVscheme_Precon.f90 NEW
  • Performs crude inverse PV or anti-PV operators with varying degrees of approximation. Options include the identity matrix (ie no preconditioning), diagonal inverse (diagonal preconditioning), vertical inverse (vertical-only preconditioning) and an iterative approximate inverse (ADI preconditioning).
26/10/06
Var_PVscheme_Precon_Setup.f90 NEW
  • Initialises structures necessary to perform preconditioning.
26/10/06
Var_GCR_PV_Abs_Print.f90 NEW
  • Diagnostic print of absolute error norms (for use in PV GCR solver).
26/10/06
Var_GCR_PV_Calc_Abs_Norm.f90 NEW
  • Calculate maximum value of error over all processors (for use in PV GCR solver).
26/10/06
Var_GCR_PV_Error_Print.f90 NEW
  • Diagnostic print of residual error norms (for use in PV GCR solver).
26/10/06
Var_GCR_PV_Two_Norm.f90 NEW
  • Calculates the two norm of the input field divided by the number of points in the field - no mass weighting (for use in PV GCR solver).
26/10/06
Var_GCR_PV_Two_Norm_MassWt.f90 NEW
  • Calculates the two norm of the input field divided by the number of points in the field - with mass weighting (for use in PV GCR solver).
26/10/06
Var_GCR_PV_Coefficient_MassWt.f90 NEW
  • Calculates inner products - with mass weighting (for use in PV GCR solver).
26/10/06
Var_GCR_PV_Coefficient.f90 NEW
  • Calculates inner products - no mass weighting (for use in PV GCR solver).
26/10/06

VarMod_Transform_p

Var_InitTransform_p.f90
  • USE variable PVcvScheme, line 42.
  • Specify Ap halos of 1 (1 is set for psi) if using PV scheme, line 75.
15/11/06

VarMod_UpPF

Var_UpPF_Balp_lszm.f90 NEW
  • Calculation of balanced pressure on psi-points and using a zonal mean linearisation state.
30/10/06
Var_UpPF_Unbalpsi_lszm.f90 NEW
  • Calculation of unbalanced streamfunction on p-points and using a zonal mean linearisation state.
30/10/06
Var_UpPFu_v.f90
  • Change arguments from Vp to Psi, Chi fields and their headers, line 6.
  • Use Header_type from VarMod_PFInfo , line 57.
  • Removed Vp_type from VarMod_TransformInfo, line 63.
  • Change declaration of arguments, line 80.
  • Change Vp % psi to Psi and Vp % chi to Chi, lines 146, 147, 152, 153, 165, 166, 171, 172.
31/10/06
Var_UpPFHp.f90
  • Add optional argument PV_Diagnostics, line 8.
  • USE FieldsOutput, lines 39-40.
  • USE Vp_header from VarMod_TransformInfo , line 60.
  • USE PVcvScheme from VarMod_TransformInfo, line 62.
  • INCLUDE Var_UpPF_Balp_lszm, line 72.
  • INCLUDE Var_FieldOutput, line 73.
  • Declare PV_Diagnostics, line 81.
  • Declare integer x and y loop variables, line 99.
  • Declare p_psi, allocatable real array, line 100.
  • Declare PV_Diagnostics1, line 101.
  • Set value of PV_Diagnostics1, lines 109-113.
  • Modify code to allow PV scheme (including CALL Var_UpPF_Balp_lszm if using PV scheme), lines 140-195.
  • Output optional balanced and unbalanced pressures, lines 197-205.
31/10/06

VarMod_UpPF_Adj

Var_UpPF_Balp_lszm_Adj.f90 NEW
  • Adjoint of Var_UpPF_Balp_lszm.
01/11/06
Var_UpPF_Unbalpsi_lszm_Adj.f90 NEW
  • Adjoint of Var_UpPF_Unbalpsi_lszm.
01/11/06
Var_UpPFu_v_Adj.f90
  • Change arguments from Vp_hat to Psi_hat, Chi_hat and their headers, line 6.
  • Use Header_type from VarMod_PFInfo , line 54.
  • Removed Vp_type from VarMod_TransformInfo, line 63.
  • Change declaration of arguments, line 89.
  • Change Vp_hat % psi to Psi_hat and Vp_hat % chi to Chi_hat, lines 352, 355, 361, 364, 377, 380, 386, 389.
01/11/06
Var_UpPFHp_Adj.f90
  • USE Vp_header from VarMod_TransformInfo , line 52.
  • USE PVcvScheme from VarMod_TransformInfo, line 54.
  • INCLUDE Var_UpPF_Balp_lszm_Adj, line 73.
  • Declare integer x, y, lowz and topz variables, line 96.
  • Declare p_psi_adj, allocatable real array, line 97.
  • CALL Var_UpPF_Balp_lszm_Adj if using PV scheme, line 169.
01/11/06
Var_UpPF_Adj_Test.f90
  • Modify call to Var_UpPFu_v, due to change of arguments, line 1127.
  • Modify call to Var_UpPFu_v_Adj, due to change of arguments, line 1193.
03/11/06

VarMod_UpTransform

Var_UpTransform.f90
  • Add optional parameter PV_Diagnostics, line 9.
  • USE PVcvScheme, line 70.
  • USE SwapScalar, line 79-80.
  • INCLUDE Var_UpPF_Unbalpsi_lszm, line 107.
  • INCLUDE Var_SwapBounds, line 108.
  • INCLUDE Var_PFdiagnostics_forPV, line 109.
  • Declare PV_Diagnostics, line 120.
  • Declare allocatable psi field, line 132.
  • Declare allocatable unbalpsi_p field, line 133.
  • Declare logical variable Use_normal_modes, line 134.
  • Declare integers x, y, LowLev and TopLev loop variables, line 135.
  • Declare PV_Diagnostics1, line 136.
  • Set value of PV_Diagnostics1, lines 149-153.
  • Add code to output optional u,v diagnostics associated with the velocity potential, lines 193-200.
  • Add code to output optional u,v diagnostics associated with the balanced streamfunction, lines 211-218.
  • Allocate psi (the total streamfunction), lines 220-224.
  • Add code for PV scheme (to allow calculation of the unbalanced streamfunction, including allocation and deallocation of unbalpsi_p and code to output optional u,v diagnostics associated with the unbalanced streamfunction), lines 226-274.
  • Modify call to Var_UpPFu_v, due to change of arguments, line 280.
  • Deallocate psi, line 285.
  • Add optional argument PV_Diagnostics1 to call to Var_UpPFHp, line 313.
31/10/06, 11/01/07
Var_PFdiagnostics_forPV.f90 NEW
  • To output the u,v associated with either a streamfunction or velocity potential field. Called by Var_UpTransform.
20/10/06

VarMod_UpTransform_Adj

Var_UpTransform_Adj.f90
  • USE PVcvScheme, line 62.
  • USE SwapScalar, line 58.
  • INCLUDE Var_UpPF_Unbalpsi_lszm_Adj, line 86.
  • INCLUDE Var_SwapBounds_Adj, line 87.
  • Declare allocatable psi_hat field, line 107.
  • Declare allocatable unbalpsi_p_hat field, line 108.
  • Declare logical variable Use_normal_modes, line 109.
  • Declare integer x, y, LowLev and TopLev loop variables, line 110.
  • Allocate psi_hat, line 314.
  • Modify call to Var_UpPFu_v_Adj, due to change of arguments, line 319.
  • Add code for PV scheme, line 328.
02/11/06

VarMod_CovVertical

Var_CovVertical.f90
  • Modify call to Var_UpPFu_v, due to change of arguments, lines 398 and 440.
31/10/06

VarMod_DelSquaredFFT

Var_DelSquaredFFT.f90
  • Add new optional parameter Mu_in (screening term), line 12.
  • Declare Mu_in, line 143.
  • Declare Mu, line 258.
  • Deal with possibility of Mu_in being present or not, line 266.
  • Add Mu to call to Var_TriDiag_p, line 1036.
  • Add Mu to call to Var_TriDiag_psi, line 1053.
  • Add Mu to call to Var_TriDiag_LAM_psi, line 1070.
  • Add Mu to call to Var_TriDiag_LAM_p, line 1087.
  • Add Mu to call to Var_TriDiag_LAM_chi, line 1104.
06/11/06
Var_TriDiag_LAM_chi.f90
  • Add new optional parameter Mu_in (screening term), line 17.
  • Declare Mu_in, line 81.
  • Declare Mu, line 98.
  • Deal with possibility of Mu_in being present or not, line 104.
  • Add Mu to diagonal terms, line 127.
06/11/06
Var_TriDiag_LAM_p.f90
  • Add new optional parameter Mu_in (screening term), line 17.
  • Declare Mu_in, line 80.
  • Declare Mu, line 97.
  • Deal with possibility of Mu_in being present or not, line 103.
  • Add Mu to diagonal terms, line 127.
06/11/06
Var_TriDiag_LAM_psi.f90
  • Add new optional parameter Mu_in (screening term), line 17.
  • Declare Mu_in, line 80.
  • Declare Mu, line 97.
  • Deal with possibility of Mu_in being present or not, line 103.
  • Add Mu to diagonal terms, line 127.
06/11/06
Var_TriDiag_p.f90
  • Add new optional parameter Mu_in (screening term), line 17.
  • Declare Mu_in, line 77.
  • Declare Mu, line 94.
  • Deal with possibility of Mu_in being present or not, line 100.
  • Add Mu to diagonal terms, lines 121, 125, 136.
06/11/06
Var_TriDiag_psi.f90
  • Add new optional parameter Mu_in (screening term), line 17.
  • Declare Mu_in, line 77.
  • Declare Mu, line 95.
  • Deal with possibility of Mu_in being present or not, line 107.
  • Add Mu to diagonal terms, line 125.
06/11/06

VarMod_PseudoOb

VarMod_PseudoOb.f90
  • PseudoObNmax = 10 (was 5), line 79.
22/02/07

VarProg_TestCov

VarProg_TestCov.f90
  • USE variable PVcvScheme from VarMod_TransformInfo, line 115.
  • INCLUDE Var_LSVtheta, line 149.
  • INCLUDE Var_FillLSzm, line 150.
  • INCLUDE Var_AllocateLSzm, line 151.
  • Declare LocalFS and set to FieldStatus_global, line 179.
  • Add code to call Var_LSVtheta, Var_AllocateLSzm Var_FillLSzm and Var_LSDeallocate if PVcvScheme is switched on, lines 269 to 281.
  • Add optional LSzmDealloc flag in call to Var_LSDeallocate to deallocate LSzm structure, line 405.
18/04/07

Temporary code written / added

VarMod_TpTransform
  • Routine Var_RoughOutput added. I have undone this change.
  • Diagnostic code added to Var_TpTransform to output first guess streamfunction, balanced streamfunction, first guess unbalanced pressure, unbalanced pressure. I have undone this change.
  • Diagnostic code added to Var_GCR_k_PV to output the residual in PV or antiPV. I have undone this change.
VarMod_Vp
  • Diagnostic code added to Var_VpPsi_B to output RHS PV. I have undone this change and put in diagnostic code that is in-line with the standard code.
  • Diagnostic code added to Var_VpPr_UnB to output RHS antiPV. I have undone this change and put in diagnostic code that is in-line with the standard code.
VarMod_LS
  • Removed condition on Diagnostic mode to be selected to call Var_ShowZM. I have undone this change.
VarMod_Transforms
  • Borrowed Marek's code Var_InitTrans_PFs_setup. This is introduced in later versions of Var., but I introduce it now to (hopefully) fix a bug. Need to remove this before merging - removed 30/04/07.
  • Add thee lines also in VarProg_CovPFstats to call this routine. Need to remove this before merging - removed 30/04/07.
VarProg_AnalysePF
  • Add extra condition MainVariant \= TestTransforms to VarProg_AnalysePF at lines 779, 812, 859 and 896. This is to prevent unnecessary calls to transforms when doing a transform test run. Need to remove this before merging (actually kept this for now - need to check that it will not interfere with normal operation.).
  • INCLUDE Var_CheckHeaders_SameDate, line 234. To allow LS and PF to have the same date. Need to remove this before merging - removed 30/04/07.
  • Change Gen_CheckHeaders to Var_CheckHeaders_SameDate, line 579. To allow LS and PF to have the same date. Need to remove this before merging - removed 30/04/07.
VarMod_ModelIO
  • Add routine Var_CheckHeaders_SameDate to set the PF header date to the same value as the LS header date. Need to remove this before merging - removed 30/04/07.
VarMod_PF
  • Add printing comments in Var_PFGp to state whether vertical regression on Gp is performed. Need to remove this before merging - removed 30/04/07.
Var_InitTransforms.f90
  • Commented-out lines detailed in main Var_InitTransforms entry above. Need to remove these before merging if they are not needed - removed 30/04/07.
Var_ImpliedSpectra.f90
  • Replaced with latest version (Marek's code). This is introduced in later versions of Var., but I introduce it now to (hopefully) fix a bug. Need to replace this before merging - replaced 30/04/07.

Issues to sort out

LAM The code is set-up currently to run on a global domain. Might just need to do extra call to Var_SetLAMBound?
Subroutine headers Check that these are up-to-date and show the current module.
Swapbounds Check that this is done appropriately.
PV calculation in T-transform Should I use PF % p or PF % Hp in this? I am using PF % Hp.
anti-PV calculation in T-transform Should I use PF % p or PF % Hp in this? I am using PF % Hp.
LSzm I should allow for this to be updated at each outer loop.
Standard tests Need to update code for adjoint test (Var_UpPF_Adj_Test?) and inverse test (?) DONE.
Tests Need to actually do adjoint and inverse tests. The code structure is different to that used before (the plumbed-in code has been adapted slightly to better fit-in with the operational code). DONE.
Ap halo For the T-transform I needed allocate a non-zero halo for Vp % Ap. Is this needed for the U-transform?
.


Page last updated 30/04/07. Ross Bannister.