Skip to content

Commit

Permalink
Merge branch 'VTKfiles' of github.com:EXP-code/EXP into VTKfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin D. Weinberg committed Nov 21, 2024
2 parents fac5609 + 6e5dbe4 commit 34a8dcf
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/CBDisk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ CBDisk::CBDisk(Component* c0, const YAML::Node& conf, MixtureBasis* m) :
PolarBasis(c0, conf, m)
{
id = "CBDisk";
is_flat = true;

// Radial scale factor/softening radius
//
Expand Down
2 changes: 1 addition & 1 deletion src/OutputContainer.H
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public:
void initialize();

//! Execute the all methods in the container
void Run(int nstep, int mstep=std::numeric_limits<int>::max(), bool last=false);
void Run(int nstep, int mstep=std::numeric_limits<int>::max(), bool final=false);
};

#endif
Expand Down
48 changes: 42 additions & 6 deletions src/PolarBasis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,20 @@ void * PolarBasis::determine_coefficients_thread(void * arg)
{
// For biorthogonal density component and normalization
//
constexpr double norm0 = 1.0;
constexpr double norm1 = M_SQRT2;
constexpr double norm0_3d = 2.0*M_PI * 0.5*M_2_SQRTPI/M_SQRT2;
constexpr double norm1_3d = 2.0*M_PI * 0.5*M_2_SQRTPI;

constexpr double norm0_2d = 1.0;
constexpr double norm1_2d = M_SQRT2;

double norm0, norm1;
if (is_flat) {
norm0 = norm0_2d;
norm1 = norm1_2d;
} else {
norm0 = norm0_3d;
norm1 = norm1_3d;
}

double r, r2, facL=1.0, fac1, fac2, phi, mass;
double xx, yy, zz;
Expand Down Expand Up @@ -1044,8 +1056,20 @@ void PolarBasis::multistep_update(int from, int to, Component *c, int i, int id)

// For biorthogonal density component and normalization
//
constexpr double norm0 = 1.0;
constexpr double norm1 = M_SQRT2;
constexpr double norm0_3d = 2.0*M_PI * 0.5*M_2_SQRTPI/M_SQRT2;
constexpr double norm1_3d = 2.0*M_PI * 0.5*M_2_SQRTPI;

constexpr double norm0_2d = 1.0;
constexpr double norm1_2d = M_SQRT2;

double norm0, norm1;
if (is_flat) {
norm0 = norm0_2d;
norm1 = norm1_2d;
} else {
norm0 = norm0_3d;
norm1 = norm1_3d;
}

double mass = c->Mass(i) * component->Adiabatic();

Expand Down Expand Up @@ -1323,8 +1347,20 @@ void PolarBasis::compute_multistep_coefficients()

void * PolarBasis::determine_acceleration_and_potential_thread(void * arg)
{
constexpr double norm0 = 1.0;
constexpr double norm1 = M_SQRT2;
constexpr double norm0_3d = 0.5*M_2_SQRTPI/M_SQRT2;
constexpr double norm1_3d = 0.5*M_2_SQRTPI;

constexpr double norm0_2d = 1.0;
constexpr double norm1_2d = M_SQRT2;

double norm0, norm1;
if (is_flat) {
norm0 = norm0_2d;
norm1 = norm1_2d;
} else {
norm0 = norm0_3d;
norm1 = norm1_3d;
}

double r, r0=0.0, phi;
double potr, potz, potl, potp, p, pc, drc, drs, dzc, dzs, ps, dfacp, facdp;
Expand Down
17 changes: 11 additions & 6 deletions src/cudaBiorthCyl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,19 @@ void BiorthCyl::initialize_cuda
// Add background arrays
//
std::vector<thrust::host_vector<cuFP_t>> tt(ndim2);
for (auto & v : tt) v.resize(numr);
for (auto & v : tt) {
v.resize(numr);
thrust::fill(v.begin(), v.end(), 0.0);
}

double dx0 = (xmax - xmin)/(numr - 1);
if (disk) {
double dx0 = (xmax - xmin)/(numr - 1);

for (int i=0; i<numr; i++) {
double r = xi_to_r(xmin + dx0*i);
tt[0][i] = disk->pot(r);
tt[1][i] = disk->dpot(r);
for (int i=0; i<numr; i++) {
double r = xi_to_r(xmin + dx0*i);
tt[0][i] = disk->pot(r);
tt[1][i] = disk->dpot(r);
}
}

// Allocate CUDA array in device memory (a one-dimension 'channel')
Expand Down
4 changes: 2 additions & 2 deletions src/end.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
void clean_up(void)
{
// Call for final output to files
output->Run(this_step, 0, true);
if (output) output->Run(this_step, 0, true);
// Cache for restart
external->finish();
if (external) external->finish();

MPI_Barrier(MPI_COMM_WORLD);

Expand Down

0 comments on commit 34a8dcf

Please sign in to comment.