Commit 84312569 authored by uheqb's avatar uheqb
Browse files

fixed failed PrestressTest and edit of CreateFiniteElasticityAssemble

parent 0708c473
Pipeline #219214 failed with stages
in 98 minutes and 10 seconds
......@@ -25,6 +25,23 @@ void MainElasticity::Initialize() {
generateStartVectors();
auto prestress = false;
config.get("WithPrestress", prestress);
if (prestress) {
int degree = 1;
bool isStatic = false;
config.get("MechPolynomialDegree", degree);
auto elasticityModel = elasticityProblem->Model();
StaticPressureProblem prestressPressure(pressureProblem->InitialPressure());
prestressedEla = CreateFiniteElasticityAssemble(*elasticityProblem, prestressPressure,*meshes, degree, isStatic);
IterativePressureSolver prestressSolver(*prestressedEla, prestressPressure);
Vector p(0.0, *displacement);
prestressSolver.Solve(p, prestressSteps);
mechA->InitializePrestress(p);
}
}
Vector &MainElasticity::Run(const Vector &start) {
......@@ -100,17 +117,7 @@ void MainElasticity::initAssemble() {
int degree = 1;
bool isStatic = false;
config.get("MechPolynomialDegree", degree);
mechA = CreateFiniteElasticityAssemble(*elasticityProblem, *pressureProblem, *meshes, degree, isStatic);
auto prestress = false;
config.get("WithPrestress", prestress);
if (prestress) {
StaticPressureProblem prestressPressure(pressureProblem->InitialPressure());
prestressedEla = CreateFiniteElasticityAssemble(*elasticityProblem, prestressPressure, *meshes, degree, isStatic);
IterativePressureSolver prestressSolver(*prestressedEla, prestressPressure);
Vector p(0.0, *displacement);
prestressSolver.Solve(p, prestressSteps);
mechA->InitializePrestress(p);
}
mechA = std::make_unique<LagrangeElasticity>(*elasticityProblem, *pressureProblem, *meshes, degree, isStatic);
}
double MainElasticity::EvaluateQuantity(const Vector &solution, const std::string &quantity) const {
......
......@@ -129,18 +129,9 @@ std::unique_ptr<FiniteElasticity> CreateFiniteElasticityAssemble(
ElasticityProblem &elasticityProblem, PressureProblem &pressureProblem, const Meshes &mesh, int degree, bool isStatic){
auto elasticityModel = elasticityProblem.Model();
if (elasticityModel.empty()) config.get("MechDiscretization", elasticityModel);
if (elasticityModel == "DG") {
return std::make_unique<DGElasticity>(elasticityProblem, pressureProblem, mesh, degree, isStatic);
}
else if (elasticityModel == "EG") {
return std::make_unique<EGElasticity>(elasticityProblem, pressureProblem, mesh, degree, isStatic);
}
else {
return std::make_unique<LagrangeElasticity>(elasticityProblem, pressureProblem, mesh, degree, isStatic);
}
return CreateFiniteElasticityAssemble(elasticityProblem, pressureProblem, elasticityModel, mesh, degree, isStatic);
}
std::unique_ptr<FiniteElasticity> CreateFiniteElasticityAssemble(
ElasticityProblem &elasticityProblem, PressureProblem &pressureProblem, std::string modelName, const Meshes &mesh, int degree, bool isStatic){
if (modelName.empty()) config.get("MechDiscretization", modelName);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment