proteus.PostProcessingTools module
- Collect classes and routines for postprocessing solution to get
quantities like conservative velocities, higher accuracy, etc
- proteus.PostProcessingTools.VelocityPostProcessingChooser(transport)[source]
pick acceptable velocity postprocessing based on input
- class proteus.PostProcessingTools.VelocityPostProcessingAlgorithmBase(postProcessingType=None, vectorTransport=None, vtComponents=[0])[source]
Bases:
object
Base class for velocity post processing algorithms
Applies same algorithm to all components in vtComponents
TODO make velocity representation type an enum
- Variables
q[('velocity',ci)] (array type) – Stores the velocity values on element quadrature points.
ebq[('velocity',ci)] (array type) – Stores the velocity values on element boundary quadrature points. Designed to reference the element number first.
ebq_global[('velocity',ci)] (array) – Stores the velocity values on the boundary. Designed to reference the global edge number first.
VelocityPostProcessingAlgorithmBase Base Class Constructor
- Parameters
postProcessingType (str) – String value of the post-processing type to be applied
vectorTransport (
proteus.Transport.OneLevelTransport
) – Vector Transport class object describing the problem.vtComponents (list) – List of indices for different vector transport components.
- postprocess(verbose=0)[source]
generate post-processed velocity field for attached VectorTransport object and store them in local dictionaries
- postprocess_component(ci, verbose=0)[source]
main functionality generate post-processed velocity field component ci
- evaluateElementVelocityField(x, ci)[source]
evaluate velocity field assuming velocity_dofs already calculated for now assumes x shaped like nE x nq x 3
- class proteus.PostProcessingTools.VPP_P1nc_RT0(vectorTransport=None, vtComponents=[0])[source]
Bases:
proteus.PostProcessingTools.VelocityPostProcessingAlgorithmBase
P1-nonconforming velocity postprocessing
VelocityPostProcessingAlgorithmBase Base Class Constructor
- Parameters
postProcessingType (str) – String value of the post-processing type to be applied
vectorTransport (
proteus.Transport.OneLevelTransport
) – Vector Transport class object describing the problem.vtComponents (list) – List of indices for different vector transport components.
- class proteus.PostProcessingTools.VPP_PWL_RT0(vectorTransport=None, vtComponents=[0], omitFluxBoundaryNodes=True)[source]
Bases:
proteus.PostProcessingTools.VelocityPostProcessingAlgorithmBase
- Local Larson-Niklasson method with RT_0 representation for element
velocities This is not the correct postprocessing for optimized NS codes
uses RT_0 representation in terms of local basis
ec N_i = rac{1}{d|E|}( ec x - p_i)
where \(p_i\) is the vertex across from face i, \(|E|\) is the volume of the element, and d is the space dimension the degrees of freedom are :math:`V^i = int_{e_i}
ec vdot n_{i}ds`
VelocityPostProcessingAlgorithmBase Base Class Constructor
- Parameters
postProcessingType (str) – String value of the post-processing type to be applied
vectorTransport (
proteus.Transport.OneLevelTransport
) – Vector Transport class object describing the problem.vtComponents (list) – List of indices for different vector transport components.
- postprocess_component(ci, verbose=0)[source]
compute mass conservative velocity field following Larson and Niklasson assuming a \(P^k C_0\) Galerkin solution has already been found
- getConservationResidualPWL(ci, correctFlux=False)[source]
compute conservation resiudal using current guess for element boundary flux
- class proteus.PostProcessingTools.VPP_PWL_RT1(vectorTransport=None, vtComponents=[0], omitFluxBoundaryNodes=True)[source]
Bases:
proteus.PostProcessingTools.VelocityPostProcessingAlgorithmBase
Base class for higher order RT elements.
- Variables
globalDOF2globalElementList (list of lists) – Lists the global element numbers associated with each degree of freedom.
globalDOFGlobalElement2StarElement (list of dicts) – Dictionaries of maps of local element numbers to global element numbers for each degree of freedom.
dofStarElementsArray (list of lists) – For every element DOF, this array lists the element’s local mapping number.
dofStarElementsNeighborsArray (list of lists of lists) – Provides local neighboring elements for each DOF on an element.
VelocityPostProcessingAlgorithmBase Base Class Constructor
- Parameters
postProcessingType (str) – String value of the post-processing type to be applied
vectorTransport (
proteus.Transport.OneLevelTransport
) – Vector Transport class object describing the problem.vtComponents (list) – List of indices for different vector transport components.
- postprocess_component(ci, verbose=0)[source]
compute mass conservative velocity field following Larson and Niklasson assuming a P^k C0 Galerkin solution has already been found
- getConservationResidualPWL(ci, correctFlux=False)[source]
compute conservation resiudal using current guess for element boundary flux
- class proteus.PostProcessingTools.VPP_PWL_BDM(vectorTransport=None, vtComponents=[0])[source]
Bases:
proteus.PostProcessingTools.VPP_PWL_RT0
- Local Larson-Niklasson method with BDM1 representation for element
velocities This is not the correct postprocessing for optimized NS codes
Only difference from VPP_PWL_RT0 should be steps for local velocity representation This one uses BDM_1 space which is \([P^1]^d\) locally with continuous linear fluxes on each face use standard basis
\[\]
ec N_i = lambda_{i/d} ec e_{i%d}
That is the dofs are locally (say in 2d) \([v^x_0,v^y_0,v^x_1,v^y_1,v^x_2,v^y_2]\)
Have to use BDM projection to get degrees of freedom
VelocityPostProcessingAlgorithmBase Base Class Constructor
- Parameters
postProcessingType (str) – String value of the post-processing type to be applied
vectorTransport (
proteus.Transport.OneLevelTransport
) – Vector Transport class object describing the problem.vtComponents (list) – List of indices for different vector transport components.
- class proteus.PostProcessingTools.VPP_PWL_BDM2(vectorTransport=None, vtComponents=[0])[source]
Bases:
proteus.PostProcessingTools.VPP_PWL_RT0
This class is intended to implement BDM2 elements in proteus
VelocityPostProcessingAlgorithmBase Base Class Constructor
- Parameters
postProcessingType (str) – String value of the post-processing type to be applied
vectorTransport (
proteus.Transport.OneLevelTransport
) – Vector Transport class object describing the problem.vtComponents (list) – List of indices for different vector transport components.
- setInteriorVelocityValues(ci)[source]
This function sets the interior velocity values based on the solution to the vt-problem.
- setInteriorTestSpace(degree)[source]
This function sets the interior test space corresponding to the dimension of the BDM space
- getInteriorTestGradients()[source]
Calculate and return the gradient values for polynomials of degree 1
- getInteriorDivFreeElement()[source]
Calculate and return the values of the divergence free interior test function. Note - calculating this integral requires the use of the Piola transformation.
- flagNeumannBoundaryEdges()[source]
This function flags neumann boundaries.
TODO - WIP - part of some experimental functions designed for LN approximations. NOTE - Currently this function is not operational and it returns a dictionary which suggests all edges are Dirichlet.
- conservativeVelocityCalculation()[source]
Serial implimentation of LN algorithm.
TODO - This function is experimental and should be refactor once completed.
- evaluateLocalVelocityRepresentation(ci, velocity_field_set=False)[source]
This function projects the solution of the vt transport problem into the BDM2 space.
- Parameters
ci (int) – The solution component being projected.
velocity_field_set (boolean) – Set to true when the quadrature values for the velocity function are already defined (this is typically used for testing).
- class proteus.PostProcessingTools.VPP_PWL_RT0_OPT(vectorTransport=None, vtComponents=[0])[source]
Bases:
proteus.PostProcessingTools.VPP_PWL_RT0
Version of local Larson-Niklasson scheme to use with optimized codes Assumes that all exterior boundaries are either flux or weak dirichlet boundaries and that exterior velocity has been calculated correctly (i.e., it’s consistent with either flux or weak dirichlet approximation)
Assumes layout the same across components
VelocityPostProcessingAlgorithmBase Base Class Constructor
- Parameters
postProcessingType (str) – String value of the post-processing type to be applied
vectorTransport (
proteus.Transport.OneLevelTransport
) – Vector Transport class object describing the problem.vtComponents (list) – List of indices for different vector transport components.
- postprocess_component(ci, verbose=0)[source]
compute mass conservative velocity field following Larson and Niklasson assuming a P^k C0 Galerkin solution has already been found Setup for optimized parallel codes
- class proteus.PostProcessingTools.VPP_PWL_BDM_OPT(vectorTransport=None, vtComponents=[0])[source]
Bases:
proteus.PostProcessingTools.VPP_PWL_RT0_OPT
- Local Larson-Niklasson method with BDM1 representation for element
velocities for optimized parallel codes
Only difference from VPP_PWL_RT0_OPT should be steps for local velocity representation This one uses BDM_1 space which is \([P^1]^d\) locally with continuous linear fluxes on each face use standard basis
\[\]
ec N_i = lambda_{i%(d+1)} ec e_{i/(d+1)}
Have to use BDM projection to get degrees of freedom
VelocityPostProcessingAlgorithmBase Base Class Constructor
- Parameters
postProcessingType (str) – String value of the post-processing type to be applied
vectorTransport (
proteus.Transport.OneLevelTransport
) – Vector Transport class object describing the problem.vtComponents (list) – List of indices for different vector transport components.
- class proteus.PostProcessingTools.VPP_PWC_RT0(vectorTransport=None, vtComponents=[0])[source]
Bases:
proteus.PostProcessingTools.VelocityPostProcessingAlgorithmBase
- Global piecewise constant Larson-Niklasson method with \(RT_0\)
representation for element velocities
uses RT_0 representation in terms of local basis
\[\]
ec N_i = rac{1}{d|E|}( ec x - p_i)
where \(p_i\) is the vertex across from face \(i\), \(|E|\) is the volume of the element, and \(d\) is the space dimension the degrees of freedom are :math:`V^i = int_{e_i}
ec vdot n_{i}ds`
VelocityPostProcessingAlgorithmBase Base Class Constructor
- Parameters
postProcessingType (str) – String value of the post-processing type to be applied
vectorTransport (
proteus.Transport.OneLevelTransport
) – Vector Transport class object describing the problem.vtComponents (list) – List of indices for different vector transport components.
- postprocess_component(ci, verbose=0)[source]
compute mass conservative velocity field following Larson and Niklasson Global piecewise constant correcction
- class proteus.PostProcessingTools.VPP_SUN_RT0(vectorTransport=None, vtComponents=[0])[source]
Bases:
proteus.PostProcessingTools.VelocityPostProcessingAlgorithmBase
- Global piecewise constant Sun-Wheeler method with \(RT_0\)
representation for element velocities
uses RT_0 representation in terms of local basis
\[\]
ec N_i = rac{1}{d|E|}( ec x - p_i)
where \(p_i\) is the vertex across from face i, \(|E|\) is the volume of the element, and d is the space dimension the degrees of freedom are :math:`V^i = int_{e_i}
ec vdot n_{i}ds`
VelocityPostProcessingAlgorithmBase Base Class Constructor
- Parameters
postProcessingType (str) – String value of the post-processing type to be applied
vectorTransport (
proteus.Transport.OneLevelTransport
) – Vector Transport class object describing the problem.vtComponents (list) – List of indices for different vector transport components.
- postprocess_component(ci, verbose=0)[source]
compute mass conservative velocity field following Sun and Wheeler Global piecewise constant correcction
- class proteus.PostProcessingTools.VPP_SUN_GS_RT0(vectorTransport=None, vtComponents=[0])[source]
Bases:
proteus.PostProcessingTools.VelocityPostProcessingAlgorithmBase
- Local Sun-Wheeler “Gauss-Seidel” method with \(RT_0\) representation
for element velocities
uses \(RT_0\) representation in terms of local basis
\[\]
ec N_i = rac{1}{d|E|}( ec x - p_i)
where p_i is the vertex across from face i, \(|E|\) is the volume of the element, and d is the space dimension the degrees of freedom are :math:`V^i = int_{e_i}
ec vdot n_{i}ds`
VelocityPostProcessingAlgorithmBase Base Class Constructor
- Parameters
postProcessingType (str) – String value of the post-processing type to be applied
vectorTransport (
proteus.Transport.OneLevelTransport
) – Vector Transport class object describing the problem.vtComponents (list) – List of indices for different vector transport components.
- postprocess_component(ci, verbose=0)[source]
compute mass conservative velocity field following Sun and Wheeler local Gauss-Seidel
- class proteus.PostProcessingTools.VPP_DG_RT0(vectorTransport=None, vtComponents=[0])[source]
Bases:
proteus.PostProcessingTools.VelocityPostProcessingAlgorithmBase
Post process DG solution velocity by projecting boundary fluxes onto local \(RT_0\) space
VelocityPostProcessingAlgorithmBase Base Class Constructor
- Parameters
postProcessingType (str) – String value of the post-processing type to be applied
vectorTransport (
proteus.Transport.OneLevelTransport
) – Vector Transport class object describing the problem.vtComponents (list) – List of indices for different vector transport components.
- class proteus.PostProcessingTools.VPP_DG_BDM(vectorTransport=None, vtComponents=[0])[source]
Bases:
proteus.PostProcessingTools.VPP_DG_RT0
- Project DG solution onto BDM1 local representation which is
\([P^1]^d\) locally with continuous linear fluxes on each face
use standard basis
\[\]
ec N_i = lambda_{i%(d+1)} ec e_{i/(d+1)}
Have to use BDM projection to get degrees of freedom
VelocityPostProcessingAlgorithmBase Base Class Constructor
- Parameters
postProcessingType (str) – String value of the post-processing type to be applied
vectorTransport (
proteus.Transport.OneLevelTransport
) – Vector Transport class object describing the problem.vtComponents (list) – List of indices for different vector transport components.
- class proteus.PostProcessingTools.VPP_POINT_EVAL(vectorTransport=None, vtComponents=[0])[source]
Bases:
proteus.PostProcessingTools.VelocityPostProcessingAlgorithmBase
Velocity calculation from just directly evaluating flux formula at intergration points using trial solution
VelocityPostProcessingAlgorithmBase Base Class Constructor
- Parameters
postProcessingType (str) – String value of the post-processing type to be applied
vectorTransport (
proteus.Transport.OneLevelTransport
) – Vector Transport class object describing the problem.vtComponents (list) – List of indices for different vector transport components.
- class proteus.PostProcessingTools.VPP_POINT_EVAL_GWVD(vectorTransport=None, vtComponents=[0])[source]
Bases:
proteus.PostProcessingTools.VelocityPostProcessingAlgorithmBase
Velocity calculation for evaluating coarse grid velocity solution at fine grid quadrature points; assumes that the coarse velocity degrees of freedom from the LDG solution are known
Currently only working for P=1 and P=2
VelocityPostProcessingAlgorithmBase Base Class Constructor
- Parameters
postProcessingType (str) – String value of the post-processing type to be applied
vectorTransport (
proteus.Transport.OneLevelTransport
) – Vector Transport class object describing the problem.vtComponents (list) – List of indices for different vector transport components.
- postprocess_component(ci, verbose=0)[source]
may need to compute velocity field at the desired velocity dofs if this step is not included in the getResidual step of the solution
- class proteus.PostProcessingTools.VPP_LOW_K_IB_PWL_RT0(vectorTransport=None, vtComponents=[0], jump_tol=10000.0, min_tol=1e-05)[source]
Bases:
proteus.PostProcessingTools.VelocityPostProcessingAlgorithmBase
Local Larson-Niklasson method with RT_0 representation for element velocities This version tries to address flux through low permeability interfaces by manually setting boundaries with a ‘large’ jump in permeability and one of these boundaries being ‘small’ to no flux
VelocityPostProcessingAlgorithmBase Base Class Constructor
- Parameters
postProcessingType (str) – String value of the post-processing type to be applied
vectorTransport (
proteus.Transport.OneLevelTransport
) – Vector Transport class object describing the problem.vtComponents (list) – List of indices for different vector transport components.
- setInteriorFluxBoundaries(ci)[source]
Flag interior flux boundaries
this version flags boundaries where \(|max(|a|_L)-max(|a|_R)|_{ebN} > jump_{tol}\) and \(min(max(|a|_L),max(|a|_R)) < min_{tol}\)
- setInteriorFluxBoundaryValues(ci, ebq_global_velocity)[source]
set interior flux boundary values this version sets interior flux boundaries to no flux
- postprocess_component(ci, verbose=0)[source]
compute mass conservative velocity field following Larson and Niklasson assuming a \(P^k C_0\) Galerkin solution has already been found
- getConservationResidualPWL(ci, correctFlux=False)[source]
compute conservation resiudal using current guess for element boundary flux
- class proteus.PostProcessingTools.AggregateVelocityPostProcessor(postProcessingTypes=None, transport=None)[source]
Bases:
object
collect different velocity postprocessing algorithms for a (possibly) multicomponent system
- vpp_types = {'dg': <class 'proteus.PostProcessingTools.VPP_DG_RT0'>, 'dg-bdm': <class 'proteus.PostProcessingTools.VPP_DG_BDM'>, 'dg-point-eval': <class 'proteus.PostProcessingTools.VPP_POINT_EVAL'>, 'p1-nc': <class 'proteus.PostProcessingTools.VPP_P1nc_RT0'>, 'point-eval': <class 'proteus.PostProcessingTools.VPP_POINT_EVAL'>, 'point-eval-gwvd': <class 'proteus.PostProcessingTools.VPP_POINT_EVAL_GWVD'>, 'pwc': <class 'proteus.PostProcessingTools.VPP_PWC_RT0'>, 'pwl': <class 'proteus.PostProcessingTools.VPP_PWL_RT0'>, 'pwl-bdm': <class 'proteus.PostProcessingTools.VPP_PWL_BDM'>, 'pwl-bdm-opt': <class 'proteus.PostProcessingTools.VPP_PWL_BDM_OPT'>, 'pwl-bdm2': <class 'proteus.PostProcessingTools.VPP_PWL_BDM2'>, 'pwl-ib-fix-0': <class 'proteus.PostProcessingTools.VPP_LOW_K_IB_PWL_RT0'>, 'pwl-opt': <class 'proteus.PostProcessingTools.VPP_PWL_RT0_OPT'>, 'sun-gs-rt0': <class 'proteus.PostProcessingTools.VPP_SUN_GS_RT0'>, 'sun-rt0': <class 'proteus.PostProcessingTools.VPP_SUN_RT0'>}[source]
- postprocess(verbose=0)[source]
main functionality generate post-processed velocity field for attached VectorTransport object and store them in local dictionaries
- class proteus.PostProcessingTools.VelocityPostProcessor_Original(postProcessingTypes=None, vectorTransport=None, vtComponents=[0], mlMesh=None, thisLevel=None)[source]
Bases:
object
accumulate basic functionality for post-processing velocity vields from scalar potentials
stores values in quadrature dictonary corresponding to vt.q and vt.ebq_global
Allowed types p1-nc pwl (default is rt0 local representation) pwl-bdm pwc (with rt0) point-eval sun-rt0 sun-gs-rt0
- postprocess(verbose=0)[source]
generate post-processed velocity field for attached VectorTransport object and store them in local dictionaries could split this up into postprocess element and postprocess element boundary
- postprocessP1nc(ci, verbose=0)[source]
compute velocity field in RT_0 assuming a potential field in P^1_{nc} has already been solved for
- postprocessPWL(ci, verbose=0)[source]
compute mass conservative velocity field following swedish way assuming a P^1 C0 Galerkin solution has already been found this is supposed to be the same as getConservationFluxPWL(ci)
- postprocessPointEval(ci, verbose=0)[source]
compute velocity field by just using point evaluation of trial solution and coefficients
\[v = - en{a}_h\grad \phi_h +\]ec f_h
- postprocessPWC(ci, verbose=0)[source]
try to implement Larson and Niklasson piecewise-constant algorithm
TODO:
- postprocessSunWheeler(ci, verbose=0)[source]
try to implement Sun and Wheeler Gauss-Seidel postprocessing algorithm
- evaluateElementVelocityField(x, ci)[source]
evaluate velocity field assuming velocity_dofs already calculated for now assumes x shaped like nE x nq x 3