From 0b25dd863f6395388fc1d58f090675d5ec633807 Mon Sep 17 00:00:00 2001
From: pareja <mpareja@uliege.be>
Date: Thu, 8 Nov 2018 10:55:01 +0100
Subject: [PATCH 1/9] start migrating electro mec

---
 dG3D/src/FractureCohesiveDG3DIPVariable.h |   4 +-
 dG3D/src/axisymmetricDG3DTerms.cpp        |   8 +-
 dG3D/src/dG3DDomain.cpp                   |  15 +-
 dG3D/src/dG3DEnhancedStrainIPVariable.h   |   4 +-
 dG3D/src/dG3DIPVariable.cpp               | 184 ++++++++++---------
 dG3D/src/dG3DIPVariable.h                 | 208 +++++++++++-----------
 dG3D/src/dG3DMaterialLaw.cpp              |  18 +-
 dG3D/src/dG3DMultiscaleMaterialLaw.cpp    |   4 +-
 dG3D/src/dG3DTerms.cpp                    |  51 +++---
 dG3D/src/nonLocalDamageDG3DIPVariable.h   |  10 +-
 10 files changed, 249 insertions(+), 257 deletions(-)

diff --git a/dG3D/src/FractureCohesiveDG3DIPVariable.h b/dG3D/src/FractureCohesiveDG3DIPVariable.h
index 27eb91e45..7fd339c0d 100644
--- a/dG3D/src/FractureCohesiveDG3DIPVariable.h
+++ b/dG3D/src/FractureCohesiveDG3DIPVariable.h
@@ -163,8 +163,8 @@ class FractureCohesive3DIPVariable : public IPVariable2ForFracture<dG3DIPVariabl
   virtual fullMatrix<double> &getRefTodMechanicalSourcedNonLocalVariable(){return _ipvbulk->getRefTodMechanicalSourcedNonLocalVariable();}
 
 
-  virtual const std::vector<std::vector<const STensor3*> > &getConstRefToLinearSymmetrizationCoupling() const  {return _ipvbulk->getConstRefToLinearSymmetrizationCoupling();};
-  virtual void setConstRefToLinearSymmetrizationCoupling(const STensor3 &eT, int i, int j)  {_ipvbulk->setConstRefToLinearSymmetrizationCoupling(eT,i,j);};
+  virtual const std::vector<const STensor3*> &getConstRefToLinearSymmetrizationCoupling() const  {return _ipvbulk->getConstRefToLinearSymmetrizationCoupling();};
+  virtual void setConstRefToLinearSymmetrizationCoupling(const STensor3 &eT, int i)  {_ipvbulk->setConstRefToLinearSymmetrizationCoupling(eT,i);};
 
 
   //------------------get 1st piola b4 AV ---------------//
diff --git a/dG3D/src/axisymmetricDG3DTerms.cpp b/dG3D/src/axisymmetricDG3DTerms.cpp
index 1efbd89db..9c769fa3c 100644
--- a/dG3D/src/axisymmetricDG3DTerms.cpp
+++ b/dG3D/src/axisymmetricDG3DTerms.cpp
@@ -515,9 +515,9 @@ void axisymmetricDG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVec
             k0p = *(ipvp->getConstRefToLinearK()[extraDOFField][extraDOFField]);
 
             static STensor3  Stiff_alphadialitationm;
-            Stiff_alphadialitationm = *(ipvm->getConstRefToLinearSymmetrizationCoupling()[extraDOFField][extraDOFField]);
+            Stiff_alphadialitationm = *(ipvm->getConstRefToLinearSymmetrizationCoupling()[extraDOFField]);
             static STensor3  Stiff_alphadialitationp;
-            Stiff_alphadialitationp = *(ipvp->getConstRefToLinearSymmetrizationCoupling()[extraDOFField][extraDOFField]);
+            Stiff_alphadialitationp = *(ipvp->getConstRefToLinearSymmetrizationCoupling()[extraDOFField]);
             if(getConstitutiveExtraDofDiffusionUseOneOverJump())
             {
               k0m*=(-1.)*fieldm*fieldm;
@@ -1302,9 +1302,9 @@ void axisymmetricDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
             static STensor3  k0p;
             k0p = *(ipvp->getConstRefToLinearK()[extraDOFField][extraDOFField2]);
             static STensor3  Stiff_alphadialitationm;
-            Stiff_alphadialitationm = *(ipvm->getConstRefToLinearSymmetrizationCoupling()[extraDOFField][extraDOFField2]);
+            Stiff_alphadialitationm = *(ipvm->getConstRefToLinearSymmetrizationCoupling()[extraDOFField]);
             static STensor3  Stiff_alphadialitationp;
-            Stiff_alphadialitationp = *(ipvp->getConstRefToLinearSymmetrizationCoupling()[extraDOFField][extraDOFField2]);
+            Stiff_alphadialitationp = *(ipvp->getConstRefToLinearSymmetrizationCoupling()[extraDOFField]);
             static STensor3  dk0mdFieldm;
             STensorOperation::zero(dk0mdFieldm);
             static STensor3  dk0pdFieldp;
diff --git a/dG3D/src/dG3DDomain.cpp b/dG3D/src/dG3DDomain.cpp
index 121689b15..ef79dbdcc 100644
--- a/dG3D/src/dG3DDomain.cpp
+++ b/dG3D/src/dG3DDomain.cpp
@@ -853,6 +853,7 @@ void dG3DDomain::computeStrain(MElement *e, const int npts_bulk, IntPt *GP,
         gradNonlocalVar(2) += Grads[i+3*nbFF+nl*nbFF][2]*disp(i+3*nbFF+nl*nbFF);
       }
     }
+
     if( ipv->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
       Msg::Fatal("Your material law uses more constitutive extra dof diffusion variables than your domain dG3DDomain::computeStrain bulk");
     for (int extraDOFField = 0; extraDOFField < ipv->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField++){
@@ -4230,7 +4231,7 @@ ThermoMechanicsInterDomainBetween3D::ThermoMechanicsInterDomainBetween3D(const T
 
 
 ElecTherMechDG3DDomain::ElecTherMechDG3DDomain (const int tag,const int phys, const int ws, const int lnum,
-                                          const int fdg, const double ElecTherMechEqRatio, const int dim) : dG3DDomain(tag,phys,ws,lnum,fdg,dim)
+                                          const int fdg, const double ElecTherMechEqRatio, const int dim) : dG3DDomain(tag,phys,ws,lnum,fdg,dim,0,2)
 					  , _ElecTherMechEqRatio(ElecTherMechEqRatio)
 {
   if(_space!=NULL) delete _space;   // A space is created in dG3DDomain remove it!
@@ -4501,11 +4502,11 @@ void ElecTherMechDG3DDomain::computeStrain(AllIPState *aips,MInterfaceElement *i
           gradfTp->operator()(2) += Gradsp[i+indexFieldfT*nbFFp][2]*ftemp;
         }
         
-        double& fTjump=ipvm->getRefTofTJump();
+        double& fTjump=ipvm->getRefToOneOverTemperatureJump();
         // compute the jump
         computeExtraFieldJump(indexFieldfT,Valsm,nbFFm,Valsp,nbFFp,dispm,dispp,fTjump);
         //Msg::Error("Temperature jump: %e",tempjump);
-        ipvp->getRefTofTJump() = fTjump;
+        ipvp->getRefToOneOverTemperatureJump() = fTjump;
 
 
         double *fVm = &(ipvm->getRefTofV());
@@ -4741,8 +4742,8 @@ void ElecTherMechDG3DDomain::computeStrain(AllIPState *aips,MInterfaceElement *i
         ipvm->getRefTofvJump() = fvjump;
         ipvp->getRefTofvJump() = fvjump;
 
-        ipvm->getRefTofTJump() = ftjump;
-        ipvp->getRefTofTJump() = ftjump;
+        ipvm->getRefToOneOverTemperatureJump() = ftjump;
+        ipvp->getRefToOneOverTemperatureJump() = ftjump;
 
         ipvm->getRefTodfvjumpdvm() = dfvjumpdvm;
         ipvp->getRefTodfvjumpdvp() = dfvjumpdvp;
@@ -4750,8 +4751,8 @@ void ElecTherMechDG3DDomain::computeStrain(AllIPState *aips,MInterfaceElement *i
         ipvm->getRefTodfvjumpdTm() = dfvjumpdTm;
         ipvp->getRefTodfvjumpdTp() = dfvjumpdTp;
 
-        ipvm->getRefTodfTjumpdTm() = dftjumpdTm;
-        ipvp->getRefTodfTjumpdTp() = dftjumpdTp;
+        ipvm->getRefTodOneOverTemperatureJumpdTm() = dftjumpdTm;
+        ipvp->getRefTodOneOverTemperatureJumpdTp() = dftjumpdTp;
       }
     }
   } 
diff --git a/dG3D/src/dG3DEnhancedStrainIPVariable.h b/dG3D/src/dG3DEnhancedStrainIPVariable.h
index 0f563a3c8..23dbd668e 100644
--- a/dG3D/src/dG3DEnhancedStrainIPVariable.h
+++ b/dG3D/src/dG3DEnhancedStrainIPVariable.h
@@ -255,8 +255,8 @@ class dG3DEnhancedStrainIPVariable : public IPVariable2Enhanced<dG3DIPVariableBa
     virtual const fullMatrix<double> &getRefTodFieldSourcedNonLocalVariable(){return _ipvbulk->getRefTodFieldSourcedNonLocalVariable();}
     virtual const fullMatrix<double> &getConstRefTodMechanicalSourcedNonLocalVariable() const{return _ipvbulk->getConstRefTodMechanicalSourcedNonLocalVariable();}
     virtual fullMatrix<double> &getRefTodMechanicalSourcedNonLocalVariable(){return _ipvbulk->getRefTodMechanicalSourcedNonLocalVariable();}
-    virtual const std::vector<std::vector<const STensor3*> > &getConstRefToLinearSymmetrizationCoupling() const  {return _ipvbulk->getConstRefToLinearSymmetrizationCoupling();};
-    virtual void setConstRefToLinearSymmetrizationCoupling(const STensor3 &eT, int i, int j)  {_ipvbulk->setConstRefToLinearSymmetrizationCoupling(eT,i,j);};
+    virtual const std::vector<const STensor3*> &getConstRefToLinearSymmetrizationCoupling() const  {return _ipvbulk->getConstRefToLinearSymmetrizationCoupling();};
+    virtual void setConstRefToLinearSymmetrizationCoupling(const STensor3 &eT, int i)  {_ipvbulk->setConstRefToLinearSymmetrizationCoupling(eT,i);};
 
 
 
diff --git a/dG3D/src/dG3DIPVariable.cpp b/dG3D/src/dG3DIPVariable.cpp
index b7007ea9b..69606e199 100644
--- a/dG3D/src/dG3DIPVariable.cpp
+++ b/dG3D/src/dG3DIPVariable.cpp
@@ -113,7 +113,7 @@ constitutiveExtraDofDiffusionData::constitutiveExtraDofDiffusionData(const int n
     dOneOverFieldJumpdFieldm.resize(num,num); dOneOverFieldJumpdFieldm.setAll(0.);
     dOneOverFieldJumpdFieldp.resize(num,num); dOneOverFieldJumpdFieldp.setAll(0.);
     interfaceFlux.resize(num,SVector3(0.));
-    linearSymmetrizationCoupling.resize(num,StdSTens3PtTmp);
+    linearSymmetrizationCoupling.resize(num,NULL);
     if(numNonLocalVariable > 0) {
       std::vector<SVector3>        StdSVect3CouplingTmp; StdSVect3CouplingTmp.resize(numNonLocalVariable,SVector3(0.));
       dFluxdNonLocalVariable.resize(num,StdSVect3CouplingTmp);
@@ -1863,12 +1863,8 @@ void PhenomenologicalSMPDG3DIPVariable::restart()
 
 //
 
-ElecTherMechDG3DIPVariableBase::ElecTherMechDG3DIPVariableBase( const bool oninter) : dG3DIPVariable(oninter),
-           Temperature(0.), gradT(0.), fluxT(0.),dPdT(0.), dFluxTdGradT(0.), dFluxTdT(0.), dFluxTdGradV(0.), dFluxTdV(0.), TemperatureJump(0.),interfaceFluxT(0.),
-              Voltage(0.), gradV(0.), fluxV(0.),dPdV(0.), dFluxVdGradV(0.), dFluxVdV(0.), dFluxVdGradT(0.), dFluxVdT(0.), VoltageJump(0.),interfaceFluxV(0.),
-              thermalSource(0.),dThermalSourcedF(0.),dThermalSourcedT(0.)
-	     ,fvJump(0.),fTJump(0.),dfvjumpdvm(0.),dfvjumpdvp(0.),dfvjumpdTm(0.),dfvjumpdTp(0.),dfTjumpdTm(0.), dfTjumpdTp(0.)
-	     ,l10(0.),l20(0.),k10(0.),k20(0.) ,dl10dF(0.),dl20dF(0.),dk10dF(0.),dk20dF(0.),dl10dT(0.),dl20dT(0.),dk10dT(0.),dk20dT(0.),dl20dv(0.),dk10dv(0.)
+ElecTherMechDG3DIPVariableBase::ElecTherMechDG3DIPVariableBase( const bool oninter) : dG3DIPVariable(oninter,0,2),
+              interfaceFluxT(0.),interfaceFluxV(0.),fvJump(0.),dfvjumpdvm(0.),dfvjumpdvp(0.),dfvjumpdTm(0.),dfvjumpdTp(0.),l10(0.),l20(0.),k10(0.),k20(0.) ,dl10dF(0.),dl20dF(0.),dk10dF(0.),dk20dF(0.),dl10dT(0.),dl20dT(0.),dk10dT(0.),dk20dT(0.),dl20dv(0.),dk10dv(0.)
 	     , fT(0.), gradfT(0.), fV(0.), gradfV(0.)
 	     , dgradVdgradfV(0.),dgradVdgradfT(0.),dgradTdgradfV(0.),dgradTdgradfT(0.), dVdfV(0.),dVdfT(0.), dTdfV(0.),dTdfT(0.),dgradVdfV(0.),dgradVdfT(0.),
 	     dgradTdfT(0.),dgradTdfV(0.),fluxjy(0.),djydV(0.),djydgradV(0.),djydT(0.),djydgradT(0.),djydF(0.),jy1(0.),djy1dT(0.),djy1dV(0.),djy1dF(0.)
@@ -1883,32 +1879,32 @@ ElecTherMechDG3DIPVariableBase::ElecTherMechDG3DIPVariableBase( const bool onint
 ElecTherMechDG3DIPVariableBase::ElecTherMechDG3DIPVariableBase(const ElecTherMechDG3DIPVariableBase &source) :
                                                                         dG3DIPVariable(source)
 {
-  Temperature    = source.Temperature;
-  gradT          = source.gradT;
-  fluxT          = source.fluxT;
-  dPdT           = source.dPdT;
-  dFluxTdGradT   = source.dFluxTdGradT ;
-  dFluxTdT       = source.dFluxTdT;
-  dFluxTdGradV   = source.dFluxTdGradV ;
-  dFluxTdV       = source.dFluxTdV;
-  dFluxTdF       = source.dFluxTdF;
-  TemperatureJump= source.TemperatureJump;
+  //Temperature    = source.Temperature;
+  //gradT          = source.gradT;
+  //fluxT          = source.fluxT;
+  //dPdT           = source.dPdT;
+  //dFluxTdGradT   = source.dFluxTdGradT ;
+  //dFluxTdT       = source.dFluxTdT;
+  //dFluxTdGradV   = source.dFluxTdGradV ;
+  //dFluxTdV       = source.dFluxTdV;
+  //dFluxTdF       = source.dFluxTdF;
+  //TemperatureJump= source.TemperatureJump;
   interfaceFluxT = source.interfaceFluxT;
 
-  Voltage        = source.Voltage;
-  gradV          = source.gradV;
-  fluxV          = source.fluxV;
-  dPdV           = source.dPdV;
-  dFluxVdGradV   = source.dFluxVdGradV ;
-  dFluxVdV       = source.dFluxVdV;
-  dFluxVdGradT   = source.dFluxVdGradT ;
-  dFluxVdT       = source.dFluxVdT;
-  dFluxVdF       = source.dFluxVdF;
-  VoltageJump    = source.VoltageJump;
+  //Voltage        = source.Voltage;
+  //gradV          = source.gradV;
+  //fluxV          = source.fluxV;
+  //dPdV           = source.dPdV;
+  //dFluxVdGradV   = source.dFluxVdGradV ;
+  //dFluxVdV       = source.dFluxVdV;
+  //dFluxVdGradT   = source.dFluxVdGradT ;
+  //dFluxVdT       = source.dFluxVdT;
+  //dFluxVdF       = source.dFluxVdF;
+  //VoltageJump    = source.VoltageJump;
   interfaceFluxV = source.interfaceFluxV;
-  thermalSource  = source.thermalSource;
-  dThermalSourcedF = source.dThermalSourcedF;
-  dThermalSourcedT = source.dThermalSourcedT;
+ //thermalSource  = source.thermalSource;
+  //dThermalSourcedF = source.dThermalSourcedF;
+  //dThermalSourcedT = source.dThermalSourcedT;
 
 
   l10		= source.l10;
@@ -1930,13 +1926,13 @@ ElecTherMechDG3DIPVariableBase::ElecTherMechDG3DIPVariableBase(const ElecTherMec
   dk20dF	= source.dk20dF;
 
   fvJump	= source.fvJump;
-  fTJump	= source.fTJump;
+ // fTJump	= source.fTJump;
   dfvjumpdvm	= source.dfvjumpdvm;
   dfvjumpdvp	= source.dfvjumpdvp;
   dfvjumpdTm	= source.dfvjumpdTm;
   dfvjumpdTp	= source.dfvjumpdTp;
-  dfTjumpdTm	= source.dfTjumpdTm;
-  dfTjumpdTp	= source.dfTjumpdTp;
+  //dfTjumpdTm	= source.dfTjumpdTm;
+ // dfTjumpdTp	= source.dfTjumpdTp;
 
 
   fT             = source.fT;
@@ -1980,34 +1976,34 @@ ElecTherMechDG3DIPVariableBase& ElecTherMechDG3DIPVariableBase::operator=(const
   {
   /*  lineark10      = src->lineark10;
     lineark20      = src->lineark20;*/
-    Temperature    = src->Temperature;
-    gradT          = src->gradT;
-    fluxT          = src->fluxT;
-    dPdT           = src-> dPdT;
-    dFluxTdGradT   = src->dFluxTdGradT;
-    dFluxTdT       = src->dFluxTdT;
-    dFluxTdGradV   = src->dFluxTdGradV;
-    dFluxTdV       = src->dFluxTdV;
-    dFluxTdF       = src->dFluxTdF;
-    TemperatureJump= src->TemperatureJump;
+    //Temperature    = src->Temperature;
+    //gradT          = src->gradT;
+    //fluxT          = src->fluxT;
+    //dPdT           = src-> dPdT;
+    //dFluxTdGradT   = src->dFluxTdGradT;
+    //dFluxTdT       = src->dFluxTdT;
+    //dFluxTdGradV   = src->dFluxTdGradV;
+    //dFluxTdV       = src->dFluxTdV;
+    //dFluxTdF       = src->dFluxTdF;
+    //TemperatureJump= src->TemperatureJump;
     interfaceFluxT = src-> interfaceFluxT;
 
    /* linearl10      = src->linearl10;
     linearl20      = src->linearl20;*/
-    Voltage        = src->Voltage;
-    gradV          = src->gradV;
-    fluxV          = src->fluxV;
-    dPdV           = src->dPdV;
-    dFluxVdGradV   = src->dFluxVdGradV;
-    dFluxVdV       = src->dFluxVdV;
-    dFluxVdGradT   = src->dFluxVdGradT;
-    dFluxVdT       = src->dFluxVdT;
-    dFluxVdF       = src->dFluxVdF;
-    VoltageJump    = src->VoltageJump;
+    //Voltage        = src->Voltage;
+    //gradV          = src->gradV;
+    //fluxV          = src->fluxV;
+    //dPdV           = src->dPdV;
+    //dFluxVdGradV   = src->dFluxVdGradV;
+    //dFluxVdV       = src->dFluxVdV;
+    //dFluxVdGradT   = src->dFluxVdGradT;
+    //dFluxVdT       = src->dFluxVdT;
+    //dFluxVdF       = src->dFluxVdF;
+    //VoltageJump    = src->VoltageJump;
     interfaceFluxV = src-> interfaceFluxV;
-    thermalSource  = src-> thermalSource;
-    dThermalSourcedF = src-> dThermalSourcedF;
-    dThermalSourcedT = src-> dThermalSourcedT;
+    //thermalSource  = src-> thermalSource;
+    //dThermalSourcedF = src-> dThermalSourcedF;
+    //dThermalSourcedT = src-> dThermalSourcedT;
 
     l10 	= src->l10;
     l20 	= src->l20;
@@ -2028,13 +2024,13 @@ ElecTherMechDG3DIPVariableBase& ElecTherMechDG3DIPVariableBase::operator=(const
     dk20dF 	= src->dk20dF;
 
     fvJump	= src->fvJump;
-    fTJump	= src->fTJump;
+    //fTJump	= src->fTJump;
     dfvjumpdvm	= src->dfvjumpdvm;
     dfvjumpdvp	= src->dfvjumpdvp;
     dfvjumpdTm	= src->dfvjumpdTm;
     dfvjumpdTp	= src->dfvjumpdTp;
-    dfTjumpdTm	= src->dfTjumpdTm;
-    dfTjumpdTp	= src->dfTjumpdTp;
+    //dfTjumpdTm	= src->dfTjumpdTm;
+    //dfTjumpdTp	= src->dfTjumpdTp;
 
 
     fT             = src->fT;
@@ -2079,15 +2075,15 @@ double ElecTherMechDG3DIPVariableBase::get(const int i) const
   }
   else if(i == IPField::THERMALFLUX_X)
   {
-    return getFluxT(0);
+    return getConstRefToFlux()[0](0);
   }
   else if(i == IPField::THERMALFLUX_Y)
   {
-    return getFluxT(1);
+    return getConstRefToFlux()[0](1);
   }
   else if(i == IPField::THERMALFLUX_Z)
   {
-    return getFluxT(2);
+    return getConstRefToFlux()[0](2);
   }
   else if(i == IPField::VOLTAGE)
   {
@@ -2095,58 +2091,58 @@ double ElecTherMechDG3DIPVariableBase::get(const int i) const
   }
   else if(i == IPField::ELECTRICALFLUX_X)
   {
-    return getFluxV(0);
+    return getConstRefToFlux()[1](0);
   }
   else if(i == IPField::ELECTRICALFLUX_Y)
   {
-    return getFluxV(1);
+    return getConstRefToFlux()[1](1);
   }
   else if(i == IPField::ELECTRICALFLUX_Z)
   {
-    return getFluxV(2);
+    return getConstRefToFlux()[1](2);
   }
   else
   {
     return dG3DIPVariable::get(i);
   }
 }
-//
+
 
 void ElecTherMechDG3DIPVariableBase::restart()
 {
   dG3DIPVariable::restart();
-  restartManager::restart(Temperature);
-  restartManager::restart(gradT);
-  restartManager::restart(fluxT);
-  restartManager::restart(dPdT);
-  restartManager::restart(dFluxTdGradT);
-  restartManager::restart(dFluxTdT);
-  restartManager::restart(dFluxTdGradV);
-  restartManager::restart(dFluxTdV);
-  restartManager::restart(dFluxTdF);
+  //restartManager::restart(Temperature);
+  //restartManager::restart(gradT);
+  //restartManager::restart(fluxT);
+  //restartManager::restart(dPdT);
+  //restartManager::restart(dFluxTdGradT);
+  //restartManager::restart(dFluxTdT);
+  //restartManager::restart(dFluxTdGradV);
+  //restartManager::restart(dFluxTdV);
+  //restartManager::restart(dFluxTdF);
   ///const STensor3               *lineark10; // Nor save nor load
   ///const STensor3               *lineark20; // nor save nor load
-  restartManager::restart(TemperatureJump);
+  //restartManager::restart(TemperatureJump);
   restartManager::restart(interfaceFluxT);
 
-  restartManager::restart(Voltage);
-  restartManager::restart(gradV);
-  restartManager::restart(fluxV);
-  restartManager::restart(dPdV);
-  restartManager::restart(dFluxVdGradV);
-  restartManager::restart(dFluxVdV);
-  restartManager::restart(dFluxVdGradV);
-  restartManager::restart(dFluxVdV);
-  restartManager::restart(dFluxVdGradT);
-  restartManager::restart(dFluxVdT);
-  restartManager::restart(dFluxVdF);
+  //restartManager::restart(Voltage);
+  //restartManager::restart(gradV);
+  //restartManager::restart(fluxV);
+  //restartManager::restart(dPdV);
+  //restartManager::restart(dFluxVdGradV);
+  //restartManager::restart(dFluxVdV);
+  //restartManager::restart(dFluxVdGradV);
+  //restartManager::restart(dFluxVdV);
+  //restartManager::restart(dFluxVdGradT);
+  //restartManager::restart(dFluxVdT);
+  //restartManager::restart(dFluxVdF);
   ///const STensor3               *linearl10;  Nor save nor load
   ///const STensor3               *linearl20;  Nor save nor load
-  restartManager::restart(VoltageJump);
+  //restartManager::restart(VoltageJump);
   restartManager::restart(interfaceFluxV);
-  restartManager::restart(thermalSource);
-  restartManager::restart(dThermalSourcedT);
-  restartManager::restart(dThermalSourcedF);
+  //restartManager::restart(thermalSource);
+  //restartManager::restart(dThermalSourcedT);
+  //restartManager::restart(dThermalSourcedF);
 
   //modified
   restartManager::restart(l10);
@@ -2166,13 +2162,13 @@ void ElecTherMechDG3DIPVariableBase::restart()
   restartManager::restart(dk20dF);
 
   restartManager::restart(fvJump);
-  restartManager::restart(fTJump);
+ //restartManager::restart(fTJump);
   restartManager::restart(dfvjumpdvm);
   restartManager::restart(dfvjumpdvp);
   restartManager::restart(dfvjumpdTm);
   restartManager::restart(dfvjumpdTp);
-  restartManager::restart(dfTjumpdTm);
-  restartManager::restart(dfTjumpdTp);
+  //restartManager::restart(dfTjumpdTm);
+  //restartManager::restart(dfTjumpdTp);
 
   restartManager::restart(fT);
   restartManager::restart(gradfT);
diff --git a/dG3D/src/dG3DIPVariable.h b/dG3D/src/dG3DIPVariable.h
index 26923e1bd..e7d218a58 100644
--- a/dG3D/src/dG3DIPVariable.h
+++ b/dG3D/src/dG3DIPVariable.h
@@ -198,8 +198,8 @@ class dG3DIPVariableBase : public ipFiniteStrain
   virtual fullMatrix<double>  &getRefTodOneOverFieldJumpdFieldp()=0; 
   virtual const std::vector<SVector3>  &getConstRefToInterfaceFlux() const=0; 
   virtual std::vector<SVector3>  &getRefToInterfaceFlux()=0; 
-  virtual const std::vector<std::vector<const STensor3*> > &getConstRefToLinearSymmetrizationCoupling() const =0; 
-  virtual void setConstRefToLinearSymmetrizationCoupling(const STensor3 &eT, int i, int j) =0; 
+  virtual const std::vector<const STensor3*> &getConstRefToLinearSymmetrizationCoupling() const =0; 
+  virtual void setConstRefToLinearSymmetrizationCoupling(const STensor3 &eT, int i) =0; 
   virtual const std::vector<std::vector<SVector3> > & getConstRefTodFluxdNonLocalVariable() const=0;
   virtual std::vector<std::vector<SVector3> > & getRefTodFluxdNonLocalVariable()=0;
   virtual const fullMatrix<double> &getConstRefTodFieldSourcedNonLocalVariable() const=0;
@@ -271,7 +271,7 @@ class constitutiveExtraDofDiffusionData{
   fullMatrix<double>           dOneOverFieldJumpdFieldm;
   fullMatrix<double>           dOneOverFieldJumpdFieldp;
   std::vector<SVector3>        interfaceFlux;
-  std::vector<std::vector<const STensor3*> > linearSymmetrizationCoupling;
+  std::vector< const STensor3* > linearSymmetrizationCoupling;
 
   //coupling with nonLocal
   std::vector<std::vector<SVector3> >       dFluxdNonLocalVariable;
@@ -835,21 +835,21 @@ protected:
     else
       return _constitutiveExtraDofDiffusionData->interfaceFlux;
   }
-  virtual const std::vector<std::vector<const STensor3*> > &getConstRefToLinearSymmetrizationCoupling() const 
+  virtual const std::vector<const STensor3*> &getConstRefToLinearSymmetrizationCoupling() const 
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
       Msg::Fatal("getConstRefToLinearSymmetrizationCoupling() : _constitutiveExtraDofDiffusionData not created");
     else
       return _constitutiveExtraDofDiffusionData->linearSymmetrizationCoupling;
   }
-  virtual void setConstRefToLinearSymmetrizationCoupling(const STensor3 &eT, int i, int j) 
+  virtual void setConstRefToLinearSymmetrizationCoupling(const STensor3 &eT, int i) 
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
       Msg::Fatal("setConstRefToLinearSymmetrizationCoupling() : _constitutiveExtraDofDiffusionData not created");
     else
     { 
-      if(i < getNumConstitutiveExtraDofDiffusionVariable() && j< getNumConstitutiveExtraDofDiffusionVariable())
-         _constitutiveExtraDofDiffusionData->linearSymmetrizationCoupling[i][j] = &eT;
+      if(i < getNumConstitutiveExtraDofDiffusionVariable())
+         _constitutiveExtraDofDiffusionData->linearSymmetrizationCoupling[i] = &eT;
       else
          Msg::Fatal("setConstRefToLinearSymmetrizationCoupling() : index out of range");
     }
@@ -1510,7 +1510,6 @@ class ThermoMechanicsDG3DIPVariableBase : public dG3DIPVariable, public extraDof
   virtual const SVector3 &getConstRefToThermalFlux() const {return getConstRefToFlux()[0];}
   virtual SVector3 &getRefToThermalFlux() {return getRefToFlux()[0];}
 
-  virtual const  STensor3 &getConstRefTodPdT() const {return getConstRefTodPdField()[0];}
   virtual  STensor3 &getRefTodPdT() {return getRefTodPdField()[0];}
 
   virtual const  STensor3 &getConstRefTodThermalFluxdGradT() const {return  getConstRefTodFluxdGradField()[0][0];}
@@ -1525,7 +1524,6 @@ class ThermoMechanicsDG3DIPVariableBase : public dG3DIPVariable, public extraDof
   virtual const double getConstRefToTemperatureJump() const {return getConstRefToFieldJump()(0);}
   virtual double &getRefToTemperatureJump() {return  getRefToFieldJump()(0);}
 
-
   virtual const double getConstRefToOneOverTemperatureJump() const {return getConstRefToOneOverFieldJump()(0);}
   virtual double &getRefToOneOverTemperatureJump() {return  getRefToOneOverFieldJump()(0);}
 
@@ -1535,7 +1533,6 @@ class ThermoMechanicsDG3DIPVariableBase : public dG3DIPVariable, public extraDof
   virtual const double getConstRefTodOneOverTemperatureJumpdFieldp() const {return getConstRefTodOneOverFieldJumpdFieldp()(0,0);}
   virtual double &getRefTodOneOverTemperaturedJumpdFieldp() {return  getRefTodOneOverFieldJumpdFieldp()(0,0);}
 
-
   virtual const double getConstRefToThermalSource() const {return getConstRefToFieldSource()(0);}
   virtual double &getRefToThermalSource() {return  getRefToFieldSource()(0);}
 
@@ -1545,8 +1542,8 @@ class ThermoMechanicsDG3DIPVariableBase : public dG3DIPVariable, public extraDof
   virtual const  STensor3 &getConstRefTodThermalSourcedF() const {return getConstRefTodFieldSourcedF()[0];}
   virtual  STensor3 &getRefTodThermalSourcedF() {return getRefTodFieldSourcedF()[0];}
 	
-  virtual const STensor3 *getConstRefToStiff_alphaDilatation() const {return getConstRefToLinearSymmetrizationCoupling()[0][0];}
-  virtual void setRefToStiff_alphaDilatation(const STensor3 &eT) {setConstRefToLinearSymmetrizationCoupling(eT,0,0);}
+  virtual const STensor3 *getConstRefToStiff_alphaDilatation() const {return getConstRefToLinearSymmetrizationCoupling()[0];}
+  virtual void setRefToStiff_alphaDilatation(const STensor3 &eT) {setConstRefToLinearSymmetrizationCoupling(eT,0);}
 
   virtual const STensor3 *getConstRefToLinearConductivity() const {return getConstRefToLinearK()[0][0];}
   virtual void setRefToLinearConductivity(const STensor3 &eT) {setConstRefToLinearK(eT,0,0);}
@@ -1756,15 +1753,15 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
 
  protected:
 
-  double                       Temperature;
-  SVector3                     gradT;
-  SVector3                     fluxT;
-  STensor3                     dPdT;
-  STensor3                     dFluxTdGradT;
-  SVector3                     dFluxTdT;
-  STensor3                     dFluxTdGradV;
-  SVector3                     dFluxTdV;
-  STensor33                    dFluxTdF;
+ // double                       Temperature;
+ //SVector3                     gradT;
+ //SVector3                     fluxT;
+ //STensor3                     dPdT;
+ //STensor3                     dFluxTdGradT;
+ //SVector3                     dFluxTdT;
+ //STensor3                     dFluxTdGradV;
+ //SVector3                     dFluxTdV;
+ //STensor33                    dFluxTdF;
  // const STensor3               *lineark10;
  // const STensor3               *lineark20;
   STensor3                     k10;
@@ -1776,19 +1773,19 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   STensor43                    dk10dF;
   STensor43                    dk20dF;
  // for dg: jump in non local epl
-  double                       TemperatureJump;
+ // double                       TemperatureJump;
   SVector3                     interfaceFluxT;
 
 
-  double                       Voltage;
-  SVector3                     gradV;
-  SVector3                     fluxV;
-  STensor3                     dPdV;
-  STensor3                     dFluxVdGradV;
-  SVector3                     dFluxVdV;
-  STensor3                     dFluxVdGradT;
-  SVector3                     dFluxVdT;
-  STensor33                    dFluxVdF;
+  //double                       Voltage;
+  //SVector3                     gradV;
+  //SVector3                     fluxV;
+  //STensor3                     dPdV;
+  //STensor3                     dFluxVdGradV;
+  //SVector3                     dFluxVdV;
+  //STensor3                     dFluxVdGradT;
+  //SVector3                     dFluxVdT;
+  //STensor33                    dFluxVdF;
   //const STensor3               *linearl10;
   //const STensor3               *linearl20;
   STensor3                     l10;
@@ -1800,21 +1797,21 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   STensor43                    dl10dF;
   STensor43                    dl20dF;
 
-  double                       thermalSource;
-  double                       dThermalSourcedT;
-  STensor3                     dThermalSourcedF;
+  //double                       thermalSource;
+  //double                       dThermalSourcedT;
+  //STensor3                     dThermalSourcedF;
  // for dg: jump in non local epl
-  double                       VoltageJump;
+  //double                       VoltageJump;
   SVector3                     interfaceFluxV;
 
   double                       fvJump;
-  double                       fTJump;
+  //double                       fTJump;
   double                       dfvjumpdvm;
   double                       dfvjumpdvp;
   double                       dfvjumpdTm;
   double                       dfvjumpdTp;
-  double                       dfTjumpdTm;
-  double                       dfTjumpdTp;
+ //double                       dfTjumpdTm;
+ //double                       dfTjumpdTp;
 
   STensor3 			dgradVdgradfV;
   STensor3 			dgradVdgradfT;
@@ -1844,7 +1841,7 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   STensor3 			djy1dT;
   STensor3 			djy1dV;
   STensor43			djy1dF;
-  const STensor3		*Stiff_alphaDilatation;
+ // const STensor3		*Stiff_alphaDilatation;
 
 
 
@@ -1857,39 +1854,42 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   {
 
   }
+
   virtual double defoEnergy() const=0;
   virtual double plasticEnergy() const=0;
   virtual double damageEnergy() const = 0;
   virtual double get(const int i) const;
 
   // Archiving data to be changed
-  virtual const double &getConstRefToTemperature() const {return  Temperature;}
-  virtual double &getRefToTemperature() {return Temperature;}
 
-  virtual const SVector3 &getConstRefToGradT() const {return gradT;}
-  virtual SVector3 &getRefToGradT() {return gradT;}
+  virtual const double getConstRefToTemperature() const {return getConstRefToField(0);}
+  virtual double &getRefToTemperature() {return getRefToField(0);}
 
-  virtual const SVector3 &getConstRefToFluxT() const {return fluxT;}
-  virtual const double getFluxT(int i) const {return fluxT(i);}
-  virtual SVector3 &getRefToFluxT() {return fluxT;}
+  virtual const SVector3 &getConstRefToGradT() const {return getConstRefToGradField()[0];}
+  virtual SVector3 &getRefToGradT() {return getRefToGradField()[0];}
 
-  virtual const  STensor3 &getConstRefTodPdT() const {return dPdT;}
-  virtual  STensor3 &getRefTodPdT() {return dPdT;}
+  virtual const SVector3 &getConstRefToThermalFlux() const {return getConstRefToFlux()[0];}
+  virtual SVector3 &getRefToThermalFlux() {return getRefToFlux()[0];}
 
-  virtual const  STensor3 &getConstRefTodFluxTdGradT() const {return  dFluxTdGradT;}//dqdgradT,
-  virtual  STensor3 &getRefTodFluxTdGradT() {return  dFluxTdGradT;}
+ //virtual const double getFluxT(int i) const {return fluxT(i);}
 
-  virtual const  SVector3 &getConstRefTodFluxTdV() const {return  dFluxTdV;}
-  virtual  SVector3 &getRefTodFluxTdV() {return  dFluxTdV;}
+  virtual  const STensor3 &getConstRefTodPdT() const {return getConstRefTodPdField()[0];}
+  virtual  STensor3 &getRefTodPdT() {return getRefTodPdField()[0];}
 
-  virtual const  STensor3 &getConstRefTodFluxTdGradV() const {return  dFluxTdGradV;}//dqdgradV,
-  virtual  STensor3 &getRefTodFluxTdGradV() {return  dFluxTdGradV;}
+  virtual const  STensor3 &getConstRefTodThermalFluxdGradT() const {return  getConstRefTodFluxdGradField()[0][0];}
+  virtual  STensor3 &getRefTodThermalFluxdGradT() {return  getRefTodFluxdGradField()[0][0];}
 
-  virtual const  SVector3 &getConstRefTodFluxTdT() const {return  dFluxTdT;}
-  virtual  SVector3 &getRefTodFluxTdT() {return  dFluxTdT;}
+  virtual const  SVector3 &getConstRefTodFluxTdV() const {return  getConstRefTodFluxdField()[0][1];}
+  virtual  SVector3 &getRefTodFluxTdV() {return  getRefTodFluxdField()[0][1];}
 
-  virtual const  STensor33 &getConstRefTodFluxTdF() const {return  dFluxTdF;}
-  virtual  STensor33 &getRefTodFluxTdF() {return  dFluxTdF;}
+  virtual const  STensor3 &getConstRefTodFluxTdGradV() const {return  getConstRefTodFluxdGradField()[0][1];}//dqdgradV,
+  virtual  STensor3 &getRefTodFluxTdGradV() {return  getRefTodFluxdGradField()[0][1];}
+
+  virtual const  SVector3 &getConstRefTodFluxTdT() const {return  getConstRefTodFluxdField()[0][0];}
+  virtual  SVector3 &getRefTodFluxTdT() {return  getRefTodFluxdField()[0][0];}
+
+  virtual const  STensor33 &getConstRefTodThermalFluxdF() const {return  getConstRefTodFluxdF()[0];}
+  virtual  STensor33 &getRefTodThermalFluxdF() {return  getRefTodFluxdF()[0];}
 
   /*virtual const STensor3 &getConstRefTolineark10() const {return *lineark10;}
   virtual void setRefTolineark10(const STensor3 &eT1) {lineark10=&eT1;}
@@ -1897,7 +1897,6 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   virtual const STensor3 &getConstRefTolineark20() const {return *lineark20;}
   virtual void setRefTolineark20(const STensor3 &eT2) {lineark20=&eT2;}*/
 
-
   virtual const  STensor3 &getConstRefToElecConductivity() const {return  l10;}
   virtual  STensor3 &getRefToElecConductivity() {return  l10;}
 
@@ -1943,8 +1942,14 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   virtual const double &getConstRefTofvJump() const {return fvJump;}
   virtual double &getRefTofvJump() {return  fvJump;}
 
-  virtual const double &getConstRefTofTJump() const {return fTJump;}
-  virtual double &getRefTofTJump() {return  fTJump;}
+  virtual const double getConstRefToOneOverTemperatureJump() const {return getConstRefToOneOverFieldJump()(0);}
+  virtual double &getRefToOneOverTemperatureJump() {return  getRefToOneOverFieldJump()(0);}
+
+  virtual const double getConstRefTodOneOverTemperatureJumpdTm() const {return getConstRefTodOneOverFieldJumpdFieldm()(0,0);}
+  virtual double &getRefTodOneOverTemperatureJumpdTm() {return  getRefTodOneOverFieldJumpdFieldm()(0,0);}
+
+  virtual const double getConstRefTodOneOverTemperatureJumpdTp() const {return getConstRefTodOneOverFieldJumpdFieldp()(0,0);}
+  virtual double &getRefTodOneOverTemperatureJumpdTp() {return  getRefTodOneOverFieldJumpdFieldp()(0,0);}
 
   virtual const double &getConstRefTodfvjumpdvm() const {return dfvjumpdvm;}
   virtual double &getRefTodfvjumpdvm() {return  dfvjumpdvm;}
@@ -1958,47 +1963,39 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   virtual const double &getConstRefTodfvjumpdTp() const {return dfvjumpdTp;}
   virtual double &getRefTodfvjumpdTp() {return  dfvjumpdTp;}
 
-  virtual const double &getConstRefTodfTjumpdTp() const {return dfTjumpdTp;}
-  virtual double &getRefTodfTjumpdTp() {return  dfTjumpdTp;}
-
-  virtual const double &getConstRefTodfTjumpdTm() const {return dfTjumpdTm;}
-  virtual double &getRefTodfTjumpdTm() {return  dfTjumpdTm;}
-
-
-  virtual const double &getConstRefToTemperatureJump() const {return TemperatureJump;}
-  virtual double &getRefToTemperatureJump() {return  TemperatureJump;}
+  virtual const double getConstRefToTemperatureJump() const {return getConstRefToFieldJump()(0);}
+  virtual double &getRefToTemperatureJump() {return  getRefToFieldJump()(0);}
 
   virtual const SVector3 &getConstRefTointerfaceFluxT() const {return interfaceFluxT;}   // i didn't use it
   virtual SVector3 &getRefTointerfaceFluxT() {return interfaceFluxT;}
 
   // for V
-  virtual const double &getConstRefToVoltage() const {return  Voltage;}
-  virtual double &getRefToVoltage() {return  Voltage;}
+  virtual const double getConstRefToVoltage() const {return  getConstRefToField(1);}
+  virtual double &getRefToVoltage() {return  getRefToField(1);}
 
-  virtual const SVector3 &getConstRefToGradV() const {return gradV;}
-  virtual SVector3 &getRefToGradV() {return gradV;}
+  virtual const SVector3 &getConstRefToGradV() const {return getConstRefToGradField()[1];}
+  virtual SVector3 &getRefToGradV() {return getRefToGradField()[1];}
 
-  virtual const SVector3 &getConstRefToFluxV() const {return fluxV;}
-  virtual const double getFluxV(int i) const {return fluxV(i);}
-  virtual SVector3 &getRefToFluxV() {return fluxV;}
+  virtual const SVector3 &getConstRefToFluxV() const {return getConstRefToFlux()[1];}
+  virtual SVector3 &getRefToFluxV() {return getRefToFlux()[1];}
 
-  virtual const  STensor3 &getConstRefTodPdV() const {return dPdV;}
-  virtual  STensor3 &getRefTodPdV() {return dPdV;}
+  virtual const  STensor3 &getConstRefTodPdV() const {return getConstRefTodPdField()[1];}
+  virtual  STensor3 &getRefTodPdV() {return getRefTodPdField()[1];}
 
-  virtual const  STensor3 &getConstRefTodFluxVdGradV() const {return  dFluxVdGradV;}//dedgradV
-  virtual  STensor3 &getRefTodFluxVdGradV() {return  dFluxVdGradV;}
+  virtual const  STensor3 &getConstRefTodFluxVdGradV() const {return  getConstRefTodFluxdGradField()[1][1];}//dedgradV
+  virtual  STensor3 &getRefTodFluxVdGradV() {return  getRefTodFluxdGradField()[1][1];}
 
-  virtual const  STensor3 &getConstRefTodFluxVdGradT() const {return  dFluxVdGradT;}//dedgradT
-  virtual  STensor3 &getRefTodFluxVdGradT() {return  dFluxVdGradT;}
+  virtual const  STensor3 &getConstRefTodFluxVdGradT() const {return  getConstRefTodFluxdGradField()[1][0];}//dedgradT
+  virtual  STensor3 &getRefTodFluxVdGradT() {return  getRefTodFluxdGradField()[1][0];}
 
-  virtual const  SVector3 &getConstRefTodFluxVdV() const {return  dFluxVdV;}//dedv
-  virtual  SVector3 &getRefTodFluxVdV() {return  dFluxVdV;}
+  virtual const  SVector3 &getConstRefTodFluxVdV() const {return  getConstRefTodFluxdField()[1][1];}//dedv
+  virtual  SVector3 &getRefTodFluxVdV() {return  getRefTodFluxdField()[1][1];}
 
-  virtual const  SVector3 &getConstRefTodFluxVdT() const {return  dFluxVdT;}//dedv
-  virtual  SVector3 &getRefTodFluxVdT() {return  dFluxVdT;}
+  virtual const  SVector3 &getConstRefTodFluxVdT() const {return  getConstRefTodFluxdField()[1][0];}//dedv
+  virtual  SVector3 &getRefTodFluxVdT() {return  getRefTodFluxdField()[1][0];}
 
-  virtual const  STensor33 &getConstRefTodFluxVdF() const {return  dFluxVdF;}//dedf
-  virtual  STensor33 &getRefTodFluxVdF() {return  dFluxVdF;}
+  virtual const  STensor33 &getConstRefTodFluxVdF() const {return  getConstRefTodFluxdF()[1];}//dedf
+  virtual  STensor33 &getRefTodFluxVdF() {return  getRefTodFluxdF()[1];}
 
  /* virtual const STensor3 &getConstRefTolinearl10() const {return *linearl10;}
   virtual void setRefTolinearl10(const STensor3 &eV1) {linearl10=&eV1;}
@@ -2006,21 +2003,20 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   virtual const STensor3 &getConstRefTolinearl20() const {return *linearl20;}
   virtual void setRefTolinearl20(const STensor3 &eV2) {linearl20=&eV2;}*/
 
-  virtual const double &getConstRefToVoltageJump() const {return VoltageJump;}
-  virtual double &getRefToVoltageJump() {return  VoltageJump;}
+  virtual const double getConstRefToVoltageJump() const {return getConstRefToFieldJump()(1);}
+  virtual double &getRefToVoltageJump() {return  getRefToFieldJump()(1);}
 
   virtual const SVector3 &getConstRefTointerfaceFluxV() const {return interfaceFluxV;}  // i didn't use it
   virtual SVector3 &getRefTointerfaceFluxV() {return interfaceFluxV;}
 
-  virtual const double getConstRefToThermalSource() const {return thermalSource;}
-  virtual double &getRefToThermalSource() {return  thermalSource;}
-
+  virtual const double getConstRefToThermalSource() const {return getConstRefToFieldSource()(0);}
+  virtual double &getRefToThermalSource() {return  getRefToFieldSource()(0);}
 
-  virtual const double getConstRefTodThermalSourcedT() const {return dThermalSourcedT;}//dwdt
-  virtual double &getRefTodThermalSourcedT() {return  dThermalSourcedT;}
+  virtual const double getConstRefTodThermalSourcedT() const {return getConstRefTodFieldSourcedField()(0,0);}
+  virtual double &getRefTodThermalSourcedT() {return  getRefTodFieldSourcedField()(0,0);}
 
-  virtual const  STensor3 &getConstRefTodThermalSourcedF() const {return  dThermalSourcedF;}//dwdf
-  virtual  STensor3 &getRefTodThermalSourcedF() {return  dThermalSourcedF;}
+  virtual const  STensor3 &getConstRefTodThermalSourcedF() const {return getConstRefTodFieldSourcedF()[0];}
+  virtual  STensor3 &getRefTodThermalSourcedF() {return getRefTodFieldSourcedF()[0];}
 
  /* virtual const  SVector3 &getConstRefTodThermalSourcedGradV() const {return  dThermalSourcedGradV;}//dwdgradV
   virtual  SVector3 &getRefTodThermalSourcedGradV() {return  dThermalSourcedGradV;}
@@ -2028,10 +2024,6 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   virtual const  SVector3 &getConstRefTodThermalSourcedGradT() const {return  dThermalSourcedGradT;}//dwdgradT
   virtual  SVector3 &getRefTodThermalSourcedGradT() {return  dThermalSourcedGradT;}*/
 
-
-
-
-
   virtual const double &getConstRefTofT() const {return  fT;}
   virtual double &getRefTofT() {return fT;}
 
@@ -2081,7 +2073,7 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   virtual SVector3  &getRefTodgradTdfV() {return  dgradTdfV;}
 
 
-  virtual const SVector3  &getConstRefToFluxEnergy() const {return fluxjy;}
+   virtual const SVector3  &getConstRefToFluxEnergy() const {return fluxjy;}
    virtual SVector3 &getRefToFluxEnergy(){return  fluxjy;}
 
    virtual const SVector3  &getConstRefTodFluxEnergydV() const {return djydV;}
@@ -2111,11 +2103,11 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
    virtual const STensor43 &getConstRefTodEnergyConductivitydF() const {return djy1dF;}
    virtual STensor43 &getRefTodEnergyConductivitydF(){return djy1dF;}
 
+  /*virtual const STensor3 &getConstRefToStiff_alphaDilatation() const {return *Stiff_alphaDilatation;} // ??
+  virtual void setRefToStiff_alphaDilatation(const STensor3 &eT) {Stiff_alphaDilatation=&eT;}*/
 
-   virtual const STensor3 &getConstRefToStiff_alphaDilatation() const {return *Stiff_alphaDilatation;}
-   virtual void setRefToStiff_alphaDilatation(const STensor3 &eT) {Stiff_alphaDilatation=&eT;}
-
-
+  virtual const STensor3 *getConstRefToStiff_alphaDilatation() const {return getConstRefToLinearSymmetrizationCoupling()[0];}
+  virtual void setRefToStiff_alphaDilatation(const STensor3 &eT) {setConstRefToLinearSymmetrizationCoupling(eT,0);}
 
   virtual IPVariable* clone() const =0;
   virtual void restart();
@@ -2131,7 +2123,7 @@ class LinearElecTherMechDG3DIPVariable : public ElecTherMechDG3DIPVariableBase
 
 public:
   LinearElecTherMechDG3DIPVariable( const bool oninter=false){Msg::Error("LinearElecTherMechDG3DIPVariable: Cannot use the default constructor");}
-	LinearElecTherMechDG3DIPVariable(double tinitial,double vinitial, const bool oninter=false);
+  LinearElecTherMechDG3DIPVariable(double tinitial,double vinitial, const bool oninter=false);
   LinearElecTherMechDG3DIPVariable(const LinearElecTherMechDG3DIPVariable &source);
   LinearElecTherMechDG3DIPVariable& operator=(const IPVariable &source);
 
diff --git a/dG3D/src/dG3DMaterialLaw.cpp b/dG3D/src/dG3DMaterialLaw.cpp
index 82af97a44..3c94d01bd 100644
--- a/dG3D/src/dG3DMaterialLaw.cpp
+++ b/dG3D/src/dG3DMaterialLaw.cpp
@@ -2567,9 +2567,9 @@ void LinearElecTherMechDG3DMaterialLaw::stress(IPVariable* ipv, const IPVariable
 
         STensor3& dPdT=ipvcur->getRefTodPdT();
 	STensor3& dPdV=ipvcur->getRefTodPdV();
-        SVector3& fluxT=ipvcur->getRefToFluxT();
+        SVector3& fluxT=ipvcur->getRefToThermalFlux();
 	SVector3& fluxV=ipvcur->getRefToFluxV();
-        STensor3& dqdgradT=ipvcur->getRefTodFluxTdGradT();
+        STensor3& dqdgradT=ipvcur->getRefTodThermalFluxdGradT();
 	STensor3& dqdgradV=ipvcur->getRefTodFluxTdGradV();
 	STensor3& dedgradV=ipvcur->getRefTodFluxVdGradV();
 	STensor3& dedgradT=ipvcur->getRefTodFluxVdGradT();
@@ -2577,7 +2577,7 @@ void LinearElecTherMechDG3DMaterialLaw::stress(IPVariable* ipv, const IPVariable
 	SVector3& dqdV=ipvcur->getRefTodFluxTdV();
 	SVector3& dedV=ipvcur->getRefTodFluxVdV();
 	SVector3& dedT=ipvcur->getRefTodFluxVdT();
-        STensor33& dqdF=ipvcur->getRefTodFluxTdF();
+        STensor33& dqdF=ipvcur->getRefTodThermalFluxdF();
 	STensor33& dedF=ipvcur->getRefTodFluxVdF();
         STensor3& P=ipvcur->getRefToFirstPiolaKirchhoffStress();
         STensor43& Tangent=ipvcur->getRefToTangentModuli();
@@ -2709,9 +2709,9 @@ void mlawAnIsotropicElecTherMechDG3DMaterialLaw::stress(IPVariable* ipv, const I
   const SVector3& gradV= ipvcur->getConstRefToGradV();
         STensor3& dPdT =ipvcur->getRefTodPdT();
 	STensor3& dPdV =ipvcur->getRefTodPdV();
-        SVector3& fluxT=ipvcur->getRefToFluxT();
+        SVector3& fluxT=ipvcur->getRefToThermalFlux();
 	SVector3& fluxV=ipvcur->getRefToFluxV();
-        STensor3& dqdgradT =ipvcur->getRefTodFluxTdGradT();
+        STensor3& dqdgradT =ipvcur->getRefTodThermalFluxdGradT();
 	STensor3& dqdgradV =ipvcur->getRefTodFluxTdGradV();
 	STensor3& djedgradV=ipvcur->getRefTodFluxVdGradV();
 	STensor3& djedgradT=ipvcur->getRefTodFluxVdGradT();
@@ -2719,7 +2719,7 @@ void mlawAnIsotropicElecTherMechDG3DMaterialLaw::stress(IPVariable* ipv, const I
 	SVector3& dqdV  =ipvcur->getRefTodFluxTdV();
 	SVector3& djedV =ipvcur->getRefTodFluxVdV();
 	SVector3& djedT =ipvcur->getRefTodFluxVdT();
-        STensor33& dqdF =ipvcur->getRefTodFluxTdF();
+        STensor33& dqdF =ipvcur->getRefTodThermalFluxdF();
 	STensor33& djedF=ipvcur->getRefTodFluxVdF();
         STensor3& P=ipvcur->getRefToFirstPiolaKirchhoffStress();
         STensor43& Tangent=ipvcur->getRefToTangentModuli();
@@ -2868,9 +2868,9 @@ void mlawElecSMPDG3DMaterialLaw::stress(IPVariable* ipv, const IPVariable* ipvp,
   const SVector3& gradV= ipvcur->getConstRefToGradV();
         STensor3& dPdT = ipvcur->getRefTodPdT();
 	STensor3& dPdV = ipvcur->getRefTodPdV();
-        SVector3& fluxT= ipvcur->getRefToFluxT();
+        SVector3& fluxT= ipvcur->getRefToThermalFlux();
 	SVector3& fluxV= ipvcur->getRefToFluxV();
-        STensor3& dqdgradT= ipvcur->getRefTodFluxTdGradT();
+        STensor3& dqdgradT= ipvcur->getRefTodThermalFluxdGradT();
 	STensor3& dqdgradV= ipvcur->getRefTodFluxTdGradV();
 	STensor3& dedgradV= ipvcur->getRefTodFluxVdGradV();
 	STensor3& dedgradT= ipvcur->getRefTodFluxVdGradT();
@@ -2878,7 +2878,7 @@ void mlawElecSMPDG3DMaterialLaw::stress(IPVariable* ipv, const IPVariable* ipvp,
 	SVector3& dqdV= ipvcur->getRefTodFluxTdV();
 	SVector3& dedV= ipvcur->getRefTodFluxVdV();
 	SVector3& dedT= ipvcur->getRefTodFluxVdT();
-        STensor33& dqdF= ipvcur->getRefTodFluxTdF();
+        STensor33& dqdF= ipvcur->getRefTodThermalFluxdF();
 	STensor33& dedF= ipvcur->getRefTodFluxVdF();
         STensor3&  P   = ipvcur->getRefToFirstPiolaKirchhoffStress();
         STensor43& Tangent=ipvcur->getRefToTangentModuli();
diff --git a/dG3D/src/dG3DMultiscaleMaterialLaw.cpp b/dG3D/src/dG3DMultiscaleMaterialLaw.cpp
index b9155891f..a3c3d38a3 100644
--- a/dG3D/src/dG3DMultiscaleMaterialLaw.cpp
+++ b/dG3D/src/dG3DMultiscaleMaterialLaw.cpp
@@ -387,7 +387,7 @@ void MultiscaleThermoMechanicsDG3DMaterialLaw::setElasticStiffness(IPVariable* i
   if (dGipv){
     dGipv->setRefToDGElasticTangentModuli(elasticStiffness);
     dGipv->setConstRefToLinearK(this->linearK,0,0);
-    dGipv->setConstRefToLinearSymmetrizationCoupling(this->Stiff_alphaDilatation,0,0);
+    dGipv->setConstRefToLinearSymmetrizationCoupling(this->Stiff_alphaDilatation,0);
   }
   else
     Msg::Fatal("ThermoMechanicsDG3DIPVariableBase must be used");
@@ -398,7 +398,7 @@ void MultiscaleThermoMechanicsDG3DMaterialLaw::initialIPVariable(IPVariable* ipv
   if (dGipv){
     dGipv->setRefToDGElasticTangentModuli(elasticStiffness);
     dGipv->setConstRefToLinearK(this->linearK,0,0);
-    dGipv->setConstRefToLinearSymmetrizationCoupling(this->Stiff_alphaDilatation,0,0);
+    dGipv->setConstRefToLinearSymmetrizationCoupling(this->Stiff_alphaDilatation,0);
 
     dGipv->getRefToTangentModuli() = elasticStiffness;
     dGipv->getRefTodFluxdGradField()[0][0] = linearK;
diff --git a/dG3D/src/dG3DTerms.cpp b/dG3D/src/dG3DTerms.cpp
index 2f48def3e..9dcd7c94f 100644
--- a/dG3D/src/dG3DTerms.cpp
+++ b/dG3D/src/dG3DTerms.cpp
@@ -117,8 +117,10 @@ void dG3DForceBulk::get(MElement *ele,int npts,IntPt *GP,fullVector<double> &vFo
       }
     }
     //extra dof
-    if( vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
-          Msg::Fatal("Your material law uses more constitutive extra dof variables than your domain dG3DForceBulk::get");
+
+    if( vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()==getNumConstitutiveExtraDofDiffusionVariable() ){ //to remove after migration
+    if( vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ){
+          Msg::Fatal("Your material law uses more constitutive extra dof variables than your domain dG3DForceBulk::get");}
     for (int extraDOFField = 0; extraDOFField< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField++){
       const SVector3 &flux =vipv[i]-> getConstRefToFlux()[extraDOFField];
       double w = 0.;
@@ -139,6 +141,7 @@ void dG3DForceBulk::get(MElement *ele,int npts,IntPt *GP,fullVector<double> &vFo
       }
     }
   }
+  }//to remove after migration
   //vFor.print("bulkF");
 }
 
@@ -1010,9 +1013,9 @@ void dG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVector<double>
             k0p = *(ipvp->getConstRefToLinearK()[extraDOFField][extraDOFField]);
 
             static STensor3  Stiff_alphadialitationm;
-            Stiff_alphadialitationm = *(ipvm->getConstRefToLinearSymmetrizationCoupling()[extraDOFField][extraDOFField]);
+            Stiff_alphadialitationm = *(ipvm->getConstRefToLinearSymmetrizationCoupling()[extraDOFField]);
             static STensor3  Stiff_alphadialitationp;
-            Stiff_alphadialitationp = *(ipvp->getConstRefToLinearSymmetrizationCoupling()[extraDOFField][extraDOFField]);
+            Stiff_alphadialitationp = *(ipvp->getConstRefToLinearSymmetrizationCoupling()[extraDOFField]);
             if(getConstitutiveExtraDofDiffusionUseOneOverJump())
             {
               k0m*=(-1.)*fieldm*fieldm;
@@ -1829,9 +1832,9 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
             static STensor3  k0p;
             k0p = *(ipvp->getConstRefToLinearK()[extraDOFField][extraDOFField2]);
             static STensor3  Stiff_alphadialitationm;
-            Stiff_alphadialitationm = *(ipvm->getConstRefToLinearSymmetrizationCoupling()[extraDOFField][extraDOFField2]);
+            Stiff_alphadialitationm = *(ipvm->getConstRefToLinearSymmetrizationCoupling()[extraDOFField]);
             static STensor3  Stiff_alphadialitationp;
-            Stiff_alphadialitationp = *(ipvp->getConstRefToLinearSymmetrizationCoupling()[extraDOFField][extraDOFField2]);
+            Stiff_alphadialitationp = *(ipvp->getConstRefToLinearSymmetrizationCoupling()[extraDOFField]);
             static STensor3  dk0mdFieldm;
             STensorOperation::zero(dk0mdFieldm);
             static STensor3  dk0pdFieldp;
@@ -2250,7 +2253,7 @@ void ElecTherMechDG3DForceBulk::get(MElement *ele,int npts,IntPt *GP,fullVector<
     double ratio = detJ*weight;
     double eqRatio = _ElecTherMechEqRatio;
 
-    const SVector3 &fluxT = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefToFluxT());
+    const SVector3 &fluxT = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefToThermalFlux());
     const SVector3 &fluxV = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefToFluxV());
     const SVector3 &gradV = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefToGradV());
     const double    w     = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefToThermalSource());
@@ -2322,14 +2325,14 @@ void ElecTherMechDG3DStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMat
         const STensor3  &dFluxVdGradT  = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxVdGradT());
         const SVector3  &dFluxVdT      = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxVdT());
         const SVector3  &dFluxTdT      = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxTdT());
-        const STensor3  &dFluxTdGradT  = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxTdGradT());
+        const STensor3  &dFluxTdGradT  = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodThermalFluxdGradT());
         const SVector3  &dFluxTdV      = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxTdV());
         const STensor3  &dFluxTdGradV  = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxTdGradV());
         const STensor3  &dPdV          = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodPdV());
         const STensor3  &dPdT          = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodPdT());
         const SVector3  &gradV         = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefToGradV());
         const SVector3  &FluxV         = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefToFluxV());
-        const STensor33 &dFluxTdF      = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxTdF());
+        const STensor33 &dFluxTdF      = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodThermalFluxdF());
         const STensor33 &dFluxVdF      = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxVdF());
         const double    w              = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefToThermalSource());
         const double    dwdt           = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodThermalSourcedT());
@@ -2688,7 +2691,7 @@ void ElecTherMechDG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVec
           const SVector3 &referenceOutwardNormalm = ipvm->getConstRefToReferenceOutwardNormal();
           const SVector3 &referenceOutwardNormalp = ipvp->getConstRefToReferenceOutwardNormal();
 
-          const double &ftJump =ipvp->getConstRefTofTJump();
+          const double &ftJump =ipvp->getConstRefToOneOverTemperatureJump();
           const double &fvJump =ipvp->getConstRefTofvJump();
 
           const STensor3  &l10m = (ipvm->getConstRefToElecConductivity());
@@ -2707,10 +2710,10 @@ void ElecTherMechDG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVec
 
 
 
-          static STensor3  Stiff_alphadialitationm;
-          Stiff_alphadialitationm = ipvm->getConstRefToStiff_alphaDilatation();
+          static STensor3 Stiff_alphadialitationm;
+          Stiff_alphadialitationm = *ipvm->getConstRefToStiff_alphaDilatation();
           static STensor3  Stiff_alphadialitationp;
-          Stiff_alphadialitationp = ipvp->getConstRefToStiff_alphaDilatation();
+          Stiff_alphadialitationp = *ipvp->getConstRefToStiff_alphaDilatation();
 
           const double &fTp = ipvp->getConstRefTofT();
           const double &fTm = ipvm->getConstRefTofT();
@@ -2922,7 +2925,7 @@ void ElecTherMechDG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVec
 
           const SVector3 &referenceOutwardNormalp = ipvp->getConstRefToReferenceOutwardNormal();
 
-          const double &ftJump =ipvp->getConstRefTofTJump();
+          const double &ftJump =ipvp->getConstRefToOneOverTemperatureJump();
           const double &fvJump =ipvp->getConstRefTofvJump();
 
 
@@ -2941,9 +2944,9 @@ void ElecTherMechDG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVec
           const SVector3  &fluxjyp= (ipvp->getConstRefToFluxEnergy());
 
           static STensor3  Stiff_alphadialitationm;
-          Stiff_alphadialitationm = ipvm->getConstRefToStiff_alphaDilatation();
+          Stiff_alphadialitationm = *ipvm->getConstRefToStiff_alphaDilatation();
           static STensor3  Stiff_alphadialitationp;
-          Stiff_alphadialitationp = ipvp->getConstRefToStiff_alphaDilatation();
+          Stiff_alphadialitationp = *ipvp->getConstRefToStiff_alphaDilatation();
 
           const double &fTp = ipvp->getConstRefTofT();
           const double &fTm = ipvm->getConstRefTofT();
@@ -3210,7 +3213,7 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
 
         if(_useFtFv)
         {
-          const double &ftJump = ipvp->getConstRefTofTJump();
+          const double &ftJump = ipvp->getConstRefToOneOverTemperatureJump();
           const double &fvJump = ipvp->getConstRefTofvJump();
 
           const std::vector<TensorialTraits<double>::GradType> &Gradsm = ipvm->gradf(_minusSpace,ie->getElem(0),GPm[i]);
@@ -3234,9 +3237,9 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
 
 
           static STensor3  Stiff_alphadialitationm;
-          Stiff_alphadialitationm = (ipvm->getConstRefToStiff_alphaDilatation());
+          Stiff_alphadialitationm = *(ipvm->getConstRefToStiff_alphaDilatation());
           static STensor3  Stiff_alphadialitationp;
-          Stiff_alphadialitationp = (ipvp->getConstRefToStiff_alphaDilatation());
+          Stiff_alphadialitationp = *(ipvp->getConstRefToStiff_alphaDilatation());
 
           const double &fTp = ipvp->getConstRefTofT();
           const double &fTm = ipvm->getConstRefTofT();
@@ -4334,7 +4337,7 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
       }
         else
         {
-          const double &ftJump = ipvp->getConstRefTofTJump();
+          const double &ftJump = ipvp->getConstRefToOneOverTemperatureJump();
           const double &fvJump = ipvp->getConstRefTofvJump();
 
           const double &dfvJumpdvm = ipvm->getConstRefTodfvjumpdvm();
@@ -4343,8 +4346,8 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
           const double &dfvJumpdTm = ipvm->getConstRefTodfvjumpdTm();
           const double &dfvJumpdTp = ipvp->getConstRefTodfvjumpdTp();
 
-          const double &dftJumpdTm = ipvm->getConstRefTodfTjumpdTm();
-          const double &dftJumpdTp = ipvp->getConstRefTodfTjumpdTp();
+          const double &dftJumpdTm = ipvm->getConstRefTodOneOverTemperatureJumpdTm();
+          const double &dftJumpdTp = ipvp->getConstRefTodOneOverTemperatureJumpdTp();
 
           //std::vector<TensorialTraits<double>::GradType> &Gradsm = vallm[i]->_vgrads;
           //std::vector<TensorialTraits<double>::GradType> &Gradsp = vallp[i]->_vgrads;
@@ -4368,9 +4371,9 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
 
           //new
           static STensor3  Stiff_alphadialitationm;
-          Stiff_alphadialitationm = (ipvm->getConstRefToStiff_alphaDilatation());
+          Stiff_alphadialitationm = *(ipvm->getConstRefToStiff_alphaDilatation());
           static STensor3  Stiff_alphadialitationp;
-          Stiff_alphadialitationp = (ipvp->getConstRefToStiff_alphaDilatation());
+          Stiff_alphadialitationp = *(ipvp->getConstRefToStiff_alphaDilatation());
 
           const double &Tp = ipvp->getConstRefToTemperature();
           const double &Tm = ipvm->getConstRefToTemperature();
diff --git a/dG3D/src/nonLocalDamageDG3DIPVariable.h b/dG3D/src/nonLocalDamageDG3DIPVariable.h
index edd7e3ff7..cb3d310b6 100644
--- a/dG3D/src/nonLocalDamageDG3DIPVariable.h
+++ b/dG3D/src/nonLocalDamageDG3DIPVariable.h
@@ -501,21 +501,21 @@ class virtualNonLocalDamageDG3DIPVariable : public dG3DIPVariableBase{
     else
       return _constitutiveExtraDofDiffusionData->interfaceFlux;
   }
-  virtual const std::vector<std::vector<const STensor3*> > &getConstRefToLinearSymmetrizationCoupling() const 
+  virtual const std::vector< const STensor3*> &getConstRefToLinearSymmetrizationCoupling() const 
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
       Msg::Fatal("getConstRefToLinearSymmetrizationCoupling() : _constitutiveExtraDofDiffusionData not created");
     else
       return _constitutiveExtraDofDiffusionData->linearSymmetrizationCoupling;
   }
-  virtual void setConstRefToLinearSymmetrizationCoupling(const STensor3 &eT, int i, int j) 
+  virtual void setConstRefToLinearSymmetrizationCoupling(const STensor3 &eT, int i) 
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
       Msg::Fatal("setConstRefToLinearSymmetrizationCoupling() : _constitutiveExtraDofDiffusionData not created");
     else
     { 
-      if(i < getNumConstitutiveExtraDofDiffusionVariable() && j< getNumConstitutiveExtraDofDiffusionVariable())
-         _constitutiveExtraDofDiffusionData->linearSymmetrizationCoupling[i][j] = &eT;
+      if(i < getNumConstitutiveExtraDofDiffusionVariable())
+         _constitutiveExtraDofDiffusionData->linearSymmetrizationCoupling[i] = &eT;
       else
          Msg::Fatal("setConstRefToLinearSymmetrizationCoupling() : index out of range");
     }
@@ -880,7 +880,7 @@ class nonLocalPorosityDG3DIPVariable : public dG3DIPVariable
 
   virtual void restart();
   virtual void setRefToLinearConductivity(const STensor3 &eT) {setConstRefToLinearK(eT,0,0);}
-  virtual void setRefToStiff_alphaDilatation(const STensor3 &eT) {setConstRefToLinearSymmetrizationCoupling(eT,0,0);}
+  virtual void setRefToStiff_alphaDilatation(const STensor3 &eT) {setConstRefToLinearSymmetrizationCoupling(eT,0);}
 protected:
   nonLocalPorosityDG3DIPVariable(const mlawNonLocalPorosity &pLaw, const bool oninter=false, const int numLocalVar = 1, const int numExtraDofDiffusion=0);
 
-- 
GitLab


From 062b0194af6036ac066fc6beb081bdf18a24405e Mon Sep 17 00:00:00 2001
From: pareja <mpareja@uliege.be>
Date: Thu, 15 Nov 2018 09:47:23 +0100
Subject: [PATCH 2/9] Update branch

---
 dG3D/src/FractureCohesiveDG3DIPVariable.h |   4 +
 dG3D/src/dG3DEnhancedStrainIPVariable.h   |   4 +
 dG3D/src/dG3DIPVariable.cpp               | 139 +++++++++--------
 dG3D/src/dG3DIPVariable.h                 | 177 +++++++++++++---------
 dG3D/src/dG3DMaterialLaw.cpp              |  54 +++----
 dG3D/src/dG3DMaterialLaw.h                |   6 +-
 dG3D/src/dG3DTerms.cpp                    |  54 ++++---
 dG3D/src/nonLocalDamageDG3DIPVariable.h   |   4 +
 8 files changed, 249 insertions(+), 193 deletions(-)

diff --git a/dG3D/src/FractureCohesiveDG3DIPVariable.h b/dG3D/src/FractureCohesiveDG3DIPVariable.h
index 7fd339c0d..9cbade9c5 100644
--- a/dG3D/src/FractureCohesiveDG3DIPVariable.h
+++ b/dG3D/src/FractureCohesiveDG3DIPVariable.h
@@ -126,6 +126,10 @@ class FractureCohesive3DIPVariable : public IPVariable2ForFracture<dG3DIPVariabl
   virtual std::vector<STensor33>   &getRefTodFluxdF() {return _ipvbulk->getRefTodFluxdF();};
   virtual const std::vector<std::vector<const STensor3*> > &getConstRefToLinearK() const {return _ipvbulk->getConstRefToLinearK();};
   virtual void setConstRefToLinearK(const STensor3 &eT, int i, int j)  {_ipvbulk->setConstRefToLinearK(eT, i, j);};
+  virtual const std::vector<std::vector<STensor3> >  &getConstRefTodLinearKdField() const {return _ipvbulk->getConstRefTodLinearKdField();}; 
+  virtual std::vector<std::vector<STensor3> >  &getRefTodLinearKdField() {return _ipvbulk->getRefTodLinearKdField();}; 
+  virtual const std::vector<STensor43>  &getConstRefTodLinearKdF() const {return _ipvbulk->getConstRefTodLinearKdF();}; 
+  virtual std::vector<STensor43>  &getRefTodLinearKdF() {return _ipvbulk->getRefTodLinearKdF();}; 
   virtual const fullVector<double>  &getConstRefToFieldSource() const {return _ipvbulk->getConstRefToFieldSource();};
   virtual fullVector<double>  &getRefToFieldSource() {return _ipvbulk->getRefToFieldSource();};
   virtual const fullMatrix<double>  &getConstRefTodFieldSourcedField() const {return _ipvbulk->getConstRefTodFieldSourcedField();};
diff --git a/dG3D/src/dG3DEnhancedStrainIPVariable.h b/dG3D/src/dG3DEnhancedStrainIPVariable.h
index 23dbd668e..444ef608d 100644
--- a/dG3D/src/dG3DEnhancedStrainIPVariable.h
+++ b/dG3D/src/dG3DEnhancedStrainIPVariable.h
@@ -220,6 +220,10 @@ class dG3DEnhancedStrainIPVariable : public IPVariable2Enhanced<dG3DIPVariableBa
     virtual std::vector<STensor33>   &getRefTodFluxdF() {return _ipvbulk->getRefTodFluxdF();};
     virtual const std::vector<std::vector<const STensor3*> > &getConstRefToLinearK() const {return _ipvbulk->getConstRefToLinearK();};
     virtual void setConstRefToLinearK(const STensor3 &eT, int i, int j)  {_ipvbulk->setConstRefToLinearK(eT, i, j);};
+    virtual const std::vector<std::vector<STensor3> >  &getConstRefTodLinearKdField() const {return _ipvbulk->getConstRefTodLinearKdField();}; 
+    virtual std::vector<std::vector<STensor3> >  &getRefTodLinearKdField() {return _ipvbulk->getRefTodLinearKdField();}; 
+    virtual const std::vector<STensor43>  &getConstRefTodLinearKdF() const {return _ipvbulk->getConstRefTodLinearKdF();}; 
+    virtual std::vector<STensor43>  &getRefTodLinearKdF() {return _ipvbulk->getRefTodLinearKdF();}; 
     virtual const fullVector<double>  &getConstRefToFieldSource() const {return _ipvbulk->getConstRefToFieldSource();};
     virtual fullVector<double>  &getRefToFieldSource() {return _ipvbulk->getRefToFieldSource();};
     virtual const fullMatrix<double>  &getConstRefTodFieldSourcedField() const {return _ipvbulk->getConstRefTodFieldSourcedField();};
diff --git a/dG3D/src/dG3DIPVariable.cpp b/dG3D/src/dG3DIPVariable.cpp
index 69606e199..fc759130a 100644
--- a/dG3D/src/dG3DIPVariable.cpp
+++ b/dG3D/src/dG3DIPVariable.cpp
@@ -1864,10 +1864,9 @@ void PhenomenologicalSMPDG3DIPVariable::restart()
 //
 
 ElecTherMechDG3DIPVariableBase::ElecTherMechDG3DIPVariableBase( const bool oninter) : dG3DIPVariable(oninter,0,2),
-              interfaceFluxT(0.),interfaceFluxV(0.),fvJump(0.),dfvjumpdvm(0.),dfvjumpdvp(0.),dfvjumpdTm(0.),dfvjumpdTp(0.),l10(0.),l20(0.),k10(0.),k20(0.) ,dl10dF(0.),dl20dF(0.),dk10dF(0.),dk20dF(0.),dl10dT(0.),dl20dT(0.),dk10dT(0.),dk20dT(0.),dl20dv(0.),dk10dv(0.)
-	     , fT(0.), gradfT(0.), fV(0.), gradfV(0.)
+              fvJump(0.),dfvjumpdvm(0.),dfvjumpdvp(0.),dfvjumpdTm(0.),dfvjumpdTp(0.),fT(0.), gradfT(0.), fV(0.), gradfV(0.)
 	     , dgradVdgradfV(0.),dgradVdgradfT(0.),dgradTdgradfV(0.),dgradTdgradfT(0.), dVdfV(0.),dVdfT(0.), dTdfV(0.),dTdfT(0.),dgradVdfV(0.),dgradVdfT(0.),
-	     dgradTdfT(0.),dgradTdfV(0.),fluxjy(0.),djydV(0.),djydgradV(0.),djydT(0.),djydgradT(0.),djydF(0.),jy1(0.),djy1dT(0.),djy1dV(0.),djy1dF(0.)
+	     dgradTdfT(0.),dgradTdfV(0.),jy1(0.),djy1dT(0.),djy1dV(0.),djy1dF(0.)
 
 {
 
@@ -1889,7 +1888,7 @@ ElecTherMechDG3DIPVariableBase::ElecTherMechDG3DIPVariableBase(const ElecTherMec
   //dFluxTdV       = source.dFluxTdV;
   //dFluxTdF       = source.dFluxTdF;
   //TemperatureJump= source.TemperatureJump;
-  interfaceFluxT = source.interfaceFluxT;
+  //interfaceFluxT = source.interfaceFluxT;
 
   //Voltage        = source.Voltage;
   //gradV          = source.gradV;
@@ -1901,29 +1900,29 @@ ElecTherMechDG3DIPVariableBase::ElecTherMechDG3DIPVariableBase(const ElecTherMec
   //dFluxVdT       = source.dFluxVdT;
   //dFluxVdF       = source.dFluxVdF;
   //VoltageJump    = source.VoltageJump;
-  interfaceFluxV = source.interfaceFluxV;
+  //interfaceFluxV = source.interfaceFluxV;
  //thermalSource  = source.thermalSource;
   //dThermalSourcedF = source.dThermalSourcedF;
   //dThermalSourcedT = source.dThermalSourcedT;
 
 
-  l10		= source.l10;
-  l20		= source.l20;
-  k10		= source.k10;
-  k20		= source.k20;
+  //l10		= source.l10;
+  //l20		= source.l20;
+  //k10		= source.k10;
+  //k20		= source.k20;
 
-  dl10dT	= source.dl10dT;
-  dl20dT	= source.dl20dT;
-  dk10dT	= source.dk10dT;
-  dk20dT	= source.dk20dT;
+  //dl10dT	= source.dl10dT;
+  //dl20dT	= source.dl20dT;
+  //dk10dT	= source.dk10dT;
+  //dk20dT	= source.dk20dT;
 
-  dl20dv	= source.dl20dv;
-  dk10dv	= source.dk10dv;
+  //dl20dv	= source.dl20dv;
+  //dk10dv	= source.dk10dv;
 
-  dl10dF	= source.dl10dF;
-  dl20dF	= source.dl20dF;
-  dk10dF	= source.dk10dF;
-  dk20dF	= source.dk20dF;
+  //dl10dF	= source.dl10dF;
+  //dl20dF	= source.dl20dF;
+  //dk10dF	= source.dk10dF;
+  //dk20dF	= source.dk20dF;
 
   fvJump	= source.fvJump;
  // fTJump	= source.fTJump;
@@ -1954,12 +1953,12 @@ ElecTherMechDG3DIPVariableBase::ElecTherMechDG3DIPVariableBase(const ElecTherMec
   dgradTdfV	= source.dgradTdfV;
 
 
-  fluxjy	= source.fluxjy;
-  djydV 	= source.djydV;
-  djydgradV	= source.djydgradV;
-  djydT		= source.djydT;
-  djydgradT	= source.djydgradT;
-  djydF		= source.djydF;
+  //fluxjy	= source.fluxjy;
+  //djydV 	= source.djydV;
+  //djydgradV	= source.djydgradV;
+  //djydT		= source.djydT;
+  //djydgradT	= source.djydgradT;
+  //djydF		= source.djydF;
   jy1		= source.jy1;
   djy1dT	= source.djy1dT;
   djy1dV	= source.djy1dV;
@@ -1986,7 +1985,7 @@ ElecTherMechDG3DIPVariableBase& ElecTherMechDG3DIPVariableBase::operator=(const
     //dFluxTdV       = src->dFluxTdV;
     //dFluxTdF       = src->dFluxTdF;
     //TemperatureJump= src->TemperatureJump;
-    interfaceFluxT = src-> interfaceFluxT;
+    //interfaceFluxT = src-> interfaceFluxT;
 
    /* linearl10      = src->linearl10;
     linearl20      = src->linearl20;*/
@@ -2000,28 +1999,28 @@ ElecTherMechDG3DIPVariableBase& ElecTherMechDG3DIPVariableBase::operator=(const
     //dFluxVdT       = src->dFluxVdT;
     //dFluxVdF       = src->dFluxVdF;
     //VoltageJump    = src->VoltageJump;
-    interfaceFluxV = src-> interfaceFluxV;
+    //interfaceFluxV = src-> interfaceFluxV;
     //thermalSource  = src-> thermalSource;
     //dThermalSourcedF = src-> dThermalSourcedF;
     //dThermalSourcedT = src-> dThermalSourcedT;
 
-    l10 	= src->l10;
-    l20 	= src->l20;
-    k10 	= src->k10;
-    k20 	= src->k20;
+    //l10 	= src->l10;
+    //l20 	= src->l20;
+    //k10 	= src->k10;
+    //k20 	= src->k20;
 
-    dl10dT 	= src->dl10dT;
-    dl20dT 	= src->dl20dT;
-    dk10dT 	= src->dk10dT;
-    dk20dT 	= src->dk20dT;
+    //dl10dT 	= src->dl10dT;
+    //dl20dT 	= src->dl20dT;
+    //dk10dT 	= src->dk10dT;
+    //dk20dT 	= src->dk20dT;
 
-    dl20dv 	= src->dl20dv;
-    dk10dv 	= src->dk10dv;
+    //dl20dv 	= src->dl20dv;
+    //dk10dv 	= src->dk10dv;
 
-    dl10dF 	= src->dl10dF;
-    dl20dF 	= src->dl20dF;
-    dk10dF 	= src->dk10dF;
-    dk20dF 	= src->dk20dF;
+    //dl10dF 	= src->dl10dF;
+    //dl20dF 	= src->dl20dF;
+    //dk10dF 	= src->dk10dF;
+    //dk20dF 	= src->dk20dF;
 
     fvJump	= src->fvJump;
     //fTJump	= src->fTJump;
@@ -2051,12 +2050,12 @@ ElecTherMechDG3DIPVariableBase& ElecTherMechDG3DIPVariableBase::operator=(const
     dgradTdfT	= src->dgradTdfT;
     dgradTdfV	= src->dgradTdfV;
 
-    fluxjy	= src->fluxjy;
-    djydV	=src->djydV;
-    djydgradV	= src->djydgradV;
-    djydT	= src->djydT;
-    djydgradT	= src->djydgradT;
-    djydF	= src->djydF;
+    //fluxjy	= src->fluxjy;
+    //djydV	=src->djydV;
+    //djydgradV	= src->djydgradV;
+    //djydT	= src->djydT;
+    //djydgradT	= src->djydgradT;
+    //djydF	= src->djydF;
     jy1		= src->jy1;
     djy1dT	=src->djy1dT;
     djy1dV	=src->djy1dV;
@@ -2123,7 +2122,7 @@ void ElecTherMechDG3DIPVariableBase::restart()
   ///const STensor3               *lineark10; // Nor save nor load
   ///const STensor3               *lineark20; // nor save nor load
   //restartManager::restart(TemperatureJump);
-  restartManager::restart(interfaceFluxT);
+  //restartManager::restart(interfaceFluxT);
 
   //restartManager::restart(Voltage);
   //restartManager::restart(gradV);
@@ -2139,27 +2138,27 @@ void ElecTherMechDG3DIPVariableBase::restart()
   ///const STensor3               *linearl10;  Nor save nor load
   ///const STensor3               *linearl20;  Nor save nor load
   //restartManager::restart(VoltageJump);
-  restartManager::restart(interfaceFluxV);
+  //restartManager::restart(interfaceFluxV);
   //restartManager::restart(thermalSource);
   //restartManager::restart(dThermalSourcedT);
   //restartManager::restart(dThermalSourcedF);
 
   //modified
-  restartManager::restart(l10);
-  restartManager::restart(l20);
-  restartManager::restart(k10);
-  restartManager::restart(k20);
-  restartManager::restart(dl10dT);
-  restartManager::restart(dl20dT);
-  restartManager::restart(dk10dT);
-  restartManager::restart(dk20dT);
-  restartManager::restart(dk10dv);
-  restartManager::restart(dl20dv);
-
-  restartManager::restart(dl10dF);
-  restartManager::restart(dl20dF);
-  restartManager::restart(dk10dF);
-  restartManager::restart(dk20dF);
+  //restartManager::restart(l10);
+  //restartManager::restart(l20);
+  //restartManager::restart(k10);
+  //restartManager::restart(k20);
+  //restartManager::restart(dl10dT);
+  //restartManager::restart(dl20dT);
+  //restartManager::restart(dk10dT);
+  //restartManager::restart(dk20dT);
+  //restartManager::restart(dk10dv);
+  //restartManager::restart(dl20dv);
+
+  //restartManager::restart(dl10dF);
+  //restartManager::restart(dl20dF);
+  //restartManager::restart(dk10dF);
+  //restartManager::restart(dk20dF);
 
   restartManager::restart(fvJump);
  //restartManager::restart(fTJump);
@@ -2188,12 +2187,12 @@ void ElecTherMechDG3DIPVariableBase::restart()
   restartManager::restart(dgradTdfT);
   restartManager::restart(dgradTdfV);
 
-  restartManager::restart(fluxjy);
-  restartManager::restart(djydV);
-  restartManager::restart(djydgradV);
-  restartManager::restart(djydT);
-  restartManager::restart(djydgradT);
-  restartManager::restart(djydF);
+  //restartManager::restart(fluxjy);
+  //restartManager::restart(djydV);
+  //restartManager::restart(djydgradV);
+  //restartManager::restart(djydT);
+  //restartManager::restart(djydgradT);
+  //restartManager::restart(djydF);
   restartManager::restart(jy1);
   restartManager::restart(djy1dT);
   restartManager::restart(djy1dV);
diff --git a/dG3D/src/dG3DIPVariable.h b/dG3D/src/dG3DIPVariable.h
index e7d218a58..ea8450d8e 100644
--- a/dG3D/src/dG3DIPVariable.h
+++ b/dG3D/src/dG3DIPVariable.h
@@ -170,6 +170,10 @@ class dG3DIPVariableBase : public ipFiniteStrain
   virtual std::vector<STensor33>   &getRefTodFluxdF()=0; 
   virtual const std::vector<std::vector<const STensor3*> > &getConstRefToLinearK() const =0; 
   virtual void setConstRefToLinearK(const STensor3 &eT, int i, int j) =0; 
+  virtual const std::vector<std::vector<STensor3> >  &getConstRefTodLinearKdField() const=0; 
+  virtual std::vector<std::vector<STensor3> >  &getRefTodLinearKdField()=0; 
+  virtual const std::vector<STensor43>  &getConstRefTodLinearKdF() const=0; 
+  virtual std::vector<STensor43>  &getRefTodLinearKdF()=0; 
   virtual const fullVector<double>  &getConstRefToFieldSource() const=0; 
   virtual fullVector<double>  &getRefToFieldSource()=0; 
   virtual const fullMatrix<double>  &getConstRefTodFieldSourcedField() const=0; 
@@ -253,6 +257,8 @@ class constitutiveExtraDofDiffusionData{
   std::vector<std::vector<SVector3> >        dFluxdField;
   std::vector<STensor33>       dFluxdF;
   std::vector<std::vector<const STensor3*> > linearK;
+  std::vector<std::vector<STensor3>> dlinearKdField;
+  std::vector<STensor43> dlinearKdF;
   fullVector<double>           fieldSource;  //related to cp*dT/dt
   fullMatrix<double>           dFieldSourcedField;
   std::vector<std::vector<SVector3> >        dFieldSourcedGradField;
@@ -279,6 +285,7 @@ class constitutiveExtraDofDiffusionData{
   fullMatrix<double>          dMechanicalSourcedNonLocalVariable;
 
 
+
  public:
   constitutiveExtraDofDiffusionData(const int numVer, const int numNonLocal=0);
   constitutiveExtraDofDiffusionData(const constitutiveExtraDofDiffusionData& src);
@@ -639,6 +646,34 @@ protected:
          Msg::Fatal("getConstRefTolinearK() : index out of range");
     }
   }
+  virtual const std::vector< std::vector<STensor3> >  &getConstRefTodLinearKdField() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefTodFluxdGradField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dlinearKdField;
+  }
+  virtual std::vector<std::vector<STensor3> >  &getRefTodLinearKdField()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefTodFluxdGradField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dlinearKdField;
+  }
+  virtual const std::vector<STensor43>  &getConstRefTodLinearKdF() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefTodFluxdGradField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dlinearKdF;
+  }
+  virtual std::vector<STensor43>  &getRefTodLinearKdF()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefTodFluxdGradField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dlinearKdF;
+  }
   virtual const fullVector<double>  &getConstRefToFieldSource() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
@@ -1764,17 +1799,17 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
  //STensor33                    dFluxTdF;
  // const STensor3               *lineark10;
  // const STensor3               *lineark20;
-  STensor3                     k10;
-  STensor3                     k20;
-  STensor3                     dk10dT;
-  STensor3                     dk20dT;
-  STensor3                     dk10dv;
-
-  STensor43                    dk10dF;
-  STensor43                    dk20dF;
+ // STensor3                     k10;
+ //STensor3                     k20;
+  //STensor3                     dk10dT;
+  //STensor3                     dk20dT;
+  //STensor3                     dk10dv;
+
+  //STensor43                    dk10dF;
+  //STensor43                    dk20dF;
  // for dg: jump in non local epl
  // double                       TemperatureJump;
-  SVector3                     interfaceFluxT;
+  //SVector3                     interfaceFluxT; //should be interfaceFluxJy
 
 
   //double                       Voltage;
@@ -1788,21 +1823,21 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   //STensor33                    dFluxVdF;
   //const STensor3               *linearl10;
   //const STensor3               *linearl20;
-  STensor3                     l10;
-  STensor3                     l20;
-  STensor3                     dl10dT;
-  STensor3                     dl20dT;
-  STensor3                     dl20dv;
+  //STensor3                     l10;
+  //STensor3                     l20;
+  //STensor3                     dl10dT;
+  //STensor3                     dl20dT;
+  //STensor3                     dl20dv;
 
-  STensor43                    dl10dF;
-  STensor43                    dl20dF;
+  //STensor43                    dl10dF;
+  //STensor43                    dl20dF;
 
   //double                       thermalSource;
   //double                       dThermalSourcedT;
   //STensor3                     dThermalSourcedF;
  // for dg: jump in non local epl
   //double                       VoltageJump;
-  SVector3                     interfaceFluxV;
+  //SVector3                     interfaceFluxV;
 
   double                       fvJump;
   //double                       fTJump;
@@ -1831,12 +1866,12 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   SVector3                      gradfT;
   SVector3                      gradfV;
 
-  SVector3 			fluxjy;
-  SVector3 			djydV;
-  STensor3 			djydgradV;
-  SVector3 			djydT;
-  STensor3 			djydgradT;
-  STensor33 			djydF;
+  //SVector3 			fluxjy;
+  //SVector3 			djydV;
+  //STensor3 			djydgradV;
+  //SVector3 			djydT;
+  //STensor3 			djydgradT;
+  //STensor33 			djydF;
   STensor3 			jy1;
   STensor3 			djy1dT;
   STensor3 			djy1dV;
@@ -1871,8 +1906,6 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   virtual const SVector3 &getConstRefToThermalFlux() const {return getConstRefToFlux()[0];}
   virtual SVector3 &getRefToThermalFlux() {return getRefToFlux()[0];}
 
- //virtual const double getFluxT(int i) const {return fluxT(i);}
-
   virtual  const STensor3 &getConstRefTodPdT() const {return getConstRefTodPdField()[0];}
   virtual  STensor3 &getRefTodPdT() {return getRefTodPdField()[0];}
 
@@ -1897,47 +1930,53 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   virtual const STensor3 &getConstRefTolineark20() const {return *lineark20;}
   virtual void setRefTolineark20(const STensor3 &eT2) {lineark20=&eT2;}*/
 
-  virtual const  STensor3 &getConstRefToElecConductivity() const {return  l10;}
+ /* virtual const  STensor3 &getConstRefToElecConductivity() const {return  l10;}
   virtual  STensor3 &getRefToElecConductivity() {return  l10;}
 
   virtual const  STensor3 &getConstRefToCrossElecConductivity() const {return  l20;}
-  virtual  STensor3 &getRefToCrossElecConductivity() {return  l20;}
+  virtual  STensor3 &getRefToCrossElecConductivity() {return  l20;}*/
+
+  virtual const  STensor3 *getConstRefToElecConductivity() const {return getConstRefToLinearK()[1][1];}
+  virtual void setRefToElecConductivity(const STensor3 &eT) {return  setConstRefToLinearK(eT,1,1);}
 
-  virtual const  STensor3 &getConstRefToTherConductivity() const {return  k10;}
-  virtual  STensor3 &getRefToTherConductivity() {return  k10;}
+  virtual const  STensor3 *getConstRefToCrossElecConductivity() const {return getConstRefToLinearK()[1][0];}
+  virtual void setRefToCrossElecConductivity(const STensor3 &eT) {return  setConstRefToLinearK(eT,1,0);}
 
-  virtual const  STensor3 &getConstRefToCrossTherConductivity() const {return  k20;}
-  virtual  STensor3 &getRefToCrossTherConductivity() {return  k20;}
+  virtual const  STensor3 *getConstRefToTherConductivity() const {return getConstRefToLinearK()[0][0];}
+  virtual void setRefToTherConductivity(const STensor3 &eT) {return  setConstRefToLinearK(eT,0,0);}
 
-  virtual const  STensor3 &getConstRefTodElecConductivitydT() const {return  dl10dT;}
-  virtual  STensor3 &getRefTodElecConductivitydT() {return  dl10dT;}
+  virtual const  STensor3 *getConstRefToCrossTherConductivity() const {return getConstRefToLinearK()[0][1];}
+  virtual void setRefToCrossTherConductivity(const STensor3 &eT) {return  setConstRefToLinearK(eT,0,1);}
 
-  virtual const  STensor3 &getConstRefTodCrossElecConductivitydT() const {return  dl20dT;}
-  virtual  STensor3 &getRefTodCrossElecConductivitydT() {return  dl20dT;}
+  virtual const  STensor3 &getConstRefTodElecConductivitydT() const {return  getConstRefTodLinearKdField()[2][0];}
+  virtual  STensor3 &getRefTodElecConductivitydT() {return  getRefTodLinearKdField()[2][0];}
 
-  virtual const  STensor3 &getConstRefTodTherConductivitydT() const {return  dk10dT;}
-  virtual  STensor3 &getRefTodTherConductivitydT() {return  dk10dT;}
+  virtual const  STensor3 &getConstRefTodCrossElecConductivitydT() const {return  getConstRefTodLinearKdField()[3][0];}
+  virtual  STensor3 &getRefTodCrossElecConductivitydT() {return  getRefTodLinearKdField()[3][0];}
 
-  virtual const  STensor3 &getConstRefTodCrossTherConductivitydT() const {return  dk20dT;}
-  virtual  STensor3 &getRefTodCrossTherConductivitydT() {return  dk20dT;}
+  virtual const  STensor3 &getConstRefTodTherConductivitydT() const {return  getConstRefTodLinearKdField()[0][0];}
+  virtual  STensor3 &getRefTodTherConductivitydT() {return  getRefTodLinearKdField()[0][0];}
 
-  virtual const  STensor3 &getConstRefTodTherConductivitydv() const {return  dk10dv;}
-  virtual  STensor3 &getRefTodTherConductivitydv() {return  dk10dv;}
+  virtual const  STensor3 &getConstRefTodCrossTherConductivitydT() const {return  getConstRefTodLinearKdField()[1][0];}
+  virtual  STensor3 &getRefTodCrossTherConductivitydT() {return  getRefTodLinearKdField()[1][0];}
 
-  virtual const  STensor3 &getConstRefTodCrossElecConductivitydv() const {return  dl20dv;}
-  virtual  STensor3 &getRefTodCrossElecConductivitydv() {return  dl20dv;}
+  virtual const  STensor3 &getConstRefTodTherConductivitydv() const {return  getConstRefTodLinearKdField()[0][1];}
+  virtual  STensor3 &getRefTodTherConductivitydv() {return  getRefTodLinearKdField()[0][1];}
 
-  virtual const  STensor43 &getConstRefTodElecConductivitydF() const {return  dl10dF;}
-  virtual  STensor43 &getRefTodElecConductivitydF() {return  dl10dF;}
+  virtual const  STensor3 &getConstRefTodCrossElecConductivitydv() const {return  getConstRefTodLinearKdField()[3][1];}
+  virtual  STensor3 &getRefTodCrossElecConductivitydv() {return  getRefTodLinearKdField()[3][1];}
 
-  virtual const  STensor43 &getConstRefTodCrossElecConductivitydF() const {return  dl20dF;}
-  virtual  STensor43 &getRefTodCrossElecConductivitydF() {return  dl20dF;}
+  virtual const  STensor43 &getConstRefTodElecConductivitydF() const {return  getConstRefTodLinearKdF()[2];}
+  virtual  STensor43 &getRefTodElecConductivitydF() {return  getRefTodLinearKdF()[2];}
 
-  virtual const  STensor43 &getConstRefTodTherConductivitydF() const {return  dk10dF;}
-  virtual  STensor43 &getRefTodTherConductivitydF() {return  dk10dF;}
+  virtual const  STensor43 &getConstRefTodCrossElecConductivitydF() const {return  getConstRefTodLinearKdF()[3];}
+  virtual  STensor43 &getRefTodCrossElecConductivitydF() {return  getRefTodLinearKdF()[3];}
 
-  virtual const  STensor43 &getConstRefTodCrossTherConductivitydF() const {return  dk20dF;}
-  virtual  STensor43 &getRefTodCrossTherConductivitydF() {return  dk20dF;}
+  virtual const  STensor43 &getConstRefTodTherConductivitydF() const {return  getConstRefTodLinearKdF()[0];}
+  virtual  STensor43 &getRefTodTherConductivitydF() {return  getRefTodLinearKdF()[0];}
+
+  virtual const  STensor43 &getConstRefTodCrossTherConductivitydF() const {return  getConstRefTodLinearKdF()[1];}
+  virtual  STensor43 &getRefTodCrossTherConductivitydF() {return  getRefTodLinearKdF()[1];}
 
   virtual const double &getConstRefTofvJump() const {return fvJump;}
   virtual double &getRefTofvJump() {return  fvJump;}
@@ -1966,8 +2005,8 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   virtual const double getConstRefToTemperatureJump() const {return getConstRefToFieldJump()(0);}
   virtual double &getRefToTemperatureJump() {return  getRefToFieldJump()(0);}
 
-  virtual const SVector3 &getConstRefTointerfaceFluxT() const {return interfaceFluxT;}   // i didn't use it
-  virtual SVector3 &getRefTointerfaceFluxT() {return interfaceFluxT;}
+  virtual const SVector3 &getConstRefTointerfaceFluxT() const {return getConstRefToInterfaceFlux()[0];}   // i didn't use it
+  virtual SVector3 &getRefTointerfaceFluxT() {return getRefToInterfaceFlux()[0];}
 
   // for V
   virtual const double getConstRefToVoltage() const {return  getConstRefToField(1);}
@@ -2006,8 +2045,8 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   virtual const double getConstRefToVoltageJump() const {return getConstRefToFieldJump()(1);}
   virtual double &getRefToVoltageJump() {return  getRefToFieldJump()(1);}
 
-  virtual const SVector3 &getConstRefTointerfaceFluxV() const {return interfaceFluxV;}  // i didn't use it
-  virtual SVector3 &getRefTointerfaceFluxV() {return interfaceFluxV;}
+  virtual const SVector3 &getConstRefTointerfaceFluxV() const {return getConstRefToInterfaceFlux()[1];}  // i didn't use it
+  virtual SVector3 &getRefTointerfaceFluxV() {return getRefToInterfaceFlux()[1];}
 
   virtual const double getConstRefToThermalSource() const {return getConstRefToFieldSource()(0);}
   virtual double &getRefToThermalSource() {return  getRefToFieldSource()(0);}
@@ -2072,24 +2111,23 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   virtual const SVector3  &getConstRefTodgradTdfV() const {return dgradTdfV;}
   virtual SVector3  &getRefTodgradTdfV() {return  dgradTdfV;}
 
+   virtual const SVector3  &getConstRefToFluxEnergy() const {return getConstRefToFlux()[0];}
+   virtual SVector3 &getRefToFluxEnergy(){return  getRefToFlux()[0];}
 
-   virtual const SVector3  &getConstRefToFluxEnergy() const {return fluxjy;}
-   virtual SVector3 &getRefToFluxEnergy(){return  fluxjy;}
-
-   virtual const SVector3  &getConstRefTodFluxEnergydV() const {return djydV;}
-   virtual SVector3 &getRefTodFluxEnergydV(){return  djydV;}
+   virtual const SVector3  &getConstRefTodFluxEnergydV() const {return getConstRefTodFluxdField()[0][1];}
+   virtual SVector3 &getRefTodFluxEnergydV(){return  getRefTodFluxdField()[0][1];}
 
-   virtual const STensor3 &getConstRefTodFluxEnergydGradV() const {return djydgradV;}
-   virtual STensor3 &getRefTodFluxEnergydGradV(){return  djydgradV;}
+   virtual const STensor3 &getConstRefTodFluxEnergydGradV() const {return getConstRefTodFluxdGradField()[0][1];}
+   virtual STensor3 &getRefTodFluxEnergydGradV(){return  getRefTodFluxdGradField()[0][1];}
 
-   virtual const SVector3  &getConstRefTodFluxEnergydT() const {return djydT;}
-   virtual SVector3 &getRefTodFluxEnergydT(){return  djydT;}
+   virtual const SVector3  &getConstRefTodFluxEnergydT() const {return getConstRefTodFluxdField()[0][0];}
+   virtual SVector3 &getRefTodFluxEnergydT(){return  getRefTodFluxdField()[0][0];}
 
-   virtual const STensor3 &getConstRefTodFluxEnergydGradT() const {return djydgradT;}
-   virtual STensor3 &getRefTodFluxEnergydGradT(){return  djydgradT;}
+   virtual const STensor3 &getConstRefTodFluxEnergydGradT() const {return getConstRefTodFluxdGradField()[0][0];}
+   virtual STensor3 &getRefTodFluxEnergydGradT(){return  getRefTodFluxdGradField()[0][0];}
 
-   virtual const STensor33 &getConstRefTodFluxEnergydF() const {return djydF;}
-   virtual STensor33 &getRefTodFluxEnergydF(){return  djydF;}
+   virtual const STensor33 &getConstRefTodFluxEnergydF() const {return getConstRefTodFluxdF()[0];}
+   virtual STensor33 &getRefTodFluxEnergydF(){return  getRefTodFluxdF()[0];}
 
    virtual const STensor3 &getConstRefToEnergyConductivity() const {return jy1;}
    virtual STensor3 &getRefToEnergyConductivity(){return  jy1;}
@@ -2103,9 +2141,6 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
    virtual const STensor43 &getConstRefTodEnergyConductivitydF() const {return djy1dF;}
    virtual STensor43 &getRefTodEnergyConductivitydF(){return djy1dF;}
 
-  /*virtual const STensor3 &getConstRefToStiff_alphaDilatation() const {return *Stiff_alphaDilatation;} // ??
-  virtual void setRefToStiff_alphaDilatation(const STensor3 &eT) {Stiff_alphaDilatation=&eT;}*/
-
   virtual const STensor3 *getConstRefToStiff_alphaDilatation() const {return getConstRefToLinearSymmetrizationCoupling()[0];}
   virtual void setRefToStiff_alphaDilatation(const STensor3 &eT) {setConstRefToLinearSymmetrizationCoupling(eT,0);}
 
diff --git a/dG3D/src/dG3DMaterialLaw.cpp b/dG3D/src/dG3DMaterialLaw.cpp
index 66f1f095b..8b62feb59 100644
--- a/dG3D/src/dG3DMaterialLaw.cpp
+++ b/dG3D/src/dG3DMaterialLaw.cpp
@@ -2571,14 +2571,14 @@ void LinearElecTherMechDG3DMaterialLaw::stress(IPVariable* ipv, const IPVariable
 
         STensor3& dPdT=ipvcur->getRefTodPdT();
 	STensor3& dPdV=ipvcur->getRefTodPdV();
-        SVector3& fluxT=ipvcur->getRefToThermalFlux();
+        SVector3  fluxT=ipvcur->getRefToThermalFlux();
 	SVector3& fluxV=ipvcur->getRefToFluxV();
         STensor3& dqdgradT=ipvcur->getRefTodThermalFluxdGradT();
-	STensor3& dqdgradV=ipvcur->getRefTodFluxTdGradV();
+	STensor3  dqdgradV=ipvcur->getRefTodFluxTdGradV();
 	STensor3& dedgradV=ipvcur->getRefTodFluxVdGradV();
 	STensor3& dedgradT=ipvcur->getRefTodFluxVdGradT();
-        SVector3& dqdT=ipvcur->getRefTodFluxTdT();
-	SVector3& dqdV=ipvcur->getRefTodFluxTdV();
+        SVector3  dqdT=ipvcur->getRefTodFluxTdT();
+	SVector3  dqdV=ipvcur->getRefTodFluxTdV();
 	SVector3& dedV=ipvcur->getRefTodFluxVdV();
 	SVector3& dedT=ipvcur->getRefTodFluxVdT();
         STensor33& dqdF=ipvcur->getRefTodThermalFluxdF();
@@ -2589,10 +2589,10 @@ void LinearElecTherMechDG3DMaterialLaw::stress(IPVariable* ipv, const IPVariable
 	double &dwdt = ipvcur->getRefTodThermalSourcedT();
 	STensor3& dwdf = ipvcur->getRefTodThermalSourcedF();
 
-	STensor3& k10 = ipvcur->getRefToTherConductivity();
-	STensor3& k20 = ipvcur->getRefToCrossTherConductivity();
-	STensor3& l10 = ipvcur->getRefToElecConductivity();
-	STensor3& l20 = ipvcur->getRefToCrossElecConductivity();
+	ipvcur->setRefToTherConductivity(this->lineark10);
+        ipvcur->setRefToCrossTherConductivity(this->lineark20);
+	ipvcur->setRefToElecConductivity(this->linearl10);
+        ipvcur->setRefToCrossElecConductivity(this->linearl20);
 	STensor3& dk10dT = ipvcur->getRefTodTherConductivitydT();
 	STensor3& dk20dT = ipvcur->getRefTodCrossTherConductivitydT();
 	STensor3& dl10dT = ipvcur->getRefTodElecConductivitydT();
@@ -2620,7 +2620,7 @@ void LinearElecTherMechDG3DMaterialLaw::stress(IPVariable* ipv, const IPVariable
   const IPLinearElecTherMech* q0 = ipvprev->getIPLinearElecTherMech();
 
 _lawLinearETM->constitutive(  F0,Fn,P, q0, q1, Tangent,T0, temperature, voltage,gradT, gradV, fluxT,fluxV, dPdT,dPdV, dqdgradT,dqdT, dqdgradV,dqdV,
-			      dedV,dedgradV,dedT,dedgradT,dqdF,dedF,w,dwdt,dwdf,l10,l20,k10,k20,dl10dT,dl20dT,dk10dT,dk20dT,dl20dv,dk10dv,dl10dF,dl20dF,dk10dF,dk20dF
+			      dedV,dedgradV,dedT,dedgradT,dqdF,dedF,w,dwdt,dwdf,linearl10,linearl20,lineark10,lineark20,dl10dT,dl20dT,dk10dT,dk20dT,dl20dv,dk10dv,dl10dF,dl20dF,dk10dF,dk20dF
 			      ,fluxjy,djydV,djydgradV,djydT,djydgradT,djydF,jy1,djy1dT,djy1dV,djy1dF,stiff);
 
 
@@ -2713,14 +2713,14 @@ void mlawAnIsotropicElecTherMechDG3DMaterialLaw::stress(IPVariable* ipv, const I
   const SVector3& gradV= ipvcur->getConstRefToGradV();
         STensor3& dPdT =ipvcur->getRefTodPdT();
 	STensor3& dPdV =ipvcur->getRefTodPdV();
-        SVector3& fluxT=ipvcur->getRefToThermalFlux();
+        SVector3  fluxT=ipvcur->getRefToThermalFlux();
 	SVector3& fluxV=ipvcur->getRefToFluxV();
         STensor3& dqdgradT =ipvcur->getRefTodThermalFluxdGradT();
-	STensor3& dqdgradV =ipvcur->getRefTodFluxTdGradV();
+	STensor3 dqdgradV =ipvcur->getRefTodFluxTdGradV();
 	STensor3& djedgradV=ipvcur->getRefTodFluxVdGradV();
 	STensor3& djedgradT=ipvcur->getRefTodFluxVdGradT();
-        SVector3& dqdT  =ipvcur->getRefTodFluxTdT();
-	SVector3& dqdV  =ipvcur->getRefTodFluxTdV();
+        SVector3  dqdT  =ipvcur->getRefTodFluxTdT();
+	SVector3  dqdV  =ipvcur->getRefTodFluxTdV();
 	SVector3& djedV =ipvcur->getRefTodFluxVdV();
 	SVector3& djedT =ipvcur->getRefTodFluxVdT();
         STensor33& dqdF =ipvcur->getRefTodThermalFluxdF();
@@ -2731,10 +2731,10 @@ void mlawAnIsotropicElecTherMechDG3DMaterialLaw::stress(IPVariable* ipv, const I
 	double &dwdT = ipvcur->getRefTodThermalSourcedT();
 	STensor3& dwdf = ipvcur->getRefTodThermalSourcedF();
 
-	STensor3& k10 = ipvcur->getRefToTherConductivity();
-	STensor3& k20 = ipvcur->getRefToCrossTherConductivity();
-	STensor3& l10 = ipvcur->getRefToElecConductivity();
-	STensor3& l20 = ipvcur->getRefToCrossElecConductivity();
+	ipvcur->setRefToTherConductivity(this->Kref10);
+        ipvcur->setRefToCrossTherConductivity(this->Kref20);
+	ipvcur->setRefToElecConductivity(this->Lref10);
+        ipvcur->setRefToCrossElecConductivity(this->Lref20);
 	STensor3& dk10dT = ipvcur->getRefTodTherConductivitydT();
 	STensor3& dk20dT = ipvcur->getRefTodCrossTherConductivitydT();
 	STensor3& dl10dT = ipvcur->getRefTodElecConductivitydT();
@@ -2763,7 +2763,7 @@ void mlawAnIsotropicElecTherMechDG3DMaterialLaw::stress(IPVariable* ipv, const I
   const IPAnIsotropicElecTherMech* q0 = ipvprev->getIPAnIsotropicElecTherMech();
 
 _lawETM->constitutive(  F0,Fn,P, q0, q1, Tangent, T0, temperature, voltage,gradT, gradV, fluxT,fluxV, dPdT,dPdV, dqdgradT,dqdT, dqdgradV,dqdV,
-	                djedV,djedgradV,djedT,djedgradT,dqdF,djedF,w,dwdT,dwdf,l10,l20,k10,k20,dl10dT,dl20dT,dk10dT,dk20dT,
+	                djedV,djedgradV,djedT,djedgradT,dqdF,djedF,w,dwdT,dwdf,Lref10,Lref20,Kref10,Kref20,dl10dT,dl20dT,dk10dT,dk20dT,
 			dl20dv,dk10dv,dl10dF,dl20dF,dk10dF,dk20dF,fluxjy,djydV,djydgradV,djydT,djydgradT,djydF,jy1,djy1dT,djy1dV,djy1dF,stiff);
 
 
@@ -2872,14 +2872,14 @@ void mlawElecSMPDG3DMaterialLaw::stress(IPVariable* ipv, const IPVariable* ipvp,
   const SVector3& gradV= ipvcur->getConstRefToGradV();
         STensor3& dPdT = ipvcur->getRefTodPdT();
 	STensor3& dPdV = ipvcur->getRefTodPdV();
-        SVector3& fluxT= ipvcur->getRefToThermalFlux();
+        SVector3  fluxT= ipvcur->getRefToThermalFlux();
 	SVector3& fluxV= ipvcur->getRefToFluxV();
         STensor3& dqdgradT= ipvcur->getRefTodThermalFluxdGradT();
-	STensor3& dqdgradV= ipvcur->getRefTodFluxTdGradV();
+	STensor3  dqdgradV= ipvcur->getRefTodFluxTdGradV();
 	STensor3& dedgradV= ipvcur->getRefTodFluxVdGradV();
 	STensor3& dedgradT= ipvcur->getRefTodFluxVdGradT();
-        SVector3& dqdT= ipvcur->getRefTodFluxTdT();
-	SVector3& dqdV= ipvcur->getRefTodFluxTdV();
+        SVector3  dqdT= ipvcur->getRefTodFluxTdT();
+	SVector3  dqdV= ipvcur->getRefTodFluxTdV();
 	SVector3& dedV= ipvcur->getRefTodFluxVdV();
 	SVector3& dedT= ipvcur->getRefTodFluxVdT();
         STensor33& dqdF= ipvcur->getRefTodThermalFluxdF();
@@ -2890,10 +2890,10 @@ void mlawElecSMPDG3DMaterialLaw::stress(IPVariable* ipv, const IPVariable* ipvp,
 	double &dwdT   = ipvcur->getRefTodThermalSourcedT();
 	STensor3& dwdf = ipvcur->getRefTodThermalSourcedF();
 
-	STensor3& k10 = ipvcur->getRefToTherConductivity();
-	STensor3& k20 = ipvcur->getRefToCrossTherConductivity();
-	STensor3& l10 = ipvcur->getRefToElecConductivity();
-	STensor3& l20 = ipvcur->getRefToCrossElecConductivity();
+	ipvcur->setRefToTherConductivity(this->K10);
+        ipvcur->setRefToCrossTherConductivity(this->K20);
+	ipvcur->setRefToElecConductivity(this->L10);
+        ipvcur->setRefToCrossElecConductivity(this->L20);
 	STensor3& dk10dT = ipvcur->getRefTodTherConductivitydT();
 	STensor3& dk20dT = ipvcur->getRefTodCrossTherConductivitydT();
 	STensor3& dl10dT = ipvcur->getRefTodElecConductivitydT();
@@ -2924,7 +2924,7 @@ void mlawElecSMPDG3DMaterialLaw::stress(IPVariable* ipv, const IPVariable* ipvp,
   const IPElecSMP* q0 = ipvprev->getIPElecSMP();
 
   _lawETMSMP->constitutive(  F0,Fn,P, q0, q1, Tangent, T0, temperature, voltage,gradT, gradV, fluxT,fluxV, dPdT,dPdV, dqdgradT,dqdT, dqdgradV,dqdV,
-			      dedV,dedgradV,dedT,dedgradT,dqdF,dedF,w,dwdT,dwdf,l10,l20,k10,k20,dl10dT,dl20dT,dk10dT,dk20dT
+			      dedV,dedgradV,dedT,dedgradT,dqdF,dedF,w,dwdT,dwdf,L10,L20,K10,K20,dl10dT,dl20dT,dk10dT,dk20dT
 			      ,dl20dv,dk10dv,dl10dF,dl20dF,dk10dF,dk20dF,fluxjy,djydV,djydgradV,djydT,djydgradT,djydF,jy1,djy1dT,djy1dV,djy1dF,stiff);
 
 
diff --git a/dG3D/src/dG3DMaterialLaw.h b/dG3D/src/dG3DMaterialLaw.h
index 8e73142ad..62214f840 100644
--- a/dG3D/src/dG3DMaterialLaw.h
+++ b/dG3D/src/dG3DMaterialLaw.h
@@ -1098,7 +1098,7 @@ class LinearElecTherMechDG3DMaterialLaw : public dG3DMaterialLaw // public mater
  protected:
   mlawLinearElecTherMech *_lawLinearETM; // pointer to allow to choose between LLN style or Gmsh Style. The choice is performed by the constructor (2 constructors with != arguments)
   STensor3 	         Stiff_alphaDilatation;
- // STensor3                lineark10, lineark20, linearl10, linearl20;
+  STensor3                lineark10, lineark20, linearl10, linearl20;
  public:
   LinearElecTherMechDG3DMaterialLaw(const int num,const double rho,const double Ex, const double Ey, const double Ez, const double Vxy, const double Vxz, const double Vyz,
 		const double MUxy, const double MUxz, const double MUyz, const double alpha, const double beta, const double gamma,const double t0,const double Kx,
@@ -1151,7 +1151,7 @@ class mlawAnIsotropicElecTherMechDG3DMaterialLaw :public dG3DMaterialLaw
 
  // pointer to allow to choose between LLN style or Gmsh Style. The choice is performed by the constructor (2 constructors with != arguments)
  //modified
-  //STensor3                Kref10, Kref20, Lref10, Lref20;
+  STensor3                Kref10, Kref20, Lref10, Lref20;
  public:
 
 
@@ -1204,7 +1204,7 @@ class mlawElecSMPDG3DMaterialLaw :public dG3DMaterialLaw
    STensor3	 Stiff_alphaDilatation;
  // pointer to allow to choose between LLN style or Gmsh Style. The choice is performed by the constructor (2 constructors with != arguments)
 //modified
- //STensor3                K10, K20, L10, L20;
+ STensor3                K10, K20, L10, L20;
  public:
 
 
diff --git a/dG3D/src/dG3DTerms.cpp b/dG3D/src/dG3DTerms.cpp
index 9dcd7c94f..751ada164 100644
--- a/dG3D/src/dG3DTerms.cpp
+++ b/dG3D/src/dG3DTerms.cpp
@@ -276,6 +276,7 @@ void dG3DStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
         }
       }
       if( vipv[i]->getNumberNonLocalVariable()>getNumNonLocalVariable() )  Msg::Fatal("Your material law uses more non local variables than your domain dG3DStiffnessBulk::get");
+    if( vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()==getNumConstitutiveExtraDofDiffusionVariable() ){ //to remove after migration
       if( vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
             Msg::Fatal("Your material law uses more constitutive extra dof variables than your domain dG3DStiffnessBulk::get");
 			
@@ -442,6 +443,7 @@ void dG3DStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
       }
     }
   //mStiff.print("bulk");
+  }//to remove after migration
   }
   else
     printf("not implemented\n");
@@ -990,6 +992,8 @@ void dG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVector<double>
           }
         }
         // constitutive extra dof
+
+    if( ipvm->getNumConstitutiveExtraDofDiffusionVariable()==getNumConstitutiveExtraDofDiffusionVariable() ){ //to remove after migration
         if( ipvm->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
             Msg::Fatal("Your material law uses more constitutive extra dof variables than your domain dG3DForceInter::get");
         if( ipvp->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
@@ -1107,6 +1111,7 @@ void dG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVector<double>
             }
 	  }
         }
+  }//to remove after migration
         //
       }
       else //broken case
@@ -1135,8 +1140,8 @@ void dG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVector<double>
         }
       }
     }
+   }
     //m.print("Force inter");
-  }
 }
 
 void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double> &stiff) const
@@ -1355,6 +1360,7 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
           }
         }
         // Here we have extra dof part
+ if( ipvm->getNumConstitutiveExtraDofDiffusionVariable()==getNumConstitutiveExtraDofDiffusionVariable() ){ //to remove after migration
         if( ipvm->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
             Msg::Fatal("Your material law uses more constitutive extra dof variable than your domain dG3DStiffnessInter::get");
         if( ipvp->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
@@ -1364,6 +1370,7 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
         for (int extraDOFField = 0; extraDOFField< ipvp->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField++){
             Msg::Fatal("Need to implement the stiffness matrix related to the CZM/CBM and constitutiveExtraDOFVariable dG3DStiffnessInter::get");
         }
+}//to remove after migration
       }
       else
       {
@@ -1790,6 +1797,8 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
 //
         }
         // constitutive extra dof
+
+      if( ipvm->getNumConstitutiveExtraDofDiffusionVariable()==getNumConstitutiveExtraDofDiffusionVariable() ){//to remove after migration
         if( ipvm->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
             Msg::Fatal("Your material law uses more constitutive extra dof variable than your domain dG3DStiffnessInter::get");
         if( ipvp->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
@@ -2210,6 +2219,7 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
 //
           }
         }
+}//to remove after migration
       }
     }
   }
@@ -2253,7 +2263,7 @@ void ElecTherMechDG3DForceBulk::get(MElement *ele,int npts,IntPt *GP,fullVector<
     double ratio = detJ*weight;
     double eqRatio = _ElecTherMechEqRatio;
 
-    const SVector3 &fluxT = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefToThermalFlux());
+//    const SVector3 &fluxT = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefToThermalFlux());
     const SVector3 &fluxV = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefToFluxV());
     const SVector3 &gradV = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefToGradV());
     const double    w     = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefToThermalSource());
@@ -2324,10 +2334,10 @@ void ElecTherMechDG3DStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMat
         const SVector3  &dFluxVdV      = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxVdV());
         const STensor3  &dFluxVdGradT  = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxVdGradT());
         const SVector3  &dFluxVdT      = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxVdT());
-        const SVector3  &dFluxTdT      = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxTdT());
-        const STensor3  &dFluxTdGradT  = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodThermalFluxdGradT());
-        const SVector3  &dFluxTdV      = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxTdV());
-        const STensor3  &dFluxTdGradV  = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxTdGradV());
+    //  const SVector3  &dFluxTdT      = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxTdT());
+    //  const STensor3  &dFluxTdGradT  = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodThermalFluxdGradT());
+    //  const SVector3  &dFluxTdV      = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxTdV());
+    //  const STensor3  &dFluxTdGradV  = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxTdGradV());
         const STensor3  &dPdV          = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodPdV());
         const STensor3  &dPdT          = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodPdT());
         const SVector3  &gradV         = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefToGradV());
@@ -2694,11 +2704,11 @@ void ElecTherMechDG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVec
           const double &ftJump =ipvp->getConstRefToOneOverTemperatureJump();
           const double &fvJump =ipvp->getConstRefTofvJump();
 
-          const STensor3  &l10m = (ipvm->getConstRefToElecConductivity());
-          const STensor3  &l10p = (ipvp->getConstRefToElecConductivity());
+          const STensor3  l10m = *(ipvm->getConstRefToElecConductivity());
+          const STensor3  l10p = *(ipvp->getConstRefToElecConductivity());
 
-          const STensor3  &l20m = (ipvm->getConstRefToCrossElecConductivity());
-          const STensor3  &l20p = (ipvp->getConstRefToCrossElecConductivity());
+          const STensor3  l20m = *(ipvm->getConstRefToCrossElecConductivity());
+          const STensor3  l20p = *(ipvp->getConstRefToCrossElecConductivity());
 
           const SVector3  &fluxVm = (ipvm->getConstRefToFluxV());
           const SVector3  &fluxVp = (ipvp->getConstRefToFluxV());
@@ -2929,11 +2939,11 @@ void ElecTherMechDG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVec
           const double &fvJump =ipvp->getConstRefTofvJump();
 
 
-          const STensor3  &l10m = (ipvm->getConstRefToElecConductivity());
-          const STensor3  &l10p = (ipvp->getConstRefToElecConductivity());
+          const STensor3  l10m = *(ipvm->getConstRefToElecConductivity());
+          const STensor3  l10p = *(ipvp->getConstRefToElecConductivity());
 
-          const STensor3  &l20m = (ipvm->getConstRefToCrossElecConductivity());
-          const STensor3  &l20p = (ipvp->getConstRefToCrossElecConductivity());
+          const STensor3  l20m = *(ipvm->getConstRefToCrossElecConductivity());
+          const STensor3  l20p = *(ipvp->getConstRefToCrossElecConductivity());
 
           const SVector3  &fluxVm = (ipvm->getConstRefToFluxV());
           const SVector3  &fluxVp = (ipvp->getConstRefToFluxV());
@@ -3261,10 +3271,10 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
             const STensor3  *dPdVm     = &(ipvm->getConstRefTodPdV());
             const STensor3  *dPdVp     = &(ipvp->getConstRefTodPdV());
 
-            const STensor3  *l10m      = &(ipvm->getConstRefToElecConductivity());
-            const STensor3  *l10p      = &(ipvp->getConstRefToElecConductivity());
-            const STensor3  *l20m      = &(ipvm->getConstRefToCrossElecConductivity());
-            const STensor3  *l20p      = &(ipvp->getConstRefToCrossElecConductivity());
+            const STensor3  *l10m      = (ipvm->getConstRefToElecConductivity());
+            const STensor3  *l10p      = (ipvp->getConstRefToElecConductivity());
+            const STensor3  *l20m      = (ipvm->getConstRefToCrossElecConductivity());
+            const STensor3  *l20p      = (ipvp->getConstRefToCrossElecConductivity());
 
             const STensor3  *dl10dTm   = &(ipvm->getConstRefTodElecConductivitydT());
             const STensor3  *dl10dTp   = &(ipvp->getConstRefTodElecConductivitydT());
@@ -4396,10 +4406,10 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
             const STensor3  *dPdVm     = &(ipvm->getConstRefTodPdV());
             const STensor3  *dPdVp     = &(ipvp->getConstRefTodPdV());
 
-            const STensor3  *l10m = &(ipvm->getConstRefToElecConductivity());
-            const STensor3  *l10p = &(ipvp->getConstRefToElecConductivity());
-            const STensor3  *l20m = &(ipvm->getConstRefToCrossElecConductivity());
-            const STensor3  *l20p = &(ipvp->getConstRefToCrossElecConductivity());
+            const STensor3  *l10m = (ipvm->getConstRefToElecConductivity());
+            const STensor3  *l10p = (ipvp->getConstRefToElecConductivity());
+            const STensor3  *l20m = (ipvm->getConstRefToCrossElecConductivity());
+            const STensor3  *l20p = (ipvp->getConstRefToCrossElecConductivity());
 
             const STensor3  *dl10dTm = &(ipvm->getConstRefTodElecConductivitydT());
             const STensor3  *dl10dTp = &(ipvp->getConstRefTodElecConductivitydT());
diff --git a/dG3D/src/nonLocalDamageDG3DIPVariable.h b/dG3D/src/nonLocalDamageDG3DIPVariable.h
index cfc812dc5..e74d9264d 100644
--- a/dG3D/src/nonLocalDamageDG3DIPVariable.h
+++ b/dG3D/src/nonLocalDamageDG3DIPVariable.h
@@ -179,6 +179,10 @@ class virtualNonLocalDamageDG3DIPVariable : public dG3DIPVariableBase{
     virtual void restart();
 
   // extradof
+  virtual const std::vector<std::vector<STensor3> >  &getConstRefTodLinearKdField() const {return _ipvBase->getConstRefTodLinearKdField();}; 
+  virtual std::vector<std::vector<STensor3> >  &getRefTodLinearKdField() {return _ipvBase->getRefTodLinearKdField();}; 
+  virtual const std::vector<STensor43>  &getConstRefTodLinearKdF() const {return _ipvBase->getConstRefTodLinearKdF();}; 
+  virtual std::vector<STensor43>  &getRefTodLinearKdF() {return _ipvBase->getRefTodLinearKdF();}; 
   virtual int getNumConstitutiveExtraDofDiffusionVariable() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-- 
GitLab


From a5fc7b39f7840525658d9a0350646cdb9124c272 Mon Sep 17 00:00:00 2001
From: pareja <mpareja@uliege.be>
Date: Fri, 23 Nov 2018 11:52:10 +0100
Subject: [PATCH 3/9] migrate the internal variables

---
 dG3D/src/FractureCohesiveDG3DIPVariable.h |  33 +-
 dG3D/src/dG3DEnhancedStrainIPVariable.h   |  35 +-
 dG3D/src/dG3DIPVariable.cpp               | 209 +++++-----
 dG3D/src/dG3DIPVariable.h                 | 449 ++++++++++++++++------
 dG3D/src/dG3DMaterialLaw.cpp              |   6 +-
 dG3D/src/dG3DMaterialLaw.h                |   6 +-
 dG3D/src/dG3DTerms.cpp                    |  16 +-
 dG3D/src/nonLocalDamageDG3DIPVariable.h   | 146 ++++++-
 8 files changed, 663 insertions(+), 237 deletions(-)

diff --git a/dG3D/src/FractureCohesiveDG3DIPVariable.h b/dG3D/src/FractureCohesiveDG3DIPVariable.h
index 628da40ee..c47e49b44 100644
--- a/dG3D/src/FractureCohesiveDG3DIPVariable.h
+++ b/dG3D/src/FractureCohesiveDG3DIPVariable.h
@@ -130,10 +130,16 @@ class FractureCohesive3DIPVariable : public IPVariable2ForFracture<dG3DIPVariabl
   virtual std::vector<STensor33>   &getRefTodFluxdF() {return _ipvbulk->getRefTodFluxdF();};
   virtual const std::vector<std::vector<const STensor3*> > &getConstRefToLinearK() const {return _ipvbulk->getConstRefToLinearK();};
   virtual void setConstRefToLinearK(const STensor3 &eT, int i, int j)  {_ipvbulk->setConstRefToLinearK(eT, i, j);};
-  virtual const std::vector<std::vector<STensor3> >  &getConstRefTodLinearKdField() const {return _ipvbulk->getConstRefTodLinearKdField();}; 
-  virtual std::vector<std::vector<STensor3> >  &getRefTodLinearKdField() {return _ipvbulk->getRefTodLinearKdField();}; 
-  virtual const std::vector<STensor43>  &getConstRefTodLinearKdF() const {return _ipvbulk->getConstRefTodLinearKdF();}; 
-  virtual std::vector<STensor43>  &getRefTodLinearKdF() {return _ipvbulk->getRefTodLinearKdF();}; 
+  virtual const std::vector<std::vector<std::vector<STensor3> > >  &getConstRefTodLinearKdField() const {return _ipvbulk->getConstRefTodLinearKdField();}; 
+  virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodLinearKdField() {return _ipvbulk->getRefTodLinearKdField();}; 
+  virtual const std::vector<std::vector<STensor43>>  &getConstRefTodLinearKdF() const {return _ipvbulk->getConstRefTodLinearKdF();}; 
+  virtual std::vector<std::vector<STensor43>>  &getRefTodLinearKdF() {return _ipvbulk->getRefTodLinearKdF();}; 
+  virtual const std::vector<std::vector<const STensor3*> > &getConstRefToEnergyK() const {return _ipvbulk->getConstRefToEnergyK();};
+  virtual void setConstRefToEnergyK(const STensor3 &eT, int i, int j)  {_ipvbulk->setConstRefToEnergyK(eT, i, j);};
+  virtual const std::vector<std::vector<std::vector<STensor3> > >  &getConstRefTodEnergyKdField() const {return _ipvbulk->getConstRefTodEnergyKdField();}; 
+  virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodEnergyKdField() {return _ipvbulk->getRefTodEnergyKdField();}; 
+  virtual const std::vector<std::vector<STensor43>>  &getConstRefTodEnergyKdF() const {return _ipvbulk->getConstRefTodEnergyKdF();}; 
+  virtual std::vector<std::vector<STensor43>>  &getRefTodEnergyKdF() {return _ipvbulk->getRefTodEnergyKdF();}; 
   virtual const fullVector<double>  &getConstRefToFieldSource() const {return _ipvbulk->getConstRefToFieldSource();};
   virtual fullVector<double>  &getRefToFieldSource() {return _ipvbulk->getRefToFieldSource();};
   virtual const fullMatrix<double>  &getConstRefTodFieldSourcedField() const {return _ipvbulk->getConstRefTodFieldSourcedField();};
@@ -162,6 +168,25 @@ class FractureCohesive3DIPVariable : public IPVariable2ForFracture<dG3DIPVariabl
   virtual fullMatrix<double>  &getRefTodOneOverFieldJumpdFieldp() {return _ipvbulk->getRefTodOneOverFieldJumpdFieldp();};
   virtual const std::vector<SVector3>  &getConstRefToInterfaceFlux() const {return _ipvbulk->getConstRefToInterfaceFlux();};
   virtual std::vector<SVector3>  &getRefToInterfaceFlux() {return _ipvbulk->getRefToInterfaceFlux();};
+ 
+  //ThermoField (fT & fv)
+  virtual double getConstRefToThermoField(const int idex) const {return _ipvbulk->getConstRefToThermoField(idex);};  
+  virtual double  &getRefToThermoField(const int idex) {return _ipvbulk->getRefToThermoField(idex);};  
+  virtual const std::vector<SVector3>  &getConstRefToGradThermoField() const {return _ipvbulk->getConstRefToGradThermoField();}; 
+  virtual std::vector<SVector3>  &getRefToGradThermoField() {return _ipvbulk->getRefToGradThermoField();}; 
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodFielddThermoField() const {return _ipvbulk->getConstRefTodFielddThermoField();};
+  virtual std::vector<std::vector<double>>  &getRefTodFielddThermoField() {return _ipvbulk->getRefTodFielddThermoField();};
+  virtual const std::vector<std::vector<SVector3>>  &getConstRefTodGradFielddThermoField() const {return _ipvbulk->getConstRefTodGradFielddThermoField();}; 
+  virtual std::vector<std::vector<SVector3>>  &getRefTodGradFielddThermoField() {return _ipvbulk->getRefTodGradFielddThermoField();};
+  virtual const std::vector<std::vector<STensor3>>  &getConstRefTodGradFielddGradThermoField() const {return _ipvbulk->getConstRefTodGradFielddGradThermoField();}; 
+  virtual std::vector<std::vector<STensor3>>  &getRefTodGradFielddGradThermoField() {return _ipvbulk->getRefTodGradFielddGradThermoField();}; 
+  virtual const fullVector<double>  &getConstRefToThermoFieldJump() const {return _ipvbulk->getConstRefToThermoFieldJump();};  
+  virtual fullVector<double>  &getRefToThermoFieldJump() {return _ipvbulk->getRefToThermoFieldJump();};
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldm() const {return _ipvbulk->getConstRefTodThermoFieldJumpdFieldm();};
+  virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldm() {return _ipvbulk->getRefTodThermoFieldJumpdFieldm();};
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldp() const {return _ipvbulk->getConstRefTodThermoFieldJumpdFieldp();};
+  virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldp() {return _ipvbulk->getRefTodThermoFieldJumpdFieldp();};
+
   //coupling constitutive extra dof with nonLocal
   virtual const std::vector<std::vector<SVector3> > & getConstRefTodFluxdNonLocalVariable() const {return _ipvbulk->getConstRefTodFluxdNonLocalVariable();}
   virtual std::vector<std::vector<SVector3> > & getRefTodFluxdNonLocalVariable(){return _ipvbulk->getRefTodFluxdNonLocalVariable();}
diff --git a/dG3D/src/dG3DEnhancedStrainIPVariable.h b/dG3D/src/dG3DEnhancedStrainIPVariable.h
index 4782d279a..702159499 100644
--- a/dG3D/src/dG3DEnhancedStrainIPVariable.h
+++ b/dG3D/src/dG3DEnhancedStrainIPVariable.h
@@ -220,13 +220,19 @@ class dG3DEnhancedStrainIPVariable : public IPVariable2Enhanced<dG3DIPVariableBa
     virtual const std::vector<std::vector<SVector3> >  &getConstRefTodFluxdField() const {return _ipvbulk->getConstRefTodFluxdField();};
     virtual std::vector<std::vector<SVector3> >  &getRefTodFluxdField() {return _ipvbulk->getRefTodFluxdField();};
     virtual const std::vector<STensor33>  &getConstRefTodFluxdF() const {return _ipvbulk->getConstRefTodFluxdF();};
-    virtual std::vector<STensor33>   &getRefTodFluxdF() {return _ipvbulk->getRefTodFluxdF();};
+    virtual std::vector<STensor33>   &getRefTodFluxdF() {return _ipvbulk->getRefTodFluxdF();};  
     virtual const std::vector<std::vector<const STensor3*> > &getConstRefToLinearK() const {return _ipvbulk->getConstRefToLinearK();};
     virtual void setConstRefToLinearK(const STensor3 &eT, int i, int j)  {_ipvbulk->setConstRefToLinearK(eT, i, j);};
-    virtual const std::vector<std::vector<STensor3> >  &getConstRefTodLinearKdField() const {return _ipvbulk->getConstRefTodLinearKdField();}; 
-    virtual std::vector<std::vector<STensor3> >  &getRefTodLinearKdField() {return _ipvbulk->getRefTodLinearKdField();}; 
-    virtual const std::vector<STensor43>  &getConstRefTodLinearKdF() const {return _ipvbulk->getConstRefTodLinearKdF();}; 
-    virtual std::vector<STensor43>  &getRefTodLinearKdF() {return _ipvbulk->getRefTodLinearKdF();}; 
+    virtual const std::vector<std::vector<std::vector<STensor3> > >  &getConstRefTodLinearKdField() const {return _ipvbulk->getConstRefTodLinearKdField();}; 
+    virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodLinearKdField() {return _ipvbulk->getRefTodLinearKdField();}; 
+    virtual const std::vector<std::vector<STensor43>>  &getConstRefTodLinearKdF() const {return _ipvbulk->getConstRefTodLinearKdF();}; 
+    virtual std::vector<std::vector<STensor43>>  &getRefTodLinearKdF() {return _ipvbulk->getRefTodLinearKdF();}; 
+    virtual const std::vector<std::vector<const STensor3*> > &getConstRefToEnergyK() const {return _ipvbulk->getConstRefToEnergyK();};
+    virtual void setConstRefToEnergyK(const STensor3 &eT, int i, int j)  {_ipvbulk->setConstRefToEnergyK(eT, i, j);};
+    virtual const std::vector<std::vector<std::vector<STensor3> > >  &getConstRefTodEnergyKdField() const {return _ipvbulk->getConstRefTodEnergyKdField();}; 
+    virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodEnergyKdField() {return _ipvbulk->getRefTodEnergyKdField();}; 
+    virtual const std::vector<std::vector<STensor43>>  &getConstRefTodEnergyKdF() const {return _ipvbulk->getConstRefTodEnergyKdF();}; 
+    virtual std::vector<std::vector<STensor43>>  &getRefTodEnergyKdF() {return _ipvbulk->getRefTodEnergyKdF();};  
     virtual const fullVector<double>  &getConstRefToFieldSource() const {return _ipvbulk->getConstRefToFieldSource();};
     virtual fullVector<double>  &getRefToFieldSource() {return _ipvbulk->getRefToFieldSource();};
     virtual const fullMatrix<double>  &getConstRefTodFieldSourcedField() const {return _ipvbulk->getConstRefTodFieldSourcedField();};
@@ -264,7 +270,24 @@ class dG3DEnhancedStrainIPVariable : public IPVariable2Enhanced<dG3DIPVariableBa
     virtual fullMatrix<double> &getRefTodMechanicalSourcedNonLocalVariable(){return _ipvbulk->getRefTodMechanicalSourcedNonLocalVariable();}
     virtual const std::vector<const STensor3*> &getConstRefToLinearSymmetrizationCoupling() const  {return _ipvbulk->getConstRefToLinearSymmetrizationCoupling();};
     virtual void setConstRefToLinearSymmetrizationCoupling(const STensor3 &eT, int i)  {_ipvbulk->setConstRefToLinearSymmetrizationCoupling(eT,i);};
-
+  
+    //ThermoField (fT & fv)
+    virtual double getConstRefToThermoField(const int idex) const {return _ipvbulk->getConstRefToThermoField(idex);};  
+    virtual double  &getRefToThermoField(const int idex) {return _ipvbulk->getRefToThermoField(idex);};  
+    virtual const std::vector<SVector3>  &getConstRefToGradThermoField() const {return _ipvbulk->getConstRefToGradThermoField();}; 
+    virtual std::vector<SVector3>  &getRefToGradThermoField() {return _ipvbulk->getRefToGradThermoField();}; 
+    virtual const  std::vector<std::vector<double>>  &getConstRefTodFielddThermoField() const {return _ipvbulk->getConstRefTodFielddThermoField();};
+    virtual std::vector<std::vector<double>>  &getRefTodFielddThermoField() {return _ipvbulk->getRefTodFielddThermoField();};
+    virtual const std::vector<std::vector<SVector3>>  &getConstRefTodGradFielddThermoField() const {return _ipvbulk->getConstRefTodGradFielddThermoField();}; 
+    virtual std::vector<std::vector<SVector3>>  &getRefTodGradFielddThermoField() {return _ipvbulk->getRefTodGradFielddThermoField();};
+    virtual const std::vector<std::vector<STensor3>>  &getConstRefTodGradFielddGradThermoField() const {return _ipvbulk->getConstRefTodGradFielddGradThermoField();}; 
+    virtual std::vector<std::vector<STensor3>>  &getRefTodGradFielddGradThermoField() {return _ipvbulk->getRefTodGradFielddGradThermoField();}; 
+    virtual const fullVector<double>  &getConstRefToThermoFieldJump() const {return _ipvbulk->getConstRefToThermoFieldJump();};  
+    virtual fullVector<double>  &getRefToThermoFieldJump() {return _ipvbulk->getRefToThermoFieldJump();};
+    virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldm() const {return _ipvbulk->getConstRefTodThermoFieldJumpdFieldm();};
+    virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldm() {return _ipvbulk->getRefTodThermoFieldJumpdFieldm();};
+    virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldp() const {return _ipvbulk->getConstRefTodThermoFieldJumpdFieldp();};
+    virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldp() {return _ipvbulk->getRefTodThermoFieldJumpdFieldp();};
 
 
 		//------------------get 1st piola b4 AV ---------------//
diff --git a/dG3D/src/dG3DIPVariable.cpp b/dG3D/src/dG3DIPVariable.cpp
index fc759130a..687d79c1f 100644
--- a/dG3D/src/dG3DIPVariable.cpp
+++ b/dG3D/src/dG3DIPVariable.cpp
@@ -77,12 +77,16 @@ void nonlocalData::restart(){
   restartManager::restart(dLocalVariableDExtraDofDiffusionField.getDataPtr(),numNonLocalVariable*numConstitutiveExtraDofDiffusionVariable);
 };
 //
-constitutiveExtraDofDiffusionData::constitutiveExtraDofDiffusionData(const int num, const int numNonLocal): numConstitutiveExtraDofDiffusionVariable(num), numNonLocalVariable(numNonLocal)
+constitutiveExtraDofDiffusionData::constitutiveExtraDofDiffusionData(const int num, const int numNonLocal, bool _useOfEnergy, bool _conjugatedField): numConstitutiveExtraDofDiffusionVariable(num), numNonLocalVariable(numNonLocal),  useOfEnergy(_useOfEnergy), conjugatedField(_conjugatedField)
 {
   if (num > 0){
     std::vector<STensor3>        StdSTens3Tmp; StdSTens3Tmp.resize(num,STensor3(0.));
+    std::vector<std::vector<STensor3>>        StdSTens3Tmp2; StdSTens3Tmp2.resize(num,StdSTens3Tmp);
     std::vector<SVector3>        StdSVect3Tmp; StdSVect3Tmp.resize(num,SVector3(0.));
+    STensor43		         StdSTens43Tmp; STensorOperation::zero(StdSTens43Tmp);
+    std::vector<STensor43>	 StdSTens43Tmp2;StdSTens43Tmp2.resize(num,StdSTens43Tmp);
     std::vector<const STensor3*> StdSTens3PtTmp; StdSTens3PtTmp.resize(num,NULL);
+    std::vector<double>          StdDoubleTmp; StdDoubleTmp.resize(num,0.);
 
     field.resize(num); field.setAll(0.);
 
@@ -95,7 +99,14 @@ constitutiveExtraDofDiffusionData::constitutiveExtraDofDiffusionData(const int n
     dFluxdF.resize(num,STensor33(0.));
  
     linearK.resize(num,StdSTens3PtTmp);
-
+    if(useOfEnergy)
+    {
+      EnergyK.resize(num,StdSTens3PtTmp);
+      dlinearKdField.resize(num,StdSTens3Tmp2);
+      dEnergyKdField.resize(num,StdSTens3Tmp2);
+      dlinearKdF.resize(num,StdSTens43Tmp2);
+      dEnergyKdF.resize(num,StdSTens43Tmp2);
+    }
     fieldSource.resize(num); fieldSource.setAll(0.);
     dFieldSourcedField.resize(num,num); dFieldSourcedField.setAll(0.);
     dFieldSourcedGradField.resize(num,StdSVect3Tmp);
@@ -109,6 +120,19 @@ constitutiveExtraDofDiffusionData::constitutiveExtraDofDiffusionData(const int n
     fieldCapacityPerUnitField.resize(num); fieldCapacityPerUnitField.setAll(0.);
 	
     fieldJump.resize(num); fieldJump.setAll(0.);
+
+    if(conjugatedField)
+    {
+      thermoField.resize(num); thermoField.setAll(0.);
+      gradThermoField.resize(num,SVector3(0.));
+      thermoFieldJump.resize(num); thermoFieldJump.setAll(0.); 
+      dFielddThermoField.resize(num,StdDoubleTmp);
+      dGradFielddThermoField.resize(num,StdSVect3Tmp);
+      dGradFielddGradThermoField.resize(num,StdSTens3Tmp);
+      dThermoFieldJumpdFieldm.resize(num,StdDoubleTmp); 	
+      dThermoFieldJumpdFieldp.resize(num,StdDoubleTmp); 
+    }
+
     oneOverFieldJump.resize(num); oneOverFieldJump.setAll(0.);
     dOneOverFieldJumpdFieldm.resize(num,num); dOneOverFieldJumpdFieldm.setAll(0.);
     dOneOverFieldJumpdFieldp.resize(num,num); dOneOverFieldJumpdFieldp.setAll(0.);
@@ -132,6 +156,7 @@ constitutiveExtraDofDiffusionData::constitutiveExtraDofDiffusionData(const const
                                                                                    dFieldSourcedF(source.dFieldSourcedF), 
 	                                                                           mechanicalSource(source.mechanicalSource), dMechanicalSourcedField(source.dMechanicalSourcedField), 
                                                                                    dMechanicalSourcedGradField(source.dMechanicalSourcedGradField), dMechanicalSourcedF(source.dMechanicalSourcedF),
+
                                                                                    fieldCapacityPerUnitField(source.fieldCapacityPerUnitField), fieldJump(source.fieldJump), 
                                                                                    oneOverFieldJump(source.oneOverFieldJump), 
                                                                                    dOneOverFieldJumpdFieldm(source.dOneOverFieldJumpdFieldm),
@@ -139,7 +164,8 @@ constitutiveExtraDofDiffusionData::constitutiveExtraDofDiffusionData(const const
                                                                                    linearSymmetrizationCoupling(source.linearSymmetrizationCoupling),  
                                                                                    dFluxdNonLocalVariable(source.dFluxdNonLocalVariable), 
                                                                                    dFieldSourcedNonLocalVariable(source.dFieldSourcedNonLocalVariable),
-                                                                                   dMechanicalSourcedNonLocalVariable(source.dMechanicalSourcedNonLocalVariable)
+                                                                                   dMechanicalSourcedNonLocalVariable(source.dMechanicalSourcedNonLocalVariable),
+                                                                                   conjugatedField(source.conjugatedField),useOfEnergy(source.useOfEnergy)
 {
   
 };
@@ -177,6 +203,10 @@ constitutiveExtraDofDiffusionData& constitutiveExtraDofDiffusionData::operator =
   dFluxdNonLocalVariable=source.dFluxdNonLocalVariable;
   dFieldSourcedNonLocalVariable=source.dFieldSourcedNonLocalVariable;
   dMechanicalSourcedNonLocalVariable=source.dMechanicalSourcedNonLocalVariable;
+
+  useOfEnergy=source.useOfEnergy;
+  conjugatedField=source.conjugatedField;  
+
   return *this;
 };
 
@@ -194,7 +224,10 @@ void constitutiveExtraDofDiffusionData::restart(){
     restartManager::restart(dFluxdGradField);
     restartManager::restart(dFluxdField);
     restartManager::restart(dFluxdF);
- 
+
+    restartManager::restart(useOfEnergy);
+    restartManager::restart(conjugatedField);
+
     //restartManager::restart(linearK.resize(num,StdSTens3PtTmp);
 
     restartManager::restart(fieldSource.getDataPtr(),numConstitutiveExtraDofDiffusionVariable);
@@ -219,9 +252,10 @@ void constitutiveExtraDofDiffusionData::restart(){
     restartManager::restart(dFieldSourcedNonLocalVariable.getDataPtr(),numConstitutiveExtraDofDiffusionVariable*numNonLocalVariable);
     restartManager::restart(dMechanicalSourcedNonLocalVariable.getDataPtr(),numConstitutiveExtraDofDiffusionVariable*numNonLocalVariable);
 
+
 };
 
-dG3DIPVariable::dG3DIPVariable(const bool oninter, int numNonLocal, int extraDofDiffusion) : dG3DIPVariableBase(), _nonlocalData(NULL), _constitutiveExtraDofDiffusionData(NULL)
+dG3DIPVariable::dG3DIPVariable(const bool oninter, int numNonLocal, int extraDofDiffusion, bool useOfEnergy, bool conjugatedField) : dG3DIPVariableBase(), _nonlocalData(NULL), _constitutiveExtraDofDiffusionData(NULL)
 {
   _oninter = oninter;
   deformationGradient(0,0) = 1.;
@@ -230,7 +264,7 @@ dG3DIPVariable::dG3DIPVariable(const bool oninter, int numNonLocal, int extraDof
   if(numNonLocal>0)
     _nonlocalData=new nonlocalData(numNonLocal,extraDofDiffusion);
   if(extraDofDiffusion>0)
-    _constitutiveExtraDofDiffusionData = new constitutiveExtraDofDiffusionData(extraDofDiffusion,numNonLocal);
+    _constitutiveExtraDofDiffusionData = new constitutiveExtraDofDiffusionData(extraDofDiffusion,numNonLocal, useOfEnergy, conjugatedField);
 
 }
 
@@ -1863,10 +1897,7 @@ void PhenomenologicalSMPDG3DIPVariable::restart()
 
 //
 
-ElecTherMechDG3DIPVariableBase::ElecTherMechDG3DIPVariableBase( const bool oninter) : dG3DIPVariable(oninter,0,2),
-              fvJump(0.),dfvjumpdvm(0.),dfvjumpdvp(0.),dfvjumpdTm(0.),dfvjumpdTp(0.),fT(0.), gradfT(0.), fV(0.), gradfV(0.)
-	     , dgradVdgradfV(0.),dgradVdgradfT(0.),dgradTdgradfV(0.),dgradTdgradfT(0.), dVdfV(0.),dVdfT(0.), dTdfV(0.),dTdfT(0.),dgradVdfV(0.),dgradVdfT(0.),
-	     dgradTdfT(0.),dgradTdfV(0.),jy1(0.),djy1dT(0.),djy1dV(0.),djy1dF(0.)
+ElecTherMechDG3DIPVariableBase::ElecTherMechDG3DIPVariableBase( const bool oninter) : dG3DIPVariable(oninter,0,2,true,true)
 
 {
 
@@ -1924,33 +1955,33 @@ ElecTherMechDG3DIPVariableBase::ElecTherMechDG3DIPVariableBase(const ElecTherMec
   //dk10dF	= source.dk10dF;
   //dk20dF	= source.dk20dF;
 
-  fvJump	= source.fvJump;
+  //fvJump	= source.fvJump;
  // fTJump	= source.fTJump;
-  dfvjumpdvm	= source.dfvjumpdvm;
-  dfvjumpdvp	= source.dfvjumpdvp;
-  dfvjumpdTm	= source.dfvjumpdTm;
-  dfvjumpdTp	= source.dfvjumpdTp;
+ // dfvjumpdvm	= source.dfvjumpdvm;
+  //dfvjumpdvp	= source.dfvjumpdvp;
+  //dfvjumpdTm	= source.dfvjumpdTm;
+  //dfvjumpdTp	= source.dfvjumpdTp;
   //dfTjumpdTm	= source.dfTjumpdTm;
  // dfTjumpdTp	= source.dfTjumpdTp;
 
 
-  fT             = source.fT;
-  gradfT         = source.gradfT;
-  fV             = source.fV;
-  gradfV         = source.gradfV;
+  //fT             = source.fT;
+  //gradfT         = source.gradfT;
+  //fV             = source.fV;
+  //gradfV         = source.gradfV;
 
-  dgradVdgradfV	= source.dgradVdgradfV;
-  dgradVdgradfT	= source.dgradVdgradfT;
-  dgradTdgradfT	= source.dgradTdgradfT;
-  dgradTdgradfV	= source.dgradTdgradfV;
-  dVdfV		= source. dVdfV;
-  dVdfT		= source. dVdfT;
-  dTdfT		= source. dTdfT;
-  dTdfV		= source. dTdfV;
-  dgradVdfV	= source.dgradVdfV;
-  dgradVdfT	= source.dgradVdfT;
-  dgradTdfT	= source.dgradTdfT;
-  dgradTdfV	= source.dgradTdfV;
+  //dgradVdgradfV	= source.dgradVdgradfV;
+  //dgradVdgradfT	= source.dgradVdgradfT;
+  //dgradTdgradfT	= source.dgradTdgradfT;
+  //dgradTdgradfV	= source.dgradTdgradfV;
+  //dVdfV		= source. dVdfV;
+  //dVdfT		= source. dVdfT;
+  //dTdfT		= source. dTdfT;
+  //dTdfV		= source. dTdfV;
+  //dgradVdfV	= source.dgradVdfV;
+  //dgradVdfT	= source.dgradVdfT;
+  //dgradTdfT	= source.dgradTdfT;
+  //dgradTdfV	= source.dgradTdfV;
 
 
   //fluxjy	= source.fluxjy;
@@ -1959,10 +1990,10 @@ ElecTherMechDG3DIPVariableBase::ElecTherMechDG3DIPVariableBase(const ElecTherMec
   //djydT		= source.djydT;
   //djydgradT	= source.djydgradT;
   //djydF		= source.djydF;
-  jy1		= source.jy1;
-  djy1dT	= source.djy1dT;
-  djy1dV	= source.djy1dV;
-  djy1dF	= source.djy1dF;
+  //jy1		= source.jy1;
+  //djy1dT	= source.djy1dT;
+  //djy1dV	= source.djy1dV;
+  //djy1dF	= source.djy1dF;
 
 
 
@@ -2022,33 +2053,33 @@ ElecTherMechDG3DIPVariableBase& ElecTherMechDG3DIPVariableBase::operator=(const
     //dk10dF 	= src->dk10dF;
     //dk20dF 	= src->dk20dF;
 
-    fvJump	= src->fvJump;
+    //fvJump	= src->fvJump;
     //fTJump	= src->fTJump;
-    dfvjumpdvm	= src->dfvjumpdvm;
-    dfvjumpdvp	= src->dfvjumpdvp;
-    dfvjumpdTm	= src->dfvjumpdTm;
-    dfvjumpdTp	= src->dfvjumpdTp;
+    //dfvjumpdvm	= src->dfvjumpdvm;
+    //dfvjumpdvp	= src->dfvjumpdvp;
+    //dfvjumpdTm	= src->dfvjumpdTm;
+    //dfvjumpdTp	= src->dfvjumpdTp;
     //dfTjumpdTm	= src->dfTjumpdTm;
     //dfTjumpdTp	= src->dfTjumpdTp;
 
 
-    fT             = src->fT;
-    gradfT         = src->gradfT;
-    fV             = src->fV;
-    gradfV         = src->gradfV;
-
-    dgradVdgradfV= src->dgradVdgradfV;
-    dgradVdgradfT= src->dgradVdgradfT;
-    dgradTdgradfT= src->dgradTdgradfT;
-    dgradTdgradfV= src->dgradTdgradfV;
-    dVdfV	= src-> dVdfV;
-    dVdfT	= src-> dVdfT;
-    dTdfT	= src-> dTdfT;
-    dTdfV	= src-> dTdfV;
-    dgradVdfV	= src->dgradVdfV;
-    dgradVdfT	= src->dgradVdfT;
-    dgradTdfT	= src->dgradTdfT;
-    dgradTdfV	= src->dgradTdfV;
+    //fT             = src->fT;
+    //gradfT         = src->gradfT;
+    //fV             = src->fV;
+    //gradfV         = src->gradfV;
+
+    //dgradVdgradfV= src->dgradVdgradfV;
+    //dgradVdgradfT= src->dgradVdgradfT;
+    //dgradTdgradfT= src->dgradTdgradfT;
+    //dgradTdgradfV= src->dgradTdgradfV;
+    //dVdfV	= src-> dVdfV;
+    //dVdfT	= src-> dVdfT;
+    //dTdfT	= src-> dTdfT;
+    //dTdfV	= src-> dTdfV;
+    //dgradVdfV	= src->dgradVdfV;
+    //dgradVdfT	= src->dgradVdfT;
+    //dgradTdfT	= src->dgradTdfT;
+    //dgradTdfV	= src->dgradTdfV;
 
     //fluxjy	= src->fluxjy;
     //djydV	=src->djydV;
@@ -2056,10 +2087,10 @@ ElecTherMechDG3DIPVariableBase& ElecTherMechDG3DIPVariableBase::operator=(const
     //djydT	= src->djydT;
     //djydgradT	= src->djydgradT;
     //djydF	= src->djydF;
-    jy1		= src->jy1;
-    djy1dT	=src->djy1dT;
-    djy1dV	=src->djy1dV;
-    djy1dF	=src->djy1dF;
+    //jy1		= src->jy1;
+    //djy1dT	=src->djy1dT;
+    //djy1dV	=src->djy1dV;
+    //djy1dF	=src->djy1dF;
 
 
   }
@@ -2160,32 +2191,32 @@ void ElecTherMechDG3DIPVariableBase::restart()
   //restartManager::restart(dk10dF);
   //restartManager::restart(dk20dF);
 
-  restartManager::restart(fvJump);
+  //restartManager::restart(fvJump);
  //restartManager::restart(fTJump);
-  restartManager::restart(dfvjumpdvm);
-  restartManager::restart(dfvjumpdvp);
-  restartManager::restart(dfvjumpdTm);
-  restartManager::restart(dfvjumpdTp);
+  //restartManager::restart(dfvjumpdvm);
+  //restartManager::restart(dfvjumpdvp);
+  //restartManager::restart(dfvjumpdTm);
+  //restartManager::restart(dfvjumpdTp);
   //restartManager::restart(dfTjumpdTm);
   //restartManager::restart(dfTjumpdTp);
 
-  restartManager::restart(fT);
-  restartManager::restart(gradfT);
-  restartManager::restart(fV);
-  restartManager::restart(gradfV);
-
-  restartManager::restart(dgradVdgradfV);
-  restartManager::restart(dgradVdgradfT);
-  restartManager::restart(dgradTdgradfT);
-  restartManager::restart(dgradTdgradfV);
-  restartManager::restart(dVdfV);
-  restartManager::restart(dVdfT);
-  restartManager::restart(dTdfT);
-  restartManager::restart(dTdfV);
-  restartManager::restart(dgradVdfV);
-  restartManager::restart(dgradVdfT);
-  restartManager::restart(dgradTdfT);
-  restartManager::restart(dgradTdfV);
+  //restartManager::restart(fT);
+  //restartManager::restart(gradfT);
+  //restartManager::restart(fV);
+  //restartManager::restart(gradfV);
+
+  //restartManager::restart(dgradVdgradfV);
+  //restartManager::restart(dgradVdgradfT);
+  //restartManager::restart(dgradTdgradfT);
+  //restartManager::restart(dgradTdgradfV);
+  //restartManager::restart(dVdfV);
+  //restartManager::restart(dVdfT);
+  //restartManager::restart(dTdfT);
+  //restartManager::restart(dTdfV);
+  //restartManager::restart(dgradVdfV);
+  //restartManager::restart(dgradVdfT);
+  //restartManager::restart(dgradTdfT);
+  //restartManager::restart(dgradTdfV);
 
   //restartManager::restart(fluxjy);
   //restartManager::restart(djydV);
@@ -2193,10 +2224,10 @@ void ElecTherMechDG3DIPVariableBase::restart()
   //restartManager::restart(djydT);
   //restartManager::restart(djydgradT);
   //restartManager::restart(djydF);
-  restartManager::restart(jy1);
-  restartManager::restart(djy1dT);
-  restartManager::restart(djy1dV);
-  restartManager::restart(djy1dF);
+  //restartManager::restart(jy1);
+  //restartManager::restart(djy1dT);
+  //restartManager::restart(djy1dV);
+  //restartManager::restart(djy1dF);
 
 
   return;
@@ -2324,8 +2355,8 @@ ElecSMPDG3DIPVariable::ElecSMPDG3DIPVariable(double tinitial,double vinitial,con
   _ESMPIP = new IPElecSMP(_lawESMP.getSa0(),_lawESMP.getPhia0(),_lawESMP.getSastar0());
   this->getRefToTemperature()=tinitial;
   this->getRefToVoltage()=vinitial;
-  this->getRefTofT()         =1./tinitial;
-  this->getRefTofV()         =-vinitial/tinitial;
+  this->getRefTofT()=1./tinitial;
+  this->getRefTofV()=-vinitial/tinitial;
 
 }
 
diff --git a/dG3D/src/dG3DIPVariable.h b/dG3D/src/dG3DIPVariable.h
index ea3749292..1fc8f11e1 100644
--- a/dG3D/src/dG3DIPVariable.h
+++ b/dG3D/src/dG3DIPVariable.h
@@ -174,10 +174,16 @@ class dG3DIPVariableBase : public ipFiniteStrain
   virtual std::vector<STensor33>   &getRefTodFluxdF()=0; 
   virtual const std::vector<std::vector<const STensor3*> > &getConstRefToLinearK() const =0; 
   virtual void setConstRefToLinearK(const STensor3 &eT, int i, int j) =0; 
-  virtual const std::vector<std::vector<STensor3> >  &getConstRefTodLinearKdField() const=0; 
-  virtual std::vector<std::vector<STensor3> >  &getRefTodLinearKdField()=0; 
-  virtual const std::vector<STensor43>  &getConstRefTodLinearKdF() const=0; 
-  virtual std::vector<STensor43>  &getRefTodLinearKdF()=0; 
+  virtual const std::vector<std::vector<const STensor3*> > &getConstRefToEnergyK() const =0; 
+  virtual void setConstRefToEnergyK(const STensor3 &eT, int i, int j) =0; 
+  virtual const std::vector<std::vector<std::vector<STensor3> > >  &getConstRefTodLinearKdField() const=0; 
+  virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodLinearKdField()=0; 
+  virtual const std::vector<std::vector<std::vector<STensor3> > >  &getConstRefTodEnergyKdField() const=0; 
+  virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodEnergyKdField()=0; 
+  virtual const std::vector< std::vector<STensor43> >  &getConstRefTodLinearKdF() const=0; 
+  virtual std::vector<std::vector<STensor43>>  &getRefTodLinearKdF()=0;  
+  virtual const std::vector< std::vector<STensor43> >  &getConstRefTodEnergyKdF() const=0; 
+  virtual std::vector<std::vector<STensor43>>  &getRefTodEnergyKdF()=0; 
   virtual const fullVector<double>  &getConstRefToFieldSource() const=0; 
   virtual fullVector<double>  &getRefToFieldSource()=0; 
   virtual const fullMatrix<double>  &getConstRefTodFieldSourcedField() const=0; 
@@ -216,6 +222,25 @@ class dG3DIPVariableBase : public ipFiniteStrain
   virtual const fullMatrix<double> &getConstRefTodMechanicalSourcedNonLocalVariable() const=0;
   virtual fullMatrix<double> &getRefTodMechanicalSourcedNonLocalVariable()=0;
 
+  //ThermoField (fT & fv)
+
+  virtual double getConstRefToThermoField(const int idex) const=0; 
+  virtual double  &getRefToThermoField(const int idex)=0; 
+  virtual const std::vector<SVector3>  &getConstRefToGradThermoField() const=0; 
+  virtual std::vector<SVector3>  &getRefToGradThermoField()=0; 
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodFielddThermoField() const=0;
+  virtual std::vector<std::vector<double>>  &getRefTodFielddThermoField()=0;
+  virtual const std::vector<std::vector<SVector3>>  &getConstRefTodGradFielddThermoField() const=0; 
+  virtual std::vector<std::vector<SVector3>>  &getRefTodGradFielddThermoField()=0;
+  virtual const std::vector<std::vector<STensor3>>  &getConstRefTodGradFielddGradThermoField() const=0; 
+  virtual std::vector<std::vector<STensor3>>  &getRefTodGradFielddGradThermoField()=0;
+  virtual const fullVector<double>  &getConstRefToThermoFieldJump() const=0; 
+  virtual fullVector<double>  &getRefToThermoFieldJump()=0;
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldm() const=0;
+  virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldm()=0;
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldp() const=0;
+  virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldp()=0;
+
   virtual void restart(){}
 };
 
@@ -252,6 +277,8 @@ class constitutiveExtraDofDiffusionData{
  public:
   int numConstitutiveExtraDofDiffusionVariable; //number of extra dof variables
   int numNonLocalVariable; //number of extra dof variables
+  bool useOfEnergy;
+  bool conjugatedField;
 
   fullVector<double>           field;
   std::vector<SVector3>        gradField;
@@ -262,8 +289,6 @@ class constitutiveExtraDofDiffusionData{
   std::vector<std::vector<SVector3> >        dFluxdField;
   std::vector<STensor33>       dFluxdF;
   std::vector<std::vector<const STensor3*> > linearK;
-  std::vector<std::vector<STensor3>> dlinearKdField;
-  std::vector<STensor43> dlinearKdF;
   fullVector<double>           fieldSource;  //related to cp*dT/dt
   fullMatrix<double>           dFieldSourcedField;
   std::vector<std::vector<SVector3> >        dFieldSourcedGradField;
@@ -290,15 +315,37 @@ class constitutiveExtraDofDiffusionData{
   fullMatrix<double>          dMechanicalSourcedNonLocalVariable;
 
 
+  // Use of energy
+  std::vector<std::vector<const STensor3*> > EnergyK;
+  std::vector<std::vector<std::vector<STensor3>>> dlinearKdField;
+  std::vector<std::vector<std::vector<STensor3>>> dEnergyKdField;
+  std::vector<std::vector<STensor43>> dlinearKdF;
+  std::vector<std::vector<STensor43>> dEnergyKdF;
+
+
+  //use of conjugated fields (fT & fv)
+
+  fullVector<double>           thermoField; //energyConjugatedField
+  std::vector<SVector3>        gradThermoField;
+  std::vector<std::vector<double>>          dFielddThermoField;
+  std::vector<std::vector<SVector3>>        dGradFielddThermoField;
+  std::vector<std::vector<STensor3>>        dGradFielddGradThermoField;
+  fullVector<double>           thermoFieldJump; 			//dg
+  std::vector<std::vector<double>>          dThermoFieldJumpdFieldm; 	//dg
+  std::vector<std::vector<double>>          dThermoFieldJumpdFieldp; 	//dg
+  
+
+
 
  public:
-  constitutiveExtraDofDiffusionData(const int numVer, const int numNonLocal=0);
+  constitutiveExtraDofDiffusionData(const int numVer, const int numNonLocal=0,   bool useOfEnergy = false, bool conjugatedField=false);
   constitutiveExtraDofDiffusionData(const constitutiveExtraDofDiffusionData& src);
   constitutiveExtraDofDiffusionData& operator = (const constitutiveExtraDofDiffusionData& src);
   virtual ~constitutiveExtraDofDiffusionData(){};
   void restart();
   virtual int getConstitutiveExtraDofDiffusionVariable() const {return numConstitutiveExtraDofDiffusionVariable;}
   virtual int getNumNonLocalVariable() const {return numNonLocalVariable;}
+  virtual bool useConjugatedField() const {return conjugatedField;}
 
 };
 
@@ -327,7 +374,7 @@ protected:
     constitutiveExtraDofDiffusionData *_constitutiveExtraDofDiffusionData;
 
  public:
-  dG3DIPVariable(const bool oninter=false, int numNonLocal=0, int extraDofDiffusion=0); // A empty constructor is mandatory to build FractureCohesive3DIPVariable OK like this as the fracture is on interface??
+  dG3DIPVariable(const bool oninter=false, int numNonLocal=0, int extraDofDiffusion=0, bool useOfEnergy=false, bool conjugatedField=false); // A empty constructor is mandatory to build FractureCohesive3DIPVariable OK like this as the fracture is on interface??
   dG3DIPVariable(const dG3DIPVariable &source);
   virtual dG3DIPVariable &operator = (const IPVariable &_source);
   virtual ~dG3DIPVariable()
@@ -645,40 +692,87 @@ protected:
   virtual void setConstRefToLinearK(const STensor3 &eT, int i, int j)
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getConstRefTolinearK() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("setConstRefTolinearK() : _constitutiveExtraDofDiffusionData not created");
     else
     {
       if(i < getNumConstitutiveExtraDofDiffusionVariable() && j< getNumConstitutiveExtraDofDiffusionVariable())
          _constitutiveExtraDofDiffusionData->linearK[i][j] = &eT;
       else
-         Msg::Fatal("getConstRefTolinearK() : index out of range");
+         Msg::Fatal("setConstRefTolinearK() : index out of range");
     }
   }
-  virtual const std::vector< std::vector<STensor3> >  &getConstRefTodLinearKdField() const
+  virtual const std::vector<std::vector<const STensor3*> > &getConstRefToEnergyK() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getConstRefTodFluxdGradField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getConstRefToEnergyK() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->EnergyK;
+  }
+  virtual void setConstRefToEnergyK(const STensor3 &eT, int i, int j)
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("setConstRefToEnergyK() : _constitutiveExtraDofDiffusionData not created");
+    else
+    {
+      if(i < getNumConstitutiveExtraDofDiffusionVariable() && j< getNumConstitutiveExtraDofDiffusionVariable())
+         _constitutiveExtraDofDiffusionData->EnergyK[i][j] = &eT;
+      else
+         Msg::Fatal("setConstRefToEnergyK() : index out of range");
+    }
+  }
+  virtual const std::vector< std::vector<std::vector<STensor3> > >  &getConstRefTodEnergyKdField() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefTodEnergyKdField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dEnergyKdField;
+  }
+  virtual std::vector< std::vector<std::vector<STensor3> > >  &getRefTodEnergyKdField()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefTodEnergyKdField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dEnergyKdField;
+  }
+  virtual const std::vector<std::vector<STensor43>>  &getConstRefTodEnergyKdF() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefTodEnergyKdF() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dEnergyKdF;
+  }
+  virtual std::vector<std::vector<STensor43>>  &getRefTodEnergyKdF()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefTodEnergyKdF() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dEnergyKdF;
+  }
+  virtual const std::vector< std::vector<std::vector<STensor3> > >  &getConstRefTodLinearKdField() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefTodLinearKdField() : _constitutiveExtraDofDiffusionData not created");
     else
       return _constitutiveExtraDofDiffusionData->dlinearKdField;
   }
-  virtual std::vector<std::vector<STensor3> >  &getRefTodLinearKdField()
+  virtual std::vector< std::vector<std::vector<STensor3> > >  &getRefTodLinearKdField()
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getRefTodFluxdGradField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getRefTodLinearKdField() : _constitutiveExtraDofDiffusionData not created");
     else
       return _constitutiveExtraDofDiffusionData->dlinearKdField;
   }
-  virtual const std::vector<STensor43>  &getConstRefTodLinearKdF() const
+  virtual const std::vector<std::vector<STensor43>>  &getConstRefTodLinearKdF() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getConstRefTodFluxdGradField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getConstRefTodLinearKdF() : _constitutiveExtraDofDiffusionData not created");
     else
       return _constitutiveExtraDofDiffusionData->dlinearKdF;
   }
-  virtual std::vector<STensor43>  &getRefTodLinearKdF()
+  virtual std::vector<std::vector<STensor43>>  &getRefTodLinearKdF()
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getRefTodFluxdGradField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getRefTodLinearKdF() : _constitutiveExtraDofDiffusionData not created");
     else
       return _constitutiveExtraDofDiffusionData->dlinearKdF;
   }
@@ -941,6 +1035,121 @@ protected:
       return _constitutiveExtraDofDiffusionData->dMechanicalSourcedNonLocalVariable;
   }
 
+  //ThermoField (fT & fv)
+
+  virtual double getConstRefToThermoField(const int idex) const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefToThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->thermoField(idex);
+  }
+  virtual double   &getRefToThermoField(const int idex)
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefToThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->thermoField(idex);
+  }
+  virtual const std::vector<SVector3>  &getConstRefToGradThermoField() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefToGradThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->gradThermoField;
+  }
+  virtual std::vector<SVector3>  &getRefToGradThermoField()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefToGradThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->gradThermoField;
+  }
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodFielddThermoField() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefTodFielddThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dFielddThermoField;
+  }
+  virtual std::vector<std::vector<double>>  &getRefTodFielddThermoField()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefTodFielddThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dFielddThermoField;
+  }
+  virtual const std::vector<std::vector<SVector3>>  &getConstRefTodGradFielddThermoField() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefTodGradFielddThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dGradFielddThermoField;
+  }
+  virtual std::vector<std::vector<SVector3>>  &getRefTodGradFielddThermoField()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefTodGradFielddThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dGradFielddThermoField;
+  }
+  virtual const std::vector<std::vector<STensor3>>  &getConstRefTodGradFielddGradThermoField() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefTodGradFielddGradThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dGradFielddGradThermoField;
+  }
+  virtual std::vector<std::vector<STensor3>>  &getRefTodGradFielddGradThermoField()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefTodGradFielddGradThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dGradFielddGradThermoField;
+  }
+  virtual const fullVector<double>  &getConstRefToThermoFieldJump() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefToThermoFieldJump() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->thermoFieldJump;
+  } 
+  virtual fullVector<double>  &getRefToThermoFieldJump()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefToThermoFieldJump() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->thermoFieldJump;
+  } 
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldm() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefTodThermoFieldJumpdFieldm() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dThermoFieldJumpdFieldm;
+  } 
+  virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldm()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefTodThermoFieldJumpdFieldm() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dThermoFieldJumpdFieldm;
+  } 
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldp() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefTodThermoFieldJumpdFieldp() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dThermoFieldJumpdFieldp;
+  }
+  virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldp()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefTodThermoFieldJumpdFieldp() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dThermoFieldJumpdFieldp;
+  }
+
 
   virtual IPVariable* clone() const =0;
   virtual void restart();
@@ -1928,32 +2137,32 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   //double                       VoltageJump;
   //SVector3                     interfaceFluxV;
 
-  double                       fvJump;
+  //double                       fvJump;
   //double                       fTJump;
-  double                       dfvjumpdvm;
-  double                       dfvjumpdvp;
-  double                       dfvjumpdTm;
-  double                       dfvjumpdTp;
+  //double                       dfvjumpdvm;
+  //double                       dfvjumpdvp;
+  //double                       dfvjumpdTm;
+  //double                       dfvjumpdTp;
  //double                       dfTjumpdTm;
  //double                       dfTjumpdTp;
 
-  STensor3 			dgradVdgradfV;
-  STensor3 			dgradVdgradfT;
-  STensor3 			dgradTdgradfV;
-  STensor3 			dgradTdgradfT;
-  double 			dVdfV;
-  double 			dVdfT;
-  double 			dTdfV;
-  double 			dTdfT;
-  SVector3 			dgradVdfV;
-  SVector3  			dgradVdfT;
-  SVector3  			dgradTdfT;
-  SVector3  			dgradTdfV;
-
-  double                       fT;
-  double                       fV;
-  SVector3                      gradfT;
-  SVector3                      gradfV;
+  //STensor3 			dgradVdgradfV;
+  //STensor3 			dgradVdgradfT;
+  //STensor3 			dgradTdgradfV;
+  //STensor3 			dgradTdgradfT;
+  //double 			dVdfV;
+  //double 			dVdfT;
+  //double 			dTdfV;
+  //double 			dTdfT;
+  //SVector3 			dgradVdfV;
+  //SVector3  			dgradVdfT;
+  //SVector3  			dgradTdfT;
+  //SVector3  			dgradTdfV;
+
+  //double                       fT;
+  //double                       fV;
+  //SVector3                      gradfT;
+  //SVector3                      gradfV;
 
   //SVector3 			fluxjy;
   //SVector3 			djydV;
@@ -1961,10 +2170,10 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   //SVector3 			djydT;
   //STensor3 			djydgradT;
   //STensor33 			djydF;
-  STensor3 			jy1;
-  STensor3 			djy1dT;
-  STensor3 			djy1dV;
-  STensor43			djy1dF;
+  //STensor3 			jy1;
+  //STensor3 			djy1dT;
+  //STensor3 			djy1dV;
+  //STensor43			djy1dF;
  // const STensor3		*Stiff_alphaDilatation;
 
 
@@ -2037,59 +2246,59 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   virtual const  STensor3 *getConstRefToCrossTherConductivity() const {return getConstRefToLinearK()[0][1];}
   virtual void setRefToCrossTherConductivity(const STensor3 &eT) {return  setConstRefToLinearK(eT,0,1);}
 
-  virtual const  STensor3 &getConstRefTodElecConductivitydT() const {return  getConstRefTodLinearKdField()[2][0];}
-  virtual  STensor3 &getRefTodElecConductivitydT() {return  getRefTodLinearKdField()[2][0];}
+  virtual const  STensor3 &getConstRefTodElecConductivitydT() const {return  getConstRefTodLinearKdField()[1][1][0];}
+  virtual  STensor3 &getRefTodElecConductivitydT() {return  getRefTodLinearKdField()[1][1][0];}
 
-  virtual const  STensor3 &getConstRefTodCrossElecConductivitydT() const {return  getConstRefTodLinearKdField()[3][0];}
-  virtual  STensor3 &getRefTodCrossElecConductivitydT() {return  getRefTodLinearKdField()[3][0];}
+  virtual const  STensor3 &getConstRefTodCrossElecConductivitydT() const {return  getConstRefTodLinearKdField()[1][0][0];}
+  virtual  STensor3 &getRefTodCrossElecConductivitydT() {return  getRefTodLinearKdField()[1][0][0];}
 
-  virtual const  STensor3 &getConstRefTodTherConductivitydT() const {return  getConstRefTodLinearKdField()[0][0];}
-  virtual  STensor3 &getRefTodTherConductivitydT() {return  getRefTodLinearKdField()[0][0];}
+  virtual const  STensor3 &getConstRefTodTherConductivitydT() const {return  getConstRefTodLinearKdField()[0][0][0];}
+  virtual  STensor3 &getRefTodTherConductivitydT() {return  getRefTodLinearKdField()[0][0][0];}
 
-  virtual const  STensor3 &getConstRefTodCrossTherConductivitydT() const {return  getConstRefTodLinearKdField()[1][0];}
-  virtual  STensor3 &getRefTodCrossTherConductivitydT() {return  getRefTodLinearKdField()[1][0];}
+  virtual const  STensor3 &getConstRefTodCrossTherConductivitydT() const {return  getConstRefTodLinearKdField()[0][1][0];}
+  virtual  STensor3 &getRefTodCrossTherConductivitydT() {return  getRefTodLinearKdField()[0][1][0];}
 
-  virtual const  STensor3 &getConstRefTodTherConductivitydv() const {return  getConstRefTodLinearKdField()[0][1];}
-  virtual  STensor3 &getRefTodTherConductivitydv() {return  getRefTodLinearKdField()[0][1];}
+  virtual const  STensor3 &getConstRefTodTherConductivitydv() const {return  getConstRefTodLinearKdField()[0][0][1];}
+  virtual  STensor3 &getRefTodTherConductivitydv() {return  getRefTodLinearKdField()[0][0][1];}
 
-  virtual const  STensor3 &getConstRefTodCrossElecConductivitydv() const {return  getConstRefTodLinearKdField()[3][1];}
-  virtual  STensor3 &getRefTodCrossElecConductivitydv() {return  getRefTodLinearKdField()[3][1];}
+  virtual const  STensor3 &getConstRefTodCrossElecConductivitydv() const {return  getConstRefTodLinearKdField()[1][0][1];}
+  virtual  STensor3 &getRefTodCrossElecConductivitydv() {return  getRefTodLinearKdField()[1][0][1];}
 
-  virtual const  STensor43 &getConstRefTodElecConductivitydF() const {return  getConstRefTodLinearKdF()[2];}
-  virtual  STensor43 &getRefTodElecConductivitydF() {return  getRefTodLinearKdF()[2];}
+  virtual const  STensor43 &getConstRefTodElecConductivitydF() const {return  getConstRefTodLinearKdF()[1][1];}
+  virtual  STensor43 &getRefTodElecConductivitydF() {return  getRefTodLinearKdF()[1][1];}
 
-  virtual const  STensor43 &getConstRefTodCrossElecConductivitydF() const {return  getConstRefTodLinearKdF()[3];}
-  virtual  STensor43 &getRefTodCrossElecConductivitydF() {return  getRefTodLinearKdF()[3];}
+  virtual const  STensor43 &getConstRefTodCrossElecConductivitydF() const {return  getConstRefTodLinearKdF()[1][0];}
+  virtual  STensor43 &getRefTodCrossElecConductivitydF() {return  getRefTodLinearKdF()[1][0];}
 
-  virtual const  STensor43 &getConstRefTodTherConductivitydF() const {return  getConstRefTodLinearKdF()[0];}
-  virtual  STensor43 &getRefTodTherConductivitydF() {return  getRefTodLinearKdF()[0];}
+  virtual const  STensor43 &getConstRefTodTherConductivitydF() const {return  getConstRefTodLinearKdF()[0][0];}
+  virtual  STensor43 &getRefTodTherConductivitydF() {return  getRefTodLinearKdF()[0][0];}
 
-  virtual const  STensor43 &getConstRefTodCrossTherConductivitydF() const {return  getConstRefTodLinearKdF()[1];}
-  virtual  STensor43 &getRefTodCrossTherConductivitydF() {return  getRefTodLinearKdF()[1];}
+  virtual const  STensor43 &getConstRefTodCrossTherConductivitydF() const {return  getConstRefTodLinearKdF()[0][1];}
+  virtual  STensor43 &getRefTodCrossTherConductivitydF() {return  getRefTodLinearKdF()[0][1];}
 
-  virtual const double &getConstRefTofvJump() const {return fvJump;}
-  virtual double &getRefTofvJump() {return  fvJump;}
+  virtual const double getConstRefTofvJump() const {return getConstRefToThermoFieldJump()(1);}
+  virtual double &getRefTofvJump() {return  getRefToThermoFieldJump()(1);}
 
-  virtual const double getConstRefToOneOverTemperatureJump() const {return getConstRefToOneOverFieldJump()(0);}
-  virtual double &getRefToOneOverTemperatureJump() {return  getRefToOneOverFieldJump()(0);}
+  virtual const double getConstRefToOneOverTemperatureJump() const {return getConstRefToThermoFieldJump()(0);}
+  virtual double &getRefToOneOverTemperatureJump() {return  getRefToThermoFieldJump()(0);}
 
-  virtual const double getConstRefTodOneOverTemperatureJumpdTm() const {return getConstRefTodOneOverFieldJumpdFieldm()(0,0);}
-  virtual double &getRefTodOneOverTemperatureJumpdTm() {return  getRefTodOneOverFieldJumpdFieldm()(0,0);}
+  virtual const double getConstRefTodOneOverTemperatureJumpdTm() const {return getConstRefTodThermoFieldJumpdFieldm()[0][0];}
+  virtual double &getRefTodOneOverTemperatureJumpdTm() {return  getRefTodThermoFieldJumpdFieldm()[0][0];}
 
-  virtual const double getConstRefTodOneOverTemperatureJumpdTp() const {return getConstRefTodOneOverFieldJumpdFieldp()(0,0);}
-  virtual double &getRefTodOneOverTemperatureJumpdTp() {return  getRefTodOneOverFieldJumpdFieldp()(0,0);}
+  virtual const double getConstRefTodOneOverTemperatureJumpdTp() const {return getConstRefTodThermoFieldJumpdFieldp()[0][0];}
+  virtual double &getRefTodOneOverTemperatureJumpdTp() {return  getRefTodThermoFieldJumpdFieldp()[0][0];}
 
-  virtual const double &getConstRefTodfvjumpdvm() const {return dfvjumpdvm;}
-  virtual double &getRefTodfvjumpdvm() {return  dfvjumpdvm;}
+  virtual const double &getConstRefTodfvjumpdvm() const {return getConstRefTodThermoFieldJumpdFieldm()[1][1];}
+  virtual double &getRefTodfvjumpdvm() {return  getRefTodThermoFieldJumpdFieldm()[1][1];}
 
-  virtual const double &getConstRefTodfvjumpdvp() const {return dfvjumpdvp;}
-  virtual double &getRefTodfvjumpdvp() {return  dfvjumpdvp;}
+  virtual const double &getConstRefTodfvjumpdvp() const {return getConstRefTodThermoFieldJumpdFieldp()[1][1];}
+  virtual double &getRefTodfvjumpdvp() {return  getRefTodThermoFieldJumpdFieldp()[1][1];}
 
-  virtual const double &getConstRefTodfvjumpdTm() const {return dfvjumpdTm;}
-  virtual double &getRefTodfvjumpdTm() {return  dfvjumpdTm;}
+  virtual const double &getConstRefTodfvjumpdTm() const {return getConstRefTodThermoFieldJumpdFieldm()[1][0];}
+  virtual double &getRefTodfvjumpdTm() {return  getRefTodThermoFieldJumpdFieldm()[1][0];}
 
-  virtual const double &getConstRefTodfvjumpdTp() const {return dfvjumpdTp;}
-  virtual double &getRefTodfvjumpdTp() {return  dfvjumpdTp;}
+  virtual const double &getConstRefTodfvjumpdTp() const {return getConstRefTodThermoFieldJumpdFieldp()[1][0];}
+  virtual double &getRefTodfvjumpdTp() {return  getRefTodThermoFieldJumpdFieldp()[1][0];}
 
   virtual const double getConstRefToTemperatureJump() const {return getConstRefToFieldJump()(0);}
   virtual double &getRefToTemperatureJump() {return  getRefToFieldJump()(0);}
@@ -2152,53 +2361,53 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   virtual const  SVector3 &getConstRefTodThermalSourcedGradT() const {return  dThermalSourcedGradT;}//dwdgradT
   virtual  SVector3 &getRefTodThermalSourcedGradT() {return  dThermalSourcedGradT;}*/
 
-  virtual const double &getConstRefTofT() const {return  fT;}
-  virtual double &getRefTofT() {return fT;}
+  virtual const double getConstRefTofT() const {return  getConstRefToThermoField(0);}
+  virtual double &getRefTofT() {return getRefToThermoField(0);}
 
-  virtual const SVector3 &getConstRefToGradfT() const {return gradfT;}
-  virtual SVector3 &getRefToGradfT() {return gradfT;}
+  virtual const SVector3 &getConstRefToGradfT() const {return getConstRefToGradThermoField()[0];}
+  virtual SVector3 &getRefToGradfT() {return getRefToGradThermoField()[0];}
 
-  virtual const double &getConstRefTofV() const {return  fV;}
-  virtual double &getRefTofV() {return  fV;}
+  virtual const double getConstRefTofV() const {return  getConstRefToThermoField(1);}
+  virtual double &getRefTofV() {return  getRefToThermoField(1);}
 
-  virtual const SVector3 &getConstRefToGradfV() const {return gradfV;}
-  virtual SVector3 &getRefToGradfV() {return gradfV;}
+  virtual const SVector3 &getConstRefToGradfV() const {return getConstRefToGradThermoField()[1];}
+  virtual SVector3 &getRefToGradfV() {return getRefToGradThermoField()[1];}
 
-  virtual const STensor3 &getConstRefTodgradVdgradfV() const {return dgradVdgradfV;}
-  virtual STensor3 &getRefTodgradVdgradfV() {return  dgradVdgradfV;}
+  virtual const STensor3 &getConstRefTodgradVdgradfV() const {return getConstRefTodGradFielddGradThermoField()[1][1];}
+  virtual STensor3 &getRefTodgradVdgradfV() {return  getRefTodGradFielddGradThermoField()[1][1];}
 
-  virtual const STensor3 &getConstRefTodgradVdgradfT() const {return dgradVdgradfT;}
-  virtual STensor3 &getRefTodgradVdgradfT() {return  dgradVdgradfT;}
+  virtual const STensor3 &getConstRefTodgradVdgradfT() const {return getConstRefTodGradFielddGradThermoField()[1][0];}
+  virtual STensor3 &getRefTodgradVdgradfT() {return  getRefTodGradFielddGradThermoField()[1][0];}
 
-  virtual const STensor3 &getConstRefTodgradTdgradfT() const {return dgradTdgradfT;}
-  virtual STensor3 &getRefTodgradTdgradfT() {return  dgradTdgradfT;}
+  virtual const STensor3 &getConstRefTodgradTdgradfT() const {return getConstRefTodGradFielddGradThermoField()[0][0];}
+  virtual STensor3 &getRefTodgradTdgradfT() {return  getRefTodGradFielddGradThermoField()[0][0];}
 
-  virtual const STensor3 &getConstRefTodgradTdgradfV() const {return dgradTdgradfV;}
-  virtual STensor3 &getRefTodgradTdgradfV() {return  dgradTdgradfV;}
+  virtual const STensor3 &getConstRefTodgradTdgradfV() const {return getConstRefTodGradFielddGradThermoField()[0][1];}
+  virtual STensor3 &getRefTodgradTdgradfV() {return  getRefTodGradFielddGradThermoField()[0][1];}
 
-  virtual const double &getConstRefTodVdfV() const {return dVdfV;}
-  virtual double &getRefTodVdfV() {return  dVdfV;}
+  virtual const double &getConstRefTodVdfV() const {return getConstRefTodFielddThermoField()[1][1];}
+  virtual double &getRefTodVdfV() {return  getRefTodFielddThermoField()[1][1];}
 
-  virtual const double &getConstRefTodVdfT() const {return dVdfT;}
-  virtual double &getRefTodVdfT() {return  dVdfT;}
+  virtual const double &getConstRefTodVdfT() const {return getConstRefTodFielddThermoField()[1][0];}
+  virtual double &getRefTodVdfT() {return  getRefTodFielddThermoField()[1][0];}
 
-   virtual const double &getConstRefTodTdfT() const {return dTdfT;}
-  virtual double &getRefTodTdfT() {return  dTdfT;}
+   virtual const double &getConstRefTodTdfT() const {return getConstRefTodFielddThermoField()[0][0];}
+  virtual double &getRefTodTdfT() {return  getRefTodFielddThermoField()[0][0];}
 
-  virtual const double &getConstRefTodTdfV() const {return dTdfV;}
-  virtual double &getRefTodTdfV() {return  dTdfV;}
+  virtual const double &getConstRefTodTdfV() const {return getConstRefTodFielddThermoField()[0][1];}
+  virtual double &getRefTodTdfV() {return  getRefTodFielddThermoField()[0][1];}
 
-    virtual const SVector3  &getConstRefTodgradVdfV() const {return dgradVdfV;}
-  virtual SVector3  &getRefTodgradVdfV() {return  dgradVdfV;}
+    virtual const SVector3  &getConstRefTodgradVdfV() const {return getConstRefTodGradFielddThermoField()[1][1];}
+  virtual SVector3  &getRefTodgradVdfV() {return  getRefTodGradFielddThermoField()[1][1];}
 
-  virtual const SVector3  &getConstRefTodgradVdfT() const {return dgradVdfT;}
-  virtual SVector3  &getRefTodgradVdfT() {return  dgradVdfT;}
+  virtual const SVector3  &getConstRefTodgradVdfT() const {return getConstRefTodGradFielddThermoField()[1][0];}
+  virtual SVector3  &getRefTodgradVdfT() {return  getRefTodGradFielddThermoField()[1][0];}
 
-   virtual const SVector3  &getConstRefTodgradTdfT() const {return dgradTdfT;}
-  virtual SVector3  &getRefTodgradTdfT() {return  dgradTdfT;}
+   virtual const SVector3  &getConstRefTodgradTdfT() const {return getConstRefTodGradFielddThermoField()[0][0];}
+  virtual SVector3  &getRefTodgradTdfT() {return  getRefTodGradFielddThermoField()[0][0];}
 
-  virtual const SVector3  &getConstRefTodgradTdfV() const {return dgradTdfV;}
-  virtual SVector3  &getRefTodgradTdfV() {return  dgradTdfV;}
+  virtual const SVector3  &getConstRefTodgradTdfV() const {return getConstRefTodGradFielddThermoField()[0][1];}
+  virtual SVector3  &getRefTodgradTdfV() {return  getRefTodGradFielddThermoField()[0][1];}
 
    virtual const SVector3  &getConstRefToFluxEnergy() const {return getConstRefToFlux()[0];}
    virtual SVector3 &getRefToFluxEnergy(){return  getRefToFlux()[0];}
@@ -2218,17 +2427,17 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
    virtual const STensor33 &getConstRefTodFluxEnergydF() const {return getConstRefTodFluxdF()[0];}
    virtual STensor33 &getRefTodFluxEnergydF(){return  getRefTodFluxdF()[0];}
 
-   virtual const STensor3 &getConstRefToEnergyConductivity() const {return jy1;}
-   virtual STensor3 &getRefToEnergyConductivity(){return  jy1;}
+   virtual const STensor3 *getConstRefToEnergyConductivity() const {return getConstRefToEnergyK()[0][0];}
+   virtual void setRefToEnergyConductivity(const STensor3 &eT){return  setConstRefToEnergyK(eT,0,0);}
 
-   virtual const STensor3 &getConstRefTodEnergyConductivitydT() const {return djy1dT;}
-   virtual STensor3 &getRefTodEnergyConductivitydT(){return  djy1dT;}
+   virtual const STensor3 &getConstRefTodEnergyConductivitydT() const {return getConstRefTodEnergyKdField()[0][0][0];}
+   virtual STensor3 &getRefTodEnergyConductivitydT(){return  getRefTodEnergyKdField()[0][0][0];}
 
-   virtual const STensor3 &getConstRefTodEnergyConductivitydV() const {return djy1dV;}
-   virtual STensor3 &getRefTodEnergyConductivitydV(){return djy1dV;}
+   virtual const STensor3 &getConstRefTodEnergyConductivitydV() const {return getConstRefTodEnergyKdField()[0][0][1];}
+   virtual STensor3 &getRefTodEnergyConductivitydV(){return getRefTodEnergyKdField()[0][0][1];}
 
-   virtual const STensor43 &getConstRefTodEnergyConductivitydF() const {return djy1dF;}
-   virtual STensor43 &getRefTodEnergyConductivitydF(){return djy1dF;}
+   virtual const STensor43 &getConstRefTodEnergyConductivitydF() const {return getConstRefTodEnergyKdF()[0][0];}
+   virtual STensor43 &getRefTodEnergyConductivitydF(){return getRefTodEnergyKdF()[0][0];}
 
   virtual const STensor3 *getConstRefToStiff_alphaDilatation() const {return getConstRefToLinearSymmetrizationCoupling()[0];}
   virtual void setRefToStiff_alphaDilatation(const STensor3 &eT) {setConstRefToLinearSymmetrizationCoupling(eT,0);}
diff --git a/dG3D/src/dG3DMaterialLaw.cpp b/dG3D/src/dG3DMaterialLaw.cpp
index 8b62feb59..34c7ac4b0 100644
--- a/dG3D/src/dG3DMaterialLaw.cpp
+++ b/dG3D/src/dG3DMaterialLaw.cpp
@@ -2610,7 +2610,7 @@ void LinearElecTherMechDG3DMaterialLaw::stress(IPVariable* ipv, const IPVariable
 	SVector3 &djydT=ipvcur->getRefTodFluxEnergydT();
 	STensor3 &djydgradT=ipvcur->getRefTodFluxEnergydGradT();
         STensor33 &djydF=ipvcur->getRefTodFluxEnergydF();
-	STensor3 &jy1=ipvcur->getRefToEnergyConductivity();
+        ipvcur->setRefToEnergyConductivity(this->jy1);
 	STensor3 &djy1dT= ipvcur->getRefTodEnergyConductivitydT();
 	STensor3 &djy1dV= ipvcur->getRefTodEnergyConductivitydV();
 	STensor43 &djy1dF=ipvcur->getRefTodEnergyConductivitydF();
@@ -2752,7 +2752,7 @@ void mlawAnIsotropicElecTherMechDG3DMaterialLaw::stress(IPVariable* ipv, const I
 	SVector3 &djydT=ipvcur->getRefTodFluxEnergydT();
 	STensor3 &djydgradT=ipvcur->getRefTodFluxEnergydGradT();
         STensor33 &djydF=ipvcur->getRefTodFluxEnergydF();
-	STensor3 &jy1=ipvcur->getRefToEnergyConductivity();
+	ipvcur->setRefToEnergyConductivity(this->jy1);
 	STensor3 &djy1dT= ipvcur->getRefTodEnergyConductivitydT();
 	STensor3 &djy1dV= ipvcur->getRefTodEnergyConductivitydV();
 	STensor43 &djy1dF=ipvcur->getRefTodEnergyConductivitydF();
@@ -2911,7 +2911,7 @@ void mlawElecSMPDG3DMaterialLaw::stress(IPVariable* ipv, const IPVariable* ipvp,
 	SVector3 &djydT    = ipvcur->getRefTodFluxEnergydT();
 	STensor3 &djydgradT= ipvcur->getRefTodFluxEnergydGradT();
         STensor33 &djydF   = ipvcur->getRefTodFluxEnergydF();
-	STensor3 &jy1      = ipvcur->getRefToEnergyConductivity();
+	ipvcur->setRefToEnergyConductivity(this->jy1);
 	STensor3 &djy1dT   = ipvcur->getRefTodEnergyConductivitydT();
 	STensor3 &djy1dV   = ipvcur->getRefTodEnergyConductivitydV();
 	STensor43 &djy1dF  = ipvcur->getRefTodEnergyConductivitydF();
diff --git a/dG3D/src/dG3DMaterialLaw.h b/dG3D/src/dG3DMaterialLaw.h
index 62214f840..04098ee29 100644
--- a/dG3D/src/dG3DMaterialLaw.h
+++ b/dG3D/src/dG3DMaterialLaw.h
@@ -1098,7 +1098,7 @@ class LinearElecTherMechDG3DMaterialLaw : public dG3DMaterialLaw // public mater
  protected:
   mlawLinearElecTherMech *_lawLinearETM; // pointer to allow to choose between LLN style or Gmsh Style. The choice is performed by the constructor (2 constructors with != arguments)
   STensor3 	         Stiff_alphaDilatation;
-  STensor3                lineark10, lineark20, linearl10, linearl20;
+  STensor3                lineark10, lineark20, linearl10, linearl20, jy1;
  public:
   LinearElecTherMechDG3DMaterialLaw(const int num,const double rho,const double Ex, const double Ey, const double Ez, const double Vxy, const double Vxz, const double Vyz,
 		const double MUxy, const double MUxz, const double MUyz, const double alpha, const double beta, const double gamma,const double t0,const double Kx,
@@ -1151,7 +1151,7 @@ class mlawAnIsotropicElecTherMechDG3DMaterialLaw :public dG3DMaterialLaw
 
  // pointer to allow to choose between LLN style or Gmsh Style. The choice is performed by the constructor (2 constructors with != arguments)
  //modified
-  STensor3                Kref10, Kref20, Lref10, Lref20;
+  STensor3                Kref10, Kref20, Lref10, Lref20, jy1;
  public:
 
 
@@ -1204,7 +1204,7 @@ class mlawElecSMPDG3DMaterialLaw :public dG3DMaterialLaw
    STensor3	 Stiff_alphaDilatation;
  // pointer to allow to choose between LLN style or Gmsh Style. The choice is performed by the constructor (2 constructors with != arguments)
 //modified
- STensor3                K10, K20, L10, L20;
+ STensor3                K10, K20, L10, L20, jy1;
  public:
 
 
diff --git a/dG3D/src/dG3DTerms.cpp b/dG3D/src/dG3DTerms.cpp
index 751ada164..fb9e0beba 100644
--- a/dG3D/src/dG3DTerms.cpp
+++ b/dG3D/src/dG3DTerms.cpp
@@ -2713,8 +2713,8 @@ void ElecTherMechDG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVec
           const SVector3  &fluxVm = (ipvm->getConstRefToFluxV());
           const SVector3  &fluxVp = (ipvp->getConstRefToFluxV());
 
-          const STensor3  &jy1m	= (ipvm->getConstRefToEnergyConductivity());
-          const STensor3  &jy1p	= (ipvp->getConstRefToEnergyConductivity());
+          const STensor3 jy1m	= *(ipvm->getConstRefToEnergyConductivity());
+          const STensor3 jy1p	= *(ipvp->getConstRefToEnergyConductivity());
           const SVector3  &fluxjym= (ipvm->getConstRefToFluxEnergy());
           const SVector3  &fluxjyp= (ipvp->getConstRefToFluxEnergy());
 
@@ -2948,8 +2948,8 @@ void ElecTherMechDG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVec
           const SVector3  &fluxVm = (ipvm->getConstRefToFluxV());
           const SVector3  &fluxVp = (ipvp->getConstRefToFluxV());
 
-          const STensor3  &jy1m	= (ipvm->getConstRefToEnergyConductivity());
-          const STensor3  &jy1p	= (ipvp->getConstRefToEnergyConductivity());
+          const STensor3  jy1m	= *(ipvm->getConstRefToEnergyConductivity());
+          const STensor3  jy1p	= *(ipvp->getConstRefToEnergyConductivity());
           const SVector3  &fluxjym= (ipvm->getConstRefToFluxEnergy());
           const SVector3  &fluxjyp= (ipvp->getConstRefToFluxEnergy());
 
@@ -3328,12 +3328,12 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
             const SVector3 *dgradTdfTp     = &(ipvp->getConstRefTodgradTdfT());
             const SVector3 *dgradTdfVp     = &(ipvp->getConstRefTodgradTdfV());
 
-            const STensor3  *jy1m	= &(ipvm->getConstRefToEnergyConductivity());
+            const STensor3  *jy1m	= (ipvm->getConstRefToEnergyConductivity());
             const STensor43 *djy1dFm    = &(ipvm->getConstRefTodEnergyConductivitydF());
             const STensor3  *djy1dVm	= &(ipvm->getConstRefTodEnergyConductivitydV());
             const STensor3  *djy1dTm	= &(ipvm->getConstRefTodEnergyConductivitydT());
 
-            const STensor3  *jy1p	= &(ipvp->getConstRefToEnergyConductivity());
+            const STensor3  *jy1p	= (ipvp->getConstRefToEnergyConductivity());
             const STensor43 *djy1dFp    = &(ipvp->getConstRefTodEnergyConductivitydF());
             const STensor3  *djy1dVp	= &(ipvp->getConstRefTodEnergyConductivitydV());
             const STensor3  *djy1dTp	= &(ipvp->getConstRefTodEnergyConductivitydT());
@@ -4433,12 +4433,12 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
             const SVector3  *djedTm     = &(ipvm->getConstRefTodFluxVdT());
             const SVector3  *djedTp     = &(ipvp->getConstRefTodFluxVdT());
 
-            const STensor3  *jy1m	= &(ipvm->getConstRefToEnergyConductivity());
+            const STensor3  *jy1m	= (ipvm->getConstRefToEnergyConductivity());
             const STensor43 *djy1dFm    = &(ipvm->getConstRefTodEnergyConductivitydF());
             const STensor3  *djy1dVm	= &(ipvm->getConstRefTodEnergyConductivitydV());
             const STensor3  *djy1dTm	= &(ipvm->getConstRefTodEnergyConductivitydT());
 
-            const STensor3  *jy1p	= &(ipvp->getConstRefToEnergyConductivity());
+            const STensor3  *jy1p	= (ipvp->getConstRefToEnergyConductivity());
             const STensor43 *djy1dFp    = &(ipvp->getConstRefTodEnergyConductivitydF());
             const STensor3  *djy1dVp	= &(ipvp->getConstRefTodEnergyConductivitydV());
             const STensor3  *djy1dTp	= &(ipvp->getConstRefTodEnergyConductivitydT());
diff --git a/dG3D/src/nonLocalDamageDG3DIPVariable.h b/dG3D/src/nonLocalDamageDG3DIPVariable.h
index f1de796d4..6a2c0a580 100644
--- a/dG3D/src/nonLocalDamageDG3DIPVariable.h
+++ b/dG3D/src/nonLocalDamageDG3DIPVariable.h
@@ -182,10 +182,14 @@ class virtualNonLocalDamageDG3DIPVariable : public dG3DIPVariableBase{
     virtual void restart();
 
   // extradof
-  virtual const std::vector<std::vector<STensor3> >  &getConstRefTodLinearKdField() const {return _ipvBase->getConstRefTodLinearKdField();}; 
-  virtual std::vector<std::vector<STensor3> >  &getRefTodLinearKdField() {return _ipvBase->getRefTodLinearKdField();}; 
-  virtual const std::vector<STensor43>  &getConstRefTodLinearKdF() const {return _ipvBase->getConstRefTodLinearKdF();}; 
-  virtual std::vector<STensor43>  &getRefTodLinearKdF() {return _ipvBase->getRefTodLinearKdF();}; 
+  virtual const std::vector<std::vector<std::vector<STensor3> > >  &getConstRefTodLinearKdField() const {return _ipvBase->getConstRefTodLinearKdField();}; 
+  virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodLinearKdField() {return _ipvBase->getRefTodLinearKdField();}; 
+  virtual const std::vector<std::vector<STensor43>>  &getConstRefTodLinearKdF() const {return _ipvBase->getConstRefTodLinearKdF();}; 
+  virtual std::vector<std::vector<STensor43>>  &getRefTodLinearKdF() {return _ipvBase->getRefTodLinearKdF();}; 
+  virtual const std::vector<std::vector<std::vector<STensor3> > >  &getConstRefTodEnergyKdField() const {return _ipvBase->getConstRefTodEnergyKdField();}; 
+  virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodEnergyKdField() {return _ipvBase->getRefTodEnergyKdField();}; 
+  virtual const std::vector<std::vector<STensor43>>  &getConstRefTodEnergyKdF() const {return _ipvBase->getConstRefTodEnergyKdF();}; 
+  virtual std::vector<std::vector<STensor43>>  &getRefTodEnergyKdF() {return _ipvBase->getRefTodEnergyKdF();};
   virtual int getNumConstitutiveExtraDofDiffusionVariable() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
@@ -312,6 +316,25 @@ class virtualNonLocalDamageDG3DIPVariable : public dG3DIPVariableBase{
          Msg::Fatal("getConstRefTolinearK() : index out of range");
     }
   }
+  virtual const std::vector<std::vector<const STensor3*> > &getConstRefToEnergyK() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefToEnergyK() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->EnergyK;
+  }
+  virtual void setConstRefToEnergyK(const STensor3 &eT, int i, int j)
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefToEnergyK() : _constitutiveExtraDofDiffusionData not created");
+    else
+    {
+      if(i < getNumConstitutiveExtraDofDiffusionVariable() && j< getNumConstitutiveExtraDofDiffusionVariable())
+         _constitutiveExtraDofDiffusionData->linearK[i][j] = &eT;
+      else
+         Msg::Fatal("getConstRefToEnergyK() : index out of range");
+    }
+  }
   virtual const fullVector<double>  &getConstRefToFieldSource() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
@@ -571,6 +594,121 @@ class virtualNonLocalDamageDG3DIPVariable : public dG3DIPVariableBase{
       return _constitutiveExtraDofDiffusionData->dMechanicalSourcedNonLocalVariable;
   }
 
+  //ThermoField (fT & fv)
+
+  virtual double getConstRefToThermoField(const int idex) const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefToThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->thermoField(idex);
+  }
+  virtual double  &getRefToThermoField(const int idex)
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefToThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->thermoField(idex);
+  }
+  virtual const std::vector<SVector3>  &getConstRefToGradThermoField() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefToGradThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->gradThermoField;
+  }
+  virtual std::vector<SVector3>  &getRefToGradThermoField()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefToGradThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->gradThermoField;
+  }
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodFielddThermoField() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefTodFielddThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dFielddThermoField;
+  }
+  virtual std::vector<std::vector<double>>  &getRefTodFielddThermoField()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefTodFielddThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dFielddThermoField;
+  }
+  virtual const std::vector<std::vector<SVector3>>  &getConstRefTodGradFielddThermoField() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefTodGradFielddThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dGradFielddThermoField;
+  }
+  virtual std::vector<std::vector<SVector3>>  &getRefTodGradFielddThermoField()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefTodGradFielddThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dGradFielddThermoField;
+  }
+  virtual const std::vector<std::vector<STensor3>>  &getConstRefTodGradFielddGradThermoField() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefTodGradFielddGradThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dGradFielddGradThermoField;
+  }
+  virtual std::vector<std::vector<STensor3>>  &getRefTodGradFielddGradThermoField()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefTodGradFielddGradThermoField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dGradFielddGradThermoField;
+  }
+  virtual const fullVector<double>  &getConstRefToThermoFieldJump() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefToThermoFieldJump() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->thermoFieldJump;
+  } 
+  virtual fullVector<double>  &getRefToThermoFieldJump()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefToThermoFieldJump() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->thermoFieldJump;
+  } 
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldm() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefTodThermoFieldJumpdFieldm() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dThermoFieldJumpdFieldm;
+  } 
+  virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldm()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefTodThermoFieldJumpdFieldm() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dThermoFieldJumpdFieldm;
+  } 
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldp() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefTodThermoFieldJumpdFieldp() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dThermoFieldJumpdFieldp;
+  }
+  virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldp()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefTodThermoFieldJumpdFieldp() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dThermoFieldJumpdFieldp;
+  }
+
 };
 
 class nonLocalDamageDG3DIPVariable : public dG3DIPVariable
-- 
GitLab


From 4cb4bec4fd49770388e0d3c1b71fb4a7e6fcb442 Mon Sep 17 00:00:00 2001
From: pareja <mpareja@uliege.be>
Date: Mon, 17 Dec 2018 11:40:03 +0100
Subject: [PATCH 4/9] Migration almost finished and some modifications on
 ElecTherMech mlaws

---
 .../mlawAnIsotropicElecTherMech.cpp           | 119 ++-
 .../materialLaw/mlawAnIsotropicElecTherMech.h |  14 +-
 NonLinearSolver/materialLaw/mlawElecSMP.cpp   | 136 ++-
 NonLinearSolver/materialLaw/mlawElecSMP.h     |  14 +-
 .../materialLaw/mlawLinearElecTherMech.cpp    |  48 +-
 .../materialLaw/mlawLinearElecTherMech.h      |  14 +-
 dG3D/src/FractureCohesiveDG3DIPVariable.h     |  42 +-
 dG3D/src/axisymmetricDG3DDomain.cpp           |   4 +-
 dG3D/src/axisymmetricDG3DTerms.cpp            |  18 +-
 dG3D/src/axisymmetricDG3DTerms.h              |   4 +-
 dG3D/src/dG3DDomain.cpp                       |  62 +-
 dG3D/src/dG3DDomain.h                         |  14 +-
 dG3D/src/dG3DEnhancedStrainIPVariable.h       |  42 +-
 dG3D/src/dG3DIPVariable.cpp                   |  87 +-
 dG3D/src/dG3DIPVariable.h                     | 346 +++++---
 dG3D/src/dG3DMaterialLaw.cpp                  |  66 +-
 dG3D/src/dG3DTerms.cpp                        | 833 +++++++++++++++---
 dG3D/src/dG3DTerms.h                          |  76 +-
 dG3D/src/nonLocalDamageDG3DIPVariable.h       | 110 +--
 19 files changed, 1494 insertions(+), 555 deletions(-)

diff --git a/NonLinearSolver/materialLaw/mlawAnIsotropicElecTherMech.cpp b/NonLinearSolver/materialLaw/mlawAnIsotropicElecTherMech.cpp
index ce1d8edfd..23629bbe8 100644
--- a/NonLinearSolver/materialLaw/mlawAnIsotropicElecTherMech.cpp
+++ b/NonLinearSolver/materialLaw/mlawAnIsotropicElecTherMech.cpp
@@ -117,9 +117,11 @@ void mlawAnIsotropicElecTherMech::constitutive(
 			    STensor3 &dl10dT,
 			    STensor3 &dl20dT,
 			    STensor3 &dk10dT,
-			    STensor3 &dK20dT,
+			    STensor3 &dk20dT,
+			    STensor3 &dl10dv,
 			    STensor3 &dl20dv,
 			    STensor3 &dk10dv,
+			    STensor3 &dk20dv,
 			    STensor43 &dl10dF,
 			    STensor43 &dl20dF,
 			    STensor43 &dk10dF,
@@ -130,14 +132,16 @@ void mlawAnIsotropicElecTherMech::constitutive(
 			    SVector3  &djydT,
 			    STensor3  &djydgradT,
                             STensor33 &djydF,
-			    STensor3  &jy1,
-			    STensor3  &djy1dT,
-			    STensor3  &djy1dV,
-			    STensor43 &djy1dF,		
+			    STensor3 &djydgradVdT,
+			    STensor3 &djydgradVdV,
+			    STensor43 &djydgradVdF,	
+			    STensor3 &djydgradTdT,
+			    STensor3 &djydgradTdV,
+			    STensor43 &djydgradTdF,	
                             const bool stiff
                            )const
 {
-    mlawAnIsotropicTherMech::constitutive(F0, Fn, P, q0, q1, Tangent, T0,	T, gradT, fluxT, dPdT, dqdgradT, dqdT, dqdF, w,	dwdt, dwdf, stiff);
+    mlawAnIsotropicTherMech::constitutive(F0, Fn, P, q0, q1, Tangent, T0, T, gradT, fluxT, dPdT, dqdgradT, dqdT, dqdF, w,	dwdt, dwdf, stiff);
     //these ones will be recomputed
     fluxT*=0.;
     dqdgradT*=0.;
@@ -156,7 +160,7 @@ void mlawAnIsotropicElecTherMech::constitutive(
     STensorOperation::zero(dLdT);
     STensorOperation::zero(dKdT);
     
-   /*  dseebeckdT*=0.;
+    dseebeckdT*=0.;
     djedV*=0.;
     djedT*=0.;
     dqdV*=0.;
@@ -168,9 +172,12 @@ void mlawAnIsotropicElecTherMech::constitutive(
     fluxjy*=0.;
     djedF*=0.; dqdF*=0;djydF*=0.;
     djydgradT*=0.;djydgradV*=0.; djydV*=0.; djydT*=0.;
-    jy1*=0.;djy1dT*=0.;djy1dV*=0.; djy1dF*=0.;
+  //jy1*=0.;djy1dT*=0.;djy1dV*=0.; djy1dF*=0.;
     
-    l10*=0.;l20*=0.;k10*=0.;k20*=0.;dl10dT*=0.;dl20dT*=0.;dk10dT*=0.;dK20dT*=0.;dl20dv*=0.;dk10dv*=0.;dl10dF*=0.;dl20dF*=0.;dk10dF*=0.;dk20dF*=0.;*/
+    l10*=0.;l20*=0.;k10*=0.;k20*=0.;dl10dT*=0.;dl20dT*=0.;dk10dT*=0.;dk20dT*=0.;dl10dv*=0.;dl20dv*=0.;dk10dv*=0.;dk20dv*=0.;dl10dF*=0.;dl20dF*=0.;dk10dF*=0.;dk20dF*=0.;
+
+    djydgradVdT*=0.;djydgradVdV*=0.;djydgradVdF*=0.;
+    djydgradTdT*=0.;djydgradTdV*=0.;djydgradTdF*=0.;
 	   
     //large defo
     static STensor3 _Lref0,_Kref0;
@@ -199,10 +206,12 @@ void mlawAnIsotropicElecTherMech::constitutive(
       {	 
         l10(i,j) = -_Lref0(i,j)*T*Jac;
 	l20(i,j) = -_Lref0(i,j)*(V*T+_seebeck*T*T)*Jac;
-	k10(i,j) = -_Kref0(i,j)*T*T*Jac-_seebeck*_Lref0(i,j)*T*T*V*Jac-pow(_seebeck,2)*_Lref0(i,j)*pow(T,3)*Jac;
-	k20(i,j) = -_seebeck*T*T*_Lref0(i,j)*Jac ;  	
-	jy1(i,j) = k10(i,j) -_seebeck*_Lref0(i,j)*T*T*V*Jac-_Lref0(i,j)*T*V*V*Jac;
-      // jy1(i,j) = -_Kref0(i,j)*T*T*Jac-2.*_seebeck*_Lref0(i,j)*T*T*V*Jac-pow(_seebeck,2)*_Lref0(i,j)*pow(T,3)*Jac-_Lref0(i,j)*T*V*V*Jac;		
+	//k10(i,j) = -_Kref0(i,j)*T*T*Jac-_seebeck*_Lref0(i,j)*T*T*V*Jac-pow(_seebeck,2)*_Lref0(i,j)*pow(T,3)*Jac;
+	//k20(i,j) = -_seebeck*T*T*_Lref0(i,j)*Jac ; 
+        k20(i,j) = l20(i,j); 	
+      //jy1(i,j) = k10(i,j) -_seebeck*_Lref0(i,j)*T*T*V*Jac-_Lref0(i,j)*T*V*V*Jac;
+      // jy1(i,j) = -_Kref0(i,j)*T*T*Jac-2.*_seebeck*_Lref0(i,j)*T*T*V*Jac-pow(_seebeck,2)*_Lref0(i,j)*pow(T,3)*Jac-_Lref0(i,j)*T*V*V*Jac;	
+        k10(i,j) = -_Kref0(i,j)*T*T*Jac-2.*_seebeck*_Lref0(i,j)*T*T*V*Jac-pow(_seebeck,2)*_Lref0(i,j)*pow(T,3)*Jac-_Lref0(i,j)*T*V*V*Jac;
       }
    }      
    //_Lref0.print("_Lref0");
@@ -231,6 +240,52 @@ void mlawAnIsotropicElecTherMech::constitutive(
   
   if(stiff)
   {
+
+   STensor43 _I4(1.,1.), DinvFndF, dLdF, dKdF;
+   STensor3 dJacdF;
+   STensorOperation::zero(DinvFndF);STensorOperation::zero(dLdF);STensorOperation::zero(dJacdF);
+
+      for (int i=0; i<3; i++){
+        for (int j=0; j<3; j++){
+          for (int p=0; p<3; p++){
+            for (int q=0; q<3; q++){
+              for (int k=0; k<3; k++){
+                for (int l=0; l<3; l++){
+                  DinvFndF(i,j,k,l) -= Fninv(i,p)*_I4(p,q,k,l)*Fninv(q,j);
+                }
+              }
+            }
+          }
+        }
+      }
+
+
+     for(int i = 0; i< 3; i++)
+     {
+       for(int j = 0; j< 3; j++)
+       {
+         dJacdF(i,j)=Jac*Fninv(j,i);
+         for(int k = 0; k< 3; k++)
+         {
+           for(int l = 0; l< 3; l++)
+           {
+	     for(int o = 0; o< 3; o++)
+              {
+                for(int n = 0; n< 3; n++)
+                 {
+                  dLdF(i,j,k,l) += DinvFndF(i,n,k,l)*_l0(n,o)*Fninv(j,o);
+                  dLdF(i,j,k,l) += Fninv(i,n)*_l0(n,o)*DinvFndF(j,o,k,l);
+
+                  dKdF(i,j,k,l) += DinvFndF(i,n,k,l)*_k0(n,o)*Fninv(j,o);
+                  dKdF(i,j,k,l) += Fninv(i,n)*_k0(n,o)*DinvFndF(j,o,k,l);
+                }
+              }
+            }
+          }
+        }
+      }
+
+
     //classical flux
     for(int K = 0; K< 3; K++)
     {
@@ -263,6 +318,18 @@ void mlawAnIsotropicElecTherMech::constitutive(
 	    djydF(K,m,N) -= Fninv(K,m)*(_Lref0(N,L)*V+_Lref0(N,L)*_seebeck*T)*gradV(L)*Jac;
             djydF(K,m,N) -= (_Lref0(K,N)*V+_Lref0(K,N)*_seebeck*T)*Fninv(L,m)*gradV(L)*Jac;
             djydF(K,m,N) += (_Lref0(K,L)*V+_Lref0(K,L)*_seebeck*T)*gradV(L)*Fninv(N,m)*Jac;
+
+            djydgradVdF(K,m,N,L) += dLdF(K,m,N,L)*_seebeck*T*Jac;
+            djydgradVdF(K,m,N,L) += dLdF(K,m,N,L)*V*Jac;
+            djydgradVdF(K,m,N,L) += _Lref0(K,m)*dJacdF(N,L)*_seebeck*T;
+            djydgradVdF(K,m,N,L) += _Lref0(K,m)*dJacdF(N,L)*V;
+
+            djydgradTdF(K,m,N,L) += dKdF(K,m,N,L)*Jac;
+            djydgradTdF(K,m,N,L) += _Kref0(K,m)*dJacdF(N,L);
+            djydgradTdF(K,m,N,L) += dLdF(K,m,N,L)*_seebeck*_seebeck*T*Jac;
+            djydgradTdF(K,m,N,L) += dLdF(K,m,N,L)*_seebeck*V*Jac;
+            djydgradTdF(K,m,N,L) += _Lref0(K,m)*_seebeck*_seebeck*T*dJacdF(N,L);
+            djydgradTdF(K,m,N,L) += _Lref0(K,m)*_seebeck*V*dJacdF(N,L);
           }
         }
       }
@@ -274,14 +341,19 @@ void mlawAnIsotropicElecTherMech::constitutive(
       {
 	dl10dT(i,j) = -_Lref0(i,j)*Jac;
 	dl20dT(i,j) = -_Lref0(i,j)*(V+2*_seebeck*T)*Jac;
-	dk10dT(i,j) = -2*_Kref0(i,j)*T*Jac- 2*_seebeck*_Lref0(i,j)*T*V*Jac-3*pow(_seebeck,2)*_Lref0(i,j)*pow(T,2)*Jac;
-	dK20dT(i,j) = -2*_seebeck*T*_Lref0(i,j)*Jac;
+	//dk10dT(i,j) = -2*_Kref0(i,j)*T*Jac- 2*_seebeck*_Lref0(i,j)*T*V*Jac-3*pow(_seebeck,2)*_Lref0(i,j)*pow(T,2)*Jac;
+	//dk20dT(i,j) = -2*_seebeck*T*_Lref0(i,j)*Jac;
+        dk20dT(i,j) = dl20dT(i,j);
 	 
 	dl20dv(i,j)= -_Lref0(i,j)*(T)*Jac;
-	dk10dv(i,j)= -_seebeck*_Lref0(i,j)*T*T*Jac;
+	dk20dv(i,j)= dl20dv(i,j);
+	//dk10dv(i,j)= -_seebeck*_Lref0(i,j)*T*T*Jac;
+
+        dk10dT(i,j) = -2.*_Kref0(i,j)*T*Jac- 4.*_seebeck*_Lref0(i,j)*T*V*Jac-3*pow(_seebeck,2)*_Lref0(i,j)*pow(T,2)*Jac-_Lref0(i,j)*V*V*Jac;
+        dk10dv(i,j) = -2.*_seebeck*_Lref0(i,j)*T*T*Jac-2.*_Lref0(i,j)*T*V*Jac; 
 	
-	djy1dT(i,j) = dk10dT(i,j)-2.*_seebeck*_Lref0(i,j)*T*V*Jac-_Lref0(i,j)*V*V*Jac;
-	djy1dV(i,j) = dk10dv(i,j)-1.*_seebeck*_Lref0(i,j)*T*T*Jac-2.*_Lref0(i,j)*T*V*Jac;
+	//djy1dT(i,j) = dk10dT(i,j)-2.*_seebeck*_Lref0(i,j)*T*V*Jac-_Lref0(i,j)*V*V*Jac;
+	//djy1dV(i,j) = dk10dv(i,j)-1.*_seebeck*_Lref0(i,j)*T*T*Jac-2.*_Lref0(i,j)*T*V*Jac;
       }
     }
 
@@ -318,9 +390,10 @@ void mlawAnIsotropicElecTherMech::constitutive(
 		{		  		   
 		  dl10dF(i,j,N,L) = -dldF(i,j,N,L)*T;
  		  dl20dF(i,j,N,L) = -dldF(i,j,N,L)*(V*T+_seebeck*T*T);
-		  dk10dF(i,j,N,L) = -dkdF(i,j,N,L)*T*T- _seebeck*dldF(i,j,N,L)*T*T*V-pow(_seebeck,2)*dldF(i,j,N,L)*pow(T,3);
-		  dk20dF(i,j,N,L) = -_seebeck*T*T*dldF(i,j,N,L);
-		  djy1dF(i,j,N,L) = -dkdF(i,j,N,L)*T*T- 2.*_seebeck*dldF(i,j,N,L)*T*T*V-pow(_seebeck,2)*dldF(i,j,N,L)*pow(T,3)-dldF(i,j,N,L)*T*V*V;
+		  //dk10dF(i,j,N,L) = -dkdF(i,j,N,L)*T*T- _seebeck*dldF(i,j,N,L)*T*T*V-pow(_seebeck,2)*dldF(i,j,N,L)*pow(T,3);
+		  dk20dF(i,j,N,L) = dl20dF(i,j,N,L);
+                  dk10dF(i,j,N,L) = -dkdF(i,j,N,L)*T*T- 2.*_seebeck*dldF(i,j,N,L)*T*T*V-pow(_seebeck,2)*dldF(i,j,N,L)*pow(T,3)-dldF(i,j,N,L)*T*V*V;
+		 // djy1dF(i,j,N,L) = -dkdF(i,j,N,L)*T*T- 2.*_seebeck*dldF(i,j,N,L)*T*T*V-pow(_seebeck,2)*dldF(i,j,N,L)*pow(T,3)-dldF(i,j,N,L)*T*V*V;
 		}
 	    }
 	 }
@@ -369,6 +442,10 @@ void mlawAnIsotropicElecTherMech::constitutive(
 	djydgradT(i,k) =_Kref0(i,k)*Jac;
 	djydgradT(i,k)+=_Lref0(i,k)*_seebeck*_seebeck*T*Jac+_Lref0(i,k)*_seebeck*V*Jac;
 	djydgradV(i,k) =_Lref0(i,k)*_seebeck*T*Jac+_Lref0(i,k)*V*Jac;
+	djydgradVdT(i,k) =_Lref0(i,k)*_seebeck*Jac;
+	djydgradVdV(i,k) =_Lref0(i,k)*Jac;
+	djydgradTdT(i,k)+=_Lref0(i,k)*_seebeck*_seebeck*Jac;
+	djydgradTdV(i,k)+=_Lref0(i,k)*_seebeck*Jac;
       }
    }    
     
diff --git a/NonLinearSolver/materialLaw/mlawAnIsotropicElecTherMech.h b/NonLinearSolver/materialLaw/mlawAnIsotropicElecTherMech.h
index e21650e09..3a5b760ff 100644
--- a/NonLinearSolver/materialLaw/mlawAnIsotropicElecTherMech.h
+++ b/NonLinearSolver/materialLaw/mlawAnIsotropicElecTherMech.h
@@ -82,9 +82,11 @@ public:
 			    STensor3 &dl10dT,
 			    STensor3 &dl20dT,
 			    STensor3 &dk10dT,
-			    STensor3 &dK20dT,
+			    STensor3 &dk20dT,
+			    STensor3 &dl10dv,
 			    STensor3 &dl20dv,
 			    STensor3 &dk10dv,
+			    STensor3 &dk20dv,
 			    STensor43 &dl10dF,
 			    STensor43 &dl20dF,
 			    STensor43 &dk10dF,
@@ -95,10 +97,12 @@ public:
 			    SVector3 &djydT,
 			    STensor3 &djydgradT,
                             STensor33 &djydF,
-			    STensor3 &jy1,
-			    STensor3 &djy1dT,
-			    STensor3 &djy1dV,
-			    STensor43 &djy1dF,
+			    STensor3 &djydgradVdT,
+			    STensor3 &djydgradVdV,
+			    STensor43 &djydgradVdF,
+			    STensor3 &djydgradTdT,
+			    STensor3 &djydgradTdV,
+			    STensor43 &djydgradTdF,
                             const bool stiff
                            ) const;
 			   
diff --git a/NonLinearSolver/materialLaw/mlawElecSMP.cpp b/NonLinearSolver/materialLaw/mlawElecSMP.cpp
index 15919749c..47c283b89 100644
--- a/NonLinearSolver/materialLaw/mlawElecSMP.cpp
+++ b/NonLinearSolver/materialLaw/mlawElecSMP.cpp
@@ -190,9 +190,11 @@ void mlawElecSMP::constitutive(
 			    STensor3 &dl10dT,
 			    STensor3 &dl20dT,
 			    STensor3 &dk10dT,
-			    STensor3 &dK20dT,
+			    STensor3 &dk20dT,
+			    STensor3 &dl10dv,
 			    STensor3 &dl20dv,
 			    STensor3 &dk10dv,
+			    STensor3 &dk20dv,
 			    STensor43 &dl10dF,
 			    STensor43 &dl20dF,
 			    STensor43 &dk10dF,
@@ -203,10 +205,12 @@ void mlawElecSMP::constitutive(
 			    SVector3 &djydT,
 			    STensor3 &djydgradT,
                             STensor33 &djydF,
-			    STensor3 &jy1,
-			    STensor3 &djy1dT,
-			    STensor3 &djy1dV,
-			    STensor43 &djy1dF,
+			    STensor3 &djydgradVdT,
+			    STensor3 &djydgradVdV,
+			    STensor43 &djydgradVdF,
+			    STensor3 &djydgradTdT,
+			    STensor3 &djydgradTdV,
+			    STensor43 &djydgradTdF,
                             const bool stiff
                            )const
 {
@@ -230,13 +234,16 @@ void mlawElecSMP::constitutive(
     STensorOperation::zero(djedF); STensorOperation::zero(djydF);
     STensorOperation::zero(fluxjy);
     STensorOperation::zero(djydgradT); STensorOperation::zero(djydgradV); STensorOperation::zero(djydV); STensorOperation::zero(djydT);
-    STensorOperation::zero(jy1); STensorOperation::zero(djy1dT); STensorOperation::zero(djy1dV); STensorOperation::zero(djy1dF);
+  //STensorOperation::zero(jy1); STensorOperation::zero(djy1dT); STensorOperation::zero(djy1dV); STensorOperation::zero(djy1dF);
        
     STensorOperation::zero(l10); STensorOperation::zero(l20); STensorOperation::zero(k10);     
     STensorOperation::zero(k20); STensorOperation::zero(dl10dT); STensorOperation::zero(dl20dT);
-    STensorOperation::zero(dk10dT); STensorOperation::zero(dK20dT); STensorOperation::zero(dl20dv); 
-    STensorOperation::zero(dk10dv); STensorOperation::zero(dl10dF); STensorOperation::zero(dl20dF); STensorOperation::zero(dk10dF); 
+    STensorOperation::zero(dk10dT); STensorOperation::zero(dk20dT); STensorOperation::zero(dl10dv); STensorOperation::zero(dl20dv); 
+    STensorOperation::zero(dk10dv); STensorOperation::zero(dk20dv); STensorOperation::zero(dl10dF); STensorOperation::zero(dl20dF); STensorOperation::zero(dk10dF); 
     STensorOperation::zero(dk20dF);
+
+    STensorOperation::zero(djydgradTdT);STensorOperation::zero(djydgradTdV);STensorOperation::zero(djydgradTdF);
+    STensorOperation::zero(djydgradVdT);STensorOperation::zero(djydgradVdV);STensorOperation::zero(djydgradVdF);
  
     //large defo
    static STensor3 _Lref0,_Kref0;
@@ -256,20 +263,21 @@ void mlawElecSMP::constitutive(
        }
      }
    }
-  
+  //energy conjugated conductivities
    for(int i = 0; i< 3; i++)
    {
      for(int j = 0; j< 3; j++)
      {
-       l10(i,j) = -_Lref0(i,j)*T*Jac;
-       l20(i,j) = -_Lref0(i,j)*(V*T+_seebeck*T*T)*Jac;
-       k10(i,j) = -_Kref0(i,j)*T*T*Jac- _seebeck*_Lref0(i,j)*T*T*V*Jac-pow(_seebeck,2)*_Lref0(i,j)*pow(T,3)*Jac;
-       k20(i,j) = -_seebeck*T*T*_Lref0(i,j)*Jac ;
-	
-       jy1(i,j) = -_Kref0(i,j)*T*T*Jac-2.*_seebeck*_Lref0(i,j)*T*T*V*Jac-pow(_seebeck,2)*_Lref0(i,j)*pow(T,3)*Jac-_Lref0(i,j)*T*V*V*Jac;	
+        l10(i,j) = -_Lref0(i,j)*T*Jac;
+	l20(i,j) = -_Lref0(i,j)*(V*T+_seebeck*T*T)*Jac;
+	//k10(i,j) = -_Kref0(i,j)*T*T*Jac-_seebeck*_Lref0(i,j)*T*T*V*Jac-pow(_seebeck,2)*_Lref0(i,j)*pow(T,3)*Jac;
+	//k20(i,j) = -_seebeck*T*T*_Lref0(i,j)*Jac ; 
+        k20(i,j) = l20(i,j); 	
+      //jy1(i,j) = k10(i,j) -_seebeck*_Lref0(i,j)*T*T*V*Jac-_Lref0(i,j)*T*V*V*Jac;
+      // jy1(i,j) = -_Kref0(i,j)*T*T*Jac-2.*_seebeck*_Lref0(i,j)*T*T*V*Jac-pow(_seebeck,2)*_Lref0(i,j)*pow(T,3)*Jac-_Lref0(i,j)*T*V*V*Jac;	
+        k10(i,j) = -_Kref0(i,j)*T*T*Jac-2.*_seebeck*_Lref0(i,j)*T*T*V*Jac-pow(_seebeck,2)*_Lref0(i,j)*pow(T,3)*Jac-_Lref0(i,j)*T*V*V*Jac;	
      }
    }
-
    static SVector3 valpat;
    STensorOperation::zero(valpat);
    static STensor3 invLref0;
@@ -310,6 +318,52 @@ void mlawElecSMP::constitutive(
    
    if(stiff)
    {
+
+   STensor43 _I4(1.,1.), DinvFndF, dLdF, dKdF;
+   STensor3 dJacdF;
+   STensorOperation::zero(DinvFndF);STensorOperation::zero(dLdF);STensorOperation::zero(dJacdF);
+
+      for (int i=0; i<3; i++){
+        for (int j=0; j<3; j++){
+          for (int p=0; p<3; p++){
+            for (int q=0; q<3; q++){
+              for (int k=0; k<3; k++){
+                for (int l=0; l<3; l++){
+                  DinvFndF(i,j,k,l) -= Fninv(i,p)*_I4(p,q,k,l)*Fninv(q,j);
+                }
+              }
+            }
+          }
+        }
+      }
+
+
+     for(int i = 0; i< 3; i++)
+     {
+       for(int j = 0; j< 3; j++)
+       {
+         dJacdF(i,j)=Jac*Fninv(j,i);
+         for(int k = 0; k< 3; k++)
+         {
+           for(int l = 0; l< 3; l++)
+           {
+	     for(int o = 0; o< 3; o++)
+              {
+                for(int n = 0; n< 3; n++)
+                 {
+                  dLdF(i,j,k,l) += DinvFndF(i,n,k,l)*_l0(n,o)*Fninv(j,o);
+                  dLdF(i,j,k,l) += Fninv(i,n)*_l0(n,o)*DinvFndF(j,o,k,l);
+
+                  dKdF(i,j,k,l) += DinvFndF(i,n,k,l)*_k0(n,o)*Fninv(j,o);
+                  dKdF(i,j,k,l) += Fninv(i,n)*_k0(n,o)*DinvFndF(j,o,k,l);
+                }
+              }
+            }
+          }
+        }
+      }
+
+
      for(int K = 0; K< 3; K++)
      {
        for(int m = 0; m< 3; m++)
@@ -338,6 +392,19 @@ void mlawElecSMP::constitutive(
 	     djydF(K,m,N) -= Fninv(K,m)*(_Lref0(N,L)*V+_Lref0(N,L)*_seebeck*T)*gradV(L)*Jac;
              djydF(K,m,N) -= (_Lref0(K,N)*V+_Lref0(K,N)*_seebeck*T)*Fninv(L,m)*gradV(L)*Jac;
              djydF(K,m,N) += (_Lref0(K,L)*V+_Lref0(K,L)*_seebeck*T)*gradV(L)*Fninv(N,m)*Jac;
+
+             djydgradVdF(K,m,N,L) += dLdF(K,m,N,L)*_seebeck*T*Jac;
+             djydgradVdF(K,m,N,L) += dLdF(K,m,N,L)*V*Jac;
+             djydgradVdF(K,m,N,L) += _Lref0(K,m)*dJacdF(N,L)*_seebeck*T;
+             djydgradVdF(K,m,N,L) += _Lref0(K,m)*dJacdF(N,L)*V;
+
+             djydgradTdF(K,m,N,L) += dKdF(K,m,N,L)*Jac;
+             djydgradTdF(K,m,N,L) += _Kref0(K,m)*dJacdF(N,L);
+             djydgradTdF(K,m,N,L) += dLdF(K,m,N,L)*_seebeck*_seebeck*T*Jac;
+             djydgradTdF(K,m,N,L) += dLdF(K,m,N,L)*_seebeck*V*Jac;
+             djydgradTdF(K,m,N,L) += _Lref0(K,m)*_seebeck*_seebeck*T*dJacdF(N,L);
+             djydgradTdF(K,m,N,L) += _Lref0(K,m)*_seebeck*V*dJacdF(N,L);
+  
            }
          }
        }
@@ -347,16 +414,21 @@ void mlawElecSMP::constitutive(
      {
        for(int j = 0; j< 3; j++)
        {
-         dl10dT(i,j) = -_Lref0(i,j)*Jac;
-         dl20dT(i,j) = -_Lref0(i,j)*(V+2*_seebeck*T)*Jac;
-         dk10dT(i,j) = -2*_Kref0(i,j)*T*Jac- 2*_seebeck*_Lref0(i,j)*T*V*Jac-3*pow(_seebeck,2)*_Lref0(i,j)*pow(T,2)*Jac;
-         dK20dT(i,j) = -2*_seebeck*T*_Lref0(i,j)*Jac;
+	dl10dT(i,j) = -_Lref0(i,j)*Jac;
+	dl20dT(i,j) = -_Lref0(i,j)*(V+2*_seebeck*T)*Jac;
+	//dk10dT(i,j) = -2*_Kref0(i,j)*T*Jac- 2*_seebeck*_Lref0(i,j)*T*V*Jac-3*pow(_seebeck,2)*_Lref0(i,j)*pow(T,2)*Jac;
+	//dk20dT(i,j) = -2*_seebeck*T*_Lref0(i,j)*Jac;
+        dk20dT(i,j) = dl20dT(i,j);
 	 
-         dl20dv(i,j)= -_Lref0(i,j)*(T)*Jac;
-         dk10dv(i,j)= -_seebeck*_Lref0(i,j)*T*T*Jac;
-	  
-         djy1dT(i,j) = -2.*_Kref0(i,j)*T*Jac- 4.*_seebeck*_Lref0(i,j)*T*V*Jac-3*pow(_seebeck,2)*_Lref0(i,j)*pow(T,2)*Jac-_Lref0(i,j)*V*V*Jac;
-         djy1dV(i,j) = -2.*_seebeck*_Lref0(i,j)*T*T*Jac-2.*_Lref0(i,j)*T*V*Jac;
+	dl20dv(i,j)= -_Lref0(i,j)*(T)*Jac;
+	dk20dv(i,j)= dl20dv(i,j);
+	//dk10dv(i,j)= -_seebeck*_Lref0(i,j)*T*T*Jac;
+
+        dk10dT(i,j) = -2.*_Kref0(i,j)*T*Jac- 4.*_seebeck*_Lref0(i,j)*T*V*Jac-3*pow(_seebeck,2)*_Lref0(i,j)*pow(T,2)*Jac-_Lref0(i,j)*V*V*Jac;
+        dk10dv(i,j) = -2.*_seebeck*_Lref0(i,j)*T*T*Jac-2.*_Lref0(i,j)*T*V*Jac; 
+	
+	//djy1dT(i,j) = dk10dT(i,j)-2.*_seebeck*_Lref0(i,j)*T*V*Jac-_Lref0(i,j)*V*V*Jac;
+	//djy1dV(i,j) = dk10dv(i,j)-1.*_seebeck*_Lref0(i,j)*T*T*Jac-2.*_Lref0(i,j)*T*V*Jac;
        }
      }
 	   
@@ -391,11 +463,11 @@ void mlawElecSMP::constitutive(
           for(int L = 0; L< 3; L++)
           {
             dl10dF(i,j,N,L) = -dldF(i,j,N,L)*T;
-            dl20dF(i,j,N,L) = -dldF(i,j,N,L)*(V*T+_seebeck*T*T);
-            dk10dF(i,j,N,L) = -dkdF(i,j,N,L)*T*T- _seebeck*dldF(i,j,N,L)*T*T*V-pow(_seebeck,2)*dldF(i,j,N,L)*pow(T,3);
-            dk20dF(i,j,N,L) = -_seebeck*T*T*dldF(i,j,N,L);
-		  
-            djy1dF(i,j,N,L) = -dkdF(i,j,N,L)*T*T- 2.*_seebeck*dldF(i,j,N,L)*T*T*V-pow(_seebeck,2)*dldF(i,j,N,L)*pow(T,3)-dldF(i,j,N,L)*T*V*V;
+ 	    dl20dF(i,j,N,L) = -dldF(i,j,N,L)*(V*T+_seebeck*T*T);
+	    //dk10dF(i,j,N,L) = -dkdF(i,j,N,L)*T*T- _seebeck*dldF(i,j,N,L)*T*T*V-pow(_seebeck,2)*dldF(i,j,N,L)*pow(T,3);
+	    dk20dF(i,j,N,L) = dl20dF(i,j,N,L);
+            dk10dF(i,j,N,L) = -dkdF(i,j,N,L)*T*T- 2.*_seebeck*dldF(i,j,N,L)*T*T*V-pow(_seebeck,2)*dldF(i,j,N,L)*pow(T,3)-dldF(i,j,N,L)*T*V*V;
+	    // djy1dF(i,j,N,L) = -dkdF(i,j,N,L)*T*T- 2.*_seebeck*dldF(i,j,N,L)*T*T*V-pow(_seebeck,2)*dldF(i,j,N,L)*pow(T,3)-dldF(i,j,N,L)*T*V*V;
 	  }
         }
       }
@@ -443,6 +515,10 @@ void mlawElecSMP::constitutive(
 	djydgradT(i,k) =_Kref0(i,k)*Jac;
 	djydgradT(i,k)+=_Lref0(i,k)*_seebeck*_seebeck*T*Jac+_Lref0(i,k)*_seebeck*V*Jac;
 	djydgradV(i,k) =_Lref0(i,k)*_seebeck*T*Jac+_Lref0(i,k)*V*Jac;
+	djydgradVdT(i,k) =_Lref0(i,k)*_seebeck*Jac;
+	djydgradVdV(i,k) =_Lref0(i,k)*Jac;
+	djydgradTdT(i,k)+=_Lref0(i,k)*_seebeck*_seebeck*Jac;
+	djydgradTdV(i,k)+=_Lref0(i,k)*_seebeck*Jac;
       }
    }
   // dqdgradT.print("dqdgradT");
diff --git a/NonLinearSolver/materialLaw/mlawElecSMP.h b/NonLinearSolver/materialLaw/mlawElecSMP.h
index 28453b1da..30e9745d1 100644
--- a/NonLinearSolver/materialLaw/mlawElecSMP.h
+++ b/NonLinearSolver/materialLaw/mlawElecSMP.h
@@ -106,9 +106,11 @@ public:
 			    STensor3 &dl10dT,
 			    STensor3 &dl20dT,
 			    STensor3 &dk10dT,
-			    STensor3 &dK20dT,
+			    STensor3 &dk20dT,
+			    STensor3 &dl10dv,
 			    STensor3 &dl20dv,
 			    STensor3 &dk10dv,
+			    STensor3 &dk20dv,
 			    STensor43 &dl10dF,
 			    STensor43 &dl20dF,
 			    STensor43 &dk10dF,
@@ -119,10 +121,12 @@ public:
 			    SVector3 &djydT,
 			    STensor3 &djydgradT,
                             STensor33 &djydF,
-			    STensor3 &jy1,
-			    STensor3 &djy1dT,
-			    STensor3 &djy1dV,
-			    STensor43 &djy1dF,
+			    STensor3 &djydgradVdT,
+			    STensor3 &djydgradVdV,
+			    STensor43 &djydgradVdF,
+			    STensor3 &djydgradTdT,
+			    STensor3 &djydgradTdV,
+			    STensor43 &djydgradTdF,
                             const bool stiff
                            ) const;
     double getInitialTemperature() const {return _t0;};
diff --git a/NonLinearSolver/materialLaw/mlawLinearElecTherMech.cpp b/NonLinearSolver/materialLaw/mlawLinearElecTherMech.cpp
index 4f414073f..03b8a78d3 100644
--- a/NonLinearSolver/materialLaw/mlawLinearElecTherMech.cpp
+++ b/NonLinearSolver/materialLaw/mlawLinearElecTherMech.cpp
@@ -167,9 +167,11 @@ void mlawLinearElecTherMech::constitutive(
 			    STensor3 &dl10dT,
 			    STensor3 &dl20dT,
 			    STensor3 &dk10dT,
-			    STensor3 &dK20dT,
+			    STensor3 &dk20dT,
+			    STensor3 &dl10dv,
 			    STensor3 &dl20dv,
 			    STensor3 &dk10dv,
+			    STensor3 &dk20dv,
 			    STensor43 &dl10dF,
 			    STensor43 &dl20dF,
 			    STensor43 &dk10dF,
@@ -180,10 +182,12 @@ void mlawLinearElecTherMech::constitutive(
 			    SVector3 &djydT,
 			    STensor3 &djydgradT,
                             STensor33 &djydF,
-			    STensor3 &jy1,
-			    STensor3 &djy1dT,
-			    STensor3 &djy1dV,
-			    STensor43 &djy1dF,
+			    STensor3 &djydgradVdT,
+			    STensor3 &djydgradVdV,
+			    STensor43 &djydgradVdF,
+			    STensor3 &djydgradTdT,
+			    STensor3 &djydgradTdV,
+			    STensor43 &djydgradTdF,
                             const bool stiff
                            )const
 {
@@ -206,7 +210,9 @@ void mlawLinearElecTherMech::constitutive(
 
     fluxjy*=0.;
     djydgradT*=0.;djydgradV*=0.; djydV*=0.; djydT*=0.;
-    jy1*=0.;djy1dT*=0.;djy1dV*=0.;
+   // jy1*=0.;djy1dT*=0.;djy1dV*=0.;
+    djydgradVdT*=0.;djydgradVdV*=0.;djydgradVdF*=0.;
+    djydgradTdT*=0.;djydgradTdV*=0.;djydgradTdF*=0.;
 
    // dPdT*=0.;
 
@@ -215,17 +221,18 @@ void mlawLinearElecTherMech::constitutive(
      //seebeck=1.802*pow(10,-4)+3.861*pow(10.-7)*T-9.582*pow(10.-10)*T*T;
 
       //modified
-    l10*=0.;l20*=0.;k10*=0.;k20*=0.;dl10dT*=0.;dl20dT*=0.;dk10dT*=0.;dK20dT*=0.;dl20dv*=0.;dk10dv*=0.;dl10dF*=0.;dl20dF*=0.;dk10dF*=0.;dk20dF*=0.;
+    l10*=0.;l20*=0.;k10*=0.;k20*=0.;dl10dT*=0.;dl20dT*=0.;dk10dT*=0.;dk20dT*=0.;dl10dv*=0.;dl20dv*=0.;dk10dv*=0.;dk20dv*=0.;dl10dF*=0.;dl20dF*=0.;dk10dF*=0.;dk20dF*=0.;
      for(int i = 0; i< 3; i++)
       {
         for(int j = 0; j< 3; j++)
         {
         l10(i,j) = -_l0(i,j)*T;
  	l20(i,j) = -_l0(i,j)*(V*T+_seebeck*T*T);
-	k10(i,j) = -_k(i,j)*T*T- _seebeck*_l0(i,j)*T*T*V-pow(_seebeck,2)*_l0(i,j)*pow(T,3);
-	k20(i,j) = -_seebeck*T*T*_l0(i,j) ;
-
-	jy1(i,j) = -_k(i,j)*T*T-2.*_seebeck*_l0(i,j)*T*T*V-pow(_seebeck,2)*_l0(i,j)*pow(T,3)-_l0(i,j)*T*V*V;
+	//k10(i,j) = -_k(i,j)*T*T- _seebeck*_l0(i,j)*T*T*V-pow(_seebeck,2)*_l0(i,j)*pow(T,3);
+	//k20(i,j) = -_seebeck*T*T*_l0(i,j) ;
+        k20(i,j) = l20(i,j);
+        k10(i,j) = -_k(i,j)*T*T-2.*_seebeck*_l0(i,j)*T*T*V-pow(_seebeck,2)*_l0(i,j)*pow(T,3)-_l0(i,j)*T*V*V;  
+	//jy1(i,j) = -_k(i,j)*T*T-2.*_seebeck*_l0(i,j)*T*T*V-pow(_seebeck,2)*_l0(i,j)*pow(T,3)-_l0(i,j)*T*V*V;
 	}
       }
 
@@ -265,13 +272,16 @@ void mlawLinearElecTherMech::constitutive(
 	       {
 		 dl10dT(i,j) = -_l0(i,j);
 		 dl20dT(i,j) = -_l0(i,j)*(V+2*_seebeck*T);
-		 dk10dT(i,j) = -2*_k(i,j)*T- 2*_seebeck*_l0(i,j)*T*V-3*pow(_seebeck,2)*_l0(i,j)*pow(T,2);
-		 dK20dT(i,j) = -2*_seebeck*T*_l0(i,j);
-
+		 //dk10dT(i,j) = -2*_k(i,j)*T- 2*_seebeck*_l0(i,j)*T*V-3*pow(_seebeck,2)*_l0(i,j)*pow(T,2);
+		 //dK20dT(i,j) = -2*_seebeck*T*_l0(i,j);
+                 dk20dT(i,j) = dl20dT(i,j);
 		 dl20dv(i,j)= -_l0(i,j)*(T);
-		 dk10dv(i,j)= -_seebeck*_l0(i,j)*T*T;
-		 djy1dT(i,j) = -2.*_k(i,j)*T- 4.*_seebeck*_l0(i,j)*T*V-3*pow(_seebeck,2)*_l0(i,j)*pow(T,2)-_l0(i,j)*V*V;
-		 djy1dV(i,j) = -2.*_seebeck*_l0(i,j)*T*T-2.*_l0(i,j)*T*V;
+                 dk20dv(i,j) = dl20dT(i,j);
+		 //dk10dv(i,j)= -_seebeck*_l0(i,j)*T*T;
+		// djy1dT(i,j) = -2.*_k(i,j)*T- 4.*_seebeck*_l0(i,j)*T*V-3*pow(_seebeck,2)*_l0(i,j)*pow(T,2)-_l0(i,j)*V*V;
+		// djy1dV(i,j) = -2.*_seebeck*_l0(i,j)*T*T-2.*_l0(i,j)*T*V;
+                 dk10dT(i,j) = -2.*_k(i,j)*T- 4.*_seebeck*_l0(i,j)*T*V-3*pow(_seebeck,2)*_l0(i,j)*pow(T,2)-_l0(i,j)*V*V; 
+                 dk10dv(i,j) = -2.*_seebeck*_l0(i,j)*T*T-2.*_l0(i,j)*T*V;
 	       }
 	   }
 
@@ -314,6 +324,10 @@ void mlawLinearElecTherMech::constitutive(
 
 	djydgradT(i,k)+=_k(i,k)+_l0(i,k)*_seebeck*_seebeck*T+_l0(i,k)*_seebeck*V;
 	djydgradV(i,k) =_l0(i,k)*_seebeck*T+_l0(i,k)*V;
+	djydgradVdT(i,k) =_l0(i,k)*_seebeck;
+	djydgradVdV(i,k) =_l0(i,k);
+	djydgradTdT(i,k)+=_l0(i,k)*_seebeck*_seebeck;
+	djydgradTdV(i,k)+=_l0(i,k)*_seebeck;
       }
     }
    double dh;
diff --git a/NonLinearSolver/materialLaw/mlawLinearElecTherMech.h b/NonLinearSolver/materialLaw/mlawLinearElecTherMech.h
index fb66a0509..aca6d1857 100644
--- a/NonLinearSolver/materialLaw/mlawLinearElecTherMech.h
+++ b/NonLinearSolver/materialLaw/mlawLinearElecTherMech.h
@@ -94,9 +94,11 @@ public:
 			    STensor3 &dl20dT,
 			    STensor3 &dk10dT,
 			    STensor3 &dK20dT,
+			    STensor3 &dl10dv,
 			    STensor3 &dl20dv,
 			    STensor3 &dk10dv,
-			     STensor43 &dl10dF,
+			    STensor3 &dk20dv,
+			    STensor43 &dl10dF,
 			    STensor43 &dl20dF,
 			    STensor43 &dk10dF,
 			    STensor43 &dk20dF,
@@ -106,10 +108,12 @@ public:
 			    SVector3 &djydT,
 			    STensor3 &djydgradT,
                             STensor33 &djydF,
-			    STensor3 &jy1,
-			    STensor3 &djy1dT,
-			    STensor3 &djy1dV,
-			    STensor43 &djy1dF,
+			    STensor3 &djydgradVdT,
+			    STensor3 &djydgradVdV,
+			    STensor43 &djydgradVdF,
+			    STensor3 &djydgradTdT,
+			    STensor3 &djydgradTdV,
+			    STensor43 &djydgradTdF,
                             const bool stiff  
                            ) const;
     double getInitialTemperature() const {return _t0;};
diff --git a/dG3D/src/FractureCohesiveDG3DIPVariable.h b/dG3D/src/FractureCohesiveDG3DIPVariable.h
index d4b8edcb8..c027e4586 100644
--- a/dG3D/src/FractureCohesiveDG3DIPVariable.h
+++ b/dG3D/src/FractureCohesiveDG3DIPVariable.h
@@ -137,12 +137,16 @@ class FractureCohesive3DIPVariable : public IPVariable2ForFracture<dG3DIPVariabl
   virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodLinearKdField() {return _ipvbulk->getRefTodLinearKdField();}; 
   virtual const std::vector<std::vector<STensor43>>  &getConstRefTodLinearKdF() const {return _ipvbulk->getConstRefTodLinearKdF();}; 
   virtual std::vector<std::vector<STensor43>>  &getRefTodLinearKdF() {return _ipvbulk->getRefTodLinearKdF();}; 
-  virtual const std::vector<std::vector<const STensor3*> > &getConstRefToEnergyK() const {return _ipvbulk->getConstRefToEnergyK();};
+/*  virtual const std::vector<std::vector<const STensor3*> > &getConstRefToEnergyK() const {return _ipvbulk->getConstRefToEnergyK();};
   virtual void setConstRefToEnergyK(const STensor3 &eT, int i, int j)  {_ipvbulk->setConstRefToEnergyK(eT, i, j);};
   virtual const std::vector<std::vector<std::vector<STensor3> > >  &getConstRefTodEnergyKdField() const {return _ipvbulk->getConstRefTodEnergyKdField();}; 
   virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodEnergyKdField() {return _ipvbulk->getRefTodEnergyKdField();}; 
   virtual const std::vector<std::vector<STensor43>>  &getConstRefTodEnergyKdF() const {return _ipvbulk->getConstRefTodEnergyKdF();}; 
-  virtual std::vector<std::vector<STensor43>>  &getRefTodEnergyKdF() {return _ipvbulk->getRefTodEnergyKdF();}; 
+  virtual std::vector<std::vector<STensor43>>  &getRefTodEnergyKdF() {return _ipvbulk->getRefTodEnergyKdF();}; */
+  virtual const std::vector<std::vector<std::vector<STensor3> > >  &getConstRefTodFluxdGradFielddField() const {return _ipvbulk->getConstRefTodFluxdGradFielddField();}; 
+  virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodFluxdGradFielddField() {return _ipvbulk->getRefTodFluxdGradFielddField();}; 
+  virtual const std::vector<std::vector<STensor43>>  &getConstRefTodFluxdGradFielddF() const {return _ipvbulk->getConstRefTodFluxdGradFielddF();}; 
+  virtual std::vector<std::vector<STensor43>>  &getRefTodFluxdGradFielddF() {return _ipvbulk->getRefTodFluxdGradFielddF();}; 
   virtual const fullVector<double>  &getConstRefToFieldSource() const {return _ipvbulk->getConstRefToFieldSource();};
   virtual fullVector<double>  &getRefToFieldSource() {return _ipvbulk->getRefToFieldSource();};
   virtual const fullMatrix<double>  &getConstRefTodFieldSourcedField() const {return _ipvbulk->getConstRefTodFieldSourcedField();};
@@ -172,23 +176,23 @@ class FractureCohesive3DIPVariable : public IPVariable2ForFracture<dG3DIPVariabl
   virtual const std::vector<SVector3>  &getConstRefToInterfaceFlux() const {return _ipvbulk->getConstRefToInterfaceFlux();};
   virtual std::vector<SVector3>  &getRefToInterfaceFlux() {return _ipvbulk->getRefToInterfaceFlux();};
  
-  //ThermoField (fT & fv)
-  virtual double getConstRefToThermoField(const int idex) const {return _ipvbulk->getConstRefToThermoField(idex);};  
-  virtual double  &getRefToThermoField(const int idex) {return _ipvbulk->getRefToThermoField(idex);};  
-  virtual const std::vector<SVector3>  &getConstRefToGradThermoField() const {return _ipvbulk->getConstRefToGradThermoField();}; 
-  virtual std::vector<SVector3>  &getRefToGradThermoField() {return _ipvbulk->getRefToGradThermoField();}; 
-  virtual const  std::vector<std::vector<double>>  &getConstRefTodFielddThermoField() const {return _ipvbulk->getConstRefTodFielddThermoField();};
-  virtual std::vector<std::vector<double>>  &getRefTodFielddThermoField() {return _ipvbulk->getRefTodFielddThermoField();};
-  virtual const std::vector<std::vector<SVector3>>  &getConstRefTodGradFielddThermoField() const {return _ipvbulk->getConstRefTodGradFielddThermoField();}; 
-  virtual std::vector<std::vector<SVector3>>  &getRefTodGradFielddThermoField() {return _ipvbulk->getRefTodGradFielddThermoField();};
-  virtual const std::vector<std::vector<STensor3>>  &getConstRefTodGradFielddGradThermoField() const {return _ipvbulk->getConstRefTodGradFielddGradThermoField();}; 
-  virtual std::vector<std::vector<STensor3>>  &getRefTodGradFielddGradThermoField() {return _ipvbulk->getRefTodGradFielddGradThermoField();}; 
-  virtual const fullVector<double>  &getConstRefToThermoFieldJump() const {return _ipvbulk->getConstRefToThermoFieldJump();};  
-  virtual fullVector<double>  &getRefToThermoFieldJump() {return _ipvbulk->getRefToThermoFieldJump();};
-  virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldm() const {return _ipvbulk->getConstRefTodThermoFieldJumpdFieldm();};
-  virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldm() {return _ipvbulk->getRefTodThermoFieldJumpdFieldm();};
-  virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldp() const {return _ipvbulk->getConstRefTodThermoFieldJumpdFieldp();};
-  virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldp() {return _ipvbulk->getRefTodThermoFieldJumpdFieldp();};
+  //Energy Conjugated Field (fT & fv)
+  virtual double getConstRefToEnergyConjugatedField(const int idex) const {return _ipvbulk->getConstRefToEnergyConjugatedField(idex);};  
+  virtual double  &getRefToEnergyConjugatedField(const int idex) {return _ipvbulk->getRefToEnergyConjugatedField(idex);};  
+  virtual const std::vector<SVector3>  &getConstRefToGradEnergyConjugatedField() const {return _ipvbulk->getConstRefToGradEnergyConjugatedField();}; 
+  virtual std::vector<SVector3>  &getRefToGradEnergyConjugatedField() {return _ipvbulk->getRefToGradEnergyConjugatedField();}; 
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodFielddEnergyConjugatedField() const {return _ipvbulk->getConstRefTodFielddEnergyConjugatedField();};
+  virtual std::vector<std::vector<double>>  &getRefTodFielddEnergyConjugatedField() {return _ipvbulk->getRefTodFielddEnergyConjugatedField();};
+  virtual const std::vector<std::vector<SVector3>>  &getConstRefTodGradFielddEnergyConjugatedField() const {return _ipvbulk->getConstRefTodGradFielddEnergyConjugatedField();}; 
+  virtual std::vector<std::vector<SVector3>>  &getRefTodGradFielddEnergyConjugatedField() {return _ipvbulk->getRefTodGradFielddEnergyConjugatedField();};
+  virtual const std::vector<std::vector<STensor3>>  &getConstRefTodGradFielddGradEnergyConjugatedField() const {return _ipvbulk->getConstRefTodGradFielddGradEnergyConjugatedField();}; 
+  virtual std::vector<std::vector<STensor3>>  &getRefTodGradFielddGradEnergyConjugatedField() {return _ipvbulk->getRefTodGradFielddGradEnergyConjugatedField();}; 
+  virtual const fullVector<double>  &getConstRefToEnergyConjugatedFieldJump() const {return _ipvbulk->getConstRefToEnergyConjugatedFieldJump();};  
+  virtual fullVector<double>  &getRefToEnergyConjugatedFieldJump() {return _ipvbulk->getRefToEnergyConjugatedFieldJump();};
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodEnergyConjugatedFieldJumpdFieldm() const {return _ipvbulk->getConstRefTodEnergyConjugatedFieldJumpdFieldm();};
+  virtual std::vector<std::vector<double>>  &getRefTodEnergyConjugatedFieldJumpdFieldm() {return _ipvbulk->getRefTodEnergyConjugatedFieldJumpdFieldm();};
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodEnergyConjugatedFieldJumpdFieldp() const {return _ipvbulk->getConstRefTodEnergyConjugatedFieldJumpdFieldp();};
+  virtual std::vector<std::vector<double>>  &getRefTodEnergyConjugatedFieldJumpdFieldp() {return _ipvbulk->getRefTodEnergyConjugatedFieldJumpdFieldp();};
 
   //coupling constitutive extra dof with nonLocal
   virtual const std::vector<std::vector<SVector3> > & getConstRefTodFluxdNonLocalVariable() const {return _ipvbulk->getConstRefTodFluxdNonLocalVariable();}
diff --git a/dG3D/src/axisymmetricDG3DDomain.cpp b/dG3D/src/axisymmetricDG3DDomain.cpp
index dfd75bde8..b88d25f42 100644
--- a/dG3D/src/axisymmetricDG3DDomain.cpp
+++ b/dG3D/src/axisymmetricDG3DDomain.cpp
@@ -49,7 +49,7 @@ void axisymmetricDG3DDomain::allocateInterfaceMPI(const int rankOtherPart, const
 
     newInterDom3D->setConstitutiveExtraDofDiffusionStabilityParameters(this->getConstitutiveExtraDofDiffusionStabilityParameter(), this->getConstitutiveExtraDofDiffusionContinuity());
     newInterDom3D->setConstitutiveExtraDofDiffusionEqRatio(this->getConstitutiveExtraDofDiffusionEqRatio());
-    newInterDom3D->setConstitutiveExtraDofDiffusionUseOneOverJump(this->getConstitutiveExtraDofDiffusionUseOneOverJump());
+    newInterDom3D->setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(this->getConstitutiveExtraDofDiffusionUseEnergyConjugatedField());
     newInterDom3D->setConstitutiveExtraDofDiffusionAccountSource(this->getConstitutiveExtraDofDiffusionAccountFieldSource(),this->getConstitutiveExtraDofDiffusionAccountMecaSource());
 
     newInterDom3D->setIncrementNonlocalBased(this->_incrementNonlocalBased);
@@ -797,7 +797,7 @@ axisymmetricInterDomainBetween3D::axisymmetricInterDomainBetween3D(const int tag
   _constitutiveExtraDofDiffusionBeta = (static_cast<axisymmetricDG3DDomain *> (dom1))->getConstitutiveExtraDofDiffusionStabilityParameter();
   _constitutiveExtraDofDiffusionContinuity = (static_cast<axisymmetricDG3DDomain *> (dom1))->getConstitutiveExtraDofDiffusionContinuity();
   _constitutiveExtraDofDiffusionEqRatio = (static_cast<axisymmetricDG3DDomain *> (dom1))->getConstitutiveExtraDofDiffusionEqRatio();
-  _constitutiveExtraDofDiffusionOneOverJump = (static_cast<axisymmetricDG3DDomain *> (dom1))->getConstitutiveExtraDofDiffusionUseOneOverJump();
+  _constitutiveExtraDofDiffusionUseEnergyConjugatedField = (static_cast<axisymmetricDG3DDomain *> (dom1))->getConstitutiveExtraDofDiffusionUseEnergyConjugatedField();
   _constitutiveExtraDofDiffusionAccountFieldSource = (static_cast<axisymmetricDG3DDomain *> (dom1))->getConstitutiveExtraDofDiffusionAccountFieldSource();
   _constitutiveExtraDofDiffusionAccountMecaSource = (static_cast<axisymmetricDG3DDomain *> (dom1))->getConstitutiveExtraDofDiffusionAccountMecaSource();
 
diff --git a/dG3D/src/axisymmetricDG3DTerms.cpp b/dG3D/src/axisymmetricDG3DTerms.cpp
index 7d1455685..92f0368a4 100644
--- a/dG3D/src/axisymmetricDG3DTerms.cpp
+++ b/dG3D/src/axisymmetricDG3DTerms.cpp
@@ -518,7 +518,7 @@ void axisymmetricDG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVec
             Stiff_alphadialitationm = *(ipvm->getConstRefToLinearSymmetrizationCoupling()[extraDOFField]);
             static STensor3  Stiff_alphadialitationp;
             Stiff_alphadialitationp = *(ipvp->getConstRefToLinearSymmetrizationCoupling()[extraDOFField]);
-            if(getConstitutiveExtraDofDiffusionUseOneOverJump())
+            if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
             {
               k0m*=(-1.)*fieldm*fieldm;
               k0p*=(-1.)*fieldp*fieldp;
@@ -1303,7 +1303,7 @@ void axisymmetricDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
             STensorOperation::zero(dStiff_alphadialitationmdFieldm);
             static STensor3 dStiff_alphadialitationpdFieldp;
             STensorOperation::zero(dStiff_alphadialitationpdFieldp);
-            if(getConstitutiveExtraDofDiffusionUseOneOverJump())
+            if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
             {
               k0m*=(-1.)*fieldm*fieldm;
               k0p*=(-1.)*fieldp*fieldp;
@@ -1496,7 +1496,7 @@ void axisymmetricDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
               {
                 stiff(j+indexField*nbFFm,l+indexField*nbFFm) -= dfieldJumpdFieldm*NMeankNBetasc*
                                       (Valsm[j+indexField*nbFFm]*Valsm[l+indexField*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
-                if(getConstitutiveExtraDofDiffusionUseOneOverJump())
+                if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
                   stiff(j+indexField*nbFFm,l+indexField*nbFFm) -= oneOverFieldJump*dNMeankNBetascdFieldm*
                                       (Valsm[j+indexField*nbFFm]*Valsm[l+indexField*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
               }
@@ -1504,7 +1504,7 @@ void axisymmetricDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
               {
                 stiff(j+indexField*nbFFm,l+indexField*nbFFp+nbdofm) -= dfieldJumpdFieldp*NMeankNBetasc*
                                       (Valsm[j+indexField*nbFFm]*Valsp[l+indexField*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
-                if(getConstitutiveExtraDofDiffusionUseOneOverJump())
+                if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
                   stiff(j+indexField*nbFFm,l+indexField*nbFFp+nbdofm) -= oneOverFieldJump*dNMeankNBetascdFieldp*
                                                   (Valsm[j+indexField*nbFFm]*Valsp[l+indexField*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
               }
@@ -1515,7 +1515,7 @@ void axisymmetricDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
               {
                 stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFm) += dfieldJumpdFieldm*NMeankNBetasc*
                                                   (Valsp[j+indexField*nbFFp]*Valsm[l+indexField*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
-                if(getConstitutiveExtraDofDiffusionUseOneOverJump())
+                if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
                   stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFm) += oneOverFieldJump*dNMeankNBetascdFieldm*
                                                   (Valsp[j+indexField*nbFFp]*Valsm[l+indexField*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
               }
@@ -1523,7 +1523,7 @@ void axisymmetricDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
               {
                 stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFp+nbdofm) += dfieldJumpdFieldp*NMeankNBetasc*
                                                   (Valsp[j+indexField*nbFFp]*Valsp[l+indexField*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
-                if(getConstitutiveExtraDofDiffusionUseOneOverJump())
+                if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
                   stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFp+nbdofm) += oneOverFieldJump*dNMeankNBetascdFieldp*
                                                   (Valsp[j+indexField*nbFFp]*Valsp[l+indexField*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
               }
@@ -1540,7 +1540,7 @@ void axisymmetricDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
                   {
                     stiff(j+indexField*nbFFm,l+indexField*nbFFm) += dfieldJumpdFieldm*(k0m(p,q)*
                                                   Gradsm[j+indexField*nbFFm][q])*(nu(p)*wJ*getConstitutiveExtraDofDiffusionEqRatio()/2.*Valsm[l+indexField*nbFFm]);
-                    if(getConstitutiveExtraDofDiffusionUseOneOverJump())
+                    if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
                       stiff(j+indexField*nbFFm,l+indexField*nbFFm) += oneOverFieldJump*(dk0mdFieldm(p,q)*
                                                   Gradsm[j+indexField*nbFFm][q])*(nu(p)*wJ*getConstitutiveExtraDofDiffusionEqRatio()/2.*Valsm[l+indexField*nbFFm]);
                   }
@@ -1579,7 +1579,7 @@ void axisymmetricDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
                   {
                     stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFp+nbdofm) += dfieldJumpdFieldp*(k0p(p,q)*
                                       Gradsp[j+indexField*nbFFp][q])*(nu(p)*wJ*getConstitutiveExtraDofDiffusionEqRatio()/2.*Valsp[l+indexField*nbFFp]);
-                    if(getConstitutiveExtraDofDiffusionUseOneOverJump())
+                    if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
                       stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFp+nbdofm) += oneOverFieldJump*
                                  (dk0pdFieldp(p,q)*Gradsp[j+indexField*nbFFp][q])*(nu(p)*wJ*getConstitutiveExtraDofDiffusionEqRatio()/2.*Valsp[l+indexField*nbFFp]);
                   }
@@ -1629,7 +1629,7 @@ void axisymmetricDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
               }
             }
 
-            if(getConstitutiveExtraDofDiffusionUseOneOverJump())
+            if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
             {
               for(int j=0;j<nbFFm;j++)
               {
diff --git a/dG3D/src/axisymmetricDG3DTerms.h b/dG3D/src/axisymmetricDG3DTerms.h
index 9d288f2db..8ad1538d6 100644
--- a/dG3D/src/axisymmetricDG3DTerms.h
+++ b/dG3D/src/axisymmetricDG3DTerms.h
@@ -430,7 +430,7 @@ public:
     DG->setNonLocalStabilityParameter(this->getNonLocalStabilityParameter());
     DG->setNumConstitutiveExtraDofDiffusionVariable(this->getNumConstitutiveExtraDofDiffusionVariable());
     DG->setConstitutiveExtraDofDiffusionEqRatio(this->getConstitutiveExtraDofDiffusionEqRatio());
-    DG->setConstitutiveExtraDofDiffusionUseOneOverJump(this->getConstitutiveExtraDofDiffusionUseOneOverJump());
+    DG->setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(this->getConstitutiveExtraDofDiffusionUseEnergyConjugatedField());
     DG->setConstitutiveExtraDofDiffusionAccountFieldSource(this->getConstitutiveExtraDofDiffusionAccountFieldSource());
     DG->setConstitutiveExtraDofDiffusionAccountMecaSource(this->getConstitutiveExtraDofDiffusionAccountMecaSource());
     DG->setConstitutiveExtraDofDiffusionStabilityParameter(this->getConstitutiveExtraDofDiffusionStabilityParameter());
@@ -475,7 +475,7 @@ public:
     DG->setNonLocalStabilityParameter(this->getNonLocalStabilityParameter());
     DG->setNumConstitutiveExtraDofDiffusionVariable(this->getNumConstitutiveExtraDofDiffusionVariable());
     DG->setConstitutiveExtraDofDiffusionEqRatio(this->getConstitutiveExtraDofDiffusionEqRatio());
-    DG->setConstitutiveExtraDofDiffusionUseOneOverJump(this->getConstitutiveExtraDofDiffusionUseOneOverJump());
+    DG->setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(this->getConstitutiveExtraDofDiffusionUseEnergyConjugatedField());
     DG->setConstitutiveExtraDofDiffusionAccountFieldSource(this->getConstitutiveExtraDofDiffusionAccountFieldSource());
     DG->setConstitutiveExtraDofDiffusionAccountMecaSource(this->getConstitutiveExtraDofDiffusionAccountMecaSource());
     DG->setConstitutiveExtraDofDiffusionStabilityParameter(this->getConstitutiveExtraDofDiffusionStabilityParameter());
diff --git a/dG3D/src/dG3DDomain.cpp b/dG3D/src/dG3DDomain.cpp
index e5ea1fa9b..5275ab0da 100644
--- a/dG3D/src/dG3DDomain.cpp
+++ b/dG3D/src/dG3DDomain.cpp
@@ -38,7 +38,7 @@ dG3DDomain::dG3DDomain (const int tag,const int phys, const int ws, const int ln
                                                             _forceInterfaceElementBroken(false),_failureIPRatio(1.), _EqMultiFieldFactor(1.),
                                                             _nonLocalBeta(100.), _nonLocalContinuity(true), _nonLocalEqRatio(100.),
                                                             _constitutiveExtraDofDiffusionBeta(100.), _constitutiveExtraDofDiffusionContinuity(true), _constitutiveExtraDofDiffusionEqRatio(100.),
-                                                            _constitutiveExtraDofDiffusionOneOverJump(false), _constitutiveExtraDofDiffusionAccountFieldSource(true),
+                                                            _constitutiveExtraDofDiffusionUseEnergyConjugatedField(false), _constitutiveExtraDofDiffusionAccountFieldSource(true),
                                                             _constitutiveExtraDofDiffusionAccountMecaSource(false), _imposeCrackFlag(false),_accountPathFollowing(true),
                                                             _incrementNonlocalBased(false), _planeStressState(false)
 {
@@ -110,7 +110,7 @@ dG3DDomain::dG3DDomain(const dG3DDomain &source) : dgPartDomain(source), _lnum(s
   _constitutiveExtraDofDiffusionBeta = source._constitutiveExtraDofDiffusionBeta;
   _constitutiveExtraDofDiffusionContinuity = source._constitutiveExtraDofDiffusionContinuity;
   _constitutiveExtraDofDiffusionEqRatio = source._constitutiveExtraDofDiffusionEqRatio;
-  _constitutiveExtraDofDiffusionOneOverJump = source._constitutiveExtraDofDiffusionOneOverJump;
+  _constitutiveExtraDofDiffusionUseEnergyConjugatedField = source._constitutiveExtraDofDiffusionUseEnergyConjugatedField;
   _constitutiveExtraDofDiffusionAccountFieldSource = source._constitutiveExtraDofDiffusionAccountFieldSource;
   _constitutiveExtraDofDiffusionAccountMecaSource = source._constitutiveExtraDofDiffusionAccountMecaSource;
 
@@ -539,14 +539,14 @@ void dG3DDomain::createTerms(unknownField *uf,IPField*ip)
   {
     (static_cast<dG3DForceBulk*>(ltermBulk))->setNumConstitutiveExtraDofDiffusionVariable(getNumConstitutiveExtraDofDiffusionVariable());
     (static_cast<dG3DForceBulk*>(ltermBulk))->setConstitutiveExtraDofDiffusionEqRatio(getConstitutiveExtraDofDiffusionEqRatio());
-    (static_cast<dG3DForceBulk*>(ltermBulk))->setConstitutiveExtraDofDiffusionUseOneOverJump(getConstitutiveExtraDofDiffusionUseOneOverJump());
+    (static_cast<dG3DForceBulk*>(ltermBulk))->setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField());
     (static_cast<dG3DForceBulk*>(ltermBulk))->setConstitutiveExtraDofDiffusionAccountFieldSource(getConstitutiveExtraDofDiffusionAccountFieldSource());
     (static_cast<dG3DForceBulk*>(ltermBulk))->setConstitutiveExtraDofDiffusionAccountMecaSource(getConstitutiveExtraDofDiffusionAccountMecaSource());
     if(!_bmbp)
     {
       (static_cast<dG3DStiffnessBulk*>(btermBulk))->setNumConstitutiveExtraDofDiffusionVariable(getNumConstitutiveExtraDofDiffusionVariable());
       (static_cast<dG3DStiffnessBulk*>(btermBulk))->setConstitutiveExtraDofDiffusionEqRatio(getConstitutiveExtraDofDiffusionEqRatio());
-      (static_cast<dG3DStiffnessBulk*>(btermBulk))->setConstitutiveExtraDofDiffusionUseOneOverJump(getConstitutiveExtraDofDiffusionUseOneOverJump());
+      (static_cast<dG3DStiffnessBulk*>(btermBulk))->setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField());
       (static_cast<dG3DStiffnessBulk*>(btermBulk))->setConstitutiveExtraDofDiffusionAccountFieldSource(getConstitutiveExtraDofDiffusionAccountFieldSource());
       (static_cast<dG3DStiffnessBulk*>(btermBulk))->setConstitutiveExtraDofDiffusionAccountMecaSource(getConstitutiveExtraDofDiffusionAccountMecaSource());
     }
@@ -556,7 +556,7 @@ void dG3DDomain::createTerms(unknownField *uf,IPField*ip)
       {
         (static_cast<dG3DForceInter*>(ltermBound))->setNumConstitutiveExtraDofDiffusionVariable(getNumConstitutiveExtraDofDiffusionVariable());
         (static_cast<dG3DForceInter*>(ltermBound))->setConstitutiveExtraDofDiffusionEqRatio(getConstitutiveExtraDofDiffusionEqRatio());
-        (static_cast<dG3DForceInter*>(ltermBound))->setConstitutiveExtraDofDiffusionUseOneOverJump(getConstitutiveExtraDofDiffusionUseOneOverJump());
+        (static_cast<dG3DForceInter*>(ltermBound))->setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField());
         (static_cast<dG3DForceInter*>(ltermBound))->setConstitutiveExtraDofDiffusionAccountFieldSource(getConstitutiveExtraDofDiffusionAccountFieldSource());
         (static_cast<dG3DForceInter*>(ltermBound))->setConstitutiveExtraDofDiffusionAccountMecaSource(getConstitutiveExtraDofDiffusionAccountMecaSource());
         (static_cast<dG3DForceInter*>(ltermBound))->setConstitutiveExtraDofDiffusionStabilityParameter(getConstitutiveExtraDofDiffusionStabilityParameter());
@@ -565,7 +565,7 @@ void dG3DDomain::createTerms(unknownField *uf,IPField*ip)
         {
           (static_cast<dG3DStiffnessInter*>(btermBound))->setNumConstitutiveExtraDofDiffusionVariable(getNumConstitutiveExtraDofDiffusionVariable());
           (static_cast<dG3DStiffnessInter*>(btermBound))->setConstitutiveExtraDofDiffusionEqRatio(getConstitutiveExtraDofDiffusionEqRatio());
-          (static_cast<dG3DStiffnessInter*>(btermBound))->setConstitutiveExtraDofDiffusionUseOneOverJump(getConstitutiveExtraDofDiffusionUseOneOverJump());
+          (static_cast<dG3DStiffnessInter*>(btermBound))->setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField());
           (static_cast<dG3DStiffnessInter*>(btermBound))->setConstitutiveExtraDofDiffusionAccountFieldSource(getConstitutiveExtraDofDiffusionAccountFieldSource());
           (static_cast<dG3DStiffnessInter*>(btermBound))->setConstitutiveExtraDofDiffusionAccountMecaSource(getConstitutiveExtraDofDiffusionAccountMecaSource());
           (static_cast<dG3DStiffnessInter*>(btermBound))->setConstitutiveExtraDofDiffusionStabilityParameter(getConstitutiveExtraDofDiffusionStabilityParameter());
@@ -671,7 +671,7 @@ dG3DDomain::createNeumannTerm(FunctionSpace<double> *spneu,  const groupOfElemen
     {
       (static_cast<g3DLoadTerm<double>*>(term))->setNumConstitutiveExtraDofDiffusionVariable(getNumConstitutiveExtraDofDiffusionVariable());
       (static_cast<g3DLoadTerm<double>*>(term))->setConstitutiveExtraDofDiffusionEqRatio(getConstitutiveExtraDofDiffusionEqRatio());
-      (static_cast<g3DLoadTerm<double>*>(term))->setConstitutiveExtraDofDiffusionUseOneOverJump(getConstitutiveExtraDofDiffusionUseOneOverJump());
+      (static_cast<g3DLoadTerm<double>*>(term))->setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField());
       (static_cast<g3DLoadTerm<double>*>(term))->setConstitutiveExtraDofDiffusionAccountFieldSource(getConstitutiveExtraDofDiffusionAccountFieldSource());
       (static_cast<g3DLoadTerm<double>*>(term))->setConstitutiveExtraDofDiffusionAccountMecaSource(getConstitutiveExtraDofDiffusionAccountMecaSource());
     }
@@ -1404,25 +1404,34 @@ void dG3DDomain::computeStrain(AllIPState *aips,MInterfaceElement *ie, IntPt *GP
         double tpj=tempjump;
         ipvp->getRefToFieldJump()(extraDOFField) = tpj;
         // compute 1/T jump to be energetically consistent
-        if(getConstitutiveExtraDofDiffusionUseOneOverJump())
+        if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
         {
-          double& ftjump= ipvm->getRefToOneOverFieldJump()(extraDOFField);
-          //here we assume no cross dependency
-          static bool msg=false;
-          if(getNumConstitutiveExtraDofDiffusionVariable()>1)
+          if(ipvm->getNumConstitutiveExtraDofDiffusionVariable()==1) //thermomec
           {
-            if(!msg)
+            double& ftjump= ipvm->getRefToOneOverFieldJump()(extraDOFField);
+            //here we assume no cross dependency
+            static bool msg=false;
+            if(getNumConstitutiveExtraDofDiffusionVariable()>1)
             {
-              Msg::Info("we assume no cross dependency between the 1/ft constitutive extra dof domain dG3DDomain::computeStrain bulk");
-              msg=true;
+              if(!msg)
+              {
+                Msg::Info("we assume no cross dependency between the 1/ft constitutive extra dof domain dG3DDomain::computeStrain bulk");
+                msg=true;
+              }
             }
+            double& dftjumpdTp = ipvp->getRefTodOneOverFieldJumpdFieldp()(extraDOFField,extraDOFField);
+            double& dftjumpdTm = ipvm->getRefTodOneOverFieldJumpdFieldm()(extraDOFField,extraDOFField);
+            computeftjump(3+getNumNonLocalVariable(),Valm,nbFFm,Valp,nbFFp,dispm,dispp,ftjump,dftjumpdTp,dftjumpdTm);
+            ipvp->getRefToOneOverFieldJump()(extraDOFField) = ftjump;
+            ipvm->getRefTodOneOverFieldJumpdFieldp()(extraDOFField,extraDOFField) = dftjumpdTp;
+            ipvp->getRefTodOneOverFieldJumpdFieldm()(extraDOFField,extraDOFField) = dftjumpdTm;
+          }
+          else if(ipvm->getNumConstitutiveExtraDofDiffusionVariable()==2) //elecTher
+          {
+
           }
-          double& dftjumpdTp = ipvp->getRefTodOneOverFieldJumpdFieldp()(extraDOFField,extraDOFField);
-          double& dftjumpdTm = ipvm->getRefTodOneOverFieldJumpdFieldm()(extraDOFField,extraDOFField);
-          computeftjump(3+getNumNonLocalVariable(),Valm,nbFFm,Valp,nbFFp,dispm,dispp,ftjump,dftjumpdTp,dftjumpdTm);
-          ipvp->getRefToOneOverFieldJump()(extraDOFField) = ftjump;
-          ipvm->getRefTodOneOverFieldJumpdFieldp()(extraDOFField,extraDOFField) = dftjumpdTp;
-          ipvp->getRefTodOneOverFieldJumpdFieldm()(extraDOFField,extraDOFField) = dftjumpdTm;
+          else
+            Msg::Fatal("UseEnergyConjugatedField with more than 2 extra dofs not implemented");
         }
       }
       //
@@ -2573,7 +2582,7 @@ void dG3DDomain::allocateInterfaceMPI(const int rankOtherPart, const groupOfElem
 
     newInterDom3D->setConstitutiveExtraDofDiffusionStabilityParameters(this->getConstitutiveExtraDofDiffusionStabilityParameter(), this->getConstitutiveExtraDofDiffusionContinuity());
     newInterDom3D->setConstitutiveExtraDofDiffusionEqRatio(this->getConstitutiveExtraDofDiffusionEqRatio());
-    newInterDom3D->setConstitutiveExtraDofDiffusionUseOneOverJump(this->getConstitutiveExtraDofDiffusionUseOneOverJump());
+    newInterDom3D->setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(this->getConstitutiveExtraDofDiffusionUseEnergyConjugatedField());
     newInterDom3D->setConstitutiveExtraDofDiffusionAccountSource(this->getConstitutiveExtraDofDiffusionAccountFieldSource(),this->getConstitutiveExtraDofDiffusionAccountMecaSource());
 
     newInterDom3D->setIncrementNonlocalBased(_incrementNonlocalBased);
@@ -3909,7 +3918,7 @@ interDomainBetween3D::interDomainBetween3D(const int tag, partDomain *dom1,partD
   _constitutiveExtraDofDiffusionBeta = (static_cast<dG3DDomain *> (dom1))->getConstitutiveExtraDofDiffusionStabilityParameter();
   _constitutiveExtraDofDiffusionContinuity = (static_cast<dG3DDomain *> (dom1))->getConstitutiveExtraDofDiffusionContinuity();
   _constitutiveExtraDofDiffusionEqRatio = (static_cast<dG3DDomain *> (dom1))->getConstitutiveExtraDofDiffusionEqRatio();
-  _constitutiveExtraDofDiffusionOneOverJump = (static_cast<dG3DDomain *> (dom1))->getConstitutiveExtraDofDiffusionUseOneOverJump();
+  _constitutiveExtraDofDiffusionUseEnergyConjugatedField = (static_cast<dG3DDomain *> (dom1))->getConstitutiveExtraDofDiffusionUseEnergyConjugatedField();
   _constitutiveExtraDofDiffusionAccountFieldSource = (static_cast<dG3DDomain *> (dom1))->getConstitutiveExtraDofDiffusionAccountFieldSource();
   _constitutiveExtraDofDiffusionAccountMecaSource = (static_cast<dG3DDomain *> (dom1))->getConstitutiveExtraDofDiffusionAccountMecaSource();
 
@@ -3986,7 +3995,7 @@ void interDomainBetween3D::createTerms(unknownField *uf,IPField*ip)
     {
       (static_cast<dG3DForceInter*>(ltermBound))->setNumConstitutiveExtraDofDiffusionVariable(getNumConstitutiveExtraDofDiffusionVariable());
       (static_cast<dG3DForceInter*>(ltermBound))->setConstitutiveExtraDofDiffusionEqRatio(getConstitutiveExtraDofDiffusionEqRatio());
-      (static_cast<dG3DForceInter*>(ltermBound))->setConstitutiveExtraDofDiffusionUseOneOverJump(getConstitutiveExtraDofDiffusionUseOneOverJump());
+      (static_cast<dG3DForceInter*>(ltermBound))->setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField());
       (static_cast<dG3DForceInter*>(ltermBound))->setConstitutiveExtraDofDiffusionAccountFieldSource(getConstitutiveExtraDofDiffusionAccountFieldSource());
       (static_cast<dG3DForceInter*>(ltermBound))->setConstitutiveExtraDofDiffusionAccountMecaSource(getConstitutiveExtraDofDiffusionAccountMecaSource());
       (static_cast<dG3DForceInter*>(ltermBound))->setConstitutiveExtraDofDiffusionStabilityParameter(getConstitutiveExtraDofDiffusionStabilityParameter());
@@ -3995,7 +4004,7 @@ void interDomainBetween3D::createTerms(unknownField *uf,IPField*ip)
       {
         (static_cast<dG3DStiffnessInter*>(btermBound))->setNumConstitutiveExtraDofDiffusionVariable(getNumConstitutiveExtraDofDiffusionVariable());
         (static_cast<dG3DStiffnessInter*>(btermBound))->setConstitutiveExtraDofDiffusionEqRatio(getConstitutiveExtraDofDiffusionEqRatio());
-        (static_cast<dG3DStiffnessInter*>(btermBound))->setConstitutiveExtraDofDiffusionUseOneOverJump(getConstitutiveExtraDofDiffusionUseOneOverJump());
+        (static_cast<dG3DStiffnessInter*>(btermBound))->setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField());
         (static_cast<dG3DStiffnessInter*>(btermBound))->setConstitutiveExtraDofDiffusionAccountFieldSource(getConstitutiveExtraDofDiffusionAccountFieldSource());
         (static_cast<dG3DStiffnessInter*>(btermBound))->setConstitutiveExtraDofDiffusionAccountMecaSource(getConstitutiveExtraDofDiffusionAccountMecaSource());
         (static_cast<dG3DStiffnessInter*>(btermBound))->setConstitutiveExtraDofDiffusionStabilityParameter(getConstitutiveExtraDofDiffusionStabilityParameter());
@@ -4402,7 +4411,6 @@ ElecTherMechDG3DDomain::ElecTherMechDG3DDomain (const int tag,const int phys, co
 
   _continuity=true;
   _ElecTherMechBeta=100.;
-  _useFtFv=false;
 }
 
 ElecTherMechDG3DDomain::ElecTherMechDG3DDomain(const ElecTherMechDG3DDomain &source) : dG3DDomain(source)
@@ -4410,7 +4418,6 @@ ElecTherMechDG3DDomain::ElecTherMechDG3DDomain(const ElecTherMechDG3DDomain &sou
      _ElecTherMechBeta = source._ElecTherMechBeta;
      _continuity = source._continuity;
      _ElecTherMechEqRatio = source._ElecTherMechEqRatio;
-     _useFtFv = source._useFtFv;
 }
 
 
@@ -4989,7 +4996,6 @@ ElecTherMechInterDomainBetween3D::ElecTherMechInterDomainBetween3D(const int tag
   }
   _continuity=(static_cast<ElecTherMechDG3DDomain *> (dom1))->getElecTherMechContinuity();
   _ElecTherMechBeta=(static_cast<ElecTherMechDG3DDomain *> (dom1))->getElecTherMechStabilityParameter();
-  _useFtFv=(static_cast<ElecTherMechDG3DDomain *> (dom1))->getUseFtFv();
 }
 
 
diff --git a/dG3D/src/dG3DDomain.h b/dG3D/src/dG3DDomain.h
index 4ef4b2913..d0804496e 100644
--- a/dG3D/src/dG3DDomain.h
+++ b/dG3D/src/dG3DDomain.h
@@ -42,7 +42,7 @@ class dG3DDomain : public dgPartDomain{
   double _constitutiveExtraDofDiffusionBeta;
   bool _constitutiveExtraDofDiffusionContinuity;
   double _constitutiveExtraDofDiffusionEqRatio;
-  bool _constitutiveExtraDofDiffusionOneOverJump;
+  bool _constitutiveExtraDofDiffusionUseEnergyConjugatedField;
   bool _constitutiveExtraDofDiffusionAccountFieldSource;
   bool _constitutiveExtraDofDiffusionAccountMecaSource;
 
@@ -132,7 +132,7 @@ class dG3DDomain : public dgPartDomain{
   {
     _constitutiveExtraDofDiffusionEqRatio=eq;
   }
-  virtual void setConstitutiveExtraDofDiffusionUseOneOverJump(bool oneOverJump) {_constitutiveExtraDofDiffusionOneOverJump=oneOverJump;}
+  virtual void setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(bool oneOverJump) {_constitutiveExtraDofDiffusionUseEnergyConjugatedField=oneOverJump;}
   virtual void setConstitutiveExtraDofDiffusionAccountSource(const bool fieldSource, const bool mecaSource)
   {
     _constitutiveExtraDofDiffusionAccountFieldSource = fieldSource;
@@ -225,7 +225,7 @@ class dG3DDomain : public dgPartDomain{
   virtual double getNonLocalEqRatio() const { return _nonLocalEqRatio;}
   //
 
-  virtual bool getConstitutiveExtraDofDiffusionUseOneOverJump() const { return _constitutiveExtraDofDiffusionOneOverJump;}
+  virtual bool getConstitutiveExtraDofDiffusionUseEnergyConjugatedField() const { return _constitutiveExtraDofDiffusionUseEnergyConjugatedField;}
   virtual double getConstitutiveExtraDofDiffusionStabilityParameter() const { return _constitutiveExtraDofDiffusionBeta;}
   virtual bool   getConstitutiveExtraDofDiffusionContinuity() const { return  _constitutiveExtraDofDiffusionContinuity;}
   virtual double getConstitutiveExtraDofDiffusionEqRatio() const { return _constitutiveExtraDofDiffusionEqRatio;}
@@ -369,7 +369,7 @@ class ElecTherMechDG3DDomain : public dG3DDomain{
   double _ElecTherMechBeta;
   bool _continuity;
   double _ElecTherMechEqRatio;
-  bool _useFtFv;
+  //bool _useFtFv;
 
  public:
 
@@ -380,8 +380,8 @@ class ElecTherMechDG3DDomain : public dG3DDomain{
      _ElecTherMechBeta = b2;
      _continuity = continuity;
   }
-	virtual void useFtFv(bool ftfv) {_useFtFv=ftfv;}
-
+	//virtual void useFtFv(bool ftfv) {_useFtFv=ftfv;}
+        virtual void useFtFv(bool ftfv) {_constitutiveExtraDofDiffusionUseEnergyConjugatedField=ftfv;}
 #ifndef SWIG
   ElecTherMechDG3DDomain(const ElecTherMechDG3DDomain &source);
   virtual ~ElecTherMechDG3DDomain(){}
@@ -407,7 +407,7 @@ class ElecTherMechDG3DDomain : public dG3DDomain{
     }
   };
 
-  virtual bool getUseFtFv() const { return _useFtFv;}
+  virtual bool getUseFtFv() const { return _constitutiveExtraDofDiffusionUseEnergyConjugatedField;}
 
   virtual FunctionSpaceBase* getSpaceForBC(const nonLinearBoundaryCondition::type bc_type, const nonLinearBoundaryCondition::location bc_location,
                                           const int dof_comp,const groupOfElements *groupBC) const
diff --git a/dG3D/src/dG3DEnhancedStrainIPVariable.h b/dG3D/src/dG3DEnhancedStrainIPVariable.h
index 702159499..22c38992d 100644
--- a/dG3D/src/dG3DEnhancedStrainIPVariable.h
+++ b/dG3D/src/dG3DEnhancedStrainIPVariable.h
@@ -227,12 +227,16 @@ class dG3DEnhancedStrainIPVariable : public IPVariable2Enhanced<dG3DIPVariableBa
     virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodLinearKdField() {return _ipvbulk->getRefTodLinearKdField();}; 
     virtual const std::vector<std::vector<STensor43>>  &getConstRefTodLinearKdF() const {return _ipvbulk->getConstRefTodLinearKdF();}; 
     virtual std::vector<std::vector<STensor43>>  &getRefTodLinearKdF() {return _ipvbulk->getRefTodLinearKdF();}; 
-    virtual const std::vector<std::vector<const STensor3*> > &getConstRefToEnergyK() const {return _ipvbulk->getConstRefToEnergyK();};
+/*    virtual const std::vector<std::vector<const STensor3*> > &getConstRefToEnergyK() const {return _ipvbulk->getConstRefToEnergyK();};
     virtual void setConstRefToEnergyK(const STensor3 &eT, int i, int j)  {_ipvbulk->setConstRefToEnergyK(eT, i, j);};
     virtual const std::vector<std::vector<std::vector<STensor3> > >  &getConstRefTodEnergyKdField() const {return _ipvbulk->getConstRefTodEnergyKdField();}; 
     virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodEnergyKdField() {return _ipvbulk->getRefTodEnergyKdField();}; 
     virtual const std::vector<std::vector<STensor43>>  &getConstRefTodEnergyKdF() const {return _ipvbulk->getConstRefTodEnergyKdF();}; 
-    virtual std::vector<std::vector<STensor43>>  &getRefTodEnergyKdF() {return _ipvbulk->getRefTodEnergyKdF();};  
+    virtual std::vector<std::vector<STensor43>>  &getRefTodEnergyKdF() {return _ipvbulk->getRefTodEnergyKdF();};  */
+    virtual const std::vector<std::vector<std::vector<STensor3> > >  &getConstRefTodFluxdGradFielddField() const {return _ipvbulk->getConstRefTodFluxdGradFielddField();}; 
+    virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodFluxdGradFielddField() {return _ipvbulk->getRefTodFluxdGradFielddField();}; 
+    virtual const std::vector<std::vector<STensor43>>  &getConstRefTodFluxdGradFielddF() const {return _ipvbulk->getConstRefTodFluxdGradFielddF();}; 
+    virtual std::vector<std::vector<STensor43>>  &getRefTodFluxdGradFielddF() {return _ipvbulk->getRefTodFluxdGradFielddF();};  
     virtual const fullVector<double>  &getConstRefToFieldSource() const {return _ipvbulk->getConstRefToFieldSource();};
     virtual fullVector<double>  &getRefToFieldSource() {return _ipvbulk->getRefToFieldSource();};
     virtual const fullMatrix<double>  &getConstRefTodFieldSourcedField() const {return _ipvbulk->getConstRefTodFieldSourcedField();};
@@ -271,23 +275,23 @@ class dG3DEnhancedStrainIPVariable : public IPVariable2Enhanced<dG3DIPVariableBa
     virtual const std::vector<const STensor3*> &getConstRefToLinearSymmetrizationCoupling() const  {return _ipvbulk->getConstRefToLinearSymmetrizationCoupling();};
     virtual void setConstRefToLinearSymmetrizationCoupling(const STensor3 &eT, int i)  {_ipvbulk->setConstRefToLinearSymmetrizationCoupling(eT,i);};
   
-    //ThermoField (fT & fv)
-    virtual double getConstRefToThermoField(const int idex) const {return _ipvbulk->getConstRefToThermoField(idex);};  
-    virtual double  &getRefToThermoField(const int idex) {return _ipvbulk->getRefToThermoField(idex);};  
-    virtual const std::vector<SVector3>  &getConstRefToGradThermoField() const {return _ipvbulk->getConstRefToGradThermoField();}; 
-    virtual std::vector<SVector3>  &getRefToGradThermoField() {return _ipvbulk->getRefToGradThermoField();}; 
-    virtual const  std::vector<std::vector<double>>  &getConstRefTodFielddThermoField() const {return _ipvbulk->getConstRefTodFielddThermoField();};
-    virtual std::vector<std::vector<double>>  &getRefTodFielddThermoField() {return _ipvbulk->getRefTodFielddThermoField();};
-    virtual const std::vector<std::vector<SVector3>>  &getConstRefTodGradFielddThermoField() const {return _ipvbulk->getConstRefTodGradFielddThermoField();}; 
-    virtual std::vector<std::vector<SVector3>>  &getRefTodGradFielddThermoField() {return _ipvbulk->getRefTodGradFielddThermoField();};
-    virtual const std::vector<std::vector<STensor3>>  &getConstRefTodGradFielddGradThermoField() const {return _ipvbulk->getConstRefTodGradFielddGradThermoField();}; 
-    virtual std::vector<std::vector<STensor3>>  &getRefTodGradFielddGradThermoField() {return _ipvbulk->getRefTodGradFielddGradThermoField();}; 
-    virtual const fullVector<double>  &getConstRefToThermoFieldJump() const {return _ipvbulk->getConstRefToThermoFieldJump();};  
-    virtual fullVector<double>  &getRefToThermoFieldJump() {return _ipvbulk->getRefToThermoFieldJump();};
-    virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldm() const {return _ipvbulk->getConstRefTodThermoFieldJumpdFieldm();};
-    virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldm() {return _ipvbulk->getRefTodThermoFieldJumpdFieldm();};
-    virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldp() const {return _ipvbulk->getConstRefTodThermoFieldJumpdFieldp();};
-    virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldp() {return _ipvbulk->getRefTodThermoFieldJumpdFieldp();};
+  //Energy Conjugated Field (fT & fv)
+    virtual double getConstRefToEnergyConjugatedField(const int idex) const {return _ipvbulk->getConstRefToEnergyConjugatedField(idex);};  
+    virtual double  &getRefToEnergyConjugatedField(const int idex) {return _ipvbulk->getRefToEnergyConjugatedField(idex);};  
+    virtual const std::vector<SVector3>  &getConstRefToGradEnergyConjugatedField() const {return _ipvbulk->getConstRefToGradEnergyConjugatedField();}; 
+    virtual std::vector<SVector3>  &getRefToGradEnergyConjugatedField() {return _ipvbulk->getRefToGradEnergyConjugatedField();}; 
+    virtual const  std::vector<std::vector<double>>  &getConstRefTodFielddEnergyConjugatedField() const {return _ipvbulk->getConstRefTodFielddEnergyConjugatedField();};
+    virtual std::vector<std::vector<double>>  &getRefTodFielddEnergyConjugatedField() {return _ipvbulk->getRefTodFielddEnergyConjugatedField();};
+    virtual const std::vector<std::vector<SVector3>>  &getConstRefTodGradFielddEnergyConjugatedField() const {return _ipvbulk->getConstRefTodGradFielddEnergyConjugatedField();}; 
+    virtual std::vector<std::vector<SVector3>>  &getRefTodGradFielddEnergyConjugatedField() {return _ipvbulk->getRefTodGradFielddEnergyConjugatedField();};
+    virtual const std::vector<std::vector<STensor3>>  &getConstRefTodGradFielddGradEnergyConjugatedField() const {return _ipvbulk->getConstRefTodGradFielddGradEnergyConjugatedField();}; 
+    virtual std::vector<std::vector<STensor3>>  &getRefTodGradFielddGradEnergyConjugatedField() {return _ipvbulk->getRefTodGradFielddGradEnergyConjugatedField();}; 
+    virtual const fullVector<double>  &getConstRefToEnergyConjugatedFieldJump() const {return _ipvbulk->getConstRefToEnergyConjugatedFieldJump();};  
+    virtual fullVector<double>  &getRefToEnergyConjugatedFieldJump() {return _ipvbulk->getRefToEnergyConjugatedFieldJump();};
+    virtual const  std::vector<std::vector<double>>  &getConstRefTodEnergyConjugatedFieldJumpdFieldm() const {return _ipvbulk->getConstRefTodEnergyConjugatedFieldJumpdFieldm();};
+    virtual std::vector<std::vector<double>>  &getRefTodEnergyConjugatedFieldJumpdFieldm() {return _ipvbulk->getRefTodEnergyConjugatedFieldJumpdFieldm();};
+    virtual const  std::vector<std::vector<double>>  &getConstRefTodEnergyConjugatedFieldJumpdFieldp() const {return _ipvbulk->getConstRefTodEnergyConjugatedFieldJumpdFieldp();};
+    virtual std::vector<std::vector<double>>  &getRefTodEnergyConjugatedFieldJumpdFieldp() {return _ipvbulk->getRefTodEnergyConjugatedFieldJumpdFieldp();};
 
 
 		//------------------get 1st piola b4 AV ---------------//
diff --git a/dG3D/src/dG3DIPVariable.cpp b/dG3D/src/dG3DIPVariable.cpp
index 687d79c1f..b68b1ef67 100644
--- a/dG3D/src/dG3DIPVariable.cpp
+++ b/dG3D/src/dG3DIPVariable.cpp
@@ -77,7 +77,7 @@ void nonlocalData::restart(){
   restartManager::restart(dLocalVariableDExtraDofDiffusionField.getDataPtr(),numNonLocalVariable*numConstitutiveExtraDofDiffusionVariable);
 };
 //
-constitutiveExtraDofDiffusionData::constitutiveExtraDofDiffusionData(const int num, const int numNonLocal, bool _useOfEnergy, bool _conjugatedField): numConstitutiveExtraDofDiffusionVariable(num), numNonLocalVariable(numNonLocal),  useOfEnergy(_useOfEnergy), conjugatedField(_conjugatedField)
+constitutiveExtraDofDiffusionData::constitutiveExtraDofDiffusionData(const int num, const int numNonLocal, bool _useOfEnergy, bool _useOfEnergyConjugatedField): numConstitutiveExtraDofDiffusionVariable(num), numNonLocalVariable(numNonLocal),  useOfEnergy(_useOfEnergy), useOfEnergyConjugatedField(_useOfEnergyConjugatedField)
 {
   if (num > 0){
     std::vector<STensor3>        StdSTens3Tmp; StdSTens3Tmp.resize(num,STensor3(0.));
@@ -101,11 +101,13 @@ constitutiveExtraDofDiffusionData::constitutiveExtraDofDiffusionData(const int n
     linearK.resize(num,StdSTens3PtTmp);
     if(useOfEnergy)
     {
-      EnergyK.resize(num,StdSTens3PtTmp);
-      dlinearKdField.resize(num,StdSTens3Tmp2);
+     /* EnergyK.resize(num,StdSTens3PtTmp);
       dEnergyKdField.resize(num,StdSTens3Tmp2);
+      dEnergyKdF.resize(num,StdSTens43Tmp2);*/
+      dlinearKdField.resize(num,StdSTens3Tmp2);
       dlinearKdF.resize(num,StdSTens43Tmp2);
-      dEnergyKdF.resize(num,StdSTens43Tmp2);
+      dFluxdGradFielddF.resize(num,StdSTens43Tmp2);
+      dFluxdGradFielddField.resize(num,StdSTens3Tmp2);
     }
     fieldSource.resize(num); fieldSource.setAll(0.);
     dFieldSourcedField.resize(num,num); dFieldSourcedField.setAll(0.);
@@ -121,16 +123,16 @@ constitutiveExtraDofDiffusionData::constitutiveExtraDofDiffusionData(const int n
 	
     fieldJump.resize(num); fieldJump.setAll(0.);
 
-    if(conjugatedField)
+    if(useOfEnergyConjugatedField)
     {
-      thermoField.resize(num); thermoField.setAll(0.);
-      gradThermoField.resize(num,SVector3(0.));
-      thermoFieldJump.resize(num); thermoFieldJump.setAll(0.); 
-      dFielddThermoField.resize(num,StdDoubleTmp);
-      dGradFielddThermoField.resize(num,StdSVect3Tmp);
-      dGradFielddGradThermoField.resize(num,StdSTens3Tmp);
-      dThermoFieldJumpdFieldm.resize(num,StdDoubleTmp); 	
-      dThermoFieldJumpdFieldp.resize(num,StdDoubleTmp); 
+      energyConjugatedField.resize(num); energyConjugatedField.setAll(0.);
+      gradEnergyConjugatedField.resize(num,SVector3(0.));
+      energyConjugatedFieldJump.resize(num); energyConjugatedFieldJump.setAll(0.); 
+      dFielddEnergyConjugatedField.resize(num,StdDoubleTmp);
+      dGradFielddEnergyConjugatedField.resize(num,StdSVect3Tmp);
+      dGradFielddGradEnergyConjugatedField.resize(num,StdSTens3Tmp);
+      dEnergyConjugatedFieldJumpdFieldm.resize(num,StdDoubleTmp); 	
+      dEnergyConjugatedFieldJumpdFieldp.resize(num,StdDoubleTmp); 
     }
 
     oneOverFieldJump.resize(num); oneOverFieldJump.setAll(0.);
@@ -151,12 +153,12 @@ constitutiveExtraDofDiffusionData::constitutiveExtraDofDiffusionData(const const
                                                                                    field(source.field), gradField(source.gradField), flux(source.flux), 
                                                                                    dPdField(source.dPdField), dPdGradField(source.dPdGradField), dFluxdGradField(source.dFluxdGradField), 
                                                                                    dFluxdField(source.dFluxdField),
-                                                                                   dFluxdF(source.dFluxdF), linearK(source.linearK), fieldSource(source.fieldSource), 
+                                                                                   dFluxdF(source.dFluxdF), linearK(source.linearK),dlinearKdField(source.dlinearKdField),
+										   dlinearKdF(source.dlinearKdF),fieldSource(source.fieldSource), 
                                                                                    dFieldSourcedField(source.dFieldSourcedField), dFieldSourcedGradField(source.dFieldSourcedGradField), 
                                                                                    dFieldSourcedF(source.dFieldSourcedF), 
 	                                                                           mechanicalSource(source.mechanicalSource), dMechanicalSourcedField(source.dMechanicalSourcedField), 
                                                                                    dMechanicalSourcedGradField(source.dMechanicalSourcedGradField), dMechanicalSourcedF(source.dMechanicalSourcedF),
-
                                                                                    fieldCapacityPerUnitField(source.fieldCapacityPerUnitField), fieldJump(source.fieldJump), 
                                                                                    oneOverFieldJump(source.oneOverFieldJump), 
                                                                                    dOneOverFieldJumpdFieldm(source.dOneOverFieldJumpdFieldm),
@@ -165,7 +167,15 @@ constitutiveExtraDofDiffusionData::constitutiveExtraDofDiffusionData(const const
                                                                                    dFluxdNonLocalVariable(source.dFluxdNonLocalVariable), 
                                                                                    dFieldSourcedNonLocalVariable(source.dFieldSourcedNonLocalVariable),
                                                                                    dMechanicalSourcedNonLocalVariable(source.dMechanicalSourcedNonLocalVariable),
-                                                                                   conjugatedField(source.conjugatedField),useOfEnergy(source.useOfEnergy)
+                                                                                   useOfEnergyConjugatedField(source.useOfEnergyConjugatedField),useOfEnergy(source.useOfEnergy),
+										   energyConjugatedField(source.energyConjugatedField), gradEnergyConjugatedField(source.gradEnergyConjugatedField),
+										   dFielddEnergyConjugatedField(source.dFielddEnergyConjugatedField),
+									           dGradFielddEnergyConjugatedField(source.dGradFielddEnergyConjugatedField),
+										   dGradFielddGradEnergyConjugatedField(source.dGradFielddGradEnergyConjugatedField),
+										   energyConjugatedFieldJump(source.energyConjugatedFieldJump),
+										   dEnergyConjugatedFieldJumpdFieldm(source.dEnergyConjugatedFieldJumpdFieldm),
+										   dEnergyConjugatedFieldJumpdFieldp(source.dEnergyConjugatedFieldJumpdFieldp), dFluxdGradFielddF(source.dFluxdGradFielddF),
+										   dFluxdGradFielddField(source.dFluxdGradFielddField)
 {
   
 };
@@ -183,8 +193,16 @@ constitutiveExtraDofDiffusionData& constitutiveExtraDofDiffusionData::operator =
   dFluxdField=source.dFluxdField; 
   dFluxdF=source.dFluxdF;
   linearK=source.linearK;
-  fieldSource=source.fieldSource;
-  
+  dlinearKdF=source.dlinearKdF;
+  dlinearKdField=source.dlinearKdField;
+ /* EnergyK=source.EnergyK;
+  dEnergyKdF=source.dEnergyKdF;
+  dEnergyKdField=source.dEnergyKdField;*/
+
+  dFluxdGradFielddF=source.dFluxdGradFielddF;
+  dFluxdGradFielddField=source.dFluxdGradFielddField;
+
+  fieldSource=source.fieldSource;  
   dFieldSourcedField=source.dFieldSourcedField;
   dFieldSourcedGradField=source.dFieldSourcedGradField;
   dFieldSourcedF=source.dFieldSourcedF;
@@ -204,8 +222,17 @@ constitutiveExtraDofDiffusionData& constitutiveExtraDofDiffusionData::operator =
   dFieldSourcedNonLocalVariable=source.dFieldSourcedNonLocalVariable;
   dMechanicalSourcedNonLocalVariable=source.dMechanicalSourcedNonLocalVariable;
 
+  energyConjugatedField=source.energyConjugatedField;
+  gradEnergyConjugatedField=source.gradEnergyConjugatedField;
+  dFielddEnergyConjugatedField=source.dFielddEnergyConjugatedField;
+  dGradFielddEnergyConjugatedField=source.dGradFielddEnergyConjugatedField;
+  dGradFielddGradEnergyConjugatedField=source.dGradFielddGradEnergyConjugatedField;
+  energyConjugatedFieldJump=source.energyConjugatedFieldJump; 			
+  dEnergyConjugatedFieldJumpdFieldm=source.dEnergyConjugatedFieldJumpdFieldm; 	
+  dEnergyConjugatedFieldJumpdFieldp=source.dEnergyConjugatedFieldJumpdFieldp; 
+
   useOfEnergy=source.useOfEnergy;
-  conjugatedField=source.conjugatedField;  
+  useOfEnergyConjugatedField=source.useOfEnergyConjugatedField;  
 
   return *this;
 };
@@ -226,10 +253,18 @@ void constitutiveExtraDofDiffusionData::restart(){
     restartManager::restart(dFluxdF);
 
     restartManager::restart(useOfEnergy);
-    restartManager::restart(conjugatedField);
+    restartManager::restart(useOfEnergyConjugatedField);
 
     //restartManager::restart(linearK.resize(num,StdSTens3PtTmp);
 
+    restartManager::restart(dlinearKdField);
+    restartManager::restart(dlinearKdF);
+    /*restartManager::restart(dEnergyKdField);
+    restartManager::restart(dEnergyKdF);*/
+
+    restartManager::restart(dFluxdGradFielddF);
+    restartManager::restart(dFluxdGradFielddField);
+
     restartManager::restart(fieldSource.getDataPtr(),numConstitutiveExtraDofDiffusionVariable);
     restartManager::restart(dFieldSourcedField.getDataPtr(),numConstitutiveExtraDofDiffusionVariable*numConstitutiveExtraDofDiffusionVariable);
     restartManager::restart(dFieldSourcedGradField);
@@ -252,10 +287,18 @@ void constitutiveExtraDofDiffusionData::restart(){
     restartManager::restart(dFieldSourcedNonLocalVariable.getDataPtr(),numConstitutiveExtraDofDiffusionVariable*numNonLocalVariable);
     restartManager::restart(dMechanicalSourcedNonLocalVariable.getDataPtr(),numConstitutiveExtraDofDiffusionVariable*numNonLocalVariable);
 
+    restartManager::restart(energyConjugatedField.getDataPtr(),numConstitutiveExtraDofDiffusionVariable);
+    restartManager::restart(gradEnergyConjugatedField);
+    restartManager::restart(dFielddEnergyConjugatedField);
+    restartManager::restart(dGradFielddEnergyConjugatedField);
+    restartManager::restart(dGradFielddGradEnergyConjugatedField);
+    restartManager::restart(energyConjugatedFieldJump.getDataPtr(),numConstitutiveExtraDofDiffusionVariable); 			
+    restartManager::restart(dEnergyConjugatedFieldJumpdFieldm); 	
+    restartManager::restart(dEnergyConjugatedFieldJumpdFieldp); 	
 
 };
 
-dG3DIPVariable::dG3DIPVariable(const bool oninter, int numNonLocal, int extraDofDiffusion, bool useOfEnergy, bool conjugatedField) : dG3DIPVariableBase(), _nonlocalData(NULL), _constitutiveExtraDofDiffusionData(NULL)
+dG3DIPVariable::dG3DIPVariable(const bool oninter, int numNonLocal, int extraDofDiffusion, bool useOfEnergy, bool energyConjugatedField) : dG3DIPVariableBase(), _nonlocalData(NULL), _constitutiveExtraDofDiffusionData(NULL)
 {
   _oninter = oninter;
   deformationGradient(0,0) = 1.;
@@ -264,7 +307,7 @@ dG3DIPVariable::dG3DIPVariable(const bool oninter, int numNonLocal, int extraDof
   if(numNonLocal>0)
     _nonlocalData=new nonlocalData(numNonLocal,extraDofDiffusion);
   if(extraDofDiffusion>0)
-    _constitutiveExtraDofDiffusionData = new constitutiveExtraDofDiffusionData(extraDofDiffusion,numNonLocal, useOfEnergy, conjugatedField);
+    _constitutiveExtraDofDiffusionData = new constitutiveExtraDofDiffusionData(extraDofDiffusion,numNonLocal, useOfEnergy, energyConjugatedField);
 
 }
 
diff --git a/dG3D/src/dG3DIPVariable.h b/dG3D/src/dG3DIPVariable.h
index 1fc8f11e1..69d2e7a47 100644
--- a/dG3D/src/dG3DIPVariable.h
+++ b/dG3D/src/dG3DIPVariable.h
@@ -174,16 +174,20 @@ class dG3DIPVariableBase : public ipFiniteStrain
   virtual std::vector<STensor33>   &getRefTodFluxdF()=0; 
   virtual const std::vector<std::vector<const STensor3*> > &getConstRefToLinearK() const =0; 
   virtual void setConstRefToLinearK(const STensor3 &eT, int i, int j) =0; 
-  virtual const std::vector<std::vector<const STensor3*> > &getConstRefToEnergyK() const =0; 
-  virtual void setConstRefToEnergyK(const STensor3 &eT, int i, int j) =0; 
   virtual const std::vector<std::vector<std::vector<STensor3> > >  &getConstRefTodLinearKdField() const=0; 
   virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodLinearKdField()=0; 
-  virtual const std::vector<std::vector<std::vector<STensor3> > >  &getConstRefTodEnergyKdField() const=0; 
-  virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodEnergyKdField()=0; 
   virtual const std::vector< std::vector<STensor43> >  &getConstRefTodLinearKdF() const=0; 
   virtual std::vector<std::vector<STensor43>>  &getRefTodLinearKdF()=0;  
+/*  virtual const std::vector<std::vector<const STensor3*> > &getConstRefToEnergyK() const =0; 
+  virtual void setConstRefToEnergyK(const STensor3 &eT, int i, int j) =0; 
+  virtual const std::vector<std::vector<std::vector<STensor3> > >  &getConstRefTodEnergyKdField() const=0; 
+  virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodEnergyKdField()=0; 
   virtual const std::vector< std::vector<STensor43> >  &getConstRefTodEnergyKdF() const=0; 
-  virtual std::vector<std::vector<STensor43>>  &getRefTodEnergyKdF()=0; 
+  virtual std::vector<std::vector<STensor43>>  &getRefTodEnergyKdF()=0; */
+  virtual const std::vector< std::vector<STensor43> >  &getConstRefTodFluxdGradFielddF() const=0; 
+  virtual std::vector<std::vector<STensor43>>  &getRefTodFluxdGradFielddF()=0; 
+  virtual const std::vector<std::vector<std::vector<STensor3> > >  &getConstRefTodFluxdGradFielddField() const=0; 
+  virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodFluxdGradFielddField()=0; 
   virtual const fullVector<double>  &getConstRefToFieldSource() const=0; 
   virtual fullVector<double>  &getRefToFieldSource()=0; 
   virtual const fullMatrix<double>  &getConstRefTodFieldSourcedField() const=0; 
@@ -222,24 +226,24 @@ class dG3DIPVariableBase : public ipFiniteStrain
   virtual const fullMatrix<double> &getConstRefTodMechanicalSourcedNonLocalVariable() const=0;
   virtual fullMatrix<double> &getRefTodMechanicalSourcedNonLocalVariable()=0;
 
-  //ThermoField (fT & fv)
-
-  virtual double getConstRefToThermoField(const int idex) const=0; 
-  virtual double  &getRefToThermoField(const int idex)=0; 
-  virtual const std::vector<SVector3>  &getConstRefToGradThermoField() const=0; 
-  virtual std::vector<SVector3>  &getRefToGradThermoField()=0; 
-  virtual const  std::vector<std::vector<double>>  &getConstRefTodFielddThermoField() const=0;
-  virtual std::vector<std::vector<double>>  &getRefTodFielddThermoField()=0;
-  virtual const std::vector<std::vector<SVector3>>  &getConstRefTodGradFielddThermoField() const=0; 
-  virtual std::vector<std::vector<SVector3>>  &getRefTodGradFielddThermoField()=0;
-  virtual const std::vector<std::vector<STensor3>>  &getConstRefTodGradFielddGradThermoField() const=0; 
-  virtual std::vector<std::vector<STensor3>>  &getRefTodGradFielddGradThermoField()=0;
-  virtual const fullVector<double>  &getConstRefToThermoFieldJump() const=0; 
-  virtual fullVector<double>  &getRefToThermoFieldJump()=0;
-  virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldm() const=0;
-  virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldm()=0;
-  virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldp() const=0;
-  virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldp()=0;
+  //Energy Conjugated Field (fT & fv)
+
+  virtual double getConstRefToEnergyConjugatedField(const int idex) const=0; 
+  virtual double  &getRefToEnergyConjugatedField(const int idex)=0; 
+  virtual const std::vector<SVector3>  &getConstRefToGradEnergyConjugatedField() const=0; 
+  virtual std::vector<SVector3>  &getRefToGradEnergyConjugatedField()=0; 
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodFielddEnergyConjugatedField() const=0;
+  virtual std::vector<std::vector<double>>  &getRefTodFielddEnergyConjugatedField()=0;
+  virtual const std::vector<std::vector<SVector3>>  &getConstRefTodGradFielddEnergyConjugatedField() const=0; 
+  virtual std::vector<std::vector<SVector3>>  &getRefTodGradFielddEnergyConjugatedField()=0;
+  virtual const std::vector<std::vector<STensor3>>  &getConstRefTodGradFielddGradEnergyConjugatedField() const=0; 
+  virtual std::vector<std::vector<STensor3>>  &getRefTodGradFielddGradEnergyConjugatedField()=0;
+  virtual const fullVector<double>  &getConstRefToEnergyConjugatedFieldJump() const=0; 
+  virtual fullVector<double>  &getRefToEnergyConjugatedFieldJump()=0;
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodEnergyConjugatedFieldJumpdFieldm() const=0;
+  virtual std::vector<std::vector<double>>  &getRefTodEnergyConjugatedFieldJumpdFieldm()=0;
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodEnergyConjugatedFieldJumpdFieldp() const=0;
+  virtual std::vector<std::vector<double>>  &getRefTodEnergyConjugatedFieldJumpdFieldp()=0;
 
   virtual void restart(){}
 };
@@ -278,7 +282,7 @@ class constitutiveExtraDofDiffusionData{
   int numConstitutiveExtraDofDiffusionVariable; //number of extra dof variables
   int numNonLocalVariable; //number of extra dof variables
   bool useOfEnergy;
-  bool conjugatedField;
+  bool useOfEnergyConjugatedField;
 
   fullVector<double>           field;
   std::vector<SVector3>        gradField;
@@ -316,36 +320,39 @@ class constitutiveExtraDofDiffusionData{
 
 
   // Use of energy
-  std::vector<std::vector<const STensor3*> > EnergyK;
-  std::vector<std::vector<std::vector<STensor3>>> dlinearKdField;
+  
+ /* std::vector<std::vector<const STensor3*> > EnergyK;
   std::vector<std::vector<std::vector<STensor3>>> dEnergyKdField;
+  std::vector<std::vector<STensor43>> dEnergyKdF;*/
   std::vector<std::vector<STensor43>> dlinearKdF;
-  std::vector<std::vector<STensor43>> dEnergyKdF;
+  std::vector<std::vector<std::vector<STensor3>>> dlinearKdField;
+  std::vector<std::vector<std::vector<STensor3>>> dFluxdGradFielddField;
+  std::vector<std::vector<STensor43>> dFluxdGradFielddF;
 
 
   //use of conjugated fields (fT & fv)
 
-  fullVector<double>           thermoField; //energyConjugatedField
-  std::vector<SVector3>        gradThermoField;
-  std::vector<std::vector<double>>          dFielddThermoField;
-  std::vector<std::vector<SVector3>>        dGradFielddThermoField;
-  std::vector<std::vector<STensor3>>        dGradFielddGradThermoField;
-  fullVector<double>           thermoFieldJump; 			//dg
-  std::vector<std::vector<double>>          dThermoFieldJumpdFieldm; 	//dg
-  std::vector<std::vector<double>>          dThermoFieldJumpdFieldp; 	//dg
+  fullVector<double>           energyConjugatedField;
+  std::vector<SVector3>        gradEnergyConjugatedField;
+  std::vector<std::vector<double>>          dFielddEnergyConjugatedField;
+  std::vector<std::vector<SVector3>>        dGradFielddEnergyConjugatedField;
+  std::vector<std::vector<STensor3>>        dGradFielddGradEnergyConjugatedField;
+  fullVector<double>           energyConjugatedFieldJump; 			
+  std::vector<std::vector<double>>          dEnergyConjugatedFieldJumpdFieldm; 	
+  std::vector<std::vector<double>>          dEnergyConjugatedFieldJumpdFieldp; 	
   
 
 
 
  public:
-  constitutiveExtraDofDiffusionData(const int numVer, const int numNonLocal=0,   bool useOfEnergy = false, bool conjugatedField=false);
+  constitutiveExtraDofDiffusionData(const int numVer, const int numNonLocal=0,   bool useOfEnergy = false, bool useOfEnergyConjugatedField=false);
   constitutiveExtraDofDiffusionData(const constitutiveExtraDofDiffusionData& src);
   constitutiveExtraDofDiffusionData& operator = (const constitutiveExtraDofDiffusionData& src);
   virtual ~constitutiveExtraDofDiffusionData(){};
   void restart();
   virtual int getConstitutiveExtraDofDiffusionVariable() const {return numConstitutiveExtraDofDiffusionVariable;}
   virtual int getNumNonLocalVariable() const {return numNonLocalVariable;}
-  virtual bool useConjugatedField() const {return conjugatedField;}
+  virtual bool useConjugatedField() const {return useOfEnergyConjugatedField;}
 
 };
 
@@ -374,7 +381,7 @@ protected:
     constitutiveExtraDofDiffusionData *_constitutiveExtraDofDiffusionData;
 
  public:
-  dG3DIPVariable(const bool oninter=false, int numNonLocal=0, int extraDofDiffusion=0, bool useOfEnergy=false, bool conjugatedField=false); // A empty constructor is mandatory to build FractureCohesive3DIPVariable OK like this as the fracture is on interface??
+  dG3DIPVariable(const bool oninter=false, int numNonLocal=0, int extraDofDiffusion=0, bool useOfEnergy=false, bool useOfEnergyConjugatedField=false); // A empty constructor is mandatory to build FractureCohesive3DIPVariable OK like this as the fracture is on interface??
   dG3DIPVariable(const dG3DIPVariable &source);
   virtual dG3DIPVariable &operator = (const IPVariable &_source);
   virtual ~dG3DIPVariable()
@@ -701,7 +708,7 @@ protected:
          Msg::Fatal("setConstRefTolinearK() : index out of range");
     }
   }
-  virtual const std::vector<std::vector<const STensor3*> > &getConstRefToEnergyK() const
+/*  virtual const std::vector<std::vector<const STensor3*> > &getConstRefToEnergyK() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
       Msg::Fatal("getConstRefToEnergyK() : _constitutiveExtraDofDiffusionData not created");
@@ -747,6 +754,34 @@ protected:
       Msg::Fatal("getRefTodEnergyKdF() : _constitutiveExtraDofDiffusionData not created");
     else
       return _constitutiveExtraDofDiffusionData->dEnergyKdF;
+  }*/
+  virtual const std::vector< std::vector<std::vector<STensor3> > >  &getConstRefTodFluxdGradFielddField() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefTodFluxdGradFielddField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dFluxdGradFielddField;
+  }
+  virtual std::vector< std::vector<std::vector<STensor3> > >  &getRefTodFluxdGradFielddField()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefTodFluxdGradFielddField() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dFluxdGradFielddField;
+  }
+  virtual const std::vector<std::vector<STensor43>>  &getConstRefTodFluxdGradFielddF() const
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getConstRefTodFluxdGradFielddF() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dFluxdGradFielddF;
+  }
+  virtual std::vector<std::vector<STensor43>>  &getRefTodFluxdGradFielddF()
+  {
+    if(_constitutiveExtraDofDiffusionData==NULL)
+      Msg::Fatal("getRefTodFluxdGradFielddF() : _constitutiveExtraDofDiffusionData not created");
+    else
+      return _constitutiveExtraDofDiffusionData->dFluxdGradFielddF;
   }
   virtual const std::vector< std::vector<std::vector<STensor3> > >  &getConstRefTodLinearKdField() const
   {
@@ -1035,119 +1070,119 @@ protected:
       return _constitutiveExtraDofDiffusionData->dMechanicalSourcedNonLocalVariable;
   }
 
-  //ThermoField (fT & fv)
+  //Energy Conjugated Fiedl (fT & fv)
 
-  virtual double getConstRefToThermoField(const int idex) const
+  virtual double getConstRefToEnergyConjugatedField(const int idex) const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getConstRefToThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getConstRefToEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->thermoField(idex);
+      return _constitutiveExtraDofDiffusionData->energyConjugatedField(idex);
   }
-  virtual double   &getRefToThermoField(const int idex)
+  virtual double   &getRefToEnergyConjugatedField(const int idex)
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getRefToThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getRefToEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->thermoField(idex);
+      return _constitutiveExtraDofDiffusionData->energyConjugatedField(idex);
   }
-  virtual const std::vector<SVector3>  &getConstRefToGradThermoField() const
+  virtual const std::vector<SVector3>  &getConstRefToGradEnergyConjugatedField() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getConstRefToGradThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getConstRefToGradEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->gradThermoField;
+      return _constitutiveExtraDofDiffusionData->gradEnergyConjugatedField;
   }
-  virtual std::vector<SVector3>  &getRefToGradThermoField()
+  virtual std::vector<SVector3>  &getRefToGradEnergyConjugatedField()
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getRefToGradThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getRefToGradEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->gradThermoField;
+      return _constitutiveExtraDofDiffusionData->gradEnergyConjugatedField;
   }
-  virtual const  std::vector<std::vector<double>>  &getConstRefTodFielddThermoField() const
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodFielddEnergyConjugatedField() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getConstRefTodFielddThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getConstRefTodFielddEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dFielddThermoField;
+      return _constitutiveExtraDofDiffusionData->dFielddEnergyConjugatedField;
   }
-  virtual std::vector<std::vector<double>>  &getRefTodFielddThermoField()
+  virtual std::vector<std::vector<double>>  &getRefTodFielddEnergyConjugatedField()
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getRefTodFielddThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getRefTodFielddEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dFielddThermoField;
+      return _constitutiveExtraDofDiffusionData->dFielddEnergyConjugatedField;
   }
-  virtual const std::vector<std::vector<SVector3>>  &getConstRefTodGradFielddThermoField() const
+  virtual const std::vector<std::vector<SVector3>>  &getConstRefTodGradFielddEnergyConjugatedField() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getConstRefTodGradFielddThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getConstRefTodGradFielddEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dGradFielddThermoField;
+      return _constitutiveExtraDofDiffusionData->dGradFielddEnergyConjugatedField;
   }
-  virtual std::vector<std::vector<SVector3>>  &getRefTodGradFielddThermoField()
+  virtual std::vector<std::vector<SVector3>>  &getRefTodGradFielddEnergyConjugatedField()
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getRefTodGradFielddThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getRefTodGradFielddEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dGradFielddThermoField;
+      return _constitutiveExtraDofDiffusionData->dGradFielddEnergyConjugatedField;
   }
-  virtual const std::vector<std::vector<STensor3>>  &getConstRefTodGradFielddGradThermoField() const
+  virtual const std::vector<std::vector<STensor3>>  &getConstRefTodGradFielddGradEnergyConjugatedField() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getConstRefTodGradFielddGradThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getConstRefTodGradFielddGradEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dGradFielddGradThermoField;
+      return _constitutiveExtraDofDiffusionData->dGradFielddGradEnergyConjugatedField;
   }
-  virtual std::vector<std::vector<STensor3>>  &getRefTodGradFielddGradThermoField()
+  virtual std::vector<std::vector<STensor3>>  &getRefTodGradFielddGradEnergyConjugatedField()
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getRefTodGradFielddGradThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getRefTodGradFielddGradEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dGradFielddGradThermoField;
+      return _constitutiveExtraDofDiffusionData->dGradFielddGradEnergyConjugatedField;
   }
-  virtual const fullVector<double>  &getConstRefToThermoFieldJump() const
+  virtual const fullVector<double>  &getConstRefToEnergyConjugatedFieldJump() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getConstRefToThermoFieldJump() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getConstRefToEnergyConjugatedFieldJump() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->thermoFieldJump;
+      return _constitutiveExtraDofDiffusionData->energyConjugatedFieldJump;
   } 
-  virtual fullVector<double>  &getRefToThermoFieldJump()
+  virtual fullVector<double>  &getRefToEnergyConjugatedFieldJump()
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getRefToThermoFieldJump() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getRefToEnergyConjugatedFieldJump() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->thermoFieldJump;
+      return _constitutiveExtraDofDiffusionData->energyConjugatedFieldJump;
   } 
-  virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldm() const
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodEnergyConjugatedFieldJumpdFieldm() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getConstRefTodThermoFieldJumpdFieldm() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getConstRefTodEnergyConjugatedFieldJumpdFieldm() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dThermoFieldJumpdFieldm;
+      return _constitutiveExtraDofDiffusionData->dEnergyConjugatedFieldJumpdFieldm;
   } 
-  virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldm()
+  virtual std::vector<std::vector<double>>  &getRefTodEnergyConjugatedFieldJumpdFieldm()
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getRefTodThermoFieldJumpdFieldm() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getRefTodEnergyConjugatedFieldJumpdFieldm() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dThermoFieldJumpdFieldm;
+      return _constitutiveExtraDofDiffusionData->dEnergyConjugatedFieldJumpdFieldm;
   } 
-  virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldp() const
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodEnergyConjugatedFieldJumpdFieldp() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getConstRefTodThermoFieldJumpdFieldp() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getConstRefTodEnergyConjugatedFieldJumpdFieldp() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dThermoFieldJumpdFieldp;
+      return _constitutiveExtraDofDiffusionData->dEnergyConjugatedFieldJumpdFieldp;
   }
-  virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldp()
+  virtual std::vector<std::vector<double>>  &getRefTodEnergyConjugatedFieldJumpdFieldp()
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getRefTodThermoFieldJumpdFieldp() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getRefTodEnergyConjugatedFieldJumpdFieldp() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dThermoFieldJumpdFieldp;
+      return _constitutiveExtraDofDiffusionData->dEnergyConjugatedFieldJumpdFieldp;
   }
 
 
@@ -2261,6 +2296,12 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   virtual const  STensor3 &getConstRefTodTherConductivitydv() const {return  getConstRefTodLinearKdField()[0][0][1];}
   virtual  STensor3 &getRefTodTherConductivitydv() {return  getRefTodLinearKdField()[0][0][1];}
 
+  virtual const  STensor3 &getConstRefTodCrossTherConductivitydv() const {return  getConstRefTodLinearKdField()[0][1][1];}
+  virtual  STensor3 &getRefTodCrossTherConductivitydv() {return  getRefTodLinearKdField()[0][1][1];}
+
+  virtual const  STensor3 &getConstRefTodElecConductivitydv() const {return  getConstRefTodLinearKdField()[1][1][1];}
+  virtual  STensor3 &getRefTodElecConductivitydv() {return  getRefTodLinearKdField()[1][1][1];}
+
   virtual const  STensor3 &getConstRefTodCrossElecConductivitydv() const {return  getConstRefTodLinearKdField()[1][0][1];}
   virtual  STensor3 &getRefTodCrossElecConductivitydv() {return  getRefTodLinearKdField()[1][0][1];}
 
@@ -2276,29 +2317,32 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   virtual const  STensor43 &getConstRefTodCrossTherConductivitydF() const {return  getConstRefTodLinearKdF()[0][1];}
   virtual  STensor43 &getRefTodCrossTherConductivitydF() {return  getRefTodLinearKdF()[0][1];}
 
-  virtual const double getConstRefTofvJump() const {return getConstRefToThermoFieldJump()(1);}
-  virtual double &getRefTofvJump() {return  getRefToThermoFieldJump()(1);}
+  virtual const double getConstRefTofvJump() const {return getConstRefToEnergyConjugatedFieldJump()(1);}
+  virtual double &getRefTofvJump() {return  getRefToEnergyConjugatedFieldJump()(1);}
 
-  virtual const double getConstRefToOneOverTemperatureJump() const {return getConstRefToThermoFieldJump()(0);}
-  virtual double &getRefToOneOverTemperatureJump() {return  getRefToThermoFieldJump()(0);}
+  virtual const double getConstRefTofTJump() const {return getConstRefToEnergyConjugatedFieldJump()(0);}
+  virtual double &getRefTofTJump() {return  getRefToEnergyConjugatedFieldJump()(0);}
 
-  virtual const double getConstRefTodOneOverTemperatureJumpdTm() const {return getConstRefTodThermoFieldJumpdFieldm()[0][0];}
-  virtual double &getRefTodOneOverTemperatureJumpdTm() {return  getRefTodThermoFieldJumpdFieldm()[0][0];}
+  virtual const double getConstRefToOneOverTemperatureJump() const {return getConstRefToEnergyConjugatedFieldJump()(0);}
+  virtual double &getRefToOneOverTemperatureJump() {return  getRefToEnergyConjugatedFieldJump()(0);}
 
-  virtual const double getConstRefTodOneOverTemperatureJumpdTp() const {return getConstRefTodThermoFieldJumpdFieldp()[0][0];}
-  virtual double &getRefTodOneOverTemperatureJumpdTp() {return  getRefTodThermoFieldJumpdFieldp()[0][0];}
+  virtual const double getConstRefTodOneOverTemperatureJumpdTm() const {return getConstRefTodEnergyConjugatedFieldJumpdFieldm()[0][0];}
+  virtual double &getRefTodOneOverTemperatureJumpdTm() {return  getRefTodEnergyConjugatedFieldJumpdFieldm()[0][0];}
 
-  virtual const double &getConstRefTodfvjumpdvm() const {return getConstRefTodThermoFieldJumpdFieldm()[1][1];}
-  virtual double &getRefTodfvjumpdvm() {return  getRefTodThermoFieldJumpdFieldm()[1][1];}
+  virtual const double getConstRefTodOneOverTemperatureJumpdTp() const {return getConstRefTodEnergyConjugatedFieldJumpdFieldp()[0][0];}
+  virtual double &getRefTodOneOverTemperatureJumpdTp() {return  getRefTodEnergyConjugatedFieldJumpdFieldp()[0][0];}
 
-  virtual const double &getConstRefTodfvjumpdvp() const {return getConstRefTodThermoFieldJumpdFieldp()[1][1];}
-  virtual double &getRefTodfvjumpdvp() {return  getRefTodThermoFieldJumpdFieldp()[1][1];}
+  virtual const double &getConstRefTodfvjumpdvm() const {return getConstRefTodEnergyConjugatedFieldJumpdFieldm()[1][1];}
+  virtual double &getRefTodfvjumpdvm() {return  getRefTodEnergyConjugatedFieldJumpdFieldm()[1][1];}
 
-  virtual const double &getConstRefTodfvjumpdTm() const {return getConstRefTodThermoFieldJumpdFieldm()[1][0];}
-  virtual double &getRefTodfvjumpdTm() {return  getRefTodThermoFieldJumpdFieldm()[1][0];}
+  virtual const double &getConstRefTodfvjumpdvp() const {return getConstRefTodEnergyConjugatedFieldJumpdFieldp()[1][1];}
+  virtual double &getRefTodfvjumpdvp() {return  getRefTodEnergyConjugatedFieldJumpdFieldp()[1][1];}
 
-  virtual const double &getConstRefTodfvjumpdTp() const {return getConstRefTodThermoFieldJumpdFieldp()[1][0];}
-  virtual double &getRefTodfvjumpdTp() {return  getRefTodThermoFieldJumpdFieldp()[1][0];}
+  virtual const double &getConstRefTodfvjumpdTm() const {return getConstRefTodEnergyConjugatedFieldJumpdFieldm()[1][0];}
+  virtual double &getRefTodfvjumpdTm() {return  getRefTodEnergyConjugatedFieldJumpdFieldm()[1][0];}
+
+  virtual const double &getConstRefTodfvjumpdTp() const {return getConstRefTodEnergyConjugatedFieldJumpdFieldp()[1][0];}
+  virtual double &getRefTodfvjumpdTp() {return  getRefTodEnergyConjugatedFieldJumpdFieldp()[1][0];}
 
   virtual const double getConstRefToTemperatureJump() const {return getConstRefToFieldJump()(0);}
   virtual double &getRefToTemperatureJump() {return  getRefToFieldJump()(0);}
@@ -2361,53 +2405,53 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   virtual const  SVector3 &getConstRefTodThermalSourcedGradT() const {return  dThermalSourcedGradT;}//dwdgradT
   virtual  SVector3 &getRefTodThermalSourcedGradT() {return  dThermalSourcedGradT;}*/
 
-  virtual const double getConstRefTofT() const {return  getConstRefToThermoField(0);}
-  virtual double &getRefTofT() {return getRefToThermoField(0);}
+  virtual const double getConstRefTofT() const {return  getConstRefToEnergyConjugatedField(0);}
+  virtual double &getRefTofT() {return getRefToEnergyConjugatedField(0);}
 
-  virtual const SVector3 &getConstRefToGradfT() const {return getConstRefToGradThermoField()[0];}
-  virtual SVector3 &getRefToGradfT() {return getRefToGradThermoField()[0];}
+  virtual const SVector3 &getConstRefToGradfT() const {return getConstRefToGradEnergyConjugatedField()[0];}
+  virtual SVector3 &getRefToGradfT() {return getRefToGradEnergyConjugatedField()[0];}
 
-  virtual const double getConstRefTofV() const {return  getConstRefToThermoField(1);}
-  virtual double &getRefTofV() {return  getRefToThermoField(1);}
+  virtual const double getConstRefTofV() const {return  getConstRefToEnergyConjugatedField(1);}
+  virtual double &getRefTofV() {return  getRefToEnergyConjugatedField(1);}
 
-  virtual const SVector3 &getConstRefToGradfV() const {return getConstRefToGradThermoField()[1];}
-  virtual SVector3 &getRefToGradfV() {return getRefToGradThermoField()[1];}
+  virtual const SVector3 &getConstRefToGradfV() const {return getConstRefToGradEnergyConjugatedField()[1];}
+  virtual SVector3 &getRefToGradfV() {return getRefToGradEnergyConjugatedField()[1];}
 
-  virtual const STensor3 &getConstRefTodgradVdgradfV() const {return getConstRefTodGradFielddGradThermoField()[1][1];}
-  virtual STensor3 &getRefTodgradVdgradfV() {return  getRefTodGradFielddGradThermoField()[1][1];}
+  virtual const STensor3 &getConstRefTodgradVdgradfV() const {return getConstRefTodGradFielddGradEnergyConjugatedField()[1][1];}
+  virtual STensor3 &getRefTodgradVdgradfV() {return  getRefTodGradFielddGradEnergyConjugatedField()[1][1];}
 
-  virtual const STensor3 &getConstRefTodgradVdgradfT() const {return getConstRefTodGradFielddGradThermoField()[1][0];}
-  virtual STensor3 &getRefTodgradVdgradfT() {return  getRefTodGradFielddGradThermoField()[1][0];}
+  virtual const STensor3 &getConstRefTodgradVdgradfT() const {return getConstRefTodGradFielddGradEnergyConjugatedField()[1][0];}
+  virtual STensor3 &getRefTodgradVdgradfT() {return  getRefTodGradFielddGradEnergyConjugatedField()[1][0];}
 
-  virtual const STensor3 &getConstRefTodgradTdgradfT() const {return getConstRefTodGradFielddGradThermoField()[0][0];}
-  virtual STensor3 &getRefTodgradTdgradfT() {return  getRefTodGradFielddGradThermoField()[0][0];}
+  virtual const STensor3 &getConstRefTodgradTdgradfT() const {return getConstRefTodGradFielddGradEnergyConjugatedField()[0][0];}
+  virtual STensor3 &getRefTodgradTdgradfT() {return  getRefTodGradFielddGradEnergyConjugatedField()[0][0];}
 
-  virtual const STensor3 &getConstRefTodgradTdgradfV() const {return getConstRefTodGradFielddGradThermoField()[0][1];}
-  virtual STensor3 &getRefTodgradTdgradfV() {return  getRefTodGradFielddGradThermoField()[0][1];}
+  virtual const STensor3 &getConstRefTodgradTdgradfV() const {return getConstRefTodGradFielddGradEnergyConjugatedField()[0][1];}
+  virtual STensor3 &getRefTodgradTdgradfV() {return  getRefTodGradFielddGradEnergyConjugatedField()[0][1];}
 
-  virtual const double &getConstRefTodVdfV() const {return getConstRefTodFielddThermoField()[1][1];}
-  virtual double &getRefTodVdfV() {return  getRefTodFielddThermoField()[1][1];}
+  virtual const double &getConstRefTodVdfV() const {return getConstRefTodFielddEnergyConjugatedField()[1][1];}
+  virtual double &getRefTodVdfV() {return  getRefTodFielddEnergyConjugatedField()[1][1];}
 
-  virtual const double &getConstRefTodVdfT() const {return getConstRefTodFielddThermoField()[1][0];}
-  virtual double &getRefTodVdfT() {return  getRefTodFielddThermoField()[1][0];}
+  virtual const double &getConstRefTodVdfT() const {return getConstRefTodFielddEnergyConjugatedField()[1][0];}
+  virtual double &getRefTodVdfT() {return  getRefTodFielddEnergyConjugatedField()[1][0];}
 
-   virtual const double &getConstRefTodTdfT() const {return getConstRefTodFielddThermoField()[0][0];}
-  virtual double &getRefTodTdfT() {return  getRefTodFielddThermoField()[0][0];}
+   virtual const double &getConstRefTodTdfT() const {return getConstRefTodFielddEnergyConjugatedField()[0][0];}
+  virtual double &getRefTodTdfT() {return  getRefTodFielddEnergyConjugatedField()[0][0];}
 
-  virtual const double &getConstRefTodTdfV() const {return getConstRefTodFielddThermoField()[0][1];}
-  virtual double &getRefTodTdfV() {return  getRefTodFielddThermoField()[0][1];}
+  virtual const double &getConstRefTodTdfV() const {return getConstRefTodFielddEnergyConjugatedField()[0][1];}
+  virtual double &getRefTodTdfV() {return  getRefTodFielddEnergyConjugatedField()[0][1];}
 
-    virtual const SVector3  &getConstRefTodgradVdfV() const {return getConstRefTodGradFielddThermoField()[1][1];}
-  virtual SVector3  &getRefTodgradVdfV() {return  getRefTodGradFielddThermoField()[1][1];}
+    virtual const SVector3  &getConstRefTodgradVdfV() const {return getConstRefTodGradFielddEnergyConjugatedField()[1][1];}
+  virtual SVector3  &getRefTodgradVdfV() {return  getRefTodGradFielddEnergyConjugatedField()[1][1];}
 
-  virtual const SVector3  &getConstRefTodgradVdfT() const {return getConstRefTodGradFielddThermoField()[1][0];}
-  virtual SVector3  &getRefTodgradVdfT() {return  getRefTodGradFielddThermoField()[1][0];}
+  virtual const SVector3  &getConstRefTodgradVdfT() const {return getConstRefTodGradFielddEnergyConjugatedField()[1][0];}
+  virtual SVector3  &getRefTodgradVdfT() {return  getRefTodGradFielddEnergyConjugatedField()[1][0];}
 
-   virtual const SVector3  &getConstRefTodgradTdfT() const {return getConstRefTodGradFielddThermoField()[0][0];}
-  virtual SVector3  &getRefTodgradTdfT() {return  getRefTodGradFielddThermoField()[0][0];}
+   virtual const SVector3  &getConstRefTodgradTdfT() const {return getConstRefTodGradFielddEnergyConjugatedField()[0][0];}
+  virtual SVector3  &getRefTodgradTdfT() {return  getRefTodGradFielddEnergyConjugatedField()[0][0];}
 
-  virtual const SVector3  &getConstRefTodgradTdfV() const {return getConstRefTodGradFielddThermoField()[0][1];}
-  virtual SVector3  &getRefTodgradTdfV() {return  getRefTodGradFielddThermoField()[0][1];}
+  virtual const SVector3  &getConstRefTodgradTdfV() const {return getConstRefTodGradFielddEnergyConjugatedField()[0][1];}
+  virtual SVector3  &getRefTodgradTdfV() {return  getRefTodGradFielddEnergyConjugatedField()[0][1];}
 
    virtual const SVector3  &getConstRefToFluxEnergy() const {return getConstRefToFlux()[0];}
    virtual SVector3 &getRefToFluxEnergy(){return  getRefToFlux()[0];}
@@ -2427,7 +2471,7 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
    virtual const STensor33 &getConstRefTodFluxEnergydF() const {return getConstRefTodFluxdF()[0];}
    virtual STensor33 &getRefTodFluxEnergydF(){return  getRefTodFluxdF()[0];}
 
-   virtual const STensor3 *getConstRefToEnergyConductivity() const {return getConstRefToEnergyK()[0][0];}
+ /*  virtual const STensor3 *getConstRefToEnergyConductivity() const {return getConstRefToEnergyK()[0][0];}
    virtual void setRefToEnergyConductivity(const STensor3 &eT){return  setConstRefToEnergyK(eT,0,0);}
 
    virtual const STensor3 &getConstRefTodEnergyConductivitydT() const {return getConstRefTodEnergyKdField()[0][0][0];}
@@ -2437,13 +2481,31 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
    virtual STensor3 &getRefTodEnergyConductivitydV(){return getRefTodEnergyKdField()[0][0][1];}
 
    virtual const STensor43 &getConstRefTodEnergyConductivitydF() const {return getConstRefTodEnergyKdF()[0][0];}
-   virtual STensor43 &getRefTodEnergyConductivitydF(){return getRefTodEnergyKdF()[0][0];}
+   virtual STensor43 &getRefTodEnergyConductivitydF(){return getRefTodEnergyKdF()[0][0];}*/
 
-  virtual const STensor3 *getConstRefToStiff_alphaDilatation() const {return getConstRefToLinearSymmetrizationCoupling()[0];}
-  virtual void setRefToStiff_alphaDilatation(const STensor3 &eT) {setConstRefToLinearSymmetrizationCoupling(eT,0);}
+   virtual const STensor3 &getConstRefTodFluxEnergydGradVdT() const {return getConstRefTodFluxdGradFielddField()[0][1][0];}
+   virtual STensor3 &getRefTodFluxEnergydGradVdT(){return  getRefTodFluxdGradFielddField()[0][1][0];}
 
-  virtual IPVariable* clone() const =0;
-  virtual void restart();
+   virtual const STensor3 &getConstRefTodFluxEnergydGradVdV() const {return getConstRefTodFluxdGradFielddField()[0][1][1];}
+   virtual STensor3 &getRefTodFluxEnergydGradVdV(){return getRefTodFluxdGradFielddField()[0][1][1];}
+
+   virtual const STensor3 &getConstRefTodFluxEnergydGradTdT() const {return getConstRefTodFluxdGradFielddField()[0][0][0];}
+   virtual STensor3 &getRefTodFluxEnergydGradTdT(){return  getRefTodFluxdGradFielddField()[0][0][0];}
+
+   virtual const STensor3 &getConstRefTodFluxEnergydGradTdV() const {return getConstRefTodFluxdGradFielddField()[0][0][1];}
+   virtual STensor3 &getRefTodFluxEnergydGradTdV(){return getRefTodFluxdGradFielddField()[0][0][1];}
+
+   virtual const STensor43 &getConstRefTodFluxEnergydGradTdF() const {return getConstRefTodFluxdGradFielddF()[0][0];}
+   virtual STensor43 &getRefTodFluxEnergydGradTdF(){return getRefTodFluxdGradFielddF()[0][0];}
+
+   virtual const STensor43 &getConstRefTodFluxEnergydGradVdF() const {return getConstRefTodFluxdGradFielddF()[0][1];}
+   virtual STensor43 &getRefTodFluxEnergydGradVdF(){return getRefTodFluxdGradFielddF()[0][1];}
+
+   virtual const STensor3 *getConstRefToStiff_alphaDilatation() const {return getConstRefToLinearSymmetrizationCoupling()[0];}
+   virtual void setRefToStiff_alphaDilatation(const STensor3 &eT) {setConstRefToLinearSymmetrizationCoupling(eT,0);}
+
+   virtual IPVariable* clone() const =0;
+   virtual void restart();
 };
 
 
diff --git a/dG3D/src/dG3DMaterialLaw.cpp b/dG3D/src/dG3DMaterialLaw.cpp
index 4ad94bb03..48e70cf4d 100644
--- a/dG3D/src/dG3DMaterialLaw.cpp
+++ b/dG3D/src/dG3DMaterialLaw.cpp
@@ -2989,6 +2989,8 @@ void LinearElecTherMechDG3DMaterialLaw::stress(IPVariable* ipv, const IPVariable
 	STensor3& dl10dT = ipvcur->getRefTodElecConductivitydT();
 	STensor3& dl20dT = ipvcur->getRefTodCrossElecConductivitydT();
 	STensor3& dk10dv = ipvcur->getRefTodTherConductivitydv();
+	STensor3& dk20dv = ipvcur->getRefTodCrossTherConductivitydv();
+	STensor3& dl10dv = ipvcur->getRefTodElecConductivitydv();
 	STensor3& dl20dv = ipvcur->getRefTodCrossElecConductivitydv();
 	STensor43& dl10dF=ipvcur->getRefTodElecConductivitydF();
 	STensor43& dl20dF=ipvcur->getRefTodCrossElecConductivitydF();
@@ -3001,18 +3003,26 @@ void LinearElecTherMechDG3DMaterialLaw::stress(IPVariable* ipv, const IPVariable
 	SVector3 &djydT=ipvcur->getRefTodFluxEnergydT();
 	STensor3 &djydgradT=ipvcur->getRefTodFluxEnergydGradT();
         STensor33 &djydF=ipvcur->getRefTodFluxEnergydF();
-        ipvcur->setRefToEnergyConductivity(this->jy1);
+
+        /*ipvcur->setRefToEnergyConductivity(this->jy1);
 	STensor3 &djy1dT= ipvcur->getRefTodEnergyConductivitydT();
 	STensor3 &djy1dV= ipvcur->getRefTodEnergyConductivitydV();
-	STensor43 &djy1dF=ipvcur->getRefTodEnergyConductivitydF();
+	STensor43 &djy1dF=ipvcur->getRefTodEnergyConductivitydF();*/
+
+	STensor3 &djydgradVdT= ipvcur->getRefTodFluxEnergydGradVdT();
+	STensor3 &djydgradVdV= ipvcur->getRefTodFluxEnergydGradVdV();
+	STensor43 &djydgradVdF=ipvcur->getRefTodFluxEnergydGradVdF();
+	STensor3 &djydgradTdT= ipvcur->getRefTodFluxEnergydGradTdT();
+	STensor3 &djydgradTdV= ipvcur->getRefTodFluxEnergydGradTdV();
+	STensor43 &djydgradTdF=ipvcur->getRefTodFluxEnergydGradTdF();
 
   /* data for J2 law */
   IPLinearElecTherMech* q1 = ipvcur->getIPLinearElecTherMech();
   const IPLinearElecTherMech* q0 = ipvprev->getIPLinearElecTherMech();
 
 _lawLinearETM->constitutive(  F0,Fn,P, q0, q1, Tangent,T0, temperature, voltage,gradT, gradV, fluxT,fluxV, dPdT,dPdV, dqdgradT,dqdT, dqdgradV,dqdV,
-			      dedV,dedgradV,dedT,dedgradT,dqdF,dedF,w,dwdt,dwdf,linearl10,linearl20,lineark10,lineark20,dl10dT,dl20dT,dk10dT,dk20dT,dl20dv,dk10dv,dl10dF,dl20dF,dk10dF,dk20dF
-			      ,fluxjy,djydV,djydgradV,djydT,djydgradT,djydF,jy1,djy1dT,djy1dV,djy1dF,stiff);
+			      dedV,dedgradV,dedT,dedgradT,dqdF,dedF,w,dwdt,dwdf,linearl10,linearl20,lineark10,lineark20,dl10dT,dl20dT,dk10dT,dk20dT,dl10dv,dl20dv,dk10dv,dk20dv,dl10dF,dl20dF,dk10dF,dk20dF
+			      ,fluxjy,djydV,djydgradV,djydT,djydgradT,djydF,djydgradVdT,djydgradVdV,djydgradVdF,djydgradTdT,djydgradTdV,djydgradTdF,stiff);
 
 
  ipvcur->setRefToDGElasticTangentModuli(this->elasticStiffness);
@@ -3151,7 +3161,9 @@ void mlawAnIsotropicElecTherMechDG3DMaterialLaw::stress(IPVariable* ipv, const I
 	STensor3& dl10dT = ipvcur->getRefTodElecConductivitydT();
 	STensor3& dl20dT = ipvcur->getRefTodCrossElecConductivitydT();
 	STensor3& dk10dv = ipvcur->getRefTodTherConductivitydv();
-	STensor3& dl20dv= ipvcur->getRefTodCrossElecConductivitydv();
+	STensor3& dk20dv = ipvcur->getRefTodCrossTherConductivitydv();
+	STensor3& dl10dv = ipvcur->getRefTodElecConductivitydv();
+	STensor3& dl20dv = ipvcur->getRefTodCrossElecConductivitydv();
 	STensor43& dl10dF=ipvcur->getRefTodElecConductivitydF();
 	STensor43& dl20dF=ipvcur->getRefTodCrossElecConductivitydF();
 	STensor43& dk10dF=ipvcur->getRefTodTherConductivitydF();
@@ -3163,10 +3175,18 @@ void mlawAnIsotropicElecTherMechDG3DMaterialLaw::stress(IPVariable* ipv, const I
 	SVector3 &djydT=ipvcur->getRefTodFluxEnergydT();
 	STensor3 &djydgradT=ipvcur->getRefTodFluxEnergydGradT();
         STensor33 &djydF=ipvcur->getRefTodFluxEnergydF();
-	ipvcur->setRefToEnergyConductivity(this->jy1);
+
+	/*ipvcur->setRefToEnergyConductivity(this->jy1);
 	STensor3 &djy1dT= ipvcur->getRefTodEnergyConductivitydT();
 	STensor3 &djy1dV= ipvcur->getRefTodEnergyConductivitydV();
-	STensor43 &djy1dF=ipvcur->getRefTodEnergyConductivitydF();
+	STensor43 &djy1dF=ipvcur->getRefTodEnergyConductivitydF();*/
+
+	STensor3 &djydgradVdT= ipvcur->getRefTodFluxEnergydGradVdT();
+	STensor3 &djydgradVdV= ipvcur->getRefTodFluxEnergydGradVdV();
+	STensor43 &djydgradVdF=ipvcur->getRefTodFluxEnergydGradVdF();
+	STensor3 &djydgradTdT= ipvcur->getRefTodFluxEnergydGradTdT();
+	STensor3 &djydgradTdV= ipvcur->getRefTodFluxEnergydGradTdV();
+	STensor43 &djydgradTdF=ipvcur->getRefTodFluxEnergydGradTdF();
 
 
 
@@ -3174,8 +3194,8 @@ void mlawAnIsotropicElecTherMechDG3DMaterialLaw::stress(IPVariable* ipv, const I
   const IPAnIsotropicElecTherMech* q0 = ipvprev->getIPAnIsotropicElecTherMech();
 
 _lawETM->constitutive(  F0,Fn,P, q0, q1, Tangent, T0, temperature, voltage,gradT, gradV, fluxT,fluxV, dPdT,dPdV, dqdgradT,dqdT, dqdgradV,dqdV,
-	                djedV,djedgradV,djedT,djedgradT,dqdF,djedF,w,dwdT,dwdf,Lref10,Lref20,Kref10,Kref20,dl10dT,dl20dT,dk10dT,dk20dT,
-			dl20dv,dk10dv,dl10dF,dl20dF,dk10dF,dk20dF,fluxjy,djydV,djydgradV,djydT,djydgradT,djydF,jy1,djy1dT,djy1dV,djy1dF,stiff);
+	                djedV,djedgradV,djedT,djedgradT,dqdF,djedF,w,dwdT,dwdf,Lref10,Lref20,Kref10,Kref20,dl10dT,dl20dT,dk10dT,dk20dT,dl10dv,dl20dv,dk10dv,dk20dv,dl10dF,dl20dF,dk10dF,dk20dF
+			      ,fluxjy,djydV,djydgradV,djydT,djydgradT,djydF,djydgradVdT,djydgradVdV,djydgradVdF,djydgradTdT,djydgradTdV,djydgradTdF,stiff);
 
 
  ipvcur->setRefToDGElasticTangentModuli(this->elasticStiffness);
@@ -3330,22 +3350,32 @@ void mlawElecSMPDG3DMaterialLaw::stress(IPVariable* ipv, const IPVariable* ipvp,
 	STensor3& dl10dT = ipvcur->getRefTodElecConductivitydT();
 	STensor3& dl20dT = ipvcur->getRefTodCrossElecConductivitydT();
 	STensor3& dk10dv = ipvcur->getRefTodTherConductivitydv();
+	STensor3& dk20dv = ipvcur->getRefTodCrossTherConductivitydv();
+	STensor3& dl10dv = ipvcur->getRefTodElecConductivitydv();
 	STensor3& dl20dv = ipvcur->getRefTodCrossElecConductivitydv();
-	STensor43& dl10dF= ipvcur->getRefTodElecConductivitydF();
-	STensor43& dl20dF= ipvcur->getRefTodCrossElecConductivitydF();
-	STensor43& dk10dF= ipvcur->getRefTodTherConductivitydF();
-	STensor43& dk20dF= ipvcur->getRefTodCrossTherConductivitydF();
-
+	STensor43& dl10dF=ipvcur->getRefTodElecConductivitydF();
+	STensor43& dl20dF=ipvcur->getRefTodCrossElecConductivitydF();
+	STensor43& dk10dF=ipvcur->getRefTodTherConductivitydF();
+	STensor43& dk20dF=ipvcur->getRefTodCrossTherConductivitydF();
 	SVector3 &fluxjy   = ipvcur->getRefToFluxEnergy();
 	SVector3 &djydV    = ipvcur->getRefTodFluxEnergydV();
 	STensor3 &djydgradV= ipvcur->getRefTodFluxEnergydGradV();
 	SVector3 &djydT    = ipvcur->getRefTodFluxEnergydT();
 	STensor3 &djydgradT= ipvcur->getRefTodFluxEnergydGradT();
         STensor33 &djydF   = ipvcur->getRefTodFluxEnergydF();
-	ipvcur->setRefToEnergyConductivity(this->jy1);
+
+	/*ipvcur->setRefToEnergyConductivity(this->jy1);
 	STensor3 &djy1dT   = ipvcur->getRefTodEnergyConductivitydT();
 	STensor3 &djy1dV   = ipvcur->getRefTodEnergyConductivitydV();
-	STensor43 &djy1dF  = ipvcur->getRefTodEnergyConductivitydF();
+	STensor43 &djy1dF  = ipvcur->getRefTodEnergyConductivitydF();*/
+
+
+	STensor3 &djydgradVdT= ipvcur->getRefTodFluxEnergydGradVdT();
+	STensor3 &djydgradVdV= ipvcur->getRefTodFluxEnergydGradVdV();
+	STensor43 &djydgradVdF=ipvcur->getRefTodFluxEnergydGradVdF();
+	STensor3 &djydgradTdT= ipvcur->getRefTodFluxEnergydGradTdT();
+	STensor3 &djydgradTdV= ipvcur->getRefTodFluxEnergydGradTdV();
+	STensor43 &djydgradTdF=ipvcur->getRefTodFluxEnergydGradTdF();
 
 
  /* IPElecSMP* q1 = ipvcur->getIPElecSMP();
@@ -3355,8 +3385,8 @@ void mlawElecSMPDG3DMaterialLaw::stress(IPVariable* ipv, const IPVariable* ipvp,
   const IPElecSMP* q0 = ipvprev->getIPElecSMP();
 
   _lawETMSMP->constitutive(  F0,Fn,P, q0, q1, Tangent, T0, temperature, voltage,gradT, gradV, fluxT,fluxV, dPdT,dPdV, dqdgradT,dqdT, dqdgradV,dqdV,
-			      dedV,dedgradV,dedT,dedgradT,dqdF,dedF,w,dwdT,dwdf,L10,L20,K10,K20,dl10dT,dl20dT,dk10dT,dk20dT
-			      ,dl20dv,dk10dv,dl10dF,dl20dF,dk10dF,dk20dF,fluxjy,djydV,djydgradV,djydT,djydgradT,djydF,jy1,djy1dT,djy1dV,djy1dF,stiff);
+			      dedV,dedgradV,dedT,dedgradT,dqdF,dedF,w,dwdT,dwdf,L10,L20,K10,K20,dl10dT,dl20dT,dk10dT,dk20dT,dl10dv,dl20dv,dk10dv,dk20dv,dl10dF,dl20dF,dk10dF,dk20dF
+			      ,fluxjy,djydV,djydgradV,djydT,djydgradT,djydF,djydgradVdT,djydgradVdV,djydgradVdF,djydgradTdT,djydgradTdV,djydgradTdF,stiff);
 
 
 
diff --git a/dG3D/src/dG3DTerms.cpp b/dG3D/src/dG3DTerms.cpp
index fb9e0beba..c7fbbd9bc 100644
--- a/dG3D/src/dG3DTerms.cpp
+++ b/dG3D/src/dG3DTerms.cpp
@@ -117,31 +117,33 @@ void dG3DForceBulk::get(MElement *ele,int npts,IntPt *GP,fullVector<double> &vFo
       }
     }
     //extra dof
-
-    if( vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()==getNumConstitutiveExtraDofDiffusionVariable() ){ //to remove after migration
+//    if( vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()==getNumConstitutiveExtraDofDiffusionVariable() ){ //to remove after migration
     if( vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ){
-          Msg::Fatal("Your material law uses more constitutive extra dof variables than your domain dG3DForceBulk::get");}
+         Msg::Fatal("Your material law uses more constitutive extra dof variables than your domain dG3DForceBulk::get");}
     for (int extraDOFField = 0; extraDOFField< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField++){
-      const SVector3 &flux =vipv[i]-> getConstRefToFlux()[extraDOFField];
+      const SVector3 &flux =   vipv[i]-> getConstRefToFlux()[extraDOFField];
       double w = 0.;
       if (getConstitutiveExtraDofDiffusionAccountFieldSource()){
          w += vipv[i]->getConstRefToFieldSource()(extraDOFField);
-      }
+        }
       if (getConstitutiveExtraDofDiffusionAccountMecaSource()){
          w += vipv[i]->getConstRefToMechanicalSource()(extraDOFField);
       }
       int indexField=3+getNumNonLocalVariable()+extraDOFField;
+
       for(int j=0;j<nbFF; j++)
       {
         for(int m=0; m<3; m++)
         {
           vFor(j+indexField*nbFF) += getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*flux(m));
         }
-        vFor(j+indexField*nbFF) += getConstitutiveExtraDofDiffusionEqRatio()*ratio*(w*Vals[j+indexField*nbFF]);// related to cp
+        if(extraDOFField==0){
+                           vFor(j+indexField*nbFF) += getConstitutiveExtraDofDiffusionEqRatio()*ratio*(w*Vals[j+indexField*nbFF]);// related to cp
+                            }
       }
     }
   }
-  }//to remove after migration
+//  }//to remove after migration
   //vFor.print("bulkF");
 }
 
@@ -276,7 +278,7 @@ void dG3DStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
         }
       }
       if( vipv[i]->getNumberNonLocalVariable()>getNumNonLocalVariable() )  Msg::Fatal("Your material law uses more non local variables than your domain dG3DStiffnessBulk::get");
-    if( vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()==getNumConstitutiveExtraDofDiffusionVariable() ){ //to remove after migration
+     // if( vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()==getNumConstitutiveExtraDofDiffusionVariable() ){ //to remove after migration
       if( vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
             Msg::Fatal("Your material law uses more constitutive extra dof variables than your domain dG3DStiffnessBulk::get");
 			
@@ -346,7 +348,59 @@ void dG3DStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
           }
         }
       }
+  if(!getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()){
       for (int extraDOFField = 0; extraDOFField< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField++){
+
+        const STensor33 &dFluxdF         = vipv[i]->getConstRefTodFluxdF()[extraDOFField]; //in reference conf
+        const STensor3  &dPdField        = vipv[i]->getConstRefTodPdField()[extraDOFField];
+        static STensor3 dwdf;
+        STensorOperation::zero(dwdf);
+
+        if (getConstitutiveExtraDofDiffusionAccountFieldSource()){
+          if(extraDOFField==0){
+          dwdf += vipv[i]->getConstRefTodFieldSourcedF()[extraDOFField];
+           }
+        }
+        if (getConstitutiveExtraDofDiffusionAccountMecaSource()){
+          if(extraDOFField==0){
+          dwdf += vipv[i]->getConstRefTodMechanicalSourcedF()[extraDOFField];
+          }
+        }
+        for(int j=0;j<nbFF; j++){
+          for(int k=0;k<nbFF;k++){
+            int indexField=3+getNumNonLocalVariable()+extraDOFField;
+
+ // F-related terms
+            for(int kk=0;kk<3;kk++)
+            {
+              if((ele->getTypeForMSH() == MSH_HEX_8 or ele->getTypeForMSH() == MSH_QUA_4  or
+      ele->getTypeForMSH() == MSH_TET_4 or ele->getTypeForMSH() == MSH_TRI_3 or ele->getTypeForMSH() == MSH_PRI_6) and !_fullDg)
+              {
+                for(int m=0; m<3; m++)
+                {
+                  mStiff(j+kk*nbFF,k+indexField*nbFF) += ratio*(Grads[j+kk*nbFF][m]*dPdField.operator()(kk,m)*Vals[k+indexField*nbFF]);
+
+                }
+                mStiff(j+kk*nbFF,k+indexField*nbFF) -= ratio*(Grads[j+kk*nbFF][kk]*(dPdField.operator()(0,0)+dPdField.operator()(1,1)+dPdField.operator()(2,2))*Vals[k+indexField*nbFF])/3.;
+                mStiff(j+kk*nbFF,k+indexField*nbFF) += ratio*(Grads[j+kk*nbFF][kk]*dPdFieldVaverage[extraDOFField][k]);
+              }
+              else
+              {
+                for(int m=0; m<3; m++)
+                  mStiff(j+kk*nbFF,k+indexField*nbFF) += ratio*(Grads[j+kk*nbFF][m]*dPdField.operator()(kk,m)*Vals[k+indexField*nbFF]);
+              }
+              for(int m=0; m<3; m++)
+              {
+                for(int n=0; n<3; n++)
+                {
+                  mStiff(j+indexField*nbFF,k+kk*nbFF) += getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*dFluxdF.operator()(m,kk,n)*Grads[k][n]);
+                }
+              if(extraDOFField==0) mStiff(j+indexField*nbFF,k+kk*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[k][m]*dwdf.operator()(kk,m)*Vals[j+indexField*nbFF]); // related to cp
+              }
+            }
+	   }
+          }
+	for (int extraDOFField2 = 0; extraDOFField2< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField2++){
         static bool msg=false;
         if(getNumConstitutiveExtraDofDiffusionVariable()>1)
         {
@@ -356,39 +410,182 @@ void dG3DStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
             msg=true;
           }
         }
-        int extraDOFField2=extraDOFField;
+        //int extraDOFField2=extraDOFField;
         const STensor3  &dFluxdGradField = vipv[i]->getConstRefTodFluxdGradField()[extraDOFField][extraDOFField2]; //in reference conf
         const SVector3  &dFluxdField     = vipv[i]->getConstRefTodFluxdField()[extraDOFField][extraDOFField2]; //in reference conf
-        const STensor33 &dFluxdF         = vipv[i]->getConstRefTodFluxdF()[extraDOFField]; //in reference conf
-        const STensor3  &dPdField        = vipv[i]->getConstRefTodPdField()[extraDOFField];
 
         double dwdt = 0.;
+        if (getConstitutiveExtraDofDiffusionAccountFieldSource()){
+          if(extraDOFField==0 && extraDOFField2==0){
+          dwdt += vipv[i]->getConstRefTodFieldSourcedField()(extraDOFField,extraDOFField2);
+           }
+        }
+        if (getConstitutiveExtraDofDiffusionAccountMecaSource()){
+          if(extraDOFField==0 && extraDOFField2==0){
+          dwdt += vipv[i]->getConstRefTodMechanicalSourcedField()(extraDOFField,extraDOFField2);
+          }
+        }
+        for(int j=0;j<nbFF; j++){
+          for(int k=0;k<nbFF;k++){
+            int indexField=3+getNumNonLocalVariable()+extraDOFField;
+            int indexField2=3+getNumNonLocalVariable()+extraDOFField2;
+
+            // Pure & Cross Terms
+            for(int m=0; m<3; m++)
+            {
+              mStiff(j+indexField*nbFF,k+indexField2*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*dFluxdField.operator()(m)*Vals[k+indexField2*nbFF]);
+              for(int n=0; n<3; n++)
+              {
+                mStiff(j+indexField*nbFF,k+indexField2*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*dFluxdGradField.operator()(m,n)*Grads[k+indexField2*nbFF][n]);
+              }
+            }
+         
+            if(extraDOFField==0 && extraDOFField2==0) mStiff(j+indexField*nbFF,k+indexField*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*dwdt*Vals[j+indexField*nbFF]*Vals[k+indexField*nbFF];// related to cp
+          }
+        }
+      }
+     }
+    }
+
+ if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()){
+      for (int extraDOFField = 0; extraDOFField< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField++){
+
+        const STensor33 &dFluxdF         = vipv[i]->getConstRefTodFluxdF()[extraDOFField]; //in reference conf
+        const STensor3  &dPdField1       = vipv[i]->getConstRefTodPdField()[extraDOFField];
+
+        int extraDOFField_aux=0;
+        if((extraDOFField+1)< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()) extraDOFField_aux=extraDOFField+1;
+        else extraDOFField_aux=extraDOFField-1;        
+
+        const STensor3  &dPdField2       = vipv[i]->getConstRefTodPdField()[extraDOFField_aux];
+
+        double          dFielddEnergyConjugatedField1            = vipv[i]->getConstRefTodFielddEnergyConjugatedField()[extraDOFField][extraDOFField];
+        double          dFielddEnergyConjugatedField2            = vipv[i]->getConstRefTodFielddEnergyConjugatedField()[extraDOFField_aux][extraDOFField];
+
         static STensor3 dwdf;
         STensorOperation::zero(dwdf);
+
         if (getConstitutiveExtraDofDiffusionAccountFieldSource()){
-          dwdt += vipv[i]->getConstRefTodFieldSourcedField()(extraDOFField,extraDOFField2);
+          if(extraDOFField==0){
           dwdf += vipv[i]->getConstRefTodFieldSourcedF()[extraDOFField];
+           }
         }
         if (getConstitutiveExtraDofDiffusionAccountMecaSource()){
-          dwdt += vipv[i]->getConstRefTodMechanicalSourcedField()(extraDOFField,extraDOFField2);
+          if(extraDOFField==0){
           dwdf += vipv[i]->getConstRefTodMechanicalSourcedF()[extraDOFField];
+          }
         }
         for(int j=0;j<nbFF; j++){
           for(int k=0;k<nbFF;k++){
             int indexField=3+getNumNonLocalVariable()+extraDOFField;
 
-            // pure thermal
+ // F-related terms
+            for(int kk=0;kk<3;kk++)
+            {
+              for(int m=0; m<3; m++){
+                  mStiff(j+kk*nbFF,k+indexField*nbFF) += ratio*(Grads[j+kk*nbFF][m]*(dPdField1.operator()(kk,m)*dFielddEnergyConjugatedField1+dPdField2.operator()(kk,m)*dFielddEnergyConjugatedField2)*Vals[k+indexField*nbFF]);
+                for(int n=0; n<3; n++)
+                  {
+                  mStiff(j+indexField*nbFF,k+kk*nbFF) += getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*dFluxdF.operator()(m,kk,n)*Grads[k][n]);
+                  }
+              if(extraDOFField==0) mStiff(j+indexField*nbFF,k+kk*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[k][m]*dwdf.operator()(kk,m)*Vals[j+indexField*nbFF]); // related to cp
+              }
+            }
+	   }
+          }
+	for (int extraDOFField2 = 0; extraDOFField2< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField2++){
+        static bool msg=false;
+        if(getNumConstitutiveExtraDofDiffusionVariable()>1)
+        {
+          if(!msg)
+          {
+            Msg::Info("we assume no cross dependency between the extra dof sources domain dG3DStiffnessBulk::get");
+            msg=true;
+          }
+        }
+        //int extraDOFField2=extraDOFField;
+        const STensor3  &dFluxdGradField1                         = vipv[i]->getConstRefTodFluxdGradField()[extraDOFField][extraDOFField2]; //in reference conf
+        const SVector3  &dFluxdField1                             = vipv[i]->getConstRefTodFluxdField()[extraDOFField][extraDOFField2]; //in reference conf
+
+        int extraDOFField_aux=0;
+        if((extraDOFField2+1)< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()) extraDOFField_aux=extraDOFField2+1;
+        else extraDOFField_aux=extraDOFField2-1;        
+
+        const STensor3  &dFluxdGradField2                         = vipv[i]->getConstRefTodFluxdGradField()[extraDOFField][extraDOFField_aux]; //in reference conf
+        const SVector3  &dFluxdField2                             = vipv[i]->getConstRefTodFluxdField()[extraDOFField][extraDOFField_aux]; //in reference conf
+
+        const STensor3  &dGradFielddGradEnergyConjugatedField1    = vipv[i]->getConstRefTodGradFielddGradEnergyConjugatedField()[extraDOFField2][extraDOFField2];
+        const SVector3  &dGradFielddEnergyConjugatedField1        = vipv[i]->getConstRefTodGradFielddEnergyConjugatedField()[extraDOFField2][extraDOFField2];
+        double          dFielddEnergyConjugatedField1            = vipv[i]->getConstRefTodFielddEnergyConjugatedField()[extraDOFField2][extraDOFField2];
+      
+        const STensor3  &dGradFielddGradEnergyConjugatedField2    = vipv[i]->getConstRefTodGradFielddGradEnergyConjugatedField()[extraDOFField_aux][extraDOFField2];
+        const SVector3  &dGradFielddEnergyConjugatedField2        = vipv[i]->getConstRefTodGradFielddEnergyConjugatedField()[extraDOFField_aux][extraDOFField2];
+        double          dFielddEnergyConjugatedField2            = vipv[i]->getConstRefTodFielddEnergyConjugatedField()[extraDOFField_aux][extraDOFField2];
+
+        double dwdt = 0.;
+        if (getConstitutiveExtraDofDiffusionAccountFieldSource()){
+          if(extraDOFField==0 && extraDOFField2==0){
+          dwdt += vipv[i]->getConstRefTodFieldSourcedField()(extraDOFField,extraDOFField2);
+           }
+        }
+        if (getConstitutiveExtraDofDiffusionAccountMecaSource()){
+          if(extraDOFField==0 && extraDOFField2==0){
+          dwdt += vipv[i]->getConstRefTodMechanicalSourcedField()(extraDOFField,extraDOFField2);
+          }
+        }
+        for(int j=0;j<nbFF; j++){
+          for(int k=0;k<nbFF;k++){
+            int indexField=3+getNumNonLocalVariable()+extraDOFField;
+            int indexField2=3+getNumNonLocalVariable()+extraDOFField2;
+
+            // Pure & Cross Terms
             for(int m=0; m<3; m++)
             {
-              mStiff(j+indexField*nbFF,k+indexField*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*dFluxdField.operator()(m)*Vals[k+indexField*nbFF]);
-              for(int n=0; n<3; n++)
+              mStiff(j+indexField*nbFF,k+indexField2*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*(dFluxdField1.operator()(m)*dFielddEnergyConjugatedField1+dFluxdField2.operator()(m)*dFielddEnergyConjugatedField2)*Vals[k+indexField2*nbFF]);
+
+               for(int n=0; n<3; n++)
               {
-                mStiff(j+indexField*nbFF,k+indexField*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*dFluxdGradField.operator()(m,n)*Grads[k+indexField*nbFF][n]);
+                mStiff(j+indexField*nbFF,k+indexField2*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*(dFluxdGradField1.operator()(m,n)*dGradFielddEnergyConjugatedField1.operator()(n)+dFluxdGradField2.operator()(m,n)*dGradFielddEnergyConjugatedField2.operator()(n))*Vals[k+indexField2*nbFF]);
+             
+              	for(int p=0; p<3; p++)
+              	{
+                 mStiff(j+indexField*nbFF,k+indexField2*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*(dFluxdGradField1.operator()(m,p)*dGradFielddGradEnergyConjugatedField1.operator()(p,n)+dFluxdGradField2.operator()(m,p)*dGradFielddGradEnergyConjugatedField2.operator()(p,n))*Grads[k+indexField2*nbFF][n]);
+             	}
               }
             }
-            mStiff(j+indexField*nbFF,k+indexField*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*dwdt*Vals[j+indexField*nbFF]*Vals[k+indexField*nbFF];// related to cp
+         
+            if(extraDOFField==0 && extraDOFField2==0) mStiff(j+indexField*nbFF,k+indexField*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*dwdt*dFielddEnergyConjugatedField1*Vals[j+indexField*nbFF]*Vals[k+indexField*nbFF];// related to cp
+          }
+        }
+      }
+     }
+    }
 
-            // cross terms
+      for (int extraDOFField = 0; extraDOFField< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField++){
+    	for (int nlk = 0; nlk < vipv[i]->getNumberNonLocalVariable(); nlk++){
+          //Msg::Error("Check extra dof / non-local coupling in dG3DStiffnessBulk::get");
+          const SVector3 &dFluxdNonLocalVariable = vipv[i]->getConstRefTodFluxdNonLocalVariable()[extraDOFField][nlk];
+          double dwdNonLocalVariable   = 0.;  
+          if (getConstitutiveExtraDofDiffusionAccountFieldSource()){
+            dwdNonLocalVariable += vipv[i]->getConstRefTodFieldSourcedNonLocalVariable()(extraDOFField,nlk);
+          }
+          if (getConstitutiveExtraDofDiffusionAccountMecaSource()){
+            dwdNonLocalVariable += vipv[i]->getConstRefTodMechanicalSourcedNonLocalVariable()(extraDOFField,nlk);
+          }
+          for(int j=0;j<nbFF; j++){
+            for(int k=0;k<nbFF;k++){
+              int indexField=3+getNumNonLocalVariable()+extraDOFField;
+              int indexNL=3+nlk;
+              for(int m=0; m<3; m++)
+              {
+                mStiff(j+indexField*nbFF,k+indexNL*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*dFluxdNonLocalVariable.operator()(m)*Vals[k+indexNL*nbFF]);
+              }
+              mStiff(j+indexField*nbFF,k+indexNL*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*dwdNonLocalVariable*Vals[j+indexField*nbFF]*Vals[k+indexNL*nbFF];
+            }
+          }
+        }
+       }
+         /*   // F-related terms
             for(int kk=0;kk<3;kk++)
             {
               if((ele->getTypeForMSH() == MSH_HEX_8 or ele->getTypeForMSH() == MSH_QUA_4  or
@@ -415,10 +612,8 @@ void dG3DStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
                 }
                 mStiff(j+indexField*nbFF,k+kk*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[k][m]*dwdf.operator()(kk,m)*Vals[j+indexField*nbFF]); // related to cp
               }
-            }
-          }
-        }
-        for (int nlk = 0; nlk < vipv[i]->getNumberNonLocalVariable(); nlk++){
+            }*/
+       /* for (int nlk = 0; nlk < vipv[i]->getNumberNonLocalVariable(); nlk++){
           //Msg::Error("Check extra dof / non-local coupling in dG3DStiffnessBulk::get");
           const SVector3 &dFluxdNonLocalVariable = vipv[i]->getConstRefTodFluxdNonLocalVariable()[extraDOFField][nlk];
           double dwdNonLocalVariable   = 0.;  
@@ -439,11 +634,10 @@ void dG3DStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
               mStiff(j+indexField*nbFF,k+indexNL*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*dwdNonLocalVariable*Vals[j+indexField*nbFF]*Vals[k+indexNL*nbFF];
             }
           }
-        }
-      }
+        }*/
     }
   //mStiff.print("bulk");
-  }//to remove after migration
+ // }//to remove after migration
   }
   else
     printf("not implemented\n");
@@ -477,7 +671,7 @@ void dG3DElasticStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<d
       for (int ipg = 0; ipg < npts; ipg++)
       {
         const std::vector<TensorialTraits<double>::GradType>& Gradsipg = vipv[ipg]->gradf(&space1,ele,GP[ipg]);
-        const STensor43 *Hipg =&vipv[ipg]->getConstRefToElasticTangentModuli();
+        const STensor43 *Hipg =&vipv[ipg]->getConstRefToTangentModuli();
         for(int k=0;k<nbFF;k++){
           SVector3 HBaverageTmp;
           STensorOperation::zero(HBaverageTmp);
@@ -533,7 +727,7 @@ void dG3DElasticStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<d
       double& detJ = vipv[i]->getJacobianDeterminant(ele,GP[i]);
       double ratio = detJ*weight;
       // x, y, z
-      const STensor43 *H =&vipv[i]->getConstRefToElasticTangentModuli();
+      const STensor43 *H =&vipv[i]->getConstRefToTangentModuli();
       const std::vector<TensorialTraits<double>::GradType> &Grads = vipv[i]->gradf(&space1,ele,GP[i]);
       const std::vector<TensorialTraits<double>::ValType> &Vals = vipv[i]->f(&space1,ele,GP[i]);
       const int threeTimesNbFF = 3*nbFF;
@@ -580,6 +774,7 @@ void dG3DElasticStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<d
         }
       }
       if( vipv[i]->getNumberNonLocalVariable()>getNumNonLocalVariable() )  Msg::Fatal("Your material law uses more non local variables than your domain dG3DStiffnessBulk::get");
+     // if( vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()==getNumConstitutiveExtraDofDiffusionVariable() ){ //to remove after migration
       if( vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
             Msg::Fatal("Your material law uses more constitutive extra dof variables than your domain dG3DStiffnessBulk::get");
 			
@@ -587,7 +782,7 @@ void dG3DElasticStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<d
         //const STensor3  *dpds = &vipv[i]->getConstRefToDLocalVariableDStrain()[nlk];
         //const STensor3  *dsdp = &vipv[i]->getConstRefToDStressDNonLocalVariable()[nlk];
         const STensor3    *cg = &vipv[i]->getConstRefToCharacteristicLengthMatrix(nlk);           // by Wu Ling
-        double  SpBar = vipv[i]->getConstRefToDLocalVariableDNonLocalVariable()(nlk,nlk);
+        
 
         for(int j=0;j<nbFF; j++){
           for(int k=0;k<nbFF;k++){
@@ -599,7 +794,7 @@ void dG3DElasticStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<d
               }
             }
             mStiff(j+nlk*nbFF+threeTimesNbFF,k+nlk*nbFF+threeTimesNbFF)
-                    += getNonLocalEqRatio()*ratio*(Vals[j+nlk*nbFF+threeTimesNbFF]*Vals[k+nlk*nbFF+threeTimesNbFF]*(1-SpBar)+ BtB);
+                    += getNonLocalEqRatio()*ratio*(Vals[j+nlk*nbFF+threeTimesNbFF]*Vals[k+nlk*nbFF+threeTimesNbFF]+ BtB);
 
             // cross terms to check
             for(int kk=0;kk<3;kk++)
@@ -607,25 +802,35 @@ void dG3DElasticStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<d
               if((ele->getTypeForMSH() == MSH_HEX_8 or ele->getTypeForMSH() == MSH_QUA_4  or
       ele->getTypeForMSH() == MSH_TET_4 or ele->getTypeForMSH() == MSH_TRI_3 or ele->getTypeForMSH() == MSH_PRI_6) and !_fullDg)
               {
-              //  for(int m=0; m<3; m++)
-              //  {
-              //    mStiff(j+kk*nbFF,k+nlk*nbFF+threeTimesNbFF) += ratio*(Grads[j+kk*nbFF](m)*dsdp->operator()(kk,m)*Vals[k+nlk*nbFF+threeTimesNbFF]); 
-              //  }
-              //  mStiff(j+kk*nbFF,k+nlk*nbFF+threeTimesNbFF) -= ratio*(Grads[j+kk*nbFF][kk]*(dsdp->operator()(0,0)+dsdp->operator()(1,1)+dsdp->operator()(2,2))*Vals[k+nlk*nbFF+threeTimesNbFF])/3.;
-              //  mStiff(j+kk*nbFF,k+nlk*nbFF+threeTimesNbFF) += ratio*(Grads[j+kk*nbFF][kk]*dPdNonLocalVaverage[nlk][k]);
+      //          for(int m=0; m<3; m++)
+      //          {
+      //            mStiff(j+kk*nbFF,k+nlk*nbFF+threeTimesNbFF) += ratio*(Grads[j+kk*nbFF](m)*dsdp->operator()(kk,m)*Vals[k+nlk*nbFF+threeTimesNbFF]); 
+      //          }
+      //          mStiff(j+kk*nbFF,k+nlk*nbFF+threeTimesNbFF) -= ratio*(Grads[j+kk*nbFF][kk]*(dsdp->operator()(0,0)+dsdp->operator()(1,1)+dsdp->operator()(2,2))*Vals[k+nlk*nbFF+threeTimesNbFF])/3.;
+      //          mStiff(j+kk*nbFF,k+nlk*nbFF+threeTimesNbFF) += ratio*(Grads[j+kk*nbFF][kk]*dPdNonLocalVaverage[nlk][k]);
               }
               else
               {
-               // for(int m=0; m<3; m++)
-               //   mStiff(j+kk*nbFF,k+nlk*nbFF+threeTimesNbFF) += ratio*(Grads[j+kk*nbFF](m)*dsdp->operator()(kk,m)*Vals[k+nlk*nbFF+threeTimesNbFF]);
+      //          for(int m=0; m<3; m++)
+      //            mStiff(j+kk*nbFF,k+nlk*nbFF+threeTimesNbFF) += ratio*(Grads[j+kk*nbFF](m)*dsdp->operator()(kk,m)*Vals[k+nlk*nbFF+threeTimesNbFF]);
               }
               for(int m=0; m<3; m++)
               {
-               // mStiff(j+nlk*nbFF+threeTimesNbFF,k+kk*nbFF) -= getNonLocalEqRatio()*ratio*(Vals[j+nlk*nbFF+threeTimesNbFF]*dpds->operator()(kk,m)*Grads[k+kk*nbFF](m));
+      //          mStiff(j+nlk*nbFF+threeTimesNbFF,k+kk*nbFF) -= getNonLocalEqRatio()*ratio*(Vals[j+nlk*nbFF+threeTimesNbFF]*dpds->operator()(kk,m)*Grads[k+kk*nbFF](m));
               }
             }
           }
         }
+        
+        for (int mlk = 0; mlk < vipv[i]->getNumberNonLocalVariable(); mlk++){
+          double  SpBar = vipv[i]->getConstRefToDLocalVariableDNonLocalVariable()(nlk,mlk);
+          for(int j=0;j<nbFF; j++){
+            for(int k=0;k<nbFF;k++){
+              mStiff(j+nlk*nbFF+threeTimesNbFF,k+mlk*nbFF+threeTimesNbFF) -= getNonLocalEqRatio()*ratio*(Vals[j+nlk*nbFF+threeTimesNbFF]*SpBar*Vals[k+mlk*nbFF+threeTimesNbFF]);
+            }
+          }
+        }
+        
         for (int extraDOFField = 0; extraDOFField < vipv[i]->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField++){
           //Msg::Error("Check non-local / extra dof coupling in dG3DStiffnessBulk::get");
           double  dLocalVariableDNonLocalVariable = vipv[i]->getConstRefToDLocalVariableDNonLocalVariable()(nlk,extraDOFField);
@@ -639,49 +844,244 @@ void dG3DElasticStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<d
           }
         }
       }
+  if(!getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()){
       for (int extraDOFField = 0; extraDOFField< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField++){
+
+        const STensor33 &dFluxdF         = vipv[i]->getConstRefTodFluxdF()[extraDOFField]; //in reference conf
+        const STensor3  &dPdField        = vipv[i]->getConstRefTodPdField()[extraDOFField];
+        static STensor3 dwdf;
+        STensorOperation::zero(dwdf);
+
+        if (getConstitutiveExtraDofDiffusionAccountFieldSource()){
+          if(extraDOFField==0){
+          dwdf += vipv[i]->getConstRefTodFieldSourcedF()[extraDOFField];
+           }
+        }
+        if (getConstitutiveExtraDofDiffusionAccountMecaSource()){
+          if(extraDOFField==0){
+          dwdf += vipv[i]->getConstRefTodMechanicalSourcedF()[extraDOFField];
+          }
+        }
+        for(int j=0;j<nbFF; j++){
+          for(int k=0;k<nbFF;k++){
+            int indexField=3+getNumNonLocalVariable()+extraDOFField;
+
+ // F-related terms
+            for(int kk=0;kk<3;kk++)
+            {
+              if((ele->getTypeForMSH() == MSH_HEX_8 or ele->getTypeForMSH() == MSH_QUA_4  or
+      ele->getTypeForMSH() == MSH_TET_4 or ele->getTypeForMSH() == MSH_TRI_3 or ele->getTypeForMSH() == MSH_PRI_6) and !_fullDg)
+              {
+                for(int m=0; m<3; m++)
+                {
+                  mStiff(j+kk*nbFF,k+indexField*nbFF) += ratio*(Grads[j+kk*nbFF][m]*dPdField.operator()(kk,m)*Vals[k+indexField*nbFF]);
+
+                }
+                mStiff(j+kk*nbFF,k+indexField*nbFF) -= ratio*(Grads[j+kk*nbFF][kk]*(dPdField.operator()(0,0)+dPdField.operator()(1,1)+dPdField.operator()(2,2))*Vals[k+indexField*nbFF])/3.;
+                mStiff(j+kk*nbFF,k+indexField*nbFF) += ratio*(Grads[j+kk*nbFF][kk]*dPdFieldVaverage[extraDOFField][k]);
+              }
+              else
+              {
+                for(int m=0; m<3; m++)
+                  mStiff(j+kk*nbFF,k+indexField*nbFF) += ratio*(Grads[j+kk*nbFF][m]*dPdField.operator()(kk,m)*Vals[k+indexField*nbFF]);
+              }
+              for(int m=0; m<3; m++)
+              {
+                for(int n=0; n<3; n++)
+                {
+                  mStiff(j+indexField*nbFF,k+kk*nbFF) += getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*dFluxdF.operator()(m,kk,n)*Grads[k][n]);
+                }
+              if(extraDOFField==0) mStiff(j+indexField*nbFF,k+kk*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[k][m]*dwdf.operator()(kk,m)*Vals[j+indexField*nbFF]); // related to cp
+              }
+            }
+	   }
+          }
+	for (int extraDOFField2 = 0; extraDOFField2< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField2++){
         static bool msg=false;
         if(getNumConstitutiveExtraDofDiffusionVariable()>1)
         {
           if(!msg)
           {
-            Msg::Info("we assume no cross dependency between the extra dof sources domain dG3DElasticStiffnessBulk::get");
+            Msg::Info("we assume no cross dependency between the extra dof sources domain dG3DStiffnessBulk::get");
             msg=true;
           }
         }
-        int extraDOFField2=extraDOFField;
+        //int extraDOFField2=extraDOFField;
         const STensor3  &dFluxdGradField = vipv[i]->getConstRefTodFluxdGradField()[extraDOFField][extraDOFField2]; //in reference conf
         const SVector3  &dFluxdField     = vipv[i]->getConstRefTodFluxdField()[extraDOFField][extraDOFField2]; //in reference conf
-        const STensor33 &dFluxdF         = vipv[i]->getConstRefTodFluxdF()[extraDOFField]; //in reference conf
-        const STensor3  &dPdField        = vipv[i]->getConstRefTodPdField()[extraDOFField];
 
         double dwdt = 0.;
+        if (getConstitutiveExtraDofDiffusionAccountFieldSource()){
+          if(extraDOFField==0 && extraDOFField2==0){
+          dwdt += vipv[i]->getConstRefTodFieldSourcedField()(extraDOFField,extraDOFField2);
+           }
+        }
+        if (getConstitutiveExtraDofDiffusionAccountMecaSource()){
+          if(extraDOFField==0 && extraDOFField2==0){
+          dwdt += vipv[i]->getConstRefTodMechanicalSourcedField()(extraDOFField,extraDOFField2);
+          }
+        }
+        for(int j=0;j<nbFF; j++){
+          for(int k=0;k<nbFF;k++){
+            int indexField=3+getNumNonLocalVariable()+extraDOFField;
+            int indexField2=3+getNumNonLocalVariable()+extraDOFField2;
+
+            // Pure & Cross Terms
+            for(int m=0; m<3; m++)
+            {
+              mStiff(j+indexField*nbFF,k+indexField2*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*dFluxdField.operator()(m)*Vals[k+indexField2*nbFF]);
+              for(int n=0; n<3; n++)
+              {
+                mStiff(j+indexField*nbFF,k+indexField2*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*dFluxdGradField.operator()(m,n)*Grads[k+indexField2*nbFF][n]);
+              }
+            }
+         
+            if(extraDOFField==0 && extraDOFField2==0) mStiff(j+indexField*nbFF,k+indexField*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*dwdt*Vals[j+indexField*nbFF]*Vals[k+indexField*nbFF];// related to cp
+          }
+        }
+      }
+     }
+    }
+
+ if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()){
+      for (int extraDOFField = 0; extraDOFField< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField++){
+
+        const STensor33 &dFluxdF         = vipv[i]->getConstRefTodFluxdF()[extraDOFField]; //in reference conf
+        const STensor3  &dPdField1       = vipv[i]->getConstRefTodPdField()[extraDOFField];
+
+        int extraDOFField_aux=0;
+        if((extraDOFField+1)< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()) extraDOFField_aux=extraDOFField+1;
+        else extraDOFField_aux=extraDOFField-1;        
+
+        const STensor3  &dPdField2       = vipv[i]->getConstRefTodPdField()[extraDOFField_aux];
+
+        double          dFielddEnergyConjugatedField1            = vipv[i]->getConstRefTodFielddEnergyConjugatedField()[extraDOFField][extraDOFField];
+        double          dFielddEnergyConjugatedField2            = vipv[i]->getConstRefTodFielddEnergyConjugatedField()[extraDOFField_aux][extraDOFField];
+
         static STensor3 dwdf;
         STensorOperation::zero(dwdf);
+
         if (getConstitutiveExtraDofDiffusionAccountFieldSource()){
-          dwdt += vipv[i]->getConstRefTodFieldSourcedField()(extraDOFField,extraDOFField2);
+          if(extraDOFField==0){
           dwdf += vipv[i]->getConstRefTodFieldSourcedF()[extraDOFField];
+           }
         }
         if (getConstitutiveExtraDofDiffusionAccountMecaSource()){
-          dwdt += vipv[i]->getConstRefTodMechanicalSourcedField()(extraDOFField,extraDOFField2);
+          if(extraDOFField==0){
           dwdf += vipv[i]->getConstRefTodMechanicalSourcedF()[extraDOFField];
+          }
         }
         for(int j=0;j<nbFF; j++){
           for(int k=0;k<nbFF;k++){
             int indexField=3+getNumNonLocalVariable()+extraDOFField;
 
-            // pure thermal
+ // F-related terms
+            for(int kk=0;kk<3;kk++)
+            {
+              for(int m=0; m<3; m++){
+                  mStiff(j+kk*nbFF,k+indexField*nbFF) += ratio*(Grads[j+kk*nbFF][m]*(dPdField1.operator()(kk,m)*dFielddEnergyConjugatedField1+dPdField2.operator()(kk,m)*dFielddEnergyConjugatedField2)*Vals[k+indexField*nbFF]);
+                for(int n=0; n<3; n++)
+                  {
+                  mStiff(j+indexField*nbFF,k+kk*nbFF) += getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*dFluxdF.operator()(m,kk,n)*Grads[k][n]);
+                  }
+              if(extraDOFField==0) mStiff(j+indexField*nbFF,k+kk*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[k][m]*dwdf.operator()(kk,m)*Vals[j+indexField*nbFF]); // related to cp
+              }
+            }
+	   }
+          }
+	for (int extraDOFField2 = 0; extraDOFField2< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField2++){
+        static bool msg=false;
+        if(getNumConstitutiveExtraDofDiffusionVariable()>1)
+        {
+          if(!msg)
+          {
+            Msg::Info("we assume no cross dependency between the extra dof sources domain dG3DStiffnessBulk::get");
+            msg=true;
+          }
+        }
+        //int extraDOFField2=extraDOFField;
+        const STensor3  &dFluxdGradField1                         = vipv[i]->getConstRefTodFluxdGradField()[extraDOFField][extraDOFField2]; //in reference conf
+        const SVector3  &dFluxdField1                             = vipv[i]->getConstRefTodFluxdField()[extraDOFField][extraDOFField2]; //in reference conf
+
+        int extraDOFField_aux=0;
+        if((extraDOFField2+1)< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()) extraDOFField_aux=extraDOFField2+1;
+        else extraDOFField_aux=extraDOFField2-1;        
+
+        const STensor3  &dFluxdGradField2                         = vipv[i]->getConstRefTodFluxdGradField()[extraDOFField][extraDOFField_aux]; //in reference conf
+        const SVector3  &dFluxdField2                             = vipv[i]->getConstRefTodFluxdField()[extraDOFField][extraDOFField_aux]; //in reference conf
+
+        const STensor3  &dGradFielddGradEnergyConjugatedField1    = vipv[i]->getConstRefTodGradFielddGradEnergyConjugatedField()[extraDOFField2][extraDOFField2];
+        const SVector3  &dGradFielddEnergyConjugatedField1        = vipv[i]->getConstRefTodGradFielddEnergyConjugatedField()[extraDOFField2][extraDOFField2];
+        double          dFielddEnergyConjugatedField1            = vipv[i]->getConstRefTodFielddEnergyConjugatedField()[extraDOFField2][extraDOFField2];
+      
+        const STensor3  &dGradFielddGradEnergyConjugatedField2    = vipv[i]->getConstRefTodGradFielddGradEnergyConjugatedField()[extraDOFField_aux][extraDOFField2];
+        const SVector3  &dGradFielddEnergyConjugatedField2        = vipv[i]->getConstRefTodGradFielddEnergyConjugatedField()[extraDOFField_aux][extraDOFField2];
+        double          dFielddEnergyConjugatedField2            = vipv[i]->getConstRefTodFielddEnergyConjugatedField()[extraDOFField_aux][extraDOFField2];
+
+        double dwdt = 0.;
+        if (getConstitutiveExtraDofDiffusionAccountFieldSource()){
+          if(extraDOFField==0 && extraDOFField2==0){
+          dwdt += vipv[i]->getConstRefTodFieldSourcedField()(extraDOFField,extraDOFField2);
+           }
+        }
+        if (getConstitutiveExtraDofDiffusionAccountMecaSource()){
+          if(extraDOFField==0 && extraDOFField2==0){
+          dwdt += vipv[i]->getConstRefTodMechanicalSourcedField()(extraDOFField,extraDOFField2);
+          }
+        }
+        for(int j=0;j<nbFF; j++){
+          for(int k=0;k<nbFF;k++){
+            int indexField=3+getNumNonLocalVariable()+extraDOFField;
+            int indexField2=3+getNumNonLocalVariable()+extraDOFField2;
+
+            // Pure & Cross Terms
             for(int m=0; m<3; m++)
             {
-              mStiff(j+indexField*nbFF,k+indexField*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*dFluxdField.operator()(m)*Vals[k+indexField*nbFF]);
-              for(int n=0; n<3; n++)
+              mStiff(j+indexField*nbFF,k+indexField2*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*(dFluxdField1.operator()(m)*dFielddEnergyConjugatedField1+dFluxdField2.operator()(m)*dFielddEnergyConjugatedField2)*Vals[k+indexField2*nbFF]);
+
+               for(int n=0; n<3; n++)
               {
-                mStiff(j+indexField*nbFF,k+indexField*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*dFluxdGradField.operator()(m,n)*Grads[k+indexField*nbFF][n]);
+                mStiff(j+indexField*nbFF,k+indexField2*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*(dFluxdGradField1.operator()(m,n)*dGradFielddEnergyConjugatedField1.operator()(n)+dFluxdGradField2.operator()(m,n)*dGradFielddEnergyConjugatedField2.operator()(n))*Vals[k+indexField2*nbFF]);
+             
+              	for(int p=0; p<3; p++)
+              	{
+                 mStiff(j+indexField*nbFF,k+indexField2*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*(dFluxdGradField1.operator()(m,p)*dGradFielddGradEnergyConjugatedField1.operator()(p,n)+dFluxdGradField2.operator()(m,p)*dGradFielddGradEnergyConjugatedField2.operator()(p,n))*Grads[k+indexField2*nbFF][n]);
+             	}
               }
             }
-            mStiff(j+indexField*nbFF,k+indexField*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*dwdt*Vals[j+indexField*nbFF]*Vals[k+indexField*nbFF];// related to cp
+         
+            if(extraDOFField==0 && extraDOFField2==0) mStiff(j+indexField*nbFF,k+indexField*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*dwdt*dFielddEnergyConjugatedField1*Vals[j+indexField*nbFF]*Vals[k+indexField*nbFF];// related to cp
+          }
+        }
+      }
+     }
+    }
 
-            // cross terms
+      for (int extraDOFField = 0; extraDOFField< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField++){
+    	for (int nlk = 0; nlk < vipv[i]->getNumberNonLocalVariable(); nlk++){
+          //Msg::Error("Check extra dof / non-local coupling in dG3DStiffnessBulk::get");
+          const SVector3 &dFluxdNonLocalVariable = vipv[i]->getConstRefTodFluxdNonLocalVariable()[extraDOFField][nlk];
+          double dwdNonLocalVariable   = 0.;  
+          if (getConstitutiveExtraDofDiffusionAccountFieldSource()){
+            dwdNonLocalVariable += vipv[i]->getConstRefTodFieldSourcedNonLocalVariable()(extraDOFField,nlk);
+          }
+          if (getConstitutiveExtraDofDiffusionAccountMecaSource()){
+            dwdNonLocalVariable += vipv[i]->getConstRefTodMechanicalSourcedNonLocalVariable()(extraDOFField,nlk);
+          }
+          for(int j=0;j<nbFF; j++){
+            for(int k=0;k<nbFF;k++){
+              int indexField=3+getNumNonLocalVariable()+extraDOFField;
+              int indexNL=3+nlk;
+              for(int m=0; m<3; m++)
+              {
+         //       mStiff(j+indexField*nbFF,k+indexNL*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*dFluxdNonLocalVariable.operator()(m)*Vals[k+indexNL*nbFF]);
+              }
+         //     mStiff(j+indexField*nbFF,k+indexNL*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*dwdNonLocalVariable*Vals[j+indexField*nbFF]*Vals[k+indexNL*nbFF];
+            }
+          }
+        }
+       }
+         /*   // F-related terms
             for(int kk=0;kk<3;kk++)
             {
               if((ele->getTypeForMSH() == MSH_HEX_8 or ele->getTypeForMSH() == MSH_QUA_4  or
@@ -708,11 +1108,9 @@ void dG3DElasticStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<d
                 }
                 mStiff(j+indexField*nbFF,k+kk*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[k][m]*dwdf.operator()(kk,m)*Vals[j+indexField*nbFF]); // related to cp
               }
-            }
-          }
-        }
-        for (int nlk = 0; nlk < vipv[i]->getNumberNonLocalVariable(); nlk++){
-          //Msg::Error("Check extra dof / non-local coupling in dG3DElasticStiffnessBulk::get");
+            }*/
+       /* for (int nlk = 0; nlk < vipv[i]->getNumberNonLocalVariable(); nlk++){
+          //Msg::Error("Check extra dof / non-local coupling in dG3DStiffnessBulk::get");
           const SVector3 &dFluxdNonLocalVariable = vipv[i]->getConstRefTodFluxdNonLocalVariable()[extraDOFField][nlk];
           double dwdNonLocalVariable   = 0.;  
           if (getConstitutiveExtraDofDiffusionAccountFieldSource()){
@@ -727,15 +1125,15 @@ void dG3DElasticStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<d
               int indexNL=3+nlk;
               for(int m=0; m<3; m++)
               {
-                //mStiff(j+indexField*nbFF,k+indexNL*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*dFluxdNonLocalVariable.operator()(m)*Vals[k+indexNL*nbFF]);
+                mStiff(j+indexField*nbFF,k+indexNL*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*(Grads[j+indexField*nbFF][m]*dFluxdNonLocalVariable.operator()(m)*Vals[k+indexNL*nbFF]);
               }
-              //mStiff(j+indexField*nbFF,k+indexNL*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*dwdNonLocalVariable*Vals[j+indexField*nbFF]*Vals[k+indexNL*nbFF];
+              mStiff(j+indexField*nbFF,k+indexNL*nbFF)+=getConstitutiveExtraDofDiffusionEqRatio()*ratio*dwdNonLocalVariable*Vals[j+indexField*nbFF]*Vals[k+indexNL*nbFF];
             }
           }
-        }
-      }
+        }*/
     }
   //mStiff.print("bulk");
+ // }//to remove after migration
   }
   else
     printf("not implemented\n");
@@ -992,8 +1390,7 @@ void dG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVector<double>
           }
         }
         // constitutive extra dof
-
-    if( ipvm->getNumConstitutiveExtraDofDiffusionVariable()==getNumConstitutiveExtraDofDiffusionVariable() ){ //to remove after migration
+//if( ipvm->getNumConstitutiveExtraDofDiffusionVariable()==getNumConstitutiveExtraDofDiffusionVariable() ){
         if( ipvm->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
             Msg::Fatal("Your material law uses more constitutive extra dof variables than your domain dG3DForceInter::get");
         if( ipvp->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
@@ -1001,33 +1398,46 @@ void dG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVector<double>
         if( ipvp->getNumConstitutiveExtraDofDiffusionVariable()!= ipvm->getNumConstitutiveExtraDofDiffusionVariable() ) 
             Msg::Fatal("Your plus and minus material laws do not use the same number of constitutive extra dof variables dG3DForceInter::get");
         for (int extraDOFField = 0; extraDOFField< ipvp->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField++){
+         for (int extraDOFField2 = 0; extraDOFField2< ipvp->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField2++){
           if( getConstitutiveExtraDofDiffusionContinuity() && !broken)
           {
             const double nbetahs = getConstitutiveExtraDofDiffusionStabilityParameter()/hs;
 
-            double fieldJump = ipvp->getConstRefToFieldJump()(extraDOFField);
+            double fieldJump = ipvp->getConstRefToEnergyConjugatedFieldJump()(extraDOFField2);
   
-            const double &fieldp = ipvp->getConstRefToField(extraDOFField);
-            const double &fieldm = ipvm->getConstRefToField(extraDOFField);
-            const double &oneOverFieldJump = ipvp->getConstRefToOneOverFieldJump()(extraDOFField);
+            const double &fieldp = ipvp->getConstRefToEnergyConjugatedField(extraDOFField);
+            const double &fieldm = ipvm->getConstRefToEnergyConjugatedField(extraDOFField);
+            //const double &oneOverFieldJump = ipvp->getConstRefToOneOverFieldJump()(extraDOFField);
 
             static STensor3  k0m;
-            k0m = *(ipvm->getConstRefToLinearK()[extraDOFField][extraDOFField]);
+            k0m = *(ipvm->getConstRefToLinearK()[extraDOFField][extraDOFField2]);
             static STensor3  k0p;
-            k0p = *(ipvp->getConstRefToLinearK()[extraDOFField][extraDOFField]);
-
+            k0p = *(ipvp->getConstRefToLinearK()[extraDOFField][extraDOFField2]);
+            
             static STensor3  Stiff_alphadialitationm;
-            Stiff_alphadialitationm = *(ipvm->getConstRefToLinearSymmetrizationCoupling()[extraDOFField]);
             static STensor3  Stiff_alphadialitationp;
-            Stiff_alphadialitationp = *(ipvp->getConstRefToLinearSymmetrizationCoupling()[extraDOFField]);
-            if(getConstitutiveExtraDofDiffusionUseOneOverJump())
-            {
-              k0m*=(-1.)*fieldm*fieldm;
-              k0p*=(-1.)*fieldp*fieldp;
-              fieldJump=oneOverFieldJump;
-              Stiff_alphadialitationm*= (-1.)*fieldm*fieldm;
-              Stiff_alphadialitationp*= (-1.)*fieldp*fieldp;
-            }
+            Stiff_alphadialitationm = *(ipvm->getConstRefToLinearSymmetrizationCoupling()[0]);
+            Stiff_alphadialitationp = *(ipvp->getConstRefToLinearSymmetrizationCoupling()[0]);
+            
+            if(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==1) //thermomec
+            {
+                if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
+               {
+                k0m*=(-1.)/(fieldm*fieldm);
+                k0p*=(-1.)/(fieldp*fieldp);
+                //fieldJump=oneOverFieldJump;
+                Stiff_alphadialitationm*= (-1.)/(fieldm*fieldm);
+                Stiff_alphadialitationp*= (-1.)/(fieldp*fieldp);
+                }
+             }
+             else
+             {
+              if(extraDOFField==0)
+                   {
+                    Stiff_alphadialitationm*= (-1.)/(fieldm*fieldm);
+                    Stiff_alphadialitationp*= (-1.)/(fieldp*fieldp); 
+                   }
+             }  
             const SVector3  &fluxm = (ipvm->getConstRefToFlux()[extraDOFField]);
             const SVector3  &fluxp = (ipvp->getConstRefToFlux()[extraDOFField]);
             // consistency \mean{cg*grad eps}
@@ -1061,17 +1471,30 @@ void dG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVector<double>
               }
             }
             int indexField=3+getNumNonLocalVariable()+extraDOFField;
-
-            for(int j=0;j<nbFFm;j++)
-  
+            
+            if(extraDOFField==extraDOFField2)
             {
-              m(j+indexField*nbFFm) -= ( meantflux+NMeank0JumpNBetasc)*(Valsm[j+indexField*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
+              for(int j=0;j<nbFFm;j++)
+              {
+                m(j+indexField*nbFFm) -= ( meantflux+NMeank0JumpNBetasc)*(Valsm[j+indexField*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
+              }
+              for(int j=0;j<nbFFp;j++)
+              {
+                m(j+indexField*nbFFp+nbdofm) += ( meantflux+NMeank0JumpNBetasc)*(Valsp[j+indexField*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
+              }
             }
-            for(int j=0;j<nbFFp;j++)
+            else
             {
-              m(j+indexField*nbFFp+nbdofm) += ( meantflux+NMeank0JumpNBetasc)*(Valsp[j+indexField*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
+              for(int j=0;j<nbFFm;j++)
+              {
+                m(j+indexField*nbFFm) -= (NMeank0JumpNBetasc)*(Valsm[j+indexField*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
+              }
+              for(int j=0;j<nbFFp;j++)
+              {
+                m(j+indexField*nbFFp+nbdofm) += (NMeank0JumpNBetasc)*(Valsp[j+indexField*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
+              }
             }
-
+    
             SVector3 k0pJumpN;
             STensorOperation::zero(k0pJumpN);
             SVector3 k0mJumpN;
@@ -1100,6 +1523,7 @@ void dG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVector<double>
               }
             }
             //new
+            if(extraDOFField==0){
             double gamma=0.;
             for(int j=0;j<nbFFm;j++)
             {
@@ -1109,10 +1533,7 @@ void dG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVector<double>
             {
               m(j+indexField*nbFFp+nbdofm) += gamma*( Stiff_alphadialitationp_JumpN*Valsp[j+indexField*nbFFp])*(wJ/2.)*(-1.);
             }
-	  }
-        }
-  }//to remove after migration
-        //
+           }
       }
       else //broken case
       {
@@ -1138,9 +1559,13 @@ void dG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVector<double>
             m(j+k*nbFFp+nbdofm) += interfaceForce[k]*(Valsp[j+0*nbFFp]*wJ);
           }
         }
+       }
       }
+     }
+     }
+     }
     }
-   }
+   //}
     //m.print("Force inter");
 }
 
@@ -1852,8 +2277,9 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
             STensorOperation::zero(dStiff_alphadialitationmdFieldm);
             static STensor3 dStiff_alphadialitationpdFieldp;
             STensorOperation::zero(dStiff_alphadialitationpdFieldp);
-            if(getConstitutiveExtraDofDiffusionUseOneOverJump())
+            if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
             {
+              Msg::Fatal("HERE TO CHANGE FOR ELECTHER");
               k0m*=(-1.)*fieldm*fieldm;
               k0p*=(-1.)*fieldp*fieldp;
               fieldJump=oneOverFieldJump;
@@ -2045,7 +2471,7 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
               {
                 stiff(j+indexField*nbFFm,l+indexField*nbFFm) -= dfieldJumpdFieldm*NMeankNBetasc*
                                       (Valsm[j+indexField*nbFFm]*Valsm[l+indexField*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
-                if(getConstitutiveExtraDofDiffusionUseOneOverJump())
+                if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
                   stiff(j+indexField*nbFFm,l+indexField*nbFFm) -= oneOverFieldJump*dNMeankNBetascdFieldm*
                                       (Valsm[j+indexField*nbFFm]*Valsm[l+indexField*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
               }
@@ -2053,7 +2479,7 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
               {
                 stiff(j+indexField*nbFFm,l+indexField*nbFFp+nbdofm) -= dfieldJumpdFieldp*NMeankNBetasc*
                                       (Valsm[j+indexField*nbFFm]*Valsp[l+indexField*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
-                if(getConstitutiveExtraDofDiffusionUseOneOverJump())
+                if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
                   stiff(j+indexField*nbFFm,l+indexField*nbFFp+nbdofm) -= oneOverFieldJump*dNMeankNBetascdFieldp*
                                                   (Valsm[j+indexField*nbFFm]*Valsp[l+indexField*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
               }
@@ -2064,7 +2490,7 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
               {
                 stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFm) += dfieldJumpdFieldm*NMeankNBetasc*
                                                   (Valsp[j+indexField*nbFFp]*Valsm[l+indexField*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
-                if(getConstitutiveExtraDofDiffusionUseOneOverJump())
+                if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
                   stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFm) += oneOverFieldJump*dNMeankNBetascdFieldm*
                                                   (Valsp[j+indexField*nbFFp]*Valsm[l+indexField*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
               }
@@ -2072,7 +2498,7 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
               {
                 stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFp+nbdofm) += dfieldJumpdFieldp*NMeankNBetasc*
                                                   (Valsp[j+indexField*nbFFp]*Valsp[l+indexField*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
-                if(getConstitutiveExtraDofDiffusionUseOneOverJump())
+                if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
                   stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFp+nbdofm) += oneOverFieldJump*dNMeankNBetascdFieldp*
                                                   (Valsp[j+indexField*nbFFp]*Valsp[l+indexField*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
               }
@@ -2089,7 +2515,7 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
                   {
                     stiff(j+indexField*nbFFm,l+indexField*nbFFm) += dfieldJumpdFieldm*(k0m(p,q)*
                                                   Gradsm[j+indexField*nbFFm][q])*(nu(p)*wJ*getConstitutiveExtraDofDiffusionEqRatio()/2.*Valsm[l+indexField*nbFFm]);
-                    if(getConstitutiveExtraDofDiffusionUseOneOverJump())
+                    if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
                       stiff(j+indexField*nbFFm,l+indexField*nbFFm) += oneOverFieldJump*(dk0mdFieldm(p,q)*
                                                   Gradsm[j+indexField*nbFFm][q])*(nu(p)*wJ*getConstitutiveExtraDofDiffusionEqRatio()/2.*Valsm[l+indexField*nbFFm]);
                   }
@@ -2128,7 +2554,7 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
                   {
                     stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFp+nbdofm) += dfieldJumpdFieldp*(k0p(p,q)*
                                       Gradsp[j+indexField*nbFFp][q])*(nu(p)*wJ*getConstitutiveExtraDofDiffusionEqRatio()/2.*Valsp[l+indexField*nbFFp]);
-                    if(getConstitutiveExtraDofDiffusionUseOneOverJump())
+                    if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
                       stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFp+nbdofm) += oneOverFieldJump*
                                  (dk0pdFieldp(p,q)*Gradsp[j+indexField*nbFFp][q])*(nu(p)*wJ*getConstitutiveExtraDofDiffusionEqRatio()/2.*Valsp[l+indexField*nbFFp]);
                   }
@@ -2178,7 +2604,7 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
               }
             }
 
-            if(getConstitutiveExtraDofDiffusionUseOneOverJump())
+            if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
             {
               for(int j=0;j<nbFFm;j++)
               {
@@ -2239,7 +2665,7 @@ void ElecTherMechDG3DForceBulk::get(MElement *ele,int npts,IntPt *GP,fullVector<
 
   // xyz Part
   dG3DForceBulk::get(ele,npts,GP,vFor);
-
+/*
   int nbdof = this->space1.getNumKeys(ele);
   int nbFF = ele->getNumShapeFunctions();
 
@@ -2285,8 +2711,6 @@ void ElecTherMechDG3DForceBulk::get(MElement *ele,int npts,IntPt *GP,fullVector<
       ATepsbar4(1) = Grads[j+indexFieldV*nbFF][1];
       ATepsbar4(2) = Grads[j+indexFieldV*nbFF][2];
 
-
-
       for(int m=0; m<3; m++)
       {
         vFor(j+indexFieldT*nbFF) += eqRatio*ratio*(ATepsbar3(m)*fluxjy(m));
@@ -2299,7 +2723,7 @@ void ElecTherMechDG3DForceBulk::get(MElement *ele,int npts,IntPt *GP,fullVector<
         vFor(j+indexFieldV*nbFF) += eqRatio*ratio*(ATepsbar4(m)*fluxV(m));
       }
     }
-  }
+  }*/
   //vFor.print("interF");
 };
 
@@ -2307,6 +2731,7 @@ void ElecTherMechDG3DForceBulk::get(MElement *ele,int npts,IntPt *GP,fullVector<
 void ElecTherMechDG3DStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double> &mStiff) const
 {
   dG3DStiffnessBulk::get(ele,npts,GP,mStiff);
+/*
   if (sym)
   {
     // Initialization of some data
@@ -2347,9 +2772,9 @@ void ElecTherMechDG3DStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMat
         const double    w              = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefToThermalSource());
         const double    dwdt           = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodThermalSourcedT());
         const STensor3  &dwdF          = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodThermalSourcedF());
-        /*const double    dwdV           = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodThermalSourcedV());
+        const double    dwdV           = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodThermalSourcedV());
         const SVector3  &dwdGradT      = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodThermalSourcedGradT());
-        const SVector3  &dwdGradV      = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodThermalSourcedGradV());*/
+        const SVector3  &dwdGradV      = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodThermalSourcedGradV());
 
         const STensor33 &djydF		= ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxEnergydF());
         const STensor3  &djydGradT	= ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxEnergydGradT());
@@ -2575,7 +3000,7 @@ void ElecTherMechDG3DStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMat
            /*   for(int n=0; n<3; n++)
               {
                  mStiff(j+indexFieldfT*nbFF,k+indexFieldfT*nbFF)+=eqRatio*ratio*(dwdGradT.operator()(n)*Bepsbar3(n))*Vals[j+indexFieldfT*nbFF];  // new related to w
-              }*/
+              }//*
 
 
                 //dfintdv
@@ -2595,7 +3020,7 @@ void ElecTherMechDG3DStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMat
               {
               mStiff(j+indexFieldfT*nbFF,k+indexFieldfV*nbFF)+=eqRatio*ratio*(dwdGradV.operator()(n)*Bepsbar4(n)*Vals[j+indexFieldfT*nbFF]);//new related to w
               }
-            }*/
+            }*//*
 
 
                 // pure electrical dfintvdv
@@ -2641,6 +3066,7 @@ void ElecTherMechDG3DStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMat
   }
   else
    printf("not implemented\n");
+*/
 }
 
 
@@ -2648,7 +3074,8 @@ void ElecTherMechDG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVec
 {
 
   dG3DForceInter::get(ele, npts, GP,m);
-  const fullVector<double> &datafield = *_data;
+
+ /* const fullVector<double> &datafield = *_data;
   MInterfaceElement *ie = dynamic_cast<MInterfaceElement*>(ele);
   const int nbFFm = ie->getElem(0)->getNumVertices();
   const int nbFFp = ie->getElem(1)->getNumVertices();
@@ -2695,7 +3122,7 @@ void ElecTherMechDG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVec
 
 
 
-        if(_useFtFv)
+        if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
         {
 
           const SVector3 &referenceOutwardNormalm = ipvm->getConstRefToReferenceOutwardNormal();
@@ -2713,12 +3140,23 @@ void ElecTherMechDG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVec
           const SVector3  &fluxVm = (ipvm->getConstRefToFluxV());
           const SVector3  &fluxVp = (ipvp->getConstRefToFluxV());
 
-          const STensor3 jy1m	= *(ipvm->getConstRefToEnergyConductivity());
-          const STensor3 jy1p	= *(ipvp->getConstRefToEnergyConductivity());
-          const SVector3  &fluxjym= (ipvm->getConstRefToFluxEnergy());
-          const SVector3  &fluxjyp= (ipvp->getConstRefToFluxEnergy());
+         //const STensor3 jy1m	= *(ipvm->getConstRefToEnergyConductivity());
+         //const STensor3 jy1p	= *(ipvp->getConstRefToEnergyConductivity());
 
+         const STensor3 jy1m	= *(ipvm->getConstRefToTherConductivity());
+         const STensor3 jy1p	= *(ipvp->getConstRefToTherConductivity());
 
+         // static STensor3 jy1m, jy1m_1, jy1p, jy1p_1;
+         // STensorOperation::zero(jy1m);STensorOperation::zero(jy1m_1);STensorOperation::zero(jy1p_1);STensorOperation::zero(jy1p);
+         // STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradField()[0][0],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],jy1m_1);
+         // STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradField()[0][1],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],jy1m);
+         // jy1m += jy1m_1;
+         // STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradField()[0][0],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],jy1p_1);
+         // STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradField()[0][1],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],jy1p);
+         // jy1p += jy1p_1;
+
+          const SVector3  &fluxjym= (ipvm->getConstRefToFluxEnergy());
+          const SVector3  &fluxjyp= (ipvp->getConstRefToFluxEnergy());
 
           static STensor3 Stiff_alphadialitationm;
           Stiff_alphadialitationm = *ipvm->getConstRefToStiff_alphaDilatation();
@@ -2948,8 +3386,21 @@ void ElecTherMechDG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVec
           const SVector3  &fluxVm = (ipvm->getConstRefToFluxV());
           const SVector3  &fluxVp = (ipvp->getConstRefToFluxV());
 
-          const STensor3  jy1m	= *(ipvm->getConstRefToEnergyConductivity());
-          const STensor3  jy1p	= *(ipvp->getConstRefToEnergyConductivity());
+          //const STensor3  jy1m	= *(ipvm->getConstRefToEnergyConductivity());
+          //const STensor3  jy1p	= *(ipvp->getConstRefToEnergyConductivity());
+
+          const STensor3 jy1m	= *(ipvm->getConstRefToTherConductivity());
+          const STensor3 jy1p	= *(ipvp->getConstRefToTherConductivity());
+
+         // static STensor3 jy1m, jy1m_1, jy1p, jy1p_1;
+         // STensorOperation::zero(jy1m);STensorOperation::zero(jy1m_1);STensorOperation::zero(jy1p_1);STensorOperation::zero(jy1p);
+         // STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradField()[0][0],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],jy1m);
+         // STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradField()[0][1],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],jy1m);
+         // jy1m += jy1m_1;
+         // STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradField()[0][0],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],jy1p);
+         // STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradField()[0][1],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],jy1p);
+         // jy1p += jy1p_1;
+
           const SVector3  &fluxjym= (ipvm->getConstRefToFluxEnergy());
           const SVector3  &fluxjyp= (ipvp->getConstRefToFluxEnergy());
 
@@ -3166,7 +3617,7 @@ void ElecTherMechDG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVec
         }
       }
     }
-  }
+  }*/
 }
 
 
@@ -3221,7 +3672,7 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
         const SVector3 &referenceOutwardNormalp = ipvp->getConstRefToReferenceOutwardNormal();
 
 
-        if(_useFtFv)
+        if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
         {
           const double &ftJump = ipvp->getConstRefToOneOverTemperatureJump();
           const double &fvJump = ipvp->getConstRefTofvJump();
@@ -3328,7 +3779,7 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
             const SVector3 *dgradTdfTp     = &(ipvp->getConstRefTodgradTdfT());
             const SVector3 *dgradTdfVp     = &(ipvp->getConstRefTodgradTdfV());
 
-            const STensor3  *jy1m	= (ipvm->getConstRefToEnergyConductivity());
+          /*  const STensor3  *jy1m	= (ipvm->getConstRefToEnergyConductivity());
             const STensor43 *djy1dFm    = &(ipvm->getConstRefTodEnergyConductivitydF());
             const STensor3  *djy1dVm	= &(ipvm->getConstRefTodEnergyConductivitydV());
             const STensor3  *djy1dTm	= &(ipvm->getConstRefTodEnergyConductivitydT());
@@ -3336,7 +3787,77 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
             const STensor3  *jy1p	= (ipvp->getConstRefToEnergyConductivity());
             const STensor43 *djy1dFp    = &(ipvp->getConstRefTodEnergyConductivitydF());
             const STensor3  *djy1dVp	= &(ipvp->getConstRefTodEnergyConductivitydV());
-            const STensor3  *djy1dTp	= &(ipvp->getConstRefTodEnergyConductivitydT());
+            const STensor3  *djy1dTp	= &(ipvp->getConstRefTodEnergyConductivitydT());  */
+
+            const STensor3  *jy1m	= (ipvm->getConstRefToTherConductivity());
+            const STensor43 *djy1dFm    = &(ipvm->getConstRefTodTherConductivitydF());
+            const STensor3  *djy1dVm	= &(ipvm->getConstRefTodTherConductivitydv());
+            const STensor3  *djy1dTm	= &(ipvm->getConstRefTodTherConductivitydT());
+
+            const STensor3  *jy1p	= (ipvp->getConstRefToTherConductivity());
+            const STensor43 *djy1dFp    = &(ipvp->getConstRefTodTherConductivitydF());
+            const STensor3  *djy1dVp	= &(ipvp->getConstRefTodTherConductivitydv());
+            const STensor3  *djy1dTp	= &(ipvp->getConstRefTodTherConductivitydT()); 
+
+            /*static STensor3 jy1m, jy1m_1;
+            STensorOperation::zero(jy1m); STensorOperation::zero(jy1m_1);
+            STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradField()[0][0],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],jy1m_1);
+            STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradField()[0][1],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],jy1m);
+            jy1m += jy1m_1;
+            static STensor43 djy1dFm, djy1dFp, djydgradVdFm, djydgradTdFm, djydgradVdFp, djydgradTdFp;
+            static STensor3 dgradVdgradfTm, dgradTdgradfTm, dgradVdgradfTp, dgradTdgradfTp; 
+            djydgradVdFm=ipvm->getConstRefTodFluxdGradFielddF()[0][1];
+            djydgradTdFm=ipvm->getConstRefTodFluxdGradFielddF()[0][0];
+            dgradVdgradfTm=ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0];
+            dgradTdgradfTm=ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0];
+            djydgradVdFp=ipvp->getConstRefTodFluxdGradFielddF()[0][1];
+            djydgradTdFp=ipvp->getConstRefTodFluxdGradFielddF()[0][0];
+            dgradVdgradfTp=ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0];
+            dgradTdgradfTp=ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0];
+            STensorOperation::zero(djy1dFm);
+            STensorOperation::zero(djy1dFp);
+
+             for (int i=0; i<3; i++){
+              for (int j=0; j<3; j++){
+                for (int k=0; k<3; k++){
+                 for (int l=0; l<3; l++){
+                  for (int q=0; q<3; q++){
+                 			  djy1dFm(i,j,k,l) += djydgradVdFm(i,q,k,l)*dgradVdgradfTm(q,j);
+                 			  djy1dFm(i,j,k,l) += djydgradTdFm(i,q,k,l)*dgradTdgradfTm(q,j);
+                 			  djy1dFp(i,j,k,l) += djydgradVdFp(i,q,k,l)*dgradVdgradfTp(q,j);
+                 			  djy1dFp(i,j,k,l) += djydgradTdFp(i,q,k,l)*dgradTdgradfTp(q,j);
+                                         }
+                                        }
+                                       }
+                                      }
+                                     }
+
+            static STensor3 djy1dVm, djy1dVm_1;
+            STensorOperation::zero(djy1dVm); STensorOperation::zero(djy1dVm_1);
+            STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradFielddField()[0][0][1],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],djy1dVm_1);
+            STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradFielddField()[0][1][1],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],djy1dVm);
+            djy1dVm += djy1dVm_1;
+            static STensor3 djy1dTm, djy1dTm_1;
+            STensorOperation::zero(djy1dTm); STensorOperation::zero(djy1dTm_1);
+            STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradFielddField()[0][0][0],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],djy1dTm_1);
+            STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradFielddField()[0][1][0],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],djy1dTm);
+            djy1dTm += djy1dTm_1;
+
+            static STensor3 jy1p, jy1p_1;
+            STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradField()[0][0],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],jy1p_1);
+            STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradField()[0][1],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],jy1p);
+            jy1p += jy1p_1;
+
+            static STensor3 djy1dVp, djy1dVp_1;
+            STensorOperation::zero(djy1dVp); STensorOperation::zero(djy1dVp_1);
+            STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradFielddField()[0][0][1],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],djy1dVp_1);
+            STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradFielddField()[0][1][1],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],djy1dVp);
+            djy1dVp += djy1dVp_1;
+            static STensor3 djy1dTp, djy1dTp_1;
+            STensorOperation::zero(djy1dTp); STensorOperation::zero(djy1dTp_1);
+            STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradFielddField()[0][0][0],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],djy1dTp_1);
+            STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradFielddField()[0][1][0],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],djy1dTp);
+            djy1dTp += djy1dTp_1;*/
 
             const STensor33 *djydFp	= &(ipvp->getConstRefTodFluxEnergydF());
             const STensor3  *djydGradTp	= &(ipvp->getConstRefTodFluxEnergydGradT());
@@ -4433,7 +4954,7 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
             const SVector3  *djedTm     = &(ipvm->getConstRefTodFluxVdT());
             const SVector3  *djedTp     = &(ipvp->getConstRefTodFluxVdT());
 
-            const STensor3  *jy1m	= (ipvm->getConstRefToEnergyConductivity());
+          /*  const STensor3  *jy1m	= (ipvm->getConstRefToEnergyConductivity());
             const STensor43 *djy1dFm    = &(ipvm->getConstRefTodEnergyConductivitydF());
             const STensor3  *djy1dVm	= &(ipvm->getConstRefTodEnergyConductivitydV());
             const STensor3  *djy1dTm	= &(ipvm->getConstRefTodEnergyConductivitydT());
@@ -4441,7 +4962,77 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
             const STensor3  *jy1p	= (ipvp->getConstRefToEnergyConductivity());
             const STensor43 *djy1dFp    = &(ipvp->getConstRefTodEnergyConductivitydF());
             const STensor3  *djy1dVp	= &(ipvp->getConstRefTodEnergyConductivitydV());
-            const STensor3  *djy1dTp	= &(ipvp->getConstRefTodEnergyConductivitydT());
+            const STensor3  *djy1dTp	= &(ipvp->getConstRefTodEnergyConductivitydT()); */
+
+            const STensor3  *jy1m	= (ipvm->getConstRefToTherConductivity());
+            const STensor43 *djy1dFm    = &(ipvm->getConstRefTodTherConductivitydF());
+            const STensor3  *djy1dVm	= &(ipvm->getConstRefTodTherConductivitydv());
+            const STensor3  *djy1dTm	= &(ipvm->getConstRefTodTherConductivitydT());
+
+            const STensor3  *jy1p	= (ipvp->getConstRefToTherConductivity());
+            const STensor43 *djy1dFp    = &(ipvp->getConstRefTodTherConductivitydF());
+            const STensor3  *djy1dVp	= &(ipvp->getConstRefTodTherConductivitydv());
+            const STensor3  *djy1dTp	= &(ipvp->getConstRefTodTherConductivitydT()); 
+
+           /* static STensor3 jy1m, jy1m_1;
+            STensorOperation::zero(jy1m); STensorOperation::zero(jy1m_1);
+            STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradField()[0][0],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],jy1m_1);
+            STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradField()[0][1],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],jy1m);
+            jy1m += jy1m_1;
+            static STensor43 djy1dFm, djy1dFp, djydgradVdFm, djydgradTdFm, djydgradVdFp, djydgradTdFp;
+            static STensor3 dgradVdgradfTm, dgradTdgradfTm, dgradVdgradfTp, dgradTdgradfTp; 
+            djydgradVdFm=ipvm->getConstRefTodFluxdGradFielddF()[0][1];
+            djydgradTdFm=ipvm->getConstRefTodFluxdGradFielddF()[0][0];
+            dgradVdgradfTm=ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0];
+            dgradTdgradfTm=ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0];
+            djydgradVdFp=ipvp->getConstRefTodFluxdGradFielddF()[0][1];
+            djydgradTdFp=ipvp->getConstRefTodFluxdGradFielddF()[0][0];
+            dgradVdgradfTp=ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0];
+            dgradTdgradfTp=ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0];
+            STensorOperation::zero(djy1dFm);
+            STensorOperation::zero(djy1dFp);
+
+             for (int i=0; i<3; i++){
+              for (int j=0; j<3; j++){
+                for (int k=0; k<3; k++){
+                 for (int l=0; l<3; l++){
+                  for (int q=0; q<3; q++){
+                 			  djy1dFm(i,j,k,l) += djydgradVdFm(i,q,k,l)*dgradVdgradfTm(q,j);
+                 			  djy1dFm(i,j,k,l) += djydgradTdFm(i,q,k,l)*dgradTdgradfTm(q,j);
+                 			  djy1dFp(i,j,k,l) += djydgradVdFp(i,q,k,l)*dgradVdgradfTp(q,j);
+                 			  djy1dFp(i,j,k,l) += djydgradTdFp(i,q,k,l)*dgradTdgradfTp(q,j);
+                                         }
+                                        }
+                                       }
+                                      }
+                                     }
+
+            static STensor3 djy1dVm, djy1dVm_1;
+            STensorOperation::zero(djy1dVm); STensorOperation::zero(djy1dVm_1);
+            STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradFielddField()[0][0][1],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],djy1dVm_1);
+            STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradFielddField()[0][1][1],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],djy1dVm);
+            djy1dVm += djy1dVm_1;
+            static STensor3 djy1dTm, djy1dTm_1;
+            STensorOperation::zero(djy1dTm); STensorOperation::zero(djy1dTm_1);
+            STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradFielddField()[0][0][0],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],djy1dTm_1);
+            STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradFielddField()[0][1][0],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],djy1dTm);
+            djy1dTm += djy1dTm_1;
+
+            static STensor3 jy1p, jy1p_1;
+            STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradField()[0][0],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],jy1p_1);
+            STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradField()[0][1],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],jy1p);
+            jy1p += jy1p_1;
+
+            static STensor3 djy1dVp, djy1dVp_1;
+            STensorOperation::zero(djy1dVp); STensorOperation::zero(djy1dVp_1);
+            STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradFielddField()[0][0][1],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],djy1dVp_1);
+            STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradFielddField()[0][1][1],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],djy1dVp);
+            djy1dVp += djy1dVp_1;
+            static STensor3 djy1dTp, djy1dTp_1;
+            STensorOperation::zero(djy1dTp); STensorOperation::zero(djy1dTp_1);
+            STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradFielddField()[0][0][0],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],djy1dTp_1);
+            STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradFielddField()[0][1][0],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],djy1dTp);
+            djy1dTp += djy1dTp_1; */
 
             const STensor33 *djydFp	= &(ipvp->getConstRefTodFluxEnergydF());
             const STensor3  *djydGradTp	= &(ipvp->getConstRefTodFluxEnergydGradT());
diff --git a/dG3D/src/dG3DTerms.h b/dG3D/src/dG3DTerms.h
index a48aff171..b54a9524b 100644
--- a/dG3D/src/dG3DTerms.h
+++ b/dG3D/src/dG3DTerms.h
@@ -35,13 +35,13 @@ template<class T1,class T2> class g3DBilinearTerm : public BiNonLinearTermBase
   int _numNonLocalVariable;
   int _numConstitutiveExtraDofDiffusionVariable;
   double _constitutiveExtraDofDiffusionEqRatio;
-  bool _constitutiveExtraDofDiffusionOneOverJump; //we can use it when considering 1/fT
+  bool _constitutiveExtraDofDiffusionUseEnergyConjugatedField; //we can use it when considering 1/fT
   bool _constitutiveExtraDofDiffusionAccountFieldSource;
   bool _constitutiveExtraDofDiffusionAccountMecaSource;
  public :
   g3DBilinearTerm(FunctionSpace<T1>& space1_,FunctionSpace<T2>& space2_) : space1(space1_),space2(space2_), 
           _nonLocalEqRatio(1.), _numNonLocalVariable(0), _numConstitutiveExtraDofDiffusionVariable(0), _constitutiveExtraDofDiffusionEqRatio(1.),
-          _constitutiveExtraDofDiffusionOneOverJump(false), _constitutiveExtraDofDiffusionAccountFieldSource(true),
+          _constitutiveExtraDofDiffusionUseEnergyConjugatedField(false), _constitutiveExtraDofDiffusionAccountFieldSource(true),
           _constitutiveExtraDofDiffusionAccountMecaSource(false)
   {}
   virtual ~g3DBilinearTerm() {}
@@ -53,8 +53,8 @@ template<class T1,class T2> class g3DBilinearTerm : public BiNonLinearTermBase
   virtual int getNumConstitutiveExtraDofDiffusionVariable() const {return _numConstitutiveExtraDofDiffusionVariable;}
   virtual void setConstitutiveExtraDofDiffusionEqRatio(double eq) {_constitutiveExtraDofDiffusionEqRatio = eq;}
   virtual double getConstitutiveExtraDofDiffusionEqRatio() const {return _constitutiveExtraDofDiffusionEqRatio;}
-  virtual void setConstitutiveExtraDofDiffusionUseOneOverJump( bool oft){_constitutiveExtraDofDiffusionOneOverJump=oft;} //we can use it when considering 1/fT
-  virtual bool getConstitutiveExtraDofDiffusionUseOneOverJump()const { return _constitutiveExtraDofDiffusionOneOverJump;} //we can use it when considering 1/fT
+  virtual void setConstitutiveExtraDofDiffusionUseEnergyConjugatedField( bool oft){_constitutiveExtraDofDiffusionUseEnergyConjugatedField=oft;} //we can use it when considering 1/fT
+  virtual bool getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()const { return _constitutiveExtraDofDiffusionUseEnergyConjugatedField;} //we can use it when considering 1/fT
   virtual void setConstitutiveExtraDofDiffusionAccountFieldSource(bool so){_constitutiveExtraDofDiffusionAccountFieldSource=so;}
   virtual bool getConstitutiveExtraDofDiffusionAccountFieldSource() const {return _constitutiveExtraDofDiffusionAccountFieldSource;}
   virtual void setConstitutiveExtraDofDiffusionAccountMecaSource(bool so) {_constitutiveExtraDofDiffusionAccountMecaSource=so;}
@@ -70,7 +70,7 @@ template<class T1> class g3DLinearTerm : public nonLinearTermBase<double>
   int _numNonLocalVariable; 
   int _numConstitutiveExtraDofDiffusionVariable;
   double _constitutiveExtraDofDiffusionEqRatio;
-  bool _constitutiveExtraDofDiffusionOneOverJump; //we can use it when considering 1/fT
+  bool _constitutiveExtraDofDiffusionUseEnergyConjugatedField; //we can use it when considering 1/fT
   bool _constitutiveExtraDofDiffusionAccountFieldSource;
   bool _constitutiveExtraDofDiffusionAccountMecaSource;
 
@@ -83,8 +83,8 @@ template<class T1> class g3DLinearTerm : public nonLinearTermBase<double>
   virtual int getNumConstitutiveExtraDofDiffusionVariable() const {return _numConstitutiveExtraDofDiffusionVariable;}
   virtual void setConstitutiveExtraDofDiffusionEqRatio(double eq) {_constitutiveExtraDofDiffusionEqRatio = eq;}
   virtual double getConstitutiveExtraDofDiffusionEqRatio() const {return _constitutiveExtraDofDiffusionEqRatio;}
-  virtual void setConstitutiveExtraDofDiffusionUseOneOverJump( bool oft){_constitutiveExtraDofDiffusionOneOverJump=oft;} //we can use it when considering 1/fT
-  virtual bool getConstitutiveExtraDofDiffusionUseOneOverJump()const { return _constitutiveExtraDofDiffusionOneOverJump;} //we can use it when considering 1/fT
+  virtual void setConstitutiveExtraDofDiffusionUseEnergyConjugatedField( bool oft){_constitutiveExtraDofDiffusionUseEnergyConjugatedField=oft;} //we can use it when considering 1/fT
+  virtual bool getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()const { return _constitutiveExtraDofDiffusionUseEnergyConjugatedField;} //we can use it when considering 1/fT
   virtual void setConstitutiveExtraDofDiffusionAccountFieldSource(bool so){_constitutiveExtraDofDiffusionAccountFieldSource=so;}
   virtual bool getConstitutiveExtraDofDiffusionAccountFieldSource() const {return _constitutiveExtraDofDiffusionAccountFieldSource;}
   virtual void setConstitutiveExtraDofDiffusionAccountMecaSource(bool so) {_constitutiveExtraDofDiffusionAccountMecaSource=so;}
@@ -94,7 +94,7 @@ template<class T1> class g3DLinearTerm : public nonLinearTermBase<double>
   g3DLinearTerm(FunctionSpace<T1>& space1_) : space1(space1_), 
                                      _nonLocalEqRatio(1.), _numNonLocalVariable(0), 
                                      _numConstitutiveExtraDofDiffusionVariable(0), _constitutiveExtraDofDiffusionEqRatio(1.),
-                                     _constitutiveExtraDofDiffusionOneOverJump(false), _constitutiveExtraDofDiffusionAccountFieldSource(true),
+                                     _constitutiveExtraDofDiffusionUseEnergyConjugatedField(false), _constitutiveExtraDofDiffusionAccountFieldSource(true),
                                      _constitutiveExtraDofDiffusionAccountMecaSource(false)
   {}
   virtual void get(MElement *ele, int npts, IntPt *GP, std::vector<fullMatrix<double> > &mv) const
@@ -112,7 +112,7 @@ template<class T1> class g3DLoadTerm : public LinearTerm<T1>
   int _numNonLocalVariable; //we will need when adding extradof
   int _numConstitutiveExtraDofDiffusionVariable;
   double _constitutiveExtraDofDiffusionEqRatio;
-  bool _constitutiveExtraDofDiffusionOneOverJump; //we can use it when considering 1/fT
+  bool _constitutiveExtraDofDiffusionUseEnergyConjugatedField; //we can use it when considering 1/fT
   bool _constitutiveExtraDofDiffusionAccountFieldSource;
   bool _constitutiveExtraDofDiffusionAccountMecaSource;
 
@@ -125,7 +125,7 @@ template<class T1> class g3DLoadTerm : public LinearTerm<T1>
                const simpleFunction<typename TensorialTraits<T1>::ValType> *Load_) : LinearTerm<T1>(space1_),Load(Load_), 
                                                   _nonLocalEqRatio(1.), _numNonLocalVariable(0), 
                                                   _numConstitutiveExtraDofDiffusionVariable(0), _constitutiveExtraDofDiffusionEqRatio(1.),
-                                                  _constitutiveExtraDofDiffusionOneOverJump(false), _constitutiveExtraDofDiffusionAccountFieldSource(true),
+                                                  _constitutiveExtraDofDiffusionUseEnergyConjugatedField(false), _constitutiveExtraDofDiffusionAccountFieldSource(true),
                                                   _constitutiveExtraDofDiffusionAccountMecaSource(false)
   {
 
@@ -138,8 +138,8 @@ template<class T1> class g3DLoadTerm : public LinearTerm<T1>
   virtual int getNumConstitutiveExtraDofDiffusionVariable() const {return _numConstitutiveExtraDofDiffusionVariable;}
   virtual void setConstitutiveExtraDofDiffusionEqRatio(double eq) {_constitutiveExtraDofDiffusionEqRatio = eq;}
   virtual double getConstitutiveExtraDofDiffusionEqRatio() const {return _constitutiveExtraDofDiffusionEqRatio;}
-  virtual void setConstitutiveExtraDofDiffusionUseOneOverJump( bool oft){_constitutiveExtraDofDiffusionOneOverJump=oft;} //we can use it when considering 1/fT
-  virtual bool getConstitutiveExtraDofDiffusionUseOneOverJump()const { return _constitutiveExtraDofDiffusionOneOverJump;} //we can use it when considering 1/fT
+  virtual void setConstitutiveExtraDofDiffusionUseEnergyConjugatedField( bool oft){_constitutiveExtraDofDiffusionUseEnergyConjugatedField=oft;} //we can use it when considering 1/fT
+  virtual bool getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()const { return _constitutiveExtraDofDiffusionUseEnergyConjugatedField;} //we can use it when considering 1/fT
   virtual void setConstitutiveExtraDofDiffusionAccountFieldSource(bool so){_constitutiveExtraDofDiffusionAccountFieldSource=so;}
   virtual bool getConstitutiveExtraDofDiffusionAccountFieldSource() const {return _constitutiveExtraDofDiffusionAccountFieldSource;}
   virtual void setConstitutiveExtraDofDiffusionAccountMecaSource(bool so) {_constitutiveExtraDofDiffusionAccountMecaSource=so;}
@@ -194,7 +194,7 @@ template<class T1> class g3DLoadTerm : public LinearTerm<T1>
     DG->setNumNonLocalVariable(this->getNumNonLocalVariable());
     DG->setNumConstitutiveExtraDofDiffusionVariable(this->getNumConstitutiveExtraDofDiffusionVariable());
     DG->setConstitutiveExtraDofDiffusionEqRatio(this->getConstitutiveExtraDofDiffusionEqRatio());
-    DG->setConstitutiveExtraDofDiffusionUseOneOverJump(this->getConstitutiveExtraDofDiffusionUseOneOverJump());
+    DG->setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(this->getConstitutiveExtraDofDiffusionUseEnergyConjugatedField());
     DG->setConstitutiveExtraDofDiffusionAccountFieldSource(this->getConstitutiveExtraDofDiffusionAccountFieldSource());
     DG->setConstitutiveExtraDofDiffusionAccountMecaSource(this->getConstitutiveExtraDofDiffusionAccountMecaSource());
     return DG;
@@ -792,7 +792,7 @@ class dG3DForceBulk : public g3DLinearTerm<double>
     DG->setNumNonLocalVariable(this->getNumNonLocalVariable());
     DG->setNumConstitutiveExtraDofDiffusionVariable(this->getNumConstitutiveExtraDofDiffusionVariable());
     DG->setConstitutiveExtraDofDiffusionEqRatio(this->getConstitutiveExtraDofDiffusionEqRatio());
-    DG->setConstitutiveExtraDofDiffusionUseOneOverJump(this->getConstitutiveExtraDofDiffusionUseOneOverJump());
+    DG->setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(this->getConstitutiveExtraDofDiffusionUseEnergyConjugatedField());
     DG->setConstitutiveExtraDofDiffusionAccountFieldSource(this->getConstitutiveExtraDofDiffusionAccountFieldSource());
     DG->setConstitutiveExtraDofDiffusionAccountMecaSource(this->getConstitutiveExtraDofDiffusionAccountMecaSource());
     return DG;
@@ -811,7 +811,7 @@ class dG3DStiffnessBulk : public BilinearTerm<double,double>
   int _numNonLocalVariable; //we will need when adding extradof
   int _numConstitutiveExtraDofDiffusionVariable;
   double _constitutiveExtraDofDiffusionEqRatio;
-  bool _constitutiveExtraDofDiffusionOneOverJump; //we can use it when considering 1/fT
+  bool _constitutiveExtraDofDiffusionUseEnergyConjugatedField; //we can use it when considering 1/fT
   bool _constitutiveExtraDofDiffusionAccountFieldSource;
   bool _constitutiveExtraDofDiffusionAccountMecaSource;
 
@@ -820,7 +820,7 @@ class dG3DStiffnessBulk : public BilinearTerm<double,double>
                                   bool FullDG, const IPField *ip) : BilinearTerm<double,double>(space1_,space2_),
                                                             _fullDg(FullDG), _ipf(ip), _nonLocalEqRatio(1.), _numNonLocalVariable(0),
                                                             _numConstitutiveExtraDofDiffusionVariable(0), _constitutiveExtraDofDiffusionEqRatio(1.),
-                                                            _constitutiveExtraDofDiffusionOneOverJump(false), _constitutiveExtraDofDiffusionAccountFieldSource(true),
+                                                            _constitutiveExtraDofDiffusionUseEnergyConjugatedField(false), _constitutiveExtraDofDiffusionAccountFieldSource(true),
                                                             _constitutiveExtraDofDiffusionAccountMecaSource(false),
                                                             _mlaw(static_cast< const dG3DMaterialLaw*>(mlaw))
   {
@@ -834,8 +834,8 @@ class dG3DStiffnessBulk : public BilinearTerm<double,double>
   virtual int getNumConstitutiveExtraDofDiffusionVariable() const {return _numConstitutiveExtraDofDiffusionVariable;}
   virtual void setConstitutiveExtraDofDiffusionEqRatio(double eq) {_constitutiveExtraDofDiffusionEqRatio = eq;}
   virtual double getConstitutiveExtraDofDiffusionEqRatio() const {return _constitutiveExtraDofDiffusionEqRatio;}
-  virtual void setConstitutiveExtraDofDiffusionUseOneOverJump( bool oft){_constitutiveExtraDofDiffusionOneOverJump=oft;} //we can use it when considering 1/fT
-  virtual bool getConstitutiveExtraDofDiffusionUseOneOverJump()const { return _constitutiveExtraDofDiffusionOneOverJump;} //we can use it when considering 1/fT
+  virtual void setConstitutiveExtraDofDiffusionUseEnergyConjugatedField( bool oft){_constitutiveExtraDofDiffusionUseEnergyConjugatedField=oft;} //we can use it when considering 1/fT
+  virtual bool getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()const { return _constitutiveExtraDofDiffusionUseEnergyConjugatedField;} //we can use it when considering 1/fT
   virtual void setConstitutiveExtraDofDiffusionAccountFieldSource(bool so){_constitutiveExtraDofDiffusionAccountFieldSource=so;}
   virtual bool getConstitutiveExtraDofDiffusionAccountFieldSource() const {return _constitutiveExtraDofDiffusionAccountFieldSource;}
   virtual void setConstitutiveExtraDofDiffusionAccountMecaSource(bool so) {_constitutiveExtraDofDiffusionAccountMecaSource=so;}
@@ -845,7 +845,7 @@ class dG3DStiffnessBulk : public BilinearTerm<double,double>
                                   bool FullDG,const IPField *ip) : BilinearTerm<double,double>(space1_,space1_),
                                                              _fullDg(FullDG), _ipf(ip),  _nonLocalEqRatio(1.), _numNonLocalVariable(0),
 							     _numConstitutiveExtraDofDiffusionVariable(0), _constitutiveExtraDofDiffusionEqRatio(1.),
-							     _constitutiveExtraDofDiffusionOneOverJump(false), _constitutiveExtraDofDiffusionAccountFieldSource(true),
+							     _constitutiveExtraDofDiffusionUseEnergyConjugatedField(false), _constitutiveExtraDofDiffusionAccountFieldSource(true),
 						             _constitutiveExtraDofDiffusionAccountMecaSource(false),
                                                              _mlaw(static_cast<const dG3DMaterialLaw*>(mlaw))
   {
@@ -864,7 +864,7 @@ class dG3DStiffnessBulk : public BilinearTerm<double,double>
     DG->setNumNonLocalVariable(this->getNumNonLocalVariable());
     DG->setNumConstitutiveExtraDofDiffusionVariable(this->getNumConstitutiveExtraDofDiffusionVariable());
     DG->setConstitutiveExtraDofDiffusionEqRatio(this->getConstitutiveExtraDofDiffusionEqRatio());
-    DG->setConstitutiveExtraDofDiffusionUseOneOverJump(this->getConstitutiveExtraDofDiffusionUseOneOverJump());
+    DG->setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(this->getConstitutiveExtraDofDiffusionUseEnergyConjugatedField());
     DG->setConstitutiveExtraDofDiffusionAccountFieldSource(this->getConstitutiveExtraDofDiffusionAccountFieldSource());
     DG->setConstitutiveExtraDofDiffusionAccountMecaSource(this->getConstitutiveExtraDofDiffusionAccountMecaSource());
     return DG;
@@ -890,7 +890,7 @@ class dG3DElasticStiffnessBulk : public dG3DStiffnessBulk{
       DG->setNumNonLocalVariable(this->getNumNonLocalVariable());
       DG->setNumConstitutiveExtraDofDiffusionVariable(this->getNumConstitutiveExtraDofDiffusionVariable());
       DG->setConstitutiveExtraDofDiffusionEqRatio(this->getConstitutiveExtraDofDiffusionEqRatio());
-      DG->setConstitutiveExtraDofDiffusionUseOneOverJump(this->getConstitutiveExtraDofDiffusionUseOneOverJump());
+      DG->setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(this->getConstitutiveExtraDofDiffusionUseEnergyConjugatedField());
       DG->setConstitutiveExtraDofDiffusionAccountFieldSource(this->getConstitutiveExtraDofDiffusionAccountFieldSource());
       DG->setConstitutiveExtraDofDiffusionAccountMecaSource(this->getConstitutiveExtraDofDiffusionAccountMecaSource());
       return DG;
@@ -965,7 +965,7 @@ class dG3DForceInter : public g3DLinearTerm<double>
     DG->setNonLocalStabilityParameter(this->getNonLocalStabilityParameter());
     DG->setNumConstitutiveExtraDofDiffusionVariable(this->getNumConstitutiveExtraDofDiffusionVariable());
     DG->setConstitutiveExtraDofDiffusionEqRatio(this->getConstitutiveExtraDofDiffusionEqRatio());
-    DG->setConstitutiveExtraDofDiffusionUseOneOverJump(this->getConstitutiveExtraDofDiffusionUseOneOverJump());
+    DG->setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(this->getConstitutiveExtraDofDiffusionUseEnergyConjugatedField());
     DG->setConstitutiveExtraDofDiffusionAccountFieldSource(this->getConstitutiveExtraDofDiffusionAccountFieldSource());
     DG->setConstitutiveExtraDofDiffusionAccountMecaSource(this->getConstitutiveExtraDofDiffusionAccountMecaSource());
     DG->setConstitutiveExtraDofDiffusionStabilityParameter(this->getConstitutiveExtraDofDiffusionStabilityParameter());
@@ -998,7 +998,7 @@ class dG3DStiffnessInter : public BilinearTerm<double,double>
   double _constitutiveExtraDofDiffusionStabilityParameter;
   bool _constitutiveExtraDofDiffusionContinuity;
   double _constitutiveExtraDofDiffusionEqRatio;
-  bool _constitutiveExtraDofDiffusionOneOverJump; //we can use it when considering 1/fT
+  bool _constitutiveExtraDofDiffusionUseEnergyConjugatedField; //we can use it when considering 1/fT
   bool _constitutiveExtraDofDiffusionAccountFieldSource;
   bool _constitutiveExtraDofDiffusionAccountMecaSource;
   
@@ -1018,7 +1018,7 @@ class dG3DStiffnessInter : public BilinearTerm<double,double>
                                                                      _interQuad(iquad),_fullDg(fulldg), _perturbation(eps), _nonLocalEqRatio(1.), _numNonLocalVariable(0),
                                                                      _nonLocalContinuity(true), _nonLocalStabilityParameter(beta1_),
                                                                      _numConstitutiveExtraDofDiffusionVariable(0), _constitutiveExtraDofDiffusionEqRatio(1.),
-                                                                     _constitutiveExtraDofDiffusionOneOverJump(false), _constitutiveExtraDofDiffusionAccountFieldSource(true),
+                                                                     _constitutiveExtraDofDiffusionUseEnergyConjugatedField(false), _constitutiveExtraDofDiffusionAccountFieldSource(true),
                                                                      _constitutiveExtraDofDiffusionAccountMecaSource(false),
                                                                      _constitutiveExtraDofDiffusionStabilityParameter(beta1_), _constitutiveExtraDofDiffusionContinuity(true),
                                                                      _incrementNonlocalBased(increBased)
@@ -1039,8 +1039,8 @@ class dG3DStiffnessInter : public BilinearTerm<double,double>
   virtual int getNumConstitutiveExtraDofDiffusionVariable() const {return _numConstitutiveExtraDofDiffusionVariable;}
   virtual void setConstitutiveExtraDofDiffusionEqRatio(double eq) {_constitutiveExtraDofDiffusionEqRatio = eq;}
   virtual double getConstitutiveExtraDofDiffusionEqRatio() const {return _constitutiveExtraDofDiffusionEqRatio;}
-  virtual void setConstitutiveExtraDofDiffusionUseOneOverJump( bool oft){_constitutiveExtraDofDiffusionOneOverJump=oft;} //we can use it when considering 1/fT
-  virtual bool getConstitutiveExtraDofDiffusionUseOneOverJump()const { return _constitutiveExtraDofDiffusionOneOverJump;} //we can use it when considering 1/fT
+  virtual void setConstitutiveExtraDofDiffusionUseEnergyConjugatedField( bool oft){_constitutiveExtraDofDiffusionUseEnergyConjugatedField=oft;} //we can use it when considering 1/fT
+  virtual bool getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()const { return _constitutiveExtraDofDiffusionUseEnergyConjugatedField;} //we can use it when considering 1/fT
   virtual void setConstitutiveExtraDofDiffusionAccountFieldSource(bool so){_constitutiveExtraDofDiffusionAccountFieldSource=so;}
   virtual bool getConstitutiveExtraDofDiffusionAccountFieldSource() const {return _constitutiveExtraDofDiffusionAccountFieldSource;}
   virtual void setConstitutiveExtraDofDiffusionAccountMecaSource(bool so) {_constitutiveExtraDofDiffusionAccountMecaSource=so;}
@@ -1066,7 +1066,7 @@ class dG3DStiffnessInter : public BilinearTerm<double,double>
     DG->setNonLocalStabilityParameter(this->getNonLocalStabilityParameter());
     DG->setNumConstitutiveExtraDofDiffusionVariable(this->getNumConstitutiveExtraDofDiffusionVariable());
     DG->setConstitutiveExtraDofDiffusionEqRatio(this->getConstitutiveExtraDofDiffusionEqRatio());
-    DG->setConstitutiveExtraDofDiffusionUseOneOverJump(this->getConstitutiveExtraDofDiffusionUseOneOverJump());
+    DG->setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(this->getConstitutiveExtraDofDiffusionUseEnergyConjugatedField());
     DG->setConstitutiveExtraDofDiffusionAccountFieldSource(this->getConstitutiveExtraDofDiffusionAccountFieldSource());
     DG->setConstitutiveExtraDofDiffusionAccountMecaSource(this->getConstitutiveExtraDofDiffusionAccountMecaSource());
     DG->setConstitutiveExtraDofDiffusionStabilityParameter(this->getConstitutiveExtraDofDiffusionStabilityParameter());
@@ -1168,7 +1168,9 @@ class ElecTherMechDG3DForceBulk : public dG3DForceBulk
                                        const IPField *ip, const bool increBased, const double ElecTherMechEqRatio, bool ftFv) :
                                        dG3DForceBulk(space1_,mlaw,FullDG,ip,increBased), _ElecTherMechEqRatio(ElecTherMechEqRatio),_useFtFv(ftFv)
   {
-
+    setNumConstitutiveExtraDofDiffusionVariable(2);
+    setConstitutiveExtraDofDiffusionEqRatio(ElecTherMechEqRatio);
+    setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(ftFv);
   }
   virtual ~ElecTherMechDG3DForceBulk(){}
   virtual void get(MElement *ele,int npts,IntPt *GP,fullVector<double> &m) const;
@@ -1199,12 +1201,17 @@ class ElecTherMechDG3DStiffnessBulk : public dG3DStiffnessBulk
                                   dG3DStiffnessBulk(space1_,space2_,mlaw,FullDG,ip), _ElecTherMechEqRatio(ElecTherMechEqRatio),_useFtFv(ftFv)
 
   {
-
+    setNumConstitutiveExtraDofDiffusionVariable(2);
+    setConstitutiveExtraDofDiffusionEqRatio(ElecTherMechEqRatio);
+    setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(ftFv);
   }
   ElecTherMechDG3DStiffnessBulk(FunctionSpace<double>& space1_, const materialLaw* mlaw,
                                   bool FullDG,const IPField *ip, const double ElecTherMechEqRatio,bool ftFv) :
                                   dG3DStiffnessBulk(space1_,mlaw,FullDG,ip), _ElecTherMechEqRatio(ElecTherMechEqRatio),_useFtFv(ftFv)
   {
+    setNumConstitutiveExtraDofDiffusionVariable(2);
+    setConstitutiveExtraDofDiffusionEqRatio(ElecTherMechEqRatio);
+    setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(ftFv);
   }
   virtual ~ElecTherMechDG3DStiffnessBulk(){}
   virtual void get(MElement *ele,int npts,IntPt *GP,fullMatrix<double> &m) const;
@@ -1237,6 +1244,11 @@ class ElecTherMechDG3DForceInter : public dG3DForceInter
                                        mlawMinus, mlawPlus,iquad,beta1_, fdg, ip, increBased), _ElecTherMechBeta(ElecTherMechBeta_),
                                        _continuity(continuity_), _ElecTherMechEqRatio(ElecTherMechEqRatio_),_useFtFv(ftfv)
   {
+    setNumConstitutiveExtraDofDiffusionVariable(2);
+    setConstitutiveExtraDofDiffusionEqRatio(ElecTherMechEqRatio_);
+    setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(ftfv);
+    setConstitutiveExtraDofDiffusionStabilityParameter(ElecTherMechBeta_); 
+    setConstitutiveExtraDofDiffusionContinuity(_continuity); 
   }
   virtual ~ElecTherMechDG3DForceInter() {}
   virtual void get(MElement *ele, int npts, IntPt *GP, fullVector<double> &v)const;
@@ -1272,7 +1284,11 @@ class ElecTherMechDG3DStiffnessInter : public dG3DStiffnessInter
                                           mlawMinus, mlawPlus,iquad,beta1_, ip, uf,fulldg, increBased,eps), _ElecTherMechBeta(ElecTherMechBeta_),
                                        _continuity(continuity_), _ElecTherMechEqRatio(ElecTherMechEqRatio),_useFtFv(ftfv)
   {
-
+    //setNumConstitutiveExtraDofDiffusionVariable(2);
+    setConstitutiveExtraDofDiffusionEqRatio(ElecTherMechEqRatio);
+    setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(ftfv);
+    setConstitutiveExtraDofDiffusionStabilityParameter(ElecTherMechBeta_); 
+    setConstitutiveExtraDofDiffusionContinuity(_continuity); 
   }
   virtual ~ElecTherMechDG3DStiffnessInter() {}
   virtual void get(MElement *ele,int npts,IntPt *GP, fullMatrix<double> &m)const;
diff --git a/dG3D/src/nonLocalDamageDG3DIPVariable.h b/dG3D/src/nonLocalDamageDG3DIPVariable.h
index 6a2c0a580..931aa5d4d 100644
--- a/dG3D/src/nonLocalDamageDG3DIPVariable.h
+++ b/dG3D/src/nonLocalDamageDG3DIPVariable.h
@@ -186,10 +186,14 @@ class virtualNonLocalDamageDG3DIPVariable : public dG3DIPVariableBase{
   virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodLinearKdField() {return _ipvBase->getRefTodLinearKdField();}; 
   virtual const std::vector<std::vector<STensor43>>  &getConstRefTodLinearKdF() const {return _ipvBase->getConstRefTodLinearKdF();}; 
   virtual std::vector<std::vector<STensor43>>  &getRefTodLinearKdF() {return _ipvBase->getRefTodLinearKdF();}; 
-  virtual const std::vector<std::vector<std::vector<STensor3> > >  &getConstRefTodEnergyKdField() const {return _ipvBase->getConstRefTodEnergyKdField();}; 
+/*  virtual const std::vector<std::vector<std::vector<STensor3> > >  &getConstRefTodEnergyKdField() const {return _ipvBase->getConstRefTodEnergyKdField();}; 
   virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodEnergyKdField() {return _ipvBase->getRefTodEnergyKdField();}; 
   virtual const std::vector<std::vector<STensor43>>  &getConstRefTodEnergyKdF() const {return _ipvBase->getConstRefTodEnergyKdF();}; 
-  virtual std::vector<std::vector<STensor43>>  &getRefTodEnergyKdF() {return _ipvBase->getRefTodEnergyKdF();};
+  virtual std::vector<std::vector<STensor43>>  &getRefTodEnergyKdF() {return _ipvBase->getRefTodEnergyKdF();}; */
+  virtual const std::vector<std::vector<std::vector<STensor3> > >  &getConstRefTodFluxdGradFielddField() const {return _ipvBase->getConstRefTodFluxdGradFielddField();}; 
+  virtual std::vector<std::vector<std::vector<STensor3> > >  &getRefTodFluxdGradFielddField() {return _ipvBase->getRefTodFluxdGradFielddField();}; 
+  virtual const std::vector<std::vector<STensor43>>  &getConstRefTodFluxdGradFielddF() const {return _ipvBase->getConstRefTodFluxdGradFielddF();}; 
+  virtual std::vector<std::vector<STensor43>>  &getRefTodFluxdGradFielddF() {return _ipvBase->getRefTodFluxdGradFielddF();};
   virtual int getNumConstitutiveExtraDofDiffusionVariable() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
@@ -316,7 +320,7 @@ class virtualNonLocalDamageDG3DIPVariable : public dG3DIPVariableBase{
          Msg::Fatal("getConstRefTolinearK() : index out of range");
     }
   }
-  virtual const std::vector<std::vector<const STensor3*> > &getConstRefToEnergyK() const
+/*  virtual const std::vector<std::vector<const STensor3*> > &getConstRefToEnergyK() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
       Msg::Fatal("getConstRefToEnergyK() : _constitutiveExtraDofDiffusionData not created");
@@ -334,7 +338,7 @@ class virtualNonLocalDamageDG3DIPVariable : public dG3DIPVariableBase{
       else
          Msg::Fatal("getConstRefToEnergyK() : index out of range");
     }
-  }
+  }*/
   virtual const fullVector<double>  &getConstRefToFieldSource() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
@@ -594,119 +598,119 @@ class virtualNonLocalDamageDG3DIPVariable : public dG3DIPVariableBase{
       return _constitutiveExtraDofDiffusionData->dMechanicalSourcedNonLocalVariable;
   }
 
-  //ThermoField (fT & fv)
+  //Energy Conjugated Field (fT & fv)
 
-  virtual double getConstRefToThermoField(const int idex) const
+  virtual double getConstRefToEnergyConjugatedField(const int idex) const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getConstRefToThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getConstRefToEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->thermoField(idex);
+      return _constitutiveExtraDofDiffusionData->energyConjugatedField(idex);
   }
-  virtual double  &getRefToThermoField(const int idex)
+  virtual double  &getRefToEnergyConjugatedField(const int idex)
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getRefToThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getRefToEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->thermoField(idex);
+      return _constitutiveExtraDofDiffusionData->energyConjugatedField(idex);
   }
-  virtual const std::vector<SVector3>  &getConstRefToGradThermoField() const
+  virtual const std::vector<SVector3>  &getConstRefToGradEnergyConjugatedField() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getConstRefToGradThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getConstRefToGradEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->gradThermoField;
+      return _constitutiveExtraDofDiffusionData->gradEnergyConjugatedField;
   }
-  virtual std::vector<SVector3>  &getRefToGradThermoField()
+  virtual std::vector<SVector3>  &getRefToGradEnergyConjugatedField()
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getRefToGradThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getRefToGradEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->gradThermoField;
+      return _constitutiveExtraDofDiffusionData->gradEnergyConjugatedField;
   }
-  virtual const  std::vector<std::vector<double>>  &getConstRefTodFielddThermoField() const
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodFielddEnergyConjugatedField() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getConstRefTodFielddThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getConstRefTodFielddEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dFielddThermoField;
+      return _constitutiveExtraDofDiffusionData->dFielddEnergyConjugatedField;
   }
-  virtual std::vector<std::vector<double>>  &getRefTodFielddThermoField()
+  virtual std::vector<std::vector<double>>  &getRefTodFielddEnergyConjugatedField()
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getRefTodFielddThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getRefTodFielddEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dFielddThermoField;
+      return _constitutiveExtraDofDiffusionData->dFielddEnergyConjugatedField;
   }
-  virtual const std::vector<std::vector<SVector3>>  &getConstRefTodGradFielddThermoField() const
+  virtual const std::vector<std::vector<SVector3>>  &getConstRefTodGradFielddEnergyConjugatedField() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getConstRefTodGradFielddThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getConstRefTodGradFielddEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dGradFielddThermoField;
+      return _constitutiveExtraDofDiffusionData->dGradFielddEnergyConjugatedField;
   }
-  virtual std::vector<std::vector<SVector3>>  &getRefTodGradFielddThermoField()
+  virtual std::vector<std::vector<SVector3>>  &getRefTodGradFielddEnergyConjugatedField()
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getRefTodGradFielddThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getRefTodGradFielddEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dGradFielddThermoField;
+      return _constitutiveExtraDofDiffusionData->dGradFielddEnergyConjugatedField;
   }
-  virtual const std::vector<std::vector<STensor3>>  &getConstRefTodGradFielddGradThermoField() const
+  virtual const std::vector<std::vector<STensor3>>  &getConstRefTodGradFielddGradEnergyConjugatedField() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getConstRefTodGradFielddGradThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getConstRefTodGradFielddGradEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dGradFielddGradThermoField;
+      return _constitutiveExtraDofDiffusionData->dGradFielddGradEnergyConjugatedField;
   }
-  virtual std::vector<std::vector<STensor3>>  &getRefTodGradFielddGradThermoField()
+  virtual std::vector<std::vector<STensor3>>  &getRefTodGradFielddGradEnergyConjugatedField()
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getRefTodGradFielddGradThermoField() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getRefTodGradFielddGradEnergyConjugatedField() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dGradFielddGradThermoField;
+      return _constitutiveExtraDofDiffusionData->dGradFielddGradEnergyConjugatedField;
   }
-  virtual const fullVector<double>  &getConstRefToThermoFieldJump() const
+  virtual const fullVector<double>  &getConstRefToEnergyConjugatedFieldJump() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getConstRefToThermoFieldJump() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getConstRefToEnergyConjugatedFieldJump() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->thermoFieldJump;
+      return _constitutiveExtraDofDiffusionData->energyConjugatedFieldJump;
   } 
-  virtual fullVector<double>  &getRefToThermoFieldJump()
+  virtual fullVector<double>  &getRefToEnergyConjugatedFieldJump()
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getRefToThermoFieldJump() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getRefToEnergyConjugatedFieldJump() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->thermoFieldJump;
+      return _constitutiveExtraDofDiffusionData->energyConjugatedFieldJump;
   } 
-  virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldm() const
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodEnergyConjugatedFieldJumpdFieldm() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getConstRefTodThermoFieldJumpdFieldm() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getConstRefTodEnergyConjugatedFieldJumpdFieldm() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dThermoFieldJumpdFieldm;
+      return _constitutiveExtraDofDiffusionData->dEnergyConjugatedFieldJumpdFieldm;
   } 
-  virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldm()
+  virtual std::vector<std::vector<double>>  &getRefTodEnergyConjugatedFieldJumpdFieldm()
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getRefTodThermoFieldJumpdFieldm() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getRefTodEnergyConjugatedFieldJumpdFieldm() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dThermoFieldJumpdFieldm;
+      return _constitutiveExtraDofDiffusionData->dEnergyConjugatedFieldJumpdFieldm;
   } 
-  virtual const  std::vector<std::vector<double>>  &getConstRefTodThermoFieldJumpdFieldp() const
+  virtual const  std::vector<std::vector<double>>  &getConstRefTodEnergyConjugatedFieldJumpdFieldp() const
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getConstRefTodThermoFieldJumpdFieldp() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getConstRefTodEnergyConjugatedFieldJumpdFieldp() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dThermoFieldJumpdFieldp;
+      return _constitutiveExtraDofDiffusionData->dEnergyConjugatedFieldJumpdFieldp;
   }
-  virtual std::vector<std::vector<double>>  &getRefTodThermoFieldJumpdFieldp()
+  virtual std::vector<std::vector<double>>  &getRefTodEnergyConjugatedFieldJumpdFieldp()
   {
     if(_constitutiveExtraDofDiffusionData==NULL)
-      Msg::Fatal("getRefTodThermoFieldJumpdFieldp() : _constitutiveExtraDofDiffusionData not created");
+      Msg::Fatal("getRefTodEnergyConjugatedFieldJumpdFieldp() : _constitutiveExtraDofDiffusionData not created");
     else
-      return _constitutiveExtraDofDiffusionData->dThermoFieldJumpdFieldp;
+      return _constitutiveExtraDofDiffusionData->dEnergyConjugatedFieldJumpdFieldp;
   }
 
 };
-- 
GitLab


From bf637de76ffc86e8c3926586c3c09e644b81db94 Mon Sep 17 00:00:00 2001
From: pareja <mpareja@uliege.be>
Date: Mon, 17 Dec 2018 11:42:00 +0100
Subject: [PATCH 5/9] Migration & ElecTherMech mlaws

---
 dG3D/benchmarks/electroThermoSMP/electroThermoSMP.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dG3D/benchmarks/electroThermoSMP/electroThermoSMP.py b/dG3D/benchmarks/electroThermoSMP/electroThermoSMP.py
index 078d915db..621bf627f 100644
--- a/dG3D/benchmarks/electroThermoSMP/electroThermoSMP.py
+++ b/dG3D/benchmarks/electroThermoSMP/electroThermoSMP.py
@@ -1,13 +1,15 @@
 #coding-Utf-8-*-
 from gmshpy import *
 
+
+
 #from dG3DpyDebug import*
 from dG3Dpy import *
 
 
 #script to launch beam problem with a python script
 
-# material law
+# material law#
 lawnum= 1 # unique number of law
 rho   = 1020.
 #young =Ex=Ey=Ez =2.1e11
@@ -119,6 +121,7 @@ myfield1.matrixByPerturbation(0,0,0,1e-8)
 #myfield1.matrixByPerturbation(1,1,1,1e-8)
 myfield1.stabilityParameters(beta1)
 myfield1.ElecTherMechStabilityParameters(beta1,bool(1))
+myfield1.useFtFv(bool(0))
 # creation of Solver
 mysolver = nonLinearMechSolver(1000)
 mysolver.createModel(geofile,meshfile,3,1)
-- 
GitLab


From 4af84c46cc109234a48a22a4015538bdef38afdb Mon Sep 17 00:00:00 2001
From: pareja <mpareja@uliege.be>
Date: Wed, 23 Jan 2019 14:26:46 +0100
Subject: [PATCH 6/9] migration of all electhermech functions finished

---
 dG3D/src/dG3DDomain.cpp      | 368 +++++++++++++--
 dG3D/src/dG3DIPVariable.h    |  28 +-
 dG3D/src/dG3DMaterialLaw.cpp |  36 +-
 dG3D/src/dG3DTerms.cpp       | 887 ++++++++++++++++++++++++++---------
 dG3D/src/dG3DTerms.h         |   4 +-
 5 files changed, 1030 insertions(+), 293 deletions(-)

diff --git a/dG3D/src/dG3DDomain.cpp b/dG3D/src/dG3DDomain.cpp
index 91a9aea00..c90dcff51 100644
--- a/dG3D/src/dG3DDomain.cpp
+++ b/dG3D/src/dG3DDomain.cpp
@@ -856,19 +856,103 @@ void dG3DDomain::computeStrain(MElement *e, const int npts_bulk, IntPt *GP,
     if( ipv->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
       Msg::Fatal("Your material law uses more constitutive extra dof diffusion variables than your domain dG3DDomain::computeStrain bulk");
     for (int extraDOFField = 0; extraDOFField < ipv->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField++){
-      double& T = ipv->getRefToField(extraDOFField);
-      SVector3& gradT = ipv->getRefToGradField()[extraDOFField];
-      T = 0.;
-      STensorOperation::zero(gradT);
+        
+      	double& T = ipv->getRefToField(extraDOFField);
+      	SVector3& gradT = ipv->getRefToGradField()[extraDOFField]; 	
+      	T = 0.;
+      	STensorOperation::zero(gradT);
+
+	      for (int i = 0; i < nbFF; i++)
+      		{
+        	  int indexField=3+getNumNonLocalVariable()+extraDOFField;
+  	           T += Vals[i+indexField*nbFF]*disp(i+indexField*nbFF);
+	           gradT(0) += Grads[i+indexField*nbFF][0]*disp(i+indexField*nbFF);
+                   gradT(1) += Grads[i+indexField*nbFF][1]*disp(i+indexField*nbFF);
+                   gradT(2) += Grads[i+indexField*nbFF][2]*disp(i+indexField*nbFF);
+    	        }
+        
+        if((getNumConstitutiveExtraDofDiffusionVariable() == 2)&&(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()))
+        {
+         double& energyConjugatedField = ipv->getRefToEnergyConjugatedField(extraDOFField);
+         SVector3& gradEnergyConjugatedField = ipv->getRefToGradEnergyConjugatedField()[extraDOFField];
+         energyConjugatedField = 0.;
+         STensorOperation::zero(gradEnergyConjugatedField);
+
+         int extraDOFField_aux=0;
+             if((extraDOFField+1)< ipv->getNumConstitutiveExtraDofDiffusionVariable()) extraDOFField_aux=extraDOFField+1;
+             else extraDOFField_aux=extraDOFField-1;  
+
+         double& dFielddEnergyConjugatedField = ipv->getRefTodFielddEnergyConjugatedField()[extraDOFField][extraDOFField];
+         double& dFielddEnergyConjugatedField2 = ipv->getRefTodFielddEnergyConjugatedField()[extraDOFField][extraDOFField_aux];
+         SVector3& dGradFielddEnergyConjugatedField = ipv->getRefTodGradFielddEnergyConjugatedField()[extraDOFField][extraDOFField];
+         SVector3& dGradFielddEnergyConjugatedField2 = ipv->getRefTodGradFielddEnergyConjugatedField()[extraDOFField][extraDOFField_aux];
+         STensor3& dGradFielddGradEnergyConjugatedField = ipv->getRefTodGradFielddGradEnergyConjugatedField()[extraDOFField][extraDOFField];
+         STensor3& dGradFielddGradEnergyConjugatedField2 = ipv->getRefTodGradFielddGradEnergyConjugatedField()[extraDOFField][extraDOFField_aux];
+ 
+         STensorOperation::zero(dGradFielddGradEnergyConjugatedField); STensorOperation::zero(dGradFielddGradEnergyConjugatedField2);
+
+         int indexFieldfT=3+getNumNonLocalVariable()+extraDOFField;
+
+          for (int i = 0; i < nbFF; i++)
+           {
+             const double& ftemp = disp(i+indexFieldfT*nbFF);
+              energyConjugatedField += Vals[i+indexFieldfT*nbFF]*ftemp;
+              gradEnergyConjugatedField(0) += Grads[i+indexFieldfT*nbFF][0]*ftemp;
+              gradEnergyConjugatedField(1) += Grads[i+indexFieldfT*nbFF][1]*ftemp;
+              gradEnergyConjugatedField(2) += Grads[i+indexFieldfT*nbFF][2]*ftemp;
+            }
+         
+           if(extraDOFField == 0)
+            {
+             T = 1/(energyConjugatedField);
 
-      for (int i = 0; i < nbFF; i++)
-      {
-        int indexField=3+getNumNonLocalVariable();
-        T += Vals[i+indexField*nbFF]*disp(i+indexField*nbFF);
-        gradT(0) += Grads[i+indexField*nbFF][0]*disp(i+indexField*nbFF);
-        gradT(1) += Grads[i+indexField*nbFF][1]*disp(i+indexField*nbFF);
-        gradT(2) += Grads[i+indexField*nbFF][2]*disp(i+indexField*nbFF);
-      }
+             gradT(0)=-1/(pow(energyConjugatedField,2))*(gradEnergyConjugatedField(0));
+             gradT(1)=-1/(pow(energyConjugatedField,2))*(gradEnergyConjugatedField(1));
+             gradT(2)=-1/(pow(energyConjugatedField,2))*(gradEnergyConjugatedField(2));
+  
+             dFielddEnergyConjugatedField  = -1./(energyConjugatedField)/(energyConjugatedField);
+             dFielddEnergyConjugatedField2 = 0.;
+
+             dGradFielddEnergyConjugatedField(0)=2/(energyConjugatedField)/(energyConjugatedField)/(energyConjugatedField)*(gradEnergyConjugatedField(0));
+             dGradFielddEnergyConjugatedField(1)=2/(energyConjugatedField)/(energyConjugatedField)/(energyConjugatedField)*(gradEnergyConjugatedField(1));
+             dGradFielddEnergyConjugatedField(2)=2/(energyConjugatedField)/(energyConjugatedField)/(energyConjugatedField)*(gradEnergyConjugatedField(2));
+
+             dGradFielddEnergyConjugatedField2(0)=0.;
+             dGradFielddEnergyConjugatedField2(1)=0.;
+             dGradFielddEnergyConjugatedField2(2)=0.;
+             
+             STensorOperation::diag(dGradFielddGradEnergyConjugatedField,-1./(energyConjugatedField)/(energyConjugatedField));
+
+            }
+           else
+            {
+            
+             double fT = ipv->getConstRefToEnergyConjugatedField(0);
+             SVector3 gradfT = ipv->getConstRefToGradEnergyConjugatedField()[0];
+             
+             T = -1*(energyConjugatedField)/(fT);
+
+             gradT(0)= -1/(fT)*(gradEnergyConjugatedField(0))+(energyConjugatedField)/(pow(fT,2))*(gradfT(0));
+             gradT(1)= -1/(fT)*(gradEnergyConjugatedField(1))+(energyConjugatedField)/(pow(fT,2))*(gradfT(1));
+             gradT(2)= -1/(fT)*(gradEnergyConjugatedField(2))+(energyConjugatedField)/(pow(fT,2))*(gradfT(2));
+
+             dFielddEnergyConjugatedField=-1./(fT);
+             dFielddEnergyConjugatedField2=(energyConjugatedField)/(fT)/(fT);
+
+             dGradFielddEnergyConjugatedField(0)=1./(fT)/(fT)*(gradfT(0));
+             dGradFielddEnergyConjugatedField(1)=1./(fT)/(fT)*(gradfT(1));
+             dGradFielddEnergyConjugatedField(2)=1./(fT)/(fT)*(gradfT(2));
+
+             dGradFielddEnergyConjugatedField2(0)=1./(fT)/(fT)*(gradEnergyConjugatedField(0))-2*(energyConjugatedField)/(fT)/(fT)/(fT)*(gradfT(0));
+             dGradFielddEnergyConjugatedField2(1)=1./(fT)/(fT)*(gradEnergyConjugatedField(1))-2*(energyConjugatedField)/(fT)/(fT)/(fT)*(gradfT(1));
+             dGradFielddEnergyConjugatedField2(2)=1./(fT)/(fT)*(gradEnergyConjugatedField(2))-2*(energyConjugatedField)/(fT)/(fT)/(fT)*(gradfT(2));
+    
+             STensorOperation::diag(dGradFielddGradEnergyConjugatedField,-1./(fT));
+             STensorOperation::diag(dGradFielddGradEnergyConjugatedField2,(energyConjugatedField)/(fT)/(fT));
+
+
+            }
+        }
     }
   }
 }
@@ -1371,12 +1455,95 @@ void dG3DDomain::computeStrain(AllIPState *aips,MInterfaceElement *ie, IntPt *GP
         STensorOperation::zero(gradTm);
         for (int i = 0; i < nbFFm; i++)
         {
-          int indexField=3+getNumNonLocalVariable();
+          int indexField=3+getNumNonLocalVariable()+extraDOFFieldm;
           Tm += Valm[i+indexField*nbFFm]*dispm(i+indexField*nbFFm);
           gradTm(0) += Gradm[i+indexField*nbFFm][0]*dispm(i+indexField*nbFFm);
           gradTm(1) += Gradm[i+indexField*nbFFm][1]*dispm(i+indexField*nbFFm);
           gradTm(2) += Gradm[i+indexField*nbFFm][2]*dispm(i+indexField*nbFFm);
         }
+
+        if((ipvm->getNumConstitutiveExtraDofDiffusionVariable() == 2)&&(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()))
+        {
+         double& energyConjugatedFieldm = ipvm->getRefToEnergyConjugatedField(extraDOFFieldm);
+         SVector3& gradEnergyConjugatedFieldm = ipvm->getRefToGradEnergyConjugatedField()[extraDOFFieldm];
+         energyConjugatedFieldm = 0.;
+         STensorOperation::zero(gradEnergyConjugatedFieldm);
+
+         int extraDOFField_aux=0;
+             if((extraDOFFieldm+1)< ipvm->getNumConstitutiveExtraDofDiffusionVariable()) extraDOFField_aux=extraDOFFieldm+1;
+             else extraDOFField_aux=extraDOFFieldm-1;  
+
+         double& dFielddEnergyConjugatedFieldm = ipvm->getRefTodFielddEnergyConjugatedField()[extraDOFFieldm][extraDOFFieldm];
+         double& dFielddEnergyConjugatedField2m = ipvm->getRefTodFielddEnergyConjugatedField()[extraDOFFieldm][extraDOFField_aux];
+         SVector3& dGradFielddEnergyConjugatedFieldm = ipvm->getRefTodGradFielddEnergyConjugatedField()[extraDOFFieldm][extraDOFFieldm];
+         SVector3& dGradFielddEnergyConjugatedField2m = ipvm->getRefTodGradFielddEnergyConjugatedField()[extraDOFFieldm][extraDOFField_aux];
+         STensor3& dGradFielddGradEnergyConjugatedFieldm = ipvm->getRefTodGradFielddGradEnergyConjugatedField()[extraDOFFieldm][extraDOFFieldm];
+         STensor3& dGradFielddGradEnergyConjugatedField2m = ipvm->getRefTodGradFielddGradEnergyConjugatedField()[extraDOFFieldm][extraDOFField_aux];
+ 
+         STensorOperation::zero(dGradFielddGradEnergyConjugatedFieldm); STensorOperation::zero(dGradFielddGradEnergyConjugatedField2m);
+
+         int indexFieldfT=3+getNumNonLocalVariable()+extraDOFFieldm;
+
+          for (int i = 0; i < nbFFm; i++)
+           {
+             const double& ftemp = dispm(i+indexFieldfT*nbFFm);
+              energyConjugatedFieldm += Valm[i+indexFieldfT*nbFFm]*ftemp;
+              gradEnergyConjugatedFieldm(0) += Gradm[i+indexFieldfT*nbFFm][0]*ftemp;
+              gradEnergyConjugatedFieldm(1) += Gradm[i+indexFieldfT*nbFFm][1]*ftemp;
+              gradEnergyConjugatedFieldm(2) += Gradm[i+indexFieldfT*nbFFm][2]*ftemp;
+            }
+         
+           if(extraDOFFieldm == 0)
+            {
+             Tm = 1/(energyConjugatedFieldm);
+
+             gradTm(0)=-1/(pow(energyConjugatedFieldm,2))*(gradEnergyConjugatedFieldm(0));
+             gradTm(1)=-1/(pow(energyConjugatedFieldm,2))*(gradEnergyConjugatedFieldm(1));
+             gradTm(2)=-1/(pow(energyConjugatedFieldm,2))*(gradEnergyConjugatedFieldm(2));
+  
+             dFielddEnergyConjugatedFieldm  = -1./(energyConjugatedFieldm)/(energyConjugatedFieldm);
+             dFielddEnergyConjugatedField2m = 0.;
+
+             dGradFielddEnergyConjugatedFieldm(0)=2/(energyConjugatedFieldm)/(energyConjugatedFieldm)/(energyConjugatedFieldm)*(gradEnergyConjugatedFieldm(0));
+             dGradFielddEnergyConjugatedFieldm(1)=2/(energyConjugatedFieldm)/(energyConjugatedFieldm)/(energyConjugatedFieldm)*(gradEnergyConjugatedFieldm(1));
+             dGradFielddEnergyConjugatedFieldm(2)=2/(energyConjugatedFieldm)/(energyConjugatedFieldm)/(energyConjugatedFieldm)*(gradEnergyConjugatedFieldm(2));
+
+             dGradFielddEnergyConjugatedField2m(0)=0.;
+             dGradFielddEnergyConjugatedField2m(1)=0.;
+             dGradFielddEnergyConjugatedField2m(2)=0.;
+             
+             STensorOperation::diag(dGradFielddGradEnergyConjugatedFieldm,-1./(energyConjugatedFieldm)/(energyConjugatedFieldm));
+             
+
+            }
+           else
+            {
+            
+             double fTm = ipvm->getConstRefToEnergyConjugatedField(0);
+             SVector3 gradfTm = ipvm->getConstRefToGradEnergyConjugatedField()[0];
+             
+             Tm = -1*(energyConjugatedFieldm)/(fTm);
+
+             gradTm(0)= -1/(fTm)*(gradEnergyConjugatedFieldm(0))+(energyConjugatedFieldm)/(pow(fTm,2))*(gradfTm(0));
+             gradTm(1)= -1/(fTm)*(gradEnergyConjugatedFieldm(1))+(energyConjugatedFieldm)/(pow(fTm,2))*(gradfTm(1));
+             gradTm(2)= -1/(fTm)*(gradEnergyConjugatedFieldm(2))+(energyConjugatedFieldm)/(pow(fTm,2))*(gradfTm(2));
+
+             dFielddEnergyConjugatedFieldm  = -1./(fTm);
+             dFielddEnergyConjugatedField2m = (energyConjugatedFieldm)/(fTm)/(fTm);
+
+             dGradFielddEnergyConjugatedFieldm(0)=1./(fTm)/(fTm)*(gradfTm(0));
+             dGradFielddEnergyConjugatedFieldm(1)=1./(fTm)/(fTm)*(gradfTm(1));
+             dGradFielddEnergyConjugatedFieldm(2)=1./(fTm)/(fTm)*(gradfTm(2));
+
+             dGradFielddEnergyConjugatedField2m(0)=1./(fTm)/(fTm)*(gradEnergyConjugatedFieldm(0))-2*(energyConjugatedFieldm)/(fTm)/(fTm)/(fTm)*(gradfTm(0));
+             dGradFielddEnergyConjugatedField2m(1)=1./(fTm)/(fTm)*(gradEnergyConjugatedFieldm(1))-2*(energyConjugatedFieldm)/(fTm)/(fTm)/(fTm)*(gradfTm(1));
+             dGradFielddEnergyConjugatedField2m(2)=1./(fTm)/(fTm)*(gradEnergyConjugatedFieldm(2))-2*(energyConjugatedFieldm)/(fTm)/(fTm)/(fTm)*(gradfTm(2));
+    
+             STensorOperation::diag(dGradFielddGradEnergyConjugatedFieldm,-1./(fTm));
+             STensorOperation::diag(dGradFielddGradEnergyConjugatedField2m,(energyConjugatedFieldm)/(fTm)/(fTm));
+
+            }
+        }
       }
       if( ipvp->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() )
         Msg::Fatal("Your material law uses more constitutive extra dof diffusion variables than your domain dG3DDomain::computeStrain bulk");
@@ -1389,50 +1556,159 @@ void dG3DDomain::computeStrain(AllIPState *aips,MInterfaceElement *ie, IntPt *GP
 
         for (int i = 0; i < nbFFp; i++)
         {
-          int indexField=3+getNumNonLocalVariable();
+          int indexField=3+getNumNonLocalVariable()+extraDOFFieldp;
           Tp += Valp[i+indexField*nbFFp]*dispp(i+indexField*nbFFp);
           gradTp(0) += Gradp[i+indexField*nbFFp][0]*dispp(i+indexField*nbFFp);
           gradTp(1) += Gradp[i+indexField*nbFFp][1]*dispp(i+indexField*nbFFp);
           gradTp(2) += Gradp[i+indexField*nbFFp][2]*dispp(i+indexField*nbFFp);
         }
+
+        if((ipvp->getNumConstitutiveExtraDofDiffusionVariable() == 2)&&(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()))
+        {
+         double& energyConjugatedFieldp = ipvp->getRefToEnergyConjugatedField(extraDOFFieldp);
+         SVector3& gradEnergyConjugatedFieldp = ipvp->getRefToGradEnergyConjugatedField()[extraDOFFieldp];
+         energyConjugatedFieldp = 0.;
+         STensorOperation::zero(gradEnergyConjugatedFieldp);
+
+         int extraDOFField_aux=0;
+             if((extraDOFFieldp+1)< ipvp->getNumConstitutiveExtraDofDiffusionVariable()) extraDOFField_aux=extraDOFFieldp+1;
+             else extraDOFField_aux=extraDOFFieldp-1;  
+
+         double& dFielddEnergyConjugatedFieldp = ipvp->getRefTodFielddEnergyConjugatedField()[extraDOFFieldp][extraDOFFieldp];
+         double& dFielddEnergyConjugatedField2p = ipvp->getRefTodFielddEnergyConjugatedField()[extraDOFFieldp][extraDOFField_aux];
+         SVector3& dGradFielddEnergyConjugatedFieldp = ipvp->getRefTodGradFielddEnergyConjugatedField()[extraDOFFieldp][extraDOFFieldp];
+         SVector3& dGradFielddEnergyConjugatedField2p = ipvp->getRefTodGradFielddEnergyConjugatedField()[extraDOFFieldp][extraDOFField_aux];
+         STensor3& dGradFielddGradEnergyConjugatedFieldp = ipvp->getRefTodGradFielddGradEnergyConjugatedField()[extraDOFFieldp][extraDOFFieldp];
+         STensor3& dGradFielddGradEnergyConjugatedField2p = ipvp->getRefTodGradFielddGradEnergyConjugatedField()[extraDOFFieldp][extraDOFField_aux];
+ 
+         STensorOperation::zero(dGradFielddGradEnergyConjugatedFieldp); STensorOperation::zero(dGradFielddGradEnergyConjugatedField2p);
+
+         int indexFieldfT=3+getNumNonLocalVariable()+extraDOFFieldp;
+
+          for (int i = 0; i < nbFFp; i++)
+           {
+             const double& ftemp = dispp(i+indexFieldfT*nbFFp);
+              energyConjugatedFieldp += Valp[i+indexFieldfT*nbFFp]*ftemp;
+              gradEnergyConjugatedFieldp(0) += Gradp[i+indexFieldfT*nbFFp][0]*ftemp;
+              gradEnergyConjugatedFieldp(1) += Gradp[i+indexFieldfT*nbFFp][1]*ftemp;
+              gradEnergyConjugatedFieldp(2) += Gradp[i+indexFieldfT*nbFFp][2]*ftemp;
+            }
+         
+           if(extraDOFFieldp == 0)
+            {
+             Tp = 1/(energyConjugatedFieldp);
+
+             gradTp(0)=-1/(pow(energyConjugatedFieldp,2))*(gradEnergyConjugatedFieldp(0));
+             gradTp(1)=-1/(pow(energyConjugatedFieldp,2))*(gradEnergyConjugatedFieldp(1));
+             gradTp(2)=-1/(pow(energyConjugatedFieldp,2))*(gradEnergyConjugatedFieldp(2));
+  
+             dFielddEnergyConjugatedFieldp  = -1./(energyConjugatedFieldp)/(energyConjugatedFieldp);
+             dFielddEnergyConjugatedField2p = 0.;
+
+             dGradFielddEnergyConjugatedFieldp(0)=2/(energyConjugatedFieldp)/(energyConjugatedFieldp)/(energyConjugatedFieldp)*(gradEnergyConjugatedFieldp(0));
+             dGradFielddEnergyConjugatedFieldp(1)=2/(energyConjugatedFieldp)/(energyConjugatedFieldp)/(energyConjugatedFieldp)*(gradEnergyConjugatedFieldp(1));
+             dGradFielddEnergyConjugatedFieldp(2)=2/(energyConjugatedFieldp)/(energyConjugatedFieldp)/(energyConjugatedFieldp)*(gradEnergyConjugatedFieldp(2));
+
+             dGradFielddEnergyConjugatedField2p(0)=0.;
+             dGradFielddEnergyConjugatedField2p(1)=0.;
+             dGradFielddEnergyConjugatedField2p(2)=0.;
+             
+             STensorOperation::diag(dGradFielddGradEnergyConjugatedFieldp,-1./(energyConjugatedFieldp)/(energyConjugatedFieldp));
+
+            }
+           else
+            {
+            
+             double fTp = ipvp->getConstRefToEnergyConjugatedField(0);
+             SVector3 gradfTp = ipvp->getConstRefToGradEnergyConjugatedField()[0];
+             
+             Tp = -1*(energyConjugatedFieldp)/(fTp);
+
+             gradTp(0)= -1/(fTp)*(gradEnergyConjugatedFieldp(0))+(energyConjugatedFieldp)/(pow(fTp,2))*(gradfTp(0));
+             gradTp(1)= -1/(fTp)*(gradEnergyConjugatedFieldp(1))+(energyConjugatedFieldp)/(pow(fTp,2))*(gradfTp(1));
+             gradTp(2)= -1/(fTp)*(gradEnergyConjugatedFieldp(2))+(energyConjugatedFieldp)/(pow(fTp,2))*(gradfTp(2));
+
+             dFielddEnergyConjugatedFieldp  = -1./(fTp);
+             dFielddEnergyConjugatedField2p = (energyConjugatedFieldp)/(fTp)/(fTp);
+
+             dGradFielddEnergyConjugatedFieldp(0)=1./(fTp)/(fTp)*(gradfTp(0));
+             dGradFielddEnergyConjugatedFieldp(1)=1./(fTp)/(fTp)*(gradfTp(1));
+             dGradFielddEnergyConjugatedFieldp(2)=1./(fTp)/(fTp)*(gradfTp(2));
+
+             dGradFielddEnergyConjugatedField2p(0)=1./(fTp)/(fTp)*(gradEnergyConjugatedFieldp(0))-2*(energyConjugatedFieldp)/(fTp)/(fTp)/(fTp)*(gradfTp(0));
+             dGradFielddEnergyConjugatedField2p(1)=1./(fTp)/(fTp)*(gradEnergyConjugatedFieldp(1))-2*(energyConjugatedFieldp)/(fTp)/(fTp)/(fTp)*(gradfTp(1));
+             dGradFielddEnergyConjugatedField2p(2)=1./(fTp)/(fTp)*(gradEnergyConjugatedFieldp(2))-2*(energyConjugatedFieldp)/(fTp)/(fTp)/(fTp)*(gradfTp(2));
+    
+             STensorOperation::diag(dGradFielddGradEnergyConjugatedFieldp,-1./(fTp));
+             STensorOperation::diag(dGradFielddGradEnergyConjugatedField2p,(energyConjugatedFieldp)/(fTp)/(fTp));
+
+            }
+        }
       }
       // compute the jump
       for (int extraDOFField = 0; extraDOFField < ipvm->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField++)
       {
-        double& tempjump= ipvm->getRefToFieldJump()(extraDOFField);
-        computeExtraFieldJump(3+getNumNonLocalVariable(),Valm,nbFFm,Valp,nbFFp,dispm,dispp,tempjump);
-        double tpj=tempjump;
-        ipvp->getRefToFieldJump()(extraDOFField) = tpj;
-        // compute 1/T jump to be energetically consistent
-        if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
+        int indexField=3+getNumNonLocalVariable()+extraDOFField;
+
+        if(ipvm->getNumConstitutiveExtraDofDiffusionVariable()==1) //thermomec
         {
-          if(ipvm->getNumConstitutiveExtraDofDiffusionVariable()==1) //thermomec
-          {
-            double& ftjump= ipvm->getRefToOneOverFieldJump()(extraDOFField);
-            //here we assume no cross dependency
-            static bool msg=false;
-            if(getNumConstitutiveExtraDofDiffusionVariable()>1)
-            {
-              if(!msg)
-              {
-                Msg::Info("we assume no cross dependency between the 1/ft constitutive extra dof domain dG3DDomain::computeStrain bulk");
-                msg=true;
-              }
-            }
-            double& dftjumpdTp = ipvp->getRefTodOneOverFieldJumpdFieldp()(extraDOFField,extraDOFField);
-            double& dftjumpdTm = ipvm->getRefTodOneOverFieldJumpdFieldm()(extraDOFField,extraDOFField);
+          double& tempjump= ipvm->getRefToFieldJump()(extraDOFField);
+          computeExtraFieldJump(indexField,Valm,nbFFm,Valp,nbFFp,dispm,dispp,tempjump);
+          double tpj=tempjump;
+          ipvp->getRefToFieldJump()(extraDOFField) = tpj;
+          // compute 1/T jump to be energetically consistent
+          if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
+          {         
+            double& ftjump = ipvm->getRefToEnergyConjugatedFieldJump()(extraDOFField);
+            double& dftjumpdTp = ipvp->getRefTodEnergyConjugatedFieldJumpdFieldp()[extraDOFField][extraDOFField];
+            double& dftjumpdTm = ipvm->getRefTodEnergyConjugatedFieldJumpdFieldm()[extraDOFField][extraDOFField];
             computeftjump(3+getNumNonLocalVariable(),Valm,nbFFm,Valp,nbFFp,dispm,dispp,ftjump,dftjumpdTp,dftjumpdTm);
-            ipvp->getRefToOneOverFieldJump()(extraDOFField) = ftjump;
-            ipvm->getRefTodOneOverFieldJumpdFieldp()(extraDOFField,extraDOFField) = dftjumpdTp;
-            ipvp->getRefTodOneOverFieldJumpdFieldm()(extraDOFField,extraDOFField) = dftjumpdTm;
+            ipvp->getRefToEnergyConjugatedFieldJump()(extraDOFField) = ftjump;
+            ipvm->getRefTodEnergyConjugatedFieldJumpdFieldm()[extraDOFField][extraDOFField] = dftjumpdTm;
+            ipvp->getRefTodEnergyConjugatedFieldJumpdFieldp()[extraDOFField][extraDOFField] = dftjumpdTp;
           }
-          else if(ipvm->getNumConstitutiveExtraDofDiffusionVariable()==2) //elecTher
-          {
-
+        }
+        else if(ipvm->getNumConstitutiveExtraDofDiffusionVariable()==2) //elecThermech
+        { 
+          if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
+          {  
+           double& ftjump = ipvm->getRefToEnergyConjugatedFieldJump()(extraDOFField);
+           computeExtraFieldJump(indexField,Valm,nbFFm,Valp,nbFFp,dispm,dispp,ftjump);
+           double tpj=ftjump;
+           ipvp->getRefToEnergyConjugatedFieldJump()(extraDOFField) = tpj;
           }
           else
-            Msg::Fatal("UseEnergyConjugatedField with more than 2 extra dofs not implemented");
+          {
+            double& tempjump= ipvm->getRefToFieldJump()(extraDOFField);
+            computeExtraFieldJump(indexField,Valm,nbFFm,Valp,nbFFp,dispm,dispp,tempjump);
+            double tpj =tempjump;
+            ipvp->getRefToFieldJump()(extraDOFField) = tpj;
+             
+            double& ftjump = ipvm->getRefToEnergyConjugatedFieldJump()(extraDOFField);
+            double& dftjumpdTp = ipvp->getRefTodEnergyConjugatedFieldJumpdFieldp()[extraDOFField][extraDOFField];
+            double& dftjumpdTm = ipvm->getRefTodEnergyConjugatedFieldJumpdFieldm()[extraDOFField][extraDOFField];
+            
+            if(extraDOFField==0)
+            {
+              computeftjump(indexField,Valm,nbFFm,Valp,nbFFp,dispm,dispp,ftjump,dftjumpdTp,dftjumpdTm);
+              ipvp->getRefToEnergyConjugatedFieldJump()(extraDOFField) = ftjump;
+              ipvm->getRefTodEnergyConjugatedFieldJumpdFieldm()[extraDOFField][extraDOFField] = dftjumpdTm;
+              ipvp->getRefTodEnergyConjugatedFieldJumpdFieldp()[extraDOFField][extraDOFField] = dftjumpdTp;
+            }
+            else
+            {
+             double& dftjumpdT2p = ipvp->getRefTodEnergyConjugatedFieldJumpdFieldp()[extraDOFField][0];
+             double& dftjumpdT2m = ipvm->getRefTodEnergyConjugatedFieldJumpdFieldm()[extraDOFField][0];
+             computefvjump(indexField-1,indexField,Valm,nbFFm,Valp,nbFFp,dispm,dispp,ftjump,dftjumpdT2p,dftjumpdT2m,dftjumpdTp,dftjumpdTm); 
+             ipvp->getRefToEnergyConjugatedFieldJump()(extraDOFField) = ftjump;
+             ipvm->getRefTodEnergyConjugatedFieldJumpdFieldm()[extraDOFField][extraDOFField] = dftjumpdTm;
+             ipvp->getRefTodEnergyConjugatedFieldJumpdFieldp()[extraDOFField][extraDOFField] = dftjumpdTp;
+             ipvm->getRefTodEnergyConjugatedFieldJumpdFieldm()[extraDOFField][0] = dftjumpdT2m;
+             ipvp->getRefTodEnergyConjugatedFieldJumpdFieldp()[extraDOFField][0] = dftjumpdT2p;
+            }
+          }
         }
+        else Msg::Fatal("UseEnergyConjugatedField with more than 2 extra dofs not implemented");
       }
       //
     }
@@ -4428,7 +4704,7 @@ void ElecTherMechDG3DDomain::computeStrain(MElement *e, const int npts_bulk, Int
   if (!getElementErosionFilter()(e)) return;
 
   dG3DDomain::computeStrain(e, npts_bulk,GP,vips, ws,disp);
-  int nbFF = e->getNumShapeFunctions();
+ /* int nbFF = e->getNumShapeFunctions();
   for(int j=0;j<npts_bulk;j++){
 
     IPStateBase* ips = (*vips)[j];
@@ -4573,7 +4849,7 @@ void ElecTherMechDG3DDomain::computeStrain(MElement *e, const int npts_bulk, Int
         gradV->operator()(2) += Grads[i+indexFieldV*nbFF][2]*volt;
       }
     }
-  }
+  }*/
 };
 
 
@@ -4586,7 +4862,7 @@ void ElecTherMechDG3DDomain::computeStrain(AllIPState *aips,MInterfaceElement *i
 
   if(!virt){
     dG3DDomain::computeStrain(aips,ie, GP,ws,efMinus,efPlus, dispm,dispp,dispExtra,virt);
-    int npts=integBound->getIntPoints(ele,&GP);
+  /*  int npts=integBound->getIntPoints(ele,&GP);
     // Get Gauss points values on minus and plus elements
     IntPt *GPm; IntPt *GPp;
     _interQuad->getIntPoints(ie,GP,&GPm,&GPp);
@@ -4913,7 +5189,7 @@ void ElecTherMechDG3DDomain::computeStrain(AllIPState *aips,MInterfaceElement *i
         ipvm->getRefTodOneOverTemperatureJumpdTm() = dftjumpdTm;
         ipvp->getRefTodOneOverTemperatureJumpdTp() = dftjumpdTp;
       }
-    }
+    }*/
   }
   else
   {  // Virtual interface element
diff --git a/dG3D/src/dG3DIPVariable.h b/dG3D/src/dG3DIPVariable.h
index 69d2e7a47..8b702fdc3 100644
--- a/dG3D/src/dG3DIPVariable.h
+++ b/dG3D/src/dG3DIPVariable.h
@@ -1867,14 +1867,14 @@ class ThermoMechanicsDG3DIPVariableBase : public dG3DIPVariable, public extraDof
   virtual const double getConstRefToTemperatureJump() const {return getConstRefToFieldJump()(0);}
   virtual double &getRefToTemperatureJump() {return  getRefToFieldJump()(0);}
 
-  virtual const double getConstRefToOneOverTemperatureJump() const {return getConstRefToOneOverFieldJump()(0);}
-  virtual double &getRefToOneOverTemperatureJump() {return  getRefToOneOverFieldJump()(0);}
+  virtual const double getConstRefToOneOverTemperatureJump() const {return getConstRefToEnergyConjugatedFieldJump()(0);}
+  virtual double &getRefToOneOverTemperatureJump() {return  getRefToEnergyConjugatedFieldJump()(0);}
 
-  virtual const double getConstRefTodOneOverTemperatureJumpdFieldm() const {return getConstRefTodOneOverFieldJumpdFieldm()(0,0);}
-  virtual double &getRefTodOneOverTemperatureJumpdFieldm() {return  getRefTodOneOverFieldJumpdFieldm()(0,0);}
+  virtual const double getConstRefTodOneOverTemperatureJumpdFieldm() const {return getConstRefTodEnergyConjugatedFieldJumpdFieldm()[0][0];}
+  virtual double &getRefTodOneOverTemperatureJumpdFieldm() {return  getRefTodEnergyConjugatedFieldJumpdFieldm()[0][0];}
 
-  virtual const double getConstRefTodOneOverTemperatureJumpdFieldp() const {return getConstRefTodOneOverFieldJumpdFieldp()(0,0);}
-  virtual double &getRefTodOneOverTemperaturedJumpdFieldp() {return  getRefTodOneOverFieldJumpdFieldp()(0,0);}
+  virtual const double getConstRefTodOneOverTemperatureJumpdFieldp() const {return getConstRefTodEnergyConjugatedFieldJumpdFieldp()[0][0];}
+  virtual double &getRefTodOneOverTemperaturedJumpdFieldp() {return  getRefTodEnergyConjugatedFieldJumpdFieldp()[0][0];}
 
   virtual const double getConstRefToThermalSource() const {return getConstRefToFieldSource()(0);}
   virtual double &getRefToThermalSource() {return  getRefToFieldSource()(0);}
@@ -2236,14 +2236,14 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   virtual const SVector3 &getConstRefToGradT() const {return getConstRefToGradField()[0];}
   virtual SVector3 &getRefToGradT() {return getRefToGradField()[0];}
 
-  virtual const SVector3 &getConstRefToThermalFlux() const {return getConstRefToFlux()[0];}
-  virtual SVector3 &getRefToThermalFlux() {return getRefToFlux()[0];}
+ /* virtual const SVector3 &getConstRefToThermalFlux() const {return getConstRefToFlux()[0];}
+  virtual SVector3 &getRefToThermalFlux() {return getRefToFlux()[0];}*/
 
   virtual  const STensor3 &getConstRefTodPdT() const {return getConstRefTodPdField()[0];}
   virtual  STensor3 &getRefTodPdT() {return getRefTodPdField()[0];}
 
-  virtual const  STensor3 &getConstRefTodThermalFluxdGradT() const {return  getConstRefTodFluxdGradField()[0][0];}
-  virtual  STensor3 &getRefTodThermalFluxdGradT() {return  getRefTodFluxdGradField()[0][0];}
+ /* virtual const  STensor3 &getConstRefTodThermalFluxdGradT() const {return  getConstRefTodFluxdGradField()[0][0];}
+  virtual  STensor3 &getRefTodThermalFluxdGradT() {return  getRefTodFluxdGradField()[0][0];}*/
 
   virtual const  SVector3 &getConstRefTodFluxTdV() const {return  getConstRefTodFluxdField()[0][1];}
   virtual  SVector3 &getRefTodFluxTdV() {return  getRefTodFluxdField()[0][1];}
@@ -2251,11 +2251,11 @@ class ElecTherMechDG3DIPVariableBase : public dG3DIPVariable
   virtual const  STensor3 &getConstRefTodFluxTdGradV() const {return  getConstRefTodFluxdGradField()[0][1];}//dqdgradV,
   virtual  STensor3 &getRefTodFluxTdGradV() {return  getRefTodFluxdGradField()[0][1];}
 
-  virtual const  SVector3 &getConstRefTodFluxTdT() const {return  getConstRefTodFluxdField()[0][0];}
-  virtual  SVector3 &getRefTodFluxTdT() {return  getRefTodFluxdField()[0][0];}
+/* virtual const  SVector3 &getConstRefTodFluxTdT() const {return  getConstRefTodFluxdField()[0][0];}
+  virtual  SVector3 &getRefTodFluxTdT() {return  getRefTodFluxdField()[0][0];}*/
 
-  virtual const  STensor33 &getConstRefTodThermalFluxdF() const {return  getConstRefTodFluxdF()[0];}
-  virtual  STensor33 &getRefTodThermalFluxdF() {return  getRefTodFluxdF()[0];}
+/*  virtual const  STensor33 &getConstRefTodThermalFluxdF() const {return  getConstRefTodFluxdF()[0];}
+  virtual  STensor33 &getRefTodThermalFluxdF() {return  getRefTodFluxdF()[0];}*/
 
   /*virtual const STensor3 &getConstRefTolineark10() const {return *lineark10;}
   virtual void setRefTolineark10(const STensor3 &eT1) {lineark10=&eT1;}
diff --git a/dG3D/src/dG3DMaterialLaw.cpp b/dG3D/src/dG3DMaterialLaw.cpp
index 48e70cf4d..b359cdb71 100644
--- a/dG3D/src/dG3DMaterialLaw.cpp
+++ b/dG3D/src/dG3DMaterialLaw.cpp
@@ -2962,17 +2962,17 @@ void LinearElecTherMechDG3DMaterialLaw::stress(IPVariable* ipv, const IPVariable
 
         STensor3& dPdT=ipvcur->getRefTodPdT();
 	STensor3& dPdV=ipvcur->getRefTodPdV();
-        SVector3  fluxT=ipvcur->getRefToThermalFlux();
+        SVector3  fluxT;
 	SVector3& fluxV=ipvcur->getRefToFluxV();
-        STensor3& dqdgradT=ipvcur->getRefTodThermalFluxdGradT();
-	STensor3  dqdgradV=ipvcur->getRefTodFluxTdGradV();
+        STensor3 dqdgradT;
+	STensor3 dqdgradV;
 	STensor3& dedgradV=ipvcur->getRefTodFluxVdGradV();
 	STensor3& dedgradT=ipvcur->getRefTodFluxVdGradT();
-        SVector3  dqdT=ipvcur->getRefTodFluxTdT();
-	SVector3  dqdV=ipvcur->getRefTodFluxTdV();
+        SVector3  dqdT;
+	SVector3  dqdV;
 	SVector3& dedV=ipvcur->getRefTodFluxVdV();
 	SVector3& dedT=ipvcur->getRefTodFluxVdT();
-        STensor33& dqdF=ipvcur->getRefTodThermalFluxdF();
+        STensor33 dqdF;
 	STensor33& dedF=ipvcur->getRefTodFluxVdF();
         STensor3& P=ipvcur->getRefToFirstPiolaKirchhoffStress();
         STensor43& Tangent=ipvcur->getRefToTangentModuli();
@@ -3134,17 +3134,17 @@ void mlawAnIsotropicElecTherMechDG3DMaterialLaw::stress(IPVariable* ipv, const I
   const SVector3& gradV= ipvcur->getConstRefToGradV();
         STensor3& dPdT =ipvcur->getRefTodPdT();
 	STensor3& dPdV =ipvcur->getRefTodPdV();
-        SVector3  fluxT=ipvcur->getRefToThermalFlux();
+        SVector3  fluxT;
 	SVector3& fluxV=ipvcur->getRefToFluxV();
-        STensor3& dqdgradT =ipvcur->getRefTodThermalFluxdGradT();
-	STensor3 dqdgradV =ipvcur->getRefTodFluxTdGradV();
+        STensor3 dqdgradT;
+	STensor3 dqdgradV;
 	STensor3& djedgradV=ipvcur->getRefTodFluxVdGradV();
 	STensor3& djedgradT=ipvcur->getRefTodFluxVdGradT();
-        SVector3  dqdT  =ipvcur->getRefTodFluxTdT();
-	SVector3  dqdV  =ipvcur->getRefTodFluxTdV();
+        SVector3  dqdT;
+	SVector3  dqdV;
 	SVector3& djedV =ipvcur->getRefTodFluxVdV();
 	SVector3& djedT =ipvcur->getRefTodFluxVdT();
-        STensor33& dqdF =ipvcur->getRefTodThermalFluxdF();
+        STensor33 dqdF;
 	STensor33& djedF=ipvcur->getRefTodFluxVdF();
         STensor3& P=ipvcur->getRefToFirstPiolaKirchhoffStress();
         STensor43& Tangent=ipvcur->getRefToTangentModuli();
@@ -3323,17 +3323,17 @@ void mlawElecSMPDG3DMaterialLaw::stress(IPVariable* ipv, const IPVariable* ipvp,
   const SVector3& gradV= ipvcur->getConstRefToGradV();
         STensor3& dPdT = ipvcur->getRefTodPdT();
 	STensor3& dPdV = ipvcur->getRefTodPdV();
-        SVector3  fluxT= ipvcur->getRefToThermalFlux();
+        SVector3  fluxT;
 	SVector3& fluxV= ipvcur->getRefToFluxV();
-        STensor3& dqdgradT= ipvcur->getRefTodThermalFluxdGradT();
-	STensor3  dqdgradV= ipvcur->getRefTodFluxTdGradV();
+        STensor3 dqdgradT;
+	STensor3 dqdgradV;
 	STensor3& dedgradV= ipvcur->getRefTodFluxVdGradV();
 	STensor3& dedgradT= ipvcur->getRefTodFluxVdGradT();
-        SVector3  dqdT= ipvcur->getRefTodFluxTdT();
-	SVector3  dqdV= ipvcur->getRefTodFluxTdV();
+        SVector3  dqdT;
+	SVector3  dqdV;
 	SVector3& dedV= ipvcur->getRefTodFluxVdV();
 	SVector3& dedT= ipvcur->getRefTodFluxVdT();
-        STensor33& dqdF= ipvcur->getRefTodThermalFluxdF();
+        STensor33 dqdF;
 	STensor33& dedF= ipvcur->getRefTodFluxVdF();
         STensor3&  P   = ipvcur->getRefToFirstPiolaKirchhoffStress();
         STensor43& Tangent=ipvcur->getRefToTangentModuli();
diff --git a/dG3D/src/dG3DTerms.cpp b/dG3D/src/dG3DTerms.cpp
index 6b6ed4d0b..a7e7c3b4d 100644
--- a/dG3D/src/dG3DTerms.cpp
+++ b/dG3D/src/dG3DTerms.cpp
@@ -117,7 +117,6 @@ void dG3DForceBulk::get(MElement *ele,int npts,IntPt *GP,fullVector<double> &vFo
       }
     }
     //extra dof
-//    if( vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()==getNumConstitutiveExtraDofDiffusionVariable() ){ //to remove after migration
     if( vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ){
          Msg::Fatal("Your material law uses more constitutive extra dof variables than your domain dG3DForceBulk::get");}
     for (int extraDOFField = 0; extraDOFField< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField++){
@@ -143,7 +142,6 @@ void dG3DForceBulk::get(MElement *ele,int npts,IntPt *GP,fullVector<double> &vFo
       }
     }
   }
-//  }//to remove after migration
   //vFor.print("bulkF");
 }
 
@@ -278,7 +276,6 @@ void dG3DStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
         }
       }
       if( vipv[i]->getNumberNonLocalVariable()>getNumNonLocalVariable() )  Msg::Fatal("Your material law uses more non local variables than your domain dG3DStiffnessBulk::get");
-     // if( vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()==getNumConstitutiveExtraDofDiffusionVariable() ){ //to remove after migration
       if( vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
             Msg::Fatal("Your material law uses more constitutive extra dof variables than your domain dG3DStiffnessBulk::get");
 			
@@ -401,15 +398,7 @@ void dG3DStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
 	   }
           }
 	for (int extraDOFField2 = 0; extraDOFField2< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField2++){
-        static bool msg=false;
-        if(getNumConstitutiveExtraDofDiffusionVariable()>1)
-        {
-          if(!msg)
-          {
-            Msg::Info("we assume no cross dependency between the extra dof sources domain dG3DStiffnessBulk::get");
-            msg=true;
-          }
-        }
+        
         //int extraDOFField2=extraDOFField;
         const STensor3  &dFluxdGradField = vipv[i]->getConstRefTodFluxdGradField()[extraDOFField][extraDOFField2]; //in reference conf
         const SVector3  &dFluxdField     = vipv[i]->getConstRefTodFluxdField()[extraDOFField][extraDOFField2]; //in reference conf
@@ -494,15 +483,7 @@ void dG3DStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
 	   }
           }
 	for (int extraDOFField2 = 0; extraDOFField2< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField2++){
-        static bool msg=false;
-        if(getNumConstitutiveExtraDofDiffusionVariable()>1)
-        {
-          if(!msg)
-          {
-            Msg::Info("we assume no cross dependency between the extra dof sources domain dG3DStiffnessBulk::get");
-            msg=true;
-          }
-        }
+        
         //int extraDOFField2=extraDOFField;
         const STensor3  &dFluxdGradField1                         = vipv[i]->getConstRefTodFluxdGradField()[extraDOFField][extraDOFField2]; //in reference conf
         const SVector3  &dFluxdField1                             = vipv[i]->getConstRefTodFluxdField()[extraDOFField][extraDOFField2]; //in reference conf
@@ -637,7 +618,6 @@ void dG3DStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
         }*/
     }
   //mStiff.print("bulk");
- // }//to remove after migration
   }
   else
     printf("not implemented\n");
@@ -774,7 +754,6 @@ void dG3DElasticStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<d
         }
       }
       if( vipv[i]->getNumberNonLocalVariable()>getNumNonLocalVariable() )  Msg::Fatal("Your material law uses more non local variables than your domain dG3DStiffnessBulk::get");
-     // if( vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()==getNumConstitutiveExtraDofDiffusionVariable() ){ //to remove after migration
       if( vipv[i]->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
             Msg::Fatal("Your material law uses more constitutive extra dof variables than your domain dG3DStiffnessBulk::get");
 			
@@ -897,15 +876,7 @@ void dG3DElasticStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<d
 	   }
           }
 	for (int extraDOFField2 = 0; extraDOFField2< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField2++){
-        static bool msg=false;
-        if(getNumConstitutiveExtraDofDiffusionVariable()>1)
-        {
-          if(!msg)
-          {
-            Msg::Info("we assume no cross dependency between the extra dof sources domain dG3DStiffnessBulk::get");
-            msg=true;
-          }
-        }
+     
         //int extraDOFField2=extraDOFField;
         const STensor3  &dFluxdGradField = vipv[i]->getConstRefTodFluxdGradField()[extraDOFField][extraDOFField2]; //in reference conf
         const SVector3  &dFluxdField     = vipv[i]->getConstRefTodFluxdField()[extraDOFField][extraDOFField2]; //in reference conf
@@ -990,15 +961,7 @@ void dG3DElasticStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<d
 	   }
           }
 	for (int extraDOFField2 = 0; extraDOFField2< vipv[i]->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField2++){
-        static bool msg=false;
-        if(getNumConstitutiveExtraDofDiffusionVariable()>1)
-        {
-          if(!msg)
-          {
-            Msg::Info("we assume no cross dependency between the extra dof sources domain dG3DStiffnessBulk::get");
-            msg=true;
-          }
-        }
+      
         //int extraDOFField2=extraDOFField;
         const STensor3  &dFluxdGradField1                         = vipv[i]->getConstRefTodFluxdGradField()[extraDOFField][extraDOFField2]; //in reference conf
         const SVector3  &dFluxdField1                             = vipv[i]->getConstRefTodFluxdField()[extraDOFField][extraDOFField2]; //in reference conf
@@ -1133,7 +1096,6 @@ void dG3DElasticStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMatrix<d
         }*/
     }
   //mStiff.print("bulk");
- // }//to remove after migration
   }
   else
     printf("not implemented\n");
@@ -1402,12 +1364,21 @@ void dG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVector<double>
           if( getConstitutiveExtraDofDiffusionContinuity() && !broken)
           {
             const double nbetahs = getConstitutiveExtraDofDiffusionStabilityParameter()/hs;
+            double fieldJump;
+            double fieldp=0.;double fieldm=0.;
 
-            double fieldJump = ipvp->getConstRefToEnergyConjugatedFieldJump()(extraDOFField2);
-  
-            const double &fieldp = ipvp->getConstRefToEnergyConjugatedField(extraDOFField);
-            const double &fieldm = ipvm->getConstRefToEnergyConjugatedField(extraDOFField);
-            //const double &oneOverFieldJump = ipvp->getConstRefToOneOverFieldJump()(extraDOFField);
+            if(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==1)
+            {
+             fieldJump = ipvp->getConstRefToFieldJump()(extraDOFField);
+             fieldp = ipvp->getConstRefToField(extraDOFField);
+             fieldm = ipvm->getConstRefToField(extraDOFField);
+            }
+            else
+            {
+             fieldJump = ipvp->getConstRefToEnergyConjugatedFieldJump()(extraDOFField2);
+             fieldp = ipvp->getConstRefToEnergyConjugatedField(extraDOFField);
+             fieldm = ipvm->getConstRefToEnergyConjugatedField(extraDOFField);
+            }
 
             static STensor3  k0m;
             k0m = *(ipvm->getConstRefToLinearK()[extraDOFField][extraDOFField2]);
@@ -1423,11 +1394,10 @@ void dG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVector<double>
             {
                 if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
                {
-                k0m*=(-1.)/(fieldm*fieldm);
-                k0p*=(-1.)/(fieldp*fieldp);
-                //fieldJump=oneOverFieldJump;
-                Stiff_alphadialitationm*= (-1.)/(fieldm*fieldm);
-                Stiff_alphadialitationp*= (-1.)/(fieldp*fieldp);
+                k0m*=(-1.)*fieldm*fieldm;
+                k0p*=(-1.)*fieldp*fieldp;
+                Stiff_alphadialitationm*= (-1.)*fieldm*fieldm;
+                Stiff_alphadialitationp*= (-1.)*fieldp*fieldp;
                 }
              }
              else
@@ -1785,7 +1755,6 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
           }
         }
         // Here we have extra dof part
- if( ipvm->getNumConstitutiveExtraDofDiffusionVariable()==getNumConstitutiveExtraDofDiffusionVariable() ){ //to remove after migration
         if( ipvm->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
             Msg::Fatal("Your material law uses more constitutive extra dof variable than your domain dG3DStiffnessInter::get");
         if( ipvp->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
@@ -1795,7 +1764,6 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
         for (int extraDOFField = 0; extraDOFField< ipvp->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField++){
             Msg::Fatal("Need to implement the stiffness matrix related to the CZM/CBM and constitutiveExtraDOFVariable dG3DStiffnessInter::get");
         }
-}//to remove after migration
       }
       else
       {
@@ -2081,7 +2049,7 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
                 }
               }
             }
-
+     
             // consistency D\mean{cG grad epl} Depl
             // Assembly consistency
             for(int j=0;j<nbFFm;j++)
@@ -2219,11 +2187,9 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
               double  dLocalVariableDNonLocalVariablep = ipvp->getConstRefToDLocalVariableDNonLocalVariable()(nlk,extraDOFField);
             }
           }
-//
         }
-        // constitutive extra dof
 
-      if( ipvm->getNumConstitutiveExtraDofDiffusionVariable()==getNumConstitutiveExtraDofDiffusionVariable() ){//to remove after migration
+        // constitutive extra dof
         if( ipvm->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
             Msg::Fatal("Your material law uses more constitutive extra dof variable than your domain dG3DStiffnessInter::get");
         if( ipvp->getNumConstitutiveExtraDofDiffusionVariable()>getNumConstitutiveExtraDofDiffusionVariable() ) 
@@ -2231,75 +2197,85 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
         if( ipvp->getNumConstitutiveExtraDofDiffusionVariable()!= ipvm->getNumConstitutiveExtraDofDiffusionVariable() ) 
             Msg::Fatal("Your plus and minus material laws do not use the same number of constitutive extra dof variables dG3DStiffnessInter::get");
         for (int extraDOFField = 0; extraDOFField< ipvp->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField++){
-          if( getConstitutiveExtraDofDiffusionContinuity() && !broken)
-          {
-            static bool msg=false;
-            if(getNumConstitutiveExtraDofDiffusionVariable()>1)
-            {
-              if(!msg)
-              {
-                Msg::Info("we assume no cross dependency between the extra dof sources domain dG3DStiffnessInter::get");
-                msg=true;
-              }
-            }
-            int extraDOFField2=extraDOFField;
+
             const double nbetahs = getConstitutiveExtraDofDiffusionStabilityParameter()/hs;
 
-            const STensor3  *dqdGradFieldm = &(ipvm->getConstRefTodFluxdGradField()[extraDOFField][extraDOFField2]);
-            const STensor3  *dqdGradFieldp = &(ipvp->getConstRefTodFluxdGradField()[extraDOFField][extraDOFField2]);
-            const SVector3  *dqdFieldm = &(ipvm->getConstRefTodFluxdField()[extraDOFField][extraDOFField2]);
-            const SVector3  *dqdFieldp = &(ipvp->getConstRefTodFluxdField()[extraDOFField][extraDOFField2]);
             const STensor33 *dqdFm = &(ipvm->getConstRefTodFluxdF()[extraDOFField]);
             const STensor33 *dqdFp = &(ipvp->getConstRefTodFluxdF()[extraDOFField]);
             const STensor3  *dPdFieldm = &(ipvm->getConstRefTodPdField()[extraDOFField]);
             const STensor3  *dPdFieldp = &(ipvp->getConstRefTodPdField()[extraDOFField]);
 
-            double fieldJump = ipvp->getConstRefToFieldJump()(extraDOFField);
-            const double &fieldp = ipvp->getConstRefToField(extraDOFField);
-            const double &fieldm = ipvm->getConstRefToField(extraDOFField);
-            const double &oneOverFieldJump = ipvp->getConstRefToOneOverFieldJump()(extraDOFField);
-            double dfieldJumpdFieldp = 1.;
-            double dfieldJumpdFieldm = -1.;
+            double fieldJump=0.; double fieldJump2=0.;
+            double fieldp=0.;double fieldm=0.; double dfieldJumpdFieldp=0.; double dfieldJumpdFieldm=0.;
+            double dfieldJumpdField2p=0.; double dfieldJumpdField2m=0.; double oneOverFieldJump=0.;
+            double dFielddEnergyConjugatedFieldp=0.; double dFielddEnergyConjugatedFieldm=0.; double dFielddEnergyConjugatedField2p=0.; double dFielddEnergyConjugatedField2m=0.;
+            static SVector3 dGradFielddEnergyConjugatedFieldp, dGradFielddEnergyConjugatedFieldm, dGradFielddEnergyConjugatedField2p, dGradFielddEnergyConjugatedField2m;
+            static STensor3 dGradFielddGradEnergyConjugatedFieldp, dGradFielddGradEnergyConjugatedFieldm, dGradFielddGradEnergyConjugatedField2p, dGradFielddGradEnergyConjugatedField2m;
 
-            static STensor3  k0m;
-            k0m = *(ipvm->getConstRefToLinearK()[extraDOFField][extraDOFField2]);
-            static STensor3  k0p;
-            k0p = *(ipvp->getConstRefToLinearK()[extraDOFField][extraDOFField2]);
-            static STensor3  Stiff_alphadialitationm;
-            Stiff_alphadialitationm = *(ipvm->getConstRefToLinearSymmetrizationCoupling()[extraDOFField]);
-            static STensor3  Stiff_alphadialitationp;
-            Stiff_alphadialitationp = *(ipvp->getConstRefToLinearSymmetrizationCoupling()[extraDOFField]);
-            static STensor3  dk0mdFieldm;
-            STensorOperation::zero(dk0mdFieldm);
-            static STensor3  dk0pdFieldp;
-            STensorOperation::zero(dk0pdFieldp);
-            static STensor3 dStiff_alphadialitationmdFieldm;
-            STensorOperation::zero(dStiff_alphadialitationmdFieldm);
-            static STensor3 dStiff_alphadialitationpdFieldp;
-            STensorOperation::zero(dStiff_alphadialitationpdFieldp);
-            if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
+            static STensor3 Stiff_alphadialitationm, Stiff_alphadialitationp, dk0mdFieldm, dk0pdFieldp, dk0mdField2m, dk0pdField2p, dk0mdField_auxm, dk0pdField_auxp, dk0mdField_aux2m, dk0pdField_aux2p, dStiff_alphadialitationmdFieldm, dStiff_alphadialitationpdFieldp, dPdField2m, dPdField2p;
+
+            if(extraDOFField==0)
+             {
+              Stiff_alphadialitationm = *(ipvm->getConstRefToLinearSymmetrizationCoupling()[0]);
+              Stiff_alphadialitationp = *(ipvp->getConstRefToLinearSymmetrizationCoupling()[0]);
+             }
+            else
+             {
+              STensorOperation::zero(Stiff_alphadialitationm);
+              STensorOperation::zero(Stiff_alphadialitationp);
+             }
+
+            if(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==1)
+            {
+             fieldJump = ipvp->getConstRefToFieldJump()(extraDOFField);
+             fieldp = ipvp->getConstRefToField(extraDOFField);
+             fieldm = ipvm->getConstRefToField(extraDOFField);
+             dfieldJumpdFieldp = 1.;
+             dfieldJumpdFieldm = -1.;
+             oneOverFieldJump = ipvp->getConstRefToOneOverFieldJump()(extraDOFField);
+             STensorOperation::zero(dk0mdFieldm);
+             STensorOperation::zero(dk0pdFieldp);
+             STensorOperation::zero(dStiff_alphadialitationmdFieldm);
+             STensorOperation::zero(dStiff_alphadialitationpdFieldp);
+              if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
+               {
+                 fieldJump=ipvp->getConstRefToOneOverFieldJump()(extraDOFField);
+                 Stiff_alphadialitationm*=(-1.)*fieldm*fieldm;
+                 Stiff_alphadialitationp*=(-1.)*fieldp*fieldp;
+                 dStiff_alphadialitationmdFieldm=Stiff_alphadialitationm;//the - is removed
+                 dStiff_alphadialitationmdFieldm*=(1.)*2./fieldm;
+                 dStiff_alphadialitationpdFieldp*=Stiff_alphadialitationp;//the - is removed
+                 dStiff_alphadialitationpdFieldp*=(1.)*2./fieldp;
+               }
+            }
+            else
             {
-              Msg::Fatal("HERE TO CHANGE FOR ELECTHER");
-              k0m*=(-1.)*fieldm*fieldm;
-              k0p*=(-1.)*fieldp*fieldp;
-              fieldJump=oneOverFieldJump;
-              dfieldJumpdFieldp=ipvp->getConstRefTodOneOverFieldJumpdFieldp()(extraDOFField,extraDOFField2);
-              dfieldJumpdFieldm=ipvm->getConstRefTodOneOverFieldJumpdFieldm()(extraDOFField,extraDOFField2);
-              dk0mdFieldm=k0m;
-              dk0mdFieldm*=(1.)*2./fieldm;//the - is removed
-              dk0pdFieldp=k0p;
-              dk0pdFieldp*=(1.)*2./fieldp;//the - is removed
-              Stiff_alphadialitationm*=(-1.)*fieldm*fieldm;
-              Stiff_alphadialitationp*=(-1.)*fieldp*fieldp;
-              dStiff_alphadialitationmdFieldm=Stiff_alphadialitationm;//the - is removed
-              dStiff_alphadialitationmdFieldm*=(1.)*2./fieldm;
-              dStiff_alphadialitationpdFieldp*=Stiff_alphadialitationp;//the - is removed
-              dStiff_alphadialitationpdFieldp*=(1.)*2./fieldp;
+             fieldp = ipvp->getConstRefToEnergyConjugatedField(extraDOFField);
+             fieldm = ipvm->getConstRefToEnergyConjugatedField(extraDOFField);
+             if(extraDOFField==0)
+                   {
+                    Stiff_alphadialitationm*= (-1.)/(fieldm*fieldm);
+                    Stiff_alphadialitationp*= (-1.)/(fieldp*fieldp); 
+                   }
+             if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
+                   {
+                    int extraDOFField_aux=0;
+                      if((extraDOFField+1)< ipvp->getNumConstitutiveExtraDofDiffusionVariable()) extraDOFField_aux=extraDOFField+1;
+                      else extraDOFField_aux=extraDOFField-1;  
+
+                    dFielddEnergyConjugatedFieldp = ipvp->getConstRefTodFielddEnergyConjugatedField()[extraDOFField][extraDOFField];
+                    dFielddEnergyConjugatedFieldm = ipvm->getConstRefTodFielddEnergyConjugatedField()[extraDOFField][extraDOFField]; 
+                    dFielddEnergyConjugatedField2p = ipvp->getConstRefTodFielddEnergyConjugatedField()[extraDOFField_aux][extraDOFField];
+                    dFielddEnergyConjugatedField2m = ipvm->getConstRefTodFielddEnergyConjugatedField()[extraDOFField_aux][extraDOFField];  
+                    dPdField2p       = ipvp->getConstRefTodPdField()[extraDOFField_aux];
+                    dPdField2m       = ipvm->getConstRefTodPdField()[extraDOFField_aux]; 
+                   }
             }
-            int indexField=3+getNumNonLocalVariable()+extraDOFField;
 
-            // Assembly consistency (from derivative of sigma with extra field)
-            for(int j=0;j<nbFFm;j++)
+         int indexField=3+getNumNonLocalVariable()+extraDOFField;
+
+         // Assembly consistency (from derivative of sigma with extra field)
+          for(int j=0;j<nbFFm;j++)
             {
               for(int k=0;k<3;k++)
               {
@@ -2307,14 +2283,16 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
                 {
                   for(int q = 0; q< 3; q++)
                   {
-                    stiff(j+k*nbFFm,l+indexField*nbFFm) -= dPdFieldm->operator()(k,q)*(Valsm[l+indexField*nbFFm]*Valsm[j+0*nbFFm]*wJ/2.*nu(q));
+                    if((getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())&&(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==2)) stiff(j+k*nbFFm,l+indexField*nbFFm) -= (dPdFieldm->operator()(k,q)*dFielddEnergyConjugatedFieldm+dPdField2m(k,q)*dFielddEnergyConjugatedField2m)*(Valsm[l+indexField*nbFFm]*Valsm[j+0*nbFFm]*wJ/2.*nu(q));
+                    else stiff(j+k*nbFFm,l+indexField*nbFFm) -= dPdFieldm->operator()(k,q)*(Valsm[l+indexField*nbFFm]*Valsm[j+0*nbFFm]*wJ/2.*nu(q));
                   }
                 }
                 for(int l=0;l<nbFFp;l++)
                 {
                   for(int q = 0; q< 3; q++)
                   {
-                    stiff(j+k*nbFFm,l+indexField*nbFFp+nbdofm) -= dPdFieldp->operator()(k,q)*(Valsp[l+indexField*nbFFp]*Valsm[j+0*nbFFm]*wJ/2.*nu(q));
+                    if((getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())&&(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==2)) stiff(j+k*nbFFm,l+indexField*nbFFp+nbdofm) -= (dPdFieldp->operator()(k,q)*dFielddEnergyConjugatedFieldp+dPdField2p(k,q)*dFielddEnergyConjugatedField2p)*(Valsp[l+indexField*nbFFp]*Valsm[j+0*nbFFm]*wJ/2.*nu(q));
+                    else stiff(j+k*nbFFm,l+indexField*nbFFp+nbdofm) -= dPdFieldp->operator()(k,q)*(Valsp[l+indexField*nbFFp]*Valsm[j+0*nbFFm]*wJ/2.*nu(q));
                   }
                 }
               }
@@ -2327,19 +2305,23 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
                 {
                   for(int q = 0; q< 3; q++)
                   {
-                    stiff(j+k*nbFFp+nbdofm,l+indexField*nbFFm) += dPdFieldm->operator()(k,q)*(Valsm[l+indexField*nbFFm]*Valsp[j+0*nbFFp]*wJ/2.*nu(q));
+                    if((getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())&&(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==2)) stiff(j+k*nbFFp+nbdofm,l+indexField*nbFFm) += (dPdFieldm->operator()(k,q)*dFielddEnergyConjugatedFieldm+dPdField2m(k,q)*dFielddEnergyConjugatedField2m)*(Valsm[l+indexField*nbFFm]*Valsp[j+0*nbFFp]*wJ/2.*nu(q));
+                    else stiff(j+k*nbFFp+nbdofm,l+indexField*nbFFm) += dPdFieldm->operator()(k,q)*(Valsm[l+indexField*nbFFm]*Valsp[j+0*nbFFp]*wJ/2.*nu(q));
                   }
                 }
                 for(int l=0;l<nbFFp;l++)
                 {
                   for(int q = 0; q< 3; q++)
                   {
-                    stiff(j+k*nbFFp+nbdofm,l+indexField*nbFFp+nbdofm) += dPdFieldp->operator()(k,q)*(Valsp[l+indexField*nbFFp]*Valsp[j+0*nbFFp]*wJ/2.*nu(q));
+                    if((getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())&&(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==2)) stiff(j+k*nbFFp+nbdofm,l+indexField*nbFFp+nbdofm) += (dPdFieldp->operator()(k,q)*dFielddEnergyConjugatedFieldp+dPdField2p(k,q)*dFielddEnergyConjugatedField2p)*(Valsp[l+indexField*nbFFp]*Valsp[j+0*nbFFp]*wJ/2.*nu(q));
+                    else stiff(j+k*nbFFp+nbdofm,l+indexField*nbFFp+nbdofm) += dPdFieldp->operator()(k,q)*(Valsp[l+indexField*nbFFp]*Valsp[j+0*nbFFp]*wJ/2.*nu(q));
                   }
                 }
               }
             }
-            for(int j=0;j<nbFFm;j++)
+
+         //F-related terms
+           for(int j=0;j<nbFFm;j++)
             {
               for(int k=0;k<3;k++)
               {
@@ -2391,20 +2373,291 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
                 }
               }
             }
+
+
+           if(extraDOFField==0)
+           {
+            double gamma=0.;
+            if(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==1)
+            {
+             for(int j=0;j<nbFFm;j++)
+             {
+              for(int k=0;k<3;k++)
+              {
+                for(int l=0;l<nbFFm;l++)
+                {
+                  for(int p =0; p < 3; p++)
+                  {
+                    stiff(j+indexField*nbFFm,l+k*nbFFm) -= gamma*(Stiff_alphadialitationm(k,p)*Valsm[j+indexField*nbFFm])*(nu(p)*wJ/2.*Valsm[l+0*nbFFm])*(-1.);
+                  }
+                }
+                for(int l=0;l<nbFFp;l++)
+                {
+                  for(int p =0; p < 3; p++)
+                  {
+                    stiff(j+indexField*nbFFm,l+k*nbFFp+nbdofm) += gamma*(Stiff_alphadialitationm(k,p)*Valsm[j+indexField*nbFFm])*(nu(p)*wJ/2.*Valsp[l+0*nbFFp])*(-1.);
+                   }
+                 }
+               }
+             }
+             for(int j=0;j<nbFFp;j++)
+             {
+              for(int k=0;k<3;k++)
+              {
+                for(int l=0;l<nbFFm;l++)
+                {
+                  for(int p =0; p < 3; p++)
+                  {
+                    stiff(j+indexField*nbFFp+nbdofm,l+k*nbFFm) -= gamma*(Stiff_alphadialitationp(k,p)*Valsp[j+indexField*nbFFp])*(nu(p)*wJ/2.*Valsm[l+0*nbFFm])*(-1.);
+                  }
+                }
+                for(int l=0;l<nbFFp;l++)
+                {
+                  for(int p =0; p < 3; p++)
+                  {
+                    stiff(j+indexField*nbFFp+nbdofm,l+k*nbFFp+nbdofm) += gamma*(Stiff_alphadialitationp(k,p)*Valsp[j+indexField*nbFFp])*(nu(p)*wJ/2.*Valsp[l+0*nbFFp])*(-1.);
+                  }
+                }
+              }
+             }
+             if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
+             {
+              for(int j=0;j<nbFFm;j++)
+              {
+                for(int l=0;l<nbFFm;l++)
+                {
+                  for(int k =0; k < 3; k++)
+                  {
+                    for(int p =0; p < 3; p++)
+                    {
+                      stiff(j+indexField*nbFFm,l+indexField*nbFFm) += gamma*jump(k)*
+                          (dStiff_alphadialitationmdFieldm(k,p)*Valsm[j+indexField*nbFFm])*nu(p)*Valsm[l+indexField*nbFFm]*wJ/2.*(-1.);
+                    }
+                  }
+                }
+              }
+              for(int j=0;j<nbFFp;j++)
+              {
+                for(int l=0;l<nbFFp;l++)
+                {
+                  for(int k =0; k < 3; k++)
+                  {
+                    for(int p =0; p< 3; p++)
+                    {
+                      stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFp+nbdofm) += gamma*jump(k)*
+                          (dStiff_alphadialitationpdFieldp(k,p)*Valsp[j+indexField*nbFFp])*nu(p)*Valsp[l+indexField*nbFFp]*wJ/2.*(-1.);
+                     }
+                   }
+                 }
+               }
+              }
+          }
+          if(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==2)
+          {
+           double gamma=0.;
+           for(int j=0;j<nbFFm;j++)
+            {
+              for(int l=0;l<nbFFm;l++)
+              {
+                for(int k =0; k < 3; k++)
+                {
+                  for(int p =0; p < 3; p++)
+                  {
+                    stiff(j+indexField*nbFFm,l+indexField*nbFFm) += gamma*jump(k)*(Stiff_alphadialitationm(k,p)*Valsm[j+indexField*nbFFm])*(2.*fieldm)*nu(p)*Valsm[l+indexField*nbFFm]*wJ/2.*(-1.);
+                  }
+                }
+              }
+            }
+
+            for(int j=0;j<nbFFp;j++)
+            {
+              for(int l=0;l<nbFFp;l++)
+              {
+                for(int k =0; k < 3; k++)
+                {
+                  for(int p =0; p< 3; p++)
+                  {
+
+                    stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFp+nbdofm) += gamma*jump(k)*(Stiff_alphadialitationp(k,p)*(2.*fieldp)*Valsp[j+indexField*nbFFp])*nu(p)*Valsp[l+indexField*nbFFp]*wJ/2.*(-1.);
+                  }
+                }
+              }
+            }
+            for(int j=0;j<nbFFm;j++)
+            {
+              for(int k=0;k<3;k++)
+              {
+                for(int l=0;l<nbFFm;l++)
+                {
+                  for(int p =0; p < 3; p++)
+                  {
+                      stiff(j+indexField*nbFFm,l+k*nbFFm) -= gamma*(Stiff_alphadialitationm(k,p)*Valsm[j+indexField*nbFFm])*(nu(p)*wJ/2.*Valsm[l+0*nbFFm])*(-1.);
+                  }
+                }
+                for(int l=0;l<nbFFp;l++)
+                {
+                  for(int p =0; p < 3; p++)
+                  {
+                      stiff(j+indexField*nbFFm,l+k*nbFFp+nbdofm) +=  gamma*(Stiff_alphadialitationm(k,p)*Valsm[j+indexField*nbFFm])*(nu(p)*wJ/2.*Valsp[l+0*nbFFp])*(-1.);
+                  }
+                }
+              }
+            }
+
+            for(int j=0;j<nbFFp;j++)
+            {
+              for(int k=0;k<3;k++)
+              {
+                for(int l=0;l<nbFFm;l++)
+                {
+                  for(int p =0; p < 3; p++)
+                  {
+                    stiff(j+indexField*nbFFp+nbdofm,l+k*nbFFm) -=  gamma*(Stiff_alphadialitationp(k,p)*Valsp[j+indexField*nbFFp])*(nu(p)*wJ/2.*Valsm[l+0*nbFFm])*(-1.);
+                  }
+                }
+                for(int l=0;l<nbFFp;l++)
+                {
+                  for(int p =0; p < 3; p++)
+                  {
+                      stiff(j+indexField*nbFFp+nbdofm,l+k*nbFFp+nbdofm) +=  gamma*(Stiff_alphadialitationp(k,p)*Valsp[j+indexField*nbFFp])*(nu(p)*wJ/2.*Valsp[l+0*nbFFp])*(-1.);
+                  }
+                }
+              }
+            }
+          }
+        }
+
+
+         for (int extraDOFField2 = 0; extraDOFField2< ipvp->getNumConstitutiveExtraDofDiffusionVariable(); extraDOFField2++){
+          if( getConstitutiveExtraDofDiffusionContinuity() && !broken)
+          {
+            const STensor3  *dqdGradFieldm = &(ipvm->getConstRefTodFluxdGradField()[extraDOFField][extraDOFField2]);
+            const STensor3  *dqdGradFieldp = &(ipvp->getConstRefTodFluxdGradField()[extraDOFField][extraDOFField2]);
+            const SVector3  *dqdFieldm = &(ipvm->getConstRefTodFluxdField()[extraDOFField][extraDOFField2]);
+            const SVector3  *dqdFieldp = &(ipvp->getConstRefTodFluxdField()[extraDOFField][extraDOFField2]);
+
+            static STensor3  k0m, k0p, k02m, k02p, dqdGradField2m, dqdGradField2p;
+            static SVector3 dqdField2m, dqdField2p;
+            static STensor43 dk0mdFm, dk0pdFp;
+            STensorOperation::zero(dk0mdFm);STensorOperation::zero(dk0pdFp);
+
+            k0m = *(ipvm->getConstRefToLinearK()[extraDOFField][extraDOFField2]);
+            k0p = *(ipvp->getConstRefToLinearK()[extraDOFField][extraDOFField2]);
+
+            if(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==1) //thermomec
+            {
+              if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
+               {
+                 k0m*=(-1.)*fieldm*fieldm;
+                 k0p*=(-1.)*fieldp*fieldp;
+                 dk0mdFieldm=k0m;
+                 dk0mdFieldm*=(1.)*2./fieldm;//the - is removed
+                 dk0pdFieldp=k0p;
+                 dk0pdFieldp*=(1.)*2./fieldp;//the - is removed
+               }
+            }
+             else
+            {
+              int extraDOFField_aux=0;
+                      if((extraDOFField2+1)< ipvp->getNumConstitutiveExtraDofDiffusionVariable()) extraDOFField_aux=extraDOFField2+1;
+                      else extraDOFField_aux=extraDOFField2-1; 
+
+              fieldJump = ipvp->getConstRefToEnergyConjugatedFieldJump()(extraDOFField2);
+              fieldJump2 = ipvp->getConstRefToEnergyConjugatedFieldJump()(extraDOFField_aux);
+
+              dk0mdFieldm  = ipvm->getConstRefTodLinearKdField()[extraDOFField][extraDOFField2][extraDOFField2];
+              dk0pdFieldp  = ipvp->getConstRefTodLinearKdField()[extraDOFField][extraDOFField2][extraDOFField2];
+              dk0mdField2m = ipvm->getConstRefTodLinearKdField()[extraDOFField][extraDOFField_aux][extraDOFField2];
+              dk0pdField2p = ipvp->getConstRefTodLinearKdField()[extraDOFField][extraDOFField_aux][extraDOFField2];
+
+              dk0mdFm  = ipvm->getConstRefTodLinearKdF()[extraDOFField][extraDOFField2];
+              dk0pdFp  = ipvp->getConstRefTodLinearKdF()[extraDOFField][extraDOFField2];
+
+              if(!getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
+                {
+                 if(extraDOFField==extraDOFField2)
+                 {
+                 dfieldJumpdFieldp=ipvp->getConstRefTodEnergyConjugatedFieldJumpdFieldp()[extraDOFField][extraDOFField2];
+                 dfieldJumpdFieldm=ipvm->getConstRefTodEnergyConjugatedFieldJumpdFieldm()[extraDOFField][extraDOFField2];
+                 dfieldJumpdField2p=ipvp->getConstRefTodEnergyConjugatedFieldJumpdFieldp()[extraDOFField_aux][extraDOFField];
+                 dfieldJumpdField2m=ipvm->getConstRefTodEnergyConjugatedFieldJumpdFieldm()[extraDOFField_aux][extraDOFField];
+
+                 k02m = *(ipvm->getConstRefToLinearK()[extraDOFField][extraDOFField_aux]);
+                 k02p = *(ipvp->getConstRefToLinearK()[extraDOFField][extraDOFField_aux]);
+                }
+                else 
+                 {
+                 dfieldJumpdFieldp=ipvp->getConstRefTodEnergyConjugatedFieldJumpdFieldp()[extraDOFField][extraDOFField2];
+                 dfieldJumpdFieldm=ipvm->getConstRefTodEnergyConjugatedFieldJumpdFieldm()[extraDOFField][extraDOFField2];
+                 dfieldJumpdField2p=ipvp->getConstRefTodEnergyConjugatedFieldJumpdFieldp()[extraDOFField2][extraDOFField2];
+                 dfieldJumpdField2m=ipvm->getConstRefTodEnergyConjugatedFieldJumpdFieldm()[extraDOFField2][extraDOFField2];
+
+                 k0m  = *(ipvm->getConstRefToLinearK()[extraDOFField][extraDOFField]);
+                 k0p  = *(ipvp->getConstRefToLinearK()[extraDOFField][extraDOFField]);
+                 k02m = *(ipvm->getConstRefToLinearK()[extraDOFField][extraDOFField2]);
+                 k02p = *(ipvp->getConstRefToLinearK()[extraDOFField][extraDOFField2]);
+                }
+              }
+              if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
+                   {
+
+                    dk0mdField_auxm = ipvm->getConstRefTodLinearKdField()[extraDOFField][extraDOFField2][extraDOFField_aux];
+                    dk0pdField_auxp = ipvp->getConstRefTodLinearKdField()[extraDOFField][extraDOFField2][extraDOFField_aux];
+                    dk0mdField_aux2m = ipvm->getConstRefTodLinearKdField()[extraDOFField][extraDOFField_aux][extraDOFField_aux];
+                    dk0pdField_aux2p = ipvp->getConstRefTodLinearKdField()[extraDOFField][extraDOFField_aux][extraDOFField_aux];
+                   
+                    dFielddEnergyConjugatedFieldp = ipvp->getConstRefTodFielddEnergyConjugatedField()[extraDOFField2][extraDOFField2];
+                    dFielddEnergyConjugatedFieldm = ipvm->getConstRefTodFielddEnergyConjugatedField()[extraDOFField2][extraDOFField2]; 
+                    dFielddEnergyConjugatedField2p = ipvp->getConstRefTodFielddEnergyConjugatedField()[extraDOFField_aux][extraDOFField2];
+                    dFielddEnergyConjugatedField2m = ipvm->getConstRefTodFielddEnergyConjugatedField()[extraDOFField_aux][extraDOFField2]; 
+
+                    dGradFielddEnergyConjugatedFieldp = ipvp->getConstRefTodGradFielddEnergyConjugatedField()[extraDOFField2][extraDOFField2]; 
+                    dGradFielddEnergyConjugatedFieldm = ipvm->getConstRefTodGradFielddEnergyConjugatedField()[extraDOFField2][extraDOFField2];
+                    dGradFielddGradEnergyConjugatedFieldp = ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[extraDOFField2][extraDOFField2];
+                    dGradFielddGradEnergyConjugatedFieldm = ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[extraDOFField2][extraDOFField2]; 
+
+                    dGradFielddEnergyConjugatedField2p = ipvp->getConstRefTodGradFielddEnergyConjugatedField()[extraDOFField_aux][extraDOFField2]; 
+                    dGradFielddEnergyConjugatedField2m = ipvm->getConstRefTodGradFielddEnergyConjugatedField()[extraDOFField_aux][extraDOFField2];
+                    dGradFielddGradEnergyConjugatedField2p = ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[extraDOFField_aux][extraDOFField2];
+                    dGradFielddGradEnergyConjugatedField2m = ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[extraDOFField_aux][extraDOFField2]; 
+
+                    dqdField2m = ipvm->getConstRefTodFluxdField()[extraDOFField][extraDOFField_aux];
+                    dqdField2p = ipvp->getConstRefTodFluxdField()[extraDOFField][extraDOFField_aux];
+                    dqdGradField2m = ipvm->getConstRefTodFluxdGradField()[extraDOFField][extraDOFField_aux];
+                    dqdGradField2p = ipvp->getConstRefTodFluxdGradField()[extraDOFField][extraDOFField_aux];
+                   }
+            }  
+
+            int indexField2=3+getNumNonLocalVariable()+extraDOFField2;
+
             // consistency D\mean{q} DT
             // Assembly consistency
+
             for(int j=0;j<nbFFm;j++)
             {
               for(int l=0;l<nbFFm;l++)
               {
                 for(int p = 0; p< 3; p++)
                 {
-                  stiff(j+indexField*nbFFm,l+indexField*nbFFm) -= dqdFieldm->operator()(p)*
-                                                       (Valsm[l+indexField*nbFFm]*Valsm[j+indexField*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio()/2.*nu(p));
+
+                  if((getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())&&(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==2)) stiff(j+indexField*nbFFm,l+indexField2*nbFFm) -= (dqdFieldm->operator()(p)*dFielddEnergyConjugatedFieldm+dqdField2m(p)*dFielddEnergyConjugatedField2m)*(Valsm[l+indexField2*nbFFm]*Valsm[j+indexField*nbFFm]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(p));
+                  else stiff(j+indexField*nbFFm,l+indexField2*nbFFm) -= dqdFieldm->operator()(p)*(Valsm[l+indexField2*nbFFm]*Valsm[j+indexField*nbFFm]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(p));
+
                   for(int q = 0; q< 3; q++)
                   {
-                    stiff(j+indexField*nbFFm,l+indexField*nbFFm) -= dqdGradFieldm->operator()(q,p)*
-                                                                           (Gradsm[l+indexField*nbFFm][p]*Valsm[j+indexField*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio()/2.*nu(q));
+
+                    if((getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())&&(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==2)) stiff(j+indexField*nbFFm,l+indexField2*nbFFm) -=(dqdGradFieldm->operator()(p,q)*dGradFielddEnergyConjugatedFieldm(q)+dqdGradField2m(p,q)*dGradFielddEnergyConjugatedField2m(q))*(Valsm[j+indexField*nbFFm]*Valsm[l+indexField2*nbFFm]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(p));
+                    else stiff(j+indexField*nbFFm,l+indexField2*nbFFm) -= dqdGradFieldm->operator()(q,p)*(Gradsm[l+indexField2*nbFFm][p]*Valsm[j+indexField*nbFFm]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(q));
+
+                    if((getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())&&(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==2))
+                     {
+                       for(int o = 0; o< 3; o++)
+                        {
+
+                          stiff(j+indexField*nbFFm,l+indexField2*nbFFm) -=(dqdGradFieldm->operator()(p,o)*dGradFielddGradEnergyConjugatedFieldm(o,q)+dqdGradField2m(p,o)*dGradFielddGradEnergyConjugatedField2m(o,q))*Valsm[j+indexField*nbFFm]*(Gradsm[l+indexField2*nbFFm][q]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(p));
+                          
+                        }
+                     }
                   }
                 }
               }
@@ -2412,12 +2665,25 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
               {
                 for(int p = 0; p< 3; p++)
                 {
-                  stiff(j+indexField*nbFFm,l+indexField*nbFFp+nbdofm) -= dqdFieldp->operator()(p)*
-                                                       (Valsp[l+indexField*nbFFp]*Valsm[j+indexField*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio()/2.*nu(p)); 
+                  
+                  if((getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())&&(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==2)) stiff(j+indexField*nbFFm,l+indexField2*nbFFp+nbdofm) -= (dqdFieldp->operator()(p)*dFielddEnergyConjugatedFieldp+dqdField2p(p)*dFielddEnergyConjugatedField2p)*(Valsp[l+indexField2*nbFFp]*Valsm[j+indexField*nbFFm]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(p));
+                  else stiff(j+indexField*nbFFm,l+indexField2*nbFFp+nbdofm) -= dqdFieldp->operator()(p)*(Valsp[l+indexField2*nbFFp]*Valsm[j+indexField*nbFFm]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(p));
+
                   for(int q = 0; q< 3; q++)
                   {
-                    stiff(j+indexField*nbFFm,l+indexField*nbFFp+nbdofm) -= dqdGradFieldp->operator()(q,p)*
-                                                       (Gradsp[l+indexField*nbFFp][p]*Valsm[j+indexField*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio()/2.*nu(q));
+                    
+                    if((getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())&&(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==2)) stiff(j+indexField*nbFFm,l+indexField2*nbFFp+nbdofm) -= (dqdGradFieldp->operator()(p,q)*dGradFielddEnergyConjugatedFieldp(q)+dqdGradField2p(p,q)*dGradFielddEnergyConjugatedField2p(q))*Valsm[j+indexField*nbFFm]*(Valsp[l+indexField2*nbFFp]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(p));
+                    else stiff(j+indexField*nbFFm,l+indexField2*nbFFp+nbdofm) -= dqdGradFieldp->operator()(q,p)*(Gradsp[l+indexField2*nbFFp][p]*Valsm[j+indexField*nbFFm]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(q));
+
+                    if((getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())&&(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==2))
+                    {
+                      for(int o = 0; o< 3; o++)
+                      {
+
+                          stiff(j+indexField*nbFFm,l+indexField2*nbFFp+nbdofm) -=(dqdGradFieldp->operator()(p,o)*dGradFielddGradEnergyConjugatedFieldp(o,q)+dqdGradField2p(p,o)*dGradFielddGradEnergyConjugatedField2p(o,q))*Valsm[j+indexField*nbFFm]*(Gradsp[l+indexField2*nbFFp][q]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(p));
+ 
+                      }
+                    }
                   }
                 }
               }
@@ -2428,12 +2694,25 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
               {
                 for(int p = 0; p< 3; p++)
                 {
-                  stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFm) += dqdFieldm->operator()(p)*
-                                                       (Valsm[l+indexField*nbFFm]*Valsp[j+indexField*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio()/2.*nu(p));
+
+                  if((getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())&&(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==2)) stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFm) += (dqdFieldm->operator()(p)*dFielddEnergyConjugatedFieldm+dqdField2m(p)*dFielddEnergyConjugatedField2m)*(Valsm[l+indexField2*nbFFm]*Valsp[j+indexField*nbFFp]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(p));
+                  else stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFm) += dqdFieldm->operator()(p)*(Valsm[l+indexField2*nbFFm]*Valsp[j+indexField*nbFFp]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(p));
+
                   for(int q = 0; q< 3; q++)
                   {
-                    stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFm) += dqdGradFieldm->operator()(q,p)*
-                                                       (Gradsm[l+indexField*nbFFm][p]*Valsp[j+indexField*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio()/2.*nu(q));
+
+                    if((getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())&&(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==2)) stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFm) +=(dqdGradFieldm->operator()(p,q)*dGradFielddEnergyConjugatedFieldm(q)+dqdGradField2m(p,q)*dGradFielddEnergyConjugatedField2m(q))*Valsp[j+indexField*nbFFp]*(Valsm[l+indexField2*nbFFm]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(p));
+                    else stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFm) += dqdGradFieldm->operator()(q,p)*(Gradsm[l+indexField2*nbFFm][p]*Valsp[j+indexField*nbFFp]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(q));
+
+                    if((getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())&&(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==2))
+                   {
+                     for(int o = 0; o< 3; o++)
+                      {
+
+                        stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFm) +=(dqdGradFieldm->operator()(p,o)*dGradFielddGradEnergyConjugatedFieldm(o,q)+dqdGradField2m(p,o)*dGradFielddGradEnergyConjugatedField2m(o,q))*Valsp[j+indexField*nbFFp]*(Gradsm[l+indexField2*nbFFm][q]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(p));
+
+                      }
+                    }
                   }
                 }
               }
@@ -2441,20 +2720,38 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
               {
                 for(int p = 0; p< 3; p++)
                 {
-                  stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFp+nbdofm) += dqdFieldp->operator()(p)*
-                                                      (Valsp[l+indexField*nbFFp]*Valsp[j+indexField*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio()/2.*nu(p));
+
+                  if((getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())&&(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==2)) stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFp+nbdofm) += (dqdFieldp->operator()(p)*dFielddEnergyConjugatedFieldp+dqdField2p(p)*dFielddEnergyConjugatedField2p)*(Valsp[l+indexField2*nbFFp]*Valsp[j+indexField*nbFFp]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(p));
+                  else stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFp+nbdofm) += dqdFieldp->operator()(p)*(Valsp[l+indexField2*nbFFp]*Valsp[j+indexField*nbFFp]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(p));
+
                   for(int q = 0; q< 3; q++)
                   {
-                    stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFp+nbdofm) += dqdGradFieldp->operator()(q,p)*
-                                                      (Gradsp[l+indexField*nbFFp][p]*Valsp[j+indexField*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio()/2.*nu(q));
+
+                    if((getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())&&(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==2)) stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFp+nbdofm) += (dqdGradFieldp->operator()(p,q)*dGradFielddEnergyConjugatedFieldp(q)+dqdGradField2p(p,q)*dGradFielddEnergyConjugatedField2p(q))*(Valsp[j+indexField*nbFFp]*Valsp[l+indexField2*nbFFp]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(p));
+                    else stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFp+nbdofm) += dqdGradFieldp->operator()(q,p)*(Gradsp[l+indexField2*nbFFp][p]*Valsp[j+indexField*nbFFp]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(q));
+
+                    if((getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())&&(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==2))
+                    {
+                      for(int o = 0; o< 3; o++)
+                      {
+
+                          stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFp+nbdofm) += (dqdGradFieldp->operator()(p,o)*dGradFielddGradEnergyConjugatedFieldp(o,q)+dqdGradField2p(p,o)*dGradFielddGradEnergyConjugatedField2p(o,q))*Valsp[j+indexField*nbFFp]*(Gradsp[l+indexField2*nbFFp][q]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.*nu(p));
+                        
+                      }
+                    }
                   }
                 }
               }
             }
+
+
+          if(ipvp->getNumConstitutiveExtraDofDiffusionVariable()==1)
+          {
             // Stability  N \mean{k0} (N)
             double NMeankNBetasc=0.;
             double dNMeankNBetascdFieldp=0.;
             double dNMeankNBetascdFieldm=0.;
+
             for(int l = 0; l <3; l++)
             {
               for(int n = 0; n <3; n++)
@@ -2464,6 +2761,7 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
                 dNMeankNBetascdFieldm+=dk0mdFieldm(l,n)*nu(n)*nbetahs*nu(l)/2.;
               }
             }
+
             // Assembly stability (if not broken)
             for(int j=0;j<nbFFm;j++)
             {
@@ -2561,95 +2859,259 @@ void dG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double>
                 }
               }
             }
-            double gamma=0.;
-            //new related to dialetation
+          }
+          else
+          {
+            // Stability  N \mean{k0} (N)
+            double NMeankNBetasc=0.;
+            double NMeank2NBetasc=0.;
+            double dNMeankNBetascdFieldp=0.;
+            double dNMeankNBetascdFieldm=0.;
+            double dNMeankNBetascdField2p=0.;
+            double dNMeankNBetascdField2m=0.;
+                        double dNMeankNBetascdField_auxp=0.;
+                        double dNMeankNBetascdField_auxm=0.;
+                        double dNMeankNBetascdField_aux2p=0.;
+                        double dNMeankNBetascdField_aux2m=0.;          
+            static STensor3 dNMeankNBetascdFm, dNMeankNBetascdFp;
+
+            STensorOperation::zero(dNMeankNBetascdFm);STensorOperation::zero(dNMeankNBetascdFp);
+
+            for(int l = 0; l <3; l++)
+            {
+              for(int n = 0; n <3; n++)
+              {
+                NMeankNBetasc  += (k0p(l,n)+k0m(l,n))*nu(n)*nbetahs*nu(l)/2.;
+                NMeank2NBetasc += (k02p(l,n)+k02m(l,n))*nu(n)*nbetahs*nu(l)/2.;
+
+                dNMeankNBetascdFieldp  += dk0pdFieldp(l,n)*nu(n)*nbetahs*nu(l)/2.;
+                dNMeankNBetascdFieldm  += dk0mdFieldm(l,n)*nu(n)*nbetahs*nu(l)/2.;
+                dNMeankNBetascdField2p += dk0pdField2p(l,n)*nu(n)*nbetahs*nu(l)/2.;
+                dNMeankNBetascdField2m += dk0mdField2m(l,n)*nu(n)*nbetahs*nu(l)/2.; 
+                
+                if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
+                       {
+                        dNMeankNBetascdField_auxp += dk0pdField_auxp(l,n)*nu(n)*nbetahs*nu(l)/2.;         
+                        dNMeankNBetascdField_auxm += dk0mdField_auxm(l,n)*nu(n)*nbetahs*nu(l)/2.; 
+                        dNMeankNBetascdField_aux2p += dk0pdField_aux2p(l,n)*nu(n)*nbetahs*nu(l)/2.;         
+                        dNMeankNBetascdField_aux2m += dk0mdField_aux2m(l,n)*nu(n)*nbetahs*nu(l)/2.;                 
+                       }
+                for(int j = 0; j<3; j++)
+                  {
+                   for(int p = 0; p<3; p++)
+                    {
+                      dNMeankNBetascdFm(j,p)+=dk0mdFm(l,n,j,p)*nu(j)*nbetahs*nu(p)/2.;
+                      dNMeankNBetascdFp(j,p)+=dk0pdFp(l,n,j,p)*nu(j)*nbetahs*nu(p)/2.;
+                   }                
+                 }
+              }
+            }
+
+            if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
+                {
+                 dNMeankNBetascdFieldp *= dFielddEnergyConjugatedFieldp;
+                 dNMeankNBetascdFieldp += (dNMeankNBetascdField_auxp*dFielddEnergyConjugatedField2p);
+                 dNMeankNBetascdFieldm *= dFielddEnergyConjugatedFieldm;
+                 dNMeankNBetascdFieldm += (dNMeankNBetascdField_auxp*dFielddEnergyConjugatedField2m);
+                 dNMeankNBetascdField2p *= dFielddEnergyConjugatedFieldp;
+                 dNMeankNBetascdField2p += (dNMeankNBetascdField_aux2p*dFielddEnergyConjugatedField2p);
+                 dNMeankNBetascdField2m *= dFielddEnergyConjugatedFieldm;
+                 dNMeankNBetascdField2m += (dNMeankNBetascdField_aux2p*dFielddEnergyConjugatedField2m);
+                 }
+
+            // Assembly stability (if not broken)
             for(int j=0;j<nbFFm;j++)
+            {
+              for(int l=0;l<nbFFm;l++)
+              {
+                if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()) stiff(j+indexField*nbFFm,l+indexField2*nbFFm) += NMeankNBetasc*(Valsm[j+indexField*nbFFm]*Valsm[l+indexField2*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
+                else stiff(j+indexField*nbFFm,l+indexField2*nbFFm) -= (dfieldJumpdFieldm*NMeankNBetasc+dfieldJumpdField2m*NMeank2NBetasc)*
+                                      (Valsm[j+indexField*nbFFm]*Valsm[l+indexField2*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
+                stiff(j+indexField*nbFFm,l+indexField2*nbFFm) -= (fieldJump*dNMeankNBetascdFieldm+fieldJump2*dNMeankNBetascdField2m)*
+                                      (Valsm[j+indexField*nbFFm]*Valsm[l+indexField2*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
+              }
+              for(int l=0;l<nbFFp;l++)
+              {
+                if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()) stiff(j+indexField*nbFFm,l+indexField2*nbFFp+nbdofm) -= NMeankNBetasc*(Valsm[j+indexField*nbFFm]*Valsp[l+indexField2*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
+                else stiff(j+indexField*nbFFm,l+indexField2*nbFFp+nbdofm) -= (dfieldJumpdFieldp*NMeankNBetasc+dfieldJumpdField2p*NMeank2NBetasc)*(Valsm[j+indexField*nbFFm]*Valsp[l+indexField2*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
+                stiff(j+indexField*nbFFm,l+indexField2*nbFFp+nbdofm) -= (fieldJump*dNMeankNBetascdFieldp+fieldJump2*dNMeankNBetascdField2p)*
+                                      (Valsm[j+indexField*nbFFm]*Valsp[l+indexField2*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
+              }
+            }
+            for(int j=0;j<nbFFp;j++)
+            {
+              for(int l=0;l<nbFFm;l++)
+              {
+                if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()) stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFm) -= NMeankNBetasc*(Valsp[j+indexField*nbFFp]*Valsm[l+indexField2*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
+                else stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFm) += (dfieldJumpdFieldm*NMeankNBetasc+dfieldJumpdField2m*NMeank2NBetasc)*(Valsp[j+indexField*nbFFp]*Valsm[l+indexField2*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
+                stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFm) += (fieldJump*dNMeankNBetascdFieldm+fieldJump2*dNMeankNBetascdField2m)*(Valsp[j+indexField*nbFFp]*Valsm[l+indexField2*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
+              }
+              for(int l=0;l<nbFFp;l++)
+              {
+                if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()) stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFp+nbdofm) += NMeankNBetasc*(Valsp[j+indexField*nbFFp]*Valsp[l+indexField2*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
+                else stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFp+nbdofm) += (dfieldJumpdFieldp*NMeankNBetasc+dfieldJumpdField2p*NMeank2NBetasc)*(Valsp[j+indexField*nbFFp]*Valsp[l+indexField2*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
+                stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFp+nbdofm) += (fieldJump*dNMeankNBetascdFieldp+fieldJump2*dNMeankNBetascdField2p)*(Valsp[j+indexField*nbFFp]*Valsp[l+indexField2*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio());
+              }
+            }
+ 
+
+           for(int j=0;j<nbFFm;j++)
             {
               for(int k=0;k<3;k++)
+               {
+                 for(int l=0;l<nbFFm;l++)
+                  {
+                   for(int p=0;p<3;p++)
+                    {
+                     stiff(j+indexField*nbFFm,l+k*nbFFm) -= fieldJump*dNMeankNBetascdFm(k,p)*Gradsm[l+0*nbFFm][p]*Valsm[j+indexField*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio();
+                  
+                    }
+                  }
+                 for(int l=0;l<nbFFp;l++)
+                  {
+                   for(int p=0;p<3;p++)
+                    {
+                     stiff(j+indexField*nbFFm,l+k*nbFFp+nbdofm) -= fieldJump*dNMeankNBetascdFp(k,p)*Gradsp[l+0*nbFFp][p]*Valsm[j+indexField*nbFFm]*wJ*getConstitutiveExtraDofDiffusionEqRatio();
+                    }
+                  }
+                } 
+              }
+
+            for(int j=0;j<nbFFp;j++)
+            {
+             for(int k=0;k<3;k++)
               {
-                for(int l=0;l<nbFFm;l++)
+               for(int l=0;l<nbFFm;l++)
                 {
-                  for(int p =0; p < 3; p++)
+                 for(int p=0;p<3;p++)
                   {
-                    stiff(j+indexField*nbFFm,l+k*nbFFm) -= gamma*(Stiff_alphadialitationm(k,p)*Valsm[j+indexField*nbFFm])*(nu(p)*wJ/2.*Valsm[l+0*nbFFm])*(-1.);
+                   stiff(j+indexField*nbFFp+nbdofm,l+k*nbFFm) += fieldJump*dNMeankNBetascdFm(k,p)*Gradsm[l+0*nbFFm][p]*Valsp[j+indexField*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio();
+                   }
+                 }
+
+                for(int l=0;l<nbFFp;l++)
+                {
+                 for(int p=0;p<3;p++)
+                  {
+                   stiff(j+indexField*nbFFp+nbdofm,l+k*nbFFp+nbdofm) +=fieldJump*dNMeankNBetascdFp(k,p)*Gradsp[l+0*nbFFp][p]*Valsp[j+indexField*nbFFp]*wJ*getConstitutiveExtraDofDiffusionEqRatio();
+                }
+              }
+            }
+          }
+            // compatibility
+            // Assembly (loop on shape function)
+
+          for(int j=0;j<nbFFm;j++)
+            {
+              for(int l=0;l<nbFFm;l++)
+              {
+                for(int p =0; p < 3; p++)
+                {
+                  for(int q =0; q < 3; q++)
+                  {
+                    if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()) stiff(j+indexField*nbFFm,l+indexField2*nbFFm) -= (k0m(p,q)*Gradsm[j+indexField*nbFFm][q])*nu(p)*Valsm[l+indexField2*nbFFm]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.;
+                    else stiff(j+indexField*nbFFm,l+indexField2*nbFFm) += ((k0m(p,q)*Gradsm[j+indexField*nbFFm][q])*nu(p)*Valsm[l+indexField2*nbFFm]*dfieldJumpdFieldm*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.)+((k02m(p,q)*Gradsm[j+indexField*nbFFm][q])*nu(p)*Valsm[l+indexField2*nbFFm]*dfieldJumpdField2m*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.);
+
+                    if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()) stiff(j+indexField*nbFFm,l+indexField2*nbFFm) += (fieldJump*(dk0mdFieldm(p,q)*dFielddEnergyConjugatedFieldm+dk0mdField_auxm(p,q)*dFielddEnergyConjugatedField2m)+fieldJump2*(dk0mdField2m(p,q)*dFielddEnergyConjugatedFieldm+dk0mdField_aux2m(p,q)*dFielddEnergyConjugatedField2m))*Gradsm[j+indexField*nbFFm][q]*nu(p)*Valsm[l+indexField2*nbFFm]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.;
+                    else stiff(j+indexField*nbFFm,l+indexField2*nbFFm) += (fieldJump*(dk0mdFieldm(p,q)*Gradsm[j+indexField*nbFFm][q])*nu(p)*Valsm[l+indexField2*nbFFm]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.)+(fieldJump2*(dk0mdField2m(p,q)*Gradsm[j+indexField*nbFFm][q])*nu(p)*Valsm[l+indexField2*nbFFm]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.);
                   }
                 }
-                for(int l=0;l<nbFFp;l++)
+              }
+              for(int l=0;l<nbFFp;l++)
+              {
+                for(int p =0; p < 3; p++)
                 {
-                  for(int p =0; p < 3; p++)
+                  for(int q =0; q < 3; q++)
                   {
-                    stiff(j+indexField*nbFFm,l+k*nbFFp+nbdofm) += gamma*(Stiff_alphadialitationm(k,p)*Valsm[j+indexField*nbFFm])*(nu(p)*wJ/2.*Valsp[l+0*nbFFp])*(-1.);
+                    if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()) stiff(j+indexField*nbFFm,l+indexField2*nbFFp+nbdofm) += (k0m(p,q)*Gradsm[j+indexField*nbFFm][q])*nu(p)*Valsp[l+indexField2*nbFFp]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.;
+                    else stiff(j+indexField*nbFFm,l+indexField2*nbFFp+nbdofm) += ((k0m(p,q)*Gradsm[j+indexField*nbFFm][q])*nu(p)*Valsp[l+indexField2*nbFFp]*dfieldJumpdFieldp*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.)+((k02m(p,q)*Gradsm[j+indexField*nbFFm][q])*nu(p)*Valsp[l+indexField2*nbFFp]*dfieldJumpdField2p*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.);
                   }
                 }
               }
             }
+
             for(int j=0;j<nbFFp;j++)
             {
-              for(int k=0;k<3;k++)
+              for(int l=0;l<nbFFm;l++)
               {
-                for(int l=0;l<nbFFm;l++)
+                for(int p =0; p < 3; p++)
                 {
-                  for(int p =0; p < 3; p++)
+                  for(int q =0; q < 3; q++)
                   {
-                    stiff(j+indexField*nbFFp+nbdofm,l+k*nbFFm) -= gamma*(Stiff_alphadialitationp(k,p)*Valsp[j+indexField*nbFFp])*(nu(p)*wJ/2.*Valsm[l+0*nbFFm])*(-1.);
+                    if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()) stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFm) -= (k0p(p,q)*Gradsp[j+indexField*nbFFp][q])*(nu(p)*Valsm[l+indexField2*nbFFm])*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.;
+                    else stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFm) += ((k0p(p,q)*Gradsp[j+indexField*nbFFp][q])*nu(p)*Valsm[l+indexField2*nbFFm]*dfieldJumpdFieldm*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.)+((k02p(p,q)*Gradsp[j+indexField*nbFFp][q])*nu(p)*Valsm[l+indexField2*nbFFm]*dfieldJumpdField2m*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.);
                   }
                 }
-                for(int l=0;l<nbFFp;l++)
+              }
+              for(int l=0;l<nbFFp;l++)
+              {
+                for(int p =0; p < 3; p++)
                 {
-                  for(int p =0; p < 3; p++)
+                  for(int q =0; q < 3; q++)
                   {
-                    stiff(j+indexField*nbFFp+nbdofm,l+k*nbFFp+nbdofm) += gamma*(Stiff_alphadialitationp(k,p)*Valsp[j+indexField*nbFFp])*(nu(p)*wJ/2.*Valsp[l+0*nbFFp])*(-1.);
+                    if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()) stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFp+nbdofm) += (k0p(p,q)*Gradsp[j+indexField*nbFFp][q])*nu(p)*Valsp[l+indexField2*nbFFp]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.;
+                    else stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFp+nbdofm) += ((k0p(p,q)*Gradsp[j+indexField*nbFFp][q])*nu(p)*Valsp[l+indexField2*nbFFp]*dfieldJumpdFieldp*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.)+((k02p(p,q)*Gradsp[j+indexField*nbFFp][q])*nu(p)*Valsp[l+indexField2*nbFFp]*dfieldJumpdField2p*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.);
+
+                    if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField()) stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFp+nbdofm) += (fieldJump*(dk0pdFieldp(p,q)*dFielddEnergyConjugatedFieldp+dk0pdField_auxp(p,q)*dFielddEnergyConjugatedField2p)+fieldJump2*(dk0pdField2p(p,q)*dFielddEnergyConjugatedFieldp+dk0pdField_aux2p(p,q)*dFielddEnergyConjugatedField2p))*Gradsp[j+indexField*nbFFp][q]*(nu(p)*getConstitutiveExtraDofDiffusionEqRatio()*(wJ/2.)*Valsp[l+indexField2*nbFFp]);
+                    else stiff(j+indexField*nbFFp+nbdofm,l+indexField2*nbFFp+nbdofm) += (fieldJump*(dk0pdFieldp(p,q)*Gradsp[j+indexField*nbFFp][q])*nu(p)*Valsp[l+indexField2*nbFFp]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.)+(fieldJump2*(dk0pdField2p(p,q)*Gradsp[j+indexField*nbFFp][q])*nu(p)*Valsp[l+indexField2*nbFFp]*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.);
                   }
                 }
               }
             }
-
-            if(getConstitutiveExtraDofDiffusionUseEnergyConjugatedField())
+           
+            for(int j=0;j<nbFFm;j++)
             {
-              for(int j=0;j<nbFFm;j++)
+              for(int l=0;l<nbFFm;l++)
               {
-                for(int l=0;l<nbFFm;l++)
+                for(int m =0; m < 3; m++)
                 {
-                  for(int k =0; k < 3; k++)
+                  for(int p =0; p < 3; p++)
                   {
-                    for(int p =0; p < 3; p++)
+                    for(int q =0; q < 3; q++)
                     {
-                      // stiff(j+indexField*nbFFm,l+indexField*nbFFm) += jump(k)*(Stiff_alphadialitationm(k,p)*(2./fieldm)*Valsm[j+indexField*nbFFm])*nu(p)*Valsm[l+indexField*nbFFm]*wJ/2.*(-1.);
-                      stiff(j+indexField*nbFFm,l+indexField*nbFFm) += gamma*jump(k)*
-                          (dStiff_alphadialitationmdFieldm(k,p)*Valsm[j+indexField*nbFFm])*nu(p)*Valsm[l+indexField*nbFFm]*wJ/2.*(-1.);
+                      for(int n =0; n< 3; n++)
+                                  {
+                        stiff(j+indexField*nbFFm,l+m*nbFFm) += fieldJump*(dk0mdFm(p,q,m,n)*Gradsm[j+indexField*nbFFm][q]*Gradsm[l+0*nbFFm][n])*(nu(p)*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.);
+                      }
                     }
                   }
                 }
               }
-              for(int j=0;j<nbFFp;j++)
+            }
+
+            for(int j=0;j<nbFFp;j++)
+            {
+              for(int l=0;l<nbFFp;l++)
               {
-                for(int l=0;l<nbFFp;l++)
+                for(int m =0; m < 3; m++)
                 {
-                  for(int k =0; k < 3; k++)
+                  for(int n =0; n< 3; n++)
                   {
-                    for(int p =0; p< 3; p++)
+                    for(int p =0; p < 3; p++)
                     {
-                      //  stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFp+nbdofm) += jump(k)*(Stiff_alphadialitationp(k,p)*(2./fieldp)*Valsp[j+indexField*nbFFp])*nu(p)*Valsp[l+indexField*nbFFp]*wJ/2.*(-1.);
-                      stiff(j+indexField*nbFFp+nbdofm,l+indexField*nbFFp+nbdofm) += gamma*jump(k)*
-                          (dStiff_alphadialitationpdFieldp(k,p)*Valsp[j+indexField*nbFFp])*nu(p)*Valsp[l+indexField*nbFFp]*wJ/2.*(-1.);
+                      for(int q =0; q < 3; q++)
+                      {
+                        stiff(j+indexField*nbFFp+nbdofm,l+m*nbFFp+nbdofm) += fieldJump*(dk0pdFp(p,q,m,n)*Gradsp[j+indexField*nbFFp][q]*Gradsp[l+0*nbFFp][n])*(nu(p)*getConstitutiveExtraDofDiffusionEqRatio()*wJ/2.);
+                      }
                     }
                   }
                 }
               }
             }
+
+          }
             for (int nlk = 0; nlk < ipvp->getNumberNonLocalVariable(); nlk++){
               Msg::Error("Implement extra dof / non-local coupling in dG3DStiffnessInter::get");
               const SVector3 &dFluxdNonLocalVariablem = ipvm->getConstRefTodFluxdNonLocalVariable()[extraDOFField][nlk];
               const SVector3 &dFluxdNonLocalVariablep = ipvm->getConstRefTodFluxdNonLocalVariable()[extraDOFField][nlk];
             }
-//
+           }
           }
-        }
-}//to remove after migration
+         }
       }
     }
   }
-  // stiff.print("dginter");
+   //stiff.print("dginter");
 }
 
 
@@ -2938,7 +3400,7 @@ void ElecTherMechDG3DStiffnessBulk::get(MElement *ele,int npts,IntPt *GP,fullMat
         const STensor3  &dPdT          = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodPdT());
         const SVector3  &gradV         = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefToGradV());
         const SVector3  &FluxV         = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefToFluxV());
-        const STensor33 &dFluxVdF      = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxVdF());
+        const STensor33 &dFluxVdF      = (*(static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodFluxVdF());
         const double    w              = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefToThermalSource());
         const double    dwdt           = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodThermalSourcedT());
         const STensor3  &dwdF          = ((static_cast <const ElecTherMechDG3DIPVariableBase * > (vipv[i]))->getConstRefTodThermalSourcedF());
@@ -3074,8 +3536,8 @@ void ElecTherMechDG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVec
 {
 
   dG3DForceInter::get(ele, npts, GP,m);
-
- /* const fullVector<double> &datafield = *_data;
+/*
+  const fullVector<double> &datafield = *_data;
   MInterfaceElement *ie = dynamic_cast<MInterfaceElement*>(ele);
   const int nbFFm = ie->getElem(0)->getNumVertices();
   const int nbFFp = ie->getElem(1)->getNumVertices();
@@ -3624,7 +4086,7 @@ void ElecTherMechDG3DForceInter::get(MElement *ele, int npts, IntPt *GP, fullVec
 void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double> &stiff) const
 {
   dG3DStiffnessInter::get(ele,npts,GP,stiff);
-
+/*
   MInterfaceElement *ie = dynamic_cast<MInterfaceElement*>(ele);
   const int nbFFm = ie->getElem(0)->getNumVertices();
   const int nbFFp = ie->getElem(1)->getNumVertices();
@@ -3779,15 +4241,15 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
             const SVector3 *dgradTdfTp     = &(ipvp->getConstRefTodgradTdfT());
             const SVector3 *dgradTdfVp     = &(ipvp->getConstRefTodgradTdfV());
 
-          /*  const STensor3  *jy1m	= (ipvm->getConstRefToEnergyConductivity());
-            const STensor43 *djy1dFm    = &(ipvm->getConstRefTodEnergyConductivitydF());
-            const STensor3  *djy1dVm	= &(ipvm->getConstRefTodEnergyConductivitydV());
-            const STensor3  *djy1dTm	= &(ipvm->getConstRefTodEnergyConductivitydT());
+          //  const STensor3  *jy1m	= (ipvm->getConstRefToEnergyConductivity());
+          //  const STensor43 *djy1dFm    = &(ipvm->getConstRefTodEnergyConductivitydF());
+          //  const STensor3  *djy1dVm	= &(ipvm->getConstRefTodEnergyConductivitydV());
+          //  const STensor3  *djy1dTm	= &(ipvm->getConstRefTodEnergyConductivitydT());
 
-            const STensor3  *jy1p	= (ipvp->getConstRefToEnergyConductivity());
-            const STensor43 *djy1dFp    = &(ipvp->getConstRefTodEnergyConductivitydF());
-            const STensor3  *djy1dVp	= &(ipvp->getConstRefTodEnergyConductivitydV());
-            const STensor3  *djy1dTp	= &(ipvp->getConstRefTodEnergyConductivitydT());  */
+          //  const STensor3  *jy1p	= (ipvp->getConstRefToEnergyConductivity());
+          //  const STensor43 *djy1dFp    = &(ipvp->getConstRefTodEnergyConductivitydF());
+          //  const STensor3  *djy1dVp	= &(ipvp->getConstRefTodEnergyConductivitydV());
+          //  const STensor3  *djy1dTp	= &(ipvp->getConstRefTodEnergyConductivitydT());  
 
             const STensor3  *jy1m	= (ipvm->getConstRefToTherConductivity());
             const STensor43 *djy1dFm    = &(ipvm->getConstRefTodTherConductivitydF());
@@ -3799,7 +4261,7 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
             const STensor3  *djy1dVp	= &(ipvp->getConstRefTodTherConductivitydv());
             const STensor3  *djy1dTp	= &(ipvp->getConstRefTodTherConductivitydT()); 
 
-            /*static STensor3 jy1m, jy1m_1;
+        //    static STensor3 jy1m, jy1m_1;
             STensorOperation::zero(jy1m); STensorOperation::zero(jy1m_1);
             STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradField()[0][0],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],jy1m_1);
             STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradField()[0][1],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],jy1m);
@@ -3857,7 +4319,7 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
             STensorOperation::zero(djy1dTp); STensorOperation::zero(djy1dTp_1);
             STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradFielddField()[0][0][0],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],djy1dTp_1);
             STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradFielddField()[0][1][0],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],djy1dTp);
-            djy1dTp += djy1dTp_1;*/
+            djy1dTp += djy1dTp_1; //
 
             const STensor33 *djydFp	= &(ipvp->getConstRefTodFluxEnergydF());
             const STensor3  *djydGradTp	= &(ipvp->getConstRefTodFluxEnergydGradT());
@@ -3881,7 +4343,7 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
             // Assembly consistency (from derivative of sigma with extra field)
             int indexFieldfT=3+getNumNonLocalVariable();
             int indexFieldfV=3+getNumNonLocalVariable()+1;
-            for(int j=0;j<nbFFm;j++)
+          for(int j=0;j<nbFFm;j++)
             {
               for(int k=0;k<3;k++)
               {
@@ -4040,7 +4502,7 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
 
              // consistency D\mean{q} DT
             //dfI1tdft+dfI1tdfv
-            for(int j=0;j<nbFFm;j++)
+           for(int j=0;j<nbFFm;j++)
             {
               for(int l=0;l<nbFFm;l++)
               {
@@ -4913,7 +5375,6 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
           Stiff_alphadialitationp*= (-1.)*(Tp*Tp);
           const SVector3 &jump = ipvp->getConstRefToJump();
 
-
           if(broken)
           {
 
@@ -4954,15 +5415,15 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
             const SVector3  *djedTm     = &(ipvm->getConstRefTodFluxVdT());
             const SVector3  *djedTp     = &(ipvp->getConstRefTodFluxVdT());
 
-          /*  const STensor3  *jy1m	= (ipvm->getConstRefToEnergyConductivity());
-            const STensor43 *djy1dFm    = &(ipvm->getConstRefTodEnergyConductivitydF());
-            const STensor3  *djy1dVm	= &(ipvm->getConstRefTodEnergyConductivitydV());
-            const STensor3  *djy1dTm	= &(ipvm->getConstRefTodEnergyConductivitydT());
+         //   const STensor3  *jy1m	= (ipvm->getConstRefToEnergyConductivity());
+         //   const STensor43 *djy1dFm    = &(ipvm->getConstRefTodEnergyConductivitydF());
+         //   const STensor3  *djy1dVm	= &(ipvm->getConstRefTodEnergyConductivitydV());
+         //   const STensor3  *djy1dTm	= &(ipvm->getConstRefTodEnergyConductivitydT());
 
-            const STensor3  *jy1p	= (ipvp->getConstRefToEnergyConductivity());
-            const STensor43 *djy1dFp    = &(ipvp->getConstRefTodEnergyConductivitydF());
-            const STensor3  *djy1dVp	= &(ipvp->getConstRefTodEnergyConductivitydV());
-            const STensor3  *djy1dTp	= &(ipvp->getConstRefTodEnergyConductivitydT()); */
+         //    const STensor3  *jy1p	= (ipvp->getConstRefToEnergyConductivity());
+         //   const STensor43 *djy1dFp    = &(ipvp->getConstRefTodEnergyConductivitydF());
+         //   const STensor3  *djy1dVp	= &(ipvp->getConstRefTodEnergyConductivitydV());
+         //  const STensor3  *djy1dTp	= &(ipvp->getConstRefTodEnergyConductivitydT()); 
 
             const STensor3  *jy1m	= (ipvm->getConstRefToTherConductivity());
             const STensor43 *djy1dFm    = &(ipvm->getConstRefTodTherConductivitydF());
@@ -4974,7 +5435,7 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
             const STensor3  *djy1dVp	= &(ipvp->getConstRefTodTherConductivitydv());
             const STensor3  *djy1dTp	= &(ipvp->getConstRefTodTherConductivitydT()); 
 
-           /* static STensor3 jy1m, jy1m_1;
+           // static STensor3 jy1m, jy1m_1;
             STensorOperation::zero(jy1m); STensorOperation::zero(jy1m_1);
             STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradField()[0][0],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],jy1m_1);
             STensorOperation::multSTensor3(ipvm->getConstRefTodFluxdGradField()[0][1],ipvm->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],jy1m);
@@ -5032,7 +5493,7 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
             STensorOperation::zero(djy1dTp); STensorOperation::zero(djy1dTp_1);
             STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradFielddField()[0][0][0],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[0][0],djy1dTp_1);
             STensorOperation::multSTensor3(ipvp->getConstRefTodFluxdGradFielddField()[0][1][0],ipvp->getConstRefTodGradFielddGradEnergyConjugatedField()[1][0],djy1dTp);
-            djy1dTp += djy1dTp_1; */
+            djy1dTp += djy1dTp_1; //
 
             const STensor33 *djydFp	= &(ipvp->getConstRefTodFluxEnergydF());
             const STensor3  *djydGradTp	= &(ipvp->getConstRefTodFluxEnergydGradT());
@@ -5055,7 +5516,7 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
 
             // Assembly consistency (from derivative of sigma with extra field)
             //dpdV +dpdT
-            for(int j=0;j<nbFFm;j++)
+           for(int j=0;j<nbFFm;j++)
             {
               for(int k=0;k<3;k++)
               {
@@ -5157,6 +5618,7 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
                 }
               }
             }
+
             //djedf  (derivative if cross term)
             for(int j=0;j<nbFFm;j++)
             {
@@ -5404,7 +5866,7 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
               }
             }
 
-            for(int j=0;j<nbFFm;j++)
+           for(int j=0;j<nbFFm;j++)
             {
               for(int l=0;l<nbFFm;l++)
               {
@@ -5560,7 +6022,6 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
               }
             }
 
-
             //F
              //new terms for dfvI3dF +dfTI3dF
             for(int j=0;j<nbFFm;j++)
@@ -5683,7 +6144,6 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
                 }
               }
             }
-
                 //new related to dialetation
 
 
@@ -5695,7 +6155,7 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
                 {
                   for(int p =0; p < 3; p++)
                   {
-                    stiff(j+indexFieldfT*nbFFm,l+indexFieldfT*nbFFm) += gamma* jump(k)*(Stiff_alphadialitationm(k,p)*(2./Tm)*Valsm[j+indexFieldfT*nbFFm])*nu(p)*Valsm[l+indexFieldfT*nbFFm]*wJ/2.*(-1.)/eqRatio;
+                    stiff(j+indexFieldfT*nbFFm,l+indexFieldfT*nbFFm) += gamma*(jump(k)*(Stiff_alphadialitationm(k,p)*(2./Tm)*Valsm[j+indexFieldfT*nbFFm])*nu(p)*Valsm[l+indexFieldfT*nbFFm]*wJ/2.*(-1.)/eqRatio);
                   }
                 }
               }
@@ -5710,7 +6170,7 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
                   for(int p =0; p< 3; p++)
                   {
 
-                    stiff(j+indexFieldfT*nbFFp+nbdofm,l+indexFieldfT*nbFFp+nbdofm) += gamma* jump(k)*(Stiff_alphadialitationp(k,p)*(2./Tp)*Valsp[j+indexFieldfT*nbFFp])*nu(p)*Valsp[l+indexFieldfT*nbFFp]*wJ/2.*(-1.)/eqRatio;
+                    stiff(j+indexFieldfT*nbFFp+nbdofm,l+indexFieldfT*nbFFp+nbdofm) += gamma*(jump(k)*(Stiff_alphadialitationp(k,p)*(2./Tp)*Valsp[j+indexFieldfT*nbFFp])*nu(p)*Valsp[l+indexFieldfT*nbFFp]*wJ/2.*(-1.)/eqRatio);
                   }
                 }
               }
@@ -5723,14 +6183,14 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
                 {
                   for(int p =0; p < 3; p++)
                   {
-                      stiff(j+indexFieldfT*nbFFm,l+k*nbFFm) -= gamma* (Stiff_alphadialitationm(k,p)*Valsm[j+indexFieldfT*nbFFm])*(nu(p)*wJ/2.*Valsm[l+0*nbFFm])/eqRatio*(-1.);
+                      stiff(j+indexFieldfT*nbFFm,l+k*nbFFm) -= gamma*((Stiff_alphadialitationm(k,p)*Valsm[j+indexFieldfT*nbFFm])*(nu(p)*wJ/2.*Valsm[l+0*nbFFm])/eqRatio*(-1.));
                   }
                 }
                 for(int l=0;l<nbFFp;l++)
                 {
                   for(int p =0; p < 3; p++)
                   {
-                      stiff(j+indexFieldfT*nbFFm,l+k*nbFFp+nbdofm) +=  gamma*(Stiff_alphadialitationm(k,p)*Valsm[j+indexFieldfT*nbFFm])*(nu(p)*wJ/2.*Valsp[l+0*nbFFp])/eqRatio*(-1.);
+                      stiff(j+indexFieldfT*nbFFm,l+k*nbFFp+nbdofm) +=  gamma*((Stiff_alphadialitationm(k,p)*Valsm[j+indexFieldfT*nbFFm])*(nu(p)*wJ/2.*Valsp[l+0*nbFFp])/eqRatio*(-1.));
                   }
                 }
               }
@@ -5744,21 +6204,20 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
                 {
                   for(int p =0; p < 3; p++)
                   {
-                    stiff(j+indexFieldfT*nbFFp+nbdofm,l+k*nbFFm) -=  gamma*(Stiff_alphadialitationp(k,p)*Valsp[j+indexFieldfT*nbFFp])*(nu(p)*wJ/2.*Valsm[l+0*nbFFm])/eqRatio*(-1.);
+                    stiff(j+indexFieldfT*nbFFp+nbdofm,l+k*nbFFm) -=  gamma*((Stiff_alphadialitationp(k,p)*Valsp[j+indexFieldfT*nbFFp])*(nu(p)*wJ/2.*Valsm[l+0*nbFFm])/eqRatio*(-1.));
                   }
                 }
                 for(int l=0;l<nbFFp;l++)
                 {
                   for(int p =0; p < 3; p++)
                   {
-                      stiff(j+indexFieldfT*nbFFp+nbdofm,l+k*nbFFp+nbdofm) +=  gamma*(Stiff_alphadialitationp(k,p)*Valsp[j+indexFieldfT*nbFFp])*(nu(p)*wJ/2.*Valsp[l+0*nbFFp])/eqRatio*(-1.);
+                      stiff(j+indexFieldfT*nbFFp+nbdofm,l+k*nbFFp+nbdofm) +=  (gamma*(Stiff_alphadialitationp(k,p)*Valsp[j+indexFieldfT*nbFFp])*(nu(p)*wJ/2.*Valsp[l+0*nbFFp])/eqRatio*(-1.));
                   }
                 }
               }
             }
-
             //dfI2tdv
-            for(int j=0;j<nbFFm;j++)
+           for(int j=0;j<nbFFm;j++)
             {
               for(int l=0;l<nbFFm;l++)
               {
@@ -5923,7 +6382,7 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
             }
 
           //dfTI2dF+dfvI2dF
-            for(int j=0;j<nbFFm;j++)
+         for(int j=0;j<nbFFm;j++)
             {
               for(int l=0;l<nbFFm;l++)
               {
@@ -5975,7 +6434,9 @@ void ElecTherMechDG3DStiffnessInter::get(MElement *ele,int npts,IntPt *GP,fullMa
       }
     }
   }
-  // stiff.print("dginter");
+*/
+   //stiff.print("dginter last");
+
 };
 
 
diff --git a/dG3D/src/dG3DTerms.h b/dG3D/src/dG3DTerms.h
index b54a9524b..28b9d422c 100644
--- a/dG3D/src/dG3DTerms.h
+++ b/dG3D/src/dG3DTerms.h
@@ -1284,11 +1284,11 @@ class ElecTherMechDG3DStiffnessInter : public dG3DStiffnessInter
                                           mlawMinus, mlawPlus,iquad,beta1_, ip, uf,fulldg, increBased,eps), _ElecTherMechBeta(ElecTherMechBeta_),
                                        _continuity(continuity_), _ElecTherMechEqRatio(ElecTherMechEqRatio),_useFtFv(ftfv)
   {
-    //setNumConstitutiveExtraDofDiffusionVariable(2);
+    setNumConstitutiveExtraDofDiffusionVariable(2);
     setConstitutiveExtraDofDiffusionEqRatio(ElecTherMechEqRatio);
     setConstitutiveExtraDofDiffusionUseEnergyConjugatedField(ftfv);
     setConstitutiveExtraDofDiffusionStabilityParameter(ElecTherMechBeta_); 
-    setConstitutiveExtraDofDiffusionContinuity(_continuity); 
+    setConstitutiveExtraDofDiffusionContinuity(_continuity);
   }
   virtual ~ElecTherMechDG3DStiffnessInter() {}
   virtual void get(MElement *ele,int npts,IntPt *GP, fullMatrix<double> &m)const;
-- 
GitLab


From 7284b17af5af7f1e3f628fd28e668d0bfd7c8b02 Mon Sep 17 00:00:00 2001
From: noels ludovic <l.noels@ulg.ac.be>
Date: Thu, 24 Jan 2019 14:28:37 +0100
Subject: [PATCH 7/9] update wrappers

---
 cm3apps/install.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cm3apps/install.txt b/cm3apps/install.txt
index a5358652f..cb02cfe63 100644
--- a/cm3apps/install.txt
+++ b/cm3apps/install.txt
@@ -289,7 +289,7 @@ alredy in your .bashrc
 	  export PATH=$PATH:$HOME/gmsh/projects/dG3D/release
 	  export PATH=$PATH:$HOME/gmsh/projects/dG3D/release/NonLinearSolver/gmsh
 
-	  export PYTHONPATH=$PYTHONPATH:$HOME/gmsh/projects/dG3D/release:$HOME/gmsh/projects/dG3D/release/NonLinearSolver/gmsh/utils/wrappers
+	  export PYTHONPATH=$PYTHONPATH:$HOME/gmsh/projects/dG3D/release:$HOME/gmsh/projects/dG3D/release/NonLinearSolver/gmsh/utils/wrappers:$HOME/gmsh/projects/dG3D/release/NonLinearSolver/gmsh/utils/wrappers/gmshpy
      
           !!!! USE ENABLE_CXX11=OFF; for old version :in CMakeList of dG3D and NonLinearSolver, replate std=c++11 by std=c++0x to get set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -DNONLOCALGMSH -std=c++0x")	
 	  !!!! if gmsh run error related to metis, compile gmsh without METIS
-- 
GitLab


From d6552361373fee70b00e06c7bde70c276f9e2382 Mon Sep 17 00:00:00 2001
From: noels ludovic <l.noels@ulg.ac.be>
Date: Thu, 24 Jan 2019 14:31:04 +0100
Subject: [PATCH 8/9] update

---
 cm3apps/install.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cm3apps/install.txt b/cm3apps/install.txt
index cb02cfe63..bbdb1f0e4 100644
--- a/cm3apps/install.txt
+++ b/cm3apps/install.txt
@@ -502,8 +502,8 @@ D) Now you can install your project(s) (dgshell and/or dG3D and/or msch), NonLin
               export PATH=$PATH:$HOME/cm3Libraries/dgshell/release/NonLinearSolver/gmsh
               export PATH=$PATH:$HOME/cm3Libraries/dG3D/debug/NonLinearSolver/gmsh
               export PATH=$PATH:$HOME/cm3Libraries/dG3D/release/NonLinearSolver/gmsh
-              export PYTHONPATH=$PYTHONPATH:$HOME/cm3Libraries/dgshell/release:$HOME/cm3Libraries/dgshell/release/dG3D:$HOME/cm3Libraries/dgshell/debug/NonLinearSolver/gmsh/utils/wrappers:$HOME/cm3Libraries/dgshell/release/NonLinearSolver/gmsh/utils/wrappers
-              export PYTHONPATH=$PYTHONPATH:$HOME/cm3Libraries/dG3D/release:$HOME/cm3Libraries/dG3D/debug:$HOME/cm3Libraries/dG3D/debug/NonLinearSolver/gmsh/utils/wrappers:$HOME/cm3Libraries/dG3D/release/NonLinearSolver/gmsh/utils/wrappers
+	      export PYTHONPATH=$PYTHONPATH:$HOME/cm3Libraries/dgshell/release:$HOME/cm3Libraries/dgshell/release/dG3D:$HOME/cm3Libraries/dgshell/debug/NonLinearSolver/gmsh/utils/wrappers:$HOME/cm3Libraries/dgshell/debug/NonLinearSolver/gmsh/utils/wrappers/gmshpy:$HOME/cm3Libraries/dgshell/release/NonLinearSolver/gmsh/utils/wrapper::$HOME/cm3Libraries/dgshell/release/NonLinearSolver/gmsh/utils/wrappers/gmshpy
+              export PYTHONPATH=$PYTHONPATH:$HOME/cm3Libraries/dG3D/release:$HOME/cm3Libraries/dG3D/debug:$HOME/cm3Libraries/dG3D/debug/NonLinearSolver/gmsh/utils/wrappers:$HOME/cm3Libraries/dG3D/debug/NonLinearSolver/gmsh/utils/wrappers/gmshpy:$HOME/cm3Libraries/dG3D/release/NonLinearSolver/gmsh/utils/wrappers:$HOME/cm3Libraries/dG3D/release/NonLinearSolver/gmsh/utils/wrappers/gmshpy
 
           (reload bashrc)
             exit the terminal and loggin again (to reload your .bashrc file)
-- 
GitLab


From 77a3c691d3ebc01a950a12023862cb7dadfc0e3f Mon Sep 17 00:00:00 2001
From: Van Dung NGUYEN <vdg.nguyen@gmail.com>
Date: Tue, 29 Jan 2019 15:52:52 +0100
Subject: [PATCH 9/9] fix problem to mass matrix with nonlocal dofs

---
 NonLinearSolver/nlTerms/nlTerms.cpp | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/NonLinearSolver/nlTerms/nlTerms.cpp b/NonLinearSolver/nlTerms/nlTerms.cpp
index d3c6b21d0..357fbc51c 100644
--- a/NonLinearSolver/nlTerms/nlTerms.cpp
+++ b/NonLinearSolver/nlTerms/nlTerms.cpp
@@ -183,7 +183,6 @@ void mass3D::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double> &m) const{
     double onediv12 = 1./12.;
     int nbdof = BilinearTerm<double,double>::space1.getNumKeys(ele);
     int nbFF = ele->getNumShapeFunctions();
-    int dim = nbdof/nbFF;
     m.resize(nbdof, nbdof,true); // true --> setAll 0.
 
     // get the shape function (and derivative values)
@@ -198,7 +197,7 @@ void mass3D::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double> &m) const{
     }
     double massele = area*_rho; // rho is the density by unit thickness
     // mass in three directions
-    for(int kk=0;kk<dim;kk++){
+    for(int kk=0;kk<3;kk++){
        m(kk*nbFF,kk*nbFF) += onediv12*massele;
        m(1+kk*nbFF,1+kk*nbFF) += onediv12*massele;
        m(2+kk*nbFF,2+kk*nbFF) += onediv12*massele;
@@ -206,6 +205,7 @@ void mass3D::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double> &m) const{
        m(4+kk*nbFF,4+kk*nbFF) += 0.25*massele;
        m(5+kk*nbFF,5+kk*nbFF) += 0.25*massele;
     }
+    //m.print("mass matrix");
   }
   else if(ele->getTypeForMSH() == MSH_TET_10){
     // integration on Gauss' points to know area
@@ -339,23 +339,23 @@ void mass3D::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double> &m) const{
        m(kk*nbFF,kk*nbFF) += oneOver*massele;
        m(1+kk*nbFF,1+kk*nbFF) += oneOver*massele;
        m(2+kk*nbFF,2+kk*nbFF) += oneOver*massele;
-       
+
        m(6+kk*nbFF,6+kk*nbFF) += 3.*oneOver*massele;
        m(7+kk*nbFF,7+kk*nbFF) += 3.*oneOver*massele;
        m(9+kk*nbFF,9+kk*nbFF) += 3.*oneOver*massele;
-       
+
        m(8+kk*nbFF,8+kk*nbFF) += 4.*oneOver*massele;
        m(10+kk*nbFF,10+kk*nbFF) += 4.*oneOver*massele;
        m(11+kk*nbFF,11+kk*nbFF) += 4.*oneOver*massele;
-       
+
        m(15+kk*nbFF,15+kk*nbFF) += 3.*4.*oneOver*massele;
        m(16+kk*nbFF,16+kk*nbFF) += 3.*4.*oneOver*massele;
        m(17+kk*nbFF,17+kk*nbFF) += 3.*4.*oneOver*massele;
-       
+
        m(3+kk*nbFF,3+kk*nbFF) += oneOver*massele;
        m(4+kk*nbFF,4+kk*nbFF) += oneOver*massele;
        m(5+kk*nbFF,5+kk*nbFF) += oneOver*massele;
-       
+
        m(12+kk*nbFF,12+kk*nbFF) += 3.*oneOver*massele;
        m(13+kk*nbFF,13+kk*nbFF) += 3.*oneOver*massele;
        m(14+kk*nbFF,14+kk*nbFF) += 3.*oneOver*massele;
@@ -366,7 +366,6 @@ void mass3D::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double> &m) const{
       // Initialization of some data
       int nbdof = BilinearTerm<double,double>::space1.getNumKeys(ele);
       int nbFF = ele->getNumShapeFunctions();
-      int dim = nbdof/nbFF;
       m.resize(nbdof, nbdof,true); // true --> setAll 0.
       // sum on Gauss' points
       std::vector<std::vector<TensorialTraits<double>::ValType> > vvals;
@@ -392,7 +391,7 @@ void mass3D::get(MElement *ele,int npts,IntPt *GP,fullMatrix<double> &m) const{
           }
         }
       }
-    // m.print("mass");
+     //m.print("mass");
    }
    else
      Msg::Error("Mass matrix is not implemented for dg3D with two different function spaces");
-- 
GitLab