Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix examples in samples folder #774

Closed
ischoegl opened this issue Dec 18, 2019 · 7 comments · Fixed by #883
Closed

Fix examples in samples folder #774

ischoegl opened this issue Dec 18, 2019 · 7 comments · Fixed by #883

Comments

@ischoegl
Copy link
Member

Please fill in the following information to report a problem with Cantera.
If you have a question about using Cantera, please post it on our
Google Users' Group.

System information

  • Cantera version: 2.5.0a3 (master branch)
  • OS: Linux
  • Python/MATLAB version: N/A

Expected behavior

All samples work without errors/warnings.

Actual behavior

One sample fails (missing input file)

$ ./LiC6_electrode 

***********************************************************************
CanteraError thrown by Application::findInputFile:

Input file LiC6_electrodebulk.xml not found in directories 
'.', 
'/usr/local/share/cantera/data'

To fix this problem, either:
    a) move the missing files into the local directory;
    b) define environment variable CANTERA_DATA to
         point to the directory containing the file.
***********************************************************************

and another raises a warning (issue caused by PR #632)

$ ./combustor 
DeprecationWarning: FlowDevice::setMassFlowRate(): To be removed after Cantera 2.5. Use device-specific functions (e.g. Valve::setValveCoeff) instead.
DeprecationWarning: Valve::setParameters(): To be removed after Cantera 2.5. Use Valve::setValveCoeff instead.

A clear and concise description of what the bug is.

To Reproduce

Steps to reproduce the behavior:

  1. Compile cantera from master (e.g. c4c30e3)
  2. Run scons samples
  3. Run examples in build/samples
@bryanwweber
Copy link
Member

bryanwweber commented Dec 18, 2019

The input file for the first one is in samples/cxx/LiC6_electrode. If you add CANTERA_DATA=path/to/samples/cxx/LiC6_electrode ./LiC6_electrode it should work. I'm not sure what the appropriate resolution is here - maybe copy the input file into the build/samples directory associated with the example? That won't solve the problem if you run the sample from another directory, e.g., CANTERA_DATA=path/to/samples/cxx/LiC6_electrode build/samples/cxx/LiC6_electrode/LiC6_electrode will fail with the same message I think.

@ischoegl
Copy link
Member Author

The input file for the first one is in samples/cxx/LiC6_electrode.

I believe the expected behavior would be that build scripts copy the input file to the build directory. (it probably needs to be converted to yaml as well)

@bryanwweber
Copy link
Member

Yeah, I think copying the input file is probably the right thing to do. I converted the input file in #768

@ischoegl
Copy link
Member Author

ischoegl commented Dec 18, 2019

Great. Can you add this to #768? I can fix the other one as it's clearly caused by yours truly.

Before tackling that, I'd like to see whether the updated example should pass a locally defined function (there just was a question on the UG that's waiting for a related answer). Edit: decided to fix the second issue with a very limited PR (#776).

@ischoegl
Copy link
Member Author

Issue should eventually be taken care of by steps discussed in Cantera/enhancements#22

@speth
Copy link
Member

speth commented Mar 29, 2020

I think I disagree that this is a problem. The build directory is just a staging location for build artifacts. While it is often useful to run things from that location for testing purposes, that does frequently require some path / environment variable manipulations. This sample runs fine from from its installed location (after being compiled with one of the generated build scripts), since the input file is already copied to that directory.

Also, I don't think the change proposed in #789 fixes the problem, since <cantera source directory>/build/data is never automatically part of the Cantera data path. The only case where this would work is if you had already run scons install before navigating into build/samples/cxx/LiC6_electrode and running that sample.

@ischoegl
Copy link
Member Author

Hm. My assumption was that the build directory was complete. I guess #776 already resolved the other issue.

speth added a commit to speth/cantera that referenced this issue Jun 27, 2020
This provides the ability to organize data files included with Cantera
and differentiate data which is useful for different purposes, e.g. sample
data which is only meant to demonstrate capabilities and may not be
physically meaningful.

See Cantera/enhancements#22.

Fixes Cantera#774
speth added a commit to speth/cantera that referenced this issue Jun 29, 2020
This provides the ability to organize data files included with Cantera
and differentiate data which is useful for different purposes, e.g. sample
data which is only meant to demonstrate capabilities and may not be
physically meaningful.

See Cantera/enhancements#22.

Fixes Cantera#774
speth added a commit to speth/cantera that referenced this issue Jul 1, 2020
This provides the ability to organize data files included with Cantera
and differentiate data which is useful for different purposes, e.g. sample
data which is only meant to demonstrate capabilities and may not be
physically meaningful.

See Cantera/enhancements#22.

Fixes Cantera#774
speth added a commit to speth/cantera that referenced this issue Jul 3, 2020
This provides the ability to organize data files included with Cantera
and differentiate data which is useful for different purposes, e.g. sample
data which is only meant to demonstrate capabilities and may not be
physically meaningful.

See Cantera/enhancements#22.

Fixes Cantera#774
bryanwweber pushed a commit that referenced this issue Jul 3, 2020
This provides the ability to organize data files included with Cantera
and differentiate data which is useful for different purposes, e.g. sample
data which is only meant to demonstrate capabilities and may not be
physically meaningful.

See Cantera/enhancements#22.

Fixes #774
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants