Properties |
Methods |
The problem description document
This represents a QuickField problem. The Problem object is a member of the Documents collection, which is available by the Problems property of the Application object. That collection contains all the Problem objects currently open in QuickField.
The Problem objects contains references to all other objects involved: the geometry Model,DataDoc and Library documents, and the calculation Result.
Use Problems (index), where index is the problem name or index number, to return a single Problem object. The following example activates problem one.
Problems(1).Activate
The index number denotes the order in which the problems were opened or created. Problems (1) is the first problem created, and Problems (Problems.Count) is the last one created.
To create a new problem, open an existing one, or save and close the problem we use the methods that a common for all types of QuickField documents. Please refer to the Document section for more details.
Other properties of the Problem object lets you get and set all the parameters accessed by the problem properties dialog. Among them are the ProblemType, Class, and Formulationproperties.
The ReferencedFile property allows you to set names of the Model and Data files that the problem refers to.
The following example creates a new magnetostatic problem and sets its parameters as in the "Magn1" example.
Dim QF As New QuickField.Application | |
Dim prb As QuickField.Problem | |
DefaultFilePath = "D:\QuickField\Examples" | |
Set prb = Problems.Add | 'Create a new problem |
With prb | |
.ProblemType = qfMagnetostatics | 'Set the problem's type |
.Class = qfPlaneParallel | 'Set the problem's class |
.LengthUnits = qfMillimeters | |
.Coordinates = qfCartesian | |
'Set names of the model file and the data file. | |
.ReferencedFile(qfModelFile) = "Magn1.mod" | |
.ReferencedFile(qfDataFile) = "Magn1.dms" | |
.SaveAs "Magn1.pbm" | 'Save the new problem |
End With | |
Other methods of the Problem object solve the problem and bring the field picture window. When the Model and DataDoc objects are ready, we can continue with the above example to solving the Magn1 problem and viewing the results:
If prb.CanSolve Then | |
prb.SolveProblem | ' Solve the problem |
QF.MainWindow.Visible = True | ' make QuickField visible |
prb.AnalyzeResults | ' and get result |
End If | |
The example above uses the SolveProblem method without parameters for solving the finite element problem. Until the solving process is finished, the method does not return control to the main program. In many situations this is not very convenient. If you specify a NoWait input parameter of the SolveProblem method as True, it starts the asynchronous solving process and returns control to the caller immediately. In that case the SolveProblem method also returns SolvingState object - a special object that gives you the ability to know about the solution in progress. The SolvingState object represents a dialog with one or two progress-bars that appears while the solution is running. You can make it visible or not, get the position of progress indicator or cancel the process.
With transient problem you have to enter timing parameters that can be divided into two groups. The first group, includes the TimeStep and TimeFinal properties, is responsible for time step and duration of the integration over time. The initial time value is always assumed as zero.
Another group of timing parameters - TimeOutputFirst and TimeOutputstep properties - controls the time moments when the solution should be stored to a file. Only stored time layers will be later available for analyzing.
The read-only IsTimeDomain property lets you know whether or not the Problem is a time domain one. It returns True if the ProblemType is set to qfHeatTransferDynamic or qfElectromagnetics, and the TimeStep is greater than zero.