Select Git revision
-
Stéphane Del Pino authored
- re-plugged sets of read references for gmsh reader - removed node lists from RefFaceList
Stéphane Del Pino authored- re-plugged sets of read references for gmsh reader - removed node lists from RefFaceList
HyperelasticSolver.cpp 30.81 KiB
#include <scheme/HyperelasticSolver.hpp>
#include <language/utils/InterpolateItemValue.hpp>
#include <mesh/ItemValueUtils.hpp>
#include <mesh/ItemValueVariant.hpp>
#include <mesh/MeshFaceBoundary.hpp>
#include <mesh/MeshFlatNodeBoundary.hpp>
#include <mesh/MeshNodeBoundary.hpp>
#include <mesh/SubItemValuePerItemVariant.hpp>
#include <scheme/DirichletBoundaryConditionDescriptor.hpp>
#include <scheme/DiscreteFunctionP0.hpp>
#include <scheme/DiscreteFunctionUtils.hpp>
#include <scheme/ExternalBoundaryConditionDescriptor.hpp>
#include <scheme/FixedBoundaryConditionDescriptor.hpp>
#include <scheme/IBoundaryConditionDescriptor.hpp>
#include <scheme/IDiscreteFunction.hpp>
#include <scheme/IDiscreteFunctionDescriptor.hpp>
#include <scheme/SymmetryBoundaryConditionDescriptor.hpp>
#include <utils/Socket.hpp>
#include <variant>
#include <vector>
template <size_t Dimension>
double
hyperelastic_dt(const DiscreteFunctionP0<Dimension, double>& c)
{
const Mesh<Connectivity<Dimension>>& mesh = dynamic_cast<const Mesh<Connectivity<Dimension>>&>(*c.mesh());
const auto Vj = MeshDataManager::instance().getMeshData(mesh).Vj();
const auto Sj = MeshDataManager::instance().getMeshData(mesh).sumOverRLjr();
CellValue<double> local_dt{mesh.connectivity()};
parallel_for(
mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { local_dt[j] = 2 * Vj[j] / (Sj[j] * c[j]); });
return min(local_dt);
}
double
hyperelastic_dt(const std::shared_ptr<const IDiscreteFunction>& c)
{
if ((c->descriptor().type() != DiscreteFunctionType::P0) or (c->dataType() != ASTNodeDataType::double_t)) {
throw NormalError("invalid discrete function type");
}
std::shared_ptr mesh = c->mesh();
switch (mesh->dimension()) {
case 1: {
return hyperelastic_dt(dynamic_cast<const DiscreteFunctionP0<1, double>&>(*c));
}
case 2: {
return hyperelastic_dt(dynamic_cast<const DiscreteFunctionP0<2, double>&>(*c));
}
case 3: {
return hyperelastic_dt(dynamic_cast<const DiscreteFunctionP0<3, double>&>(*c));
}
default: {
throw UnexpectedError("invalid mesh dimension");
}
}
}
template <size_t Dimension>
class HyperelasticSolverHandler::HyperelasticSolver final : public HyperelasticSolverHandler::IHyperelasticSolver
{
private:
using Rdxd = TinyMatrix<Dimension>;
using Rd = TinyVector<Dimension>;