Skip to content

Commit

Permalink
Add struct variable to cds solver to inform it that temperature is on…
Browse files Browse the repository at this point in the history
…e of the passive scalars. Refs Nek5000#170
  • Loading branch information
aprilnovak committed Nov 16, 2020
1 parent f9b58ee commit e907bd1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/cds.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ typedef struct
int NVfields; // Number of velocity fields
int NSfields; // Number of scalar fields

// Whether one of the scalars represents temperature; if temperature is a passive
// scalar, then temperature is the first passive scalar
bool temperature_solution;

setupAide options;

oogs_t *gsh, *gshT;
Expand Down
3 changes: 3 additions & 0 deletions src/core/parReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ libParanumal::setupAide parRead(std::string &setupFile, MPI_Comm comm)
int nscal = 0;
int isStart = 0;
if(ini.sections.count("temperature")) {
options.setArgs("TEMPERATURE_SOLUTION", "TRUE");
nscal++;
isStart++;

Expand Down Expand Up @@ -581,6 +582,8 @@ libParanumal::setupAide parRead(std::string &setupFile, MPI_Comm comm)
}
}
}
else
options.setArgs("TEMPERATURE_SOLUTION", "FALSE");

//
for (auto & sec : ini.sections) {
Expand Down
17 changes: 17 additions & 0 deletions src/nekrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ void setup(MPI_Comm comm_in, int buildOnly, int sizeTarget,
// init solver
ins = insSetup(comm, device, options, buildOnly);

// tell the cds solver whether one of the passive scalars represents temperature
if (ins->Nscalar) {
auto temp = options.getArgs("TEMPERATURE_SOLUTION");
ins->cds->temperature_solution = temp == "TRUE" ? true : false;
}

// set initial condition
int readRestartFile;
options.getArgs("RESTART FROM FILE", readRestartFile);
Expand Down Expand Up @@ -221,6 +227,17 @@ void printRuntimeStatistics()
{
timer::printRunStat();
}

const bool hasTemperatureSolution()
{
// if there are scalars, check the convection-diffusion solver for temperature;
// otherwise, a lack of scalars means that there is definitely no temperature
if (ins->Nscalar)
return ins->cds->temperature_solution;
else
return false;
}

} // namespace

static void dryRun(libParanumal::setupAide &options, int npTarget)
Expand Down
1 change: 1 addition & 0 deletions src/nekrs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ void udfExecuteStep(double time, int tstep, int isOutputStep);
void nekOutfld(void);
void nekUserchk(void);
void printRuntimeStatistics(void);
const bool hasTemperatureSolution(void);

const double dt(void);
const int outputStep(void);
Expand Down

0 comments on commit e907bd1

Please sign in to comment.