-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- use globalIds from nek - add multiplicity cross-check - add ktauChannel example - add ktau RANS model - add variable viscocity term to pressure rhs (but no stress ellipticOperator)
- Loading branch information
Showing
31 changed files
with
1,201 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@kernel void cfill(const dlong Ntotal, | ||
const dlong offset, | ||
const dfloat CONST, | ||
@restrict dfloat * NU) | ||
{ | ||
for(dlong n=0;n<Ntotal;++n;@tile(256,@outer,@inner)){ | ||
if(n<Ntotal){ | ||
const dlong id = n + offset; | ||
NU[id] = CONST; | ||
} | ||
} | ||
} | ||
|
||
void cdsDirichletConditions3D(bcData *bc) | ||
{ | ||
bc->sP = 0; | ||
if(bc->scalarId == 0) bc->sP = 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[OCCA] | ||
backend = CUDA | ||
deviceNumber = LOCAL-RANK | ||
|
||
[GENERAL] | ||
polynomialOrder = 7 | ||
#startFrom = r.fld+time=0 | ||
stopAt = endTime | ||
endTime = 500 | ||
dt = 2e-02 | ||
timeStepper = tombo2 | ||
|
||
writeControl = runTime | ||
writeInterval = 50 | ||
|
||
[PRESSURE] | ||
preconditioner = semg_amg | ||
residualTol = 1e-04 | ||
|
||
[VELOCITY] | ||
boundaryTypeMap = wall, slipY | ||
residualTol = 1e-06 | ||
density = 1.0 | ||
viscosity = -43500. | ||
|
||
[TEMPERATURE] | ||
#solver = none | ||
boundaryTypeMap = inlet, insulated | ||
residualTol = 1e-06 | ||
rhoCp = 1.0 | ||
conductivity = -43500. | ||
|
||
[SCALAR01] # k | ||
boundaryTypeMap = inlet, insulated | ||
residualTol = 1e-06 | ||
rho = 1.0 | ||
diffusivity = -43500. | ||
|
||
[SCALAR02] # tau | ||
boundaryTypeMap = inlet, insulated | ||
residualTol = 1e-06 | ||
rho = 1.0 | ||
diffusivity = -43500. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// | ||
// nekRS User Defined File | ||
// | ||
#include <math.h> | ||
#include "udf.hpp" | ||
#include "plugins/RANSktau.hpp" | ||
|
||
/* User Functions */ | ||
|
||
static dfloat rho, mueLam; | ||
occa::kernel userfKernel; | ||
|
||
void userf(ins_t *ins, dfloat time, occa::memory o_U, occa::memory o_FU) | ||
{ | ||
const dfloat Re_tau = 2000.0; | ||
const dfloat Re_b = rho/mueLam; | ||
const dfloat DPDX = (Re_tau/Re_b)*(Re_tau/Re_b); | ||
userfKernel(ins->Nlocal, 0*ins->fieldOffset, DPDX, o_FU); | ||
} | ||
|
||
void userq(ins_t *ins, dfloat time, occa::memory o_S, occa::memory o_FS) | ||
{ | ||
mesh_t *mesh = ins->mesh; | ||
cds_t *cds = ins->cds; | ||
|
||
RANSktau::updateSourceTerms(); | ||
} | ||
|
||
void uservp(ins_t *ins, dfloat time, occa::memory o_U, occa::memory o_S, | ||
occa::memory o_UProp, occa::memory o_SProp) | ||
{ | ||
mesh_t *mesh = ins->mesh; | ||
cds_t *cds = ins->cds; | ||
|
||
RANSktau::updateProperties(); | ||
|
||
dfloat conductivity; | ||
ins->options.getArgs("SCALAR00 DIFFUSIVITY", conductivity); | ||
const dfloat Pr_t = 0.7; | ||
occa::memory o_mue_t = RANSktau::o_mue_t(); | ||
occa::memory o_temp_mue = cds->o_diff + 0*cds->fieldOffset*sizeof(dfloat); | ||
ins->scalarScaledAddKernel(ins->Nlocal, mueLam, 1/Pr_t, o_mue_t, o_temp_mue); | ||
} | ||
|
||
void UDF_LoadKernels(ins_t *ins) | ||
{ | ||
userfKernel = udfBuildKernel(ins, "cfill"); | ||
RANSktau::buildKernel(ins); | ||
} | ||
|
||
void UDF_Setup(ins_t *ins) | ||
{ | ||
mesh_t *mesh = ins->mesh; | ||
cds_t *cds = ins->cds; | ||
|
||
// get IC from nek | ||
if (!ins->readRestartFile) nek_copyTo(ins->startTime); | ||
|
||
udf.properties = &uservp; | ||
udf.uEqnSource = &userf; | ||
udf.sEqnSource = &userq; | ||
|
||
const int scalarFieldStart = 1; | ||
ins->options.getArgs("VISCOSITY", mueLam); | ||
ins->options.getArgs("DENSITY", rho); | ||
RANSktau::setup(ins, mueLam, rho, scalarFieldStart); | ||
} | ||
|
||
void UDF_ExecuteStep(ins_t *ins, dfloat time, int tstep) | ||
{ | ||
if (ins->isOutputStep) { | ||
nek_ocopyFrom(time, tstep); | ||
nek_userchk(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
C | ||
C USER SPECIFIED ROUTINES: | ||
C | ||
C - boundary conditions | ||
C - initial conditions | ||
C - variable properties | ||
C - forcing function for fluid (f) | ||
C - forcing function for passive scalar (q) | ||
C - general purpose routine for checking errors etc. | ||
C | ||
c----------------------------------------------------------------------- | ||
subroutine useric (ix,iy,iz,ieg) | ||
include 'SIZE' | ||
include 'TOTAL' | ||
include 'NEKUSE' | ||
|
||
real kmax | ||
|
||
Re = 1/param(2) | ||
kmax = 3.9201E-03 | ||
omax = 0.5 | ||
|
||
ux = 1.0 | ||
uy = 0.0 | ||
uz = 0.0 | ||
|
||
yd = 1 + y | ||
tau = 0.0 | ||
if(yd.ne.0) then | ||
omeg = omax + 6./Re/0.075/yd**2 | ||
tau = 1/omeg | ||
endif | ||
|
||
if (ifield.eq.2) then | ||
temp = 1.0 | ||
elseif (ifield.eq.3) then | ||
temp = kmax | ||
elseif (ifield.eq.4) then | ||
temp = tau | ||
endif | ||
|
||
return | ||
end | ||
c----------------------------------------------------------------------- | ||
subroutine userchk | ||
include 'SIZE' | ||
include 'TOTAL' | ||
|
||
c ubar = glsc2(vx,bm1,nx1*ny1*nz1*nelt)/volvm1 | ||
c if (nid.eq.0) write(6,*) 'ubar=', ubar | ||
|
||
return | ||
end | ||
c----------------------------------------------------------------------- | ||
subroutine usrdat ! This routine to modify element vertices | ||
include 'SIZE' ! _before_ mesh is generated, which | ||
include 'TOTAL' ! guarantees GLL mapping of mesh. | ||
|
||
return | ||
end | ||
c----------------------------------------------------------------------- | ||
subroutine usrdat2() ! This routine to modify mesh coordinates | ||
include 'SIZE' | ||
include 'TOTAL' | ||
|
||
parameter(BETAM = 1.8) | ||
|
||
call rescale_x(xm1, 0.0,8.0) | ||
call rescale_x(ym1,-1.0,0.0) | ||
call rescale_x(zm1, 0.0,1.0) | ||
|
||
ntot = nx1*ny1*nz1*nelt | ||
|
||
do i=1,ntot | ||
ym1(i,1,1,1) = tanh(BETAM*ym1(i,1,1,1))/tanh(BETAM) | ||
enddo | ||
|
||
do iel=1,nelt | ||
cbc(5,iel,1) = 'P ' | ||
cbc(6,iel,1) = 'P ' | ||
do ifc=1,2*ndim | ||
cbc(ifc,iel,2) = cbc(ifc,iel,1) | ||
if (cbc(ifc,iel,1) .eq. 'W ') cbc(ifc,iel,2) = 't ' | ||
if (cbc(ifc,iel,1) .eq. 'SYM') cbc(ifc,iel,2) = 'I ' | ||
if (cbc(ifc,iel,1) .eq. 'W ') boundaryID(ifc,iel) = 1 | ||
if (cbc(ifc,iel,1) .eq. 'SYM') boundaryID(ifc,iel) = 2 | ||
enddo | ||
enddo | ||
|
||
return | ||
end | ||
c----------------------------------------------------------------------- | ||
subroutine usrdat3 | ||
include 'SIZE' | ||
include 'TOTAL' | ||
|
||
return | ||
end | ||
c----------------------------------------------------------------------- | ||
subroutine usrsetvert(glo_num,nel,nx,ny,nz) ! to modify glo_num | ||
integer*8 glo_num(1) | ||
|
||
! kludge for periodic bc in z | ||
nxy = nx*ny | ||
nxyz = nx*ny*nz | ||
do iel = 1,nel | ||
ioff = nxyz*(iel-1) | ||
do ixy = 1,nxy | ||
glo_num(ioff + nxy*(nz-1) + ixy) = glo_num(ioff + ixy) | ||
enddo | ||
enddo | ||
|
||
return | ||
end | ||
c----------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
base.rea | ||
-3 spatial dimension ( < 0 --> generate .rea/.re2 pair) | ||
1 number of fields | ||
#======================================================================= | ||
# | ||
# Example of .box file for Taylor-Green | ||
# | ||
# If nelx (y or z) < 0, then genbox automatically generates the | ||
# grid spacing in the x (y or z) direction | ||
# with a geometric ratio given by "ratio". | ||
# ( ratio=1 implies uniform spacing ) | ||
# | ||
# Note that the character bcs _must_ have 3 spaces. | ||
# | ||
#======================================================================= | ||
# | ||
Box | ||
-5 -12 -1 nelx,nely,nelz for Box | ||
0 8 1. x0,x1,gain (rescaled in usrdat) | ||
0 1 1. y0,y1,gain (rescaled in usrdat) | ||
0 1 1. z0,z1,gain | ||
P ,P ,W ,SYM,E ,E bc's (3 chars each!) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.