Field outputs
Relevant module: edelweissfe.utils.fieldoutput
FieldOutputs store all kind of analysis results,
and are defined via the keyword *fieldOutput.
All fieldOutputs are accessable to all outputmanagers at the end of each
increment, step and job.
Furthermore, they can be exported to *.csv files at the end of the analysis job.
Attention
If the results are exported to a .csv file with enabled “saveHistory”, the time History is automatically appended to the .csv file”
Option |
Type / Default |
Description |
|---|---|---|
perNode |
tuple, default=() |
Create node-based field output. |
perElement |
tuple, default=() |
Create element-based field output. |
fromExpression |
tuple, default=() |
Create field output from expression. |
Option |
Type / Default |
Description |
|---|---|---|
name |
str (required) |
Name of the field output. |
field |
str (required) |
Field of the result. |
result |
str (required) |
Result name. |
elSet |
str, default=None |
Element set. |
nSet |
str, default=None |
Node set. |
rigidBody |
str, default=None |
Rigid body (as registered in model.rigidBodies). |
saveHistory |
bool, default=False |
Save complete History or only last (increment) result |
f(x) |
str, default=None |
Function to apply in each increment. |
f_export(x) |
str, default=None |
Function to apply on final result (table). |
export |
str, default=None |
Export the field output to a file at the end of the job. |
Option |
Type / Default |
Description |
|---|---|---|
name |
str (required) |
Name of the field output. |
elSet |
str (required) |
Element set. |
result |
str (required) |
Result name. |
quadraturePoint |
str (required) |
Integer or slice. |
saveHistory |
bool, default=False |
Save complete History or only last (increment) result |
f(x) |
str, default=None |
Function to apply in each increment. |
f_export(x) |
str, default=None |
Function to apply on final result (table). |
export |
str, default=None |
Export the field output to a file at the end of the job. |
Option |
Type / Default |
Description |
|---|---|---|
name |
str (required) |
Name of the field output. |
elSet |
str, default=None |
Element set. |
nSet |
str, default=None |
Node set. |
expression |
str (required) |
Expression for retrieving field output. |
saveHistory |
bool, default=False |
Save complete History or only last (increment) result |
f(x) |
str, default=None |
Function to apply in each increment. |
f_export(x) |
str, default=None |
Function to apply on final result (table). |
export |
str, default=None |
Export the field output to a file at the end of the job. |
../../../testfiles/marmot/FieldOutput/fieldOutput.inp*material, name=modleon, id=modleon
30000.0, 0.15 ,13 , 47.4 , 55 , 4.74 , 0.85 , 0.12 , 0.003, 2.0, 0.000001, 15.0, 0.10, 1
*section, name=section1, material=modleon, type=plane
all
*job, name=cps4job, domain=2d, solver=NIST
*solver, solver=NIST, name=theSolver
*modelGenerator, generator=planeRectQuad, name=gen
x0=0, l=50
y0=0, h=100
elType=CPS4
nX=20
nY=20
*fieldOutput,
>>perNode, name=displacement, nSet=all, field=displacement, result=U
>>perNode, name=displacement_top, nSet=gen_top, field=displacement, result=U, saveHistory=True
>>perNode, name=displacement_top_mean_1, nSet=gen_top, field=displacement, result=U, saveHistory=True, f(x)='mean( x[:,1])'
>>perNode, name=RF_bottom, nSet=gen_bottom, field=displacement, result=P, saveHistory=True
>>perNode, name=RF_bottom_sum_1, nSet=gen_bottom, field=displacement, result=P, saveHistory=True, f(x)='sum(x[:,1])'
>>perElement, name=stress, elSet=all, result=stress, quadraturePoint=1
>>perElement, name=stress_top, elSet=gen_top, result=stress, quadraturePoint=1
>>perElement, name=alphaP, elSet=all, result=alphaP, quadraturePoint=1
** *output, type=meshPlot,
** figure=1, axSpec=221, create=perNode, fieldOutput=displacement, f(x)='x[:,1]', label=U2
** figure=1, axSpec=222, create=perElement, fieldOutput=stress, f(x)='x[:,1]', label=S2
** figure=1, axSpec=212, c=red, ls=dashed, create=xyData, x=time, y=RF_bottom, f(y)='sum ( y[:,:,1], axis=1)', label=Sum(RF)
*output, type=ensight, name=myEnsightExport
>>perNode, fieldOutput=displacement
>>perElement, fieldOutput=stress
>>perElement, fieldOutput=alphaP
>>configuration, overwrite=yes
*output, type=monitor, name=myNodeMonitor
fieldOutput=RF_bottom, f(x)='sum ( x[:,1] )'
*output, type=plotAlongPath, name=myNodeSetPlotter
figure=2, nSet=gen_top, fieldOutput=RF_bottom, f(x)='x[:,1]', label=P along bottom, normalize=True
*step, solver=theSolver
maxInc=1e-1, minInc=1e-8, maxNumInc=1000, maxIter=25, stepLength=100
>>options, name=myEnsightExport, intermediateSaveInterval=2
>>options, name=theSolver, extrapolation=linear
>>dirichlet, name=1, nSet=gen_leftBottom, field=displacement, 2=0.0, 1=0.0
>>dirichlet, name=bottom, nSet=gen_bottom, field=displacement, 2=0,
>>nodeforces, name=top, nSet=gen_top, field=displacement, 2=-80, f(t)=t**2
Module documentation:
- class edelweissfe.utils.fieldoutput.FieldOutputController(model, journal)[source]
The central module for managing field outputs, which can be used by output managers.
Methods
addExpressionFieldOutput(associatedSet, ...)Add a new FieldOutput entry to be computed during the simulation
addPerElementFieldOutput(name, elSet[, ...])Add a new FieldOutput entry to be computed during the simulation
addPerNodeFieldOutput(name, nodeField[, ...])Add a new FieldOutput entry to be computed during the simulation
addRigidBodyFieldOutput(name, rigidBody, field)Add a new FieldOutput entry operating directly on a RigidBody.
Finalize all field outputs at the end of an increment.
Finalize all field outputs at the end of a job.
Finalize all field outputs at the end of a step.
initializeStep(step)Initalize an step.
initializeJob
- addExpressionFieldOutput(associatedSet, theExpression, name, saveHistory=False, f_x=None, export=None, fExport_x=None)[source]
Add a new FieldOutput entry to be computed during the simulation
- Parameters:
associatedSet (set) – The associated set of nodes or elements.
theExpression (Callable) – The expression to be evaluated.
name (str) – The name of this FieldOutput.
saveHistory – Save the complete history or only the last result.
f_x (Callable) – Apply a math function on the results.
export (str) – Export the results to a file.
fExport_x (Callable) – Apply a math function on the results before exporting.
- addPerElementFieldOutput(name, elSet, result=None, saveHistory=False, f_x=None, export=None, fExport_x=None, quadraturePoints=int | slice | list[int])[source]
Add a new FieldOutput entry to be computed during the simulation
- Parameters:
name (str) – The name of this FieldOutput.
elSet (ElementSet) – The
ElementSeton which this FieldOutput should operate.result (str) – The name of the result, which is provided by the Elements in the
ElementSet.journal – The
Journalinstance for logging purposes.saveHistory – Save the complete history or only the last result.
f_x (Callable) – Apply a math function on the results.
export (str) – Export the results to a file.
fExport_x (Callable) – Apply a math function on the results before exporting.
quadraturePoints – The indices of quadrature points for which the results should be extracted.
- addPerNodeFieldOutput(name, nodeField, result=None, saveHistory=False, f_x=None, export=None, fExport_x=None)[source]
Add a new FieldOutput entry to be computed during the simulation
- Parameters:
name (str) – The name of this FieldOutput.
nodeField (NodeField) – The
NodeFieldon which this FieldOutput should operate.result (str) – The name of the result entry in the
NodeField.journal – The
Journalinstance for logging purposes.saveHistory – Save the complete history or only the last result.
f_x (Callable) – Apply a math function on the results.
export (str) – Export the results to a file.
fExport_x (Callable) – Apply a math function on the results before exporting.
- addRigidBodyFieldOutput(name, rigidBody, field, saveHistory=False, f_x=None, export=None, fExport_x=None)[source]
Add a new FieldOutput entry operating directly on a RigidBody.
- Parameters:
name (str) – The name of this FieldOutput.
rigidBody – The
RigidBodyon which this FieldOutput should operate.field (str) – The name of the field to retrieve from the rigid body (e.g., “displacement”).
saveHistory – Save the complete history or only the last result.
f_x (Callable) – Apply a math function on the results.
export (str) – Export the results to a file.
fExport_x (Callable) – Apply a math function on the results before exporting.
- class edelweissfe.utils.fieldoutput._FieldOutputBase(name, model, journal, saveHistory=False, f_x=None, export=None, fExport_x=None, reshape_to_dimensions=None)[source]
Entity of a fieldOutput request. Carries the history or the latest result.
- Parameters:
name (str) – The name of this FieldOutput.
model (FEModel) – A dictionary containing the model tree.
journal (Journal) – The journal object for logging.
saveHistory (bool) – Save the complete history or only the last result.
f_x (Callable) – Apply a math function on the results.
export (str) – Export the results to a file.
fExport_x (Callable) – Apply a math function on the results before exporting.
reshape_to_dimensions (int) – Reshape the result to a specific number of dimensions.
- Attributes:
resultVersionThe number of changes of
resultso far – its updates and a restart’s load: the key of whatever is derived from the result and kept until it changes (e.g.
Methods
Finalize an increment, i.e. store the current results.
Bring the stored result up to date with the model's final state, if the step advanced past the increment that stored the current one.
Get the last result, no matter if the history is stored or not.
The history this field output carries from one increment to the next -- the times, the results (flattened, since refinement changes their shape), and how much of the export file belongs to the run.
Get the history.
Get the time history.
Whether a result was computed yet:
Falsebefore the first converged increment.Initalize everything.
initializeStep(step)Write the current (just-updated) result as the first row of this step.
setRestartData(data)Restore the state
getRestartData()returned.setResults(values)Modifies a result at it's origin, if possible.
Update file output.
finalizeJob
- finalizeStep()[source]
Bring the stored result up to date with the model’s final state, if the step advanced past the increment that stored the current one.
The output managers write one final frame at the end of a step, from the result stored here – see the Ensight export’s
finalizeStep, which writes whenever time has advanced since its last frame. If the topology changed after that result was stored, which is exactly what live h-adaptivity does between two output increments, the result belongs to a different mesh than the one being written and the export rejects it:Variable displacement result size (32) does not match the number of nodes (141)
Guarded on time having advanced, by the same rule the managers use, so the two decisions cannot disagree: whenever a manager writes a final frame the result behind it has just been refreshed, and a step ending on an increment that already stored a result does not store a second one at the same time and duplicate the last point of a history export.
- getLastResult()[source]
Get the last result, no matter if the history is stored or not.
- Returns:
The result array.
- Return type:
np.ndarray
- getRestartData()[source]
The history this field output carries from one increment to the next – the times, the results (flattened, since refinement changes their shape), and how much of the export file belongs to the run.
- Returns:
The state.
- Return type:
dict[str, numpy.ndarray]
- getResultHistory()[source]
Get the history. Throws an exception if the history is not stored, or if the stored entries do not all share the same shape (e.g. because the mesh changed under adaptive refinement, in which case a rectangular per-node history is not well-defined).
- Returns:
The result history.
- Return type:
np.ndarray
- hasResult()[source]
Whether a result was computed yet:
Falsebefore the first converged increment.- Returns:
TrueoncegetLastResult()has something to return.- Return type:
bool
- initializeJob()[source]
Initalize everything. Will also update the results based on the proved start time and solution.
- initializeStep(step)[source]
Write the current (just-updated) result as the first row of this step.
Only at the start of a step: a step resumed from a checkpoint already exported this state, as the last row before the checkpoint was written.
- setRestartData(data)[source]
Restore the state
getRestartData()returned.- Parameters:
data (dict[str, ndarray]) – The state.
- setResults(values)[source]
Modifies a result at it’s origin, if possible. Throws an exception if not possible.
- Parameters:
values (ndarray) – The values.
- property resultVersion: int
the key of whatever is derived from the result and kept until it changes (e.g. a marker’s
selectionStamp()).A cache key, not state: a resumed run counts from its restart, not from the start of the analysis. It is backed by the change counter
_version, which, like the_versionof a set, a surface or a node field, a restart need not reproduce.- Type:
The number of changes of
resultso far – its updates and a restart’s load
- class edelweissfe.utils.fieldoutput.ElementFieldOutput(name, elSet, resultName, model, journal, saveHistory=False, f_x=None, export=None, fExport_x=None, quadraturePoints=0)[source]
This is a Element based FieldOutput. It operates on ElementSets.
- Parameters:
name (str) – The name of this FieldOutput.
elSet (ElementSet) – The ElementSet on which this FieldOutput operates.
resultName (str) – The name of the result entry in the
ElementBase.model (FEModel) – The model tree instance.
journal (Journal) – The journal object for logging.
saveHistory (bool) – Save the complete history or only the last result.
f_x (Callable) – Apply a math function on the results.
export (str) – Export the results to a file.
fExport_x (Callable) – Apply a math function on the results before exporting.
quadraturePoints (int | slice | list[int]) – The list of quadrature points for which the results should be extracted.
- Attributes:
resultVersionThe number of changes of
resultso far – its updates and a restart’s load: the key of whatever is derived from the result and kept until it changes (e.g.
Methods
finalizeIncrement()Finalize an increment, i.e. store the current results.
finalizeStep()Bring the stored result up to date with the model's final state, if the step advanced past the increment that stored the current one.
getLastResult()Get the last result, no matter if the history is stored or not.
getRestartData()The history this field output carries from one increment to the next -- the times, the results (flattened, since refinement changes their shape), and how much of the export file belongs to the run.
getResultHistory()Get the history.
getTimeHistory()Get the time history.
hasResult()Whether a result was computed yet:
Falsebefore the first converged increment.initializeJob()Initalize everything.
initializeStep(step)Write the current (just-updated) result as the first row of this step.
setRestartData(data)Restore the state
getRestartData()returned.setResults(values)Modifies a result at it's origin, if possible.
updateResults(model)Update the field output.
writeLastResult()Update file output.
finalizeJob
- class edelweissfe.utils.fieldoutput.NodeFieldOutput(name, nodeField, result, model, journal, saveHistory=False, f_x=None, export=None, fExport_x=None)[source]
This is a Node based FieldOutput. It operates on NodeFields.
- Parameters:
name (str) – The name of this FieldOutput.
nodeField – The NodeField, on which this FieldOutput operates.
result (str) – The name of the result entry in the NodeField, one of
ENTRIES.model (FEModel) – The model tree instance.
journal (Journal) – The journal object for logging.
saveHistory (bool) – Save the complete history or only the last result.
f_x (Callable) – Apply a math function on the results.
export (str) – Export the results to a file.
fExport_x (Callable) – Apply a math function on the results before exporting.
- Raises:
KeyError – If the result is not an entry a node field holds.
- Attributes:
resultVersionThe number of changes of
resultso far – its updates and a restart’s load: the key of whatever is derived from the result and kept until it changes (e.g.
Methods
finalizeIncrement()Finalize an increment, i.e. store the current results.
finalizeStep()Bring the stored result up to date with the model's final state, if the step advanced past the increment that stored the current one.
getLastResult()Get the last result, no matter if the history is stored or not.
getRestartData()The history this field output carries from one increment to the next -- the times, the results (flattened, since refinement changes their shape), and how much of the export file belongs to the run.
getResultHistory()Get the history.
getTimeHistory()Get the time history.
hasResult()Whether a result was computed yet:
Falsebefore the first converged increment.initializeJob()Initalize everything.
initializeStep(step)Write the current (just-updated) result as the first row of this step.
setRestartData(data)Restore the state
getRestartData()returned.setResults(values)Modifies a result at it's origin, if possible.
updateResults(model)Update the field output.
writeLastResult()Update file output.
finalizeJob
- class edelweissfe.utils.fieldoutput.RigidBodyFieldOutput(name, rigidBody, field, model, journal, saveHistory=False, f_x=None, export=None, fExport_x=None)[source]
This is a FieldOutput operating directly on a RigidBody.
A rigid body’s visualization (e.g., surface) nodes are not independent degrees of freedom – they are fully determined by the rigid body’s reference point, which is itself part of an ordinary NodeField. This FieldOutput therefore does not operate on a NodeField at all: it queries
getVisualizationField(), which computes the requested field directly from the rigid body’s (already solved) kinematics.- Parameters:
name (str) – The name of this FieldOutput.
rigidBody – The RigidBody on which this FieldOutput operates.
field (str) – The name of the field to retrieve from the rigid body (e.g., “displacement”).
model (FEModel) – The model tree instance.
journal (Journal) – The journal object for logging.
saveHistory (bool) – Save the complete history or only the last result.
f_x (Callable) – Apply a math function on the results.
export (str) – Export the results to a file.
fExport_x (Callable) – Apply a math function on the results before exporting.
- Attributes:
resultVersionThe number of changes of
resultso far – its updates and a restart’s load: the key of whatever is derived from the result and kept until it changes (e.g.
Methods
finalizeIncrement()Finalize an increment, i.e. store the current results.
finalizeStep()Bring the stored result up to date with the model's final state, if the step advanced past the increment that stored the current one.
getLastResult()Get the last result, no matter if the history is stored or not.
getRestartData()The history this field output carries from one increment to the next -- the times, the results (flattened, since refinement changes their shape), and how much of the export file belongs to the run.
getResultHistory()Get the history.
getTimeHistory()Get the time history.
hasResult()Whether a result was computed yet:
Falsebefore the first converged increment.initializeJob()Initalize everything.
initializeStep(step)Write the current (just-updated) result as the first row of this step.
setRestartData(data)Restore the state
getRestartData()returned.setResults(values)Modifies a result at it's origin, if possible.
updateResults(model)Update the field output from the rigid body's current kinematics.
writeLastResult()Update file output.
finalizeJob
- class edelweissfe.utils.fieldoutput.ExpressionFieldOutput(associatedSet, theExpression, name, model, journal, saveHistory=False, f_x=None, export=None, fExport_x=None)[source]
This is a Node based FieldOutput. It operates on NodeFields.
- Parameters:
associatedSet (OrderedSet | None) – The associated set of nodes or elements.
theExpression – The expression to be evaluated.
name (str) – The name of this FieldOutput.
nodeField – The NodeField, on which this FieldOutput operates.
result – The name of the result entry in the NodeField.
model (FEModel) – The model tree instance.
journal (Journal) – The journal object for logging.
saveHistory (bool) – Save the complete history or only the last result.
f_x (Callable) – Apply a math function on the results.
export (str) – Export the results to a file.
fExport_x (Callable) – Apply a math function on the results before exporting.
- Attributes:
resultVersionThe number of changes of
resultso far – its updates and a restart’s load: the key of whatever is derived from the result and kept until it changes (e.g.
Methods
finalizeIncrement()Finalize an increment, i.e. store the current results.
finalizeStep()Bring the stored result up to date with the model's final state, if the step advanced past the increment that stored the current one.
getLastResult()Get the last result, no matter if the history is stored or not.
getRestartData()The history this field output carries from one increment to the next -- the times, the results (flattened, since refinement changes their shape), and how much of the export file belongs to the run.
getResultHistory()Get the history.
getTimeHistory()Get the time history.
hasResult()Whether a result was computed yet:
Falsebefore the first converged increment.initializeJob()Initalize everything.
initializeStep(step)Write the current (just-updated) result as the first row of this step.
setRestartData(data)Restore the state
getRestartData()returned.setResults(values)Modifies a result at it's origin, if possible.
updateResults(model)Update the field output.
writeLastResult()Update file output.
finalizeJob