@@ -1738,8 +1738,8 @@ void doVillasenorDepositionShapeNImplicit (const amrex::ParticleReal * const xp_
1738
1738
// cell crossings are defined at cell centers if depos_order is even
1739
1739
1740
1740
int num_segments = 1 ;
1741
- amrex::Real shift = 0 .0_rt ;
1742
- if ( (depos_order % 2 ) == 0 ) { shift = 0 .5_rt ; }
1741
+ double shift = 0.0 ;
1742
+ if ( (depos_order % 2 ) == 0 ) { shift = 0.5 ; }
1743
1743
1744
1744
#if defined(WARPX_DIM_3D)
1745
1745
@@ -1763,21 +1763,21 @@ void doVillasenorDepositionShapeNImplicit (const amrex::ParticleReal * const xp_
1763
1763
1764
1764
// need to assert that the number of cell crossings in each direction
1765
1765
// is within the range permitted by the number of guard cells
1766
- // e.g., if (num_segments > 5 ) ...
1766
+ // e.g., if (num_segments > 7 ) ...
1767
1767
1768
1768
// compute total change in particle position and the initial cell
1769
1769
// locations in each direction used to find the position at cell crossings.
1770
1770
const double dxp = x_new - x_old;
1771
1771
const double dyp = y_new - y_old;
1772
1772
const double dzp = z_new - z_old;
1773
- const auto dirX_sign = static_cast <int >(dxp < 0 . ? -1 : 1 );
1774
- const auto dirY_sign = static_cast <int >(dyp < 0 . ? -1 : 1 );
1775
- const auto dirZ_sign = static_cast <int >(dzp < 0 . ? -1 : 1 );
1773
+ const auto dirX_sign = static_cast <double >(dxp < 0 . ? -1 . : 1 . );
1774
+ const auto dirY_sign = static_cast <double >(dyp < 0 . ? -1 . : 1 . );
1775
+ const auto dirZ_sign = static_cast <double >(dzp < 0 . ? -1 . : 1 . );
1776
1776
double Xcell = 0 ., Ycell = 0 ., Zcell = 0 .;
1777
1777
if (num_segments > 1 ) {
1778
- Xcell = i_old + shift + 0 .5_rt *(1 -dirX_sign);
1779
- Ycell = j_old + shift + 0 .5_rt *(1 -dirY_sign);
1780
- Zcell = k_old + shift + 0 .5_rt *(1 -dirZ_sign);
1778
+ Xcell = static_cast < double >( i_old) + shift + 0.5 *(1 . -dirX_sign);
1779
+ Ycell = static_cast < double >( j_old) + shift + 0.5 *(1 . -dirY_sign);
1780
+ Zcell = static_cast < double >( k_old) + shift + 0.5 *(1 . -dirZ_sign);
1781
1781
}
1782
1782
1783
1783
// loop over the number of segments and deposit
@@ -1836,20 +1836,20 @@ void doVillasenorDepositionShapeNImplicit (const amrex::ParticleReal * const xp_
1836
1836
}
1837
1837
1838
1838
// compute the segment factors (each equal to dt_seg/dt for nonzero dxp, dyp, or dzp)
1839
- const auto seg_factor_x = static_cast <amrex::Real >(dxp == 0 . ? 1 . : dxp_seg/dxp);
1840
- const auto seg_factor_y = static_cast <amrex::Real >(dyp == 0 . ? 1 . : dyp_seg/dyp);
1841
- const auto seg_factor_z = static_cast <amrex::Real >(dzp == 0 . ? 1 . : dzp_seg/dzp);
1839
+ const auto seg_factor_x = static_cast <double >(dxp == 0 . ? 1 . : dxp_seg/dxp);
1840
+ const auto seg_factor_y = static_cast <double >(dyp == 0 . ? 1 . : dyp_seg/dyp);
1841
+ const auto seg_factor_z = static_cast <double >(dzp == 0 . ? 1 . : dzp_seg/dzp);
1842
1842
1843
1843
// compute cell-based weights using the average segment position
1844
1844
double sx_cell[depos_order] = {0 .};
1845
1845
double sy_cell[depos_order] = {0 .};
1846
1846
double sz_cell[depos_order] = {0 .};
1847
- double const x0_bar = (x0_new + x0_old)/2 .0_rt ;
1848
- double const y0_bar = (y0_new + y0_old)/2 .0_rt ;
1849
- double const z0_bar = (z0_new + z0_old)/2 .0_rt ;
1850
- const int i0_cell = compute_shape_factor_cell ( sx_cell, x0_bar-0 .5_rt );
1851
- const int j0_cell = compute_shape_factor_cell ( sy_cell, y0_bar-0 .5_rt );
1852
- const int k0_cell = compute_shape_factor_cell ( sz_cell, z0_bar-0 .5_rt );
1847
+ double const x0_bar = (x0_new + x0_old)/2.0 ;
1848
+ double const y0_bar = (y0_new + y0_old)/2.0 ;
1849
+ double const z0_bar = (z0_new + z0_old)/2.0 ;
1850
+ const int i0_cell = compute_shape_factor_cell ( sx_cell, x0_bar-0.5 );
1851
+ const int j0_cell = compute_shape_factor_cell ( sy_cell, y0_bar-0.5 );
1852
+ const int k0_cell = compute_shape_factor_cell ( sz_cell, z0_bar-0.5 );
1853
1853
1854
1854
if constexpr (depos_order >= 3 ) { // higher-order correction to the cell-based weights
1855
1855
Compute_shape_factor_pair<depos_order-1 > compute_shape_factors_cell;
@@ -1859,14 +1859,14 @@ void doVillasenorDepositionShapeNImplicit (const amrex::ParticleReal * const xp_
1859
1859
double sy_new_cell[depos_order] = {0 .};
1860
1860
double sz_old_cell[depos_order] = {0 .};
1861
1861
double sz_new_cell[depos_order] = {0 .};
1862
- const int i0_cell_2 = compute_shape_factors_cell ( sx_old_cell, sx_new_cell, x0_old-0 .5_rt , x0_new-0 .5_rt );
1863
- const int j0_cell_2 = compute_shape_factors_cell ( sy_old_cell, sy_new_cell, y0_old-0 .5_rt , y0_new-0 .5_rt );
1864
- const int k0_cell_2 = compute_shape_factors_cell ( sz_old_cell, sz_new_cell, z0_old-0 .5_rt , z0_new-0 .5_rt );
1862
+ const int i0_cell_2 = compute_shape_factors_cell ( sx_old_cell, sx_new_cell, x0_old-0.5 , x0_new-0.5 );
1863
+ const int j0_cell_2 = compute_shape_factors_cell ( sy_old_cell, sy_new_cell, y0_old-0.5 , y0_new-0.5 );
1864
+ const int k0_cell_2 = compute_shape_factors_cell ( sz_old_cell, sz_new_cell, z0_old-0.5 , z0_new-0.5 );
1865
1865
ignore_unused (i0_cell_2, j0_cell_2, k0_cell_2);
1866
1866
for (int m=0 ; m<depos_order; m++) {
1867
- sx_cell[m] = (4 .0_rt *sx_cell[m] + sx_old_cell[m] + sx_new_cell[m])/6 .0_rt ;
1868
- sy_cell[m] = (4 .0_rt *sy_cell[m] + sy_old_cell[m] + sy_new_cell[m])/6 .0_rt ;
1869
- sz_cell[m] = (4 .0_rt *sz_cell[m] + sz_old_cell[m] + sz_new_cell[m])/6 .0_rt ;
1867
+ sx_cell[m] = (4.0 *sx_cell[m] + sx_old_cell[m] + sx_new_cell[m])/6.0 ;
1868
+ sy_cell[m] = (4.0 *sy_cell[m] + sy_old_cell[m] + sy_new_cell[m])/6.0 ;
1869
+ sz_cell[m] = (4.0 *sz_cell[m] + sz_old_cell[m] + sz_new_cell[m])/6.0 ;
1870
1870
}
1871
1871
}
1872
1872
@@ -1948,18 +1948,18 @@ void doVillasenorDepositionShapeNImplicit (const amrex::ParticleReal * const xp_
1948
1948
1949
1949
// need to assert that the number of cell crossings in each direction
1950
1950
// is within the range permitted by the number of guard cells
1951
- // e.g., if (num_segments > 3 ) ...
1951
+ // e.g., if (num_segments > 5 ) ...
1952
1952
1953
1953
// compute total change in particle position and the initial cell
1954
1954
// locations in each direction used to find the position at cell crossings.
1955
1955
const double dxp = x_new - x_old;
1956
1956
const double dzp = z_new - z_old;
1957
- const auto dirX_sign = static_cast <int >(dxp < 0 . ? -1 : 1 );
1958
- const auto dirZ_sign = static_cast <int >(dzp < 0 . ? -1 : 1 );
1957
+ const auto dirX_sign = static_cast <double >(dxp < 0 . ? -1 . : 1 . );
1958
+ const auto dirZ_sign = static_cast <double >(dzp < 0 . ? -1 . : 1 . );
1959
1959
double Xcell = 0 ., Zcell = 0 .;
1960
1960
if (num_segments > 1 ) {
1961
- Xcell = i_old + shift + 0 .5_rt *(1 -dirX_sign);
1962
- Zcell = k_old + shift + 0 .5_rt *(1 -dirZ_sign);
1961
+ Xcell = static_cast < double >( i_old) + shift + 0.5 *(1 . -dirX_sign);
1962
+ Zcell = static_cast < double >( k_old) + shift + 0.5 *(1 . -dirZ_sign);
1963
1963
}
1964
1964
1965
1965
// loop over the number of segments and deposit
@@ -2001,29 +2001,29 @@ void doVillasenorDepositionShapeNImplicit (const amrex::ParticleReal * const xp_
2001
2001
}
2002
2002
2003
2003
// compute the segment factors (each equal to dt_seg/dt for nonzero dxp, or dzp)
2004
- const auto seg_factor_x = static_cast <amrex::Real >(dxp == 0 . ? 1 . : dxp_seg/dxp);
2005
- const auto seg_factor_z = static_cast <amrex::Real >(dzp == 0 . ? 1 . : dzp_seg/dzp);
2004
+ const auto seg_factor_x = static_cast <double >(dxp == 0 . ? 1 . : dxp_seg/dxp);
2005
+ const auto seg_factor_z = static_cast <double >(dzp == 0 . ? 1 . : dzp_seg/dzp);
2006
2006
2007
2007
// compute cell-based weights using the average segment position
2008
2008
double sx_cell[depos_order] = {0 .};
2009
2009
double sz_cell[depos_order] = {0 .};
2010
- double const x0_bar = (x0_new + x0_old)/2 .0_rt ;
2011
- double const z0_bar = (z0_new + z0_old)/2 .0_rt ;
2012
- const int i0_cell = compute_shape_factor_cell ( sx_cell, x0_bar-0 .5_rt );
2013
- const int k0_cell = compute_shape_factor_cell ( sz_cell, z0_bar-0 .5_rt );
2010
+ double const x0_bar = (x0_new + x0_old)/2.0 ;
2011
+ double const z0_bar = (z0_new + z0_old)/2.0 ;
2012
+ const int i0_cell = compute_shape_factor_cell ( sx_cell, x0_bar-0.5 );
2013
+ const int k0_cell = compute_shape_factor_cell ( sz_cell, z0_bar-0.5 );
2014
2014
2015
2015
if constexpr (depos_order >= 3 ) { // higher-order correction to the cell-based weights
2016
2016
Compute_shape_factor_pair<depos_order-1 > compute_shape_factors_cell;
2017
2017
double sx_old_cell[depos_order] = {0 .};
2018
2018
double sx_new_cell[depos_order] = {0 .};
2019
2019
double sz_old_cell[depos_order] = {0 .};
2020
2020
double sz_new_cell[depos_order] = {0 .};
2021
- const int i0_cell_2 = compute_shape_factors_cell ( sx_old_cell, sx_new_cell, x0_old-0 .5_rt , x0_new-0 .5_rt );
2022
- const int k0_cell_2 = compute_shape_factors_cell ( sz_old_cell, sz_new_cell, z0_old-0 .5_rt , z0_new-0 .5_rt );
2021
+ const int i0_cell_2 = compute_shape_factors_cell ( sx_old_cell, sx_new_cell, x0_old-0.5 , x0_new-0.5 );
2022
+ const int k0_cell_2 = compute_shape_factors_cell ( sz_old_cell, sz_new_cell, z0_old-0.5 , z0_new-0.5 );
2023
2023
ignore_unused (i0_cell_2, k0_cell_2);
2024
2024
for (int m=0 ; m<depos_order; m++) {
2025
- sx_cell[m] = (4 .0_rt *sx_cell[m] + sx_old_cell[m] + sx_new_cell[m])/6 .0_rt ;
2026
- sz_cell[m] = (4 .0_rt *sz_cell[m] + sz_old_cell[m] + sz_new_cell[m])/6 .0_rt ;
2025
+ sx_cell[m] = (4.0 *sx_cell[m] + sx_old_cell[m] + sx_new_cell[m])/6.0 ;
2026
+ sz_cell[m] = (4.0 *sz_cell[m] + sz_old_cell[m] + sz_new_cell[m])/6.0 ;
2027
2027
}
2028
2028
}
2029
2029
@@ -2115,12 +2115,12 @@ void doVillasenorDepositionShapeNImplicit (const amrex::ParticleReal * const xp_
2115
2115
2116
2116
// need to assert that the number of cell crossings in each direction
2117
2117
// is within the range permitted by the number of guard cells
2118
- // e.g., if (num_segments > 2 ) ...
2118
+ // e.g., if (num_segments > 3 ) ...
2119
2119
2120
2120
// compute dzp and the initial cell location used to find the cell crossings.
2121
2121
double const dzp = z_new - z_old;
2122
- const auto dirZ_sign = static_cast <int >(dzp < 0 . ? -1 : 1 );
2123
- double Zcell = k_old + shift + 0 .5_rt *(1 -dirZ_sign);
2122
+ const auto dirZ_sign = static_cast <double >(dzp < 0 . ? -1 . : 1 . );
2123
+ double Zcell = static_cast < double >( k_old) + shift + 0.5 *(1 . -dirZ_sign);
2124
2124
2125
2125
// loop over the number of segments and deposit
2126
2126
Compute_shape_factor< depos_order-1 > compute_shape_factor_cell;
@@ -2142,21 +2142,21 @@ void doVillasenorDepositionShapeNImplicit (const amrex::ParticleReal * const xp_
2142
2142
}
2143
2143
2144
2144
// compute the segment factor (equal to dt_seg/dt for nonzero dzp)
2145
- const auto seg_factor = static_cast <amrex::Real >(dzp == 0 . ? 1 . : dzp_seg/dzp);
2145
+ const auto seg_factor = static_cast <double >(dzp == 0 . ? 1 . : dzp_seg/dzp);
2146
2146
2147
2147
// compute cell-based weights using the average segment position
2148
2148
double sz_cell[depos_order] = {0 .};
2149
- double const z0_bar = (z0_new + z0_old)/2 .0_rt ;
2150
- const int k0_cell = compute_shape_factor_cell ( sz_cell, z0_bar-0 .5_rt );
2149
+ double const z0_bar = (z0_new + z0_old)/2.0 ;
2150
+ const int k0_cell = compute_shape_factor_cell ( sz_cell, z0_bar-0.5 );
2151
2151
2152
2152
if constexpr (depos_order >= 3 ) { // higher-order correction to the cell-based weights
2153
2153
Compute_shape_factor_pair<depos_order-1 > compute_shape_factors_cell;
2154
2154
double sz_old_cell[depos_order] = {0 .};
2155
2155
double sz_new_cell[depos_order] = {0 .};
2156
- const int k0_cell_2 = compute_shape_factors_cell ( sz_old_cell, sz_new_cell, z0_old-0 .5_rt , z0_new-0 .5_rt );
2156
+ const int k0_cell_2 = compute_shape_factors_cell ( sz_old_cell, sz_new_cell, z0_old-0.5 , z0_new-0.5 );
2157
2157
ignore_unused (k0_cell_2);
2158
2158
for (int m=0 ; m<depos_order; m++) {
2159
- sz_cell[m] = (4 .0_rt *sz_cell[m] + sz_old_cell[m] + sz_new_cell[m])/6 .0_rt ;
2159
+ sz_cell[m] = (4.0 *sz_cell[m] + sz_old_cell[m] + sz_new_cell[m])/6.0 ;
2160
2160
}
2161
2161
}
2162
2162
0 commit comments