Skip to content

Commit d48d769

Browse files
committed
add test for multi-domain
this test incorporates Constant k and non-constant k domains with the same phase
1 parent c6a975d commit d48d769

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

src/TestReactors.jl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,4 +200,36 @@ end;
200200

201201

202202

203+
@testset "Multi-domain ConstantV and ConstantTP simulation" begin
204+
phaseDict = readinput("../src/testing/superminimal.rms")
205+
spcs = phaseDict["phase"]["Species"]
206+
rxns = phaseDict["phase"]["Reactions"]
207+
ig = IdealGas(spcs,rxns,name="phase")
208+
209+
initialcondsTP = Dict(["T"=>1000.0,"P"=>10.0e5,"H2"=>0.67,"O2"=>0.33])
210+
domainTP,y0TP,pTP = ConstantTPDomain(phase=ig,initialconds=initialcondsTP) #Define the domain (encodes how system thermodynamic properties calculated)
211+
212+
reactTP = Reactor(domainTP,y0TP,(0.0,0.04);p=pTP) #Create the reactor object
213+
solTP = solve(reactTP.ode,CVODE_BDF(),abstol=1e-16,reltol=1e-6); #solve the ode associated with the reactor
214+
215+
initialcondsV = Dict(["T"=>1000.0,"P"=>10.0e5,"H2"=>0.67,"O2"=>0.33])
216+
domainV,y0V,pV = ConstantVDomain(phase=ig,initialconds=initialcondsV) #Define the domain (encodes how system thermodynamic properties calculated)
217+
218+
reactV = Reactor(domainV,y0V,(0.0,0.04);p=pV) #Create the reactor object
219+
solV = solve(reactV.ode,CVODE_BDF(),abstol=1e-16,reltol=1e-6); #solve the ode associated with the reactor
220+
221+
initialcondsTP = Dict(["T"=>1000.0,"P"=>10.0e5,"H2"=>0.67,"O2"=>0.33])
222+
domainTP,y0TP,pTP = ConstantTPDomain(phase=ig,initialconds=initialcondsTP) #Define the domain (encodes how system thermodynamic properties calculated)
223+
initialcondsV = Dict(["T"=>1000.0,"P"=>10.0e5,"H2"=>0.67,"O2"=>0.33])
224+
domainV,y0V,pV = ConstantVDomain(phase=ig,initialconds=initialcondsV) #Define the domain (encodes how system thermodynamic properties calculated)
225+
226+
react,y0,p = Reactor((domainTP,domainV),(y0TP,y0V),(0.0,0.04),[],(pTP,pV));
227+
sol = solve(react.ode,CVODE_BDF(),abstol=1e-16,reltol=1e-6);
228+
229+
t = 0.03
230+
@test sol(t)[1:length(spcs)] solTP(t)[1:end-1] rtol=1e-5
231+
print(length(sol(t)[length(spcs)+1:end-3]))
232+
print(length(solV(t)[1:end-2]))
233+
@test sol(t)[length(spcs)+1:end-3] solV(t)[1:end-2] rtol=1e-5
234+
end;
203235
end;

0 commit comments

Comments
 (0)