LESARD: Postprocessing¶
Page navigation
Automatic post-processing routines¶
The predefined set of exports plots are given in wrapper routines located in the file PostProcess
under the
_Solver
folder. This is the main post-processing file that proposes predefined post-treatment tasks
-
3_LESARD.SourceCode.PostProcess.
Compute_Errors
(*argv)¶ Exports the usually welcome plots after computation, in Matplotlib. The inputs should be given in the below given order.
- Parameters
ProblemName (string) – name of the problem module to investigate, stored in the “PredefinedProblems” folder (see the problem definition’s instructions for more details)
Settings (string) – name of the settings file specifying the scheme, time options etc to use for the study, stored in the “PredefinedSettings” folder
Type (integer) – where to compute the errors (0: on veertices, 1: on degrees of freedom)
- Returns
The solution’s matplotlib plots for each time step given in
time
.- Return type
None
The automatically exported plots (called plotting routines) for the fluid’s selector are:
- PlotConvergenceRate
The automatically exported error values (called error routines) are
- ComputeErrors (automatically called through PlotConvergenceRate)
-
3_LESARD.SourceCode.PostProcess.
Results_ConvertToVTK
(*argv)¶ Converts a solution exported in .sol to a classical vtk output
- Parameters
ProblemName (string) – name of the problem module to investigate, stored in the “PredefinedProblems” folder (see the problem definition’s instructions for more details)
Settings (string) – name of the settings file specifying the scheme, time options etc to use for the study, stored in the “PredefinedSettings” folder
time (float array-like or string) – time points for which to process the plot, or “all”
Resolution (integer) – mesh resolution
- Returns
Saves the converted solution for each time step given in
time
in the same folder as targetted from the inputs.- Return type
None
-
3_LESARD.SourceCode.PostProcess.
Plots_StaticSchlieren
(*argv)¶ Exports the usually welcome plots after computation, in Matplotlib. The inputs should be given in the below given order.
- Parameters
ProblemName (string) – name of the problem module to investigate, stored in the “PredefinedProblems” folder (see the problem definition’s instructions for more details)
Settings (string) – name of the settings file specifying the scheme, time options etc to use for the study, stored in the “PredefinedSettings” folder
time (float array-like or string) – time points for which to process the plot, or “all”
Resolution (integer) – mesh resolution
- Returns
The solution’s matplotlib plots for each time step given in
time
.- Return type
None
The automatically exported plots (called plotting routines) for this function are for the selected variable:
- Compute2DSchlierenImages
Note
For speedup, we assume that the mesh is the same for every time point. Change line 174 to be as 169 if wished otherwise
-
3_LESARD.SourceCode.PostProcess.
Plots_StaticMatplotlib
(*argv)¶ Exports the usually welcome plots after computation, in Matplotlib. The inputs should be given in the below given order.
- Parameters
ProblemName (string) – name of the problem module to investigate, stored in the “PredefinedProblems” folder (see the problem definition’s instructions for more details)
Settings (string) – name of the settings file specifying the scheme, time options etc to use for the study, stored in the “PredefinedSettings” folder
time (float array-like or string) – time points for which to process the plot, or “all”
Resolution (integer) – mesh resolution
- Returns
The solution’s matplotlib plots for each time step given in
time
.- Return type
None
The automatically exported plots (called plotting routines) for this function are for each variable:
- PlotVariableOnWholeDomainTri2D
- PlotVariableOnWholeDomainTri
- PlotVariableOnEachSubDomainTri2D
- PlotVariableOneEachSubDomainTri
- PlotVariableOnWholeDomain2D
- PlotVariableOnEachSubDomain2D
- PlotVariableOnWholeDomain
- PlotVariableOneEachSubDomain
The automatically exported plots (called plotting routines) for the fluid’s selector are:
- PlotLSValuesOnWholeDomainTri
- PlotLSValuesTri
- PlotLSValuesOnWholeDomainTri
-
3_LESARD.SourceCode.PostProcess.
Plot_DebugMatplotlib
(*argv)¶ Exports the debug tools for multiphase computation, in Matplotlib (linked to the
Plots_Matplotlib
module). The inputs should be given in the below given order.- Parameters
ProblemName (string) – name of the problem module to investigate, stored in the “PredefinedProblems” folder (see the problem definition’s instructions for more details)
Settings (string) – name of the settings file specifying the scheme, time options etc to use for the study, stored in the “PredefinedSettings” folder
time (float array-like or string) – time points for which to process the plot, or “all”
Resolution (integer) – mesh resolution
- Returns
The solution’s matplotlib plots for each time step given in
time
.- Return type
None
The automatically debug (called routines) for this function are:
- PlotFlags
- PlotSubdomains
- PlotLSubDomains
- PlotLSValuesTri
-
3_LESARD.SourceCode.PostProcess.
Plots_StaticPlotly
(*argv)¶ Exports the usually welcome plots after computation, in plotly (linked to the
Plots_Plotly
module). The inputs should be given in the below given order.- Parameters
ProblemName (string) – name of the problem module to investigate, stored in the “PredefinedProblems” folder (see the problem definition’s instructions for more details)
Settings (string) – name of the settings file specifying the scheme, time options etc to use for the study, stored in the “PredefinedSettings” folder
time (float array-like or string) – time points for which to process the plot, or “all”
Resolution (integer) – mesh resolution
- Returns
The solution’s matplotlib plots for each time step given in
time
.- Return type
None
The automatically exported plots (called plotting routines) for this function are for each variable:
- PlotSolution2DOnEachSubDomain
- PlotSolution2D
- PlotLevelSetOnEachSubDomain
- PlotSolutionOnEachSubdomain
- PlotSolution
The automatically exported plots (called plotting routines) for the fluid’s selector are:
- PlotEachLevelSet
- PlotEachLevelSetTri
- PlotAllLevelSets
-
3_LESARD.SourceCode.PostProcess.
Plots_AnimationsPlotly
(*argv)¶ Exports the usually welcome animation after computation, in Plotly. The inputs should be given in the below given order.
- Parameters
ProblemName (string) – name of the problem module to investigate, stored in the “PredefinedProblems” folder (see the problem definition’s instructions for more details)
Settings (string) – name of the settings file specifying the scheme, time options etc to use for the study, stored in the “PredefinedSettings” folder
Resolution (integer) – mesh resolution
- Returns
The solution’s plotly plot as html animation from all the raw files that have been exported in the results folder.
- Return type
None
The automatically exported animations (called plotting routines) for this function are for each variable:
- Animate3DSolution
- Animate3DLevelSet
- Animate2DLevelSet (very slow, visualisation time slow as well, commented hardly by default)
User information¶
The module Printouts
located in the SourceCode/Postprocessing
file gathers
routines defining reccurring runtime printouts for concision.
-
3_LESARD.SourceCode.PostProcessing.Printouts.
PrintPbInfo
(Mesh, Prolem, ProblemData, Solver, Solution)¶ Print a recap of the problem and solver at the launch of the problem
- Parameters
Mesh (MeshStructure) – the considered mesh
Problem (Problem) – the considered problem
ProblemData (Parameters) – the parameters of the solver
Solver (Solver) – the used solver
Solution (Solution) – the obtained solution
- Returns
None
Note
To be completed
-
3_LESARD.SourceCode.PostProcessing.Printouts.
Printout_MinMaxSolVal
(Problem, Solution)¶ Printouts the min and max values of the solution for each variable for the given solution
-
3_LESARD.SourceCode.PostProcessing.Printouts.
Printout_MinMaxSolVal_Primary
(Problem, Solution)¶ Printouts the min and max values of the solution for each primary variable for the given solution
- Parameters
Problem (Problem) – the considered problem
Solution (Solution srucutre) – the obtained solution
- Returns
None
-
3_LESARD.SourceCode.PostProcessing.Printouts.
Printout_DetailedLSValues
(t, Problem, Mesh, Solution)¶ Printouts the min and max values of the solution for each variable for the given solution
- Parameters
t (float) – the considered time point
Problem (Problem) – the considered problem
Mesh (MeshStructure) – the considered mesh
Solution (Solution srucutre) – the obtained solution
- Returns
None
Plotly plots¶
The module Plots_Plotly
located in the SourceCode/Postprocessing
file proposes
visualisation routines for solution of a multi
phase problem which is stored in a Solution structure, in Plotly. It contains plotting 2D solutions, plotting 3D solutions
and animation routines.
Note
The module is made to be used on-line, that is either while computing the solution (except videos) or after an exported solution has been loaded
Warning
When the level set is constant (i.e. 1 fluid), the 3D plot of the level set may fail
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
GetMeshgridFom3VectorsMaskX
(Mesh, X, Y, Z)¶ Interpolation routine in order to plot.
- Parameters
Mesh (MeshStructure) – the mesh in use
X (float array like) – the x coordinates of the considered points
Y (float array like) – the y coordinates of the considered points
Z (float array like) – the data’s (scalar) value at the considered points
Returns
xgrid (float 2D numpy array) – x meshgrid of the points where the solution Z has been interpolated
ygrid (float 2D numpy array) – y meshgrid of the points where the solution Z has been interpolated
zgrid (float 2D numpy array) – values of the interpolated Z at the generated grid points
Note
When holes in the domains, the xy values are masked with None in both corresponding meshgrids
The x resolution of the interpolation grid is set to 5*(xmax-xmin)/np.min(Mesh.InnerElementsDiameter), and respectively for the y axis
The interpolation method is set to “linear”, with a fill value of “-1e-15” in order to fit the 0 crossing at a physical boundary in case of interpolating a level set.
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
GetMeshgridFom3VectorsMaskZ
(Mesh, X, Y, Z)¶ Interpolation routine in order to plot.
- Parameters
Mesh (MeshStructure) – the mesh in use
X (float array like) – the x coordinates of the considered points
Y (float array like) – the y coordinates of the considered points
Z (float array like) – the data’s (scalar) value at the considered points
Returns
xgrid (float 2D numpy array) – x meshgrid of the points where the solution Z has been interpolated
ygrid (float 2D numpy array) – y meshgrid of the points where the solution Z has been interpolated
zgrid (float 2D numpy array) – values of the interpolated Z at the generated grid points
Note
When holes in the domains, the z values are masked with None in both corresponding meshgrids
The x resolution of the interpolation grid is set to 5*(xmax-xmin)/np.min(Mesh.InnerElementsDiameter), and respectively for the y axis
The interpolation method is set to “linear”, with a fill value of “-1e-15” in order to fit the 0 crossing at a physical boundary in case of interpolating a level set.
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
GenerateFigurePlotly3D
(Frame, bounds, Title='Plot Title', Zaxis='Zaxis')¶ A generic 3D plotly routine that encapsulates a plotted object in a figure.
- Parameters
Frame (Plotly object) – any plotly content that can be incorporated in a figure
bounds (float array-like) – the xmin-xmax bounds of the plot (the same will be used for the y axis, guaranteeing the equal option: always use the larger data to not cut-off the picture unwinlingly)
title (string) – (optional) the title of the figure
Zaxis (string) – the zaxis label to be set (default = “Zaxis”)
- Returns
the figure in Plotly format
- Return type
fig (plotly figure instance)
Note
The figure is only generated, not shown neither exported
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
GenerateFigurePlotly2D
(Frame, bounds, Title='Plot Title')¶ A generic 2D plotly routine that encapsulates a plotted object in a figure.
- Parameters
Frame (Plotly object) – any plotly content that can be incorporated in a figure
bounds (float array-like) – the xmin-xmax bounds of the plot (the same will be used for the y axis, guaranteeing the equal option: always use the larger data to not cut-off the picture unwinlingly)
title (string) – (optional) the title of the figure
- Returns
the figure in Plotly format
- Return type
fig (plotly figure instance)
Note
The figure is only generated, not shown neither exported
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
PlotAnimation3D
(LightExport, TestName, Resolution, FrameFunc, cmin, cmax, args, Title='Plot Title', Zaxis='Zaxis')¶ Routine that creates a 3D plotly hmtl animation given the Frame function framefunc and the solutions that are stored in the TestName folder.
- Parameters
LightExport (integer) – integer telling if the results have been exported with a light (1, without mesh) or full export (0)
TestName (string) – the name of the folder where the results are stored
Resolution (integer) – the resolution of the associated mesh
FrameFunc (function callback) – the plotting function furnishing each frame, whose three first arguments should be Problem, Mesh, Solution, cbounds
cmin (float) – the minimum value of the plotted quantities
cmax (float) – the maximum value of the plotted quantities
args (array-like) – containing the further arguments to be passed to FrameFunc
Title (string) – (optional) the title of the animation
Zaxis (string) – (optional) the label of the z axis
- Returns
a plotly animation
- Return type
fig (plotly animation)
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
PlotAnimation2D
(LightExport, TestName, Resolution, FrameFunc, cmin, cmax, args, Title='Plot Title')¶ Routine that creates a 2D plotly hmtl animation given the Frame function framefunc and the solutions that are stored in the TestName folder.
- Parameters
LightExport (integer) – integer telling if the results have been exported with a light (1, without mesh) or full export (0)
TestName (string) – the name of the folder where the results are stored
Resolution (integer) – the resolution of the associated mesh
FrameFunc (function callback) – the plotting function furnishing each frame, whose three first arguments should be Problem, Mesh, Solution, cbounds
cmin (float) – the minimum value of the plotted quantities
cmax (float) – the maximum value of the plotted quantities
args (array-like) – containing the further arguments to be passed to FrameFunc
Title (string) – (optional) the title of the animation
- Returns
a plotly animation
- Return type
fig (plotly animation)
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
PlotAllLevelSets
(Mesh, Solution, ParametersId)¶ Plots all the level sets on the computational domain.
- Parameters
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
ParametersId (string) – the string forming the “ProblemName_ParameterName”, mapping to the right solution export folder
- Returns
The 3D plot of all the levels set on the considered domain are exported in the problem-dependent solution export folder.
- Return type
None
Note
The figure is only exported, not shown
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
GenerateFrameEachLevelSet
(Problem, Mesh, Solution, cbounds, VariableId, ParametersId)¶ Generates a figure’s frame of the slevel set variableId on the full computational domain.
- Parameters
Problem (Problem) – the considered problem
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
cbounds (float array-like) – values determining the bounds of the color scale to use
VariableId (integer) – the index of the desired variable to be plot
:param : the index of the desired variable to be plot :type : integer :param ParametersId: the string forming the “ProblemName_ParameterName”, mapping to the right solution export folder :type ParametersId: string
- Returns
The frame representing the solution on the considered domain with a subdomain-dependent color scale.
- Return type
None
Note
The routine has been split from PlotSolutionOnEachSubdomain to ease the construction of a video frame later
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
PlotEachLevelSet
(Mesh, Solution, ParametersId)¶ Plots the level sets in independent figures, each on the full computational domain.
- Parameters
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
ParametersId (string) – the string forming the “ProblemName_ParameterName”, mapping to the right solution export folder
- Returns
The 3D plot of all the levels set on the considered domain, exported in the problem-dependent solution export folder.
- Return type
None
Note
The figure is only exported, not shown
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
PlotEachLevelSetTri
(Mesh, Solution, ParametersId)¶ Plots the level sets in independent figures, each on the full computational domain.
- Parameters
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
ParametersId (string) – the string forming the “ProblemName_ParameterName”, mapping to the right solution export folder
- Returns
The 3D plot of all the levels set on the considered domain, exported in the problem-dependent solution export folder.
- Return type
None
Note
The figure is only exported, not shown
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
PlotSolution
(Problem, Mesh, Solution, VariableId, ParametersId)¶ Plots the solution’s variableId on the full computational domain.
- Parameters
Problem (Problem) – the considered problem
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
VariableId (integer) – the index of the desired variable to be plot
:param : the index of the desired variable to be plot :type : integer :param ParametersID: the string forming the “ProblemName_ParameterName”, mapping to the right solution export folder :type ParametersID: string
- Returns
The 3D plot of all the given solution set on the considered domain, exported in the problem-dependent solution export folder.
Note
The figure is only exported, not shown
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
GenerateFrameSolutionOnEachSubdomain
(Problem, Mesh, Solution, cbounds, VariableId, ParametersId)¶ Generates a figure’s frame of the solution’s variableId on the full computational domain with a color scale per subdomain.
- Parameters
Problem (Problem) – the considered problem
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
cbounds (float array-like) – values determining the bounds of the color scale to use
VariableId (integer) – the index of the desired variable to be plot
:param : the index of the desired variable to be plot :type : integer :param ParametersId: the string forming the “ProblemName_ParameterName”, mapping to the right solution export folder :type ParametersId: string
- Returns
The frame representing the solution on the considered domain with a subdomain-dependent color scale.
- Return type
None
Note
The routine has been split from PlotSolutionOnEachSubdomain to ease the construction of a video frame later
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
PlotSolutionOnEachSubdomain
(Problem, Mesh, Solution, VariableId, ParametersId, cbounds)¶ Generates a figure’s frame of the solution’s variableId on the full computational domain with a color scale per subdomain.
- Parameters
Problem (Problem) – the considered problem
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
VariableId (integer) – the index of the desired variable to be plot
:param : the index of the desired variable to be plot :type : integer :param ParametersID: the string forming the “ProblemName_ParameterName”, mapping to the right solution export folder :type ParametersID: string :param cbounds: values determining the bounds of the color scale to use :type cbounds: float array-like
- Returns
The frame representing the solution on the considered domain with a subdomain-dependent color scale.
- Return type
None
Note
The routine has been split from PlotSolutionOnEachSubdomain to ease the construction of a video frame later
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
PlotLevelSetOnEachSubDomain
(Problem, Mesh, Solution, ParametersId)¶ Plots the positive part of each level set on their corresponding subdomain.
- Parameters
Problem (Problem) – the considered problem
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
ParametersId (string) – the string forming the “ProblemName_ParameterName”, mapping to the right solution export folder
- Returns
The 2D plot of all the levels set on their corresponding subdomains, exported in the problem-dependent solution export folder.
- Return type
None
Note
The figure is only exported, not shown
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
GenerateFrameLevelSetOnEachSubDomain
(Problem, Mesh, Solution, cbounds, VariableId, ParametersId)¶ Plots the positive part of each level set on their corresponding subdomain.
- Parameters
Problem (Problem) – the considered problem
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
cbounds (float array-like) – values determining the bounds of the color scale to use
VariableId (integer) – the index of the desired variable to be plot
:param : the index of the desired variable to be plot :type : integer :param ParametersId: the string forming the “ProblemName_ParameterName”, mapping to the right solution export folder :type ParametersId: string
- Returns
The 2D plot of all the levels set on their corresponding subdomains, exported in the problem-dependent solution export folder.
- Return type
None
Note
The figure is only exported, not shown
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
PlotSolution2D
(Problem, Mesh, Solution, VariableId, ParametersId)¶ Plots the solution’s variableId on the full computational domain in 2D.
- Parameters
Problem (Problem) – the considered problem
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
VariableId (integer) – the index of the desired variable to be plot
:param : the index of the desired variable to be plot :type : integer :param ParametersId: the string forming the “ProblemName_ParameterName”, mapping to the right solution export folder :type ParametersId: string
- Returns
The 2D plot of all the given solution set on the considered domain, exported in the problem-dependent solution export folder.
- Return type
None
Note
The figure is only exported, not shown
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
PlotSolution2DOnEachSubDomain
(Problem, Mesh, Solution, VariableId, ParametersId)¶ Plots the solution’s variableId on the full computational domain in 2D, with a subdomain-dependent colorscale.
- Parameters
Problem (Problem) – the considered problem
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
VariableId (integer) – the index of the desired variable to be plot
:param : the index of the desired variable to be plot :type : integer :param ParametersId: the string forming the “ProblemName_ParameterName”, mapping to the right solution export folder :type ParametersId: string
- Returns
The 2D plot of all the given solution set on the considered domain, exported in the problem-dependent solution export folder.
- Return type
None
Note
The figure is only exported, not shown
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
Animate3DLevelSet
(TestName, Resolution)¶ Animates the level set for each, on the full domain.
- Parameters
LightExport (integer) – integer telling if the results have been exported with a light (1, without mesh) or full export (0)
TestName (string) – the string forming the “ProblemName_ParameterName”, mapping to the right solution export folder
Resolution (integer) – resolution of the considered mesh
- Returns
The 3D animation is exported an html format
- Return type
None
Note
The figure is only exported, not shown
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
Animate2DLevelSet
(TestName, Resolution)¶ Animates all the levels sets on the domain accross the time, on their respective positive parts.
- Parameters
LightExport (integer) – integer telling if the results have been exported with a light (1, without mesh) or full export (0)
TestName (string) – the string forming the “ProblemName_ParameterName”, mapping to the right solution export folder
Resolution (integer) – resolution of the considered mesh
- Returns
Only exports the 2D animation in an html format
- Return type
None
Note
The figure is only exported, not shown
-
3_LESARD.SourceCode.PostProcessing.Plots_Plotly.
Animate3DSolution
(TestName, Resolution)¶ Animates the solution for each variable.
- Parameters
LightExport (integer) – integer telling if the results have been exported with a light (1, without mesh) or full export (0)
TestName (string) – the string forming the “ProblemName_ParameterName”, mapping to the right solution export folder
Resolution (integer) – resolution of the considered mesh
- Returns
Only exports the 3D animation in an html format
- Return type
None
Note
The figure is only exported, not shown
Matplotlib plots¶
The module Plots_Matplotlib
located in the SourceCode/Postprocessing
file proposes visualisation routines for solution of a multi
phase problem which is stored in a Solution structure, using matplotlib.
It contains plotting 2D solutions, plotting 3D solutions, animation and check-up routines.
Note
The module is made to be used on-line, that is either while computing the solution (except videos) or after the solution has been exported
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
ring_coding
(ob)¶ Creates the matplotlib ring codes from a shapely object
- Parameters
ob (shapely object) – the shapely object of interest
- Returns
the matplotlib path-dependent associated code
- Return type
codes (shapely codes)
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
pathify
(polygon)¶ Creates a matplotlib path out of a shapely polygon.
- Parameters
polygon (shapely polygon or multipolygon) – the polygon of interest
- Returns
the path created from the vertices and codes of the given polygon
- Return type
path (matplotlib path)
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
GetMeshgridFom3VectorsMaskX
(Mesh, X, Y, Z)¶ Interpolation routine in order to plot.
- Parameters
Mesh (MeshStructure) – the mesh in use
X (float array like) – the x coordinates of the considered points
Y (float array like) – the y coordinates of the considered points
Z (float array like) – the data’s (scalar) value at the considered points
Returns
xgrid (float 2D numpy array) – x meshgrid of the points where the solution Z has been interpolated
ygrid (float 2D numpy array) – y meshgrid of the points where the solution Z has been interpolated
zgrid (float 2D numpy array) – values of the interpolated Z at the generated grid points
Note
When holes in the domains, the xy values are masked with None in both corresponding meshgrids
The x resolution of the interpolation grid is set to 5*(xmax-xmin)/np.min(Mesh.InnerElementsDiameter), and respectively for the y axis
The interpolation method is set to “linear”, with a fill value of “-1e-15” in order to fit the 0 crossing at a physical boundary in case of interpolating a level set.
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
GetMeshgridFom3VectorsMaskZ
(Mesh, X, Y, Z)¶ Interpolation routine in order to plot.
- Parameters
Mesh (MeshStructure) – the mesh in use
X (float array like) – the x coordinates of the considered points
Y (float array like) – the y coordinates of the considered points
Z (float array like) – the data’s (scalar) value at the considered points
Returns
xgrid (float 2D numpy array) – x meshgrid of the points where the solution Z has been interpolated
ygrid (float 2D numpy array) – y meshgrid of the points where the solution Z has been interpolated
zgrid (float 2D numpy array) – values of the interpolated Z at the generated grid points
Note
When holes in the domains, the z values are masked with None in both corresponding meshgrids
The x resolution of the interpolation grid is set to 5*(xmax-xmin)/np.min(Mesh.InnerElementsDiameter), and respectively for the y axis
The interpolation method is set to “linear”, with a fill value of “-1e-15” in order to fit the 0 crossing at a physical boundary in case of interpolating a level set.
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
plotMultipoly
(Poly, color, ax)¶ Simple routine that plots a polygon being form of several ones in a shapely format
- Parameters
Poly (shapely multipolygon) – the polygon to plot
color (matplotlib compatible color) – the wished color (alpha is set to 0.4)
ax (matplotlib axes instance) – ax attached to the figure the polygon should be plot on
- Returns
fills direclty the figure attached to ax
- Return type
None
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
PlotFlags
(Problem, Mesh, Solution, ParametersId)¶ Debug plotting routine that plots fluid’s flag at each Dof
- Parameters
Problem (Problem) – the considered problem and its properties
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
ParametersId (string) – name of the export folder (TestCase_TestSettings)
- Returns
Only exporting the plot
- Return type
None
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
PlotSubdomains
(Problem, Mesh, Solution, ParametersId)¶ Plots the registered subdomain patches
- Parameters
Problem (Problem) – the considered problem and its properties
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
ParametersId (string) – name of the export folder (TestCase_TestSettings)
- Returns
Only exporting the plot
- Return type
None
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
PlotLSubDomains
(Problem, Mesh, Solution, ParametersId)¶ Plots the zero contour of the level sets and the registered subdomain patches
- Parameters
Problem (Problem) – the considered problem and its properties
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
ParametersId (string) – name of the export folder (TestCase_TestSettings)
- Returns
only exporting the plot
- Return type
None
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
PlotLSValuesTri
(Problem, Mesh, Solution, ParametersId)¶ Plots the zero contour of the level sets and the registered subdomain patches, given a triangulation.
- Parameters
Problem (Problem) – the considered problem and its properties
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
ParametersId (string) – name of the export folder (TestCase_TestSettings)
- Returns
only exporting the plot
- Return type
None
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
PlotLSValuesOnWholeDomainTri
(Problem, Mesh, Solution, ParametersId)¶ Plots the fluid selectors of the subdomain, given a triangulation
- Parameters
Problem (Problem) – the considered problem and its properties
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
ParametersId (string) – name of the export folder (TestCase_TestSettings)
- Returns
only exporting the plot
- Return type
None
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
PlotVariableOnWholeDomainTri2D
(Problem, Mesh, Solution, VariableId, ParametersId)¶ Plot one variable independently of the subdomain, given a triangulation
- Parameters
Problem (Problem) – the considered problem and its properties
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
VariableId (integer) – the index of the desired variable to be plot
ParametersId (string) – name of the export folder (TestCase_TestSettings)
- Returns
only exporting the plot
- Return type
None
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
PlotVariableOnEachSubDomainTri2D
(Problem, Mesh, Solution, VariableId, ParametersId)¶ Plot one variable with a color scale depending of the subdomain, given a triangulation
- Parameters
Problem (Problem) – the considered problem and its properties
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
VariableId (integer) – the index of the desired variable to be plot
ParametersId (string) – name of the export folder (TestCase_TestSettings)
- Returns
only exporting the plot
- Return type
None
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
PlotVariableOnWholeDomainTri
(Problem, Mesh, Solution, VariableId, ParametersId)¶ Plot one variable independently of the subdomain, given a triangulation
- Parameters
Problem (Problem) – the considered problem and its properties
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
VariableId (integer) – the index of the desired variable to be plot
ParametersId (string) – name of the export folder (TestCase_TestSettings)
- Returns
only exporting the plot
- Return type
None
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
PlotVariableOneEachSubDomainTri
(Problem, Mesh, Solution, VariableId, ParametersId)¶ Plot one variable with a color scale depending of the subdomain
- Parameters
Problem (Problem) – the considered problem and its properties
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
VariableId (integer) – the index of the desired variable to be plot
ParametersId (string) – name of the export folder (TestCase_TestSettings)
- Returns
only exporting the plot
- Return type
None
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
PlotPrimaryVariableOnWholeDomainTri
(Problem, Mesh, Solution, Field, ParametersId)¶ Plot one variable independently of the subdomain, given a triangulation
- Parameters
Problem (Problem) – the considered problem and its properties
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
Field (integer) – the index of the primary variable to plot the solution for
ParametersId (string) – name of the export folder (TestCase_TestSettings)
- Returns
only exporting the plot
- Return type
None
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
PlotPrimaryVariableOneEachSubDomainTri
(Problem, Mesh, Solution, Field, ParametersId)¶ Plot one variable with a color scale depending of the subdomain
- Parameters
Problem (Problem) – the considered problem and its properties
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
Field (integer) – the index of the primary variable one wants the plot for
ParametersId (string) – name of the export folder (TestCase_TestSettings)
- Returns
only exporting the plot
- Return type
None
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
PlotVariableOnWholeDomain2D
(Problem, Mesh, Solution, VariableId, ParametersId)¶ Plot one variable on the whole domain
- Parameters
Problem (Problem) – the considered problem and its properties
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
VariableId (integer) – the index of the desired variable to be plot
ParametersId (string) – name of the export folder (TestCase_TestSettings)
- Returns
only exporting the plot
- Return type
None
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
PlotVariableOnEachSubDomain2D
(Problem, Mesh, Solution, VariableId, ParametersId)¶ Plot one variable with a color scale depending of the subdomain
- Parameters
Problem (Problem) – the considered problem and its properties
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
VariableId (integer) – the index of the desired variable to be plot
ParametersId (string) – name of the export folder (TestCase_TestSettings)
- Returns
only exporting the plot
- Return type
None
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
PlotVariableOnWholeDomain
(Problem, Mesh, Solution, VariableId, ParametersId)¶ Plot one variable on the whole subdomain
- Parameters
Problem (Problem) – the considered problem and its properties
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
VariableId (integer) – the index of the desired variable to be plot
ParametersId (string) – name of the export folder (TestCase_TestSettings)
- Returns
only exporting the plot
- Return type
None
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
PlotVariableOneEachSubDomain
(Problem, Mesh, Solution, VariableId, ParametersId)¶ Plot one variable with a color scale depending of the subdomain
- Parameters
Problem (Problem) – the considered problem and its properties
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
VariableId (integer) – the index of the desired variable to be plot
ParametersId (string) – name of the export folder (TestCase_TestSettings)
- Returns
only exporting the plot
- Return type
None
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
PlotPrimaryVariableOnWholeDomain
(Problem, Mesh, Solution, Field, ParametersId)¶ Plot one variable on the whole subdomain
- Parameters
Problem (Problem) – the considered problem and its properties
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
Field (integer) – the index of the primary variable to plot
ParametersId (string) – name of the export folder (TestCase_TestSettings)
- Returns
only exporting the plot
- Return type
None
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
PlotPrimaryVariableOneEachSubDomain
(Problem, Mesh, Solution, Field, ParametersId)¶ Plot one variable with a color scale depending of the subdomain
- Parameters
Problem (Problem) – the considered problem and its properties
Mesh (MeshStructure) – the considered mesh
Solution (Solution) – the solution of the considered problem
Field (integer) – the index of the primary variable to plot
ParametersId (string) – name of the export folder (TestCase_TestSettings)
- Returns
only exporting the plot
- Return type
None
-
3_LESARD.SourceCode.PostProcessing.Plots_Matplotlib.
PlotNormalDualInfo
(Mesh, idx)¶ Plots the normals and dual information of an element (normals, dual normals, barycentric point) for the considered element.
- Parameters
Mesh (MeshStructure) – the considered mesh
- Returns
Runtime-plotted plot
- Return type
None
Exports¶
The module Exports
located in the SourceCode/Postprocessing
furnishes the tools to export and load a solution and problem
that is stored in the solution and problem structures format. It contains binary exports/loads and text format export/loads, text files export compatible with the plt format
Note
The binary exports use pickles, use it by knowing it and aknowledging the risks
-
3_LESARD.SourceCode.PostProcessing.Exports.
ExportSolution
(LightExport, TestCase, Mesh, ProblemData, Problem, Solution)¶ Export the solution in a binary pickle format, paying attention if the user wants to export the mesh inside the binary file or not.
- Parameters
LightExport (integer) – integer stating is the export should be light (1) or full (0)
TestCase (string) – name of the folder in which the solutions are stored
Mesh (MeshStructure instance) – mesh on which the solution has been computed
ProblemData (Parameters structure instance) – user defined parameters defining the problem that has been solved
Problem (Problem structure instance) – the problem that has been solved or processed
Solution (Solution structure instance) – the actual solution to the problem
Note
This routine loads a binary file that has been generated by pickles. To work, the used structures should already be known by the programm by the loading time.
The time encoding format in the outfile is 8.6f, therefore any finer time export will overwrite the just exported results
-
3_LESARD.SourceCode.PostProcessing.Exports.
LoadSolution
(LightExport, TestCase, Resolution, t, ReturnMesh=0)¶ Load the file that has been exported in binary pickle format, , paying attention if the user wants to export the mesh inside the binary file or not.
- Parameters
LightExport (integer) – integer stating is the export has been be light (1) or full (0)
TestCase (string) – name of the folder in which the solutions are stored
Resolution (integer) – resolution of the associated mesh
t (float) – time for which to load the solution
ReturnMesh (integer) – (optional, default 0) in case of a light export, give the possibility to load the mesh along with the solution (1) or not (0).
- Returns
mesh on which the solution has been computed ProblemData (Parameters structure instance): user defined parameters defining the problem that has been solved Problem (Problem structure instance): the problem that has been solved or processed Solution (Solution structure instance): the actual solution to the problem
- Return type
Mesh (MeshStructure instance)
-
3_LESARD.SourceCode.PostProcessing.Exports.
CleanExportEnvironment
(TestCase, Resolution)¶ Clean the export environment: removes all the files contained in the designated export folder.
- Parameters
TestCase (string) – name of the folder in which the solutions are stored
Resolution (integer) – resolution of the associated mesh
- Returns
Files permanently removed from the designated folder
- Return type
None
-
3_LESARD.SourceCode.PostProcessing.Exports.
ExportSettings
(TestCase, SolverSpecs, Resolution)¶ Copy the settings file on which the test has be run in the solution folder
- Parameters
TestCase (string) – name of the folder in which the solutions are stored
SovlerSpecs (string) – the name of the setting file in use
Resolution (integer) – resolution of the associated mesh
- Returns
None
-
3_LESARD.SourceCode.PostProcessing.Exports.
ExportUsedMesh
(TestCase, Mesh)¶ Export the mesh on which the test has be run in the solution folder
- Parameters
TestCase (string) – name of the folder in which the solutions are stored
Mesh (MeshStructure) – the name of the setting file in use
- Returns
None
-
3_LESARD.SourceCode.PostProcessing.Exports.
LoadSolutionPlainMesh
(TestCase, Resolution, t, ReturnMesh=1)¶ Load the file that has been exported in binary pickle format
- Parameters
TestCase (string) – name of the folder in which the solutions are stored
Resolution (integer) – resolution of the associated mesh
t (float) – time for which to load the solution
ReturnMesh (integer) – selects if the mesh has to be collected (1) or not (0)
- Returns
mesh on which the solution has been computed ProblemData (Parameters structure instance): user defined parameters defining the problem that has been solved Problem (Problem structure instance): the problem that has been solved or processed Solution (Solution structure instance): the actual solution to the problem
- Return type
Mesh (MeshStructure instance)
-
3_LESARD.SourceCode.PostProcessing.Exports.
ExportSolutionPlainMesh
(TestCase, Mesh, ProblemData, Problem, Solution)¶ Export the solution in a binary pickle format
- Parameters
TestCase (string) – name of the folder in which the solutions are stored
Mesh (MeshStructure instance) – mesh on which the solution has been computed
ProblemData (Parameters structure instance) – user defined parameters defining the problem that has been solved
Problem (Problem structure instance) – the problem that has been solved or processed
Solution (Solution structure instance) – the actual solution to the problem
Note
This routine loads a binary file that has been generated by pickles. To work, the used structures should already be known by the programm by the loading time.
The time encoding format in the outfile is 8.6f, therefore any finer time export will overwrite the just exported results
-
3_LESARD.SourceCode.PostProcessing.Exports.
LoadSolutionMeshFree
(TestCase, Resolution, t, ReturnMesh=0)¶ Load the file that has been exported in binary pickle format without the mesh in the structure
- Parameters
TestCase (string) – name of the folder in which the solutions are stored
Resolution (integer) – resolution of the associated mesh
t (float) – time for which to load the solution
ReturnMesh (integer) – selects if the mesh has to be collected (1) or not (0)
- Returns
mesh on which the solution has been computed ProblemData (Parameters structure instance): user defined parameters defining the problem that has been solved Problem (Problem structure instance): the problem that has been solved or processed Solution (Solution structure instance): the actual solution to the problem
- Return type
Mesh (MeshStructure instance)
-
3_LESARD.SourceCode.PostProcessing.Exports.
ExportSolutionMeshFree
(TestCase, Mesh, ProblemData, Problem, Solution)¶ Export the solution in a binary pickle format without the mesh in the structure
- Parameters
TestCase (string) – name of the folder in which the solutions are stored
Mesh (MeshStructure instance) – mesh on which the solution has been computed
ProblemData (Parameters structure instance) – user defined parameters defining the problem that has been solved
Problem (Problem structure instance) – the problem that has been solved or processed
Solution (Solution structure instance) – the actual solution to the problem
Note
This routine loads a binary file that has been generated by pickles. To work, the used structures should already be known by the programm by the loading time.
The time encoding format in the outfile is 8.6f, therefore any finer time export will overwrite the just exported results
-
3_LESARD.SourceCode.PostProcessing.Exports.
ExportSolutionVTK
(TestCase, Mesh, ProblemData, Problem, Solution)¶ Export the solution in VTK format through the meshio interface.
- Args:
TestCase (string): name of the folder in which the solutions are stored Mesh (MeshStructure instance): mesh on which the solution has been computed ProblemData (Parameters structure instance): user defined parameters defining the problem that has been solved Problem (Problem structure instance): the problem that has been solved or processed Solution (Solution structure instance): the actual solution to the problem
Note
This routine is available only for triangulations