Conversation
remove old directories
remove old directories
remove old directories
remove old directories
remove old directories
remove old directories
Co-authored-by: Jeffrey Curtis <jcurtis2@illinois.edu>
Co-authored-by: Jeffrey Curtis <jcurtis2@illinois.edu>
…tate_saturated_vapor_pressure_wrt_water
|
closing and reopening to trigger codecov analysis in further commits |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #205 +/- ##
===========================================
+ Coverage 0 77.40% +77.40%
===========================================
Files 0 55 +55
Lines 0 9427 +9427
===========================================
+ Hits 0 7297 +7297
- Misses 0 2130 +2130 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| add_test(test_tchem ${CMAKE_BINARY_DIR}/test_run/run_test_directory.sh tchem) | ||
| endif() | ||
| add_test(test_weighting ${CMAKE_BINARY_DIR}/test_run/run_test_directory.sh weighting) | ||
| #>>>>>>> 2341ef410d6f49f3169b8461b5fa8c89dbd3c7a2 |
There was a problem hiding this comment.
this seems to be a merge-conflict leftover to be removed?
There was a problem hiding this comment.
would it be better to make it a part of the web-publishable doxygen html?
There was a problem hiding this comment.
IIUC, the lack of these additions was not detected by CI, it would be great to add a mechanism at least parsing all the scenario input on CI
There was a problem hiding this comment.
Yeah, this is a fairly common occurrence. The urban_plume scenarios are often fixed but the scenarios that often require more libraries (SUNDIALs for condense, CAMP) are often overlooked. This is often as simple as missing a spec file line change/addition. In this case, it would be a lack of adding things in aero_data.dat for most scenarios or a more special case in terms of the CAMP scenario. The CAMP test caught this, it was fixed in the test but not in the scenario til later.
I think that something that simply attempts to run a 0 second simulation will work in terms of reading in all inputs.
| aerosol_diameter = aero_particle_dry_diameter(aero_particle, aero_data) | ||
| immersed_surface_area = const%pi * aerosol_diameter **2 | ||
|
|
||
| total_vol = 0d0 |
There was a problem hiding this comment.
| total_vol = 0d0 |
| if (i_spec == aero_data%i_water) cycle | ||
| abifm_m = aero_data%abifm_m(i_spec) | ||
| abifm_c = aero_data%abifm_c(i_spec) | ||
| j_het = 10 ** (abifm_m * (1 - a_w_ice) + abifm_c) * 10000 |
There was a problem hiding this comment.
| j_het = 10 ** (abifm_m * (1 - a_w_ice) + abifm_c) * 10000 | |
| j_het = 10d0 ** (abifm_m * (1d0 - a_w_ice) + abifm_c) * 10000 |
Also define what the 10000 is.
| !> Initialization for the sigular scheme, sampling the freezing temperature | ||
| !> for each particles. |
There was a problem hiding this comment.
| !> Initialization for the sigular scheme, sampling the freezing temperature | |
| !> for each particles. | |
| !> Initialization for the singular scheme, sampling the freezing | |
| !> temperature for each particle. |
| !> for each particles. | ||
| subroutine ice_nucleation_singular_initialize(aero_state, aero_data, & | ||
| INAS_a, INAS_b) | ||
| implicit none |
There was a problem hiding this comment.
| implicit none |
| subroutine ice_nucleation_immersion_freezing_time_dependent(aero_state, & | ||
| aero_data, env_state, del_t, immersion_freezing_scheme_type, & | ||
| freezing_rate) | ||
|
|
||
| !> Aerosol state. | ||
| type(aero_state_t), intent(inout) :: aero_state | ||
| !> Aerosol data. | ||
| type(aero_data_t), intent(in) :: aero_data | ||
| !> Environment state. | ||
| type(env_state_t), intent(inout) :: env_state | ||
| !> Total time to integrate. | ||
| real(kind=dp), intent(in) :: del_t | ||
| !> Freezing rate (only used for the constant rate scheme). | ||
| real(kind=dp), intent(in) :: freezing_rate | ||
| integer, intent(in) :: immersion_freezing_scheme_type | ||
|
|
||
| integer :: i_part, i_bin, i_class, n_bins, n_class | ||
| real(kind=dp) :: a_w_ice, pis, pvs | ||
| real(kind=dp) :: p_freeze | ||
|
|
||
| real(kind=dp) :: p_freeze_max, radius_max, diameter_max | ||
|
|
||
| integer :: k_th, n_parts_in_bin | ||
| real(kind=dp) :: rand | ||
| real(kind=dp), allocatable :: H2O_masses(:), total_masses(:), & | ||
| H2O_frac(:) | ||
| integer :: i_spec_max | ||
| real(kind=dp) :: j_het_max | ||
| integer :: rand_geo | ||
|
|
||
|
|
||
| allocate(total_masses(aero_state_n_part(aero_state))) | ||
| allocate(H2O_masses(aero_state_n_part(aero_state))) | ||
| allocate(H2O_frac(aero_state_n_part(aero_state))) | ||
|
|
||
| call aero_state_sort(aero_state, aero_data) | ||
|
|
||
| total_masses = aero_state_masses(aero_state, aero_data) | ||
| H2O_masses = aero_state_masses(aero_state, aero_data, include=["H2O"]) | ||
| H2O_frac = H2O_masses / total_masses | ||
| pvs = env_state_saturated_vapor_pressure_wrt_water(env_state%temp) | ||
| pis = env_state_saturated_vapor_pressure_wrt_ice(env_state%temp) | ||
| a_w_ice = pis / pvs | ||
| if (immersion_freezing_scheme_type == IMMERSION_FREEZING_SCHEME_ABIFM) then | ||
| call ABIFM_max_spec(aero_data, a_w_ice, i_spec_max, j_het_max) | ||
| endif | ||
|
|
||
| n_bins = aero_sorted_n_bin(aero_state%aero_sorted) | ||
| n_class = aero_sorted_n_class(aero_state%aero_sorted) | ||
|
|
||
| loop_bins: do i_bin = 1, n_bins | ||
| loop_classes: do i_class = 1, n_class | ||
| n_parts_in_bin = integer_varray_n_entry(& | ||
| aero_state%aero_sorted%size_class%inverse(i_bin, i_class)) | ||
| radius_max = aero_state%aero_sorted%bin_grid%edges(i_bin + 1) | ||
| diameter_max = radius_max * 2 | ||
| if (immersion_freezing_scheme_type == & | ||
| IMMERSION_FREEZING_SCHEME_ABIFM) then | ||
| p_freeze_max = ABIFM_Pfrz_max(diameter_max, aero_data, j_het_max, & | ||
| del_t) | ||
| else if (immersion_freezing_scheme_type == & | ||
| IMMERSION_FREEZING_SCHEME_CONST) then | ||
| p_freeze_max = 1 - exp(freezing_rate * del_t) | ||
| endif | ||
|
|
||
| k_th = n_parts_in_bin + 1 | ||
| loop_choosed_particles: do while(.TRUE.) | ||
| rand_geo = rand_geometric(p_freeze_max) | ||
| k_th = k_th - rand_geo | ||
| if (k_th <= 0) then | ||
| EXIT loop_choosed_particles | ||
| endif | ||
| i_part = aero_state%aero_sorted%size_class & | ||
| %inverse(i_bin, i_class)%entry(k_th) | ||
| if (aero_state%apa%particle(i_part)%frozen) then | ||
| cycle | ||
| end if | ||
| if (H2O_frac(i_part) < const%imf_water_threshold) then | ||
| cycle | ||
| end if | ||
| if (immersion_freezing_scheme_type == & | ||
| IMMERSION_FREEZING_SCHEME_ABIFM) then | ||
| p_freeze = ABIFM_Pfrz_particle( & | ||
| aero_state%apa%particle(i_part), aero_data, a_w_ice, del_t) | ||
| call warn_assert_msg(301184565, p_freeze <= p_freeze_max,& | ||
| "p_freeze > p_freeze_max.") | ||
| rand = pmc_random() | ||
| if (rand < p_freeze / p_freeze_max) then | ||
| aero_state%apa%particle(i_part)%frozen = .TRUE. | ||
| aero_state%apa%particle(i_part)%den_ice = & | ||
| const%reference_ice_density | ||
| aero_state%apa%particle(i_part)%ice_shape_phi = 1d0 | ||
|
|
||
| endif | ||
| else | ||
| aero_state%apa%particle(i_part)%frozen = .TRUE. | ||
| aero_state%apa%particle(i_part)%den_ice = & | ||
| const%reference_ice_density | ||
| aero_state%apa%particle(i_part)%ice_shape_phi = 1d0 | ||
| endif | ||
|
|
||
| enddo loop_choosed_particles | ||
| enddo loop_classes | ||
| enddo loop_bins | ||
|
|
||
| deallocate(total_masses) | ||
| deallocate(H2O_masses) | ||
| deallocate(H2O_frac) | ||
|
|
||
| end subroutine ice_nucleation_immersion_freezing_time_dependent |
There was a problem hiding this comment.
Fix all enddo and endif to be end do and end if
| else if (immersion_freezing_scheme_type == & | ||
| IMMERSION_FREEZING_SCHEME_CONST) then | ||
| p_freeze = 1 - exp(freezing_rate * del_t) | ||
| end if |
There was a problem hiding this comment.
p_freeze for IMMERSION_FREEZING_SCHEME_CONST doesn't rely on the particle at all. I think it would be worth considering moving outside the loop.
| else if (immersion_freezing_scheme_type == & | ||
| IMMERSION_FREEZING_SCHEME_CONST) then | ||
| p_freeze_max = 1 - exp(freezing_rate * del_t) | ||
| endif |
There was a problem hiding this comment.
If I understand correctly, consider refactoring p_freeze_max outside all these loops for the constant case.
Co-authored-by: Jeffrey Curtis <jcurtis2@illinois.edu>
Co-authored-by: Jeffrey Curtis <jcurtis2@illinois.edu>
Co-authored-by: Jeffrey Curtis <jcurtis2@illinois.edu>
Add the immersion freezing simulation codes, freezing test case, and freezing scenario.