Removed init. of pot_act_ext from main loop;
zero filling of pot_act_ext now only if external potential active; improved warning on minimum timestep; changed CUDAHOME to CUDA_HOME
This commit is contained in:
parent
0a2344563d
commit
064eb4e3c5
2 changed files with 18 additions and 19 deletions
17
phigrape.cpp
17
phigrape.cpp
|
|
@ -71,12 +71,7 @@ public:
|
|||
void add_component(External_gravity &component)
|
||||
{
|
||||
components.push_back(&component);
|
||||
}
|
||||
bool any_active()
|
||||
{
|
||||
for (auto component : components)
|
||||
if (component->is_active) return true;
|
||||
return false;
|
||||
if (component.is_active) any_active = true;
|
||||
}
|
||||
void operator()(int n, const std::vector<double3> &x, const std::vector<double3> &v, std::vector<double> &pot, std::vector<double3> &acc, std::vector<double3> &jrk)
|
||||
{
|
||||
|
|
@ -92,6 +87,7 @@ public:
|
|||
}
|
||||
fflush(stdout);
|
||||
}
|
||||
bool any_active = false;
|
||||
private:
|
||||
std::vector<External_gravity*> components;
|
||||
};
|
||||
|
|
@ -497,6 +493,7 @@ int main(int argc, char *argv[])
|
|||
std::vector<int> ind_act(N);
|
||||
std::vector<double3> x_act_new(N), v_act_new(N), a_act_new(N), adot_act_new(N);
|
||||
std::vector<double> t(N, time_cur), pot_act_new(N);
|
||||
std::vector<double> pot_act_ext(N, 0.);
|
||||
|
||||
// Functors for the main integration loop
|
||||
Active_search active_search(myRank, n_proc, n_loc, N, grapite_active_search_flag);
|
||||
|
|
@ -555,8 +552,10 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
/* Calculate gravity on active particles due to external forces */
|
||||
std::vector<double> pot_act_ext(N, 0.);
|
||||
calc_ext_grav(n_act, x_act_new, v_act_new, pot_act_ext, a_act_new, adot_act_new);
|
||||
if (calc_ext_grav.any_active) {
|
||||
std::fill_n(begin(pot_act_ext), n_act, 0);
|
||||
calc_ext_grav(n_act, x_act_new, v_act_new, pot_act_ext, a_act_new, adot_act_new);
|
||||
}
|
||||
|
||||
/* correct the active particles positions etc... on all the nodes */
|
||||
double min_dt = dt_max;
|
||||
|
|
@ -589,7 +588,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (config.dt_min_warning && (myRank == 0)) {
|
||||
if (dt_tmp == dt_min) {
|
||||
printf("!!! Warning1: dt_act = dt_min = %.6E \t ind_act = %07d \n", dt_tmp, ind_act[i]);
|
||||
printf("!!! Warning1: dt_act = dt_min = %.6E \t ind_act = %07d time_cur=%.16E\n", dt_tmp, ind_act[i], time_cur);
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue