From 09c7affbbc13db122214cbc6d93eb288de9220a3 Mon Sep 17 00:00:00 2001 From: Tias Maiti Date: Wed, 5 Aug 2015 11:09:38 +0000 Subject: [PATCH] more efficient rate calculation in updateState when subdt is zero --- code/thermal_adiabatic.f90 | 10 +++------- code/vacancyflux_isochempot.f90 | 9 ++------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/code/thermal_adiabatic.f90 b/code/thermal_adiabatic.f90 index d685868a8..d217cadb7 100644 --- a/code/thermal_adiabatic.f90 +++ b/code/thermal_adiabatic.f90 @@ -226,13 +226,9 @@ function thermal_adiabatic_updateState(subdt, ip, el) .true.] temperature (homog)%p(thermalMapping(homog)%p(ip,el)) = T - 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 - + temperatureRate(homog)%p(thermalMapping(homog)%p(ip,el)) = & + (thermalState(homog)%state(1,offset) - thermalState(homog)%subState0(1,offset))/(subdt+tiny(0.0_pReal)) + end function thermal_adiabatic_updateState !-------------------------------------------------------------------------------------------------- diff --git a/code/vacancyflux_isochempot.f90 b/code/vacancyflux_isochempot.f90 index 8f2295857..da6cd0ad6 100644 --- a/code/vacancyflux_isochempot.f90 +++ b/code/vacancyflux_isochempot.f90 @@ -227,13 +227,8 @@ function vacancyflux_isochempot_updateState(subdt, ip, el) .true.] vacancyConc (homog)%p(vacancyfluxMapping(homog)%p(ip,el)) = Cv - - 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 + vacancyConcRate(homog)%p(vacancyfluxMapping(homog)%p(ip,el)) = & + (vacancyfluxState(homog)%state(1,offset) - vacancyfluxState(homog)%subState0(1,offset))/(subdt+tiny(0.0_pReal)) end function vacancyflux_isochempot_updateState