From 275c52d271335b0ca322ece783f21d590e23b7c3 Mon Sep 17 00:00:00 2001 From: cenamiller Date: Wed, 29 May 2024 12:08:43 -0600 Subject: [PATCH 1/2] adding TDRP file for beltrami validation - output_txt=TRUE. This can probably be refined in the future to only print what we need! --- ncar_scripts/TDRP/beltrami.val.tdrp | 1222 +++++++++++++++++++++++++++ 1 file changed, 1222 insertions(+) create mode 100644 ncar_scripts/TDRP/beltrami.val.tdrp diff --git a/ncar_scripts/TDRP/beltrami.val.tdrp b/ncar_scripts/TDRP/beltrami.val.tdrp new file mode 100644 index 0000000..e259e61 --- /dev/null +++ b/ncar_scripts/TDRP/beltrami.val.tdrp @@ -0,0 +1,1222 @@ + +// Overwrite bgU with the content of this file. +// +// If set to a valid file, the bgU array will be overwritten. +// +// Type: string + +debug_bgu_overwrite = ""; + +///////////// debug_kd //////////////////////////////// +// +// Debug the KD tree. +// +// If set to a non-zero value val, dump val/step KD tree lookup. +// +// Type: int + +debug_kd = 0; + +///////////// debug_kd_step /////////////////////////// +// +// Step for decrementing debug_kd. +// +// debug_kd is decremented by this value. +// +// Type: int + +debug_kd_step = 0; + +//====================================================================== +// +// BACKGROUND SECTION. +// +//====================================================================== + +///////////// load_background ///////////////////////// +// +// Tell Samurai to load background observations. +// +// TODO. +// +// Type: boolean + +load_background = FALSE; + +///////////// load_bg_coefficients //////////////////// +// +// Tell Samurai to load background coefficients. +// +// TODO. +// +// Type: boolean + +load_bg_coefficients = FALSE; + +///////////// adjust_background /////////////////////// +// +// Tell Samurai to adjust the background observations. +// +// Adjust the interpolated background to satisfy mass continuity and +// match the supplied points exactly. +// +// Type: boolean + +adjust_background = FALSE; + +///////////// bkgd_obs_interpolation ////////////////// +// +// Interpolation method to fit background observations to the grid. +// +// TODO explain the various methods here. +// +// Type: enum +// Options: +// INTERP_NONE +// INTERP_SPLINE +// INTERP_KD_TREE +// INTERP_FRACTL + +bkgd_obs_interpolation = INTERP_SPLINE; + +//====================================================================== +// +// OPERATION SECTION. +// +//====================================================================== + +///////////// mode //////////////////////////////////// +// +// Coordinate system. +// +// XYZ for Cartesian, RTZ for spherical. +// +// Type: enum +// Options: +// MODE_XYZ +// MODE_RTZ + +mode = MODE_XYZ; + +///////////// projection ////////////////////////////// +// +// Projection. +// +// TODO. +// +// Type: enum +// Options: +// PROJ_LAMBERT_CONFORMAL_CONIC +// PROJ_TRANSVERSE_MERCATOR_EXACT + +projection = PROJ_TRANSVERSE_MERCATOR_EXACT; + +///////////// data_directory ////////////////////////// +// +// Path to the data directory. +// +// Samurai will load data files from this directory. +// +// Type: string + +data_directory = "/glade/campaign/cisl/asap/samurai/data/beltrami"; + +///////////// output_directory //////////////////////// +// +// Path to the output directory. +// +// Samurai will write result files in this directory. +// +// Type: string + +output_directory = "."; + +///////////// preprocess_obs ////////////////////////// +// +// TODO. +// +// Type: boolean + +preprocess_obs = FALSE; + +///////////// num_iterations ////////////////////////// +// +// Max number of iterations to the multipass reduction factor. +// +// Multiple iterations will reduce the cutoff wavelengths and background +// error variance. +// +// Type: int + +num_iterations = 1; + +///////////// output_mish ///////////////////////////// +// +// Type: boolean + +output_mish = FALSE; + +///////////// output_txt ////////////////////////////// +// +// Type: boolean + +output_txt = FALSE; + +///////////// output_qc /////////////////////////////// +// +// Type: boolean + +output_qc = TRUE; + +///////////// output_netcdf /////////////////////////// +// +// Type: boolean + +output_netcdf = TRUE; + +///////////// output_asi ////////////////////////////// +// +// Type: boolean + +output_asi = FALSE; + +///////////// output_COAMPS /////////////////////////// +// +// Type: boolean + +output_COAMPS = FALSE; + +///////////// save_mish /////////////////////////////// +// +// Type: boolean + +save_mish = FALSE; + +//====================================================================== +// +// GRID DEFINITION SECTION. +// +//====================================================================== + +///////////// i_min /////////////////////////////////// +// +// Type: float + +i_min = 12.0; + +///////////// i_max /////////////////////////////////// +// +// Type: float + +i_max = 28.0; + +///////////// i_incr ////////////////////////////////// +// +// Type: float + +i_incr = 0.5; + +///////////// j_min /////////////////////////////////// +// +// Type: float + +j_min = -4.0; + +///////////// j_max /////////////////////////////////// +// +// Type: float + +j_max = 12.0; + +///////////// j_incr ////////////////////////////////// +// +// Type: float + +j_incr = 0.5; + +///////////// k_min /////////////////////////////////// +// +// Type: float + +k_min = 0.0; + +///////////// k_max /////////////////////////////////// +// +// Type: float + +k_max = 18.0; + +///////////// k_incr ////////////////////////////////// +// +// Type: float + +k_incr = 0.5; + +//====================================================================== +// +// BACKGROUND SECTION. +// +//====================================================================== + +///////////// ref_state /////////////////////////////// +// +// Type: string + +ref_state = "dunion_mt.snd"; + +///////////// ref_time //////////////////////////////// +// +// Reference time. +// +// hh:mm:ss. +// +// Type: string + +ref_time = "23:51:32"; + +///////////// i_background_roi //////////////////////// +// +// Radius of influence in the I direction. +// +// Type: float + +i_background_roi = 25; + +///////////// j_background_roi //////////////////////// +// +// Radius of influence in the J direction. +// +// Type: float + +j_background_roi = 25; + +//====================================================================== +// +// RADAR SECTION. +// +//====================================================================== + +///////////// radar_skip ////////////////////////////// +// +// Type: int + +radar_skip = 2; + +///////////// radar_stride //////////////////////////// +// +// Type: int + +radar_stride = 3; + +///////////// dynamic_stride ////////////////////////// +// +// Type: int + +dynamic_stride = 0; + +///////////// qr_variable ///////////////////////////// +// +// ???. +// +// Type: string + +qr_variable = "dbz"; + +///////////// radar_dbz /////////////////////////////// +// +// Radar reflectivity variable name in the input files. +// +// Example: DBZ for Eldora, DZ for CSU-CHILL. +// +// Type: string + +radar_dbz = "DBZ"; + +///////////// radar_vel /////////////////////////////// +// +// Radar velocity of scatterers away from instrument. +// +// Example: VG for Eldora, VE for CSU-CHILL, VR, ... +// +// Type: string + +radar_vel = "VG"; + +///////////// radar_sw //////////////////////////////// +// +// Type: string + +radar_sw = "SW"; + +///////////// i_reflectivity_roi ////////////////////// +// +// Type: float + +i_reflectivity_roi = 0.5; + +///////////// j_reflectivity_roi ////////////////////// +// +// Type: float + +j_reflectivity_roi = 0.5; + +///////////// k_reflectivity_roi ////////////////////// +// +// Type: float + +k_reflectivity_roi = 0.5; + +///////////// dbz_pseudow_weight ////////////////////// +// +// Type: float + +dbz_pseudow_weight = 1.0; + +///////////// mask_reflectivity /////////////////////// +// +// Type: float + +mask_reflectivity = -500; + +///////////// melting_zone_width ////////////////////// +// +// Type: float + +melting_zone_width = 1; + +///////////// mixed_phase_dbz ///////////////////////// +// +// Type: float + +mixed_phase_dbz = 20.0; + +///////////// rain_dbz //////////////////////////////// +// +// Type: float + +rain_dbz = 30.0; + +//====================================================================== +// +// PARAMETERS SECTION. +// +//====================================================================== + +//====================================================================== +// +// BOUNDARY CONDITIONS SECTION. +// +//====================================================================== + +///////////// i_rhou_bcL ////////////////////////////// +// +// Type: string + +i_rhou_bcL = "R0"; + +///////////// i_rhou_bcR ////////////////////////////// +// +// Type: string + +i_rhou_bcR = "R0"; + +///////////// i_rhov_bcL ////////////////////////////// +// +// Type: string + +i_rhov_bcL = "R0"; + +///////////// i_rhov_bcR ////////////////////////////// +// +// Type: string + +i_rhov_bcR = "R0"; + +///////////// i_rhow_bcL ////////////////////////////// +// +// Type: string + +i_rhow_bcL = "R0"; + +///////////// i_rhow_bcR ////////////////////////////// +// +// Type: string + +i_rhow_bcR = "R0"; + +///////////// i_tempk_bcL ///////////////////////////// +// +// Type: string + +i_tempk_bcL = "R0"; + +///////////// i_tempk_bcR ///////////////////////////// +// +// Type: string + +i_tempk_bcR = "R0"; + +///////////// i_qv_bcL //////////////////////////////// +// +// Type: string + +i_qv_bcL = "R0"; + +///////////// i_qv_bcR //////////////////////////////// +// +// Type: string + +i_qv_bcR = "R0"; + +///////////// i_rhoa_bcL ////////////////////////////// +// +// Type: string + +i_rhoa_bcL = "R0"; + +///////////// i_rhoa_bcR ////////////////////////////// +// +// Type: string + +i_rhoa_bcR = "R0"; + +///////////// i_qr_bcL //////////////////////////////// +// +// Type: string + +i_qr_bcL = "R0"; + +///////////// i_qr_bcR //////////////////////////////// +// +// Type: string + +i_qr_bcR = "R0"; + +///////////// j_rhou_bcL ////////////////////////////// +// +// Type: string + +j_rhou_bcL = "R0"; + +///////////// j_rhou_bcR ////////////////////////////// +// +// Type: string + +j_rhou_bcR = "R0"; + +///////////// j_rhov_bcL ////////////////////////////// +// +// Type: string + +j_rhov_bcL = "R0"; + +///////////// j_rhov_bcR ////////////////////////////// +// +// Type: string + +j_rhov_bcR = "R0"; + +///////////// j_rhow_bcL ////////////////////////////// +// +// Type: string + +j_rhow_bcL = "R0"; + +///////////// j_rhow_bcR ////////////////////////////// +// +// Type: string + +j_rhow_bcR = "R0"; + +///////////// j_tempk_bcL ///////////////////////////// +// +// Type: string + +j_tempk_bcL = "R0"; + +///////////// j_tempk_bcR ///////////////////////////// +// +// Type: string + +j_tempk_bcR = "R0"; + +///////////// j_qv_bcL //////////////////////////////// +// +// Type: string + +j_qv_bcL = "R0"; + +///////////// j_qv_bcR //////////////////////////////// +// +// Type: string + +j_qv_bcR = "R0"; + +///////////// j_rhoa_bcL ////////////////////////////// +// +// Type: string + +j_rhoa_bcL = "R0"; + +///////////// j_rhoa_bcR ////////////////////////////// +// +// Type: string + +j_rhoa_bcR = "R0"; + +///////////// j_qr_bcL //////////////////////////////// +// +// Type: string + +j_qr_bcL = "R0"; + +///////////// j_qr_bcR //////////////////////////////// +// +// Type: string + +j_qr_bcR = "R0"; + +///////////// k_rhou_bcL ////////////////////////////// +// +// Type: string + +k_rhou_bcL = "R0"; + +///////////// k_rhou_bcR ////////////////////////////// +// +// Type: string + +k_rhou_bcR = "R0"; + +///////////// k_rhov_bcL ////////////////////////////// +// +// Type: string + +k_rhov_bcL = "R0"; + +///////////// k_rhov_bcR ////////////////////////////// +// +// Type: string + +k_rhov_bcR = "R0"; + +///////////// k_rhow_bcL ////////////////////////////// +// +// Type: string + +k_rhow_bcL = "R1T0"; + +///////////// k_rhow_bcR ////////////////////////////// +// +// Type: string + +k_rhow_bcR = "R1T0"; + +///////////// k_tempk_bcL ///////////////////////////// +// +// Type: string + +k_tempk_bcL = "R0"; + +///////////// k_tempk_bcR ///////////////////////////// +// +// Type: string + +k_tempk_bcR = "R0"; + +///////////// k_qv_bcL //////////////////////////////// +// +// Type: string + +k_qv_bcL = "R0"; + +///////////// k_qv_bcR //////////////////////////////// +// +// Type: string + +k_qv_bcR = "R0"; + +///////////// k_rhoa_bcL ////////////////////////////// +// +// Type: string + +k_rhoa_bcL = "R0"; + +///////////// k_rhoa_bcR ////////////////////////////// +// +// Type: string + +k_rhoa_bcR = "R0"; + +///////////// k_qr_bcL //////////////////////////////// +// +// Type: string + +k_qr_bcL = "R0"; + +///////////// k_qr_bcR //////////////////////////////// +// +// Type: string + +k_qr_bcR = "R0"; + +//====================================================================== +// +// OBSERVATION ERRORS SECTION. +// +//====================================================================== + +///////////// dropsonde_rhoa_error //////////////////// +// +// Type: float + +dropsonde_rhoa_error = 1; + +///////////// dropsonde_rhou_error //////////////////// +// +// Type: float + +dropsonde_rhou_error = 2; + +///////////// dropsonde_rhov_error //////////////////// +// +// Type: float + +dropsonde_rhov_error = 2; + +///////////// dropsonde_rhow_error //////////////////// +// +// Type: float + +dropsonde_rhow_error = 50; + +///////////// dropsonde_tempk_error /////////////////// +// +// Type: float + +dropsonde_tempk_error = 2; + +///////////// dropsonde_qv_error ////////////////////// +// +// Type: float + +dropsonde_qv_error = 0.5; + +///////////// dropsonde_rhoua_error /////////////////// +// +// Type: float + +dropsonde_rhoua_error = 1; + +///////////// flightlevel_rhoa_error ////////////////// +// +// Type: float + +flightlevel_rhoa_error = 1; + +///////////// flightlevel_rhou_error ////////////////// +// +// Type: float + +flightlevel_rhou_error = 1; + +///////////// flightlevel_rhov_error ////////////////// +// +// Type: float + +flightlevel_rhov_error = 1; + +///////////// flightlevel_rhow_error ////////////////// +// +// Type: float + +flightlevel_rhow_error = 1; + +///////////// flightlevel_tempk_error ///////////////// +// +// Type: float + +flightlevel_tempk_error = 1; + +///////////// flightlevel_qv_error //////////////////// +// +// Type: float + +flightlevel_qv_error = 0.5; + +///////////// flightlevel_rhoua_error ///////////////// +// +// Type: float + +flightlevel_rhoua_error = 1; + +///////////// mtp_rhoa_error ////////////////////////// +// +// Type: float + +mtp_rhoa_error = 0; + +///////////// mtp_tempk_error ///////////////////////// +// +// Type: float + +mtp_tempk_error = 0; + +///////////// insitu_rhoa_error /////////////////////// +// +// Type: float + +insitu_rhoa_error = 1; + +///////////// insitu_rhou_error /////////////////////// +// +// Type: float + +insitu_rhou_error = 1; + +///////////// insitu_rhov_error /////////////////////// +// +// Type: float + +insitu_rhov_error = 1; + +///////////// insitu_rhow_error /////////////////////// +// +// Type: float + +insitu_rhow_error = 2; + +///////////// insitu_tempk_error ////////////////////// +// +// Type: float + +insitu_tempk_error = 1; + +///////////// insitu_qv_error ///////////////////////// +// +// Type: float + +insitu_qv_error = 0.5; + +///////////// insitu_rhoua_error ////////////////////// +// +// Type: float + +insitu_rhoua_error = 1; + +///////////// sfmr_windspeed_error //////////////////// +// +// Type: float + +sfmr_windspeed_error = 10; + +///////////// qscat_rhou_error //////////////////////// +// +// Type: float + +qscat_rhou_error = 2.5; + +///////////// qscat_rhov_error //////////////////////// +// +// Type: float + +qscat_rhov_error = 2.5; + +///////////// ascat_rhou_error //////////////////////// +// +// Type: float + +ascat_rhou_error = 2.5; + +///////////// ascat_rhov_error //////////////////////// +// +// Type: float + +ascat_rhov_error = 2.5; + +///////////// amv_rhou_error ////////////////////////// +// +// Type: float + +amv_rhou_error = 10; + +///////////// amv_rhov_error ////////////////////////// +// +// Type: float + +amv_rhov_error = 10; + +///////////// lidar_sw_error ////////////////////////// +// +// Type: float + +lidar_sw_error = 1; + +///////////// lidar_power_error /////////////////////// +// +// Type: float + +lidar_power_error = 50; + +///////////// lidar_min_error ///////////////////////// +// +// Type: float + +lidar_min_error = 1; + +///////////// radar_sw_error ////////////////////////// +// +// Type: float + +radar_sw_error = 1; + +///////////// radar_fallspeed_error /////////////////// +// +// Type: float + +radar_fallspeed_error = 2; + +///////////// radar_min_error ///////////////////////// +// +// Type: float + +radar_min_error = 1; + +///////////// aeri_qv_error /////////////////////////// +// +// Type: float + +aeri_qv_error = 1; + +///////////// aeri_rhoa_error ///////////////////////// +// +// Type: float + +aeri_rhoa_error = 1; + +///////////// aeri_rhou_error ///////////////////////// +// +// Type: float + +aeri_rhou_error = 1; + +///////////// aeri_rhov_error ///////////////////////// +// +// Type: float + +aeri_rhov_error = 1; + +///////////// aeri_rhow_error ///////////////////////// +// +// Type: float + +aeri_rhow_error = 1; + +///////////// aeri_tempk_error //////////////////////// +// +// Type: float + +aeri_tempk_error = 1; + +///////////// bg_obs_error //////////////////////////// +// +// Type: float + +bg_obs_error = 1; + +///////////// bg_interpolation_error ////////////////// +// +// Type: float + +bg_interpolation_error = 1; + +///////////// mesonet_qv_error //////////////////////// +// +// Type: float + +mesonet_qv_error = 1; + +///////////// mesonet_rhoa_error ////////////////////// +// +// Type: float + +mesonet_rhoa_error = 1; + +///////////// mesonet_rhou_error ////////////////////// +// +// Type: float + +mesonet_rhou_error = 1; + +///////////// mesonet_rhov_error ////////////////////// +// +// Type: float + +mesonet_rhov_error = 1; + +///////////// mesonet_rhow_error ////////////////////// +// +// Type: float + +mesonet_rhow_error = 1; + +///////////// mesonet_tempk_error ///////////////////// +// +// Type: float + +mesonet_tempk_error = 1; + +//====================================================================== +// +// XYP SPECIFIC SECTION. +// +//====================================================================== + +///////////// output_latlon_increment ///////////////// +// +// Type: float + +output_latlon_increment = -1; + +///////////// output_pressure_increment /////////////// +// +// Type: float + +output_pressure_increment = -1; + +//====================================================================== +// +// OPTION SECTION. +// +//====================================================================== + +///////////// max_radar_elevation ///////////////////// +// +// Type: float + +max_radar_elevation = 45; + +///////////// horizontal_radar_appx /////////////////// +// +// Type: boolean + +horizontal_radar_appx = TRUE; + +///////////// allow_background_missing_values ///////// +// +// Type: boolean + +allow_background_missing_values = TRUE; + +///////////// allow_negative_angles /////////////////// +// +// Type: boolean + +allow_negative_angles = TRUE; + +///////////// array_order ///////////////////////////// +// +// Order of compressed arrays passed through samurai.h interface. +// +// One of row_order or column_order. +// +// Type: string + +array_order = "row_order"; + +///////////// bg_interpolation //////////////////////// +// +// Type: string + +bg_interpolation = "none"; + +//====================================================================== +// +// KD TREE NEAREST NEIGHBOR SECTION. +// +//====================================================================== + +///////////// bkgd_kd_max_distance //////////////////// +// +// Any point outside of that distance will be ignored. +// +// Type: float + +bkgd_kd_max_distance = 20; + +///////////// bkgd_kd_num_neighbors /////////////////// +// +// Values will be averaged over these many nearest neighbors. +// +// Type: int + +bkgd_kd_num_neighbors = 1; + +//====================================================================== +// +// FRACTL INTERFACE SECTION. +// +//====================================================================== + +///////////// fractl_nc_file ////////////////////////// +// +// Need bkgd_obs_interpolation set to INTERP_FRACTL to be used. +// +// Type: string + +fractl_nc_file = ""; + +///////////// use_fractl_errors /////////////////////// +// +// Need bkgd_obs_interpolation set to 'fractl' to be used. +// +// Type: boolean + +use_fractl_errors = FALSE; + +//====================================================================== +// +// ITERATION DEPENDENT SECTION. +// +//====================================================================== + +///////////// mc_weight /////////////////////////////// +// +// Type: float +// 1D array - variable length. + +mc_weight = { 1, 1 }; + +///////////// neumann_u_weight //////////////////////// +// +// Type: float +// 1D array - variable length. + +neumann_u_weight = { 0.01, 0.01 }; + +///////////// neumann_v_weight //////////////////////// +// +// Type: float +// 1D array - variable length. + +neumann_v_weight = { 0.01, 0.01 }; + +///////////// dirichlet_w_weight ////////////////////// +// +// Type: float +// 1D array - variable length. + +dirichlet_w_weight = { 0.01, 0.01 }; + +///////////// bg_qr_error ///////////////////////////// +// +// Type: float +// 1D array - variable length. + +bg_qr_error = { 5, 1 }; + +///////////// bg_qv_error ///////////////////////////// +// +// Type: float +// 1D array - variable length. + +bg_qv_error = { 20, 2 }; + +///////////// bg_rhoa_error /////////////////////////// +// +// Type: float +// 1D array - variable length. + +bg_rhoa_error = { 20, 2 }; + +///////////// bg_rhou_error /////////////////////////// +// +// Type: float +// 1D array - variable length. + +bg_rhou_error = { 100, 2 }; + +///////////// bg_rhov_error /////////////////////////// +// +// Type: float +// 1D array - variable length. + +bg_rhov_error = { 100, 2 }; + +///////////// bg_rhow_error /////////////////////////// +// +// Type: float +// 1D array - variable length. + +bg_rhow_error = { 20, 2 }; + +///////////// bg_tempk_error ////////////////////////// +// +// Type: float +// 1D array - variable length. + +bg_tempk_error = { 20, 2 }; + +///////////// i_filter_length ///////////////////////// +// +// Type: float +// 1D array - variable length. + +i_filter_length = { 2, 2 }; + +///////////// j_filter_length ///////////////////////// +// +// Type: float +// 1D array - variable length. + +j_filter_length = { 2, 2 }; + +///////////// k_filter_length ///////////////////////// +// +// Type: float +// 1D array - variable length. + +k_filter_length = { 2, 2 }; + +///////////// i_spline_cutoff ///////////////////////// +// +// Type: float +// 1D array - variable length. + +i_spline_cutoff = { 2, 5 }; + +///////////// j_spline_cutoff ///////////////////////// +// +// Type: float +// 1D array - variable length. + +j_spline_cutoff = { 2, 5 }; + +///////////// k_spline_cutoff ///////////////////////// +// +// Type: float +// 1D array - variable length. + +k_spline_cutoff = { 2, 5 }; + +///////////// i_max_wavenumber //////////////////////// +// +// Type: float +// 1D array - variable length. + +i_max_wavenumber = { -1, -1 }; + +///////////// j_max_wavenumber //////////////////////// +// +// Type: float +// 1D array - variable length. + +j_max_wavenumber = { -1, -1 }; + +///////////// k_max_wavenumber //////////////////////// +// +// Type: float +// 1D array - variable length. + +k_max_wavenumber = { -1, -1 }; + From 753c8c487a52b7e594cc99fdf4c7a4db4fcd494f Mon Sep 17 00:00:00 2001 From: cenamiller Date: Wed, 17 Jul 2024 12:52:36 -0600 Subject: [PATCH 2/2] Adding Supreeth's python script for checking residual/iterations as a VERY basic correctness check. Expect numbers to be different for each test case. Waiting for confirmation from John on ref.log file --- docker/Dockerfile | 3 +- ncar_scripts/validation/ref.log | 219 ++++++++++++++++++++++++++ ncar_scripts/validation/validation.py | 65 ++++++++ 3 files changed, 286 insertions(+), 1 deletion(-) create mode 100644 ncar_scripts/validation/ref.log create mode 100644 ncar_scripts/validation/validation.py diff --git a/docker/Dockerfile b/docker/Dockerfile index 2e99395..62c3a2e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -28,9 +28,10 @@ ENV PATH="/usr/local/bin:${PATH}" RUN echo "#!/bin/bash \n\ cd /app/samurai/build/release/bin/ \n\ -./samurai -params /app/samurai/ncar_scripts/TDRP/beltrami.tdrp\ +./samurai -params /app/samurai/ncar_scripts/TDRP/beltrami.tdrp > /app/test.log " > /app/run_samurai.sh WORKDIR /app/ RUN chmod +x /app/run_samurai.sh +RUN python /app/samurai/ncar_scripts/validation/validation.py ref.log test.log CMD [ "./run_samurai.sh" ] diff --git a/ncar_scripts/validation/ref.log b/ncar_scripts/validation/ref.log new file mode 100644 index 0000000..69eaa70 --- /dev/null +++ b/ncar_scripts/validation/ref.log @@ -0,0 +1,219 @@ +Initializing SAMURAI 3D +iMin iMax iIncr jMin jMax jIncr kMin kMax kIncr +12 28 0.5 -4 12 0.5 0 18 0.5 + +Can't open Reference State file for reading, 'dunion_mt.snd' using default... +DEBUG: center date = 2008-09-14 00:00:00.000000000, time = 0 +Found matching reference time 23:51:32 at 16.7150002, 148 +Physical (mish) State size = 2459968 +Nodal State size = 334425 +Grid dimensions: (33, 33, 37) +Loading preprocessed observations from samurai_Observations.in +Number of New Observations: 45134 +runTime: loadMetObs: 0.180747 +done with stof conversion... +kRankMax: 39 +runTime: initObCost3D: 0.009943 +runTime: gridDependentInit: 0.225525 +Outer Loop Iteration: 1 +Initializing state vector... +4th Order Recursive Filter coefficients computed for lengthscale 2 Delta X +4th Order Recursive Filter coefficients computed for lengthscale 2 Delta X +4th Order Recursive Filter coefficients computed for lengthscale 2 Delta X +i Spline cutoff set to 2 +j Spline cutoff set to 2 +k Spline cutoff set to 2 +Mass continuity weight set to 1 +Initializing background... +Variable 0 RMS = 0 BG Error = 2.0003561e-264 ( Infinite! %) +Variable 1 RMS = 0 BG Error = 6.9244327e-77 ( Infinite! %) +Variable 2 RMS = 0 BG Error = 1.98973863e-264 ( Infinite! %) +Variable 3 RMS = 0 BG Error = 2.35119669e-154 ( Infinite! %) +Variable 4 RMS = 0 BG Error = 2.46005736e-91 ( Infinite! %) +Variable 5 RMS = 0 BG Error = 6.74774891e-67 ( Infinite! %) +Variable 6 RMS = 0 BG Error = 2.26065223e-264 ( Infinite! %) +Build H transform matrix... +calcHmatrix: Grid dimensions: (35, 35, 39) +sizeof(integer): 8 +Non-zero entries in sparse H matrix: 2913945 = 0.0193053991 % +Memory usage for [H] (Mbytes): 22.231636 +Memory usage for [obsVector] (Mbytes): 12.0520782 +Memory usage for [obsData] (Mbytes): 0.344345093 +Memory usage for [HCq] (Mbytes): 0.708839417 +Memory usage for [mPtr,mVal,I2H] (Mbytes): 47.01474 +Memory usage for [IH,JH] (Mbytes): 22.5759888 +Memory usage for [state] (Mbytes): 2.55146027 +Initializing innovation vector... +Innovation RMS : 1.11738251 +Outputting background... +Beginning analysis... +runTime: Cost3D Init: 2.595816 +Beginning minimize() + Solver conv. tolerance = 0.0001 +SOLVER: Samurai Truncated Newton + Newton Iteration: 0 J = 22845.491 Residual = 8893.15899 + CG iteration 0: r_norm = 8893.15899124 rel_resid = 1.0000000000 + CG iteration 1: r_norm = 4162.93162226 rel_resid = 0.4681049362 + CG iteration 2: r_norm = 2047.43755712 rel_resid = 0.2302261276 + CG iteration 3: r_norm = 1238.49662484 rel_resid = 0.1392639698 + CG iteration 4: r_norm = 868.82289098 rel_resid = 0.0976956436 + CG iteration 5: r_norm = 602.01158975 rel_resid = 0.0676937847 + CG iteration 6: r_norm = 474.02692020 rel_resid = 0.0533024228 + CG iteration 7: r_norm = 355.57894329 rel_resid = 0.0399834236 + CG iteration 8: r_norm = 290.70525706 rel_resid = 0.0326886382 + CG iteration 9: r_norm = 264.01542038 rel_resid = 0.0296874733 + CG iteration 10: r_norm = 216.92881810 rel_resid = 0.0243927741 + CG iteration 11: r_norm = 207.52873180 rel_resid = 0.0233357721 + CG iteration 12: r_norm = 180.64183587 rel_resid = 0.0203124487 + CG iteration 13: r_norm = 147.97435769 rel_resid = 0.0166391220 + CG iteration 14: r_norm = 131.23414016 rel_resid = 0.0147567518 + CG iteration 15: r_norm = 115.75321006 rel_resid = 0.0130159834 + CG iteration 16: r_norm = 97.65789792 rel_resid = 0.0109812383 + CG iteration 17: r_norm = 94.68236406 rel_resid = 0.0106466514 + CG iteration 18: r_norm = 89.37095746 rel_resid = 0.0100494051 + CG iteration 19: r_norm = 80.17847657 rel_resid = 0.0090157476 + CG iteration 20: r_norm = 72.08148929 rel_resid = 0.0081052739 + CG iteration 21: r_norm = 68.49380766 rel_resid = 0.0077018535 + CG iteration 22: r_norm = 70.31786972 rel_resid = 0.0079069619 + CG iteration 23: r_norm = 64.82676906 rel_resid = 0.0072895097 + CG iteration 24: r_norm = 62.74735891 rel_resid = 0.0070556884 + CG iteration 25: r_norm = 67.29491794 rel_resid = 0.0075670432 + CG iteration 26: r_norm = 66.54664888 rel_resid = 0.0074829033 + CG iteration 27: r_norm = 58.84494433 rel_resid = 0.0066168776 + CG iteration 28: r_norm = 60.89486006 rel_resid = 0.0068473824 + CG iteration 29: r_norm = 62.21404998 rel_resid = 0.0069957200 + CG iteration 30: r_norm = 55.65348907 rel_resid = 0.0062580113 + CG iteration 31: r_norm = 48.11997537 rel_resid = 0.0054108979 + CG iteration 32: r_norm = 46.94731161 rel_resid = 0.0052790366 + CG iteration 33: r_norm = 43.76094716 rel_resid = 0.0049207427 + CG iteration 34: r_norm = 44.70758625 rel_resid = 0.0050271885 + CG iteration 35: r_norm = 44.72064206 rel_resid = 0.0050286565 + CG iteration 36: r_norm = 41.35664727 rel_resid = 0.0046503888 + CG iteration 37: r_norm = 42.16741905 rel_resid = 0.0047415569 + CG iteration 38: r_norm = 38.56333067 rel_resid = 0.0043362916 + CG iteration 39: r_norm = 37.62799304 rel_resid = 0.0042311166 + CG iteration 40: r_norm = 35.34243265 rel_resid = 0.0039741146 + CG iteration 41: r_norm = 33.61047041 rel_resid = 0.0037793624 + CG iteration 42: r_norm = 31.60390546 rel_resid = 0.0035537322 + CG iteration 43: r_norm = 30.40648581 rel_resid = 0.0034190872 + CG iteration 44: r_norm = 30.76831149 rel_resid = 0.0034597730 + CG iteration 45: r_norm = 28.72439344 rel_resid = 0.0032299426 + CG iteration 46: r_norm = 29.70274495 rel_resid = 0.0033399543 + CG iteration 47: r_norm = 26.88781064 rel_resid = 0.0030234263 + CG iteration 48: r_norm = 25.95810051 rel_resid = 0.0029188841 + CG iteration 49: r_norm = 23.75876657 rel_resid = 0.0026715778 + CG iteration 50: r_norm = 23.46863142 rel_resid = 0.0026389533 + CG iteration 51: r_norm = 21.62540334 rel_resid = 0.0024316897 + CG iteration 52: r_norm = 21.52602769 rel_resid = 0.0024205153 + CG iteration 53: r_norm = 21.94182784 rel_resid = 0.0024672704 + CG iteration 54: r_norm = 21.37005524 rel_resid = 0.0024029769 + CG iteration 55: r_norm = 20.61176072 rel_resid = 0.0023177097 + CG iteration 56: r_norm = 19.32688988 rel_resid = 0.0021732311 + CG iteration 57: r_norm = 18.71677656 rel_resid = 0.0021046263 + CG iteration 58: r_norm = 18.44910553 rel_resid = 0.0020745278 + CG iteration 59: r_norm = 18.10205561 rel_resid = 0.0020355034 + CG iteration 60: r_norm = 17.77863574 rel_resid = 0.0019991362 + CG iteration 61: r_norm = 16.93147849 rel_resid = 0.0019038767 + CG iteration 62: r_norm = 15.93680686 rel_resid = 0.0017920299 + CG iteration 63: r_norm = 15.52872161 rel_resid = 0.0017461424 + CG iteration 64: r_norm = 14.56545572 rel_resid = 0.0016378270 + CG iteration 65: r_norm = 13.37201383 rel_resid = 0.0015036292 + CG iteration 66: r_norm = 12.21936914 rel_resid = 0.0013740190 + CG iteration 67: r_norm = 11.95424525 rel_resid = 0.0013442069 + CG iteration 68: r_norm = 12.12568306 rel_resid = 0.0013634843 + CG iteration 69: r_norm = 11.80570136 rel_resid = 0.0013275037 + CG iteration 70: r_norm = 11.14763371 rel_resid = 0.0012535066 + CG iteration 71: r_norm = 11.01251032 rel_resid = 0.0012383125 + CG iteration 72: r_norm = 11.13647526 rel_resid = 0.0012522519 + CG iteration 73: r_norm = 10.49971685 rel_resid = 0.0011806510 + CG iteration 74: r_norm = 10.15748159 rel_resid = 0.0011421680 + CG iteration 75: r_norm = 10.19348569 rel_resid = 0.0011462165 + CG iteration 76: r_norm = 9.82749171 rel_resid = 0.0011050620 + CG iteration 77: r_norm = 9.57802150 rel_resid = 0.0010770100 + CG iteration 78: r_norm = 8.89089856 rel_resid = 0.0009997458 + CG iteration 79: r_norm = 8.37125498 rel_resid = 0.0009413140 + CG iteration 80: r_norm = 7.77495414 rel_resid = 0.0008742624 + CG iteration 81: r_norm = 7.29530509 rel_resid = 0.0008203277 + CG iteration 82: r_norm = 7.39577528 rel_resid = 0.0008316252 + CG iteration 83: r_norm = 7.25639223 rel_resid = 0.0008159522 + CG iteration 84: r_norm = 6.92466606 rel_resid = 0.0007786509 + CG iteration 85: r_norm = 6.90213804 rel_resid = 0.0007761177 + CG iteration 86: r_norm = 6.69066711 rel_resid = 0.0007523386 + CG iteration 87: r_norm = 6.64115178 rel_resid = 0.0007467708 + CG iteration 88: r_norm = 6.22766491 rel_resid = 0.0007002759 + CG iteration 89: r_norm = 6.00550281 rel_resid = 0.0006752947 + CG iteration 90: r_norm = 5.65305484 rel_resid = 0.0006356633 + CG iteration 91: r_norm = 5.56309956 rel_resid = 0.0006255482 + CG iteration 92: r_norm = 5.48012948 rel_resid = 0.0006162185 + CG iteration 93: r_norm = 5.20179906 rel_resid = 0.0005849214 + CG iteration 94: r_norm = 4.99526069 rel_resid = 0.0005616970 + CG iteration 95: r_norm = 4.90719918 rel_resid = 0.0005517948 + CG iteration 96: r_norm = 4.58675410 rel_resid = 0.0005157621 + CG iteration 97: r_norm = 4.51808954 rel_resid = 0.0005080410 + CG iteration 98: r_norm = 4.65175669 rel_resid = 0.0005230714 + CG iteration 99: r_norm = 4.64780954 rel_resid = 0.0005226275 + CG iteration 100: r_norm = 4.46025613 rel_resid = 0.0005015379 + CG iteration 101: r_norm = 4.08484772 rel_resid = 0.0004593247 + CG iteration 102: r_norm = 4.03037335 rel_resid = 0.0004531993 + CG iteration 103: r_norm = 3.80278356 rel_resid = 0.0004276077 + CG iteration 104: r_norm = 3.68412999 rel_resid = 0.0004142656 + CG iteration 105: r_norm = 3.55713783 rel_resid = 0.0003999859 + CG iteration 106: r_norm = 3.67058056 rel_resid = 0.0004127420 + CG iteration 107: r_norm = 3.69781822 rel_resid = 0.0004158048 + CG iteration 108: r_norm = 3.54574118 rel_resid = 0.0003987044 + CG iteration 109: r_norm = 3.24116642 rel_resid = 0.0003644561 + CG iteration 110: r_norm = 3.08467614 rel_resid = 0.0003468594 + CG iteration 111: r_norm = 3.04970554 rel_resid = 0.0003429271 + CG iteration 112: r_norm = 2.81396300 rel_resid = 0.0003164188 + CG iteration 113: r_norm = 2.80291740 rel_resid = 0.0003151768 + CG iteration 114: r_norm = 2.62542797 rel_resid = 0.0002952188 + CG iteration 115: r_norm = 2.38092247 rel_resid = 0.0002677252 + CG iteration 116: r_norm = 2.41000145 rel_resid = 0.0002709950 + CG iteration 117: r_norm = 2.37948000 rel_resid = 0.0002675630 + CG iteration 118: r_norm = 2.30045197 rel_resid = 0.0002586766 + CG iteration 119: r_norm = 2.19891519 rel_resid = 0.0002472592 + CG iteration 120: r_norm = 2.14094345 rel_resid = 0.0002407405 + CG iteration 121: r_norm = 2.05958434 rel_resid = 0.0002315920 + CG iteration 122: r_norm = 1.96089928 rel_resid = 0.0002204952 + CG iteration 123: r_norm = 1.89027414 rel_resid = 0.0002125537 + CG iteration 124: r_norm = 1.84224722 rel_resid = 0.0002071533 + CG iteration 125: r_norm = 1.82503292 rel_resid = 0.0002052176 + CG iteration 126: r_norm = 1.69054286 rel_resid = 0.0001900948 + CG iteration 127: r_norm = 1.66218061 rel_resid = 0.0001869055 + CG iteration 128: r_norm = 1.70973413 rel_resid = 0.0001922527 + CG iteration 129: r_norm = 1.53412693 rel_resid = 0.0001725064 + CG iteration 130: r_norm = 1.55958146 rel_resid = 0.0001753687 + CG iteration 131: r_norm = 1.49372106 rel_resid = 0.0001679629 + CG iteration 132: r_norm = 1.48548444 rel_resid = 0.0001670368 + CG iteration 133: r_norm = 1.43058190 rel_resid = 0.0001608632 + CG iteration 134: r_norm = 1.32900982 rel_resid = 0.0001494418 + CG iteration 135: r_norm = 1.33136683 rel_resid = 0.0001497069 + CG iteration 136: r_norm = 1.34191880 rel_resid = 0.0001508934 + CG iteration 137: r_norm = 1.29990642 rel_resid = 0.0001461693 + CG iteration 138: r_norm = 1.24629579 rel_resid = 0.0001401410 + CG iteration 139: r_norm = 1.23236934 rel_resid = 0.0001385750 + CG iteration 140: r_norm = 1.18576157 rel_resid = 0.0001333341 + CG iteration 141: r_norm = 1.18689092 rel_resid = 0.0001334611 + CG iteration 142: r_norm = 1.12580024 rel_resid = 0.0001265917 + CG iteration 143: r_norm = 1.18976584 rel_resid = 0.0001337844 + CG iteration 144: r_norm = 1.14744710 rel_resid = 0.0001290258 + CG iteration 145: r_norm = 1.15145723 rel_resid = 0.0001294767 + CG iteration 146: r_norm = 1.10558078 rel_resid = 0.0001243181 + CG iteration 147: r_norm = 1.07237516 rel_resid = 0.0001205843 + CG iteration 148: r_norm = 1.00863187 rel_resid = 0.0001134166 + CG iteration 149: r_norm = 0.98456063 rel_resid = 0.0001107099 + CG iteration 150: r_norm = 0.95356638 rel_resid = 0.0001072247 + CG iteration 151: r_norm = 0.87312980 rel_resid = 0.0000981799 + MT LS: Number of function evals = 1 + MT LS: step = 1.0000000000 + Newton Iteration: 1 J = 53.3725799957 Residual = 0.8731298034 + Minimum J: 53.3725799957 + Found minimum in 1 outer Newton iterations. + (and a total of 151 inner CG iterations.) + FINAL ||g(X)||/||g(X0)|| = 0.0000981799 + (Linesearch iterations = 1 ) +runTime: Cost3D minimize: 20.4124290000 +Outputting increment... +Outputting analysis... +runTime: Cost3d update: 4.5529970000 +Analysis successful! diff --git a/ncar_scripts/validation/validation.py b/ncar_scripts/validation/validation.py new file mode 100644 index 0000000..b7503a0 --- /dev/null +++ b/ncar_scripts/validation/validation.py @@ -0,0 +1,65 @@ +import re +import argparse +import math +import numpy as np + +# Set up command line argument parsing +parser = argparse.ArgumentParser(description='Usage: python validation.py refernce_log_file run_log_file') +parser.add_argument('ref', type=str, help='Reference log file') +parser.add_argument('run', type=str, help='Run log file') + +args = parser.parse_args() + +ref = args.ref +run = args.run + +if ref is None or run is None: + raise ValueError('Please provide reference and run log files') + +def parseFile(file): + pattern = r"CG iteration\s+(\d+):\s+r_norm =\s+(\d+(\.\d+)?)\s+rel_resid =\s+(\d+(\.\d+)?)" + + with open(file) as f: + data = f.read() + + matches = re.findall(pattern, data) + + # Initialize lists + cg_iterations = [] + r_norms = [] + rel_resids = [] + + # Populate lists + for match in matches: + cg_iterations.append(int(match[0])) + r_norms.append(float(match[1])) + rel_resids.append(float(match[3])) + + # Create dictionary + data_dict = { + 'CG iteration': cg_iterations, + 'r_norm': r_norms, + 'rel_resid': rel_resids + } + + return data_dict + +def calculate_rms(dict1, dict2): + if set(dict1.keys()) != set(dict2.keys()): + raise ValueError("Dictionaries have different keys") + + rms_values = {} + for key in dict1.keys(): + diff = np.array(dict1[key]) - np.array(dict2[key]) + square_diff = np.square(diff) + mean_square_diff = np.mean(square_diff) + rms = np.sqrt(mean_square_diff) + rms_values[key] = rms + + return rms_values + +ref_data = parseFile(ref) +run_data = parseFile(run) +rms_values = calculate_rms(ref_data, run_data) +for key, rms in rms_values.items(): + print(f'RMS value for {key}: {rms}') \ No newline at end of file