Go to the documentation of this file.
61 real(kind=
dp) :: frac_dim
63 real(kind=
dp) :: prime_radius
65 real(kind=
dp) :: vol_fill_factor
95 real(kind=
dp),
intent(in) :: v
111 real(kind=
dp),
intent(in) :: v
132 real(kind=
dp),
intent(in) :: v
147 real(kind=
dp),
intent(in) :: r
168 real(kind=
dp),
intent(in) :: d
183 if (
fractal%frac_dim <= 2d0)
then
185 elseif ((
fractal%frac_dim > 2d0) .and. (
fractal%frac_dim <= 3d0))
then
188 call die_msg(110248362,
'volume fractal dimension larger than 3')
204 real(kind=
dp),
intent(in) :: v
206 real(kind=
dp) :: ds, n
212 *
fractal%prime_radius**2 * n**(ds / 3d0) * ((ds - 2d0) &
229 + 0.6353d0 *
fractal%frac_dim - 0.4898d0
244 real(kind=
dp),
intent(in) :: v
262 real(kind=
dp),
intent(in) :: v
279 real(kind=
dp),
intent(in) :: r_eff
281 real(kind=
dp),
intent(in) :: temp
283 real(kind=
dp),
intent(in) :: pressure
301 if (
fractal%frac_dim == 3d0 .and.
fractal%vol_fill_factor == 1d0)
then
321 real(kind=
dp),
intent(in) :: v
323 real(kind=
dp),
intent(in) :: temp
325 real(kind=
dp),
intent(in) :: pressure
327 real(kind=
dp),
parameter :: newton_rel_tol = 1d-14
328 integer,
parameter :: newton_max_steps = 10
331 real(kind=
dp) :: rmec, reff, c_reff, fp, f, df
332 real(kind=
dp) :: a1, a2, a3, a4, a5
333 integer ::newton_step
351 do newton_step = 1,newton_max_steps
352 f = a1 * x**2 + a2 * x + a3 * exp(a4 * x) + a5
353 df = 2d0 * a1 * x + a2 + a3 * a4 * exp(a4 * x)
355 if (abs(f / df) / (abs(x + f / df) + abs(x)) &
356 < newton_rel_tol)
exit
358 call assert_msg(728724732, newton_step < newton_max_steps, &
359 "fractal Newton loop failed to converge")
371 fractal, mobility_rad, temp, pressure)
376 real(kind=
dp),
intent(in) :: mobility_rad
378 real(kind=
dp),
intent(in) :: temp
380 real(kind=
dp),
intent(in) :: pressure
382 real(kind=
dp),
parameter :: newton_rel_tol = 1d-14
383 integer,
parameter :: newton_max_steps = 10
386 real(kind=
dp) :: c_rme, fp, phi, ds, psi, c1, c2, f, df
387 real(kind=
dp) :: a1, a2, a3, a4, a5, a6, a7, a8
388 integer :: newton_step
396 psi = 1d0 / (
fractal%vol_fill_factor &
402 c2 =
fractal%frac_dim * ds / 3d0 - 1d0
403 a1 = c_rme / mobility_rad * phi * psi * (ds - 2d0)
404 a2 = c_rme / mobility_rad * phi * (3d0 - ds)
405 a3 = -phi * psi * (ds - 2d0)
406 a4 = phi * (ds - 3d0)
413 do newton_step = 1,newton_max_steps
414 f = a1 * x**(c1 + 1d0) + a2 * x**(c2 + 1d0) + a3 * x**c1 &
415 + a4 * x**c2 + a5 * exp(a6 * x**c1 + a7 * x**c2) + a8
416 df = a1 * (c1 + 1d0) * x**c1 + a2 * (c2 + 1d0) * x**c2 &
417 + a3 * c1 * x**(c1 - 1d0) + a4 * c2 * x**(c2 - 1d0) &
418 + a5 * (a6 * c1 * x**(c1 - 1d0) + a7 * c2 * x**(c2 - 1d0)) &
419 * exp(a6 * x**c1 + a7 * x**c2)
421 if (abs(f / df) / (abs(x + f / df) + abs(x)) &
422 < newton_rel_tol)
exit
424 call assert_msg(875871349, newton_step < newton_max_steps, &
425 "fractal Newton loop failed to converge")
435 mobility_rad, temp, pressure)
440 real(kind=
dp),
intent(in) :: mobility_rad
442 real(kind=
dp),
intent(in) :: temp
444 real(kind=
dp),
intent(in) :: pressure
446 real(kind=
dp) :: rmec
454 mobility_rad, temp, pressure)
472 real(kind=
dp),
intent(in) :: mobility_rad
474 real(kind=
dp),
intent(in) :: temp
476 real(kind=
dp),
intent(in) :: pressure
478 real(kind=
dp) :: rgeo
507 character,
intent(inout) :: buffer(:)
509 integer,
intent(inout) :: position
513 integer :: prev_position
515 prev_position = position
530 character,
intent(inout) :: buffer(:)
532 integer,
intent(inout) :: position
536 integer :: prev_position
538 prev_position = position
550 subroutine spec_file_read_fractal(file, fractal)
555 type(
fractal_t),
intent(inout) :: fractal
557 logical :: do_fractal
584 fractal%prime_radius)
586 fractal%vol_fill_factor)
587 call assert_msg(801987241, fractal%frac_dim <= 3d0, &
588 'fractal dimension greater than 3')
593 end subroutine spec_file_read_fractal
598 subroutine fractal_output_netcdf(fractal, ncid)
619 unit=
"1", description=
"particle volume fractal dimension")
621 "fractal_prime_radius", unit=
"m", &
622 description=
"radius of primary particles")
624 "fractal_vol_fill_factor", unit=
"1", &
625 description=
"volume filling factor")
627 end subroutine fractal_output_netcdf
635 type(
fractal_t),
intent(inout) :: fractal
637 integer,
intent(in) :: ncid
642 "fractal_vol_fill_factor")
real(kind=dp) function fractal_surface_frac_dim(fractal)
Compute surface fractal dimension .
real(kind=dp) elemental function fractal_vol2rad(fractal, v)
Convert mass-equivalent volume (m^3) to geometric radius (m).
Wrapper functions for MPI.
integer function pmc_mpi_pack_size_real(val)
Determines the number of bytes required to pack the given value.
integer function pmc_mpi_pack_size_fractal(val)
Determines the number of bytes required to pack the given value.
real(kind=dp) elemental function sphere_rad2vol(r)
Convert geometric radius (m) to mass-equivalent volume (m^3) for spherical particles.
real(kind=dp), parameter fractal_a_slip
Constant in slip correction equation in Eq. 22 of Naumann [2003].
subroutine die_msg(code, error_msg)
Error immediately.
real(kind=dp) function fractal_mobility_rad_to_mobility_rad_in_continuum(fractal, mobility_rad, temp, pressure)
Convert mobility equivalent radius (m) to that in the continuum regime (m).
Wrapper functions for NetCDF. These all take a NetCDF ncid in data mode and return with it again in d...
integer, parameter dp
Kind of a double precision real number.
Reading formatted text input.
subroutine pmc_mpi_unpack_fractal(buffer, position, val)
Unpacks the given value from the buffer, advancing position.
subroutine spec_file_read_logical(file, name, var)
Read a logical from a spec file that must have a given name.
real(kind=dp) function fractal_slip_correct(R_eff, temp, pressure)
Slip correction function from continuum to free molecular regime.
subroutine pmc_mpi_pack_real(buffer, position, val)
Packs the given value into the buffer, advancing position.
subroutine assert(code, condition_ok)
Errors unless condition_ok is true.
subroutine fractal_input_netcdf(fractal, ncid)
Read full state.
real(kind=dp), parameter fractal_b_slip
Constant in slip correction equation in Eq. 22 of Naumann [2003].
real(kind=dp) elemental function fractal_diam2vol(fractal, d)
Convert geometric diameter (m) to mass-equivalent volume (m^3).
An input file with extra data for printing messages.
real(kind=dp) function fractal_mobility_rad_to_vol(fractal, mobility_rad, temp, pressure)
Convert mobility equivalent radius (m) to mass-equivalent volume (m^3).
real(kind=dp) elemental function sphere_vol2rad(v)
Convert mass-equivalent volume (m^3) to geometric radius (m) for spherical particles.
real(kind=dp), parameter fractal_scale_exponent_s_acc
Scaling exponent in calculating accessible particle surface area in Eq. 26 of Naumann [2003].
real(kind=dp) function fractal_vol_to_accessible_surface(fractal, v)
Convert mass-equivalent volume (m^3) to accessible particle surface area (m^2).
subroutine spec_file_read_real(file, name, var)
Read a real number from a spec file that must have the given name.
subroutine assert_msg(code, condition_ok, error_msg)
Errors unless condition_ok is true.
real(kind=dp) elemental function diam2rad(d)
Convert diameter (m) to radius (m).
real(kind=dp) elemental function fractal_vol2diam(fractal, v)
Convert mass-equivalent volume (m^3) to geometric diameter (m).
subroutine pmc_nc_write_real(ncid, var, name, unit, long_name, standard_name, description)
Write a single real to a NetCDF file.
real(kind=dp) function fractal_vol_to_mobility_rad_in_continuum(fractal, v)
Convert mass-equivalent volume (m^3) to continuum regime mobility equivalent radius (m).
type(const_t), save const
Fixed variable for accessing the constant's values.
elemental logical function fractal_is_spherical(fractal)
Test whether a particle is spherical.
real(kind=dp) function fractal_mobility_rad_to_geometric_rad(fractal, mobility_rad, temp, pressure)
Convert mobility equivalent radius (m) to geometric radius (m^3).
type(fractal_t), intent(in) fractal
real(kind=dp) function fractal_vol_to_mobility_rad(fractal, v, temp, pressure)
Convert mass-equivalent volume (m^3) to mobility equivalent radius (m).
real(kind=dp) elemental function fractal_vol_to_num_of_monomers(fractal, v)
Convert mass-equivalent volume (m^3) to number of monomers in a fractal particle cluster.
The fractal_t structure and associated subroutines.
real(kind=dp), parameter fractal_q_slip
Constant in slip correction equation in Eq. 22 of Naumann [2003].
real(kind=dp) function air_mean_free_path(temp, pressure)
Calculate air molecular mean free path (m).
real(kind=dp) function fractal_vol_to_effective_rad(fractal, v)
Convert mass-equivalent volume (m^3) to particle effective radius (m).
real(kind=dp), parameter fractal_scale_factor_s_acc
Scaling factor in calculating accessible particle surface area in Eq. 26 of Naumann [2003].
real(kind=dp) elemental function fractal_rad2vol(fractal, r)
Convert geometric radius (m) to mass-equivalent volume (m^3).
subroutine pmc_nc_read_real(ncid, var, name, must_be_present)
Read a single real from a NetCDF file.
subroutine fractal_set_spherical(fractal)
Set fractal parameters for spherical particles.
subroutine pmc_mpi_pack_fractal(buffer, position, val)
Packs the given value into the buffer, advancing position.
subroutine pmc_mpi_unpack_real(buffer, position, val)
Unpacks the given value from the buffer, advancing position.
real(kind=dp) function fractal_kirkwood_riseman(fractal)
Kirkwood-Riseman ratio .