Skip to content

Commit 7d6e31e

Browse files
committed
Add test for VaporLiquidMassTransferInternalInterfaceConstantT and ConstantVOutlet
fix
1 parent ebf6b56 commit 7d6e31e

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

src/TestReactors.jl

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,52 @@ end;
7272

7373
end;
7474

75+
@testset "Test vapor-liquid phase multi-domain reactor simulation with VaporLiquidMassTransferInternalInterfaceConstantT and VolumeMaintainingOutlet interface" begin
76+
input_file = "../src/testing/TdependentkLAkH.rms"
77+
phaseDict = readinput(input_file)
78+
liqspcs = phaseDict["phase"]["Species"]
79+
liqrxns = phaseDict["phase"]["Reactions"]
80+
solvent = phaseDict["Solvents"][1]
81+
gasspcs = liqspcs
82+
gasrxns = []
83+
liqspcnames = getfield.(liqspcs,:name)
84+
gasspcnames = getfield.(gasspcs,:name)
85+
86+
gas = IdealGas(gasspcs,gasrxns;name="gas");
87+
liq = IdealDiluteSolution(liqspcs,liqrxns,solvent;name="liq",diffusionlimited=true)
88+
89+
Vliq = 1.0
90+
Vgas = 1.0
91+
T = 25 + 273.15
92+
octaneconc = 6478
93+
tf = 3600*24
94+
95+
initialconds = Dict("octane"=>octaneconc*Vliq,"T"=>T,"V"=>Vliq)
96+
domainliq,y0liq,pliq = ConstantTVDomain(phase=liq,initialconds=initialconds);
97+
98+
P = 101300.0
99+
N2N = P*Vgas/R/T*0.8
100+
oxygenN = P*Vgas/R/T*0.2
101+
initialconds = Dict("N2"=>N2N,"oxygen"=>oxygenN,"T"=>T,"P"=>P)
102+
domaingas,y0gas,pgas = ConstantTPDomain(phase=gas,initialconds=initialconds);
103+
initialconds = Dict("N2"=>N2N,"oxygen"=>oxygenN,"T"=>T,"P"=>P)
104+
inletgas = Inlet(domaingas,initialconds,x->42)
105+
outletgas = VolumeMaintainingOutlet(domaingas)
106+
107+
ignoremasstransferspcnames = ["octane"] #only allowing octane to be consumed via reactions, to avoid the liquid phase to dry out completely
108+
vl,pinter = VaporLiquidMassTransferInternalInterfaceConstantT(domaingas,domainliq,ignoremasstransferspcnames);
109+
110+
domains = (domainliq,domaingas)
111+
interfaces = [vl,inletgas,outletgas]
112+
react,y0,p = Reactor(domains,(y0liq,y0gas),(0.0,tf),interfaces,(pliq,pgas,pinter));
113+
sol = solve(react.ode,react.recommendedsolver,abstol=1e-18,reltol=1e-6);
114+
115+
name = "oxygen"
116+
ind = findfirst(x->x==name,liqspcnames)
117+
@test sol(tf)[ind] 1.5533140456432624e-7 rtol=1e-5 #test there are oxygen dissolved into the liquid
118+
119+
end
120+
75121
@testset "Test liquid phase Parametrized T Constant V reactor jacobian" begin
76122
#Parametrized T constant V Ideal Dilute Liquid
77123
initialconds = Dict(["ts"=>[0.,600.,1200.],"T"=>[450.0,490.,500.],"V"=>1.0e-6*1e6,"octane"=>6.154e-3*1e6,"oxygen"=>4.953e-6*1e6])

0 commit comments

Comments
 (0)