GitLab maintenance scheduled form Friday, 2021-06-18 5:00pm to Satursday, 2021-06-19 10:00pm CT - Services will be unavailable during this time.

Commit e3170b45 authored by Elia Merzari's avatar Elia Merzari

Updaing NekRS 11k case

parent 83209d1e
parameter (lsurf_m=1700000)
common /point_cloudx/ pc_x(lsurf_m*4)
common /point_cloudy/ pc_y(lsurf_m*4)
common /point_cloudz/ pc_z(lsurf_m*4)
common /point_cloudt/ pc_t(lsurf_m*4)
common /point_cloudf/ pc_f(lsurf_m*4)
common /ref_element/ pc_flag(lsurf_m*4)
common /tot_surf/ nw_bdt
common /data_reference/ plmask(lelt), pflmask(lelt),
& pplist(lelt), offset, nw_bd1
common /test_passing/ flux_moose, temp_nek
real pc_x, pc_y, pc_z, pc_flag, pc_t, pc_f
integer plmask, pflmask, pllist, offset, nw_bd1, nw_bdt
This diff is collapsed.
// Boundary conditions
/* wall 1, inflow 2, outflow 3, x-slip 4, y-slip 5, z-slip 6 */
void insVelocityDirichletConditions3D(bcData *bc)
void velocityDirichletConditions(bcData *bc)
{
bc->uP = 0.0;
bc->vP = 0.0;
bc->wP = 1.0;
bc->u = 0.0;
bc->v = 0.0;
bc->w = 0.17;
}
void insVelocityNeumannConditions3D(bcData *bc)
void scalarDirichletConditions(bcData *bc)
{
bc->s = 573.0;
}
void cdsDirichletConditions3D(bcData *bc)
void scalarNeumannConditions(bcData *bc)
{
bc->sP = 0.0;
}
void cdsNeumannConditions3D(bcData *bc)
{
bc->sF = 1.0;
bc->flux = bc->wrk[bc->idM];
}
// Stabilized outflow (Dong et al)
void insPressureDirichletConditions3D(bcData *bc)
void pressureDirichletConditions(bcData *bc)
{
const dfloat iU0delta = 10.0;
const dfloat un = bc->uM*bc->nx + bc->vM*bc->ny + bc->wM*bc->nz;
const dfloat s0 = 0.5 * (1.0 - tanh(un*iU0delta));
bc->pP = -0.5 * (bc->uM*bc->uM + bc->vM*bc->vM + bc->wM*bc->wM) * s0;
const dfloat un = bc->u*bc->nx + bc->v*bc->ny + bc->w*bc->nz;
const dfloat s0 = 0.5 * (1.0 - tanh(un*iU0delta));
bc->p = -0.5 * (bc->u*bc->u + bc->v*bc->v + bc->w*bc->w) * s0;
}
......@@ -4,31 +4,35 @@
#include <math.h>
#include "udf.hpp"
#include "cfl.hpp"
int my_iostep=100;
#include <iostream>
/* UDF Functions */
void UDF_LoadKernels(ins_t *ins)
void UDF_LoadKernels(nrs_t *nrs)
{
}
void UDF_Setup(ins_t *ins)
void UDF_Setup(nrs_t *nrs)
{
// get IC from nek
if (!ins->readRestartFile) nek_copyTo(ins->startTime);
nrs->o_usrwrk.free(); free(nrs->usrwrk);
nrs->usrwrk = (dfloat*) calloc(nrs->mesh->Nelements*nrs->mesh->Np, sizeof(dfloat));
nrs->o_usrwrk = nrs->mesh->device.malloc(nrs->mesh->Nelements*nrs->mesh->Np*sizeof(dfloat), nrs->usrwrk);
// nrs->cds->o_usrwrk = nrs->o_usrwrk;
// printf ("> Test %d \n", nrs->mesh->Nelements*nrs->mesh->Np*sizeof(dfloat));
}
void UDF_ExecuteStep(ins_t *ins, dfloat time, int tstep)
void UDF_ExecuteStep(nrs_t *nrs, dfloat time, int tstep)
{
dfloat cfl=computeCFL(ins, time, tstep);
if (ins->isOutputStep || cfl>4.0) {
nek_ocopyFrom(time, tstep);
nek_userchk();
}
if (ins->isOutputStep) {
nek_ocopyFrom(time, tstep);
nek_userchk();
}
nek_userchk();
//std::cout << "Finished userchk" << std::endl;
int nwbdt=nekData.cbscnrs[0];
auto *wrk1 = nekData.cbscnrs;
wrk1 = wrk1 + nwbdt*5*4 + 2;
nrs->o_usrwrk.copyFrom(wrk1,nrs->mesh->Nelements*nrs->mesh->Np*sizeof(dfloat));
//auto *ptr=nekData.cbscnrs;
//nrs->o_usrwrk.copyFrom(wrk, mesh->Nelements*mesh->Np*sizeof(dfloat));
//std::cout << "Finished UDF_ExecuteStep" << std::endl;
}
include 'nek_moose.f'
c-----------------------------------------------------------------------
subroutine uservp(i,j,k,eg) ! set variable properties
include 'SIZE'
......@@ -84,7 +85,7 @@ c-----------------------------------------------------------------------
ux = 0.0
uy = 0.0
uz = 1.0
temp = 0.0
temp = 573.0
return
end
......@@ -92,10 +93,21 @@ c-----------------------------------------------------------------------
subroutine userchk
include 'SIZE'
include 'TOTAL'
include 'NEKMOOSE'
c implicit none
COMMON /SCNRS/ SC_NRS(LX1*LY1*LZ1*LELT*7*5)
real SC_NRS
common /flux_reconstructed/flux_recon(lx1,ly1,lz1,lelt)
integer n_count
save n_count
n=lx1*ly1*lz1*nelt
time=0.0
if (istep.eq.0) then
time=0.0
xxmax = glmax(xm1,n)
yymax = glmax(ym1,n)
zzmax = glmax(zm1,n)
......@@ -108,7 +120,6 @@ c-----------------------------------------------------------------------
18 format(' xyz min ',5g13.5)
19 format(' xyz max ',5g13.5)
endif
ifxyo=.true.
c call outpost(vx,vy,vz,t,pr,' ')
endif
......@@ -146,9 +157,41 @@ c ifpsco(1) = .true.
cc call outpost(vx,vy,vz,pr,t,' ')
c endif
c call comp_Reynolds
if (mod(istep,500).ne.0) then
call compute_cfl(cfl,vx,vy,vz,1.0)
call outpost(cflf,vy,vz,pr,t,'cfl')
n_count=n_count+1
! The first call is at time step zero
if ((1+1+nw_bdt*4*5+n).gt.(7*5*n)) then
if (nid.eq.0) write(6,*) "> Insufficient scratch memory"
call exitt()
endif
if (n_count.gt.2) then
if (mod(n_count,2).eq.1) then
if (nid.eq.0) write(6,*) "> DOWNLOADING FLUX"
do i=1,nw_bdt*4
pc_f(i)=sc_nrs(1+i+nw_bdt*4*4)*1.5*1.5
enddo
flux_moose=sc_nrs(1+1+nw_bdt*4*5)
call flux_reconstruction()
do i=1,n
sc_nrs(1+1+nw_bdt*4*5+i)=flux_recon(i,1,1,1)
enddo
endif
if (mod(n_count,2).eq.0) then
if (nid.eq.0) write(6,*) "> LOADING TEMPERATURE"
tmin=glmin(t,n)
tmax=glmax(t,n)
if (nid.eq.0) then
write(6,*) "> Temperature: ", tmin," - ", tmax
endif
call nek_interpolation()
do i=1,nw_bdt*4
sc_nrs(1+i+nw_bdt*4*3)=pc_t(i)
enddo
endif
endif
return
......@@ -171,13 +214,20 @@ c-----------------------------------------------------------------------
subroutine usrdat2
include 'SIZE'
include 'TOTAL'
integer e,f
include 'NEKMOOSE'
COMMON /SCNRS/ SC_NRS(LX1*LY1*LZ1*LELT*7)
real SC_NRS
common /flux_reconstructed/flux_recon(lx1,ly1,lz1,lelt)
integer f,e
n=lx1*ly1*lz1*nelt
ifheat = .false.
nface = 2*ldim
nface = 6
do e=1,nelv
do f=1,nface
boundaryID(f,e) = 0
if(cbc(f,e,1).eq.'E '.or.cbc(f,e,1).eq.' ')then
cbc(f,e,1)='E '
cbc(f,e,2)='E '
......@@ -203,7 +253,36 @@ c-----------------------------------------------------------------------
enddo
enddo
param(18) = 1 ! use algebraic residual norm
c param(18) = 1 ! use algebraic residual norm
c call setup_topo
call rzero(flux_recon,n)
call nek_pointscloud()
c storing information in common
c parameter (lsurf_m=60000)
c common /point_cloudx/ pc_x(lsurf_m*4)
c common /point_cloudy/ pc_y(lsurf_m*4)
c common /point_cloudz/ pc_z(lsurf_m*4)
c common /point_cloudt/ pc_t(lsurf_m*4)
c common /point_cloudf/ pc_f(lsurf_m*4)
c common /ref_element/ pc_flag(lsurf_m*4)
c common /tot_surf/ nw_bdt
! Units in cm, radius is 1.5 cm
sc_nrs(1)=nw_bdt
do i=1,nw_bdt*4
sc_nrs(1+i)=pc_x(i)*1.5
sc_nrs(1+i+nw_bdt*4)=pc_y(i)*1.5
sc_nrs(1+i+nw_bdt*4*2)=pc_z(i)*1.5
enddo
if (nid.eq.0) then
do i=1,nw_bdt*4
write (6,*)i,pc_x(i),pc_y(i),pc_z(i)
enddo
endif
return
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment