Skip to content
Snippets Groups Projects
Commit 43461e66 authored by Laura Lindner's avatar Laura Lindner
Browse files

try next iterate of adaptive version

parent effd6379
No related branches found
No related tags found
1 merge request!273fixed hopefully problem with computing displacement by depending mechassamble...
Pipeline #357005 failed
......@@ -272,9 +272,11 @@ bool adaptiveSegregatedSolver::Step(IElphyAssemble &elphyAssemble, IElasticity &
elphyAssemble.ResetTime(mechAssemble.Time(), mechAssemble.LastTStep(), elphyDeltaTime);
double gammaInfNorm=elphyAssemble.InftyNormOnVertices(v_stretch(elphyValues));
vout(2)<<"gammaInfNorm "<<gammaInfNorm<<endl;
int elphyStepCounter=0;
if (gammaInfNorm<=0.00001) {
while (elphyStepCounter != elphySteps && gammaInfNorm <= 0.00001) {
double minGammaInfNorm =0.00001;
if (gammaInfNorm<minGammaInfNorm) {
while (elphyStepCounter != elphySteps && gammaInfNorm < minGammaInfNorm) {
//while (!elphyAssemble.IsFinished()) {
elphySolver->printSolverNameInStep(elphyAssemble, ongoingElphyStep);
elphySolver->Step(elphyAssemble, elphyValues);
......@@ -283,15 +285,31 @@ bool adaptiveSegregatedSolver::Step(IElphyAssemble &elphyAssemble, IElasticity &
ongoingElphyStep += 1;
elphyStepCounter += 1;
}
//}else if(0.0<gammaInfNorm<0.5*maxGammaInfNorm) {
}else if(minGammaInfNorm<=gammaInfNorm && gammaInfNorm<factorMaxGammaInfnorm*maxGammaInfNorm) {
int numberOfInbetweenTimSteps=int(log2(elphySteps))-1;
vout(2)<<" numberOfInbetweenTimSteps "<<numberOfInbetweenTimSteps;
for (int i=0;i<numberOfInbetweenTimSteps;i++){
double leftboundary= (double(i)/double(numberOfInbetweenTimSteps))*factorMaxGammaInfnorm*maxGammaInfNorm+minGammaInfNorm;
double rightboundary= (double(i+1)/double(numberOfInbetweenTimSteps))*factorMaxGammaInfnorm*maxGammaInfNorm;
vout(2)<<" leftboundary "<<leftboundary<<" rightboundary "<<rightboundary;
if ( leftboundary< gammaInfNorm && gammaInfNorm<= rightboundary){
vout(2)<<" i "<<i<<" number steps "<<int(elphySteps/(pow(2,i+1)))<<endl;
while (elphyStepCounter !=int(elphySteps/(pow(2,i+1)))) {
elphySolver->printSolverNameInStep(elphyAssemble, ongoingElphyStep);
elphySolver->Step(elphyAssemble, elphyValues);
ongoingElphyStep += 1;
elphyStepCounter += 1;
}
break;
}
}
}else{
elphySolver->printSolverNameInStep(elphyAssemble, ongoingElphyStep);
elphySolver->Step(elphyAssemble, elphyValues);
ongoingElphyStep += 1;
elphyStepCounter=1;
}
// Projects stretch from elphy to mech
cardiacTransfer->Project(u_stretch(mechValues), v_stretch(elphyValues));
mechAssemble.UpdateStretch(u_stretch(mechValues));
......
......@@ -99,12 +99,17 @@ class adaptiveSegregatedSolver: public SegregatedSolver {
double elphyDeltaTime{0.0};
double maxGammaInfNorm{0.0};
int oldEplpyStepCounter{0};
double factorMaxGammaInfnorm{0.8};
public:
explicit adaptiveSegregatedSolver(std::unique_ptr<ElphySolver> &&eSolver,
std::unique_ptr<ElastodynamicTimeIntegrator> &&mSolver,int eSteps = -1) :
SegregatedSolver(std::move(eSolver),std::move(mSolver),eSteps) {
if(elphySteps<=2){
Exit("The difference between MechDeltaTime and ElphyDeltaTime is to small for the adaptive scheme!")
}
Config::Get("ElphyDeltaTime", elphyDeltaTime);
Config::Get("MaximalGammaInf", maxGammaInfNorm);
Config::Get("FactorMaximalGammaInf",factorMaxGammaInfnorm);
oldEplpyStepCounter=elphySteps;
};
......
......@@ -211,10 +211,10 @@ def startAll():
def startAdaptiveTimeStep():
lL=[2]
tL=[0]
tL=[0,2]
nL=['SI']
sdt=0.0004
startJobs(lL,tL,nL,sdt,'adaptive/',{'Mesh':'TestBiventricleSimpleExcitation_smooth','ElphyProblem':'DeformedBiventricleCoarse','EndTime':0.6,'MechDeltaTime':0.0016,'AdaptiveTimeStepForMech':'true',})
startJobs(lL,tL,nL,sdt,'adaptive/',{'Mesh':'TestBiventricleSimpleExcitation_smooth','ElphyProblem':'DeformedBiventricleCoarse','EndTime':0.15,'MechDeltaTime':0.0016,'AdaptiveTimeStepForMech':'true','MaximalGammaInf':0.3,'FactorMaximalGammaInf':0.8})
def startFixedMechTimeStep():
lL=[2]
......
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