Commit c969365b authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

several bug fixes using the new test cases.


Former-commit-id: 36567220a6b658f9dbff8091561e53ed45c4bf7a
parent cfe714f1
...@@ -32,7 +32,7 @@ L = 50 # Number of particles along one axis ...@@ -32,7 +32,7 @@ L = 50 # Number of particles along one axis
rho = 1. # Density rho = 1. # Density
P = 1. # Pressure P = 1. # Pressure
gamma = 5./3. # Gas adiabatic index gamma = 5./3. # Gas adiabatic index
pert = 0.1 # Perturbation scale (in units of the interparticle separation) pert = 0.01 # Perturbation scale (in units of the interparticle separation)
fileName = "perturbedBox.hdf5" fileName = "perturbedBox.hdf5"
......
...@@ -28,7 +28,7 @@ from numpy import * ...@@ -28,7 +28,7 @@ from numpy import *
periodic= 1 # 1 For periodic box periodic= 1 # 1 For periodic box
boxSize = 1. boxSize = 1.
L = 50 # Number of particles along one axis L = 50 # Number of particles along one axis
rho = 1. # Density rho = 2. # Density
P = 1. # Pressure P = 1. # Pressure
gamma = 5./3. # Gas adiabatic index gamma = 5./3. # Gas adiabatic index
fileName = "uniformBox.hdf5" fileName = "uniformBox.hdf5"
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <string.h> #include <string.h>
#include <pthread.h> #include <pthread.h>
#include <math.h> #include <math.h>
#include <fenv.h>
#include <omp.h> #include <omp.h>
/* Conditional headers. */ /* Conditional headers. */
...@@ -193,6 +194,24 @@ void map_wcount_max ( struct part *p , struct cell *c , void *data ) { ...@@ -193,6 +194,24 @@ void map_wcount_max ( struct part *p , struct cell *c , void *data ) {
} }
void map_h_min ( struct part *p , struct cell *c , void *data ) {
struct part **p2 = (struct part **)data;
if ( p->h < (*p2)->h )
*p2 = p;
}
void map_h_max ( struct part *p , struct cell *c , void *data ) {
struct part **p2 = (struct part **)data;
if ( p->h > (*p2)->h )
*p2 = p;
}
/** /**
* @brief Mapping function for neighbour count. * @brief Mapping function for neighbour count.
...@@ -689,6 +708,9 @@ int main ( int argc , char *argv[] ) { ...@@ -689,6 +708,9 @@ int main ( int argc , char *argv[] ) {
float dt_max = 0.0f; float dt_max = 0.0f;
ticks tic; ticks tic;
/* Choke on FP-exceptions. */
feenableexcept( FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW );
/* Init the space. */ /* Init the space. */
bzero( &s , sizeof(struct space) ); bzero( &s , sizeof(struct space) );
...@@ -862,6 +884,7 @@ int main ( int argc , char *argv[] ) { ...@@ -862,6 +884,7 @@ int main ( int argc , char *argv[] ) {
parts[k].x[2] += shift[2]; parts[k].x[2] += shift[2];
} }
/* Dump the first few particles. */
for(k=0; k<10; ++k) for(k=0; k<10; ++k)
printParticle(parts, k); printParticle(parts, k);
...@@ -910,12 +933,6 @@ int main ( int argc , char *argv[] ) { ...@@ -910,12 +933,6 @@ int main ( int argc , char *argv[] ) {
/* Dump the particle positions. */ /* Dump the particle positions. */
// space_map_parts( &s , &map_dump , shift ); // space_map_parts( &s , &map_dump , shift );
/* Dump the acceleration of the first particle. */
for ( k = 0 ; k < 3 ; k++ ) {
printf( "main: parts[%lli].a is [ %.16e %.16e %.16e ].\n" , s.parts[k].id , s.parts[k].a[0] , s.parts[k].a[1] , s.parts[k].a[2] );
printf( "main: parts[%lli].a has h=%e, rho=%e, wcount=%.3f.\n" , s.parts[k].id , s.parts[k].h , s.parts[k].rho , s.parts[k].wcount + 32.0/3 );
}
/* Initialize the runner with this space. */ /* Initialize the runner with this space. */
tic = getticks(); tic = getticks();
engine_init( &e , &s , nr_threads , nr_queues , engine_policy_steal | engine_policy_keep ); engine_init( &e , &s , nr_threads , nr_queues , engine_policy_steal | engine_policy_keep );
...@@ -943,6 +960,23 @@ int main ( int argc , char *argv[] ) { ...@@ -943,6 +960,23 @@ int main ( int argc , char *argv[] ) {
/* Take a step. */ /* Take a step. */
engine_step( &e , 0 ); engine_step( &e , 0 );
/* Dump the first few particles. */
for(k=0; k<10; ++k)
printParticle(parts, k);
printParticle( parts , 113531 );
/* Get the particle with the lowest h. */
p = &s.parts[0];
space_map_parts( &s , &map_h_min , &p );
printf( "main: particle %lli/%i at [ %e %e %e ] has minimum h=%.3e (h_dt=%.3e).\n" ,
p->id , (int)(p - s.parts) , p->x[0] , p->x[1] , p->x[2] , p->h , p->h_dt );
/* Get the particle with the highest h. */
p = &s.parts[0];
space_map_parts( &s , &map_h_max , &p );
printf( "main: particle %lli/%i at [ %e %e %e ] has maximum h=%.3e (h_dt=%.3e).\n" ,
p->id , (int)(p - s.parts) , p->x[0] , p->x[1] , p->x[2] , p->h , p->h_dt );
/* Output. */ /* Output. */
#ifdef TIMER #ifdef TIMER
printf( "main: runner timers are [ %.3f" , timers[0]/CPU_TPS*1000 ); printf( "main: runner timers are [ %.3f" , timers[0]/CPU_TPS*1000 );
...@@ -1010,11 +1044,9 @@ int main ( int argc , char *argv[] ) { ...@@ -1010,11 +1044,9 @@ int main ( int argc , char *argv[] ) {
// space_map_parts( &s , &map_icount , &icount ); // space_map_parts( &s , &map_icount , &icount );
// printf( "main: average neighbours per particle is %.3f.\n" , (double)icount / s.nr_parts ); // printf( "main: average neighbours per particle is %.3f.\n" , (double)icount / s.nr_parts );
/* Dump the acceleration of the first particle. */ /* Dump the first few particles. */
for ( k = 0 ; k < 3 ; k++ ) { for(k=0; k<10; ++k)
printf( "main: parts[%lli].a is [ %.16e %.16e %.16e ].\n" , s.parts[k].id , s.parts[k].a[0] , s.parts[k].a[1] , s.parts[k].a[2] ); printParticle(parts, k);
printf( "main: parts[%lli].a has h=%e, rho=%e, wcount=%.3f.\n" , s.parts[k].id , s.parts[k].h , s.parts[k].rho , s.parts[k].wcount );
}
/* Get all the cells of a certain depth. */ /* Get all the cells of a certain depth. */
// icount = 1; // icount = 1;
......
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
AUTOMAKE_OPTIONS=gnu AUTOMAKE_OPTIONS=gnu
# Add the debug flag to the whole thing # Add the debug flag to the whole thing
AM_CFLAGS = -g -O3 -Wall -Werror -ffast-math -fstrict-aliasing -ftree-vectorize \ # AM_CFLAGS = -g -O3 -Wall -Werror -ffast-math -fstrict-aliasing -ftree-vectorize \
-funroll-loops $(SIMD_FLAGS) $(OPENMP_CFLAGS) \ # -funroll-loops $(SIMD_FLAGS) $(OPENMP_CFLAGS) \
-DTIMER -DCOUNTER -DCPU_TPS=2.67e9
# AM_CFLAGS = -Wall -Werror $(OPENMP_CFLAGS) \
# -DTIMER -DCOUNTER -DCPU_TPS=2.67e9 # -DTIMER -DCOUNTER -DCPU_TPS=2.67e9
AM_CFLAGS = -Wall -Werror $(OPENMP_CFLAGS) \
-DTIMER -DCOUNTER -DCPU_TPS=2.67e9
# Assign a "safe" version number # Assign a "safe" version number
AM_LDFLAGS = $(LAPACK_LIBS) $(BLAS_LIBS) $(HDF5_LDFLAGS) -version-info 0:0:0 AM_LDFLAGS = $(LAPACK_LIBS) $(BLAS_LIBS) $(HDF5_LDFLAGS) -version-info 0:0:0
......
...@@ -22,17 +22,26 @@ ...@@ -22,17 +22,26 @@
#include "part.h" #include "part.h"
void printParticle(struct part *parts, int i) void printParticle ( struct part *parts , long long int id ) {
{
printf("## Particle[%d]: id= %lld x=( %f, %f, %f) v=( %f, %f, %f) h= %f m= %f rho= %f u= %f dt= %f\n", int i;
/* Look for the particle. */
for ( i = 0 ; parts[i].id != id ; i++ );
printf("## Particle[%d]: id=%lld, x=(%f,%f,%f), v=(%f,%f,%f), a=(%f,%f,%f), h=%f, h_dt=%f, wcount=%f, m=%f, rho=%f, u=%f, dudt=%f, dt=%.3e\n",
i, i,
parts[i].id, parts[i].id,
parts[i].x[0], parts[i].x[1], parts[i].x[2], parts[i].x[0], parts[i].x[1], parts[i].x[2],
parts[i].v[0], parts[i].v[1], parts[i].v[2], parts[i].v[0], parts[i].v[1], parts[i].v[2],
parts[i].a[0], parts[i].a[1], parts[i].a[2],
parts[i].h, parts[i].h,
parts[i].h_dt,
parts[i].wcount,
parts[i].mass, parts[i].mass,
parts[i].rho, parts[i].rho,
parts[i].u, parts[i].u,
parts[i].u_dt,
parts[i].dt parts[i].dt
); );
} }
......
...@@ -20,4 +20,4 @@ ...@@ -20,4 +20,4 @@
void printParticle(struct part *parts, int i); void printParticle(struct part *parts, long long int i);
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "lock.h" #include "lock.h"
#include "task.h" #include "task.h"
#include "part.h" #include "part.h"
#include "debug.h"
#include "cell.h" #include "cell.h"
#include "space.h" #include "space.h"
#include "queue.h" #include "queue.h"
...@@ -65,6 +66,7 @@ void engine_prepare ( struct engine *e ) { ...@@ -65,6 +66,7 @@ void engine_prepare ( struct engine *e ) {
int j, k, qid; int j, k, qid;
struct space *s = e->s; struct space *s = e->s;
struct queue *q; struct queue *q;
float dt_max = e->dt_max;
TIMER_TIC TIMER_TIC
...@@ -92,12 +94,13 @@ void engine_prepare ( struct engine *e ) { ...@@ -92,12 +94,13 @@ void engine_prepare ( struct engine *e ) {
/* Re-set the particle data. */ /* Re-set the particle data. */
// tic = getticks(); // tic = getticks();
#pragma omp parallel for schedule(static) #pragma omp parallel for schedule(static)
for ( k = 0 ; k < s->nr_parts ; k++ ) { for ( k = 0 ; k < s->nr_parts ; k++ )
s->parts[k].wcount = 0.0f; if ( s->parts[k].dt <= dt_max ) {
s->parts[k].wcount_dh = 0.0f; s->parts[k].wcount = 0.0f;
s->parts[k].rho = 0.0f; s->parts[k].wcount_dh = 0.0f;
s->parts[k].rho_dh = 0.0f; s->parts[k].rho = 0.0f;
} s->parts[k].rho_dh = 0.0f;
}
// printf( "engine_prepare: re-setting particle data took %.3f ms.\n" , (double)(getticks() - tic) / CPU_TPS * 1000 ); // printf( "engine_prepare: re-setting particle data took %.3f ms.\n" , (double)(getticks() - tic) / CPU_TPS * 1000 );
/* Run throught the tasks and get all the waits right. */ /* Run throught the tasks and get all the waits right. */
...@@ -177,15 +180,18 @@ void engine_step ( struct engine *e , int sort_queues ) { ...@@ -177,15 +180,18 @@ void engine_step ( struct engine *e , int sort_queues ) {
int k, nr_parts = e->s->nr_parts; int k, nr_parts = e->s->nr_parts;
struct part *restrict parts = e->s->parts, *restrict p; struct part *restrict parts = e->s->parts, *restrict p;
float *restrict v_bar; float *restrict v_bar;
float dt = e->dt, hdt = 0.5*dt, dt_max; float dt = e->dt, hdt = 0.5*dt, dt_max, dt_min, ldt_min, ldt_max;
#ifdef __SSE2__ double etot = 0.0, letot, lmom[3], mom[3] = { 0.0 , 0.0 , 0.0 };
VEC_MACRO(4,float) hdtv = _mm_set1_ps( hdt ); int threadID, nthreads;
#endif // #ifdef __SSE2__
// VEC_MACRO(4,float) hdtv = _mm_set1_ps( hdt );
// #endif
/* Get the maximum dt. */ /* Get the maximum dt. */
dt_max = dt; dt_max = 2.0f*dt;
for ( k = 0 ; k < 32 && (e->step & (1 << k)) == 0 ; k++ ) for ( k = 0 ; k < 32 && (e->step & (1 << k)) == 0 ; k++ )
dt_max *= 2; dt_max *= 2;
dt_max = 1;
/* Set the maximum dt. */ /* Set the maximum dt. */
e->dt_max = dt_max; e->dt_max = dt_max;
...@@ -198,43 +204,46 @@ void engine_step ( struct engine *e , int sort_queues ) { ...@@ -198,43 +204,46 @@ void engine_step ( struct engine *e , int sort_queues ) {
/* First kick. */ /* First kick. */
TIMER_TIC TIMER_TIC
#pragma omp parallel for schedule(static) private(p) // #pragma omp parallel for schedule(static) private(p)
for ( k = 0 ; k < nr_parts ; k++ ) { for ( k = 0 ; k < nr_parts ; k++ ) {
/* Get a handle on the part. */ /* Get a handle on the part. */
p = &parts[k]; p = &parts[k];
/* Step and store the velocity and internal energy. */ /* Step and store the velocity and internal energy. */
#ifdef __SSE__ // #ifdef __SSE__
_mm_store_ps( &v_bar[4*k] , _mm_add_ps( _mm_load_ps( &p->v[0] ) , _mm_mul_ps( hdtv , _mm_load_ps( &p->a[0] ) ) ) ); // _mm_store_ps( &v_bar[4*k] , _mm_add_ps( _mm_load_ps( &p->v[0] ) , _mm_mul_ps( hdtv , _mm_load_ps( &p->a[0] ) ) ) );
#else // #else
v_bar[4*k+0] = p->v[0] + hdt * p->a[0]; v_bar[4*k+0] = p->v[0] + hdt * p->a[0];
v_bar[4*k+1] = p->v[1] + hdt * p->a[1]; v_bar[4*k+1] = p->v[1] + hdt * p->a[1];
v_bar[4*k+2] = p->v[2] + hdt * p->a[2]; v_bar[4*k+2] = p->v[2] + hdt * p->a[2];
#endif // #endif
v_bar[4*k+3] = p->u + hdt * p->u_dt; v_bar[4*k+3] = p->u + hdt * p->u_dt;
/* Move the particles with the velocitie at the half-step. */ /* Move the particles with the velocitie at the half-step. */
// p->x[0] += dt * v_bar[3*k+0]; p->x[0] += dt * v_bar[4*k+0];
// p->x[1] += dt * v_bar[3*k+1]; p->x[1] += dt * v_bar[4*k+1];
// p->x[2] += dt * v_bar[3*k+2]; p->x[2] += dt * v_bar[4*k+2];
/* Update positions and energies at the half-step. */ /* Update positions and energies at the half-step. */
// p->v[0] += dt * p->a[0]; p->v[0] += dt * p->a[0];
// p->v[1] += dt * p->a[1]; p->v[1] += dt * p->a[1];
// p->v[2] += dt * p->a[2]; p->v[2] += dt * p->a[2];
// p->u *= expf( p->u_dt / p->u * dt ); p->u *= expf( p->u_dt / p->u * dt );
// p->h *= expf( -1.0f * p->h_dt / p->h * dt ); // p->h *= expf( p->h_dt / p->h * dt );
/* Integrate other values if this particle will not be updated. */ /* Integrate other values if this particle will not be updated. */
if ( p->dt > dt_max ) { // if ( p->dt > dt_max ) {
p->rho *= expf( -3.0f * p->h_dt / p->h * dt ); // p->rho *= expf( -3.0f * p->h_dt / p->h * dt );
p->POrho2 = p->u * ( const_gamma - 1.0f ) / ( p->rho + p->h * p->rho_dh / 3.0f ); // p->POrho2 = p->u * ( const_gamma - 1.0f ) / ( p->rho + p->h * p->rho_dh / 3.0f );
} // }
} }
TIMER_TOC( timer_kick1 ); TIMER_TOC( timer_kick1 );
// for(k=0; k<10; ++k)
// printParticle(parts, k);
/* Prepare the space. */ /* Prepare the space. */
engine_prepare( e ); engine_prepare( e );
...@@ -263,43 +272,79 @@ void engine_step ( struct engine *e , int sort_queues ) { ...@@ -263,43 +272,79 @@ void engine_step ( struct engine *e , int sort_queues ) {
/* Stop the clock. */ /* Stop the clock. */
TIMER_TOC(timer_step); TIMER_TOC(timer_step);
// for(k=0; k<10; ++k)
// printParticle(parts, k);
/* Second kick. */ /* Second kick. */
TIMER_TIC_ND TIMER_TIC_ND
e->dt_min = FLT_MAX; dt_min = FLT_MAX; dt_max = 0.0f;
#pragma omp parallel private(p,k) #pragma omp parallel private(p,k,ldt_min,ldt_max,lmom,letot,threadID,nthreads)
{ {
int threadID = omp_get_thread_num(); threadID = omp_get_thread_num();
int nthreads = omp_get_num_threads(); nthreads = omp_get_num_threads();
float dt_min = FLT_MAX; ldt_min = FLT_MAX; ldt_max = 0.0f;
lmom[0] = 0.0; lmom[1] = 0.0; lmom[2] = 0.0;
letot = 0.0;
for ( k = nr_parts * threadID / nthreads ; k < nr_parts * (threadID + 1) / nthreads ; k++ ) { for ( k = nr_parts * threadID / nthreads ; k < nr_parts * (threadID + 1) / nthreads ; k++ ) {
/* Get a handle on the part. */ /* Get a handle on the part. */
p = &parts[k]; p = &parts[k];
/* Scale the derivatives. */ /* Scale the derivatives if they're freshly computed. */
p->u_dt *= p->POrho2; if ( p->dt <= dt_max ) {
p->h_dt *= p->h * 0.333333333f; p->u_dt *= p->POrho2;
p->h_dt *= p->h * 0.333333333f;
}
/* Update positions and energies at the half-step. */ /* Update positions and energies at the half-step. */
#ifdef __SSE__ // #ifdef __SSE__
_mm_store_ps( &p->v[0] , _mm_add_ps( _mm_load_ps( &v_bar[4*k] ) , _mm_mul_ps( hdtv , _mm_load_ps( &p->a[0] ) ) ) ); // _mm_store_ps( &p->v[0] , _mm_add_ps( _mm_load_ps( &v_bar[4*k] ) , _mm_mul_ps( hdtv , _mm_load_ps( &p->a[0] ) ) ) );
#else // #else
p->v[0] = v_bar[4*k+0] + hdt * p->a[0]; p->v[0] = v_bar[4*k+0] + hdt * p->a[0];
p->v[1] = v_bar[4*k+1] + hdt * p->a[1]; p->v[1] = v_bar[4*k+1] + hdt * p->a[1];
p->v[2] = v_bar[4*k+2] + hdt * p->a[2]; p->v[2] = v_bar[4*k+2] + hdt * p->a[2];
#endif // #endif
// p->u = v_bar[4*k+3] + hdt * p->u_dt; p->u = v_bar[4*k+3] + hdt * p->u_dt;
/* Get the smallest dt. */ /* Get the smallest/largest dt. */
dt_min = fminf( dt_min , p->dt ); ldt_min = fminf( ldt_min , p->dt );
ldt_max = fmaxf( ldt_max , p->dt );
/* Collect total energy. */
letot += 0.5 * p->mass * ( p->v[0]*p->v[0] + p->v[1]*p->v[1] + p->v[2]*p->v[2] ) + p->mass * p->u;
/* Collect momentum */
lmom[0] += p->mass * p->v[0];
lmom[1] += p->mass * p->v[1];
lmom[2] += p->mass * p->v[2];
} }
#pragma omp critical #pragma omp critical
e->dt_min = fminf( e->dt_min , dt_min ); {
dt_min = fminf( dt_min , ldt_min );
dt_max = fmaxf( dt_max , ldt_max );
mom[0] += lmom[0];
mom[1] += lmom[1];
mom[2] += lmom[2];
etot += letot;
}
} }
TIMER_TOC( timer_kick2 ); TIMER_TOC( timer_kick2 );
printf( "engine_step: dt_min is %e.\n" , e->dt_min ); fflush(stdout); e->dt_min = dt_min;
printf( "engine_step: dt_min/dt_max is %e/%e.\n" , dt_min , dt_max ); fflush(stdout);
printf( "engine_step: etot is %e.\n" , etot ); fflush(stdout);
printf( "engine_step: total momentum is [ %e , %e , %e ].\n" , mom[0] , mom[1] , mom[2] ); fflush(stdout);
/* Does the time step need adjusting? */
if ( dt_min < e->dt ) {
e->dt *= 0.5;
printf( "engine_step: dt_min dropped below time step, adjusting to dt=%e.\n" , e->dt );
}
else if ( dt_min > 2*e->dt ) {
e->dt *= 2.0;
printf( "engine_step: dt_min is larger than twice the time step, adjusting to dt=%e.\n" , e->dt );
}
/* Clean up. */ /* Clean up. */
free( v_bar ); free( v_bar );
......
...@@ -325,6 +325,7 @@ void runner_dosort ( struct runner *r , struct cell *c , int flags ) { ...@@ -325,6 +325,7 @@ void runner_dosort ( struct runner *r , struct cell *c , int flags ) {
void runner_doghost ( struct runner *r , struct cell *c ) { void runner_doghost ( struct runner *r , struct cell *c ) {
struct part *p; struct part *p;
struct cpart *cp;
struct cell *finger; struct cell *finger;
int i, k, redo, count = c->count; int i, k, redo, count = c->count;
int *pid; int *pid;
...@@ -357,9 +358,10 @@ void runner_doghost ( struct runner *r , struct cell *c ) { ...@@ -357,9 +358,10 @@ void runner_doghost ( struct runner *r , struct cell *c ) {
/* Get a direct pointer on the part. */ /* Get a direct pointer on the part. */
p = &c->parts[ pid[i] ]; p = &c->parts[ pid[i] ];
cp = &c->cparts[ pid[i] ];
/* Is this part within the timestep? */ /* Is this part within the timestep? */
if ( p->dt <= dt_max ) { if ( cp->dt <= dt_max ) {
/* Adjust the computed rho. */ /* Adjust the computed rho. */
ihg = kernel_igamma / p->h; ihg = kernel_igamma / p->h;
...@@ -370,11 +372,12 @@ void runner_doghost ( struct runner *r , struct cell *c ) { ...@@ -370,11 +372,12 @@ void runner_doghost ( struct runner *r , struct cell *c ) {
/* Update the smoothing length. */ /* Update the smoothing length. */
p->h -= ( p->wcount - const_nwneigh ) / p->wcount_dh; p->h -= ( p->wcount - const_nwneigh ) / p->wcount_dh;
cp->h = p->h;
/* Did we get the right number density? */ /* Did we get the right number density? */
if ( p->wcount > const_nwneigh + 1 || if ( p->wcount > const_nwneigh + 1 ||
p->wcount < const_nwneigh - 1 ) { p->wcount < const_nwneigh - 1 ) {
printf( "runner_doghost: particle %lli (h=%e,depth=%i) has bad wcount=%f.\n" , p->id , p->h , c->depth , p->wcount ); fflush(stdout); // printf( "runner_doghost: particle %lli (h=%e,h_dt=%e,depth=%i) has bad wcount=%.3f.\n" , p->id , p->h , p->h_dt , c->depth , p->wcount ); fflush(stdout);
// p->h += ( p->wcount + kernel_root - const_nwneigh ) / p->wcount_dh; // p->h += ( p->wcount + kernel_root - const_nwneigh ) / p->wcount_dh;
pid[redo] = pid[i]; pid[redo] = pid[i];
redo += 1; redo += 1;
...@@ -387,6 +390,7 @@ void runner_doghost ( struct runner *r , struct cell *c ) { ...@@ -387,6 +390,7 @@ void runner_doghost ( struct runner *r , struct cell *c ) {
/* Compute this particle's time step. */ /* Compute this particle's time step. */
p->dt = const_cfl * p->h / sqrtf( const_gamma * ( const_gamma - 1.0f ) * p->u ); p->dt = const_cfl * p->h / sqrtf( const_gamma * ( const_gamma - 1.0f ) * p->u );
cp->dt = p->dt;
/* Compute the pressure. */ /* Compute the pressure. */
// p->P = p->rho * p->u * ( const_gamma - 1.0f ); // p->P = p->rho * p->u * ( const_gamma - 1.0f );
...@@ -394,15 +398,15 @@ void runner_doghost ( struct runner *r , struct cell *c ) { ...@@ -394,15 +398,15 @@ void runner_doghost ( struct runner *r , struct cell *c ) {
/* Compute the P/Omega/rho2. */ /* Compute the P/Omega/rho2. */
p->POrho2 = p->u * ( const_gamma - 1.0f ) / ( p->rho + p->h * p->rho_dh / 3.0f ); p->POrho2 = p->u * ( const_gamma - 1.0f ) / ( p->rho + p->h * p->rho_dh / 3.0f );
} /* Reset the acceleration. */
for ( k = 0 ; k < 3 ; k++ )
p->a[k] = 0.0f;
/* Reset the acceleration. */ /* Reset the time derivatives. */
for ( k = 0 ; k < 3 ; k++ ) p->u_dt = 0.0f;
p->a[k] = 0.0f; p->h_dt = 0.0f;
/* Reset the time derivatives. */ }
p->u_dt = 0.0f;
p->h_dt = 0.0f;
} }
......
...@@ -368,7 +368,7 @@ __attribute__ ((always_inline)) INLINE static void runner_iact_force ( float r2 ...@@ -368,7 +368,7 @@ __attribute__ ((always_inline)) INLINE static void runner_iact_force ( float r2
pj->u_dt += pi->mass * dvdr * wj_dr; pj->u_dt += pi->mass * dvdr * wj_dr;
/* Get the time derivative for h. */ /* Get the time derivative for h. */