diff --git a/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp b/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp index ecd3c59c9e4c97f261e0149745a6844a9e91a089..19e06024fc1aa35dd8383fe59167b234a7524fec 100644 --- a/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp +++ b/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp @@ -131,7 +131,7 @@ _damageVolumeCenter(0.,0.,0.),_homogenizedCrackSurface(0.), _microBCOld(NULL),_microFailureBC(NULL), _failureBCIsSwitched(false), _pathFollowingSwitchCriterion(0.), _failureBasedOnPreviousState(true), - _currentTime(0.),_timeStep(0.) + _currentTime(0.),_timeStep(1.) { // check parallelization of dofManager #if defined(HAVE_MPI) @@ -2012,7 +2012,14 @@ void nonLinearMechSolver::setTimeForLaw(const double t,const double dt) { for(std::map<int,materialLaw*>::iterator it=maplaw.begin(); it!=maplaw.end();++it) { - it->second->setTime(t,dt); + if (_microFlag){ + double macroTime = _currentTime+ t*_timeStep; + double tstep = dt*_timeStep; // because + it->second->setTime(macroTime,tstep); + } + else{ + it->second->setTime(t,dt); + } } } diff --git a/dG3D/src/dG3DMultiscaleMaterialLaw.cpp b/dG3D/src/dG3DMultiscaleMaterialLaw.cpp index 084135079700f9317834bdb52b355eb7fe57ebd8..6ca578a9171857344a325e090e028904ca975fdf 100644 --- a/dG3D/src/dG3DMultiscaleMaterialLaw.cpp +++ b/dG3D/src/dG3DMultiscaleMaterialLaw.cpp @@ -206,6 +206,7 @@ void dG3DMultiscaleMaterialLaw::stress(IPVariable* ipv, const IPVariable* ipvpre } } + solver->setTime(_currentTime,_timeStep); // set tangent averaging flag solver->tangentAveragingFlag(stiff); // solve micro problem @@ -1650,7 +1651,7 @@ 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/dgC0ShellFunctionSpace.h b/dgshell/src/dgC0ShellFunctionSpace.h index 4c6a95baefd043d5c147f377b4f49dcdd932b4fe..5221bccc2fd8b3023ce19e6bed18b308bc624c78 100644 --- a/dgshell/src/dgC0ShellFunctionSpace.h +++ b/dgshell/src/dgC0ShellFunctionSpace.h @@ -36,7 +36,7 @@ class DgC0CgDgLagrangeFunctionSpace : public IsoparametricLagrangeFunctionSpace{ } protected : - virtual void getKeysOnElement(MElement *ele, std::vector<Dof> &keys) + virtual void getKeysOnElement(MElement *ele, std::vector<Dof> &keys) const { int nk=ele->getNumVertices(); // return the number of vertices // negative type in mpi if the Dof are not located on this partition @@ -66,7 +66,7 @@ class DgC0CgDgLagrangeFunctionSpace : public IsoparametricLagrangeFunctionSpace{ class DgC0FullDgLagrangeFunctionSpace : public IsoparametricLagrangeFunctionSpace{ protected: - virtual void getKeysOnElement(MElement *ele, std::vector<Dof> &keys){ + virtual void getKeysOnElement(MElement *ele, std::vector<Dof> &keys) const{ int nk=ele->getNumVertices(); // return the number of vertices #if defined(HAVE_MPI) // small duplication to avoid multiple if in a loop if( (ele->getPartition() != 0)and (ele->getPartition() != Msg::GetCommRank() +1)) @@ -104,7 +104,7 @@ class DgC0CgDgBoundaryConditionLagrangeFunctionSpace : public DgC0CgDgLagrangeFu DgC0CgDgBoundaryConditionLagrangeFunctionSpace(int id, int comp1, int comp2) : DgC0CgDgLagrangeFunctionSpace(id,comp1,comp2){} virtual ~DgC0CgDgBoundaryConditionLagrangeFunctionSpace(){} - virtual void getKeys(MElement *ele, std::vector<Dof> &keys){ + virtual void getKeys(MElement *ele, std::vector<Dof> &keys) const{ DgC0CgDgLagrangeFunctionSpace::getKeysOnElement(ele,keys); } virtual FunctionSpaceBase* clone(const int id) const{ @@ -123,7 +123,7 @@ class DgC0CgDgBoundaryConditionLagrangeFunctionSpaceGhost : public DgC0CgDgBound virtual ~DgC0CgDgBoundaryConditionLagrangeFunctionSpaceGhost(){}; // Here we be sure that the dofs have negative type (Ghost) - virtual void getKeys(MElement *ele, std::vector<Dof> &keys){ + virtual void getKeys(MElement *ele, std::vector<Dof> &keys) const{ int nk = ele->getNumVertices(); for (int j=0;j<_ncomp;++j) for (int i=0;i<nk;++i) @@ -320,14 +320,14 @@ class DgC0FullDgBoundaryConditionLagrangeFunctionSpace : public DgC0FullDgLagran Msg::Fatal("DgC0FullDgBoundaryConditionLagrangeFunctionSpace::clone is not defined"); } - virtual void getKeys(MInterfaceElement *ielem, std::vector<Dof> &keys){ + virtual void getKeys(MInterfaceElement *ielem, std::vector<Dof> &keys) const{ Msg::Error("Impossible to get keys on interface element for a Dirichlet Boundary Conditions"); } - virtual void getKeys(MElement *e, std::vector<Dof> &keys){ - std::map<MElement*,std::pair<MElement*,MElement*> >::iterator itele=mapInter.find(e); + virtual void getKeys(MElement *e, std::vector<Dof> &keys) const{ + std::map<MElement*,std::pair<MElement*,MElement*> >::const_iterator itele=mapInter.find(e); MElement *ele1 = itele->second.first; MElement *ele2 = itele->second.second; - std::map<MElement*,std::pair<std::vector<int>,std::vector<int> > >::iterator itvec=mapLocalVertex.find(e); + std::map<MElement*,std::pair<std::vector<int>,std::vector<int> > >::const_iterator itvec=mapLocalVertex.find(e); int nbcomp=comp.size(); #if defined(HAVE_MPI) // small duplication to avoid multiple if in a loop if( (ele1->getPartition() != 0)and (ele1->getPartition() != Msg::GetCommRank() +1))