Skip to content

Commit 6bd3e31

Browse files
committed
2 parents 5d25f3d + fd6bc9e commit 6bd3e31

File tree

5 files changed

+48
-13
lines changed

5 files changed

+48
-13
lines changed

external/kokkos

Submodule kokkos updated 169 files

src/muscl/MHDInitFunctors2D.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "shared/problems/KHParams.h"
1616
#include "shared/problems/RotorParams.h"
1717
#include "shared/problems/FieldLoopParams.h"
18+
#include "shared/problems/OrszagTangParams.h"
1819

1920
// kokkos random numbers
2021
#include <Kokkos_Random.hpp>
@@ -250,15 +251,17 @@ class InitOrszagTangFunctor2D : public MHDBaseFunctor2D {
250251

251252
public:
252253
InitOrszagTangFunctor2D(HydroParams params,
253-
DataArray2d Udata) :
254-
MHDBaseFunctor2D(params), Udata(Udata) {};
254+
OrszagTangParams otParams,
255+
DataArray2d Udata) :
256+
MHDBaseFunctor2D(params), otParams(otParams), Udata(Udata) {};
255257

256258
// static method which does it all: create and execute functor
257259
static void apply(HydroParams params,
260+
OrszagTangParams otParams,
258261
DataArray2d Udata,
259262
int nbCells)
260263
{
261-
InitOrszagTangFunctor2D functor(params, Udata);
264+
InitOrszagTangFunctor2D functor(params, otParams, Udata);
262265

263266
functor.phase = INIT_ALL_VAR_BUT_ENERGY;
264267
Kokkos::parallel_for(nbCells, functor);
@@ -380,8 +383,9 @@ class InitOrszagTangFunctor2D : public MHDBaseFunctor2D {
380383

381384
} // init_energy
382385

386+
OrszagTangParams otParams;
383387
DataArray2d Udata;
384-
PhaseType phase ;
388+
PhaseType phase;
385389

386390
}; // InitOrszagTangFunctor2D
387391

src/muscl/MHDInitFunctors3D.h

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "shared/problems/ImplodeParams.h"
1818
#include "shared/problems/KHParams.h"
1919
#include "shared/problems/RotorParams.h"
20+
#include "shared/problems/OrszagTangParams.h"
2021

2122
// kokkos random numbers
2223
#include <Kokkos_Random.hpp>
@@ -269,15 +270,17 @@ class InitOrszagTangFunctor3D : public MHDBaseFunctor3D {
269270

270271
public:
271272
InitOrszagTangFunctor3D(HydroParams params,
272-
DataArray3d Udata) :
273-
MHDBaseFunctor3D(params), Udata(Udata) {};
273+
OrszagTangParams otParams,
274+
DataArray3d Udata) :
275+
MHDBaseFunctor3D(params), otParams(otParams), Udata(Udata) {};
274276

275277
// static method which does it all: create and execute functor
276278
static void apply(HydroParams params,
279+
OrszagTangParams otParams,
277280
DataArray3d Udata,
278281
int nbCells)
279282
{
280-
InitOrszagTangFunctor3D functor(params, Udata);
283+
InitOrszagTangFunctor3D functor(params, otParams, Udata);
281284

282285
functor.phase = INIT_ALL_VAR_BUT_ENERGY;
283286
Kokkos::parallel_for(nbCells, functor);
@@ -325,6 +328,7 @@ class InitOrszagTangFunctor3D : public MHDBaseFunctor3D {
325328
const real_t xmin = params.xmin;
326329
const real_t ymin = params.ymin;
327330
const real_t zmin = params.zmin;
331+
const real_t zmax = params.zmax;
328332
UNUSED(zmin);
329333

330334
const double dx = params.dx;
@@ -339,13 +343,14 @@ class InitOrszagTangFunctor3D : public MHDBaseFunctor3D {
339343
const double p0 = gamma0/(2.0*TwoPi);
340344
const double d0 = gamma0*p0;
341345
const double v0 = 1.0;
346+
const double kt = otParams.kt;
342347

343348
int i,j,k;
344349
index2coord(index,i,j,k,isize,jsize,ksize);
345350

346351
double xPos = xmin + dx/2 + (i+nx*i_mpi-ghostWidth)*dx;
347352
double yPos = ymin + dy/2 + (j+ny*j_mpi-ghostWidth)*dy;
348-
//double zPos = zmin + dz/2 + (k+nz*k_mpi-ghostWidth)*dz;
353+
double zPos = zmin + dz/2 + (k+nz*k_mpi-ghostWidth)*dz;
349354

350355
// density
351356
Udata(i,j,k,ID) = d0;
@@ -360,8 +365,8 @@ class InitOrszagTangFunctor3D : public MHDBaseFunctor3D {
360365
Udata(i,j,k,IW) = ZERO_F;
361366

362367
// bx, by, bz
363-
Udata(i,j,k, IBX) = -B0*sin( yPos*TwoPi);
364-
Udata(i,j,k, IBY) = B0*sin(2.0*xPos*TwoPi);
368+
Udata(i,j,k, IBX) = -B0*cos(2*TwoPi*kt*(zPos-zmin)/(zmax-zmin))*sin( yPos*TwoPi);
369+
Udata(i,j,k, IBY) = B0*cos(2*TwoPi*kt*(zPos-zmin)/(zmax-zmin))*sin(2.0*xPos*TwoPi);
365370
Udata(i,j,k, IBZ) = 0.0;
366371

367372
} // init_all_var_but_energy
@@ -402,8 +407,9 @@ class InitOrszagTangFunctor3D : public MHDBaseFunctor3D {
402407

403408
} // init_energy
404409

410+
OrszagTangParams otParams;
405411
DataArray3d Udata;
406-
PhaseType phase ;
412+
PhaseType phase;
407413

408414
}; // InitOrszagTangFunctor3D
409415

src/muscl/SolverMHDMuscl.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,14 +388,16 @@ void SolverMHDMuscl<dim>::init_blast(DataArray Udata)
388388
template<int dim>
389389
void SolverMHDMuscl<dim>::init_orszag_tang(DataArray Udata)
390390
{
391+
392+
OrszagTangParams otParams = OrszagTangParams(configMap);
391393

392394
// alias to actual device functor
393395
using InitOrszagTangFunctor =
394396
typename std::conditional<dim==2,
395397
InitOrszagTangFunctor2D,
396398
InitOrszagTangFunctor3D>::type;
397399

398-
InitOrszagTangFunctor::apply(params, Udata, nbCells);
400+
InitOrszagTangFunctor::apply(params, otParams, Udata, nbCells);
399401

400402
} // init_orszag_tang
401403

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#ifndef ORSZAG_TANG_PARAMS_H_
2+
#define ORSZAG_TANG_PARAMS_H_
3+
4+
#include <math.h>
5+
6+
#include "utils/config/ConfigMap.h"
7+
8+
9+
struct OrszagTangParams {
10+
11+
// transverse wave vector
12+
real_t kt;
13+
14+
OrszagTangParams(ConfigMap& configMap)
15+
{
16+
17+
kt = configMap.getFloat ("OrszagTang", "kt", 0.0);
18+
19+
}
20+
21+
}; // struct OrszagTangParams
22+
23+
#endif // ORSZAG_TANG_PARAMS_H_

0 commit comments

Comments
 (0)