Skip to content

Commit

Permalink
check SZA and Earth-Sun distance in test
Browse files Browse the repository at this point in the history
  • Loading branch information
mattldawson committed May 22, 2024
1 parent 4e2876f commit b6d5e62
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions test/regression/solvers/delta_eddington.F90
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ subroutine test_cpp_delta_eddington_solver_t(config_file_path)
earth_sun_distance => core%get_profile( "Earth-Sun distance", "AU" )

! Run the solver for each set of conditions
allocate( f90_radiation_fields( columns%ncells_ ) )
do i_column = 1, columns%ncells_
allocate( f90_radiation_fields( columns%ncells_ + 1 ) )
do i_column = 1, columns%ncells_ + 1
call core%run( solar_zenith_angle%edge_val_( i_column ), &
earth_sun_distance%edge_val_( i_column ) )

Expand Down
17 changes: 15 additions & 2 deletions test/regression/solvers/delta_eddington.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,25 @@ void CheckInputs(const std::vector<double>& solar_zenith_angles,
const std::map<std::string, tuvx::Profile<tuvx::Array2D<double>>>& profiles,
const tuvx::RadiatorState<tuvx::Array3D<double>>& accumulated_radiator_states)
{
// Solar zenith angles have been converted to radians from degrees
ASSERT(solar_zenith_angles.size() == 2);
ASSERT(solar_zenith_angles.at(0) > 1.8294 * 3.14159265 / 180.0);
ASSERT(solar_zenith_angles.at(0) < 1.8295 * 3.14159265 / 180.0);
ASSERT(solar_zenith_angles.at(1) > 28.199 * 3.14159265 / 180.0);
ASSERT(solar_zenith_angles.at(1) < 28.200 * 3.14159265 / 180.0);

// Earth-Sun distances are in AU
ASSERT(earth_sun_distances.size() == 2);
ASSERT(earth_sun_distances.at(0) > 0.9961);
ASSERT(earth_sun_distances.at(0) < 0.9962);
ASSERT(earth_sun_distances.at(1) > 0.9962);
ASSERT(earth_sun_distances.at(1) < 0.9963);

// heights have been converted to meters from km
ASSERT(grids.size() == 2);
ASSERT(grids.at("altitude [m]").NumberOfColumns() == 2);
ASSERT(grids.at("altitude [m]").NumberOfSections() == 120);
ASSERT(!grids.at("altitude [m]").IsConstant());
// heights have been converted to meters from km
ASSERT(grids.at("altitude [m]").edges_(0,0) == 0.0);
ASSERT(grids.at("altitude [m]").edges_(42,0) == 42000.0);
ASSERT(grids.at("altitude [m]").edges_(120,0) == 120000.0);
Expand All @@ -77,10 +89,11 @@ void CheckInputs(const std::vector<double>& solar_zenith_angles,
ASSERT(grids.at("altitude [m]").mid_points_(0,1) == 500.0);
ASSERT(grids.at("altitude [m]").mid_points_(41,1) == 41500.0);
ASSERT(grids.at("altitude [m]").mid_points_(119,1) == 119500.0);

// wavelengths have been converted to meters from nm
ASSERT(grids.at("wavelength [m]").NumberOfColumns() == 1);
ASSERT(grids.at("wavelength [m]").NumberOfSections() == 156);
ASSERT(grids.at("wavelength [m]").IsConstant());
// wavelengths have been converted to meters from nm
ASSERT(grids.at("wavelength [m]").edges_(0,0) == 120.0*1.0e-9);
ASSERT(grids.at("wavelength [m]").edges_(77,0) == 311.5*1.0e-9);
ASSERT(grids.at("wavelength [m]").edges_(156,0) == 735.0*1.0e-9);
Expand Down

0 comments on commit b6d5e62

Please sign in to comment.