diff --git a/NonLinearSolver/internalPoints/ipstate.cpp b/NonLinearSolver/internalPoints/ipstate.cpp index f595d8ddd3f0cf114639852d142982eabfe2f54f..579870fa5c27fa781822934a96c6ff750b08ea92 100644 --- a/NonLinearSolver/internalPoints/ipstate.cpp +++ b/NonLinearSolver/internalPoints/ipstate.cpp @@ -495,6 +495,23 @@ void AllIPState::restart() } } +void AllIPState::setTime(const double time, const double dtime, const int numstep){ + if (isMultiscale){ + for(ipstateContainer::iterator its=_mapall.begin(); its!=_mapall.end();++its) + { + ipstateElementContainer& vips = its->second; + for(ipstateElementContainer::iterator it=vips.begin(); it!=vips.end();++it) + { + IPStateBase* ips = *it; + if (ips->getSolver() != NULL){ + ips->getSolver()->setTime(time,dtime,numstep); + } + } + } + + } +}; + void AllIPState::nextStep() { //state ? state=false : state=true; this->copy(IPStateBase::current,IPStateBase::previous); diff --git a/NonLinearSolver/internalPoints/ipstate.h b/NonLinearSolver/internalPoints/ipstate.h index 3799fd7618883c41277bd728acad320e690c4537..c4d2a038d1cb908bb46079fc24cb4fc8613bc0b5 100644 --- a/NonLinearSolver/internalPoints/ipstate.h +++ b/NonLinearSolver/internalPoints/ipstate.h @@ -136,6 +136,8 @@ class AllIPState{ } } void restart(); + + void setTime(const double time, const double dtime, const int numstep); ipstateContainer* getAIPSContainer() {return &_mapall;}; const ipstateContainer* getAIPSContainer() const {return &_mapall;}; diff --git a/NonLinearSolver/materialLaw/mlawHyperelastic.cpp b/NonLinearSolver/materialLaw/mlawHyperelastic.cpp index 7a627061d20dc54988b54283f4d6114afd700507..88b3d59b48e117fe5bd8d582b23c0d40eb68d3ac 100644 --- a/NonLinearSolver/materialLaw/mlawHyperelastic.cpp +++ b/NonLinearSolver/materialLaw/mlawHyperelastic.cpp @@ -1714,7 +1714,7 @@ mlawPowerYieldHyper::mlawPowerYieldHyper(const int num,const double E,const doub mlawPowerYieldHyper::mlawPowerYieldHyper(const mlawPowerYieldHyper& src):mlawHyperViscoElastic(src), _tol(src._tol),_n(src._n),_nonAssociatedFlow(src._nonAssociatedFlow),_b(src._b), - _I4(src._I4), _I(src._I), _Idev(src._Idev),_p(1.){ + _I4(src._I4), _I(src._I), _Idev(src._Idev),_p(src._p){ _viscosity = NULL; if (src._viscosity) _viscosity = src._viscosity->clone(); diff --git a/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp b/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp index 19e06024fc1aa35dd8383fe59167b234a7524fec..7127579527cfb28da94719af2c5f54978aca249f 100644 --- a/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp +++ b/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp @@ -102,7 +102,7 @@ _stressflag(true),_tangentflag(false),_enum(0),_gnum(0),_rveVolume(0.), _systemType(nonLinearMechSolver::MULT_ELIM),_controlType(nonLinearMechSolver::LOAD_CONTROL), _highOrderFlag(false), _eigenValueFile(NULL), _perturbationfactor(0.1), - _archive(true),_archivecounter(0),_stiffEstimation(true),_stiffnessModification(true), + _archive(true),_stiffEstimation(true),_stiffnessModification(true), _iterativeNR(true),_messageView(false), _outputFile(NULL), _eigenFollowing(false), _homogenizeStressMethod(nonLinearMechSolver::VOLUME), _stabilityCriterionFollowing(false), _homogenizeTangentMethod(nonLinearMechSolver::PERTURB), _isHommStrainSaveToFile(true), @@ -131,7 +131,7 @@ _damageVolumeCenter(0.,0.,0.),_homogenizedCrackSurface(0.), _microBCOld(NULL),_microFailureBC(NULL), _failureBCIsSwitched(false), _pathFollowingSwitchCriterion(0.), _failureBasedOnPreviousState(true), - _currentTime(0.),_timeStep(1.) + _macroTime(0.),_macroTimeStep(1.),_macroStep(0.) { // check parallelization of dofManager #if defined(HAVE_MPI) @@ -1052,10 +1052,10 @@ void nonLinearMechSolver::endOfScheme(unknownField *ufield,energeticField *efiel #endif // HAVE_MPI } -void nonLinearMechSolver::oneStepPreSolve(const double curtime, const double timestep) +void nonLinearMechSolver::oneStepPreSolve(const double curtime, const double timestep, const int numstep) { this->setTimeForBC(curtime); - this->setTimeForLaw(curtime,timestep); + this->setTimeForLaw(curtime,timestep,numstep); //for periodic BC if (_testFlag){ @@ -1066,7 +1066,7 @@ void nonLinearMechSolver::oneStepPreSolve(const double curtime, const double tim } -void nonLinearMechSolver::oneStepPreSolvePathFollowing(const double curtime, const double timestep){ +void nonLinearMechSolver::oneStepPreSolvePathFollowing(const double curtime, const double timestep, const int numstep){ static std::string name = "A"; linearSystem<double>* lsys =pAssembler->getLinearSystem(name); pathFollowingSystem<double>* pathsys = dynamic_cast<pathFollowingSystem<double>*>(lsys); @@ -1112,7 +1112,7 @@ void nonLinearMechSolver::oneStepPreSolvePathFollowing(const double curtime, con double loadParam = pathsys->getControlParameter(); double dloadParam = fabs(pathsys->getControlParameterStep()); - this->oneStepPreSolve(loadParam,dloadParam); + this->oneStepPreSolve(loadParam,dloadParam, numstep); } @@ -2008,19 +2008,21 @@ void nonLinearMechSolver::setTimeForBC(double time){ } -void nonLinearMechSolver::setTimeForLaw(const double t,const double dt) +void nonLinearMechSolver::setTimeForLaw(const double t,const double dt, const int numstep) { for(std::map<int,materialLaw*>::iterator it=maplaw.begin(); it!=maplaw.end();++it) { if (_microFlag){ - double macroTime = _currentTime+ t*_timeStep; - double tstep = dt*_timeStep; // because - it->second->setTime(macroTime,tstep); + double mtime = _macroTime- (1-t)*_macroTimeStep; + double tstep = dt*_macroTimeStep; // because + it->second->setTime(mtime,tstep); } else{ it->second->setTime(t,dt); } } + // if multiscale + _ipf->getAips()->setTime(t,dt,numstep); } void nonLinearMechSolver::fixNodalDofs(){ @@ -2825,7 +2827,7 @@ double nonLinearMechSolver::solveStaticLinear() int step = 1; /* solving */ - this->setTimeForLaw(curtime,timestep); + this->setTimeForLaw(curtime,timestep,step); std::cout << "Neumann BC"<< std::endl; double tsystresol = Cpu(); this->computeExternalForces(_ufield); @@ -2859,7 +2861,7 @@ double nonLinearMechSolver::solveEigen() int step = 1; /* solving */ - this->setTimeForLaw(curtime,timestep); + this->setTimeForLaw(curtime,timestep,step); printf("--begin assembling \n"); double tsystresol = Cpu(); if (_eigenSolverType == DYNAMIC) @@ -5536,7 +5538,7 @@ double nonLinearMechSolver::oneExplicitStep(const double curtime) if(mytime>endtime) mytime = endtime; - this->oneStepPreSolve(mytime,timeStep); + this->oneStepPreSolve(mytime,timeStep,_currentStep+1); // solve via assembler to perform mpi operation (communication before and after systemSolve pAssembler->systemSolve(); @@ -5660,27 +5662,27 @@ double nonLinearMechSolver::computeLocalPathFollowingStep() const{ }; -int nonLinearMechSolver::oneStaticStep(const double curtime,const double dt) +int nonLinearMechSolver::oneStaticStep(const double curtime,const double dt, const int numstep) { int niteNR = 0; if (_pathFollowing){ - this->oneStepPreSolvePathFollowing(curtime,dt); - niteNR = NewtonRaphsonPathFollowing(pAssembler,_ufield); + this->oneStepPreSolvePathFollowing(curtime,dt,numstep); + niteNR = NewtonRaphsonPathFollowing(pAssembler,_ufield,numstep); } else{ - this->oneStepPreSolve(curtime,dt); + this->oneStepPreSolve(curtime,dt,numstep); // Solve one step by NR scheme double tsystresol = Cpu(); - niteNR = NewtonRaphson(pAssembler,_ufield); + niteNR = NewtonRaphson(pAssembler,_ufield,numstep); tsystresol = Cpu() - tsystresol; Msg::Info("Time of Newton-Raphson resolution %f",tsystresol); } return niteNR; } -double nonLinearMechSolver::finalizeStaticScheme(const double curtime, const int ii) +double nonLinearMechSolver::finalizeStaticScheme(const double curtime, const int numstep) { - this->endOfScheme(_ufield,_energField,curtime,ii); + this->endOfScheme(_ufield,_energField,curtime,numstep); Msg::Info("NonLinearStatic OK"); return curtime; } @@ -6161,7 +6163,7 @@ void nonLinearMechSolver::computeStiffMatrix(dofManager<double> *pmanager){ } // Newton Raphson scheme to solve one step -int nonLinearMechSolver::NewtonRaphson(dofManager<double> *pmanager,unknownField *ufield){ +int nonLinearMechSolver::NewtonRaphson(dofManager<double> *pmanager,unknownField *ufield, const int numstep){ staticDofManager<double>* staticAssembler = static_cast<staticDofManager<double>*>(pmanager); if (whatScheme == Implicit){ staticAssembler->systemSolveIntReturn(); @@ -6587,7 +6589,7 @@ void nonLinearMechSolver::createSystem() } } -int nonLinearMechSolver::NewtonRaphsonPathFollowing(dofManager<double> *pmanager, unknownField *ufield){ +int nonLinearMechSolver::NewtonRaphsonPathFollowing(dofManager<double> *pmanager, unknownField *ufield, const int numstep){ std::string name = "A"; linearSystem<double>* lsys =pmanager->getLinearSystem(name); nonLinearSystem<double>* nonsys = dynamic_cast<nonLinearSystem<double>*>(lsys); @@ -6631,7 +6633,7 @@ int nonLinearMechSolver::NewtonRaphsonPathFollowing(dofManager<double> *pmanager // update load double loadParam = pathsys->getControlParameter(); double dloadParam = fabs(pathsys->getControlParameterStep()); - this->oneStepPreSolve(loadParam,dloadParam); + this->oneStepPreSolve(loadParam,dloadParam,numstep); if (!_iterativeNR) break; // new forces @@ -6708,7 +6710,7 @@ double nonLinearMechSolver::solveSNL() } Msg::Info("t= %e on %e",curtime,dendtime); - int niteNR = this->oneStaticStep(curtime,dt); + int niteNR = this->oneStaticStep(curtime,dt,ii+1); if(niteNR == _maxNRite) // time step reduction { @@ -6864,7 +6866,7 @@ double nonLinearMechSolver::solveMulti() curtime+=dt; if(curtime > dendtime){curtime = dendtime;} - this->oneStepPreSolve(curtime,dt); + this->oneStepPreSolve(curtime,dt,step+1); // Solve one step by NR scheme int niteNR=0; if(step%_numstepImpl==0 or !oneExplicitScheme) @@ -6872,7 +6874,7 @@ double nonLinearMechSolver::solveMulti() Msg::Info("Solve implicit system(s)"); double tsystresol = Cpu(); tsystresol = Cpu() - tsystresol; - niteNR = NewtonRaphson(pAssembler,_ufield); + niteNR = NewtonRaphson(pAssembler,_ufield,step+1); Msg::Info("Time of Newton-Raphson resolution n %f: ",tsystresol); if(niteNR == _maxNRite) // time step reduction @@ -9022,7 +9024,7 @@ void nonLinearMechSolver::extractAveragePropertiesPerturbation(homogenizedData* _microBC->setFirstOrderKinematicalVariable(Fplus); /** solve perturbated system**/ - this->OneStep(); + this->OneStep(0); /** get homogenized stress in perturbed system **/ this->extractAverageStress(&homoDataPlus); @@ -9105,7 +9107,7 @@ void nonLinearMechSolver::extractAveragePropertiesPerturbation(homogenizedData* _microBC->setSecondOrderKinematicalVariable(Gplus); /** solve perturbed system**/ - this->OneStep(); + this->OneStep(0); /** get homogenized stress in perturbed system **/ this->extractAverageStress(&homoDataPlus); @@ -9192,7 +9194,7 @@ void nonLinearMechSolver::extractAveragePropertiesPerturbation(homogenizedData* gradTplus(i) += gradTpert; _microBC->setConstitutiveExtraDofDiffusionKinematicalVariable(index,gradTplus); /** solve perturbed system**/ - this->OneStep(); + this->OneStep(0); /** get homogenized stress in perturbed system **/ this->extractAverageStress(&homoDataPlus); @@ -9261,7 +9263,7 @@ void nonLinearMechSolver::extractAveragePropertiesPerturbation(homogenizedData* _microBC->setConstitutiveExtraDofDiffusionConstantVariable(index,Tplus); /** solve perturbed system**/ - this->OneStep(); + this->OneStep(0); /** get homogenized stress in perturbed system **/ this->extractAverageStress(&homoDataPlus); @@ -9332,7 +9334,7 @@ void nonLinearMechSolver::extractAveragePropertiesPerturbation(homogenizedData* gradVplus(i) += gradVpert; _microBC->setNonConstitutiveExtraDofDiffusionKinematicalVariable(index,gradVplus); /** solve perturbed system**/ - this->OneStep(); + this->OneStep(0); /** get homogenized stress in perturbed system **/ this->extractAverageStress(&homoDataPlus); @@ -10283,7 +10285,7 @@ void nonLinearMechSolver::nextStep(){ } // archive data - this->archiveData(0.,0.); + this->archiveData(_macroTime,_macroStep); // next step for solver std::string name = "A"; @@ -10717,21 +10719,21 @@ double nonLinearMechSolver::microSolve(){ return time; }; -void nonLinearMechSolver::OneStep(){ +void nonLinearMechSolver::OneStep(const int numstep){ int niteNR = 0; if (_pathFollowing){ niteNR = pathFollowingPerturbation(pAssembler,_ufield); } else{ if (_systemType == MULT_ELIM) - niteNR = microNewtonRaphson(pAssembler,_ufield); + niteNR = microNewtonRaphson(pAssembler,_ufield,numstep); else { if (_systemType == DISP_ELIM) _pAl->applyPBCByConstraintElimination(); else if (_systemType == DISP_ELIM_UNIFIED){ _pAl->updateSystemUnknown(); } - niteNR = NewtonRaphson(pAssembler,_ufield); + niteNR = NewtonRaphson(pAssembler,_ufield,numstep); } if(niteNR == _maxNRite) // time step reduction { @@ -10754,7 +10756,7 @@ double nonLinearMechSolver::solveMicroSolverSNL(){ double dendtime = double(endtime); double dtmax = dendtime/double(_numstepImpl); // time step value prescribed by user (time step can not be greater than this value) double dt = dtmax; // initial time step value - int ii = 0; // iteration counter + int ii =0.; // iteration counter double tolend = 0.000001/dendtime; // OTHERWISE LAST STEP CAN BE DONE TWICE ?? double toldtmax = 0.000001/dtmax; // IDEM (PRECISION PROBLEM) int numberTimeStepReduction=0; @@ -10790,7 +10792,7 @@ double nonLinearMechSolver::solveMicroSolverSNL(){ if (_pathFollowing){ pathSys->setPseudoTimeIncrement(dt); _pAl->updateConstraint(_ipf); - niteNR = microNewtonRaphsonPathFollowing(pAssembler,_ufield); + niteNR = microNewtonRaphsonPathFollowing(pAssembler,_ufield,ii+1); double control = pathSys->getControlParameter(); if (_outputFile) @@ -10815,10 +10817,10 @@ double nonLinearMechSolver::solveMicroSolverSNL(){ } } else{ - this->oneStepPreSolve(curtime,dt); + this->oneStepPreSolve(curtime,dt,ii+1); _pAl->updateConstraint(_ipf); if (_systemType == MULT_ELIM) - niteNR = microNewtonRaphson(pAssembler,_ufield); + niteNR = microNewtonRaphson(pAssembler,_ufield,ii+1); else { if (_systemType == DISP_ELIM){ _pAl->applyPBCByConstraintElimination(); @@ -10827,7 +10829,7 @@ double nonLinearMechSolver::solveMicroSolverSNL(){ _pAl->updateSystemUnknown(); } - niteNR = NewtonRaphson(pAssembler,_ufield); + niteNR = NewtonRaphson(pAssembler,_ufield,ii+1); } } @@ -10969,36 +10971,28 @@ void nonLinearMechSolver::archiveData(const double curtime, const int numstep){ // Archiving if (_outputFile) fprintf(_outputFile,"Archiving on element %d, IP point %d \n",getElementSolverNumber(),getGaussPointSolverNumber()); - double time = curtime; - double step = numstep; - - if (_multiscaleFlag){ - _archivecounter++; - time += (double)_archivecounter; - step += _archivecounter; - } if (_criterionFile != NULL){ std::string name = "A"; linearSystem<double>* lsys = pAssembler->getLinearSystem(name); nonLinearSystem<double>* nonsys = dynamic_cast<nonLinearSystem<double>*>(lsys); double val = nonsys->getInstabilityCriterion(); - fprintf(_criterionFile,"%e; %e; \n",time,val); + fprintf(_criterionFile,"%e; %e; \n",curtime,val); } if (_archive){ - _energField->archive(time,step); - _ufield->archive(time,step); + _energField->archive(curtime,numstep); + _ufield->archive(curtime,numstep); if (_oneUnknownField != NULL) - _oneUnknownField->archive(time,step); - _ipf->archive(time,step); + _oneUnknownField->archive(curtime,numstep); + _ipf->archive(curtime,numstep); } - this->homogenizedDataToFile(time); + this->homogenizedDataToFile(curtime); staticDofManager<double>* sAssembler = dynamic_cast<staticDofManager<double>*>(pAssembler); if (sAssembler) - this->forceArchiving(time,step,sAssembler); + this->forceArchiving(curtime,numstep,sAssembler); }; @@ -11009,7 +11003,7 @@ double nonLinearMechSolver::solveMicroSolverStaticLinear(){ int step = 1; /* solving */ this->setTimeForBC(curtime); - this->setTimeForLaw(curtime,timestep); + this->setTimeForLaw(curtime,timestep,step); if (_systemType == DISP_ELIM) _pAl->applyPBCByConstraintElimination(); @@ -11064,9 +11058,10 @@ double nonLinearMechSolver::solveMicroSolverForwardEuler(){ }; }; -void nonLinearMechSolver::setTime(const double ctime,const double dtime){ - _timeStep = dtime; - _currentTime = ctime; +void nonLinearMechSolver::setTime(const double ctime,const double dtime, const int curstep){ + _macroTimeStep = dtime; + _macroTime = ctime; + _macroStep = curstep; } double nonLinearMechSolver::microSolveStaticLinear(){ @@ -11175,7 +11170,7 @@ int nonLinearMechSolver::pathFollowingPerturbation(dofManager<double> *pmanager, return iter; }; -int nonLinearMechSolver::microNewtonRaphson(dofManager<double> *pmanager,unknownField *ufield){ +int nonLinearMechSolver::microNewtonRaphson(dofManager<double> *pmanager,unknownField *ufield, const int numstep){ std::string name = "A"; linearSystem<double>* lsys = pmanager->getLinearSystem(name); pbcSystem<double> * pbcSys = dynamic_cast<pbcSystem<double>*>(lsys); @@ -11235,7 +11230,7 @@ int nonLinearMechSolver::microNewtonRaphson(dofManager<double> *pmanager,unknown return iter; } -int nonLinearMechSolver::microNewtonRaphsonPathFollowing(dofManager<double> *pmanager,unknownField *ufield){ +int nonLinearMechSolver::microNewtonRaphsonPathFollowing(dofManager<double> *pmanager,unknownField *ufield, const int numstep){ std::string name = "A"; linearSystem<double>* lsys =pmanager->getLinearSystem(name); nonLinearSystem<double>* nonsys = dynamic_cast<nonLinearSystem<double>*>(lsys); diff --git a/NonLinearSolver/nlsolver/nonLinearMechSolver.h b/NonLinearSolver/nlsolver/nonLinearMechSolver.h index f2ad270b26a02434b48aa0e734e3a3ad3fd6361d..5146a7967375a4b4e9d1a193266a62eea327735e 100644 --- a/NonLinearSolver/nlsolver/nonLinearMechSolver.h +++ b/NonLinearSolver/nlsolver/nonLinearMechSolver.h @@ -362,8 +362,8 @@ class nonLinearMechSolver void initAllBCsOnDofs(); void initTerms(unknownField *ufield, IPField *ipf); void endOfScheme(unknownField *ufield,energeticField *efield,const double endtime, const int endstep); // common operation at the end of a scheme - void oneStepPreSolve(const double curtime, const double timestep); - void oneStepPreSolvePathFollowing(const double curtime, const double timestep); + void oneStepPreSolve(const double curtime, const double timestep, const int numstep); + void oneStepPreSolvePathFollowing(const double curtime, const double timestep, const int numstep); void computeIPCompOnDomain(const double time); void computeIPCompDamageZoneAveraging(const double time); void fillMapOfInterfaceElementsInOneDomain(MElement *e, std::vector<MElement*> &eleFound, @@ -375,12 +375,12 @@ class nonLinearMechSolver void setPairSpaceElementForBoundaryConditions(); // new implementation // Function used by non linear solver (return the number of iteration to converge) - int NewtonRaphson(dofManager<double> *pmanager, unknownField *ufield); + int NewtonRaphson(dofManager<double> *pmanager, unknownField *ufield, const int numstep); /* NewtonRaphson function for arc-length path following */ - int NewtonRaphsonPathFollowing(dofManager<double> *pmanager, unknownField *ufield); + int NewtonRaphsonPathFollowing(dofManager<double> *pmanager, unknownField *ufield, const int numstep); bool localPathFollowingSwitching() const; double computeLocalPathFollowingStep() const; @@ -407,7 +407,7 @@ class nonLinearMechSolver double criticalExplicitTimeStep(unknownField *ufield); void setInitialCondition(); void setTimeForBC(double time); - void setTimeForLaw(const double t,const double dt); + void setTimeForLaw(const double t,const double dt, const int numstep); void initArchiveForce(); void endArchiveForce(); void forceArchiving(const double curtime,const int numstep,const dofManager<double>* pAssembler); @@ -665,8 +665,8 @@ class nonLinearMechSolver virtual double finalizeExplicitScheme(const double curtime); // Implicit scheme control virtual void initializeStaticScheme(); - virtual int oneStaticStep(const double curtime, const double dt); - virtual double finalizeStaticScheme(const double curtime,const int curstep); + virtual int oneStaticStep(const double curtime, const double dt, const int numstep); + virtual double finalizeStaticScheme(const double curtime,const int numstep); // Display control virtual void createOnelabDisplacementView(const std::string &fname,const double time) const; @@ -708,8 +708,9 @@ class nonLinearMechSolver protected: #ifndef SWIG // time and time step - double _timeStep; // for law which works on increment. (Use only in so no getTimeStep function) - double _currentTime; // To save results vs time + double _macroTimeStep; // for law which works on increment. (Use only in so no getTimeStep function) + double _macroTime; // To save results vs time + int _macroStep; // current macroscopic step //for micro flag SYSTEM_TYPE _systemType; @@ -756,7 +757,6 @@ class nonLinearMechSolver // for archiving bool _archive; int _iterMax; - int _archivecounter; // all homogenized filename bool _isHommProSaveToFile; // flag -->save homogenized properties to files bool _isHommStrainSaveToFile; //flag --> save homogenized strain to files @@ -842,8 +842,8 @@ class nonLinearMechSolver double critialPointTestFunction(double time, double* &mode); void modeViewToFile(std::vector<int>& num, double time, int step); // newton raphson - int microNewtonRaphson(dofManager<double> *pAssembler,unknownField *ufield); - int microNewtonRaphsonPathFollowing(dofManager<double> *pAssembler,unknownField *ufield); + int microNewtonRaphson(dofManager<double> *pAssembler,unknownField *ufield,const int numstep); + int microNewtonRaphsonPathFollowing(dofManager<double> *pAssembler,unknownField *ufield, const int numstep); int pathFollowingPerturbation(dofManager<double> *pAssembler,unknownField *ufield); @@ -855,14 +855,14 @@ class nonLinearMechSolver double solveMicroSolverStaticLinear(); double solveMicroSolverForwardEuler(); - void OneStep(); + void OneStep(const int numstep); void writeDisturbedMeshByEigenVector(int step); void writeDeformedMesh(int step); #endif // SWIG public: #ifndef SWIG - void setTime(const double ctime,const double dtime); + void setTime(const double ctime,const double dtime, const int curstep); // RVE analysis newton raphson double microSolveStaticLinear(); double microSolveSNL(); @@ -924,7 +924,7 @@ class nonLinearMechSolver double microSolve(); void nextStep(); - void archiveData(const double curtime, const int iter); + void archiveData(const double curtime, const int numstep); void setMessageView(const bool view); void setPeriodicity(const double x, const double y, const double z, const std::string direction); diff --git a/dG3D/src/NonLocalDamageHyperelasticDG3DMaterialLaw.cpp b/dG3D/src/NonLocalDamageHyperelasticDG3DMaterialLaw.cpp index 6bb5446d02a909bf32d171e5dbbe0df17b5c16fe..de57e1bb3e78b2c4cf3b97259c400f611d663a6b 100644 --- a/dG3D/src/NonLocalDamageHyperelasticDG3DMaterialLaw.cpp +++ b/dG3D/src/NonLocalDamageHyperelasticDG3DMaterialLaw.cpp @@ -109,8 +109,7 @@ NonLocalDamagePowerYieldHyperDG3DMaterialLaw::NonLocalDamagePowerYieldHyperDG3DM }; void NonLocalDamagePowerYieldHyperDG3DMaterialLaw::setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _nldPowerYieldHyperlaw->setTime(t,dtime); } @@ -313,8 +312,7 @@ LocalDamagePowerYieldHyperDG3DMaterialLawWithFailure::LocalDamagePowerYieldHyper }; void LocalDamagePowerYieldHyperDG3DMaterialLawWithFailure::setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _localPowerYieldHyperlaw->setTime(t,dtime); } @@ -513,8 +511,7 @@ NonLocalDamagePowerYieldHyperDG3DMaterialLawWithFailure::NonLocalDamagePowerYiel }; void NonLocalDamagePowerYieldHyperDG3DMaterialLawWithFailure::setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _nldPowerYieldHyperlaw->setTime(t,dtime); } diff --git a/dG3D/src/dG3DMaterialLaw.cpp b/dG3D/src/dG3DMaterialLaw.cpp index 632f8ca846b99334d178a769ace112d68308fc36..fce62a2ae640b03b2a8fe90b3797fb18ae2435b8 100644 --- a/dG3D/src/dG3DMaterialLaw.cpp +++ b/dG3D/src/dG3DMaterialLaw.cpp @@ -892,8 +892,7 @@ NonLocalDamageDG3DMaterialLaw::NonLocalDamageDG3DMaterialLaw(const NonLocalDamag void NonLocalDamageDG3DMaterialLaw::setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _nldlaw->setTime(t,dtime); return; } @@ -1082,8 +1081,7 @@ dG3DMaterialLaw(src) }; void LocalDamageHyperelasticDG3DMaterialLaw::setTime(const double t,const double dtime) { - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _nlLaw->setTime(t,dtime); } @@ -1171,8 +1169,7 @@ dG3DMaterialLaw(src) }; void NonLocalDamageHyperelasticDG3DMaterialLaw::setTime(const double t,const double dtime) { - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _nlLaw->setTime(t,dtime); } @@ -1271,8 +1268,7 @@ NonLocalDamageIsotropicElasticityDG3DMaterialLaw::NonLocalDamageIsotropicElastic void NonLocalDamageIsotropicElasticityDG3DMaterialLaw::setTime(const double t,const double dtime) { - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _nldIsotropicElasticitylaw->setTime(t,dtime); } @@ -1386,8 +1382,7 @@ LocalDamageJ2HyperDG3DMaterialLaw::LocalDamageJ2HyperDG3DMaterialLaw(const Local void LocalDamageJ2HyperDG3DMaterialLaw::setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _nldJ2Hyperlaw->setTime(t,dtime); } @@ -1491,8 +1486,7 @@ void NonLocalDamageJ2HyperDG3DMaterialLaw::setStrainOrder(const int order){ void NonLocalDamageJ2HyperDG3DMaterialLaw::setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _nldJ2Hyperlaw->setTime(t,dtime); } diff --git a/dG3D/src/dG3DMaterialLaw.h b/dG3D/src/dG3DMaterialLaw.h index 0558fb639bbf52bc65a5bd602f1f2bd3c0746b53..663f96b8c39a2cd7c5580fbd04fc5f19f78155b4 100644 --- a/dG3D/src/dG3DMaterialLaw.h +++ b/dG3D/src/dG3DMaterialLaw.h @@ -146,8 +146,7 @@ class J2SmallStrainDG3DMaterialLaw : public dG3DMaterialLaw } // set the time of _j2law virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _j2law.setTime(t,dtime); } virtual materialLaw::matname getType() const {return _j2law.getType();} @@ -194,8 +193,7 @@ class J2LinearDG3DMaterialLaw : public dG3DMaterialLaw } // set the time of _j2law virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _j2law.setTime(t,dtime); } virtual materialLaw::matname getType() const {return _j2law.getType();} @@ -237,8 +235,7 @@ class HyperViscoElasticDG3DMaterialLaw : public dG3DMaterialLaw{ virtual ~HyperViscoElasticDG3DMaterialLaw(){} // set the time of _j2law virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _viscoLaw.setTime(t,dtime); } virtual materialLaw::matname getType() const {return _viscoLaw.getType();} @@ -288,8 +285,7 @@ class HyperViscoElastoPlasticPowerYieldDG3DMaterialLaw : public dG3DMaterialLaw HyperViscoElastoPlasticPowerYieldDG3DMaterialLaw(const HyperViscoElastoPlasticPowerYieldDG3DMaterialLaw& src); virtual ~HyperViscoElastoPlasticPowerYieldDG3DMaterialLaw(){}; virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _viscoLaw.setTime(t,dtime); } virtual materialLaw::matname getType() const {return _viscoLaw.getType();} @@ -331,8 +327,7 @@ class ViscoelasticDG3DMaterialLaw : public dG3DMaterialLaw } virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _Vislaw.setTime(t,dtime); } @@ -387,8 +382,7 @@ class EOSDG3DMaterialLaw : public dG3DMaterialLaw } virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); maplaw.begin()->second->setTime(t,dtime); _EOSlaw.setTime(t,dtime); } @@ -427,8 +421,7 @@ class VUMATinterfaceDG3DMaterialLaw : public dG3DMaterialLaw VUMATinterfaceDG3DMaterialLaw(const VUMATinterfaceDG3DMaterialLaw &source); // set the time of _vumatlaw virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _vumatlaw.setTime(t,dtime); } virtual materialLaw::matname getType() const {return _vumatlaw.getType();} @@ -462,8 +455,7 @@ class TransverseIsotropicDG3DMaterialLaw : public dG3DMaterialLaw virtual ~TransverseIsotropicDG3DMaterialLaw(){} // set the time of _tilaw virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _tilaw.setTime(t,dtime); } virtual materialLaw::matname getType() const {return _tilaw.getType();} @@ -503,8 +495,7 @@ class TransverseIsoCurvatureDG3DMaterialLaw : public dG3DMaterialLaw virtual ~TransverseIsoCurvatureDG3DMaterialLaw(){} // set the time of _tilaw virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _tilaw.setTime(t,dtime); } virtual materialLaw::matname getType() const {return _tilaw.getType();} @@ -598,8 +589,7 @@ class TransverseIsoYarnBDG3DMaterialLaw : public dG3DMaterialLaw // set the time of _tilaw virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _tilaw.setTime(t,dtime); } @@ -657,8 +647,7 @@ class AnisotropicDG3DMaterialLaw : public dG3DMaterialLaw virtual ~AnisotropicDG3DMaterialLaw(){} // set the time of _tilaw virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _tilaw.setTime(t,dtime); } virtual materialLaw::matname getType() const {return _tilaw.getType();} @@ -692,8 +681,7 @@ class AnisotropicStochDG3DMaterialLaw : public dG3DMaterialLaw virtual ~AnisotropicStochDG3DMaterialLaw(){} // set the time of _tilaw virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _tilaw.setTime(t,dtime); } virtual materialLaw::matname getType() const {return _tilaw.getType();} @@ -994,8 +982,7 @@ class NonLocalDamageGursonDG3DMaterialLaw : public dG3DMaterialLaw NonLocalDamageGursonDG3DMaterialLaw(const NonLocalDamageGursonDG3DMaterialLaw &source); // set the time of _nldlaw virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _nldGursonlaw->setTime(t,dtime); } virtual materialLaw::matname getType() const {return _nldGursonlaw->getType();} @@ -1040,8 +1027,7 @@ class LinearThermoMechanicsDG3DMaterialLaw : public dG3DMaterialLaw // public ma LinearThermoMechanicsDG3DMaterialLaw(const LinearThermoMechanicsDG3DMaterialLaw &source); // set the time of _nldlaw virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _lawLinearTM->setTime(t,dtime); } virtual materialLaw::matname getType() const {return _lawLinearTM->getType();} @@ -1086,8 +1072,7 @@ class J2ThermoMechanicsDG3DMaterialLaw : public dG3DMaterialLaw } // set the time of _j2law virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _j2law.setTime(t,dtime); } virtual materialLaw::matname getType() const {return _j2law.getType();} @@ -1155,8 +1140,7 @@ class FullJ2ThermoMechanicsDG3DMaterialLaw : public dG3DMaterialLaw{ virtual double getExtraDofStoredEnergyPerUnitField(double T) const; // set the time of _nldlaw virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _j2FullThermo.setTime(t,dtime); } virtual materialLaw* clone() const{ return new FullJ2ThermoMechanicsDG3DMaterialLaw(*this);}; @@ -1195,8 +1179,7 @@ class mlawAnIsotropicTherMechDG3DMaterialLaw :public dG3DMaterialLaw mlawAnIsotropicTherMechDG3DMaterialLaw(const mlawAnIsotropicTherMechDG3DMaterialLaw &source); // set the time of _nldlaw virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _lawAnTM->setTime(t,dtime); } virtual materialLaw::matname getType() const {return _lawAnTM->getType();} @@ -1249,8 +1232,7 @@ class SMPDG3DMaterialLaw :public dG3DMaterialLaw // ,public mlawSMP SMPDG3DMaterialLaw(const SMPDG3DMaterialLaw &source); // set the time of _nldlaw virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _lawTMSMP->setTime(t,dtime); } virtual materialLaw::matname getType() const {return _lawTMSMP->getType();} @@ -1296,8 +1278,7 @@ class LinearElecTherMechDG3DMaterialLaw : public dG3DMaterialLaw // public mater LinearElecTherMechDG3DMaterialLaw(const LinearElecTherMechDG3DMaterialLaw &source); // set the time of _nldlaw virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _lawLinearETM->setTime(t,dtime); } virtual materialLaw::matname getType() const {return _lawLinearETM->getType();} @@ -1352,8 +1333,7 @@ class mlawAnIsotropicElecTherMechDG3DMaterialLaw :public dG3DMaterialLaw } // set the time of _nldlaw virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _lawETM->setTime(t,dtime); } virtual materialLaw::matname getType() const {return _lawETM->getType();} @@ -1413,8 +1393,7 @@ class mlawElecSMPDG3DMaterialLaw :public dG3DMaterialLaw mlawElecSMPDG3DMaterialLaw(const mlawElecSMPDG3DMaterialLaw &source); // set the time of _nldlaw virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dG3DMaterialLaw::setTime(t,dtime); _lawETMSMP->setTime(t,dtime); } virtual materialLaw::matname getType() const {return _lawETMSMP->getType();} diff --git a/dG3D/src/dG3DMultiscaleMaterialLaw.cpp b/dG3D/src/dG3DMultiscaleMaterialLaw.cpp index 6ca578a9171857344a325e090e028904ca975fdf..968dcfd1a29490cedcb677bad34e865c2dfb5e40 100644 --- a/dG3D/src/dG3DMultiscaleMaterialLaw.cpp +++ b/dG3D/src/dG3DMultiscaleMaterialLaw.cpp @@ -205,9 +205,7 @@ void dG3DMultiscaleMaterialLaw::stress(IPVariable* ipv, const IPVariable* ipvpre solver->getMicroBC()->setGradientOfDeformationGradient(G); } } - - solver->setTime(_currentTime,_timeStep); - // set tangent averaging flag + // set tangent averaging flag solver->tangentAveragingFlag(stiff); // solve micro problem double time = solver->microSolve(); @@ -1651,7 +1649,6 @@ void MultiscaleThermoMechanicsDG3DMaterialLaw::stress(IPVariable* ipv, const IPV solver->getMicroBC()->setConstitutiveExtraDofDiffusionGradient(0,gradT); solver->getMicroBC()->setConstitutiveExtraDofDiffusionValue(0,T); solver->tangentAveragingFlag(stiff); - solver->setTime(_currentTime,_timeStep); // solve microscopic problem double time =solver->microSolve(); diff --git a/dgshell/src/dgNonLinearShellMaterial.h b/dgshell/src/dgNonLinearShellMaterial.h index 1c5c8028d5d3cb4b2ef115f6de771dd820aaf3a2..1cf48a70440430e85c935f93951765e417f99417 100644 --- a/dgshell/src/dgNonLinearShellMaterial.h +++ b/dgshell/src/dgNonLinearShellMaterial.h @@ -101,8 +101,7 @@ class J2linearShellLaw : public dgNonLinearShellMaterialLaw virtual ~J2linearShellLaw(){} // set the time of _j2law virtual void setTime(const double t,const double dtime){ - this->_timeStep = dtime; - this->_currentTime = t; + dgNonLinearShellMaterialLaw::setTime(t,dtime); _j2law.setTime(t,dtime); } virtual materialLaw::matname getType() const {return _j2law.getType();}