@@ -487,7 +487,8 @@ end function per_particle_size
487
487
! ! For a single particle representation, the unique names will be a 'P'
488
488
! ! followed by the computational particle number, a '.', the phase name,
489
489
! ! another '.', and the species name.
490
- function unique_names (this , phase_name , tracer_type , spec_name )
490
+ function unique_names (this , phase_name , tracer_type , spec_name , &
491
+ phase_is_at_surface )
491
492
492
493
use camp_util, only : integer_to_string
493
494
! > List of unique names
@@ -500,6 +501,8 @@ function unique_names(this, phase_name, tracer_type, spec_name)
500
501
integer (kind= i_kind), optional , intent (in ) :: tracer_type
501
502
! > Aerosol-phase species name
502
503
character (len=* ), optional , intent (in ) :: spec_name
504
+ ! > Indicates if aerosol phase is at the surface of particle
505
+ logical , optional , intent (in ) :: phase_is_at_surface
503
506
504
507
integer :: i_particle, i_layer, i_phase, i_spec, j_spec
505
508
integer :: num_spec, curr_tracer_type
@@ -520,6 +523,10 @@ function unique_names(this, phase_name, tracer_type, spec_name)
520
523
if (present (phase_name)) then
521
524
if (phase_name .ne. this% aero_phase(i_phase)% val% name ()) cycle
522
525
end if
526
+ if (present (phase_is_at_surface)) then
527
+ if (phase_is_at_surface .neqv. &
528
+ this% aero_phase_is_at_surface(i_phase)) cycle
529
+ end if
523
530
if (present (spec_name) .or. present (tracer_type)) then
524
531
spec_names = this% aero_phase(i_phase)% val% get_species_names()
525
532
do j_spec = 1 , size (spec_names)
@@ -549,6 +556,10 @@ function unique_names(this, phase_name, tracer_type, spec_name)
549
556
if (present (phase_name)) then
550
557
if (phase_name .ne. this% aero_phase(i_phase)% val% name ()) cycle
551
558
end if
559
+ if (present (phase_is_at_surface)) then
560
+ if (phase_is_at_surface .neqv. &
561
+ this% aero_phase_is_at_surface(i_phase)) cycle
562
+ end if
552
563
spec_names = this% aero_phase(i_phase)% val% get_species_names()
553
564
do j_spec = 1 , this% aero_phase(i_phase)% val% size ()
554
565
if (present (spec_name)) then
@@ -641,27 +652,25 @@ end function spec_name
641
652
! ! particle representation with layers, a phase can exist in multiple layers
642
653
! ! in one particle.
643
654
integer (kind= i_kind) function num_phase_instances(this, phase_name, &
644
- num_is_at_surface )
655
+ is_at_surface )
645
656
646
657
! > Aerosol representation data
647
658
class(aero_rep_single_particle_t), intent (in ) :: this
648
659
! > Aerosol phase name
649
660
character (len=* ), intent (in ) :: phase_name
650
661
! > Indicates if aerosol phase is at the surface of particle
651
- logical , intent (in ), optional :: num_is_at_surface
662
+ logical , intent (in ), optional :: is_at_surface
652
663
653
664
integer (kind= i_kind) :: i_phase, i_layer, phase_index
654
665
655
-
656
666
num_phase_instances = 0
657
- phase_index = 0
658
- if (present (num_is_at_surface)) then
659
- if (num_is_at_surface) then
667
+ if (present (is_at_surface)) then
668
+ if (is_at_surface) then
660
669
do i_layer = 1 , NUM_LAYERS_
661
670
do i_phase = LAYER_PHASE_START_(i_layer), LAYER_PHASE_END_(i_layer)
662
671
if (this% aero_phase(i_phase)% val% name () .eq. phase_name .and. &
663
672
this% aero_phase_is_at_surface(i_phase)) then
664
- phase_index = phase_index + 1
673
+ num_phase_instances = num_phase_instances + 1
665
674
end if
666
675
end do
667
676
end do
@@ -670,7 +679,7 @@ integer(kind=i_kind) function num_phase_instances(this, phase_name, &
670
679
do i_phase = LAYER_PHASE_START_(i_layer), LAYER_PHASE_END_(i_layer)
671
680
if (this% aero_phase(i_phase)% val% name () .eq. phase_name .and. &
672
681
.not. this% aero_phase_is_at_surface(i_phase)) then
673
- phase_index = phase_index + 1
682
+ num_phase_instances = num_phase_instances + 1
674
683
end if
675
684
end do
676
685
end do
@@ -679,12 +688,12 @@ integer(kind=i_kind) function num_phase_instances(this, phase_name, &
679
688
do i_layer = 1 , NUM_LAYERS_
680
689
do i_phase = LAYER_PHASE_START_(i_layer), LAYER_PHASE_END_(i_layer)
681
690
if (this% aero_phase(i_phase)% val% name () .eq. phase_name) then
682
- phase_index = phase_index + 1
691
+ num_phase_instances = num_phase_instances + 1
683
692
end if
684
693
end do
685
694
end do
686
695
end if
687
- num_phase_instances = phase_index * MAX_PARTICLES_
696
+ num_phase_instances = num_phase_instances * MAX_PARTICLES_
688
697
689
698
end function num_phase_instances
690
699
0 commit comments