Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial 2 - Periodic Hill #35

Open
JezSw opened this issue Oct 7, 2024 · 4 comments · May be fixed by #44
Open

Tutorial 2 - Periodic Hill #35

JezSw opened this issue Oct 7, 2024 · 4 comments · May be fixed by #44
Assignees

Comments

@JezSw
Copy link
Owner

JezSw commented Oct 7, 2024

No description provided.

@kzscisoft
Copy link
Collaborator

kzscisoft commented Oct 8, 2024

In order to get the example to run in Nekrs I had to make the following modifications to the .par file:

[GENERAL]
+ polynomialOrder = 7
stopAt = endTime
endTime  = 200
variableDT = yes
- targetCFL = 0.4
+ dt = targetCFL = 0.4 + initial=1e-1
- writeControl = runTime
+ checkpointControl = steps
- writeInterval = 20
+ checkpointInterval = 20
- constFlowRate = X
- meanVelocity = 1.0
+ constFlowRate = meanVelocity=1.0 + direction=X

[PROBLEMTYPE]
- equation = incompNS
+ equation = navierstokes

- [PRESSURE]
- residualTol = 1e-5
- residualProj = yes

[VELOCITY]
residualTol = 1e-8
density = 1
viscosity = -100

For quick runs during testing I temporarily set endTime = 1

Manually set initial dt to 1e-1 else simulation does not work.

Note also removal of Pressure block due to there being no PRESSURE block in par specification in NekRS, hence:

MPI tasks: 1

Aborting in /home/kzarebsk/Documents/UKAEA/NekRS/nekRS/src/core/io/par.cpp:processError

        unknown key: pressure::residualproj


run with `--help par` for more details


Aborting in /home/kzarebsk/Documents/UKAEA/NekRS/nekRS/src/core/io/par.cpp:processError

        unknown key: pressure::residualproj


run with `--help par` for more details


Aborting in /home/kzarebsk/Documents/UKAEA/NekRS/nekRS/src/core/io/par.cpp:processError

        unknown key: pressure::residualproj


run with `--help par` for more details


Aborting in /home/kzarebsk/Documents/UKAEA/NekRS/nekRS/src/core/io/par.cpp:processError

        unknown key: pressure::residualproj


run with `--help par` for more details

@kzscisoft
Copy link
Collaborator

Mapping of variable mesh from Fortran to UDF file:

subroutine usrdat2()
    implicit none
    include 'SIZE'
    include 'TOTAL'
    
    integer ntot,i
    real A,B,C,xx,yy,argx,A1
    
    ntot = lx1*ly1*lz1*nelt
    
    A   = 4.5
    B   = 3.5
    C   = 1./6
    
    do i=1,ntot
       xx   = xm1(i,1,1,1)
       yy   = ym1(i,1,1,1)
       argx = B*(abs(xx-A)-B)
       A1   = C + C*tanh(argx)
       ym1(i,1,1,1) = yy + (3-yy)*A1
    enddo
      
    return
end
void UDF_Setup() {
  auto mesh = nrs->meshV;

  const dfloat A{4.5}, B{3.5}, C{1./6};

  // mesh modification
  for(int i{0}; i < mesh -> Nlocal; ++i) {
    const dfloat argx{B * (std::abs(mesh->x[i] - A) - B)};
    const dfloat A1{C * (1. + std::tanh(argx))};
    mesh->y[i] = mesh->y[i] + A1 * (3. - mesh->y[i]);
  }
}

@kzscisoft
Copy link
Collaborator

kzscisoft commented Oct 8, 2024

Boundary conditions mapping from Fortran to UDF:

subroutine useric(ix,iy,iz,ieg)
      implicit none
      include 'SIZE'
      include 'TOTAL'
      include 'NEKUSE'
      
      integer ix,iy,iz,ieg
      
      ux   = 1.0
      uy   = 0.0
      uz   = 0.0
      temp = 0.0
      
      return
end
#ifdef __okl__

void velocityDirichletConditions(bcData* bc) {
  bc->u = 1.0;
  bc->v = 0.0;
  bc->w = 0.0;
  bc->s = 0.0;
}

#endif

@kzscisoft
Copy link
Collaborator

Need to mention that UDF_ExecuteStep is always required, even if empty:

void UDF_ExecuteStep(double time, int tstep) {}

@JezSw JezSw linked a pull request Oct 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In review
Development

Successfully merging a pull request may close this issue.

3 participants