Modelling n-dodecane detonation in SD toolbox

145 views
Skip to first unread message

srikeshav Nikhilesh

unread,
Sep 9, 2020, 8:57:21 AM9/9/20
to Cantera Users' Group
I am trying to model Kerosene detonation using SD toolbox on MATLAB.
For this purpose I intend to use n-dodecane as the surrogate. I found from the Explosion Dynamics Website, that JetSurf2.cti would be useful for this. I am new to both Cantera and SD toolbox environment. When I try to run this code - 

1. comp = 'C12H26:2 O2:37 N2:137.64 CO2:0.074 Ar:1.665'; 
2. mech = 'JetSurf2.cti';
3. P1=1.01e5;
4. T1=298.13;
5. gas1=GRI30('Mix');  
6. set(gas1,'Temperature',T1,'Pressure',P1,'MoleFractions',comp);
7. Dcj = CJspeed1(P1, T1, comp, mech);
8. gas2= PostShock_eq2(Dcj,P1, T1, comp, mech, 'Mix');

I get the following errors - 

***********************************************************************
CanteraError thrown by Phase::setMoleFractionsByName:
Unknown species 'C12H26'
***********************************************************************


Error in phase_set (line 5)
    ctmethods(30, n, -job, a);

Error in ThermoPhase/setMoleFractions (line 42)
    phase_set(tp.tp_id, 30, x);

Error in ThermoPhase/set (line 96)
            setMoleFractions(tp, val);

Error in Untitled (line 6)
set(gas1,'Temperature',T1,'Pressure',P1,'MoleFractions',comp);


Any help with this is appreciated.
After a bit of googling, I suspect I am initializing the wrong gas object.
Any help with this will be appreciated.....



Dodecane_det.m

Bryan W. Weber

unread,
Sep 9, 2020, 9:58:01 AM9/9/20
to Cantera Users' Group
Hi,

I'm not sure about the internals of the SD Toolbox. However, on line 5, you are creating the GRI-3.0 mechanism, not the JetSuRF mechanism. You'll want to replace that line with:

gas = Solution(mech);

Best,
Bryan

srikeshav Nikhilesh

unread,
Sep 9, 2020, 2:16:46 PM9/9/20
to Cantera Users' Group
Hello Bryan, 
Thanks for the reply. 
I changed it now into the Solution(mech) format, as per your advice, it helped me in intialising the gas object. However, I still have an error at line 8.

1. comp = 'NC12H26:2 O2:37 N2:137.64 CO2:0.074 Ar:1.665'; 
2. mech = 'JetSurf2.cti';
3. P1=1.01e5;
4. T1=298.13;
5. gas1 = Solution('JetSurf2.cti', 'gas');  
6. set(gas1,'Temperature',T1,'Pressure',P1,'MoleFractions',comp);
7. Dcj = CJspeed1(P1, T1, comp, mech);
8. gas2= PostShock_trial(Dcj,P1, T1, comp, mech, 'Mix');

I get the following errors - 
***********************************************************************
CanteraError thrown by xml_find_id:
id not found: hexaneReduced
***********************************************************************


Error in XML_Node/findByID (line 12)
index = ctmethods(10, 8, root.id, id);

Error in Solution (line 51)
    node = findByID(doc, id);

Error in PostShock_trial (line 20)
gas1 = Solution(mech, 'hexaneReduced', trans);

Error in Dodecane_det (line 20)
gas2= PostShock_trial(Dcj,P1, T1, comp, mech, 'Mix');

Functions used in lines 7 and 8 are from SD toolbox. How do I go about this?

Regards,
Nikhilesh 
Dodecane_det.m

Steven DeCaluwe

unread,
Sep 9, 2020, 2:31:23 PM9/9/20
to canter...@googlegroups.com
Hi Nikhilesh,

The error message indicates that there is not a phase named “hexaneReduced” in your `JetSurf2.cti’ input file.  Can you see if it exists, or if perhaps there is a typo?

Best,
Steven
 

--
You received this message because you are subscribed to the Google Groups "Cantera Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cantera-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cantera-users/90bf9040-b50a-4fbf-89a5-bb26b358b82do%40googlegroups.com.
<Dodecane_det.m>

srikeshav Nikhilesh

unread,
Sep 9, 2020, 2:39:25 PM9/9/20
to Cantera Users' Group
Hello Decaluwe,

Thanks for the reply.
As you correctly pointed out, it was a typo. I wrongly copy-pasted a error message from another Matlab instance. 
The error message for this script was - 

***********************************************************************
CanteraError thrown by xml_find_id:
id not found: JetSurf2
***********************************************************************


Error in XML_Node/findByID (line 12)
index = ctmethods(10, 8, root.id, id);

Error in Solution (line 51)
    node = findByID(doc, id);

Error in PostShock_trial (line 20)
gas1 = Solution(mech, 'JetSurf2', trans);

Error in Dodecane_det (line 8)
gas2= PostShock_trial(Dcj,P1, T1, comp, mech, 'Mix');

Steven DeCaluwe

unread,
Sep 9, 2020, 2:42:11 PM9/9/20
to canter...@googlegroups.com
Okay, well this error says something similar.  You are asking it to find a phase named `JetSurf2’, and it claims that it cannot find a phase with that name in your file.  You previously loaded a phase named ‘gas’ from that file; do you intend to load a different phase definition here, and if so can you check the cli file to see if it exists?

Best,
Steven




srikeshav Nikhilesh

unread,
Sep 9, 2020, 2:53:54 PM9/9/20
to Cantera Users' Group
Hello DeCaluwe, 
As you rightly observed line 5 loads a gas phase from JetSurf.cti. Line 8 uses the previously loaded gas object as a function argument to calculate the post-shock properties of the gas.
I don't think a new phase definition has been used.
PostShock_trial function was modified from PostShock_eq function in the SDToolbox. I have posted both these codes for your benefit.

PostShock_trial.m
PostShock_eq.m

Steven DeCaluwe

unread,
Sep 9, 2020, 3:38:22 PM9/9/20
to <cantera-users@googlegroups.com>
Nikish,

Lines 20 and 21 of ‘PostShock_trial.m’ attempt to load a phase ‘JetSurf2’ from the ‘mech’ file passed to the function.  This phase is not found in that mechanism file.  That is the source of the error.  You either need to change ‘JetSurf2’ in those lines to correpond to the gas phase definition that you want to load, here (it looks like ‘gas’ would work), or pass a different mechanism file (or change the mechanism file) so that it contains a phase named ‘JetSurf2’.

Best of luck,
Steven

To view this discussion on the web visit https://groups.google.com/d/msgid/cantera-users/3c94f73c-0f6e-47e5-8d8a-c13bfd91df76n%40googlegroups.com.
<PostShock_trial.m><PostShock_eq.m>

srikeshav Nikhilesh

unread,
Sep 10, 2020, 1:59:33 AM9/10/20
to Cantera Users' Group
Hello DeCaluwe,

I replaced the said lines with Solution('JetSurf2'), it started working like a charms. 
Thanks a lot.
A further doubt, it is known that n-Dodecane is a liquid at P=1 atm and T = 298 K. Is there any way I can factor this into creating a multiphase object, instead of a gas object created as gas1?
I have attached the CJspeed function too.....

CJspeed.m

Steven DeCaluwe

unread,
Sep 10, 2020, 2:29:22 PM9/10/20
to <cantera-users@googlegroups.com>
Hi Nikish,

You can try loading a different phase mechanism, such as the redlich Kwong model that comes with Cantera.  However, that may not have all of the functionality that your program in SDtoolbox requires, in terms of partial molar thermodynamic derivatives.  You could try it out, though.

Best,
Steven



srikeshav Nikhilesh

unread,
Sep 13, 2020, 10:33:39 AM9/13/20
to Cantera Users' Group
Thanks Steven.
I will try it out and see how it goes.
To unsubscribe from this group and stop receiving emails from it, send an email to canter...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages