Skip to content

Commit 6ee78f8

Browse files
committed
Add jacobiany test for ParametrizedPDomain
1 parent 538e61d commit 6ee78f8

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/TestReactors.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,24 @@ ja=jacobiany(y,p,t,domain,[],nothing);
180180
j = jacobianyforwarddiff(y,p,t,domain,[],nothing);
181181
@test all((abs.(ja.-j) .> 1e-4.*abs.(j).+1e-16).==false)
182182
end;
183+
184+
#Parametrized P adiabatic Ideal Gas
185+
#uses ethane.yml mechanism
186+
@testset "Parametrized pressure adiabatic reactor jacobian" begin
187+
initialconds = Dict(["T"=>1000.0,"ts"=>[0.,100.,200.],"P"=>[2.0e5,3.0e5,5.0e5],"H2"=>0.67,"O2"=>0.33])
188+
domain,y0,p = ParametrizedPDomain(phase=ig,initialconds=initialconds) #Define the domain (encodes how system thermodynamic properties calculated)
189+
190+
react = Reactor(domain,y0,(0.0,0.101),p=p) #Create the reactor object
191+
sol = solve(react.ode,CVODE_BDF(),abstol=1e-20,reltol=1e-12); #solve the ode associated with the reactor
192+
193+
#analytic jacobian vs. ForwardDiff jacobian
194+
t=0.1;
195+
y = sol(t);
196+
ja=jacobiany(y,p,t,domain,[],nothing);
197+
j = jacobianyforwarddiff(y,p,t,domain,[],nothing);
198+
@test all((abs.(ja.-j) .> 1e-4.*abs.(j).+1e-16).==false)
199+
end;
200+
201+
202+
203+
end;

0 commit comments

Comments
 (0)