proteus.mprans.TADR module
An optimized Advection-Diffusion-Reaction transport module
- proteus.mprans.TADR.DIAGNOSTICS = {'boundary_flux': 'the exterior-boundary solute-flux split, once per step (LevelModel._logBoundarySoluteFlux)', 'dmp': 'the low- and high-order maxima of every residual call, against the discrete maximum principle', 'fct': 'sum(u^2) before and after the FCT step: does the limiter sharpen or diffuse', 'rowsum': "with 'dmp': the largest row sum of the transport operator, at the boundary and in the interior"}[source]
the run-time diagnostics a TADR model can log, each off by default since it costs MPI reductions every step or call.
- Type:
Coefficients(diagnostics=…)
- class proteus.mprans.TADR.ShockCapturing(coefficients, nd, shockCapturingFactor=0.25, lag=True, nStepsToDelay=None)[source]
Bases:
ShockCapturing_base
- class proteus.mprans.TADR.NumericalFlux(vt, getPointwiseBoundaryConditions, getAdvectiveFluxBoundaryConditions, getDiffusiveFluxBoundaryConditions)[source]
- class proteus.mprans.TADR.RKEV(transport, timeOrder=1, runCFL=0.1, integrateInterpolationPoints=False)[source]
Bases:
SSPWrapper for SSPRK time integration using EV
… more to come …
Set flags that indicate that all terms are implicit.
- initializeTimeHistory(resetFromDOF=True)[source]
Push necessary information into time history arrays
- class proteus.mprans.TADR.CompatibleBackwardEuler(transport, integrateInterpolationPoints=False)[source]
Bases:
BackwardEulerBackward Euler for STABILIZATION_TYPE=’Compatible’. The transport takes one step per flow step, so it proposes no step of its own: the split-operator controller’s minimum is the flow’s.
Set flags that indicate that all terms are implicit.
- proteus.mprans.TADR.checkCoupledQuadrature(modelA, nameA, modelB, nameB)[source]
Verify two coupled models share a mesh and one quadrature rule.
Coupled fields (velocity, water content, density) are passed between models as bare quadrature arrays indexed by eN*nQuadraturePoints_element+k, so both sides must agree on the quadrature or the receiving kernel reads the wrong entries – or past the end of the array.
nQuadraturePoints_element is NOT a shared setting: OneLevelTransport builds it per model in Quadrature.buildUnion over that model’s own integral keys, plus any (‘stab’,..)/(‘numDiff’,..) rules and the Lobatto points that massLumping/reactionLumping inject. Two models handed the identical elementQuadrature object can therefore still end up with different point counts, and unions of equal size can order their points differently, which scrambles the coupled fields within each element without changing a shape. So compare the reference points themselves, not just their count.
Called from attachModels on both sides of the Richards <-> TADR coupling, where the aliases are formed and before any kernel indexes them.
- class proteus.mprans.TADR.Coefficients(aOfX=None, LS_model=None, nd=2, V_model=0, RD_model=None, ME_model=1, VOS_model=None, checkMass=True, epsFact=0.0, useMetrics=0.0, sc_uref=1.0, sc_beta=1.0, movingDomain=False, forceStrongConditions=False, STABILIZATION_TYPE='VMS', ENTROPY_TYPE='POWER', diagonal_conductivity=True, cE=1.0, cMax=1.0, uL=0.0, uR=1.0, cK=0.0, LUMPED_MASS_MATRIX=False, FCT=True, outputQuantDOFs=False, nullSpace='NoNullSpace', initialize=True, physicalDiffusion=0.0, alpha_L=0.0, alpha_T=0.0, Dm=None, porosity=1.0, dispersion_type=0, theta_s=1.0, theta_r=0.0, power_law_exponent=0.0, velocity_exponent=1.0, rho_f=1.0, rho_s=1.0, viscosity_omega_max=0.0, specified_velocity=True, k_d=0.0, c_sat=1.0, mms_source=None, EDGE_VELOCITY=False, VELOCITY_COUPLING=None, CONSERVATIVE_FORM=False, diagnostics=())[source]
Bases:
TC_baseSet the number of components (equations) of the PDE and initialize the dicitionaries describing the form of the coefficients. Strings naming each component (used for viewing and archiving) and a structure defining the sparsity pattern of diffusion tensors may also be provided.
- static copyExteriorElementBoundaryValuesFromElementBoundaryValues(exteriorElementBoundaries, elementBoundaryElements, elementBoundaryLocalElementBoundaries, ebq_val, ebqe_val)[source]
- initializeMesh(mesh)[source]
Give the TC object access to the mesh for any mesh-dependent information.
- attachModels(modelList)[source]
Give the TC object access to other models in a loosely coupled split operator formulation (e.g. a transport equation for concentration might get velocity from a flow equation)
- syncCompatibleDensity()[source]
rho_T(c) = rho_f (1 + eps c) from the current DOFs: at the nodes (nodal_rho, the flow’s rho_T,i) and at the element and boundary quadrature points (q_rho, ebqe_rho).
- preStep(t, firstStep=False)[source]
Give the TC object an opportunity to modify itself before the time step.
- class proteus.mprans.TADR.LevelModel(uDict, phiDict, testSpaceDict, matType, dofBoundaryConditionsDict, dofBoundaryConditionsSetterDict, coefficients, elementQuadrature, elementBoundaryQuadrature, fluxBoundaryConditionsDict=None, advectiveFluxBoundaryConditionsSetterDict=None, diffusiveFluxBoundaryConditionsSetterDictDict=None, stressTraceBoundaryConditionsSetterDict=None, stabilization=None, shockCapturing=None, conservativeFluxDict=None, numericalFluxType=None, TimeIntegrationClass=None, massLumping=False, reactionLumping=False, options=None, name='defaultName', reuse_trial_and_test_quadrature=True, sd=True, movingDomain=False, bdyNullSpace=False)[source]
Bases:
OneLevelTransportAllocate storage and initialize some variables.
- Parameters:
uDict (dict) – Dictionary of
proteus.FemTools.FiniteElementFunctionobjects.phiDict (dict) – Dictionary of
proteus.FemTools.FiniteElementFunctionobjects.testSpaceDict (dict) – Dictionary of FiniteElementSpace objects
dofBoundaryConditionsDict (dict) – Dictionary of DOFBoundaryConditions objects for the Dirichlet conditions.
coefficients (
proteus.TransportCoefficients.TC_base) – Problem’s Transport Coefficients class.elementQuadratureDict (dict) – Dictionary of dictionaries of quadrature rules for each element integral in each component equation.
elementBoundaryQuadratureDict (dict) – Dictionary of dictionaries of quadrature rules for each element boundary integral in each component equation
stabilization (bool)
shockCapturing (bool)
numericalFlux (bool)
bdyNullSpace (bool) – Indicates whether the boundary conditions create a global null space.
Notes
The constructor sets the input arguments, calculates dimensions, and allocates storage. The meanings of variable suffixes are
global – per physical domain
element – per element
elementBoundary – per element boundary
The prefix n means ‘number of’.
Storage is divided into quantities required at different sets of points or geometric entities. Each type of storage has a dictionary for all the quantities of that type. The names and dimensions of the storage dictionaries are
e – at element
q – at element quadrature, unique to elements
ebq – at element boundary quadrature, unique to elements
ebq_global – at element boundary quadrature, unique to element boundary
ebqe – at element boundary quadrature, unique to global, exterior element boundary
phi_ip – at the generalized interpolation points required to build a nonlinear phi
- ghostScatter(*arrays)[source]
Forward-insert (owner -> ghost copy) each DOF array. No-op in serial.
With one layer of overlap only the OWNED DOFs have their full element star on this rank, so anything built by a loop over elements or rows – uLow on the explicit paths, the Zalesak ratios – is incomplete at a ghost DOF, and FCTStep reads those arrays at the column j of an owned row i. The owner always holds the complete value, so an insert scatter repairs every ghost. Shuttled through u[0].dof, the one ghosted vector this model owns (as in Richards.ghostScatter).
- calculateElementQuadrature()[source]
Calculate the physical location and weights of the quadrature rules and the shape information at the quadrature points.
This function should be called only when the mesh changes.
- calculateElementBoundaryQuadrature()[source]
Calculate the physical location and weights of the quadrature rules and the shape information at the quadrature points on element boundaries.
This function should be called only when the mesh changes.
- calculateExteriorElementBoundaryQuadrature()[source]
Calculate the physical location and weights of the quadrature rules and the shape information at the quadrature points on global element boundaries.
This function should be called only when the mesh changes.
- prepareCompatibleStep()[source]
Per-step data of STABILIZATION_TYPE=’Compatible’ from the flow model’s export.
Fhat_ij = E_ij, the carried storage M^n -> M^{n+1} = M^n + (m^{n+1} - m^n) (M^0 = m^0), B_i = M_L,i (M^{n+1}_i - M^n_i)/dt - sum_j Fhat_ij, and the dispersion velocity v_h = q_h / rho^F with q_h reconstructed from the spatial exchanges only.
- FCTStep_compatible()[source]
Zalesak limiting of S = M c toward the high-order target (Algorithm 3); called by Newton after the low-order solve has converged, with c^L in u[0].dof.
- compatibleStepBudget()[source]
Fluid and solute budgets of the step just taken (STABILIZATION_TYPE=’Compatible’).
- fluid: sum_i M_L,i (m^{n+1}_i - m^n_i) - dt sum_i (sum_j E~_ij + b_i) = dt sum_i r_i, the
flow solver residual (free rows), from the flow model’s export.
- solute: sum_free M_L,i (S^{n+1}_i - S^n_i) minus dt sum_free B^c_i, minus the exchange
with Dirichlet nodes, dt sum F^L_ij(c^L) + alpha_ij f_ij (i free, j Dirichlet); dt times the sum of the transport residual at c^L, up to round-off.