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
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[PL] Change return type of getFlux().
  • Loading branch information
TomFischer committed May 30, 2018
commit 3f11cb84c0457d703878a0cbcc87b9aadfa5dda3
9 changes: 4 additions & 5 deletions ProcessLib/GroundwaterFlow/GroundwaterFlowFEM.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class LocalAssemblerData : public GroundwaterFlowLocalAssemblerInterface
/// Computes the flux in the point \c p_local_coords that is given in local
/// coordinates using the values from \c local_x.
// TODO add time dependency
std::vector<double> getFlux(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't the flux 2D in two dimentsions?

Eigen::Vector3d getFlux(
MathLib::Point3d const& p_local_coords,
std::vector<double> const& local_x) const override
{
Expand All @@ -123,8 +123,6 @@ class LocalAssemblerData : public GroundwaterFlowLocalAssemblerInterface
// here, which is not affected by axial symmetry.
fe.computeShapeFunctions(p_local_coords.getCoords(), shape_matrices,
GlobalDim, false);
std::vector<double> flux;
flux.resize(3);

// fetch hydraulic conductivity
SpatialPosition pos;
Expand All @@ -133,9 +131,10 @@ class LocalAssemblerData : public GroundwaterFlowLocalAssemblerInterface
double const t = 0.0;
auto const k = _process_data.hydraulic_conductivity(t, pos)[0];

Eigen::Map<Eigen::RowVectorXd>(flux.data(), flux.size()) =
Eigen::Vector3d flux;
flux.head<GlobalDim>() =
-k * shape_matrices.dNdx *
Eigen::Map<const Eigen::VectorXd>(local_x.data(), local_x.size());
Eigen::Map<const NodalVectorType>(local_x.data(), local_x.size());

return flux;
}
Expand Down
2 changes: 1 addition & 1 deletion ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class GroundwaterFlowProcess final : public Process
bool isLinear() const override { return true; }
//! @}

std::vector<double> getFlux(std::size_t element_id,
Eigen::Vector3d getFlux(std::size_t element_id,
MathLib::Point3d const& p,
GlobalVector const& x) const override
{
Expand Down
7 changes: 3 additions & 4 deletions ProcessLib/HT/HTFEM.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class HTFEM : public HTLocalAssemblerInterface
/// Computes the flux in the point \c pnt_local_coords that is given in
/// local coordinates using the values from \c local_x.
// TODO add time dependency
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yep, that would be nice (for the sake of completeness). Could you please add it now?

std::vector<double> getFlux(
Eigen::Vector3d getFlux(
Copy link
Collaborator

Choose a reason for hiding this comment

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

For the HT process the problem is that there are potentially two different interesting fluxes:
The mass/volume flux and the heat flux.
Maybe there should be different names for them?

Copy link
Member

Choose a reason for hiding this comment

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

Or one could pass the variable_id to getFlux?

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right, there are potentially two different interesting fluxes. Maybe other processes have also interesting quantities fluxes. For this reason we would need rather general names. I opened an issue for discussion and for the time being I would keep the implementation of this PR. Is this okay for you?

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK.

MathLib::Point3d const& pnt_local_coords,
std::vector<double> const& local_x) const override
{
Expand Down Expand Up @@ -149,10 +149,9 @@ class HTFEM : public HTLocalAssemblerInterface
auto const b = this->_material_properties.specific_body_force;
q += K_over_mu * rho_w * b;
Copy link
Member

Choose a reason for hiding this comment

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

I'm not getting the intentions of the comment. What is 'downwards'? Maybe it's copied from some other context...

}
std::vector<double> flux;
flux.resize(3);
Eigen::Map<GlobalDimVectorType>(flux.data(), flux.size()) = q;

Eigen::Vector3d flux;
flux.head<GlobalDim>() = q;
return flux;
}

Expand Down
2 changes: 1 addition & 1 deletion ProcessLib/HT/HTLocalAssemblerInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class HTLocalAssemblerInterface : public ProcessLib::LocalAssemblerInterface,
NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
std::vector<double>& /*cache*/) const = 0;

virtual std::vector<double> getFlux(
virtual Eigen::Vector3d getFlux(
MathLib::Point3d const& pnt_local_coords,
std::vector<double> const& local_x) const = 0;

Expand Down
6 changes: 3 additions & 3 deletions ProcessLib/HT/HTProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ void HTProcess::setCoupledSolutionsOfPreviousTimeStep()
}
}

std::vector<double> HTProcess::getFlux(std::size_t element_id,
MathLib::Point3d const& p,
GlobalVector const& x) const
Eigen::Vector3d HTProcess::getFlux(std::size_t element_id,
MathLib::Point3d const& p,
GlobalVector const& x) const
{
// fetch local_x from primary variable
std::vector<GlobalIndexType> indices_cache;
Expand Down
2 changes: 1 addition & 1 deletion ProcessLib/HT/HTProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class HTProcess final : public Process
bool isLinear() const override { return false; }
//! @}

std::vector<double> getFlux(std::size_t element_id,
Eigen::Vector3d getFlux(std::size_t element_id,
MathLib::Point3d const& p,
GlobalVector const& x) const override;

Expand Down
4 changes: 2 additions & 2 deletions ProcessLib/LocalAssemblerInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ class LocalAssemblerInterface

/// Computes the flux in the point \c p_local_coords that is given in local
/// coordinates using the values from \c local_x.
virtual std::vector<double> getFlux(
virtual Eigen::Vector3d getFlux(
MathLib::Point3d const& /*p_local_coords*/,
std::vector<double> const& /*local_x*/) const
{
return std::vector<double>();
return Eigen::Vector3d{};
}

private:
Expand Down
8 changes: 4 additions & 4 deletions ProcessLib/Process.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ class Process

// Used as a call back for CalculateSurfaceFlux process.

virtual std::vector<double> getFlux(std::size_t /*element_id*/,
MathLib::Point3d const& /*p*/,
GlobalVector const& /*x*/) const
virtual Eigen::Vector3d getFlux(std::size_t /*element_id*/,
MathLib::Point3d const& /*p*/,
GlobalVector const& /*x*/) const
{
return std::vector<double>{};
return Eigen::Vector3d{};
}

protected:
Expand Down