@@ -29,6 +29,10 @@ y=sol(t)
2929ja= jacobiany (y,p,t,domain,[],nothing );
3030j= jacobianyforwarddiff (y,p,t,domain,[],nothing );
3131@test all ((abs .(ja.- j) .> 1e-4 .* abs .(j).+ 1e-16 ). == false )
32+
33+ jpa= jacobianp (y,p,t,domain,[],nothing );
34+ jp= jacobianpforwarddiff (y,p,t,domain,[],nothing );
35+ @test all ((abs .(jpa.- jp) .> 1e-4 .* abs .(jp).+ 1e-16 ). == false )
3236end ;
3337
3438@testset " Test liquid phase Parametrized T Constant V reactor jacobian" begin
@@ -45,6 +49,10 @@ y=sol(t)
4549ja= jacobiany (y,p,t,domain,[],nothing );
4650j= jacobianyforwarddiff (y,p,t,domain,[],nothing );
4751@test all ((abs .(ja.- j) .> 1e-4 .* abs .(j).+ 1e-16 ). == false )
52+
53+ jpa= jacobianp (y,p,t,domain,[],nothing );
54+ jp= jacobianpforwarddiff (y,p,t,domain,[],nothing );
55+ @test all ((abs .(jpa.- jp) .> 1e-4 .* abs .(jp).+ 1e-16 ). == false )
4856end ;
4957
5058# Use superminimal example to test
@@ -80,6 +88,10 @@ ja=jacobiany(y,p,t,domain,[],nothing);
8088j = jacobianyforwarddiff (y,p,t,domain,[],nothing );
8189@test all ((abs .(ja.- j) .> 1e-4 .* abs .(j).+ 1e-16 ). == false )
8290
91+ jpa= jacobianp (y,p,t,domain,[],nothing );
92+ jp= jacobianpforwarddiff (y,p,t,domain,[],nothing );
93+ @test all ((abs .(jpa.- jp) .> 1e-4 .* abs .(jp).+ 1e-16 ). == false )
94+
8395# sensitivities
8496dps = getadjointsensitivities (sim," H2" ,CVODE_BDF (linear_solver= :GMRES );sensealg= InterpolatingAdjoint (autojacvec= ReverseDiffVJP (true )),abstol= 1e-16 ,reltol= 1e-6 )
8597react2 = Reactor (domain,y0,(0.0 ,150.11094 );p= p,forwardsensitivities= true )
@@ -117,6 +129,10 @@ ja=jacobiany(y,p,t,domain,[],nothing);
117129j = jacobianyforwarddiff (y,p,t,domain,[],nothing );
118130@test all ((abs .(ja.- j) .> 1e-4 .* abs .(j).+ 1e-16 ). == false )
119131
132+ jpa= jacobianp (y,p,t,domain,[],nothing );
133+ jp= jacobianpforwarddiff (y,p,t,domain,[],nothing );
134+ @test all ((abs .(jpa.- jp) .> 1e-4 .* abs .(jp).+ 1e-16 ). == false )
135+
120136# sensitivities
121137react = Reactor (domain,y0,(0.0 ,0.02 ),p= p) # Create the reactor object
122138sol = solve (react. ode,CVODE_BDF (),abstol= 1e-20 ,reltol= 1e-12 ); # solve the ode associated with the reactor
@@ -163,6 +179,10 @@ ja=jacobiany(y,p,t,domain,[],nothing);
163179j = jacobianyforwarddiff (y,p,t,domain,[],nothing );
164180@test all ((abs .(ja.- j) .> 1e-4 .* abs .(j).+ 1e-16 ). == false )
165181
182+ jpa= jacobianp (y,p,t,domain,[],nothing );
183+ jp= jacobianpforwarddiff (y,p,t,domain,[],nothing );
184+ @test all ((abs .(jpa.- jp) .> 1e-4 .* abs .(jp).+ 1e-16 ). == false )
185+
166186end ;
167187
168188# Parametrized T and P Ideal Gas
@@ -180,6 +200,10 @@ y = sol(t);
180200ja= jacobiany (y,p,t,domain,[],nothing );
181201j = jacobianyforwarddiff (y,p,t,domain,[],nothing );
182202@test all ((abs .(ja.- j) .> 1e-4 .* abs .(j).+ 1e-16 ). == false )
203+
204+ jpa= jacobianp (y,p,t,domain,[],nothing );
205+ jp= jacobianpforwarddiff (y,p,t,domain,[],nothing );
206+ @test all ((abs .(jpa.- jp) .> 1e-4 .* abs .(jp).+ 1e-16 ). == false )
183207end ;
184208
185209# Parametrized V adiabatic Ideal Gas
@@ -197,6 +221,10 @@ y = sol(t);
197221ja= jacobiany (y,p,t,domain,[],nothing );
198222j = jacobianyforwarddiff (y,p,t,domain,[],nothing );
199223@test all ((abs .(ja.- j) .> 1e-4 .* abs .(j).+ 1e-16 ). == false )
224+
225+ jpa= jacobianp (y,p,t,domain,[],nothing );
226+ jp= jacobianpforwarddiff (y,p,t,domain,[],nothing );
227+ @test all ((abs .(jpa.- jp) .> 1e-4 .* abs .(jp).+ 1e-16 ). == false )
200228end ;
201229
202230# Parametrized P adiabatic Ideal Gas
@@ -214,6 +242,10 @@ y = sol(t);
214242ja= jacobiany (y,p,t,domain,[],nothing );
215243j = jacobianyforwarddiff (y,p,t,domain,[],nothing );
216244@test all ((abs .(ja.- j) .> 1e-4 .* abs .(j).+ 1e-16 ). == false )
245+
246+ jpa= jacobianp (y,p,t,domain,[],nothing );
247+ jp= jacobianpforwarddiff (y,p,t,domain,[],nothing );
248+ @test all ((abs .(jpa.- jp) .> 1e-4 .* abs .(jp).+ 1e-16 ). == false )
217249end ;
218250
219251
0 commit comments