Skip to content

Commit

Permalink
small changes to the new HS solver (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhixchen authored Jun 30, 2023
1 parent c451018 commit 45e14b7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 29 deletions.
11 changes: 5 additions & 6 deletions applications/solvers/dfHighSpeedFoam/createFields.H
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ if (mesh.schemesDict().readIfPresent("timeScheme", ddtSchemes))
}
}

word chemScheme("RR");
word chemScheme("ode");
mesh.schemesDict().readIfPresent("chemScheme", chemScheme);

if ((chemScheme == "wrate") || (chemScheme == "RR"))
if ((chemScheme == "direct") || (chemScheme == "ode"))
{
Info<< "chemScheme: " << chemScheme << endl;
}
Expand All @@ -21,24 +21,23 @@ else
FatalErrorInFunction
<< "chemScheme: " << chemScheme
<< " is not a valid choice. "
<< "Options are: wrate, RR"
<< "Options are: 'ode' | 'direct'"
<< abort(FatalError);
}


if((ddtSchemes != "RK2SSP") && (ddtSchemes != "RK3SSP"))
{
if(chemScheme == "wrate")
if(chemScheme == "direct")
{
FatalErrorInFunction
<< "This combination is not a valid choice. "
<< "If you want to use wrate for chemistry, please use RK2SSP or RK3SSP scheme."
<< "If you want to use direct integrate for chemistry, please use RK2SSP or RK3SSP scheme."
<< abort(FatalError);
}
}



Info<< "Reading thermophysical properties\n" << endl;

// psiThermo* pThermo = new hePsiThermo<psiThermo, CanteraMixture>(mesh, word::null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,22 @@ forAll(rhoYi_save,i)
);
}

List<scalar> rkcoe1(3);
List<scalar> rkcoe2(3);
List<scalar> rkcoe3(3);
scalar rk=2;
label nrk=0;

if(ddtSchemes == "RK2SSP")
{
rkcoe1[0]=1.0; rkcoe2[0]=0.0; rkcoe3[0]=1.0;
rkcoe1[1]=0.5; rkcoe2[1]=0.5; rkcoe3[1]=0.5;
rkcoe1[2]=0.0; rkcoe2[2]=0.0; rkcoe3[2]=0.0;
}
else if(ddtSchemes == "RK3SSP")
{
rkcoe1[0]=1.0; rkcoe2[0]=0.0; rkcoe3[0]=1.0;
rkcoe1[1]=0.75; rkcoe2[1]=0.25; rkcoe3[1]=0.25;
rkcoe1[2]=0.33; rkcoe2[2]=0.66; rkcoe3[2]=0.66;
rk=3;
}
23 changes: 1 addition & 22 deletions applications/solvers/dfHighSpeedFoam/dfHighSpeedFoam.C
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ int main(int argc, char *argv[])
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "createFields.H"
#include "createFields_rk2.H"
#include "createFieldsSave.H"
#include "createTimeControls.H"

double time_monitor_flow=0;
Expand All @@ -98,27 +98,6 @@ int main(int argc, char *argv[])
scalar CoNum = 0.0;
scalar meanCoNum = 0.0;

std::vector<double> rkcoe1(3);
std::vector<double> rkcoe2(3);
std::vector<double> rkcoe3(3);
scalar rk;
label nrk=0;

if(ddtSchemes == "RK2SSP")
{
rkcoe1[0]=1.0; rkcoe2[0]=0.0; rkcoe3[0]=1.0;
rkcoe1[1]=0.5; rkcoe2[1]=0.5; rkcoe3[1]=0.5;
rkcoe1[2]=0.0; rkcoe2[2]=0.0; rkcoe3[2]=0.0;
rk=2;
}
else if(ddtSchemes == "RK3SSP")
{
rkcoe1[0]=1.0; rkcoe2[0]=0.0; rkcoe3[0]=1.0;
rkcoe1[1]=0.75; rkcoe2[1]=0.25; rkcoe3[1]=0.25;
rkcoe1[2]=0.33; rkcoe2[2]=0.66; rkcoe3[2]=0.66;
rk=3;
}

Info<< "\nStarting time loop\n" << endl;

while (runTime.run())
Expand Down
2 changes: 1 addition & 1 deletion examples/dfHighSpeedFoam/twoD_detonationH2/Allrun
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ cp -r 0_orig/ 0/
runApplication blockMesh
runApplication setFields
runApplication decomposePar
runApplication mpirun -np 4 $application -parallel
runApplication mpirun -np 4 --allow-run-as-root $application -parallel

0 comments on commit 45e14b7

Please sign in to comment.