pyCAPS
pyCAPS: A Python Extension Module for CAPS
analysis4.py

Example use cases for interacting the pyCAPS._capsAnalysis.getAnalysisVal() and pyCAPS._capsAnalysis.getAnalysisOutVal() functions.

1 from __future__ import print_function
2 
3 # Import pyCAPS module (Linux and OSx = pyCAPS.so file; Windows = pyCAPS.pyd file)
4 import pyCAPS
5 
6 # Instantiate our CAPS problem "myProblem"
7 print("Initiating capsProblem")
8 myProblem = pyCAPS.capsProblem()
9 
10 # Load a *.csm file "./csmData/cfdMultiBody.csm" into our newly created problem. The
11 # project name "basicTest" may be optionally set here; if no argument is provided
12 # the CAPS file provided is used as the project name.
13 print("Loading file into our capsProblem")
14 myGeometry = myProblem.loadCAPS("./csmData/cfdMultiBody.csm", "basicTest")
15 
16 # Load FUN3D aim
17 fun3d = myProblem.loadAIM(aim = "fun3dAIM",
18  altName = "fun3d",
19  analysisDir = "FUN3DAnalysisTest",
20  capsIntent = "CFD")
21 
22 
24 valueDict = fun3d.getAnalysisVal()
25 
26 print("Variable Dict = ", valueDict)
27 
28 
29 
31 valueList = fun3d.getAnalysisVal(namesOnly = True)
32 
33 print("Variable List =", valueList)
34 
35 
36 
38 valueDict = fun3d.getAnalysisOutVal()
39 
40 print("Variable Dict = ", valueDict)
41 
42 
43 
45 valueList = fun3d.getAnalysisOutVal(namesOnly = True)
46 
47 print("Variable List =", valueList)
48 
49 
50 # Close our problems
51 print("Closing our problem")
52 myProblem.closeCAPS()
53