From 7928ce3ac3a3f897419ae05e475ed21cc38afd2f Mon Sep 17 00:00:00 2001 From: Tias Maiti Date: Tue, 4 Aug 2015 21:27:30 +0000 Subject: [PATCH] fixed erroneous rate calculation in updateState when time increment (subdt) was zero during initialization. --- code/thermal_adiabatic.f90 | 10 +++++++--- code/vacancyflux_isochempot.f90 | 9 +++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/code/thermal_adiabatic.f90 b/code/thermal_adiabatic.f90 index 80debf2fc..d685868a8 100644 --- a/code/thermal_adiabatic.f90 +++ b/code/thermal_adiabatic.f90 @@ -226,9 +226,13 @@ function thermal_adiabatic_updateState(subdt, ip, el) .true.] temperature (homog)%p(thermalMapping(homog)%p(ip,el)) = T - temperatureRate(homog)%p(thermalMapping(homog)%p(ip,el)) = & - (thermalState(homog)%state(1,offset) - thermalState(homog)%subState0(1,offset))/subdt - + if (subdt > tiny(0.0_pReal)) then + temperatureRate(homog)%p(thermalMapping(homog)%p(ip,el)) = & + (thermalState(homog)%state(1,offset) - thermalState(homog)%subState0(1,offset))/subdt + else + temperatureRate(homog)%p(thermalMapping(homog)%p(ip,el)) = 0.0_pReal + endif + end function thermal_adiabatic_updateState !-------------------------------------------------------------------------------------------------- diff --git a/code/vacancyflux_isochempot.f90 b/code/vacancyflux_isochempot.f90 index 756a992fd..8f2295857 100644 --- a/code/vacancyflux_isochempot.f90 +++ b/code/vacancyflux_isochempot.f90 @@ -227,8 +227,13 @@ function vacancyflux_isochempot_updateState(subdt, ip, el) .true.] vacancyConc (homog)%p(vacancyfluxMapping(homog)%p(ip,el)) = Cv - vacancyConcRate(homog)%p(vacancyfluxMapping(homog)%p(ip,el)) = & - (vacancyfluxState(homog)%state(1,offset) - vacancyfluxState(homog)%subState0(1,offset))/subdt + + if (subdt > tiny(0.0_pReal)) then + vacancyConcRate(homog)%p(vacancyfluxMapping(homog)%p(ip,el)) = & + (vacancyfluxState(homog)%state(1,offset) - vacancyfluxState(homog)%subState0(1,offset))/subdt + else + vacancyConcRate(homog)%p(vacancyfluxMapping(homog)%p(ip,el)) = 0.0_pReal + endif end function vacancyflux_isochempot_updateState