COMSOL Multiphysics Programming Reference Manual 5.4

Telechargé par FATMA OULED SAAD
COMSOL Multiphysics
Programming Reference Manual
Contact Information
Visit the Contact COMSOL page at www.comsol.com/contact to submit general
inquiries, contact Technical Support, or search for an address and phone number. You can
also visit the Worldwide Sales Offices page at www.comsol.com/contact/offices for
address and contact information.
If you need to contact Support, an online request form is located at the COMSOL Access
page at www.comsol.com/support/case. Other useful links include:
• Support Center: www.comsol.com/support
• Product Download: www.comsol.com/product-download
• Product Updates: www.comsol.com/support/updates
• COMSOL Blog: www.comsol.com/blogs
• Discussion Forum: www.comsol.com/community
• Events: www.comsol.com/events
• COMSOL Video Gallery: www.comsol.com/video
• Support Knowledge Base: www.comsol.com/support/knowledgebase
Part number: CM020007
COMSOL Multiphysics® Programming Reference Manual
© 1998–2018 COMSOL
Protected by patents listed on www.comsol.com/patents, and U.S. Patents 7,519,518; 7,596,474;
7,623,991; 8,457,932; 8,954,302; 9,098,106; 9,146,652; 9,323,503; 9,372,673; and 9,454,625. Patents
pending.
This Documentation and the Programs described herein are furnished under the COMSOL Software License
Agreement (www.comsol.com/comsol-license-agreement) and may be used or copied only under the terms
of the license agreement.
COMSOL, the COMSOL logo, COMSOL Multiphysics, COMSOL Desktop, COMSOL Server, and
LiveLink are either registered trademarks or trademarks of COMSOL AB. All other trademarks are the
property of their respective owners, and COMSOL AB and its subsidiaries and products are not affiliated
with, endorsed by, sponsored by, or supported by those trademark owners. For a list of such trademark
owners, see www.comsol.com/trademarks.
Version: COMSOL 5.4
CONTENTS | 3
Contents
Chapter 1: Introduction
About the COMSOL API 16
Where Do I Find More Information? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Getting Started 18
The Model Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Compiling a Model File for Java®. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
The Model File for Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Running a Compiled Model File for Java from the Desktop . . . . . . . . . . . . . . . . . . . . . . 20
Running a Compiled Model File as a Batch Job from the Desktop . . . . . . . . . . . . . . . . . . . 20
Running a Compiled Model File with the COMSOL Batch Command . . . . . . . . . . . . . . . . . . 20
Getting the COMSOL Installation Path from the Windows Registry . . . . . . . . . . . . . . . . . . 20
Setting up Eclipse for Compiling and Running a Java® File . . . . . . . . . . . . . . . . . . . . . . 20
Chapter 2: General Commands
About General Commands 24
Overview of General-Purpose Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
get* and Selection Access Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
set(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
setEntry(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
setIndex() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Methods Associated to Set, SetIndex, and the Various Get Methods . . . . . . . . . . . . . . . . . . 29
Selections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Selection Color Themes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
The loadFile and saveFile Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Inserting Features from Other Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
ModelUtil. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
model.attr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
model.attr(<tag>) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
model.batch() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
model.bem() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
model.capeopen() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
model.coeff() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
model.common() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
model.component() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
model.constr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
model.coordSystem() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
model.cpl() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
model.elem() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
model.elementSet() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
model.extraDim() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
model.field(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
model.form() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
model.frame() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
model.func(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4 | CONTENTS
model.geom() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
model.group() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
model.init() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
model.intRule() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
model.massProp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
model.material() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
model.mesh() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
model.methodCall() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
model.modelNode(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
model.multiphysics() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
model.nodeGroup(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
model.ode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
model.opt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Least-Squares Objective Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
model.pair() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
model.param() and model.result().param() . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
model.physics() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
model.probe() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
model.reduced() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
model.result() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
model.savePoint() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
model.selection() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
model.shape() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
model.sol() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
model.solverEvent() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
model.study() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
model.unitSystem() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
model.variable() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
model.view() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
model.weak() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Plotting and Exporting Images 177
Errors and Warnings 180
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Retrieving Problem Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Chapter 3: Geometry
About Geometry Commands 184
Features for Creating Geometric Primitives. . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Features for Geometric Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Selection Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Features for Virtual Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Features for Mesh Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Geometry Object Information Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Working with a Geometry Sequence 190
Adding a Model Component (Geometry). . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Adding a Geometry Feature. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Editing a Geometry Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
Building Geometry Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
CONTENTS | 5
Feature Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Accessing Geometry Object Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Deleting and Disabling Geometry Features . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Deleting Geometry Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Moving and Scaling Geometry Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Plotting a Geometry Sequence. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Geometry Settings 195
Length Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Angular Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Scale Values When Changing Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Geometry Representation in 3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Default Repair Tolerances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Automatic Rebuild . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Work Planes 198
Selections of Geometric Entities 199
Named Selections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Using Selection Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Cumulative Selections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Virtual Operations 201
About Virtual Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Mesh Control Entities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Geometry Object Information 202
General Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Geometric Entity Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Adjacency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Evaluation on an Edge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Evaluation on a Face. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Geometry Representation Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Measurements 207
Measuring Geometric Entities in Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Measuring Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Inserting Geometry Sequences from File 208
Example of Importing Geometry Sequences. . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Exporting Geometry to File 209
Exporting to an ACIS File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Exporting to a Parasolid File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Exporting to an STL File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Compatibility for mphbin/mphtxt in 2D and 3D . . . . . . . . . . . . . . . . . . . . . . . . . 210
Using Geometry Parts 211
Geometry Commands 213
AdjacentSelection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
BallSelection, BoxSelection, CylinderSelection, Disk Selection . . . . . . . . . . . . . . . . . . . . 217
BezierPolygon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
1 / 866 100%
La catégorie de ce document est-elle correcte?
Merci pour votre participation!

Faire une suggestion

Avez-vous trouvé des erreurs dans l'interface ou les textes ? Ou savez-vous comment améliorer l'interface utilisateur de StudyLib ? N'hésitez pas à envoyer vos suggestions. C'est très important pour nous!