@@ -1063,6 +1063,9 @@ End Subroutine Initialize_Reference_Heating
10631063 Subroutine Augment_Reference ()
10641064 Implicit None
10651065 Real * 8 , Allocatable :: temp_functions(:,:), temp_constants(:)
1066+ Character (len= 2 ) :: intstring
1067+ Character * 12 :: dstring
1068+ Character * 8 :: dofmt = ' (ES12.5)'
10661069
10671070 If (my_rank .eq. 0 ) Then
10681071 Call stdout% print (' Reference state will be augmented.' )
@@ -1111,10 +1114,29 @@ Subroutine Augment_Reference()
11111114 temp_constants(2 ) = ra_constants(2 )
11121115 Endif
11131116
1114- If (use_custom_function(14 )) Then
1117+ If (with_custom_reference .and. use_custom_function(14 )) Then
1118+ ! Set c_11 = 1 by default
1119+ If (.not. use_custom_constant(11 )) Then
1120+ If (my_rank .eq. 0 ) Then
1121+ Call stdout% print (' User didn'' t set c_11; now setting c_11 to 1.' )
1122+ Endif
1123+ ra_constants(11 ) = 1.0d0
1124+ Else
1125+ If (my_rank .eq. 0 ) Then
1126+ Write (dstring,dofmt) ra_constants(11 )
1127+ Call stdout% print (' User set c_11 to ' // Trim (dstring))
1128+ Endif
1129+ Endif
11151130 If (my_rank .eq. 0 ) Then
11161131 Call stdout% print (' Background thermal gradient is set to:' )
11171132 Call stdout% print (' c_11*f_14' )
1133+ ! Make a warning if the user is trying to change a dsdr that physically was assumed = 0
1134+ If (any (reference_type .eq. (/ 1 , 2 / ))) Then
1135+ Write (intstring, ' (I2)' ) reference_type
1136+ Call stdout% print (' WARNING: reference_type = ' // Adjustl (intstring)// ' assumes dsdr = 0 by default.' )
1137+ Call stdout% print (' make sure the combination of' )
1138+ Call stdout% print (' reference_type = ' // Adjustl (intstring)// ' and nonzero dsdr was intended.' )
1139+ Endif
11181140 Call stdout% print (' ' )
11191141 Endif
11201142 ref% dsdr(:) = ra_constants(11 )* ra_functions(:,14 )
@@ -2017,19 +2039,21 @@ Subroutine Set_Reference_Equation_Coefficients
20172039 ! the combination c_11 and f_14 cannot be backed out from the "ref" structure
20182040 ! (which only has ref%dsdr = c_11*f_14)
20192041 ! and will depend on the convention of the different reference_types
2020- Select Case (reference_type)
2021- Case (1 ,2 )
2022- ra_constants(11 ) = 0.0d0
2023- ra_functions(:,14 ) = 0.0d0
2024- Case (3 )
2025- ra_constants(11 ) = 1.0d0
2026- ra_functions(:,14 ) = ref% dsdr
2027- ! For reference_type = 4, c_11 and f_14 have been set already
2028- Case (5 )
2029- ra_constants(11 ) = Prandtl_Number* Buoyancy_Number_Visc/ Rayleigh_Number
2030- ra_functions(:,14 ) = ref% dsdr/ ra_constants(11 )
2031- End Select
2032-
2042+ If (.not. use_custom_function(14 )) Then
2043+ ! If user set dsdr via "with custom", then c_11 and f_14 have already been set
2044+ Select Case (reference_type)
2045+ Case (1 ,2 )
2046+ ra_constants(11 ) = 0.0d0
2047+ ra_functions(:,14 ) = 0.0d0
2048+ Case (3 )
2049+ ra_constants(11 ) = 1.0d0
2050+ ra_functions(:,14 ) = ref% dsdr
2051+ ! For reference_type = 4, c_11 and f_14 have been set already
2052+ Case (5 )
2053+ ra_constants(11 ) = Prandtl_Number* Buoyancy_Number_Visc/ Rayleigh_Number
2054+ ra_functions(:,14 ) = ref% dsdr/ ra_constants(11 )
2055+ End Select
2056+ Endif
20332057
20342058 ra_functions(:,1 ) = ref% density
20352059 ra_functions(:,4 ) = ref% temperature
0 commit comments