ansys.dyna.core.solver.dynasolver#
Module for defining the PyDNYA solver
service.
Exceptions#
Documentation missing. |
|
Documentation missing. |
|
Documentation missing. |
Classes#
Provides the gRPC client-side of Ansys LS-DYNA. |
Module Contents#
- exception ansys.dyna.core.solver.dynasolver.RunningError[source]#
Bases:
Exception
Documentation missing.
- exception ansys.dyna.core.solver.dynasolver.NotFound[source]#
Bases:
Exception
Documentation missing.
- exception ansys.dyna.core.solver.dynasolver.UnexpectedResponse[source]#
Bases:
Exception
Documentation missing.
- class ansys.dyna.core.solver.dynasolver.DynaSolver(hostname='localhost', port='5000', channel=None, server_path='')[source]#
Provides the gRPC client-side of Ansys LS-DYNA.
- Parameters:
- Returns:
An
instance
of
the
client
,which
can
be
used
to
communicate
with
the
gRPC
server
running
at
the
given
host
name
and
port.The
client
can
then
interact
with
LS-DYNAvia
gRPC.
- static grpc_local_server_on() bool [source]#
Check if the server is launched locally.
- Returns:
- bool
True
when successful,False
when failed.
- list_files(subname=None)[source]#
Get size information about one or more files in the LS-DYNA working directory.
- node(n)[source]#
Get size information about a node in the model’s working directory.
- Parameters:
- n
integer
User ID of a node in the model.
- n
- Returns:
A
pair
of
3-tuplesare
returned
,giving
the
(x, y, z)
coordinates
and
velocities
of
the
node.If
the
node
number
given
does
not
exist
in
the
model
,then
(None, None)
is
returned.
- pause()[source]#
Pause LS-DYNA execution.
Execution stops until told to resume or quit. Most
switch
” commands result in one cycle being executed so that the switch can be handled, and then LS-DYNA pauses again.
- quit()[source]#
Terminate the gRPC server program. This does not terminate LS-DYNA.
If the server is running inside a container, it ignore this command and continues running.
- resume(cycle=None, time=None)[source]#
Resume execution.
- Parameters:
- cycle
integer
,optional
Cycle to pause execution on. The default is
None
.- time
float
,optional
Ssimulation time to pause execution at. The default is
None
.- This command can be given whether LS-DYNA is paused or running.
- LS-DYNA runs until the given cycle number or simulation time. If
- both are given, it stops based on whichever occurs first. If
- neither are given, it runs until termination or until paused.
- cycle
- run(args)[source]#
Begin execution with the given string as the command-line arguments.
- Parameters:
- args
str
Command line to pass to LS-DYNA.
- args
- start(nproc)[source]#
Start LS-DYNA.
The program starts and awaits further input. To begin a simulation, the
run
command must used to send the command line arguments.After starting but before running, a
resume
command can be sent to set a pause time or cycle.- Parameters:
- nproc
int
Number of cores (MPI ranks) to run.
- nproc
- start_locally(preset='MPP', input='', nproc=1, memory=20)[source]#
Begin execution with the given string as the command-line arguments.
- Parameters:
- args
str
Command line to pass to LS-DYNA.
- args
- tail(which=1, how=2, queuesize=0)[source]#
Monitor the stdout or stderr of the running job.
- Parameters:
- which
int
,optional
Which stream to monitor. The default is
1
, in which case stdout is used. Otherwise, stderr is used.- how
int
,optional
How to handle the file data. The default is
2
. Options are:0: The file contents are printed to stdout, and this method does not return until LS-DYNA terminates.
1: A
Queue
instance is returned. The queue holds raw blocks of text as returned by the server.2: A
Queue
instance is returned.The queue holds individual lines of text.
- queuesize
int
,optional
Size to use for the
Queue
instance if thehow
parameter is set to a value greater than0
.
- which
- Returns:
If
the
value
for
the
how
parameter
is
greater
than
0,a
Queue instance
is
returned.When
a
call
to
the
q.get()
method
returns
None
,all
data
has
been
returned.
- time()[source]#
Get the current cycle count and simulation time.
- Returns:
A
(cycle_count
,simulation_time
) pair.
- send(cmdin)[source]#
Send one request to LS-DYNA using the command-line interface.
- Parameters:
- cmdin
str
Command to send.
- cmdin
- Returns:
None
There is no data returned. Data that is returned from the underlying method call is just printed to the screen. This method is used to support the sample interactive
client.py
program.Description
Example
“list” then optional file name
list d3plot
“list” then optional file name
list d3plot
“node” user node number
node 43444
“pause” (no arguments)
pause
“download” then file name
download glstat
“upload” then file name
upload input.k
“quit” (no arguments)
quit
“resume” optional cycle and/or time
resume 5000 0.25
“run” then the command line
run i=input.k jobid=xx
“setlc” user load curve number and value
setlc 1075 0.245
“start” number of processors
start 5
“switch” then switch text
switch sw2
“tail” then 1 for stdout, 2 for stderr
tail 1
“time” (no arguments)
time.