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

Balance for HT process #2132

Merged
merged 13 commits into from
May 31, 2018
Merged
Prev Previous commit
Next Next commit
[PL] Include time in balance output file name.
  • Loading branch information
TomFischer committed May 30, 2018
commit 1d9aa9a14949880b76736b22c7c41fcb0e53ba26
19 changes: 9 additions & 10 deletions ProcessLib/HT/HTProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,25 +273,24 @@ void HTProcess::postTimestepConcreteProcess(GlobalVector const& x,
}
if (_balance_mesh) // computing the balance is optional
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!_balance_mesh)
{
    return;
}

{
std::vector<double> init_values(_balance_mesh->getNumberOfElements(),
0.0);
MeshLib::addPropertyToMesh(*_balance_mesh, _balance_pv_name,
MeshLib::MeshItemType::Cell, 1, init_values);
auto* const balance_pv = MeshLib::getOrCreateMeshProperty<double>(
*_balance_mesh, _balance_pv_name, MeshLib::MeshItemType::Cell, 1);
// initialise the PropertyVector pv with zero values
std::fill(balance_pv->begin(), balance_pv->end(), 0.0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure here;
If the properties are set, then use NaN for initialization. If the properties are '+='-ed, then setting them 0 is of course necessary.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The properties are '+='-ed.

auto balance = ProcessLib::CalculateSurfaceFlux(
*_balance_mesh,
getProcessVariables(process_id)[0].get().getNumberOfComponents(),
_integration_order);

auto* const balance_pv =
_balance_mesh->getProperties().template getPropertyVector<double>(
_balance_pv_name);

balance.integrate(x, *balance_pv, *this);
// post: surface_mesh has vectorial element property
// post: surface_mesh has scalar element property

// TODO output, if output classes are ready this has to be
// changed
MeshLib::IO::writeMeshToFile(*_balance_mesh, _balance_out_fname);
std::string const fname =
BaseLib::dropFileExtension(_balance_out_fname) + "_t_" +
std::to_string(t) + ".vtu";
MeshLib::IO::writeMeshToFile(*_balance_mesh, fname);
}
}

Expand Down