Skip to content

Commit fd678f8

Browse files
committed
Use E* for momentum conservation
1 parent 9ae395e commit fd678f8

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/field_advance/standard/hyb_advance_b.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,8 @@ hyb_advance_b( field_array_t * RESTRICT fa,
397397
}
398398
}
399399

400-
//4: Update B=B_n+dt*(K1+2*K2+2*K3+K4)/6
401-
hyb_advance_e(fa,(isub+1)/nsub); //sets ghost Bs
400+
//4: Last update for E, subtract resistive terms for interpolation to ions
401+
hyb_advance_e(fa,2.0); //sets ghost Bs
402402
begin_remote_ghost_e( fa->f, fa->g );//ARI add cell-centered BCs
403403
end_remote_ghost_e( fa->f, fa->g );
404404

src/field_advance/standard/hyb_advance_e.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ typedef struct pipeline_args {
3131
field_t * ALIGNED(16) fx, * ALIGNED(16) fy, * ALIGNED(16) fz; \
3232
field_t * ALIGNED(16) fmx, * ALIGNED(16) fmy, * ALIGNED(16) fmz; \
3333
int x, y, z; \
34-
float ux,uy,uz,rho,hstep
34+
float ux,uy,uz,rho,hstep,res
3535

3636
#define f(x,y,z) f[ VOXEL(x,y,z, nx,ny,nz) ]
3737

@@ -84,21 +84,21 @@ typedef struct pipeline_args {
8484
f0->ex = (f0->cbz + f0->cbz0)*( pz*( (fz->cbx - fmz->cbx) ) - px*( fx->cbz - fmx->cbz ) ) \
8585
+ (f0->cby + f0->cby0)*( py*( (fy->cbx - fmy->cbx) ) - px*( fx->cby - fmx->cby ) ) \
8686
- uy*(f0->cbz+f0->cbz0) + uz*(f0->cby+f0->cby0) - px*( fx->pexx - fmx->pexx ) \
87-
+ m[f0->cmat].epsz*eta*rho*(py*( fy->cbz - fmy->cbz ) - pz*( fz->cby - fmz->cby) );\
87+
+ res*m[f0->cmat].epsz*eta*rho*(py*( fy->cbz - fmy->cbz ) - pz*( fz->cby - fmz->cby) );\
8888
f0->ex = m[f0->cmat].epsx*f0->ex;
8989

9090
#define UPDATE_EY() \
9191
f0->ey = (f0->cbx+f0->cbx0)*( px*( (fx->cby - fmx->cby) ) - py*( fy->cbx - fmy->cbx ) ) \
9292
+ (f0->cbz+f0->cbz0)*( pz*( (fz->cby - fmz->cby) ) - py*( fy->cbz - fmy->cbz ) ) \
9393
- uz*(f0->cbx+f0->cbx0) + ux*(f0->cbz+f0->cbz0) - py*( fy->pexx - fmy->pexx ) \
94-
+ m[f0->cmat].epsz*eta*rho*(pz*( fz->cbx - fmz->cbx ) - px*( fz->cbz - fmz->cbz) ); \
94+
+ res*m[f0->cmat].epsz*eta*rho*(pz*( fz->cbx - fmz->cbx ) - px*( fz->cbz - fmz->cbz) ); \
9595
f0->ey = m[f0->cmat].epsx*f0->ey;
9696

9797
#define UPDATE_EZ() \
9898
f0->ez = (f0->cby+f0->cby0)*( py*( (fy->cbz - fmy->cbz) ) - pz*( fz->cby - fmz->cby ) ) \
9999
+ (f0->cbx+f0->cbx0)*( px*( (fx->cbz - fmx->cbz) ) - pz*( fz->cbx - fmz->cbx ) ) \
100100
- ux*(f0->cby+f0->cby0) + uy*(f0->cbx+f0->cbx0) - pz*( fz->pexx - fmz->pexx ) \
101-
+ m[f0->cmat].epsz*eta*rho*(px*( fx->cby - fmx->cby ) - py*( fy->cbx - fmy->cbx) ); \
101+
+ res*m[f0->cmat].epsz*eta*rho*(px*( fx->cby - fmx->cby ) - py*( fy->cbx - fmy->cbx) ); \
102102
f0->ez = m[f0->cmat].epsx*f0->ez;
103103

104104

@@ -240,7 +240,8 @@ hyb_advance_e( field_array_t * RESTRICT fa,
240240
args->hstep=frac;
241241

242242
DECLARE_STENCIL();
243-
hstep=frac;
243+
hstep = (frac>1.5) ? 1. : frac;
244+
res = (frac>1.5) ? 0. : 1.;
244245
//have to fix
245246
//if (nmx*nmy*nmz) {
246247
//EXEC_PIPELINES( hyb_advance_e, args, 0 );
@@ -279,7 +280,7 @@ hyb_advance_e( field_array_t * RESTRICT fa,
279280
}
280281

281282

282-
if(fa->g->hypereta>0) hyb_hypereta(fa);
283+
if(fa->g->hypereta>0 && res>0) hyb_hypereta(fa);
283284

284285

285286
/*//to initialize E

0 commit comments

Comments
 (0)