Skip to content

Commit a5611e7

Browse files
committed
Replace std::pow where possible
1 parent 019cb2b commit a5611e7

File tree

10 files changed

+63
-63
lines changed

10 files changed

+63
-63
lines changed

benchmarks/hollow_sphere/hollow_sphere.cc

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,17 @@ namespace aspect
7373

7474
if (mmm == -1)
7575
{
76-
alpha=-gammma*(std::pow(R2,3)-std::pow(R1,3))/(std::pow(R2,3)*std::log(R1)-std::pow(R1,3)*std::log(R2));
77-
beta=-3*gammma*(std::log(R2)-std::log(R1))/(std::pow(R1,3)*std::log(R2)-std::pow(R2,3)*std::log(R1)) ;
76+
alpha=-gammma*(Utilities::fixed_power<3>(R2)-Utilities::fixed_power<3>(R1))/(Utilities::fixed_power<3>(R2)*std::log(R1)-Utilities::fixed_power<3>(R1)*std::log(R2));
77+
beta=-3*gammma*(std::log(R2)-std::log(R1))/(Utilities::fixed_power<3>(R1)*std::log(R2)-Utilities::fixed_power<3>(R2)*std::log(R1)) ;
7878
fr=alpha/(r*r)+beta*r;
79-
gr=-2/(r*r)*(alpha*std::log(r)+beta/3*std::pow(r,3)+gammma);
79+
gr=-2/(r*r)*(alpha*std::log(r)+beta/3*Utilities::fixed_power<3>(r)+gammma);
8080
}
8181
else
8282
{
83-
alpha=gammma*(mmm+1)*(std::pow(R1,-3)-std::pow(R2,-3))/(std::pow(R1,-mmm-4)-std::pow(R2,-mmm-4));
83+
alpha=gammma*(mmm+1)*(Utilities::fixed_power<-3>(R1)-Utilities::fixed_power<-3>(R2))/(std::pow(R1,-mmm-4)-std::pow(R2,-mmm-4));
8484
beta=-3*gammma*(std::pow(R1,mmm+1)-std::pow(R2,mmm+1))/(std::pow(R1,mmm+4)-std::pow(R2,mmm+4));
8585
fr=alpha/std::pow(r,mmm+3)+beta*r;
86-
gr=-2/(r*r)*(-alpha/(mmm+1)*std::pow(r,-mmm-1)+beta/3*std::pow(r,3)+gammma);
86+
gr=-2/(r*r)*(-alpha/(mmm+1)*std::pow(r,-mmm-1)+beta/3*Utilities::fixed_power<3>(r)+gammma);
8787
}
8888

8989
const double v_r =gr*std::cos(theta);
@@ -115,17 +115,17 @@ namespace aspect
115115
if (mmm == -1)
116116
{
117117
mur=mu0;
118-
alpha=-gammma*(std::pow(R2,3)-std::pow(R1,3))/(std::pow(R2,3)*std::log(R1)-std::pow(R1,3)*std::log(R2));
119-
beta=-3*gammma*(std::log(R2)-std::log(R1))/(std::pow(R1,3)*std::log(R2)-std::pow(R2,3)*std::log(R1)) ;
120-
gr=-2/(r*r)*(alpha*std::log(r)+beta/3*std::pow(r,3)+gammma);
118+
alpha=-gammma*(Utilities::fixed_power<3>(R2)-Utilities::fixed_power<3>(R1))/(Utilities::fixed_power<3>(R2)*std::log(R1)-Utilities::fixed_power<3>(R1)*std::log(R2));
119+
beta=-3*gammma*(std::log(R2)-std::log(R1))/(Utilities::fixed_power<3>(R1)*std::log(R2)-Utilities::fixed_power<3>(R2)*std::log(R1)) ;
120+
gr=-2/(r*r)*(alpha*std::log(r)+beta/3*Utilities::fixed_power<3>(r)+gammma);
121121
hr=2/r*gr*mur;
122122
}
123123
else
124124
{
125125
mur=mu0*std::pow(r,mmm+1);
126-
alpha=gammma*(mmm+1)*(std::pow(R1,-3)-std::pow(R2,-3))/(std::pow(R1,-mmm-4)-std::pow(R2,-mmm-4));
126+
alpha=gammma*(mmm+1)*(Utilities::fixed_power<-3>(R1)-Utilities::fixed_power<-3>(R2))/(std::pow(R1,-mmm-4)-std::pow(R2,-mmm-4));
127127
beta=-3*gammma*(std::pow(R1,mmm+1)-std::pow(R2,mmm+1))/(std::pow(R1,mmm+4)-std::pow(R2,mmm+4));
128-
gr=-2/(r*r)*(-alpha/(mmm+1)*std::pow(r,-mmm-1)+beta/3*std::pow(r,3)+gammma);
128+
gr=-2/(r*r)*(-alpha/(mmm+1)*std::pow(r,-mmm-1)+beta/3*Utilities::fixed_power<3>(r)+gammma);
129129
hr=(mmm+3)/r*gr*mur;
130130
}
131131

@@ -147,17 +147,17 @@ namespace aspect
147147

148148
if (mmm == -1)
149149
{
150-
alpha=-gammma*(std::pow(R2,3)-std::pow(R1,3))/(std::pow(R2,3)*std::log(R1)-std::pow(R1,3)*std::log(R2));
151-
beta=-3*gammma*(std::log(R2)-std::log(R1))/(std::pow(R1,3)*std::log(R2)-std::pow(R2,3)*std::log(R1)) ;
150+
alpha=-gammma*(Utilities::fixed_power<3>(R2)-Utilities::fixed_power<3>(R1))/(Utilities::fixed_power<3>(R2)*std::log(R1)-Utilities::fixed_power<3>(R1)*std::log(R2));
151+
beta=-3*gammma*(std::log(R2)-std::log(R1))/(Utilities::fixed_power<3>(R1)*std::log(R2)-Utilities::fixed_power<3>(R2)*std::log(R1)) ;
152152
fr=alpha/(r*r)+beta*r;
153-
gr=-2/(r*r)*(alpha*std::log(r)+beta/3*std::pow(r,3)+gammma);
153+
gr=-2/(r*r)*(alpha*std::log(r)+beta/3*Utilities::fixed_power<3>(r)+gammma);
154154
}
155155
else
156156
{
157-
alpha=gammma*(mmm+1)*(std::pow(R1,-3)-std::pow(R2,-3))/(std::pow(R1,-mmm-4)-std::pow(R2,-mmm-4));
157+
alpha=gammma*(mmm+1)*(Utilities::fixed_power<-3>(R1)-Utilities::fixed_power<-3>(R2))/(std::pow(R1,-mmm-4)-std::pow(R2,-mmm-4));
158158
beta=-3*gammma*(std::pow(R1,mmm+1)-std::pow(R2,mmm+1))/(std::pow(R1,mmm+4)-std::pow(R2,mmm+4));
159159
fr=alpha/std::pow(r,mmm+3)+beta*r;
160-
gr=-2/(r*r)*(-alpha/(mmm+1)*std::pow(r,-mmm-1)+beta/3*std::pow(r,3)+gammma);
160+
gr=-2/(r*r)*(-alpha/(mmm+1)*std::pow(r,-mmm-1)+beta/3*Utilities::fixed_power<3>(r)+gammma);
161161
}
162162

163163
return -(6.*gr + 4.*fr) * std::cos(theta) * mu0 / r;
@@ -380,15 +380,15 @@ namespace aspect
380380

381381
if (mmm == -1)
382382
{
383-
alpha = -gammma*(std::pow(R2,3)-std::pow(R1,3))/(std::pow(R2,3)*std::log(R1)-std::pow(R1,3)*std::log(R2));
384-
beta = -3*gammma*(std::log(R2)-std::log(R1))/(std::pow(R1,3)*std::log(R2)-std::pow(R2,3)*std::log(R1)) ;
385-
rho = -(alpha/std::pow(r,4)*(8*std::log(r)-6) + 8./3.*beta/r+8*gammma/std::pow(r,4))*std::cos(theta) + rho_0;
383+
alpha = -gammma*(Utilities::fixed_power<3>(R2)-Utilities::fixed_power<3>(R1))/(Utilities::fixed_power<3>(R2)*std::log(R1)-Utilities::fixed_power<3>(R1)*std::log(R2));
384+
beta = -3*gammma*(std::log(R2)-std::log(R1))/(Utilities::fixed_power<3>(R1)*std::log(R2)-Utilities::fixed_power<3>(R2)*std::log(R1)) ;
385+
rho = -(alpha/Utilities::fixed_power<4>(r)*(8*std::log(r)-6) + 8./3.*beta/r+8*gammma/Utilities::fixed_power<4>(r))*std::cos(theta) + rho_0;
386386
}
387387
else
388388
{
389-
alpha=gammma*(mmm+1)*(std::pow(R1,-3)-std::pow(R2,-3))/(std::pow(R1,-mmm-4)-std::pow(R2,-mmm-4));
389+
alpha=gammma*(mmm+1)*(Utilities::fixed_power<-3>(R1)-Utilities::fixed_power<-3>(R2))/(std::pow(R1,-mmm-4)-std::pow(R2,-mmm-4));
390390
beta=-3*gammma*(std::pow(R1,mmm+1)-std::pow(R2,mmm+1))/(std::pow(R1,mmm+4)-std::pow(R2,mmm+4));
391-
rho= -(2*alpha*std::pow(r,-4)*(mmm+3)/(mmm+1)*(mmm-1)-2*beta/3*(mmm-1)*(mmm+3)*std::pow(r,mmm)-mmm*(mmm+5)*2*gammma*std::pow(r,mmm-3) )*std::cos(theta) + rho_0;
391+
rho= -(2*alpha*Utilities::fixed_power<-4>(r)*(mmm+3)/(mmm+1)*(mmm-1)-2*beta/3*(mmm-1)*(mmm+3)*std::pow(r,mmm)-mmm*(mmm+5)*2*gammma*std::pow(r,mmm-3) )*std::cos(theta) + rho_0;
392392
}
393393

394394
out.densities[i] = rho;

benchmarks/layeredflow/layeredflow.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ namespace aspect
5050
const double yplus=(1.+y0)/beta;
5151
const double yminus=(1.-y0)/beta;
5252
const double C1 = 2.*numbers::PI /
53-
( beta*std::log(beta*beta+std::pow(1.+y0,2.0))-2.*(1.+y0)*std::atan(yplus)
54-
- beta*std::log(beta*beta+std::pow(1.-y0,2.0))+2.*(1.-y0)*std::atan(yminus)
53+
( beta*std::log(beta*beta+Utilities::fixed_power<2>(1.+y0))-2.*(1.+y0)*std::atan(yplus)
54+
- beta*std::log(beta*beta+Utilities::fixed_power<2>(1.-y0))+2.*(1.-y0)*std::atan(yminus)
5555
+ 2.*numbers::PI*(1.+2.*epsilon) );
5656

5757
const double C2 = ( beta*std::log( beta*beta+Utilities::fixed_power<2>(1+y0) )- 2.*(1.+y0)*std::atan(yplus)

benchmarks/viscosity_grooves/viscosity_grooves.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ namespace aspect
6262
const GeometryModel::Box<2> *geometry
6363
= dynamic_cast<const GeometryModel::Box<2>*> (&geometry_model);
6464
const double L=geometry->get_extents()[0];
65-
return x*x*y*y+x*y+5. - std::pow(L,4.)/9.-std::pow(L,2.)/4.-5.;
65+
return x*x*y*y+x*y+5. - Utilities::fixed_power<4>(L)/9.-Utilities::fixed_power<2>(L)/4.-5.;
6666
}
6767

6868
double

source/boundary_temperature/dynamic_core.cc

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ namespace aspect
562562
DynamicCore<dim>::
563563
get_mass(const double r) const
564564
{
565-
return 4.*numbers::PI*Rho_cen*(-std::pow(L,2)/2.*r*std::exp(-std::pow(r/L,2))+std::pow(L,3)/4.*std::sqrt(numbers::PI)*std::erf(r/L));
565+
return 4.*numbers::PI*Rho_cen*(-Utilities::fixed_power<2>(L)/2.*r*std::exp(-Utilities::fixed_power<2>(r/L))+Utilities::fixed_power<3>(L)/4.*std::sqrt(numbers::PI)*std::erf(r/L));
566566
}
567567

568568

@@ -591,9 +591,9 @@ namespace aspect
591591
DynamicCore<dim>::
592592
get_pressure(const double r) const
593593
{
594-
return P_CMB-(4*numbers::PI*constants::big_g*std::pow(Rho_cen,2))/3
595-
*((3*std::pow(r,2)/10.-std::pow(L,2)/5)*std::exp(-std::pow(r/L,2))
596-
-(3*std::pow(Rc,2)/10-std::pow(L,2)/5)*std::exp(-std::pow(Rc/L,2)));
594+
return P_CMB-(4*numbers::PI*constants::big_g*Utilities::fixed_power<2>(Rho_cen))/3
595+
*((3*Utilities::fixed_power<2>(r)/10.-Utilities::fixed_power<2>(L)/5)*std::exp(-Utilities::fixed_power<2>(r/L))
596+
-(3*Utilities::fixed_power<2>(Rc)/10-Utilities::fixed_power<2>(L)/5)*std::exp(-Utilities::fixed_power<2>(Rc/L)));
597597
}
598598

599599

@@ -603,7 +603,7 @@ namespace aspect
603603
DynamicCore<dim>::
604604
get_rho(const double r) const
605605
{
606-
return Rho_cen*std::exp(-std::pow(r/L,2));
606+
return Rho_cen*std::exp(-Utilities::fixed_power<2>(r/L));
607607
}
608608

609609

@@ -613,7 +613,7 @@ namespace aspect
613613
DynamicCore<dim>::
614614
get_g(const double r) const
615615
{
616-
return (4*numbers::PI/3)*constants::big_g*Rho_cen*r*(1-3*std::pow(r,2)/(5*std::pow(L,2)));
616+
return (4*numbers::PI/3)*constants::big_g*Rho_cen*r*(1-3*Utilities::fixed_power<2>(r)/(5*Utilities::fixed_power<2>(L)));
617617
}
618618

619619

@@ -623,7 +623,7 @@ namespace aspect
623623
DynamicCore<dim>::
624624
get_T(const double Tc, const double r) const
625625
{
626-
return Tc*std::exp((std::pow(Rc,2)-std::pow(r,2))/std::pow(D,2));
626+
return Tc*std::exp((Utilities::fixed_power<2>(Rc)-Utilities::fixed_power<2>(r))/Utilities::fixed_power<2>(D));
627627
}
628628

629629

@@ -633,8 +633,8 @@ namespace aspect
633633
DynamicCore<dim>::
634634
get_gravity_potential(const double r) const
635635
{
636-
return 2./3.*numbers::PI*constants::big_g*Rho_cen*(std::pow(r,2)*(1.-3.*std::pow(r,2)
637-
/(10.*std::pow(L,2)))-std::pow(Rc,2)*(1.-3.*std::pow(Rc,2)/(10.*std::pow(L,2))));
636+
return 2./3.*numbers::PI*constants::big_g*Rho_cen*(Utilities::fixed_power<2>(r)*(1.-3.*Utilities::fixed_power<2>(r)
637+
/(10.*Utilities::fixed_power<2>(L)))-Utilities::fixed_power<2>(Rc)*(1.-3.*Utilities::fixed_power<2>(Rc)/(10.*Utilities::fixed_power<2>(L))));
638638
}
639639

640640

@@ -644,8 +644,8 @@ namespace aspect
644644
DynamicCore<dim>::
645645
get_specific_heating(const double Tc, double &Qs,double &Es) const
646646
{
647-
const double A = std::sqrt(1./(std::pow(L,-2)+std::pow(D,-2)));
648-
const double Is = 4.*numbers::PI*get_T(Tc,0.)*Rho_cen*(-std::pow(A,2)*Rc/2.*std::exp(-std::pow(Rc/A,2))+std::pow(A,3)*std::sqrt(numbers::PI)/4.*std::erf(Rc/A));
647+
const double A = std::sqrt(1./(Utilities::fixed_power<-2>(L)+Utilities::fixed_power<-2>(D)));
648+
const double Is = 4.*numbers::PI*get_T(Tc,0.)*Rho_cen*(-Utilities::fixed_power<2>(A)*Rc/2.*std::exp(-Utilities::fixed_power<2>(Rc/A))+Utilities::fixed_power<3>(A)*std::sqrt(numbers::PI)/4.*std::erf(Rc/A));
649649

650650
Qs = -Cp/Tc*Is;
651651
Es = Cp/Tc*(Mc-Is/Tc);
@@ -661,13 +661,13 @@ namespace aspect
661661
double It = numbers::signaling_nan<double>();
662662
if (D>L)
663663
{
664-
const double B = std::sqrt(1/(1/std::pow(L,2)-1/std::pow(D,2)));
665-
It = 4*numbers::PI*Rho_cen/get_T(Tc,0)*(-std::pow(B,2)*Rc/2*std::exp(-std::pow(Rc/B,2))+std::pow(B,3)/std::sqrt(numbers::PI)/4*std::erf(Rc/B));
664+
const double B = std::sqrt(1/(1/Utilities::fixed_power<2>(L)-1/Utilities::fixed_power<2>(D)));
665+
It = 4*numbers::PI*Rho_cen/get_T(Tc,0)*(-Utilities::fixed_power<2>(B)*Rc/2*std::exp(-Utilities::fixed_power<2>(Rc/B))+Utilities::fixed_power<3>(B)/std::sqrt(numbers::PI)/4*std::erf(Rc/B));
666666
}
667667
else
668668
{
669-
const double B = std::sqrt(1/(std::pow(D,-2)-std::pow(L,-2)));
670-
It = 4*numbers::PI*Rho_cen/get_T(Tc,0)*(std::pow(B,2)*Rc/2*std::exp(std::pow(Rc/B,2))-std::pow(B,2)*fun_Sn(B,Rc,100)/2);
669+
const double B = std::sqrt(1/(Utilities::fixed_power<-2>(D)-Utilities::fixed_power<-2>(L)));
670+
It = 4*numbers::PI*Rho_cen/get_T(Tc,0)*(Utilities::fixed_power<2>(B)*Rc/2*std::exp(Utilities::fixed_power<2>(Rc/B))-Utilities::fixed_power<2>(B)*fun_Sn(B,Rc,100)/2);
671671
}
672672

673673
Qr = Mc*core_data.H;
@@ -684,17 +684,17 @@ namespace aspect
684684
double It = numbers::signaling_nan<double>();
685685
if (D>L)
686686
{
687-
const double B = std::sqrt(1./(1./std::pow(L,2)-1./std::pow(D,2)));
688-
It = 4*numbers::PI*Rho_cen/get_T(Tc,0)*(-std::pow(B,2)*Rc/2*std::exp(-std::pow(Rc/B,2))+std::pow(B,3)/std::sqrt(numbers::PI)/4*std::erf(Rc/B));
689-
It -= 4*numbers::PI*Rho_cen/get_T(Tc,0)*(-std::pow(B,2)*r/2*std::exp(-std::pow(r/B,2))+std::pow(B,3)/std::sqrt(numbers::PI)/4*std::erf(r/B));
687+
const double B = std::sqrt(1./(1./Utilities::fixed_power<2>(L)-1./Utilities::fixed_power<2>(D)));
688+
It = 4*numbers::PI*Rho_cen/get_T(Tc,0)*(-Utilities::fixed_power<2>(B)*Rc/2*std::exp(-Utilities::fixed_power<2>(Rc/B))+Utilities::fixed_power<3>(B)/std::sqrt(numbers::PI)/4*std::erf(Rc/B));
689+
It -= 4*numbers::PI*Rho_cen/get_T(Tc,0)*(-Utilities::fixed_power<2>(B)*r/2*std::exp(-Utilities::fixed_power<2>(r/B))+Utilities::fixed_power<3>(B)/std::sqrt(numbers::PI)/4*std::erf(r/B));
690690
}
691691
else
692692
{
693-
const double B = std::sqrt(1./(std::pow(D,-2)-std::pow(L,-2)));
694-
It = 4*numbers::PI*Rho_cen/get_T(Tc,0)*(std::pow(B,2)*Rc/2*std::exp(std::pow(Rc/B,2))-std::pow(B,2)*fun_Sn(B,Rc,100)/2);
695-
It -= 4*numbers::PI*Rho_cen/get_T(Tc,0)*(std::pow(B,2)*r/2*std::exp(std::pow(r/B,2))-std::pow(B,2)*fun_Sn(B,r,100)/2);
693+
const double B = std::sqrt(1./(Utilities::fixed_power<-2>(D)-Utilities::fixed_power<-2>(L)));
694+
It = 4*numbers::PI*Rho_cen/get_T(Tc,0)*(Utilities::fixed_power<2>(B)*Rc/2*std::exp(Utilities::fixed_power<2>(Rc/B))-Utilities::fixed_power<2>(B)*fun_Sn(B,Rc,100)/2);
695+
It -= 4*numbers::PI*Rho_cen/get_T(Tc,0)*(Utilities::fixed_power<2>(B)*r/2*std::exp(Utilities::fixed_power<2>(r/B))-Utilities::fixed_power<2>(B)*fun_Sn(B,r,100)/2);
696696
}
697-
const double Cc = 4*numbers::PI*std::pow(r,2)*get_rho(r)*X/(Mc-get_mass(r));
697+
const double Cc = 4*numbers::PI*Utilities::fixed_power<2>(r)*get_rho(r)*X/(Mc-get_mass(r));
698698
Eh = Rh*(It-(Mc-get_mass(r))/get_T(Tc,r))*Cc;
699699
}
700700

@@ -705,17 +705,17 @@ namespace aspect
705705
DynamicCore<dim>::
706706
get_gravity_heating(const double Tc, const double r, const double X, double &Qg, double &Eg) const
707707
{
708-
const double Cc = 4*numbers::PI*std::pow(r,2)*get_rho(r)*X/(Mc-get_mass(r));
709-
const double C_2 = 3./16.*std::pow(L,2) - 0.5*std::pow(Rc,2)*(1.-3./10.*std::pow(Rc/L,2));
708+
const double Cc = 4*numbers::PI*Utilities::fixed_power<2>(r)*get_rho(r)*X/(Mc-get_mass(r));
709+
const double C_2 = 3./16.*Utilities::fixed_power<2>(L) - 0.5*Utilities::fixed_power<2>(Rc)*(1.-3./10.*Utilities::fixed_power<2>(Rc/L));
710710
if (r==Rc)
711711
Qg = 0.;
712712
else
713713
{
714-
Qg = (8./3.*std::pow(numbers::PI*Rho_cen,2)*constants::big_g*(
715-
((3./20.*std::pow(Rc,5)-std::pow(L,2)*std::pow(Rc,3)/8.-C_2*std::pow(L,2)*Rc)*std::exp(-std::pow(Rc/L,2))
716-
+C_2/2.*std::pow(L,3)*std::sqrt(numbers::PI)*std::erf(Rc/L))
717-
-((3./20.*std::pow(r,5)-std::pow(L,2)*std::pow(r,3)/8.-C_2*std::pow(L,2)*r)*std::exp(-std::pow(r/L,2))
718-
+C_2/2.*std::pow(L,3)*std::sqrt(numbers::PI)*std::erf(r/L)))
714+
Qg = (8./3.*Utilities::fixed_power<2>(numbers::PI*Rho_cen)*constants::big_g*(
715+
((3./20.*Utilities::fixed_power<5>(Rc)-Utilities::fixed_power<2>(L)*Utilities::fixed_power<3>(Rc)/8.-C_2*Utilities::fixed_power<2>(L)*Rc)*std::exp(-Utilities::fixed_power<2>(Rc/L))
716+
+C_2/2.*Utilities::fixed_power<3>(L)*std::sqrt(numbers::PI)*std::erf(Rc/L))
717+
-((3./20.*Utilities::fixed_power<5>(r)-Utilities::fixed_power<2>(L)*Utilities::fixed_power<3>(r)/8.-C_2*Utilities::fixed_power<2>(L)*r)*std::exp(-Utilities::fixed_power<2>(r/L))
718+
+C_2/2.*Utilities::fixed_power<3>(L)*std::sqrt(numbers::PI)*std::erf(r/L)))
719719
-(Mc-get_mass(r))*get_gravity_potential(r))*Beta_c*Cc;
720720
}
721721

@@ -729,8 +729,8 @@ namespace aspect
729729
DynamicCore<dim>::
730730
get_adiabatic_heating(const double Tc, double &Ek, double &Qk) const
731731
{
732-
Ek = 16*numbers::PI*k_c*std::pow(Rc,5)/5/std::pow(D,4);
733-
Qk = 8*numbers::PI*std::pow(Rc,3)*k_c*Tc/std::pow(D,2);
732+
Ek = 16*numbers::PI*k_c*Utilities::fixed_power<5>(Rc)/5/Utilities::fixed_power<4>(D);
733+
Qk = 8*numbers::PI*Utilities::fixed_power<3>(Rc)*k_c*Tc/Utilities::fixed_power<2>(D);
734734
}
735735

736736

@@ -740,7 +740,7 @@ namespace aspect
740740
DynamicCore<dim>::
741741
get_latent_heating(const double Tc, const double r, double &El, double &Ql) const
742742
{
743-
Ql = 4.*numbers::PI*std::pow(r,2)*Lh*get_rho(r);
743+
Ql = 4.*numbers::PI*Utilities::fixed_power<2>(r)*Lh*get_rho(r);
744744
El = Ql*(get_T(Tc,r)-Tc)/(Tc*get_T(Tc,r));
745745
}
746746

source/geometry_model/ellipsoidal_chunk.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ namespace aspect
495495
bottom_depth = prm.get_double("Depth");
496496
semi_major_axis_a = prm.get_double("Semi-major axis");
497497
eccentricity = prm.get_double("Eccentricity");
498-
semi_minor_axis_b = std::sqrt((1 - std::pow(eccentricity,2.)) * std::pow(semi_major_axis_a,2.));
498+
semi_minor_axis_b = std::sqrt((1 - Utilities::fixed_power<2>(eccentricity)) * Utilities::fixed_power<2>(semi_major_axis_a));
499499
EW_subdiv = prm.get_integer("East-West subdivisions");
500500
NS_subdiv = prm.get_integer("North-South subdivisions");
501501
depth_subdiv = prm.get_integer("Depth subdivisions");

source/material_model/latent_heat_melt.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ namespace aspect
172172
= beta * std::pow((temperature - T_solidus)/(T_lherz_liquidus - T_solidus),beta-1)
173173
* (dT_solidus_dp * (temperature - T_lherz_liquidus)
174174
+ dT_lherz_liquidus_dp * (T_solidus - temperature))
175-
/ std::pow(T_lherz_liquidus - T_solidus,2);
175+
/ Utilities::fixed_power<2>(T_lherz_liquidus - T_solidus);
176176

177177
// melt fraction after melting of all clinopyroxene
178178
const double R_cpx = r1 + r2 * pressure;
@@ -181,7 +181,7 @@ namespace aspect
181181
if (peridotite_melt_fraction(temperature, pressure, compositional_fields, position) > F_max)
182182
{
183183
const double T_max = std::pow(F_max,1.0/beta) * (T_lherz_liquidus - T_solidus) + T_solidus;
184-
const double dF_max_dp = - M_cpx * std::pow(r1 + r2 * pressure,-2) * r2;
184+
const double dF_max_dp = - M_cpx * Utilities::fixed_power<-2>(r1 + r2 * pressure) * r2;
185185
const double dT_max_dp = dT_solidus_dp
186186
+ 1.0/beta * std::pow(F_max,1.0/beta - 1.0) * dF_max_dp * (T_lherz_liquidus - T_solidus)
187187
+ std::pow(F_max,1.0/beta) * (dT_lherz_liquidus_dp - dT_solidus_dp);

source/material_model/melt_boukare.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ namespace aspect
190190
(a + (1. - a) * std::pow(1 + b * (pressure - Pth), c)));
191191

192192
const double Cp_ref = reference_specific_heats[i] + specific_heat_linear_coefficients[i] * in.temperature[q]
193-
+ specific_heat_second_coefficients[i] * std::pow(in.temperature[q], -2.)
193+
+ specific_heat_second_coefficients[i] * Utilities::fixed_power<-2>(in.temperature[q])
194194
+ specific_heat_third_coefficients[i] * std::pow(in.temperature[q], -0.5);
195195

196196
const long double dSdT0 = reference_volumes[i] * reference_bulk_moduli[i] * Utilities::fixed_power<2>(heat_capacity_ratio * reference_thermal_expansivities[i])

0 commit comments

Comments
 (0)