Commit be0aa800 authored by Stefan's avatar Stefan
Browse files

Add fixes for

- abort in build-only mode if udf failed to compile
- use correct diffusivity in k-tau example
- default initial guess method for scalars
parent e48d7dc8
......@@ -39,7 +39,7 @@ void uservp(nrs_t *nrs, dfloat time, occa::memory o_U, occa::memory o_S,
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);
nrs->scalarScaledAddKernel(nrs->Nlocal, mueLam, 1/Pr_t, o_mue_t, o_temp_mue);
nrs->scalarScaledAddKernel(nrs->Nlocal, conductivity, 1/Pr_t, o_mue_t, o_temp_mue);
}
void UDF_LoadKernels(nrs_t *nrs)
......
......@@ -58,7 +58,10 @@ occa::memory cdsSolve(const int is, cds_t* cds, dfloat time)
*(cds->o_usrwrk),
cds->o_wrk1);
if(cds->options[is].compareArgs("SCALAR INITIAL GUESS DEFAULT", "EXTRAPOLATION")) {
std::stringstream ss;
ss << std::setfill('0') << std::setw(2) << is;
string sid = ss.str();
if(cds->options[is].compareArgs("SCALAR" + sid + " INITIAL GUESS DEFAULT", "EXTRAPOLATION")) {
cds->o_wrk0.copyFrom(cds->o_Se, cds->Ntotal * sizeof(dfloat), 0, is * cds->fieldOffset * sizeof(dfloat));
if (solver->Nmasked) cds->maskCopyKernel(solver->Nmasked, 0, solver->o_maskIds, cds->o_wrk2, cds->o_wrk0);
}
......
......@@ -89,9 +89,6 @@ void setDefaultSettings(setupAide &options, string casename, int rank)
options.setArgs("PRESSURE RESIDUAL PROJECTION VECTORS", "8");
options.setArgs("PRESSURE RESIDUAL PROJECTION START", "5");
options.setArgs("SCALAR INITIAL GUESS DEFAULT","EXTRAPOLATION");
options.setArgs("VELOCITY INITIAL GUESS DEFAULT","EXTRAPOLATION");
//options.setArgs("PRESSURE PARALMOND CHEBYSHEV DEGREE", "2");
//options.setArgs("PRESSURE PARALMOND SMOOTHER", "CHEBYSHEV");
//options.setArgs("PRESSURE PARALMOND PARTITION", "STRONGNODES");
......@@ -463,6 +460,7 @@ setupAide parRead(void *ppar, std::string setupFile, MPI_Comm comm)
options.setArgs("BOOMERAMG NONGALERKIN TOLERANCE", to_string_f(nonGalerkinTol));
}
options.setArgs("VELOCITY INITIAL GUESS DEFAULT","EXTRAPOLATION");
string vsolver;
int flow = 1;
bool v_rproj;
......@@ -539,13 +537,14 @@ setupAide parRead(void *ppar, std::string setupFile, MPI_Comm comm)
if(solver == "none") {
options.setArgs("SCALAR00 SOLVER", "NONE");
} else {
options.setArgs("SCALAR INITIAL GUESS DEFAULT","PREVIOUS STEP");
options.setArgs("SCALAR00 INITIAL GUESS DEFAULT", "EXTRAPOLATION");
options.setArgs("SCALAR00 PRECONDITIONER", "JACOBI");
bool t_rproj;
if(par->extract("temperature", "residualproj", t_rproj) ||
par->extract("temperature", "residualprojection", t_rproj)) {
if(t_rproj) {
options.setArgs("SCALAR00 RESIDUAL PROJECTION", "TRUE");
options.setArgs("SCALAR00 INITIAL GUESS DEFAULT", "PREVIOUS STEP");
options.setArgs("SCALAR00 RESIDUAL PROJECTION VECTORS", "8");
options.setArgs("SCALAR00 RESIDUAL PROJECTION START", "5");
} else {
......@@ -616,12 +615,14 @@ setupAide parRead(void *ppar, std::string setupFile, MPI_Comm comm)
options.setArgs("SCALAR" + sid + " SOLVER", "NONE");
continue;
}
options.setArgs("SCALAR" + sid + " INITIAL GUESS DEFAULT", "EXTRAPOLATION");
bool t_rproj;
if(par->extract("scalar" + sidPar, "residualproj", t_rproj) ||
par->extract("scalar" + sidPar, "residualprojection", t_rproj)) {
if(t_rproj) {
options.setArgs("SCALAR" + sid + " RESIDUAL PROJECTION", "TRUE");
options.setArgs("SCALAR INITIAL GUESS DEFAULT","PREVIOUS STEP");
options.setArgs("SCALAR" + sid + " INITIAL GUESS DEFAULT","PREVIOUS STEP");
options.setArgs("SCALAR" + sid + " RESIDUAL PROJECTION VECTORS", "8");
options.setArgs("SCALAR" + sid + " RESIDUAL PROJECTION START", "5");
} else {
......
......@@ -263,7 +263,10 @@ static void dryRun(setupAide &options, int npTarget)
string udfFile;
options.getArgs("UDF FILE", udfFile);
if (!udfFile.empty()) {
udfBuild(udfFile.c_str());
int err = 0;
if(rank == 0) err = udfBuild(udfFile.c_str());
MPI_Allreduce(MPI_IN_PLACE, &err, 1, MPI_INT, MPI_SUM, comm);
if(err) ABORT(EXIT_FAILURE);;
MPI_Barrier(comm);
*(void**)(&udf.loadKernels) = udfLoadFunction("UDF_LoadKernels",0);
*(void**)(&udf.setup0) = udfLoadFunction("UDF_Setup0",0);
......
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