use initial pressure and temperature as default in bc dirichlet

This commit is contained in:
Tor Harald Sandve 2022-11-04 12:10:06 +01:00
parent 75b78bf659
commit 17d0ccee83
2 changed files with 13 additions and 9 deletions

View File

@ -59,8 +59,8 @@ public:
FaceDir::DirEnum dir;
BCComponent component;
double rate;
double pressure;
double temperature;
std::optional<double> pressure;
std::optional<double> temperature;
BCFace() = default;
explicit BCFace(const DeckRecord& record, const GridDims& grid);

View File

@ -67,6 +67,7 @@ BCComponent component(const std::string& s) {
}
}
using BC = ParserKeywords::BC;
BCConfig::BCFace::BCFace(const DeckRecord& record, const GridDims& grid) :
i1(0),
i2(grid.getNX() - 1),
@ -74,14 +75,17 @@ BCConfig::BCFace::BCFace(const DeckRecord& record, const GridDims& grid) :
j2(grid.getNY() - 1),
k1(0),
k2(grid.getNZ() - 1),
bctype(fromstring::bctype(record.getItem("TYPE").get<std::string>(0))),
dir(FaceDir::FromString(record.getItem("DIRECTION").get<std::string>(0))),
component(fromstring::component(record.getItem("COMPONENT").get<std::string>(0))),
rate(record.getItem("RATE").getSIDouble(0)),
pressure(record.getItem("PRESSURE").getSIDouble(0)),
temperature(record.getItem("TEMPERATURE").getSIDouble(0))
bctype(fromstring::bctype(record.getItem<BC::TYPE>().get<std::string>(0))),
dir(FaceDir::FromString(record.getItem<BC::DIRECTION>().get<std::string>(0))),
component(fromstring::component(record.getItem<BC::COMPONENT>().get<std::string>(0))),
rate(record.getItem<BC::RATE>().getSIDouble(0))
{
using BC = ParserKeywords::BC;
if (const auto& P = record.getItem<BC::PRESSURE>(); ! P.defaultApplied(0)) {
pressure = P.getSIDouble(0);
}
if (const auto& T = record.getItem<BC::TEMPERATURE>(); ! T.defaultApplied(0)) {
temperature = T.getSIDouble(0);
}
if (const auto& I1 = record.getItem<BC::I1>(); ! I1.defaultApplied(0)) {
this->i1 = I1.get<int>(0) - 1;
}