Skip to content
Snippets Groups Projects
Commit adcc2658 authored by Tom Fischer's avatar Tom Fischer Committed by Dmitri Naumov
Browse files

[PL] Move balance calculation to class Balance.

parent c0d6f47f
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,8 @@
// TODO used for output, if output classes are ready this has to be changed
#include "MeshLib/IO/writeMeshToFile.h"
#include "ProcessLib/CalculateSurfaceFlux/CalculateSurfaceFlux.h"
namespace ProcessLib
{
struct Balance
......@@ -44,6 +46,26 @@ struct Balance
output_mesh_file_name.c_str());
}
void integrate(GlobalVector const& x, double const t, Process const& p,
int const process_id, int const integration_order,
MeshLib::Mesh const& bulk_mesh)
{
auto* const balance_pv = MeshLib::getOrCreateMeshProperty<double>(
surface_mesh, property_vector_name, MeshLib::MeshItemType::Cell, 1);
// initialise the PropertyVector pv with zero values
std::fill(balance_pv->begin(), balance_pv->end(), 0.0);
auto balance = ProcessLib::CalculateSurfaceFlux(
surface_mesh,
p.getProcessVariables(process_id)[0].get().getNumberOfComponents(),
integration_order);
balance.integrate(
x, *balance_pv, t, bulk_mesh,
[&p](std::size_t const element_id, MathLib::Point3d const& pnt,
double const t, GlobalVector const& x) {
return p.getFlux(element_id, pnt, t, x);
});
}
void save(double const t) const
{
// TODO (TomFischer) output, if output classes are ready this has to be
......
......@@ -14,7 +14,6 @@
#include "NumLib/DOF/DOFTableUtil.h"
#include "NumLib/DOF/LocalToGlobalIndexMap.h"
#include "ProcessLib/CalculateSurfaceFlux/CalculateSurfaceFlux.h"
#include "ProcessLib/Utils/CreateLocalAssemblers.h"
#include "HTMaterialProperties.h"
......@@ -272,23 +271,7 @@ void HTProcess::postTimestepConcreteProcess(GlobalVector const& x,
{
return;
}
auto* const balance_pv = MeshLib::getOrCreateMeshProperty<double>(
_balance->surface_mesh, _balance->property_vector_name,
MeshLib::MeshItemType::Cell, 1);
// initialise the PropertyVector pv with zero values
std::fill(balance_pv->begin(), balance_pv->end(), 0.0);
auto balance = ProcessLib::CalculateSurfaceFlux(
_balance->surface_mesh,
getProcessVariables(process_id)[0].get().getNumberOfComponents(),
_integration_order);
balance.integrate(
x, *balance_pv, t, _mesh,
[this](std::size_t const element_id, MathLib::Point3d const& pnt,
double const t, GlobalVector const& x) {
return getFlux(element_id, pnt, t, x);
});
// post: surface_mesh has scalar element property
_balance->integrate(x, t, *this, process_id, _integration_order, _mesh);
_balance->save(t);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment