proteus.PostProcessingTools module

Collect classes and routines for postprocessing solution to get
quantities like conservative velocities, higher accuracy, etc

Inheritance diagram of proteus.PostProcessingTools

proteus.PostProcessingTools.VelocityPostProcessingChooser(transport)[source]

pick acceptable velocity postprocessing based on input

class proteus.PostProcessingTools.VelocityPostProcessingAlgorithmBase(postProcessingType=None, vectorTransport=None, vtComponents=[0])[source]

Base class for velocity post processing algorithms

Applies same algorithm to all components in vtComponents

computeGeometricInfo()[source]
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

removeBoundaryFluxesFromResidual(ci, flag_elementBoundaries=None)[source]
addBoundaryFluxesBackToResidual(ci, flag_elementBoundaries=None)[source]
archiveVelocityValues(archive, t, tCount, initialPhase=False, meshChanged=False)[source]

write out post processed velocity values as a finite element space

class proteus.PostProcessingTools.VPP_P1nc_RT0(vectorTransport=None, vtComponents=[0])[source]

Bases: proteus.PostProcessingTools.VelocityPostProcessingAlgorithmBase

P1-nonconforming velocity postprocessing

postprocess_component(ci, verbose=0)[source]

compute velocity field in RT_0 assuming a potential field in \(P^1_{nc}\) has already been solved for

Uses Chou and Tang approach for now, so averaged pressure is not correct

evaluateElementVelocityField(x, ci)[source]

evaluate velocity field assuming velocity_dofs already calculated for now assumes x shaped like nE x nq x 3

getElementBoundaryRT0velocityValues()[source]

calculate P1nc flux values at points defined on element boundaries

getElementRT0velocityValues()[source]

calculate P1nc flux values at points defined on elements

getGlobalElementBoundaryRT0velocityValues()[source]

calculate P1nc flux values at points defined uniquely on global exterior elementBoundaries

postProcessRT0potentialFromP1nc()[source]

convert P1nc potential to RT0 potential locally

postProcessRT0potentialFromP1nc_sd()[source]

convert P1nc potential to RT0 potential locally

postProcessRT0velocityFromP1nc()[source]

convert P1nc flux to RT0 flux locally allow for full mass matrix, etc

postProcessRT0velocityFromP1nc_sd()[source]

convert P1nc flux to RT0 flux locally allow for full mass matrix, etc

updateRT0velocityWithAveragedPotentialP1nc()[source]

incorporate additional constant flux terms for multiple potentials

updateRT0velocityWithAveragedPotentialP1nc_sd()[source]

incorporate additional constant flux terms for multiple potentials

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`

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

getConservationJacobianPWL(ci)[source]

Build local systems for post-processing solve

evaluateLocalVelocityRepresentation(ci)[source]

project to \(RT_0\) velocity from element boundary fluxes

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_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

computeBDM1projectionMatrices()[source]
computeGeometricInfo()[source]
evaluateLocalVelocityRepresentation(ci)[source]

project to BDM velocity from element boundary fluxes

evaluateElementVelocityField(x, ci)[source]

evaluate velocity field assuming velocity_dofs already calculated for now assumes x shaped like nE x nq x 3 .. todo:: put python loops in c

buildLocalBDM1projectionMatrices()[source]

build local projections to BDM1 assuming standard basis for P^1(E)

factorLocalBDM1projectionMatrices()[source]

compute LU factorization for local BDM projection matrices

getElementBDM1velocityValuesLagrangeRep()[source]

get velocity at quadrature points assuming have local dofs for local P^1(E) and std Lagr. basis

solveLocalBDM1projection()[source]

solve for local [P^1(E)]^d dofs using BDM1 projection assuming system already factored

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

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

getConservationJacobianPWL(ci)[source]

Build local systems for post-processing solve

getConservationResidualPWL(ci, correctFlux=False)[source]

compute conservation resiudal using current guess for element boundary flux

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_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
computeBDM1projectionMatrices()[source]
updateWeights()[source]
computeGeometricInfo()[source]
evaluateLocalVelocityRepresentation(ci)[source]

project to BDM velocity from element boundary fluxes

evaluateElementVelocityField(x, ci)[source]

evaluate velocity field assuming velocity_dofs already calculated for now assumes x shaped like nE x nq x 3

buildLocalBDM1projectionMatrices()[source]

build local projections to BDM1 assuming standard basis for P^1(E)

factorLocalBDM1projectionMatrices()[source]

compute LU factorization for local BDM projection matrices

getElementBDM1velocityValuesLagrangeRep()[source]

get velocity at quadrature points assuming have local dofs for local P^1(E) and std Lagr. basis

solveLocalBDM1projection()[source]

solve for local [P^1(E)]^d dofs using BDM1 projection assuming system already factored

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`

postprocess_component(ci, verbose=0)[source]

compute mass conservative velocity field following Larson and Niklasson Global piecewise constant correcction

evaluateLocalVelocityRepresentation(ci)[source]

project to \(RT_0\) velocity from element boundary fluxes

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_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`

postprocess_component(ci, verbose=0)[source]

compute mass conservative velocity field following Sun and Wheeler Global piecewise constant correcction

evaluateLocalVelocityRepresentation(ci)[source]

project to \(RT_0\) velocity from element boundary fluxes

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_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`

postprocess_component(ci, verbose=0)[source]

compute mass conservative velocity field following Sun and Wheeler local Gauss-Seidel

evaluateLocalVelocityRepresentation(ci)[source]

project to \(RT_0\) velocity from element boundary fluxes

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_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

postprocess_component(ci, verbose=0)[source]
evaluateLocalVelocityRepresentation(ci)[source]

project to \(RT_0\) velocity from element boundary fluxes

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_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
computeBDM1projectionMatrices()[source]
computeGeometricInfo()[source]
evaluateLocalVelocityRepresentation(ci)[source]

project to BDM velocity from element boundary fluxes

evaluateElementVelocityField(x, ci)[source]

evaluate velocity field assuming velocity_dofs already calculated for now assumes x shaped like nE x nq x 3

buildLocalBDM1projectionMatrices()[source]

build local projections to BDM1 assuming standard basis for P^1(E)

factorLocalBDM1projectionMatrices()[source]

compute LU factorization for local BDM projection matrices

getElementBDM1velocityValuesLagrangeRep()[source]

get velocity at quadrature points assuming have local dofs for local P^1(E) and std Lagr. basis

solveLocalBDM1projectionFromFlux()[source]

solve for local [P^1(E)]^d dofs using BDM1 projection assuming system already factored

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

postprocess_component(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

evaluateElementVelocityField(x, ci)[source]

evaluate velocity field assuming velocity_dofs already calculated for now assumes x shaped like nE x nq x 3

TODO
Decide if should fail or throw exception here
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

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

evaluateElementVelocityField(x, ci)[source]

evaluate velocity field assuming velocity_dofs already calculated for now assumes x shaped like nE x nq x 3 .. todo:: put python loops in c

archiveVelocityValues(archive, t, tCount, initialPhase=False, meshChanged=False)[source]
getElementLDGvelocityValuesLagrangeRep()[source]

get velocity at quadrature points assuming have local dofs for local P^k(E) where k=1,2 and std Lagr. basis

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

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

getConservationJacobianPWL(ci)[source]

Build local systems for post-processing solve

evaluateLocalVelocityRepresentation(ci)[source]

project to RT_0 velocity from element boundary fluxes

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.AggregateVelocityPostProcessor(postProcessingTypes=None, transport=None)[source]

collect different velocity postprocessing algorithms for a (possibly) multicomponent system

vpp_types = {'pwl-ib-fix-0': <class proteus.PostProcessingTools.VPP_LOW_K_IB_PWL_RT0>, 'sun-gs-rt0': <class proteus.PostProcessingTools.VPP_SUN_GS_RT0>, 'pwl-opt': <class proteus.PostProcessingTools.VPP_PWL_RT0_OPT>, 'sun-rt0': <class proteus.PostProcessingTools.VPP_SUN_RT0>, 'dg': <class proteus.PostProcessingTools.VPP_DG_RT0>, 'pwc': <class proteus.PostProcessingTools.VPP_PWC_RT0>, 'pwl-bdm': <class proteus.PostProcessingTools.VPP_PWL_BDM>, 'pwl': <class proteus.PostProcessingTools.VPP_PWL_RT0>, 'p1-nc': <class proteus.PostProcessingTools.VPP_P1nc_RT0>, 'point-eval': <class proteus.PostProcessingTools.VPP_POINT_EVAL>, 'pwl-bdm-opt': <class proteus.PostProcessingTools.VPP_PWL_BDM_OPT>, 'dg-bdm': <class proteus.PostProcessingTools.VPP_DG_BDM>, 'dg-point-eval': <class proteus.PostProcessingTools.VPP_POINT_EVAL>, 'point-eval-gwvd': <class proteus.PostProcessingTools.VPP_POINT_EVAL_GWVD>}[source]
postprocess(verbose=0)[source]

main functionality generate post-processed velocity field for attached VectorTransport object and store them in local dictionaries

evaluateElementVelocityField(x, ci)[source]

evaluate velocity field assuming velocity_dofs already calculated for now assumes x shaped like nE x nq x 3

archiveVelocityValues(archive, t, tCount, initialPhase=False, meshChanged=False)[source]

write out post processed velocity values as a finite element space

class proteus.PostProcessingTools.VelocityPostProcessor_Original(postProcessingTypes=None, vectorTransport=None, vtComponents=[0], mlMesh=None, thisLevel=None)[source]

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

buildLocalBDM1projectionMatrices()[source]

build local projections to BDM1 assuming standard basis for P^1(E)

calculateConservationResidual()[source]

calculate discrete mass balance error for a given velocity

factorLocalBDM1projectionMatrices()[source]

compute LU factorization for local BDM projection matrices

getElementBDM1velocityValuesLagrangeRep()[source]

get velocity at quadrature points assuming have local dofs for local P^1(E) and std Lagr. basis

getElementBoundaryRT0velocityValues()[source]

calculate P1nc flux values at points defined on element boundaries

getElementRT0velocityValues()[source]

calculate P1nc flux values at points defined on elements

getGlobalElementBoundaryRT0velocityValues()[source]

calculate P1nc flux values at points defined uniquely on global exterior elementBoundaries

postProcessRT0potentialFromP1nc()[source]

convert P1nc potential to RT0 potential locally

postProcessRT0potentialFromP1nc_sd()[source]

convert P1nc potential to RT0 potential locally

postProcessRT0velocityFromP1nc()[source]

convert P1nc flux to RT0 flux locally allow for full mass matrix, etc

postProcessRT0velocityFromP1nc_sd()[source]

convert P1nc flux to RT0 flux locally allow for full mass matrix, etc

solveLocalBDM1projection()[source]

solve for local [P^1(E)]^d dofs using BDM1 projection assuming system already factored

updateRT0velocityWithAveragedPotentialP1nc()[source]

incorporate additional constant flux terms for multiple potentials

updateRT0velocityWithAveragedPotentialP1nc_sd()[source]

incorporate additional constant flux terms for multiple potentials

computeBDM1projectionMatrices()[source]
computeGeometricInfo()[source]
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)

postprocessPWL_opt(ci, verbose=0)[source]
postprocessDG(ci, verbose=0)[source]
getConservationResidualPWL(ci, correctFlux=False)[source]
getConservationJacobianPWL(ci)[source]
getConservationResidualPWL_opt(ci, correctFlux=False)[source]
getConservationJacobianPWL_opt(ci)[source]
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

removeBoundaryFluxesFromResidual(ci, flag_elementBoundaries=None)[source]

remove boundary fluxes from element residuals

addBoundaryFluxesBackToResidual(ci, flag_elementBoundaries=None)[source]

remove boundary fluxes from element residuals