16 use base_random,
only : rand_uni => rand_r4
17 use base_utils,
only : cspline_scalar
29 integer,
dimension(HISTORY_SIZE) :: total_n_food_ingested
31 real(srp),
dimension(HISTORY_SIZE) :: total_mass_food_ingested
33 real(srp),
dimension(HISTORY_SIZE) :: total_mass_evacuated
35 real(srp),
dimension(HISTORY_SIZE) :: food_mass_absorb_curr
37 real(srp),
dimension(HISTORY_SIZE) :: food_mass_absorb_cum
39 real(srp),
dimension(HISTORY_SIZE) :: energy_balance_curr
41 real(srp),
dimension(HISTORY_SIZE) :: body_mass_current
64 real(srp) :: body_mass0
102 integer :: time_in_process
106 integer :: ingestion_delay
128 real(srp) :: absorped
130 integer :: time_in_mg
132 integer :: time_absorbed
140 procedure,
public :: is_evacuate => &
148 real(srp) :: mass_stomach
153 integer :: n_food_items_stomach
183 real(srp) :: mass_midgut
188 integer :: n_food_items_midgut
310 real(srp),
intent(in) :: mass
313 stomach = 0.0007_srp * mass ** 1.829_srp
321 integer,
optional,
intent(in) :: id_num
325 if (
present(id_num))
then
331 this%history%food_mass_absorb_curr = missing
332 this%history%food_mass_absorb_cum = missing
333 this%history%energy_balance_curr = missing
334 this%history%body_mass_current = missing
336 this%history%total_n_food_ingested = 0
337 this%history%total_mass_food_ingested = 0.0_srp
338 this%history%total_mass_evacuated = 0.0_srp
341 call add_to_history(this%history%body_mass_current,this%body_mass0)
347 is_per_hour, time_step)
result(smr_out)
350 real(srp),
intent(in) :: temperature
353 logical,
optional,
intent(in) :: is_per_hour
355 integer(LONG),
optional,
intent(in) :: time_step
359 logical :: is_hour_loc
360 integer(LONG) :: step_loc
362 if (
present(is_per_hour))
then
363 is_hour_loc = is_per_hour
365 is_hour_loc = .false.
368 if (
present(time_step))
then
376 is_hour_loc, step_loc )
382 is_per_hour, time_step)
result(smr_out)
384 real(srp),
intent(in) :: body_mass
386 real(srp),
intent(in) :: temperature
389 logical,
optional,
intent(in) :: is_per_hour
391 integer(LONG),
optional,
intent(in) :: time_step
395 logical :: is_hour_loc
396 integer(LONG) :: step_loc
398 if (
present(is_per_hour))
then
399 is_hour_loc = is_per_hour
401 is_hour_loc = .false.
404 if (
present(time_step))
then
410 if ( is_hour_loc )
then
419 smr_out = smr_out + &
434 real(srp),
intent(in) :: fish_mass
436 real(srp),
intent(in) :: swimming_speed
439 integer,
intent(in),
optional :: time_unit
442 real(srp) :: amr_h_out
444 integer :: time_unit_loc
448 real(srp),
parameter :: a = 0.24_srp
449 real(srp),
parameter :: b = 0.80_srp
450 real(srp),
parameter :: c = 0.60_srp
452 if (
present(time_unit))
then
453 time_unit_loc = time_unit
458 associate( m => fish_mass, u => swimming_speed, amr => amr_h_out )
460 amr = a * m**b * u**c
466 amr_h_out = time_unit_loc * amr_h_out/
hour
473 temperature, is_exclude_smr, is_per_hour)
result (amr_out)
474 class(
fish),
intent(in) :: this
476 real(srp),
optional,
intent(in) :: temperature
481 logical,
optional,
intent(in) :: is_exclude_smr
484 logical,
optional,
intent(in) :: is_per_hour
488 logical :: is_exclude_smr_loc, is_per_hour_loc
489 real(srp) :: current_activity, temp_loc
491 if (
present(is_exclude_smr))
then
492 is_exclude_smr_loc = is_exclude_smr
494 is_exclude_smr_loc = .false.
497 if (
present(is_per_hour))
then
498 is_per_hour_loc = is_per_hour
500 is_per_hour_loc = .false.
503 if (
present(temperature))
then
504 temp_loc = temperature
506 temp_loc = global_temperature
509 current_activity = this%activity_baseline() * this%activity_appetite()
511 if (is_per_hour_loc)
then
512 amr_out = salmon_oxygen_consumption( &
513 g2kg(this%mass()), temp_loc, current_activity, &
516 amr_out = salmon_oxygen_consumption( &
517 g2kg(this%mass()), temp_loc, current_activity )
520 if (is_exclude_smr_loc) amr_out = amr_out - this%smr(temp_loc)
528 real(srp) :: energy_out
530 real(srp),
parameter :: protein_cont=0.15_srp, protein_energy=24.0_srp, &
531 fat_cont =0.23_srp, fat_energy =35.0_srp
533 real(srp) :: protein_fish, fat_fish
536 protein_fish = this%mass() * protein_cont * protein_energy
537 fat_fish = this%mass() * fat_cont * fat_energy
539 energy_out = protein_fish + fat_fish
548 real(srp),
intent(in) :: body_energy
550 real(srp) :: mass_get
552 real(srp),
parameter :: protein_cont=0.15_srp, protein_energy=24.0_srp, &
553 fat_cont =0.23_srp, fat_energy =35.0_srp
556 mass_get = body_energy / &
557 ( protein_cont * protein_energy + fat_cont * fat_energy )
566 mass, start_mass, delay)
570 real(srp),
optional,
intent(in) :: mass
574 real(srp),
optional,
intent(in) :: start_mass
578 integer,
optional,
intent(in) :: delay
580 if (
present(mass))
then
581 call this%init( mass )
583 call this%init( missing )
586 this%time_in_process = 0
588 if (
present(delay))
then
589 this%ingestion_delay = delay
591 this%ingestion_delay = global_ingestion_delay_min * minute
601 mass, start_mass, delay)
605 real(srp),
optional,
intent(in) :: mass
608 real(srp),
optional,
intent(in) :: start_mass
612 integer,
optional,
intent(in) :: delay
615 real(srp) :: mass_loc
618 if (
present(mass))
then
624 if (
present(delay))
then
627 delay_loc = global_digestion_delay_min * minute
634 if (
present(start_mass))
then
635 this%mass_0 = start_mass
637 this%mass_0 = this%mass
640 this%absorped = 0.0_srp
644 this%time_absorbed = 0
655 class(food_item),
intent(in) :: food_item_in
660 integer,
optional,
intent(in) :: ingest_delay
668 call this%copy( food_item_in )
673 this%time_in_process = 0
675 if (
present(ingest_delay))
then
676 this%ingestion_delay = ingest_delay
678 this%ingestion_delay = global_ingestion_delay_min * minute
688 integer,
optional,
intent(in) :: t_increment
692 if (
present(t_increment))
then
693 inc_loc = t_increment
698 this%time_in_process = this%time_in_process + inc_loc
704 is_destructed, tolerance, max_time )
708 logical,
optional,
intent(out) :: is_destructed
711 real(srp),
optional,
intent(in) :: tolerance
715 integer,
optional,
intent(in) :: max_time
718 real(srp) :: toler_loc
720 if (
present(tolerance))
then
721 toler_loc = tolerance
723 toler_loc = min_mass_toler
726 if ( this%mass < toler_loc )
then
728 if (
present(is_destructed)) is_destructed = .true.
730 if (
present(is_destructed)) is_destructed = .false.
738 is_destructed, tolerance, max_time )
742 logical,
optional,
intent(out) :: is_destructed
746 real(srp),
optional,
intent(in) :: tolerance
751 integer,
optional,
intent(in) :: max_time
753 integer :: max_time_loc
755 if (
present(max_time))
then
756 max_time_loc = max_time
758 max_time_loc = global_maximum_duration_midgut_min * minute
761 if ( this%is_evacuate(max_time_loc) )
then
765 if (
present(is_destructed)) is_destructed = .true.
767 if (
present(is_destructed)) is_destructed = .false.
776 max_time)
result(is_destruct)
782 integer,
optional,
intent(in) :: max_time
784 logical :: is_destruct
786 integer :: max_time_loc
788 if (
present(max_time))
then
789 max_time_loc = max_time
791 max_time_loc = global_maximum_duration_midgut_min * minute
794 if ( this%time_absorbed >= max_time_loc )
then
797 is_destruct = .false.
807 real(srp),
optional,
intent(in) :: max_absorb
809 logical :: is_absorbed
811 real(srp) :: max_absorb_loc
813 check_invalid:
if (this%mass_0==missing.or.this%absorped==0.0_srp)
then
814 is_absorbed = .false.
818 if (
present(max_absorb))
then
819 max_absorb_loc = max_absorb
821 max_absorb_loc = this%mass_0 * global_absorption_ratio
824 if ( this%absorped <= max_absorb_loc - min_mass_toler )
then
825 is_absorbed = .false.
836 ingestion_delay, water_uptake, rescale )
result (volume_out)
838 integer,
intent(in) :: time_in_process
841 real(srp),
optional,
intent(in) :: dry_mass
845 integer,
optional,
intent(in) :: ingestion_delay
848 real(srp),
optional,
intent(in) :: water_uptake
850 real(srp),
optional,
intent(in) :: rescale
852 real(srp) :: volume_out
855 real(srp) :: dry_mass_loc, water_uptake_loc, rescale_loc
856 integer :: ingestion_delay_loc
862 if (
present(dry_mass))
then
863 dry_mass_loc = dry_mass
865 dry_mass_loc = global_food_item_mass
868 if (
present(ingestion_delay))
then
869 ingestion_delay_loc = ingestion_delay
871 ingestion_delay_loc = global_ingestion_delay_min * minute
874 if (
present(water_uptake))
then
875 water_uptake_loc = water_uptake
877 water_uptake_loc = global_water_uptake
880 if (
present(rescale))
then
881 rescale_loc = rescale
883 rescale_loc = 1.0_srp
909 max_vol = dry_mass_loc + dry_mass_loc * water_uptake_loc
916 if ( time_in_process <= 0 )
then
917 volume_out = global_food_item_mass
918 else if ( time_in_process < ingestion_delay_loc )
then
919 associate( t => real(time_in_process, srp), &
920 cm => max_vol, c0 => dry_mass_loc, &
921 a => global_water_uptake_a, &
922 r => global_water_uptake_r )
923 volume_out = c0 + logistic( t, a, cm-c0, r )
938 cspline_scalar( real(global_transport_pattern_t, srp)*rescale_loc,&
939 global_transport_pattern_r, &
940 real(time_in_process - ingestion_delay_loc, srp) )
949 class(
stomach),
intent(inout) :: this
951 real(srp),
optional,
intent(in) :: mass
953 if(
present(mass))
then
954 this%mass_stomach = mass
956 this%mass_stomach = global_stomach_mass
959 this%n_food_items_stomach = 0
963 call this%food_items_stomach%zero()
969 class(
stomach),
intent(inout) :: this
973 logical,
allocatable,
dimension(:) :: is_destruct
975 debug_check_max_stom:
if (is_debug)
then
976 if (this%n_food_items_stomach > &
977 max_food_items_index * debug_warn_level )
then
978 write(*,*)
"DEBUG_CHECK_MAX_STOM: N of food items in stomach ", &
979 this%n_food_items_stomach,
" exceeds ", &
980 nint(max_food_items_index * debug_warn_level)
982 if (this%n_food_items_stomach > max_food_items_index)
then
983 write(*,*)
"DEBUG_CHECK_MAX_STOM: N of food items in stomach ", &
984 this%n_food_items_stomach,
" exceeds MAX_FOOD_ITEMS_INDEX=",&
988 end if debug_check_max_stom
990 allocate( is_destruct(this%n_food_items_stomach) )
992 is_destruct = .false.
995 associate( stom_foods &
996 => this%food_items_stomach(1:this%n_food_items_stomach) )
1001 call stom_foods%time_update()
1010 call stom_foods%check_disappear(is_destructed=is_destruct)
1011 this%n_food_items_stomach = this%n_food_items_stomach - count(is_destruct)
1017 if ( this%n_food_items_stomach < 0 ) this%n_food_items_stomach = 0
1018 if ( this%n_food_items_stomach >= max_food_items_index ) &
1019 this%n_food_items_stomach = max_food_items_index
1026 class(
fish),
intent(inout) :: this
1029 class(food_item),
intent(in) :: food_item_ingested
1035 call add_to_history( this%history%total_n_food_ingested, &
1036 last(this%history%total_n_food_ingested) + 1 )
1038 call add_to_history( this%history%total_mass_food_ingested, &
1039 last(this%history%total_mass_food_ingested) + &
1040 food_item_ingested%mass )
1045 call new_food_item_in%init_ingest( food_item_ingested )
1050 this%food_items_stomach(2:this%n_food_items_stomach+1) = &
1051 this%food_items_stomach(1:this%n_food_items_stomach)
1053 this%food_items_stomach(1) = new_food_item_in
1056 this%n_food_items_stomach = this%n_food_items_stomach + 1
1059 call this%add_midgut( food_item_ingested )
1066 class(
stomach),
intent(in) :: this
1069 real(srp),
optional,
intent(in) :: tolerance
1071 real(srp) :: total_mass
1074 real(srp) :: toler_loc
1076 if (
present(tolerance))
then
1077 toler_loc = tolerance
1079 toler_loc = min_mass_toler
1084 associate( foods_stomach &
1085 => this%food_items_stomach(1:this%n_food_items_stomach) )
1086 total_mass = sum( foods_stomach%mass, &
1087 foods_stomach%mass > toler_loc .and. &
1088 foods_stomach%mass /= missing )
1098 class(
stomach),
intent(in) :: this
1099 real(srp),
optional,
intent(in) :: fcapacity
1100 real(srp) :: appetite
1102 real(srp) :: fcapacity_loc
1104 real(srp) :: mass_relative
1106 if (
present(fcapacity))
then
1107 fcapacity_loc = fcapacity
1109 fcapacity_loc = global_stomach_mass
1118 mass_relative = this%st_food_mass()/fcapacity_loc
1133 appetite =
appetite_func( mass_relative, global_appetite_logist_a, &
1134 global_appetite_logist_r )
1143 class(
midgut),
intent(inout) :: this
1145 real(srp),
optional,
intent(in) :: mass
1147 if(
present(mass))
then
1148 this%mass_midgut = mass
1150 this%mass_midgut = global_midgut_mass
1153 this%n_food_items_midgut = 0
1157 call this%food_items_midgut%zero()
1163 class(
midgut),
intent(inout) :: this
1166 real(srp),
optional,
intent(in) :: dry_mass
1168 integer,
optional,
intent(in) :: t_increment
1171 real(srp) :: dry_mass_loc
1178 real(srp) :: absorbed_i , mass_0
1183 real(srp),
parameter :: threshold_min_vol = min_mass_toler
1187 real(srp),
dimension(MAX_FOOD_ITEMS_INDEX) :: delta_vol
1191 logical,
allocatable,
dimension(:) :: is_destruct
1197 debug_check_max_midgut:
if (is_debug)
then
1198 if (this%n_food_items_midgut > &
1199 max_food_items_index * debug_warn_level )
then
1200 write(*,
"(a,i4,a,i4)") &
1201 "DEBUG_CHECK_MAX_MIDGUT: N of food items in midgut ", &
1202 this%n_food_items_midgut,
" exceeds ", &
1203 nint(max_food_items_index * debug_warn_level)
1205 if (this%n_food_items_midgut > max_food_items_index)
then
1206 write(*,
"(a,i4,a,i4)") &
1207 "DEBUG_CHECK_MAX_MIDGUT: N of food items in midgut ", &
1208 this%n_food_items_midgut,
" exceeds MAX_FOOD_ITEMS_INDEX=",&
1209 max_food_items_index
1212 end if debug_check_max_midgut
1214 allocate( is_destruct(this%n_food_items_midgut) )
1215 is_destruct = .false.
1219 if (
present(dry_mass))
then
1220 dry_mass_loc = dry_mass
1222 dry_mass_loc = global_food_item_mass
1225 if (
present(t_increment))
then
1226 inc_loc = t_increment
1249 associate(stom_foods => &
1250 this%food_items_stomach(1:this%n_food_items_stomach))
1252 where ( stom_foods%time_in_process > stom_foods%ingestion_delay .and. &
1253 stom_foods%time_in_process /= unknown )
1254 delta_vol(1:this%n_food_items_stomach) = &
1258 delta_vol(1:this%n_food_items_stomach) = 0.0_srp
1266 delta_vol(this%n_food_items_stomach+1:this%n_food_items_midgut) = 0.0_srp
1273 associate( midgut_foods => &
1274 this%food_items_midgut(1:this%n_food_items_midgut) )
1276 midgut_foods%mass = midgut_foods%mass + &
1277 delta_vol(1:this%n_food_items_midgut)
1278 midgut_foods%time_in_process = midgut_foods%time_in_process + inc_loc
1281 where ( midgut_foods%mass >= threshold_min_vol .and. &
1282 delta_vol > 0.0_srp )
1283 midgut_foods%time_in_mg = midgut_foods%time_in_mg + 1
1306 do_absorp:
do i=this%n_food_items_stomach+1, this%n_food_items_midgut
1308 associate( midgut_foods => this%food_items_midgut(i), &
1309 r => this%mg_food_mass() / this%mass_midgut, &
1310 rmax => global_mid_gut_mm_r_max, &
1311 km => global_mid_gut_mm_k_m )
1314 midgut_foods%time_in_mg = midgut_foods%time_in_mg + 1
1316 debug_check_full_midgut_delta:
if (is_debug)
then
1317 if ( delta_vol(i) > 0.0_srp )
then
1318 write(*,*)
"DEBUG_CHECK_FULL_MIDGUT_DELTA: `delta_vol` nonzero [",&
1319 i,
"], ", delta_vol(i),
", certainly eror"
1321 end if debug_check_full_midgut_delta
1323 if ( (midgut_foods%time_in_mg > midgut_foods%ingestion_delay) .and. &
1324 (.not. midgut_foods%is_absorbed_full()) )
then
1326 mass_0 = midgut_foods%mass
1327 absorbed_i = mass_0 * michaelis_menten( r, rmax, km )
1329 midgut_foods%mass = midgut_foods%mass - absorbed_i * &
1330 midgut_temp_factor(global_temperature)
1332 if ( midgut_foods%mass < midgut_foods%mass_0 - &
1333 midgut_foods%mass_0 * global_absorption_ratio )
then
1335 midgut_foods%mass = midgut_foods%mass_0 - &
1336 midgut_foods%mass_0 * global_absorption_ratio
1338 midgut_foods%absorped = midgut_foods%mass_0*global_absorption_ratio
1342 midgut_foods%absorped = &
1343 min( midgut_foods%mass_0 * global_absorption_ratio, &
1344 midgut_foods%absorped + &
1345 ( mass_0 - midgut_foods%mass ) )
1354 debug_digest_checks:
if (is_debug)
then
1355 associate( midgut_foods => &
1356 this%food_items_midgut(1:this%n_food_items_midgut) )
1357 if (any(midgut_foods%ingestion_delay/=global_digestion_delay_min &
1359 write(*,*)
"DEBUG_DIGEST_CHECKS: midgut digestion delay mismatch: ",&
1360 global_digestion_delay_min, midgut_foods%ingestion_delay
1363 if ( any(midgut_foods%absorped > &
1364 midgut_foods%mass_0 * global_absorption_ratio ) )
then
1365 write(*,*)
"DEBUG_DIGEST_CHECKS: exceed absorption MAX ratio at ", &
1366 global_time_step ,
" step, count ", &
1367 count(midgut_foods%absorped > &
1368 midgut_foods%mass_0 * global_absorption_ratio ), &
1369 ", total Ns ", this%n_food_items_stomach,
"/", &
1370 this%n_food_items_midgut,
" stomach/midgut"
1373 end if debug_digest_checks
1380 associate( foods_midgut_not_stom => &
1381 this%food_items_midgut( &
1382 this%n_food_items_stomach+1:this%n_food_items_midgut) )
1387 where ( foods_midgut_not_stom%is_absorbed_full() )
1388 foods_midgut_not_stom%time_absorbed = &
1389 foods_midgut_not_stom%time_absorbed + 1
1392 debug_digest_disappear:
if ( is_debug )
then
1393 if ( any( foods_midgut_not_stom%time_absorbed > &
1394 global_maximum_duration_midgut_min * minute ) )
then
1395 write(*,*)
"DEBUG_DIGEST_DISAPPEAR: must remove ", &
1396 count( foods_midgut_not_stom%time_absorbed > &
1397 global_maximum_duration_midgut_min * minute ),&
1398 " at time ", global_time_step
1400 end if debug_digest_disappear
1403 call add_to_history( this%history%total_mass_evacuated, &
1404 last(this%history%total_mass_evacuated) + &
1405 this%evacuated_step() )
1409 call foods_midgut_not_stom%check_disappear( is_destructed=is_destruct )
1413 this%n_food_items_midgut = this%n_food_items_midgut-count( is_destruct )
1415 debug_check_subzero_food:
if (is_debug)
then
1416 if ( any( foods_midgut_not_stom%mass < 0.00000001_srp .and. &
1417 foods_midgut_not_stom%mass /= missing ) )
then
1418 write(*,*)
"DEBUG_CHECK_SUBZERO_FOOD: midgut food items are " // &
1419 "suspiciously small"
1420 write(*,*)
" ", foods_midgut_not_stom%mass
1423 end if debug_check_subzero_food
1428 call this%history_update()
1436 class(
fish),
intent(inout) :: this
1439 real(srp),
optional,
intent(in) :: temperature
1442 real(srp),
optional,
intent(in) :: start_value
1444 integer :: hist_length, absorb_last_item
1445 real(srp) :: absorp_increment
1447 real(srp) :: temp_loc, start_loc
1449 real(srp),
parameter :: balance_start = 0.0_srp
1450 real(srp) :: balance_current
1452 if (
present(temperature))
then
1453 temp_loc = temperature
1455 temp_loc = global_temperature
1458 if (
present(start_value))
then
1459 start_loc = start_value
1461 start_loc = balance_start
1464 balance_current = temp_loc
1466 hist_length =
size(this%history%food_mass_absorb_cum)
1470 absorb_last_item = this%absorp_last_i()
1482 if ( absorb_last_item == 1 )
then
1483 call add_to_history(this%history%energy_balance_curr, start_loc - &
1484 energy_o2(o2vol(mg2g( this%smr(temp_loc) ))) )
1487 absorp_increment = this%history%food_mass_absorb_cum(hist_length) - &
1488 this%history%food_mass_absorb_cum(hist_length-1)
1490 balance_current = this%history%energy_balance_curr(hist_length) &
1491 + feed_energy(absorp_increment) &
1492 - this%uptake_energy(temp_loc)
1494 call add_to_history( this%history%energy_balance_curr, balance_current )
1503 class(
fish),
intent(in) :: this
1506 real(srp),
optional,
intent(in) :: temperature
1511 logical,
optional,
intent(in) :: is_oxygen
1514 real(srp) :: temp_loc
1515 logical :: set_is_oxygen
1517 if (
present(temperature))
then
1518 temp_loc = temperature
1520 temp_loc = global_temperature
1523 if (
present(is_oxygen))
then
1524 set_is_oxygen = is_oxygen
1526 set_is_oxygen = .false.
1529 if (set_is_oxygen)
then
1530 ue_ze = mg2g(this%smr(temp_loc)) * global_ue_ze_factor
1532 if (global_is_ue_ze_fixed_rate)
then
1543 from_micro(global_ue_ze_ammonia_excretion) ) &
1546 ue_ze = energy_o2(o2vol(mg2g(this%smr(temp_loc)))) * global_ue_ze_factor
1554 real(srp),
parameter :: ammonia_molar_mass=17.03052_srp
1555 real(srp),
parameter :: nitrogen_molar_mass=14.006747_srp
1557 real(srp),
intent(in) :: mol
1559 logical,
intent(in),
optional :: is_ammonia
1561 logical :: use_ammonia
1563 if (
present(is_ammonia))
then
1564 use_ammonia = is_ammonia
1566 use_ammonia = .false.
1569 if (use_ammonia)
then
1570 gram = mol * ammonia_molar_mass
1572 gram = mol * nitrogen_molar_mass
1598 real(srp),
intent(in) :: excreted_nitrogen
1600 logical,
optional,
intent(in) :: is_kg
1603 logical :: is_kg_loc
1605 real(srp),
parameter :: energ_g_nitro = 24.85_srp
1607 if (
present(is_kg))
then
1613 bue = excreted_nitrogen * energ_g_nitro
1615 if (is_kg_loc) bue = bue / 1000.0_srp
1627 class(
fish),
intent(in) :: this
1628 real(srp),
optional,
intent(in) :: temperature
1631 logical,
optional,
intent(in) :: sda_off
1634 real(srp) :: temp_loc
1635 logical :: sda_off_debug
1637 if (
present(temperature))
then
1638 temp_loc = temperature
1640 temp_loc = global_temperature
1643 if (
present(sda_off))
then
1644 sda_off_debug = sda_off
1646 sda_off_debug = .false.
1650 kj_out = energy_o2(o2vol(mg2g(this%smr(temp_loc)))) + &
1651 energy_o2(o2vol(mg2g(this%amr(temp_loc)))) + &
1652 this%ue_ze(temp_loc)
1654 if (.NOT. sda_off_debug)
then
1656 energy_o2(o2vol(mg2g(this%smr(temp_loc)))) * &
1657 this%sda_fact(global_sda_absorp_rate_max, &
1658 global_sda_factor_max)
1668 is_mass, sda_off)
result (o2_out)
1669 class(
fish),
intent(in) :: this
1670 real(srp),
optional,
intent(in) :: temperature
1673 logical,
optional,
intent(in) :: is_mass
1676 logical,
optional,
intent(in) :: sda_off
1681 logical,
parameter :: is_include_ue_ze = .false.
1683 real(srp) :: temp_loc
1684 logical :: is_mass_g, sda_off_debug
1686 if (
present(temperature))
then
1687 temp_loc = temperature
1689 temp_loc = global_temperature
1692 if (
present(sda_off))
then
1693 sda_off_debug = sda_off
1695 sda_off_debug = .false.
1698 if (
present(is_mass))
then
1706 o2_out = mg2g(this%smr(temp_loc)) + &
1707 mg2g(this%amr(temp_loc))
1709 if (is_include_ue_ze) &
1710 o2_out=o2_out+this%ue_ze(temp_loc, is_oxygen=.true.)
1711 if (.NOT. sda_off_debug)
then
1712 o2_out = o2_out + mg2g(this%smr(temp_loc)) * &
1713 this%sda_fact(global_sda_absorp_rate_max, &
1714 global_sda_factor_max)
1718 o2_out = o2vol(mg2g(this%smr(temp_loc))) + &
1719 o2vol(mg2g(this%amr(temp_loc)))
1720 if (is_include_ue_ze) &
1721 o2_out=o2_out+o2vol(this%ue_ze(temp_loc, is_oxygen=.true.))
1722 if (.NOT. sda_off_debug)
then
1723 o2_out = o2_out + o2vol(mg2g(this%smr(temp_loc))) * &
1724 this%sda_fact(global_sda_absorp_rate_max, &
1725 global_sda_factor_max)
1748 use base_utils,
only : solve_line
1749 class(
fish),
intent(in) :: this
1752 real(srp),
intent(in) :: max_ap
1754 real(srp),
intent(in) :: max_sda
1755 logical,
optional,
intent(in) :: is_limit
1756 real(srp) :: ap_fact
1757 real(srp),
parameter :: max_ultimate = 24.0_srp
1761 call solve_line(k, b, 0.0_srp, 0.0_srp, max_ap, max_sda)
1763 ap_fact = k * this%absorption_rate() + b
1765 if (
present(is_limit))
then
1766 if (is_limit) ap_fact = within(ap_fact, 0.0_srp, max_sda)
1768 ap_fact = within(ap_fact, 0.0_srp, max_ultimate)
1775 class(
fish),
intent(inout) :: this
1777 real(srp) :: updated_mass, last_ebal, prev_ebal
1784 if (global_time_step > 1)
then
1786 last_ebal = last(this%history%energy_balance_curr)
1787 prev_ebal = this%history%energy_balance_curr( &
1788 size(this%history%energy_balance_curr)-1 )
1795 updated_mass = last(this%history%body_mass_current) + &
1798 call add_to_history( this%history%body_mass_current, updated_mass )
1813 class(
midgut),
intent(in) :: this
1814 real(srp) :: volume_out
1819 integer,
optional,
intent(in) :: max_time
1822 integer :: max_time_loc
1824 if (
present(max_time))
then
1825 max_time_loc = max_time
1827 max_time_loc = global_maximum_duration_midgut_min * minute
1830 volume_out = 0.0_srp
1832 associate( foods_midgut_not_stom => &
1833 this%food_items_midgut( &
1834 this%n_food_items_stomach+1:this%n_food_items_midgut) )
1836 do i = 1,
size(foods_midgut_not_stom)
1837 if ( foods_midgut_not_stom(i)%is_evacuate(max_time_loc) )
then
1838 volume_out = volume_out + foods_midgut_not_stom(i)%mass_0 - &
1839 foods_midgut_not_stom(i)%absorped
1855 class(
midgut),
intent(in) :: this
1861 integer,
optional,
intent(in) :: max_time
1863 integer :: max_time_loc
1865 if (
present(max_time))
then
1866 max_time_loc = max_time
1868 max_time_loc = global_maximum_duration_midgut_min * minute
1871 associate( foods_midgut_not_stom => &
1872 this%food_items_midgut( &
1873 this%n_food_items_stomach+1:this%n_food_items_midgut) )
1874 n_out = count( foods_midgut_not_stom%is_evacuate(max_time_loc) )
1881 class(
midgut),
intent(inout) :: this
1883 integer :: absorb_last_item
1884 real(srp) :: absorp_prev, absorp_total, absorp_diff, absorp_cumulate
1888 absorb_last_item = this%absorp_last_i()
1894 if ( absorb_last_item == 0 )
then
1895 absorp_prev = 0.0_srp
1896 absorp_total = 0.0_srp
1897 absorp_cumulate = 0.0_srp
1899 absorp_prev = this%history%food_mass_absorb_cum(absorb_last_item)
1901 sum( this%food_items_midgut(1:this%n_food_items_midgut)%absorped, &
1902 this%food_items_midgut(1:this%n_food_items_midgut)%absorped &
1908 absorp_diff = absorp_total - &
1909 this%history%food_mass_absorb_curr( absorb_last_item )
1910 if ( absorp_diff > 0.0_srp )
then
1911 absorp_cumulate = absorp_prev + absorp_diff
1913 absorp_cumulate = absorp_prev
1917 call add_to_history( this%history%food_mass_absorb_curr, absorp_total )
1918 call add_to_history( this%history%food_mass_absorb_cum, absorp_cumulate )
1928 class(
midgut),
intent(in) :: this
1930 integer :: absorb_last_item
1934 absorb_last_item = count( this%history%food_mass_absorb_cum == missing )
1943 class(
midgut),
intent(in) :: this
1946 real(srp),
optional,
intent(in) :: tolerance
1948 real(srp) :: total_mass
1951 real(srp) :: toler_loc
1953 if (
present(tolerance))
then
1954 toler_loc = tolerance
1956 toler_loc = min_mass_toler
1961 associate( foods_midgut &
1962 => this%food_items_midgut(1:this%n_food_items_midgut) )
1964 sum( foods_midgut%mass, &
1965 foods_midgut%mass > toler_loc .and. &
1966 foods_midgut%mass /= missing )
1981 class(
midgut),
intent(in) :: this
1982 real(srp),
optional,
intent(in) :: fcapacity
1983 real(srp) :: appetite
1985 real(srp) :: fcapacity_loc
1987 real(srp) :: mass_relative, correction_fac
1989 if (
present(fcapacity))
then
1990 fcapacity_loc = fcapacity
1992 fcapacity_loc = this%mass_midgut
2001 mass_relative = this%mg_food_mass()/fcapacity_loc
2006 correction_fac = this%mass_midgut / this%mass_stomach
2022 global_appetite_logist_a, &
2023 global_appetite_logist_r )
2030 class(
midgut),
intent(in) :: this
2031 real(srp) :: out_rate
2033 if( global_time_step == 1 .or. this%absorp_last_i()<
history_size/2 )
then
2041 out_rate = this%history%food_mass_absorb_cum( this%absorp_last_i() ) - &
2042 this%history%food_mass_absorb_cum( this%absorp_last_i()-1 )
2048 class(
midgut),
intent(in) :: this
2049 real(srp) :: out_factor
2051 real(srp) :: absorp_rate
2053 real(srp),
dimension(*),
parameter :: grid_test_x = [0.0_srp, 0.00003_srp],&
2054 grid_test_y = [0.0_srp, 1.0_srp]
2057 absorp_rate = this%absorption_rate()
2059 if ( absorp_rate >= grid_test_x(1) .and. &
2060 absorp_rate <= grid_test_x(
size(grid_test_x)) )
then
2061 out_factor = cspline_scalar( grid_test_x, grid_test_y, absorp_rate )
2062 else if ( absorp_rate < grid_test_x(1) )
then
2063 out_factor = grid_test_y(1)
2065 out_factor = grid_test_y(
size(grid_test_y))
2074 class(
midgut),
intent(inout) :: this
2078 class(food_item),
optional,
intent(in) :: food_item_pass
2081 real(srp) :: food_item_pass_start_mass_loc
2083 if (
present(food_item_pass))
then
2084 select type ( food_item_pass )
2086 food_item_pass_start_mass_loc = food_item_pass%mass
2088 food_item_pass_start_mass_loc = food_item_pass%mass
2090 food_item_pass_start_mass_loc = food_item_pass%mass_0
2092 food_item_pass_start_mass_loc = food_item_pass%mass
2095 food_item_pass_start_mass_loc = global_food_item_mass
2101 this%food_items_midgut(2:this%n_food_items_midgut+1) = &
2102 this%food_items_midgut(1:this%n_food_items_midgut)
2111 call this%food_items_midgut(1)%zero( &
2113 start_mass=food_item_pass_start_mass_loc )
2115 this%n_food_items_midgut = this%n_food_items_midgut + 1
2136 real(srp),
intent(in) :: mass_relative
2138 real(srp),
intent(in) :: a
2140 real(srp),
intent(in) :: r
2142 real(srp) :: value_out
2144 value_out = 1.0_srp - logistic( mass_relative, a, 1.0_srp, r )
2152 class(
fish),
intent(in) :: this
2154 integer(LONG),
optional,
intent(in) :: time_step
2155 real(srp) :: appetite
2156 integer(LONG) :: step_loc
2159 if ( .not. is_day() .and. global_appetite_fish_night >= 0.0_srp )
then
2160 appetite = global_appetite_fish_night
2164 if(
present(time_step))
then
2165 step_loc = time_step
2167 step_loc = global_time_step
2187 if ( this%appetite_stomach() < global_appetite_stomach_threshold )
then
2188 appetite = this%appetite_stomach()
2190 appetite = maxval( [ this%appetite_stomach(), this%appetite_midgut(), &
2191 this%appetite_energy() ] )
2195 if (is_stress_enable) &
2214 use base_utils,
only : cspline_scalar
2216 integer,
intent(in) :: time_step_incr
2219 logical,
optional,
intent(in) :: is_force
2222 logical :: is_force_loc
2224 if (
present(is_force))
then
2225 is_force_loc = is_force
2227 is_force_loc = .false.
2230 if ( is_stress() .or. is_force_loc )
then
2231 fout = cspline_scalar( hour * global_stress_factor_hour, &
2232 global_stress_fact_suppress, &
2233 real(time_step_incr, srp) )
2244 use base_utils,
only : cspline_vector
2246 integer,
dimension(:),
intent(in) :: time_step_incr
2249 logical,
optional,
intent(in) :: is_force
2250 real(srp),
allocatable,
dimension(:) :: fout
2252 logical :: is_force_loc
2254 if (
present(is_force))
then
2255 is_force_loc = is_force
2257 is_force_loc = .false.
2260 if (.NOT.
allocated(fout))
allocate(fout(
size(time_step_incr)))
2262 if ( is_stress() .or. is_force_loc )
then
2263 fout = cspline_vector( hour * global_stress_factor_hour, &
2264 global_stress_fact_suppress, &
2265 real(time_step_incr, srp) )
2287 integer(LONG),
intent(in),
optional :: time_step
2290 integer :: i, last_stress, time_over
2291 integer(LONG) :: time_loc
2295 if (.not. is_stress() )
then
2299 if (
present(time_step))
then
2300 time_loc = time_step
2302 time_loc = global_time_step
2305 last_stress = unknown
2308 do i = 1,
size(global_stress_intervention_time)
2309 if ( time_loc >= global_stress_intervention_time(i) )
then
2316 if (last_stress == unknown)
then
2322 time_over = time_loc - global_stress_intervention_time(last_stress)
2324 if (time_over <= last(global_stress_factor_hour)*hour)
then
2330 if (fout <= small ) fout = 0.0_srp
2339 real(srp) :: current_mass_get
2341 current_mass_get = last( this%history%body_mass_current )
2347 result(appetite_factor)
2348 class(
fish),
intent(in) :: this
2349 real(srp) :: appetite_factor
2352 real(hrp) :: ebal_older, ebal_newer
2353 real(hrp) :: ebal_diff
2354 integer,
parameter :: block_size = 4
2355 real(hrp) :: delta_e, appetite_hg
2357 hist_len =
size(this%history%energy_balance_curr)
2360 if (global_time_step < block_size*2 )
then
2361 appetite_factor = 0.0_srp
2365 associate( e_hist => this%history%energy_balance_curr )
2367 if (block_size < 4 .or. hist_len < block_size*2)
then
2368 ebal_older = e_hist(hist_len-1)
2369 ebal_newer = e_hist(hist_len)
2372 ebal_older = average(e_hist(hist_len-2*block_size+1:hist_len-block_size), &
2373 undef_ret_null=.true.)
2375 ebal_newer = average(e_hist(hist_len-block_size+1:hist_len), &
2376 undef_ret_null=.true.)
2380 ebal_diff = ebal_newer - ebal_older
2393 associate( r_e => real(global_energy_appetite_rate,hrp), &
2394 b_e => real(global_energy_appetite_shift,hrp) )
2396 delta_e = ebal_diff/this%smr(global_temperature)
2401 if (delta_e < 10.0_hrp * tiny(1.0_srp)) delta_e = 0.0_hrp
2402 if (delta_e > 10.0_hrp) delta_e = 10.0_hrp
2404 appetite_hg = 1.0_hrp / (1.0_hrp + exp(-r_e * (-delta_e-b_e)))
2405 appetite_factor = real(appetite_hg, srp)
2417 class(
fish),
intent(inout) :: this
2419 class(food_item),
intent(in) :: food_item_in
2422 logical,
optional,
intent(out) :: have_eaten
2424 if (
present(have_eaten)) have_eaten = .false.
2426 if ( rand_uni() < this%appetite() )
then
2427 call this%do_ingest( food_item_in )
2428 if (
present(have_eaten)) have_eaten = .true.
2439 class(
fish),
intent(inout) :: this
2441 class(food_item),
pointer,
intent(in) :: food_item_in
2444 logical,
optional,
intent(out) :: have_eaten
2446 if (
present(have_eaten)) have_eaten = .false.
2448 if ( .NOT.
associated(food_item_in) )
return
2450 if ( rand_uni() < this%appetite() )
then
2451 call this%do_ingest( food_item_in )
2452 if (
present(have_eaten)) have_eaten = .true.
2479 class(
fish),
intent(in) :: this
2482 integer(LONG),
optional,
intent(in) :: time_step
2484 real(srp) :: act_out
2486 integer(LONG) :: time_step_loc, i
2488 if (
present(time_step))
then
2489 time_step_loc = time_step
2491 time_step_loc = global_time_step
2494 if ( is_day(time_step_loc) )
then
2495 act_out = global_baseline_activity_day
2497 act_out = global_baseline_activity_night
2500 if (is_stress_enable) &
2501 act_out = act_out - &
2502 act_out * global_stress_activity_decr * &
2524 class(
fish),
intent(in) :: this
2525 real(srp) :: act_out
2527 act_out = global_appetite_activity_factor * this%appetite() + 1.0_srp
2535 real(srp) :: adj_out
2538 integer,
optional,
intent(in) :: target_emptying_time
2539 real(srp),
parameter :: min_diff = 0.00001
2542 integer :: target_empty_loc
2544 if (
present(target_emptying_time))
then
2545 target_empty_loc = target_emptying_time
2547 target_empty_loc = &
2551 do i=1, global_transport_dim
2552 if ( global_transport_pattern_r(i) < min_diff )
then
2554 real(target_empty_loc,srp)/
real(Global_Transport_Pattern_T(i),srp)
2564 result(empty_time_raw)
2566 real(srp),
optional,
intent(in) :: fish_mass
2568 real(srp),
optional,
intent(in) :: temperature
2569 integer :: empty_time_raw
2571 integer :: temp_size, i
2572 real(srp) :: mass_loc, temperature_loc
2575 dimension(size(Global_Stomach_Emptying_Pattern%grid_temperature)) :: x_t
2577 if (
present(fish_mass))
then
2578 mass_loc = fish_mass
2580 mass_loc = global_body_mass
2583 if (
present(temperature))
then
2584 temperature_loc = temperature
2586 temperature_loc = global_temperature
2589 temp_size =
size(global_stomach_emptying_pattern%grid_temperature)
2592 x_t(i) = cspline_scalar( &
2593 global_stomach_emptying_pattern%grid_mass, &
2594 real(global_stomach_emptying_pattern%emptying_time(:,i),srp), &
2598 empty_time_raw = nint( cspline_scalar( &
2599 global_stomach_emptying_pattern%grid_temperature, &
2600 x_t, temperature_loc ) )
2609 result(empty_time_raw)
2610 class(
stomach),
intent(in) :: this
2611 integer :: empty_time_raw
2614 real(srp),
optional,
intent(in) :: temperature
2616 real(srp) :: temp_loc
2618 if (
present(temperature))
then
2619 temp_loc = temperature
2621 temp_loc = global_temperature
2641 use csv_io ,
only: csv_matrix_read
2643 character(len=*),
intent(in) :: csv_file
2644 type(stomach_emptying_pattern) :: pattern_out
2646 real(srp),
allocatable,
dimension(:,:) :: raw_data_csv
2647 logical :: is_success
2649 raw_data_csv = transpose( &
2650 csv_matrix_read( csv_file, csv_file_status=is_success, &
2651 missing_code=missing ) )
2654 pattern_out%grid_mass = raw_data_csv(2:,1)
2656 pattern_out%grid_temperature = raw_data_csv(1,2:)
2658 pattern_out%emptying_time = nint(raw_data_csv(2:,2:)) * hour
Simple history stack function, add to the end of the stack. We need only to add components on top (en...
Function calculating standard oxygen consumption in rainbow trout based on the curve from Fig....
Calculate SMR, with generic interface to non-object oriented procedure.
Calculate stress pattern based on cubic spline interpolation over the grid defined by commondata::glo...
This module defines global parameters and general-level computational utilities.
elemental real(srp) function g2kg(g)
Convert g to kg.
real(srp), public global_body_mass
Fish body mass, g, at the start of the simulation Configuration file example:
real(srp), public global_stress_cost_smr
Maximum value of the metabolic cost of stress in units of resting metabolic rate (SMR)....
logical, parameter, public is_stress_enable
Compile-time logical flag that defines if stress effects described by global_stress_factor_hour,...
integer, parameter, public hour
Global time constants, number of sec in hour and min.
integer(long), public global_time_step
Global variable that defines the current time step.
Module defining the environment.
This module defines the fish and its components. The model is discrete, time is based on time steps,...
impure subroutine fish_decide_eat_food_item_ptr(this, food_item_in, have_eaten)
This procedure determines if the fish decides to consume the food item and if yes,...
elemental real(srp) function fish_stomach_total_mass_food(this, tolerance)
Calculate the total mass of food in the fish stomach.
elemental real(srp) function nitrogen_mass(mol, is_ammonia)
Calculate the mass of ammonia, mol to g.
elemental real(srp) function fish_midgut_absorption_factor(this)
Appetite factor multiplier based on the total absorption rate.
elemental integer function fish_stomach_emptying_time(this, temperature)
Object-oriented frontend for stomach_emptying_time(): Calculate the stomach emptying time for a fish ...
elemental subroutine fish_grow_increment_energy(this)
Grow the fish body mass: increment mass based on energy.
elemental real(srp) function fish_amr_locomotion_energy_cost(this, temperature, is_exclude_smr, is_per_hour)
Calculate the active metabolic rate. This can be based on amr_swim_basic() or def_salmon::salmon_oxyg...
elemental real(srp) function fish_body_mass_current_get(this)
Get the current body mass of the fish. Note that this is the shortcut to obtain the last value from t...
elemental integer function fish_midgut_n_evacuated_step(this, max_time)
Calculate the number of the total mass of food evacuated from the midgut after full absorption and ev...
elemental real(srp) function fish_energy_consumption_step(this, temperature, sda_off)
Calculate total energy, kJ consumption of the fish depending on the temperature E = SMR + AMR + (UE+Z...
pure real(srp) function fish_smr_temp_bodymass_evan1990_value(body_mass, temperature, is_per_hour, time_step)
SMR calculation from Evans 1992 data, non-object scalar version.
elemental real(srp) function fish_oxygen_consumption_step(this, temperature, is_mass, sda_off)
Calculate total oxygen consumption (l) of the fish depending on the temperature O2 = O2_SMR + O2_AMR ...
pure real(srp) function stress_suppress(time_step)
Calculate real stress suppression factor for a specific time step given the configured stress interve...
pure real(srp) function, dimension(:), allocatable stress_suppress_factor_v(time_step_incr, is_force)
Vector-based version of the stress-based suppression function ::stress_factor(). There is a scalar ve...
elemental real(srp) function stomach_vol(mass)
Calculate the stomach volume (ml) based on the fish body mass (g) using Salgado, A....
elemental subroutine fish_midgut_init(this, mass)
Initialise an empty fish midgut object.
elemental logical function food_item_eaten_mg_exceed_max_is_to_destruct(this, max_time)
Check if the food item in the midgut has spent for more than the maximum time in the midgut after ful...
elemental subroutine food_item_eaten_check_destruct(this, is_destructed, tolerance, max_time)
Check if the food item mass shrunk to near-zero and destruct it.
elemental real(srp) function fish_activity_appetite_factor(this)
Calculate activity factor linked to appetite. Appetite factor has a linear relationship with the fish...
elemental subroutine fish_stomach_init(this, mass)
Initialise an empty fish stomach object.
elemental real(srp) function amr_swim_basic(fish_mass, swimming_speed, time_unit)
Calculate the active metabolic rate of fish in units of oxygen consumption per hour.
impure subroutine fish_midgut_update_from_stomach(this, dry_mass, t_increment)
This procedure processes the food item in the midgut of the fish.
elemental integer function midgut_absorp_history_last_past_idx(this)
Determine the index of the latest absorption item in the history stack array. If the whole array is c...
elemental subroutine fish_midgut_shift_items_after_new_ingest(this, food_item_pass)
Shift food items in the midgut after a new food item is ingested and therefore food items are shifted...
elemental real(srp) function fish_appetite_probability_ingestion(this, time_step)
Calculate the overall appetite of the fish, which defines the probability to ingest any food item.
elemental subroutine food_item_eaten_update_age_in_stomach(this, t_increment)
This procedure updates the time the food item spent in the stomach of the fish.
elemental real(srp) function fish_activity_baseline_component(this, time_step)
Calculate the baseline activity of the fish.
integer, parameter, public history_size
The size of the history that saves the fish data back in time.
elemental subroutine food_item_eaten_mg_check_destruct(this, is_destructed, tolerance, max_time)
Check if the food item has been processed for more than commondata::global_maximum_duration_midgut s ...
pure real(srp) function stress_suppress_factor_s(time_step_incr, is_force)
Calculate suppression factor for appetite caused by stress intervention at time time: generic interfa...
elemental subroutine food_item_eaten_mg_set_zero_init_state(this, mass, start_mass, delay)
Initialise an empty food item as ingested by the fish. Cleanup and set zero state.
elemental real(srp) function fish_midgut_total_mass_evacuated_step(this, max_time)
Calculate the increment of the total mass of food evacuated from the midgut after full absorption and...
elemental real(srp) function branchial_nitrogen_to_energy(excreted_nitrogen, is_kg)
Calculate the branchal and urinary energy loss from branchial and urinary nitrogen loss....
elemental subroutine fish_ingest_food_item(this, food_item_ingested)
This procedure shows what happens when the fish eats a single food item.
elemental integer function stomach_emptying_time(fish_mass, temperature)
Calculate the stomach emptying time for a fish with specific body mass at a specific temperature....
elemental real(srp) function fish_midgut_total_mass_food(this, tolerance)
Calculate the total mass of food in the fish midgut.
elemental subroutine fish_init_new_zero(this, id_num)
Initialise an empty ::fish object to an empty zero state.
elemental real(srp) function fish_whole_body_energy_trout(this)
Calculate the whole body energy content.
elemental subroutine food_item_eaten_eat_init_at_ingest(this, food_item_in, ingest_delay)
Initialise a single food item as it is ingested by the fish. Note that the ingested food item is copi...
elemental real(srp) function fish_energy_branchial_step(this, temperature, is_oxygen)
Calculate urinal (UE) and branchial energy (ZE) as a proportion of the SMR.
elemental real(srp) function fish_appetite_factor_midgut(this, fcapacity)
Calculate the fish appetite factor based on the relative midgut fullness. Appetite factor is equivale...
elemental real(srp) function fish_appetite_factor_stomach(this, fcapacity)
Calculate the fish appetite factor based on the relative stomach fullness. Appetite factor is equival...
elemental real(srp) function fish_midgut_absorption_rate(this)
Calculate instantaneous absorption rate based on the current absorption data and previous absorption ...
impure subroutine fish_decide_eat_food_item(this, food_item_in, have_eaten)
This procedure determines if the fish decides to consume the food item and if yes,...
elemental subroutine food_item_eaten_set_zero_init_state(this, mass, start_mass, delay)
Initialise an empty food item as ingested by the fish. Cleanup and set zero state.
pure real(srp) function fish_smr_temp_bodymass_evan1990_scalar(this, temperature, is_per_hour, time_step)
SMR calculation from Evans 1992 data, scalar version.
elemental real(srp) function st_food_item_mass(time_in_process, dry_mass, ingestion_delay, water_uptake, rescale)
This function defines the mass of a single food item as it passes through the fish stomach.
elemental real(srp) function fish_energy_sda_factor(this, max_ap, max_sda, is_limit)
Calculate the relative SDA (specific dynamic action) factor for SMR unit of energy uptake....
elemental real(srp) function appetite_func(mass_relative, A, R)
Computational backend for the appetite function. Appetite is calculated as.
elemental subroutine fish_energy_balance_update(this, temperature, start_value)
Calculate and update the current energy balance of the fish. Note that the energy balance is kept in ...
elemental subroutine fish_midgut_history_update(this)
Update the history stack arrays for the fish, ::midgut class.
elemental logical function food_item_eaten_is_absorbed_full(this, max_absorb)
Check if the food item has been absorbed to the maximum possible mass.
impure subroutine fish_stomach_update_step(this)
Update one time step of the fish stomach life cycle.
elemental real(srp) function fish_appetite_factor_energy_balance(this)
Calculate appetite factor that depends on the energy balance.
elemental real(srp) function energy2mass(body_energy)
Calculate the body mass from whole body energy.
elemental real(srp) function stomach_adjust(target_emptying_time)
Calculate the adjustment factor for the transformation of the stomach transport pattern Time scale co...
impure type(stomach_emptying_pattern) function get_stomach_emptying_matrix_csv(csv_file)
Get the stomach emptying time base matrix from a CSV input data file.
This defines the root type for the FISH class.
Defines an umbrella class for the complete fish organism An outline of the ::fish class inheritance i...
This type defines history arrays that are saved for the FISH class.
Defines the midgut of the fish.
Defines the stomach of the fish.