Source Code

228 views
Skip to first unread message

Steve Willis

unread,
Oct 5, 2020, 10:04:39 AM10/5/20
to CONTAM
Where can I find the source code for ContamW and ContamX? The appendix to the user manual on the project file format references many parameters defined in header files which I have not been able to locate on the NIST website.

Steve Willis

unread,
Oct 21, 2020, 1:23:44 AM10/21/20
to CONTAM, Steve Willis
I could still use help with this. I haven't been able to locate the source code for ContamX. I have since located a thesis with specific details of how Contam calculates some values in the project file, so I suspect the source code was available in the past. The language of the Contam license also has terms for source code distribution. Am I simply overlooking it, or is source code not available to the public?

Thanks,

Steve

Stuart Dols

unread,
Oct 22, 2020, 11:46:25 AM10/22/20
to CONTAM, Steve Willis
Steve,
The source code is not publicly available.
The PRJ format was provided in the past for a particular sponsor, and I have been updating it to track the evolution of CONTAM and as a courtesy to those few users who may need such detailed information.
- Stuart

Steve Willis

unread,
Oct 22, 2020, 7:24:07 PM10/22/20
to CONTAM, Stuart Dols, Steve Willis
Thanks, Stuart. I sincerely appreciate your efforts to keep the documentation for the PRJ format up to date. I have a task that requires programmatic generation of PRJ files, and the available documentation has been very helpful.

My program is creating an Orifice Area Data airflow element with the parameters shown in the attached ContamW screenshot. I understand that ContamW will calculate a laminar and turbulent flow coefficients and store them with this element in the PRJ file. I have replicated the calculation of the turbulent flow coefficient precisely. However, my calculated laminar flow coefficient exhibits a small difference from one generated by ContamW. I think that one or more of the following assumptions must be incorrect, and would appreciate any guidance.

(Possibly incorrect) assumptions for ContamW's calculation of the laminar flow coefficient:
  1. The air density is 1.2041 kg/m^3 (based on page 244 of the CONTAM User Guide)
  2. The dynamic viscosity of air is 1.8205E-05 N⋅s/m^2 for a new CONTAM project (with a default 20C ambient temperature, based on tables available online)
  3. The Reynold's number is 30 (based on this being the default value for other airflow element types in ContamW)
  4. The hydraulic diameter is the square root of the leakage area (rather than 4*area/perimeter, based on an appendix to David Stanton's thesis, though I'm not sure how he determined this).
Thanks,

Steve
Capture.PNG

Stuart Dols

unread,
Oct 23, 2020, 8:59:39 AM10/23/20
to Steve Willis, CONTAM, Stuart Dols

Steve,

I assume you are referring to the 3.2 version of the User Guide.

The laminar coefficient calculations are now provided in the 3.4 version of the User Guide in the Theoretical Background - Airflow Analysis section (8.3.3).

The attached spreadsheet may help as well.

I have not reviewed this spreadsheet in some time, so please let me know if you discover any discrepancies.

Also, feel free to reach out if you have any other questions or concerns.

- Stuart


 


--
To unsubscribe from this group, send email to contam+un...@list.nist.gov
 
View this message at https://list.nist.gov/contam
---
To unsubscribe from this group and stop receiving emails from it, send an email to contam+un...@list.nist.gov.
Calc_Laminar_Flow_Coefs.xlsx

Steve Willis

unread,
Oct 23, 2020, 11:26:21 AM10/23/20
to CONTAM, stu...@gmail.com, CONTAM, Stuart Dols, Steve Willis
Thanks! I was indeed using version 3.2 of the guide. I must have missed the 3.4 version by days when I downloaded it in August.

Do you have a spreadsheet like this for airflow element type plr_leak1? None of the elements in this sheet seem to match how ContamW is writing the project file for that element type. Please see the attached spreadsheet. I'm calculating Ct with a formula I found in David Stanton's thesis, and that seems to exactly match how ContamW is writing the PRJ file (but differs from those used by other elements on your spreadsheet). With the formulas in version 3.4 of the User Guide, I am now very close with my calculation of Ck, but only if I make an assumption about the hydraulic diameter calculation which I can't verify for the plr_leak1 element type.

For reference, I have created a new project with ContamW 3.4.0.0, and added a single Leakage Area Data airflow element with the values shown in the screenshot I posted previously, with no other changes to the project. When I save the project, the resulting PRJ file has this section:

1 23 plr_leak1 some_name
some_description
5.45618e-07 0.00300356 0.65 0.6 10 0.005 0 0 0 2 2 0

I'm trying to match the calculations of the first two fields, which are highlighted in the attached spreadsheet.

Thanks for your time and help with this.
contam plr_leak1.xlsx

Stuart Dols

unread,
Oct 23, 2020, 2:17:54 PM10/23/20
to Steve Willis, CONTAM, Stuart Dols
For the leakage element:
Ct = Cd*A*sqrt(2)*dPref^(0.5 - exp)
This is based on effective leakage area as explained in the ASHRAE Handbook of Fundamentals.
- Stuart

Steve Willis

unread,
Oct 23, 2020, 4:48:54 PM10/23/20
to CONTAM, stu...@gmail.com, CONTAM, Stuart Dols, Steve Willis
Apparently I replied to the notification email rather than Google Groups.

That works, and is just a reordering of the terms. How about Ck, and my assumptions about the values that go into calculating it (particularly the hydraulic diameter calculation)? Am I close?

Thanks again,

Steve

Steve Willis

unread,
Oct 30, 2020, 3:00:15 PM10/30/20
to CONTAM, Steve Willis, stu...@gmail.com, CONTAM, Stuart Dols
Raising this again for visibility. Thanks.

Stuart Dols

unread,
Nov 3, 2020, 8:49:55 AM11/3/20
to CONTAM, Steve Willis, stu...@gmail.com, CONTAM, Stuart Dols
You are spot on.
Your values are within 0.0001%, so I will attribute it to rounding differences.
- Stuart

Anders Bjork

unread,
Oct 9, 2025, 12:16:14 PMOct 9
to CONTAM, Stuart Dols, stu...@gmail.com, CONTAM
Hello Stuart and CONTAM team,

(replying to this thread because my post is relevant to the Orifice Area powerlaw model laminar coefficient mentioned)

I am testing behavior of the Orifice Area powerlaw airflow model in CONTAM near the transition from Laminar to turbulent flow. I'm running ContamW 3.4.06 with ContamX 3.4.02.

The model am using is a 10-second transient airflow simulation with no contaminants.

In the model, I use a 0.5 kg/s AHS Supply (no recirculation, not that it would matter) to pressurize the only Zone. This Supply is on the "day1" schedule, which is trapezoidal and always decreasing from the initial value.

I'm not considering transient density effects, so I have "vary density with time step" turned off. I'm using the schedule to consider different set points for the AHS Supply.

I am comparing simulation results to analytical (Kirchhoff's laws based) hand calculations for t=0 through t=5 (seconds). The node network represents a current divider in the electrical circuit analog. Only t=0 should create turbulent flow through the orifice according to my calculations.

After t=4 (so starting at 5s), the results seem to "freeze" and the total mass balance of airflow out does not equal the supply airflow.

Can y'all explain what I'm running into with the solver here? I know that there are likely some issues with precision applying CONTAM to such laminar and low-pressure flow. Is there a calculable point where the solver starts to error out of being useful?

Feel free to download the attached PRJ file as well.

Thank you!
Anders
orfc-flow-in-flow-divider.prj

Anders Bjork

unread,
Oct 9, 2025, 7:25:38 PMOct 9
to CONTAM, Anders Bjork, Stuart Dols, stu...@gmail.com, CONTAM
Stuart,

It looks like I needed to change my Absolute Convergence Factor (in Simulation Parameters>Airflow Numerics); I was using the default value of 1 x 10^-6 but for very small air change rates the Contam User Guide v 3.4 encourages reduction of this value: "A test is also provided in the event of very low flows to ensure that the sum of the absolute values of the flows is less than the absolute convergence factor based on a very small zone air change rate entered here."

When I reduced the Absolute Convergence Factor to less than 1x10^-8, even the smallest AHS Supply value in my model (1x10^-10) created logical results.

See updated PRJ file with the smaller Absolute Convergence Factor.

I'd still welcome insight on this when you're back from furlough,
Anders

orfc-flow-in-flow-dividerl_RevA.prj
Reply all
Reply to author
Forward
0 new messages