@@ -158,50 +158,59 @@ evaluateDerivatives(const Scalar time,
158158 const auto DrhoDti = DrhoDt (i);
159159 const auto DuDti = DuDt (i);
160160
161- // Time evolution of the solid pressure
162- const auto dPsdti = dPsdri*DrhoDti + dPsdui*DuDti;
161+ // If fully compressed we're done
162+ if (alphai == 1.0 ) {
163163
164- // If we're above the solid transition pressure we should compress out all porosity
165- if (Pi >= mPs ) {
166-
167- DalphaDt (i) = (1.0 - alphai)*safeInvVar (dt);
164+ DalphaDt (i) = 0.0 ;
168165 fDSnew (i) = 1.0 ;
169166
170167 } else {
171168
172- // First compute the derivative with respect to pressure
173- auto DalphaDpi = 0.0 ;
174- if (alphai > 1.0 ) {
175- if (Pi < mPe or dPsdti < 0.0 ) {
169+ // Time evolution of the solid pressure
170+ const auto dPsdti = dPsdri*DrhoDti + dPsdui*DuDti;
176171
177- // Elastic
178- if (c0i != mcS0) { // If initial porous sound speed is the same as solid phase, no elastic evolution
179- const auto halpha = 1.0 + (alphai - 1.0 )*(c0i - mcS0)*safeInvVar (mcS0*(mAlphae - 1.0 ));
180- DalphaDpi = alphai*alphai/mKS0 *(1.0 - safeInvVar (halpha*halpha));
181- }
172+ // If we're above the solid transition pressure we should compress out all porosity
173+ if (Pi >= mPs ) {
182174
183- } else {
175+ DalphaDt (i) = (1.0 - alphai)*safeInvVar (dt);
176+ fDSnew (i) = 1.0 ;
177+
178+ } else {
179+
180+ // First compute the derivative with respect to pressure
181+ auto DalphaDpi = 0.0 ;
182+ if (alphai > 1.0 ) {
183+ if (Pi < mPe or dPsdti < 0.0 ) {
184+
185+ // Elastic
186+ if (c0i != mcS0) { // If initial porous sound speed is the same as solid phase, no elastic evolution
187+ const auto halpha = 1.0 + (alphai - 1.0 )*(c0i - mcS0)*safeInvVar (mcS0*(mAlphae - 1.0 ));
188+ DalphaDpi = alphai*alphai/mKS0 *(1.0 - safeInvVar (halpha*halpha));
189+ }
184190
185- // Plastic
186- DalphaDpi = (Pi < mPt ?
187- mn1*(mAlphat - mAlphae )*pow ((mPt - Pi)/(mPt - mPe ), mn1)*safeInv (mPt - Pi) + mn2*(1.0 - mAlphat )*pow ((mPs - Pi)/(mPs - mPe ), mn2)*safeInv (mPs - Pi) :
188- mn2*(1.0 - mAlphat )*pow ((mPs - Pi)/(mPs - mPe ), mn2)*safeInv (mPs - Pi));
191+ } else {
189192
193+ // Plastic
194+ DalphaDpi = (Pi < mPt ?
195+ mn1*(mAlphat - mAlphae )*pow ((mPt - Pi)/(mPt - mPe ), mn1)*safeInv (mPt - Pi) + mn2*(1.0 - mAlphat )*pow ((mPs - Pi)/(mPs - mPe ), mn2)*safeInv (mPs - Pi) :
196+ mn2*(1.0 - mAlphat )*pow ((mPs - Pi)/(mPs - mPe ), mn2)*safeInv (mPs - Pi));
197+
198+ }
190199 }
191- }
192200
193- // Now we can compute the final time derivative
194- DalphaDpi = min (0.0 , DalphaDpi); // Keep things physical
195- const auto Ainv = safeInvVar (alphai + DalphaDpi*(Pi - rhoi*dPsdri));
196- const auto dPdti = (alphai*dPsdri*DrhoDti + dPsdui*DuDti)*Ainv;
197- DalphaDt (i) = DalphaDpi*dPdti;
201+ // Now we can compute the final time derivative
202+ DalphaDpi = min (0.0 , DalphaDpi); // Keep things physical
203+ const auto Ainv = safeInvVar (alphai + DalphaDpi*(Pi - rhoi*dPsdri));
204+ const auto dPdti = (alphai*dPsdri*DrhoDti + dPsdui*DuDti)*Ainv;
205+ DalphaDt (i) = DalphaDpi*dPdti;
198206
199- // Optionally update the deviatoric stress scaling term
200- if (mJutziStateUpdate ) {
201- auto DalphaDrhoi = (Pi/(rhoi*rhoi)*dPsdui + alphai*dPsdri)*Ainv * DalphaDpi;
202- fDSnew (i) = std::max (0.0 , std::min (1.0 , 1.0 + DalphaDrhoi*rhoi/alphai));
203- } else {
204- fDSnew (i) = 1.0 ;
207+ // Optionally update the deviatoric stress scaling term
208+ if (mJutziStateUpdate ) {
209+ auto DalphaDrhoi = (Pi/(rhoi*rhoi)*dPsdui + alphai*dPsdri)*Ainv * DalphaDpi;
210+ fDSnew (i) = std::max (0.0 , std::min (1.0 , 1.0 + DalphaDrhoi*rhoi/alphai));
211+ } else {
212+ fDSnew (i) = 1.0 ;
213+ }
205214 }
206215 }
207216
237246PalphaPorosity<Dimension>::
238247dumpState (FileIO& file, const string& pathName) const {
239248 PorosityModel<Dimension>::dumpState (file, pathName);
240- file.write (mc0, pathName + " /c0" );
241249 file.write (mdPdU, pathName + " /dPdU" );
242250 file.write (mdPdR, pathName + " /dPdR" );
243251}
250258PalphaPorosity<Dimension>::
251259restoreState (const FileIO& file, const string& pathName) {
252260 PorosityModel<Dimension>::restoreState (file, pathName);
253- file.read (mc0, pathName + " /c0" );
254261 file.read (mdPdU, pathName + " /dPdU" );
255262 file.read (mdPdR, pathName + " /dPdR" );
256263}
0 commit comments