sandbox/Antoonvh/criticallocation.h
Find a location and grid size that is critical with respect to the CFL criterion.
void find_a_critical_location(double xcrit,double ycrit,double zcrit,double lev)
{
double xyzdt[5];
double dtmax = 100.0*DT;
int n=0;
@if _MPIdouble xyzdtglob[5*npe()];
@endif
foreach_face(reduction(min:dtmax)){
if (u.x[] != 0.) {
double dt = Delta*cm[]/fabs(u.x[]);
if (dt < dtmax){
[0]=x;
xyzdt[1]=y;
xyzdt[2]=z;
xyzdt[3]=dt;
xyzdt[4]=(double)level;
xyzdt= dt;
dtmax }
}
}
@if _MPI (&xyzdt,5,MPI_DOUBLE,xyzdtglob,5,MPI_DOUBLE,0,MPI_COMM_WORLD);
MPI_Gatherfor (int m = 0;m<npe();m++){
if (xyzdtglob[5*m+3]==dtmax){
=m;
n// fprintf(ferr,"Critical cell proc. ID = %d\n",n)
=xyzdtglob[5*n];
xcrit=xyzdtglob[(5*n)+1];
ycrit=xyzdtglob[(5*n)+2];
zcrit=xyzdtglob[(5*n)+4];
lev+=npe();
m}
}
@endif
!_MPI
@if =xyzdt[0];
xcrit=xyzdt[1];
ycrit=xyzdt[2];
zcrit=xyzdt[4];
lev
@endif}