Internal Functions¶
These are additional functions that do not clearly fit into another category.
-
enum RatelDebugColorType¶
Colors for debug logging.
Values:
-
enumerator RATEL_DEBUG_COLOR_SUCCESS¶
Success color.
-
enumerator RATEL_DEBUG_COLOR_WARNING¶
Warning color.
-
enumerator RATEL_DEBUG_COLOR_ERROR¶
Error color.
-
enumerator RATEL_DEBUG_COLOR_NONE¶
Use native terminal coloring.
-
enumerator RATEL_DEBUG_COLOR_SUCCESS¶
-
typedef PetscErrorCode RatelTSMonitorFunction(TS, PetscInt, PetscReal, Vec, void*)¶
Monitor routine signature.
-
typedef const struct RatelPolygonVertex_private *ConstRatelPolygonVertex¶
-
int enzyme_tape¶
-
int enzyme_const¶
-
int enzyme_dup¶
-
int enzyme_nofree¶
-
int enzyme_allocated¶
-
void *__enzyme_function_like[2] = {(void*)RatelLog1p, (void*)"log1p"}¶
-
PetscClassId RATEL_CLASSID¶
-
PetscLogStage RATEL_Setup¶
-
PetscLogEvent RATEL_DMSetupByOrder¶
-
PetscLogEvent RATEL_DMSetupSolver¶
-
PetscLogEvent RATEL_OutputFields¶
-
PetscLogEvent RATEL_OutputFields_CeedOp¶
-
PetscLogEvent RATEL_Residual¶
-
PetscLogEvent RATEL_Residual_CeedOp¶
-
PetscLogEvent RATEL_Jacobian¶
-
PetscLogEvent RATEL_Jacobian_CeedOp¶
-
PetscLogEvent RATEL_MPM_Migrate¶
-
PetscLogEvent RATEL_MPM_SwarmToMesh¶
-
PetscLogEvent RATEL_MPM_SwarmToMesh_CeedOp¶
-
PetscLogEvent RATEL_RemapMesh¶
-
PetscLogEvent RATEL_Monitor¶
-
PetscLogEvent RATEL_CeedBasisCreate¶
-
PetscLogEvent RATEL_CeedElemRestrictionCreate¶
-
PetscLogEvent RATEL_CeedElemRestrictionCreatePoints¶
-
PetscLogEvent RATEL_SetupResidual¶
-
PetscLogEvent RATEL_SetupJacobian¶
-
static inline CeedMemType MemTypePetscToCeed(PetscMemType mem_type)¶
Translate PetscMemType to CeedMemType.
- Parameters:
mem_type – [in] PetscMemType
- Returns:
Equivalent CeedMemType
-
static inline CeedInt GetCeedQuadratureSize(CeedEvalMode eval_mode, CeedInt dim, CeedInt num_components)¶
Return the quadrature size from the eval mode, dimension, and number of components.
- Parameters:
eval_mode – [in] The basis evaluation mode
dim – [in] The basis dimension
num_components – [in] The basis number of components
- Returns:
The maximum of the two integers
-
int MMSError_CEED_ScalarBPs(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Compute error from true solution for CEED scalar BPs MMS.
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSCEEDBPsParamsQ – [in] Number of quadrature points
in – [in] Input arrays
0 - qdata
1 - quadrature point coordinates
2 - computed solution
out – [out] Output array
0 - error from true solution
- Returns:
An error code: 0 - success, otherwise - failure
-
int MMSError_CEED_VectorBPs(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Compute error from true solution for CEED vector BPs MMS.
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSCEEDBPsParamsQ – [in] Number of quadrature points
in – [in] Input arrays
0 - qdata
1 - quadrature point coordinates
2 - computed solution
out – [out] Output array
0 - error from true solution
- Returns:
An error code: 0 - success, otherwise - failure
-
int MMSError_Linear(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Compute error from true solution for linear elasticity MMS.
Uses an MMS adapted from doi:10.1016/j.compstruc.2019.106175
- Parameters:
ctx – [in] QFunction context, unused
Q – [in] Number of quadrature points
in – [in] Input arrays
0 - qdata
1 - quadrature point coordinates
2 - computed solution
out – [out] Output array
0 - error from true solution
- Returns:
An error code: 0 - success, otherwise - failure
-
int BodyForce(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Compute forcing term with user-specified body force.
- Parameters:
ctx – [in] QFunction context, holding
RatelForcingBodyParamsQ – [in] Number of quadrature points
in – [in] Input arrays
0 - qdata
out – [out] Output array
0 - forcing term
- Returns:
An error code: 0 - success, otherwise - failure
-
int BodyForceEnergy(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Compute external energy cause by forcing term with user-specified body force.
- Parameters:
ctx – [in] QFunction context, holding
RatelForcingBodyParamsQ – [in] Number of quadrature points
in – [in] Input arrays
0 - qdata
1 - displacement u
out – [out] Output array
0 - energy due to body force
- Returns:
An error code: 0 - success, otherwise - failure
-
int MMSForce_CEED_BP1(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Compute forcing term for CEED scalar BP1 MMS.
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSCEEDBPsParamsQ – [in] Number of quadrature points
in – [in] Input arrays
0 - qdata
1 - quadrature point coordinates
out – [out] Output array
0 - forcing term
- Returns:
An error code: 0 - success, otherwise - failure
-
int MMSForce_CEED_BP2(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Compute forcing term for CEED vector BP2 MMS.
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSCEEDBPsParamsQ – [in] Number of quadrature points
in – [in] Input arrays
0 - qdata
1 - quadrature point coordinates
out – [out] Output array
0 - forcing term
- Returns:
An error code: 0 - success, otherwise - failure
-
int MMSForce_CEED_BP3(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Compute forcing term for CEED scalar BP3 MMS.
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSCEEDBPsParamsQ – [in] Number of quadrature points
in – [in] Input arrays
0 - qdata
1 - quadrature point coordinates
out – [out] Output array
0 - forcing term
- Returns:
An error code: 0 - success, otherwise - failure
-
int MMSForce_CEED_BP4(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Compute forcing term for CEED vector BP4 MMS.
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSCEEDBPsParamsQ – [in] Number of quadrature points
in – [in] Input arrays
0 - qdata
1 - quadrature point coordinates
out – [out] Output array
0 - forcing term
- Returns:
An error code: 0 - success, otherwise - failure
-
int MMSForce_Linear(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Compute forcing term for linear elasticity MMS.
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSLinearElasticityParamsQ – [in] Number of quadrature points
in – [in] Input arrays
0 - qdata
1 - quadrature point coordinates
out – [out] Output array
0 - forcing term
- Returns:
An error code: 0 - success, otherwise - failure
-
int MMSForceEnergy_Linear(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Compute external energy cause by forcing term for linear elasticity MMS.
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSLinearElasticityParamsQ – [in] Number of quadrature points
in – [in] Input arrays
0 - qdata
1 - quadrature point coordinates
2 - displacement u
out – [out] Output array
0 - energy due to mms force
- Returns:
An error code: 0 - success, otherwise - failure
-
int MMSForce_MixedLinear(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Compute forcing term for mixed linear elasticity MMS.
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSMixedLinearElasticityParamsQ – [in] Number of quadrature points
in – [in] Input arrays
0 - qdata
1 - quadrature point coordinates
out – [out] Output array
0 - forcing term, displacement field
- Returns:
An error code: 0 - success, otherwise - failure
-
int MMSForceEnergy_MixedLinear(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Compute external energy cause by forcing term for mixed linear elasticity MMS.
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSMixedLinearElasticityParamsQ – [in] Number of quadrature points
in – [in] Input arrays
0 - qdata
1 - quadrature point coordinates
2 - displacement u
out – [out] Output array
0 - energy due to mms force
- Returns:
An error code: 0 - success, otherwise - failure
-
int MPMBodyForce(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Compute forcing term with user-specified body force and density defined at points.
- Parameters:
ctx – [in] QFunction context, holding
RatelForcingBodyParamsQ – [in] Number of quadrature points
in – [in] Input arrays
0 - qdata
1 - state data
2 - density
out – [out] Output array
0 - forcing term
- Returns:
An error code: 0 - success, otherwise - failure
-
int MMSForce_PoromechanicsLinear(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Compute forcing term for linear poromechanics MMS.
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSPoromechanicsLinearParamsQ – [in] Number of quadrature points
in – [in] Input arrays
0 - qdata
1 - quadrature point coordinates
out – [out] Output array
0 - forcing term, displacement field
1 - forcing term, pressure field
- Returns:
An error code: 0 - success, otherwise - failure
-
int MMSICs_PoromechanicsLinear_u(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Compute initial conditions for linear poromechanics MMS.
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSPoromechanicsLinearParamsQ – [in] Number of quadrature points
in – [in] Input arrays
0 - coordinates computed at nodes
1 - nodal multiplicity
out – [out] Output array
0 - Incitial conditions for displacement field
- Returns:
An error code: 0 - success, otherwise - failure
-
int MMSICs_PoromechanicsLinear_pf(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Compute initial conditions for linear poromechanics MMS.
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSPoromechanicsLinearParamsQ – [in] Number of quadrature points
in – [in] Input arrays
0 - coordinates computed at nodes
1 - nodal multiplicity
out – [out] Output array
0 - Incitial conditions for pressure field
- Returns:
An error code: 0 - success, otherwise - failure
-
int Mass(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Apply mass operator.
- Parameters:
ctx – [in] QFunction context, holding the number of components
Q – [in] Number of quadrature points
in – [in] Input arrays
0 - volumetric qdata
1 - u
out – [out] Output array
0 - v
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelScalarBPsMMSTrueSolution(void *ctx, const CeedScalar coords[3], CeedScalar *true_solution)¶
Compute true solution for scalar BPs problems.
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSCEEDBPsParamscoords – [in] Coordinate array
true_solution – [out] True solution
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelScalarBPsPoissonForcing(void *ctx, const CeedScalar coords[3], CeedScalar *poisson_forcing)¶
Compute forcing term for Poisson problems.
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSCEEDBPsParamscoords – [in] Coordinate array
poisson_forcing – [out] Forcing term needed for Poisson problem
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelVectorBPsMMSTrueSolution(void *ctx, const CeedScalar coords[3], CeedScalar true_solution[3])¶
Compute true solution for vector BPs problems.
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSCEEDBPsParamscoords – [in] Coordinate array
true_solution – [out] True solution
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelVectorBPsPoissonForcing(void *ctx, const CeedScalar coords[3], CeedScalar poisson_forcing[3])¶
Compute forcing term Poisson problems.
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSCEEDBPsParamscoords – [in] Coordinate array
poisson_forcing – [out] Forcing term needed for Poisson problem
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelLinearElasticityMMSTrueSolution(void *ctx, const CeedScalar coords[3], CeedScalar true_solution[3])¶
Compute true solution for linear elasticity MMS.
Uses an MMS adapted from doi:10.1016/j.compstruc.2019.106175
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSLinearElasticityParamscoords – [in] Coordinate array
true_solution – [out] True solution
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelLinearElasticityMMSForcing(void *ctx, const CeedScalar coords[3], CeedScalar mms_forcing[3])¶
Compute forcing term for linear elasticity MMS.
Uses an MMS adapted from doi:10.1016/j.compstruc.2019.106175
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSLinearElasticityParamscoords – [in] Coordinate array
mms_forcing – [out] Forcing term
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMixedLinearElasticityMMSTrueSolution(void *ctx, const CeedScalar coords[3], CeedScalar true_solution_u[3], CeedScalar *true_solution_p)¶
Compute true solution for mixed linear elasticity MMS.
Uses an MMS adapted from doi:10.1016/j.compstruc.2019.106175
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSMixedLinearElasticityParamscoords – [in] Coordinate array
true_solution_u – [out] True solution, displacement
true_solution_p – [out] True solution, pressure
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMixedLinearElasticityMMSForcing(void *ctx, const CeedScalar coords[3], CeedScalar mms_forcing_u[3])¶
Compute forcing term for mixed linear elasticity MMS.
Uses an MMS adapted from doi:10.1016/j.compstruc.2019.106175
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSMixedLinearElasticityParamscoords – [in] Coordinate array
mms_forcing_u – [out] Forcing term for displacement
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelPoromechanicsMMSTrueSolution(void *ctx, CeedScalar time, const CeedScalar coords[3], CeedScalar true_solution_u[3], CeedScalar *true_solution_pf)¶
Compute true solution for linear poromechanics MMS.
Uses an MMS adapted from doi:10.1016/j.compstruc.2019.106175
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSPoromechanicsLinearParamstime – [in] Time
coords – [in] Coordinate array
true_solution_u – [out] True solution, displacement
true_solution_pf – [out] True solution, pressure
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelPoromechanicsMMSForcing(void *ctx, const CeedScalar coords[3], CeedScalar mms_forcing_u[3])¶
Compute displacement forcing term for linear poromechanics MMS.
Uses an MMS adapted from doi:10.1016/j.compstruc.2019.106175
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSPoromechanicsLinearParamscoords – [in] Coordinate array
mms_forcing_u – [out] Forcing term for displacement
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelPoromechanicsMMSGamma(void *ctx, const CeedScalar coords[3], CeedScalar *mms_forcing_pf)¶
Compute pressure forcing term for linear poromechanics MMS.
Uses an MMS adapted from doi:10.1016/j.compstruc.2019.106175
- Parameters:
ctx – [in] QFunction context, holding
RatelMMSPoromechanicsLinearParamscoords – [in] Coordinate array
mms_forcing_pf – [out] Forcing term for pressure
- Returns:
An error code: 0 - success, otherwise - failure
-
void __enzyme_autodiff(void*, ...)¶
-
void __enzyme_fwddiff(void*, ...)¶
-
void __enzyme_augmentfwd(void*, ...)¶
-
void __enzyme_fwdsplit(void*, ...)¶
-
int __enzyme_augmentsize(void*, ...)¶
-
int ElasticityResidual_utt(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Apply scaled mass operator for elasticity u_tt residual.
- Parameters:
ctx – [in] QFunction context, holding common parameters and model parameters
Q – [in] Number of quadrature points
in – [in] Input arrays
0 - volumetric qdata
1 - u
out – [out] Output array
0 - v
- Returns:
An error code: 0 - success, otherwise - failure
-
int ElasticityDamageResidual_utt(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Apply scaled mass operator for elasticity damage u_tt residual.
- Parameters:
ctx – [in] QFunction context, holding common parameters and model parameters
Q – [in] Number of quadrature points
in – [in] Input arrays
0 - volumetric qdata
1 - u
out – [out] Output array
0 - v
- Returns:
An error code: 0 - success, otherwise - failure
-
adouble RatelComputeJ2m1_ADOLC(const adouble A_sym[6])¶
Compute
J^2 - 1using symmetric strain tensor 2*E, or 2*e.Note that by providing 2*e = b - I, or 2*E = C - I, we compute det(b) - 1 (or det(C) - 1), where det(b) = det(C) = J^2
- Parameters:
A_sym – [in] Input matrix, in symmetric representation
- Returns:
A scalar value:
J^2 - 1
-
adouble RatelMatTraceSymmetric_ADOLC(adouble A_sym[6])¶
Compute the trace of a 3x3 matrix.
- Parameters:
A_sym – [in] Input 3x3 matrix, in symmetric representation
- Returns:
A scalar value:
trace(A)
-
adouble RatelLog1p_ADOLC(adouble x)¶
Computes
log1p()- Parameters:
x – [in] Scalar value
- Returns:
A scalar value:
log1p(x)
-
adouble RatelStrainEnergy_NeoHookean_AD_ADOLC(adouble strain_sym[6], const CeedScalar lambda, const CeedScalar mu)¶
Compute strain energy for neo-Hookean hyperelasticity.
- Parameters:
strain_sym – [in] Green Lagrange/Euler strain, in symmetric representation
lambda – [in] Lamé parameter
mu – [in] Shear modulus
- Returns:
A scalar value: strain energy
-
void GradientPsi_ADOLC(CeedScalar grad_sym[6], CeedScalar strain_sym[6], const CeedScalar lambda, const CeedScalar mu)¶
Compute the gradient of strain energy for neo-Hookean hyperelasticity with ADOL-C.
- Parameters:
grad_sym – [out] Gradient of strain energy, in symmetric representation
strain_sym – [in] Green Lagrange/Euler strain, in symmetric representation
lambda – [in] Lamé parameter
mu – [in] Shear modulus
-
void HessianPsi_ADOLC(CeedScalar hess[6][6], CeedScalar strain_sym[6], const CeedScalar lambda, const CeedScalar mu)¶
Compute the hessian of strain energy for neo-Hookean hyperelasticity with ADOL-C.
- Parameters:
hess – [out] Hessian of strain energy
strain_sym – [in] Green Lagrange strain
lambda – [in] Lamé parameter
mu – [in] Shear modulus
-
int PoromechanicsLinearResidual_utt(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Poromechanics u_tt residual for linear poromechanics.
- Parameters:
ctx – [in] QFunction context, holding common parameters and model parameters
Q – [in] Number of quadrature points
in – [in] Input arrays
0 - volumetric qdata
1 - u_tt
out – [out] Output array
0 - v
1 - dqdX
- Returns:
An error code: 0 - success, otherwise - failure
-
int PoromechanicsResidual_utt(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Poromechanics u_tt residual at finite strain.
- Parameters:
ctx – [in] QFunction context, holding common parameters and model parameters
Q – [in] Number of quadrature points
in – [in] Input arrays
0 - volumetric qdata
1 - stored value u
2 - u_tt
out – [out] Output array
0 - stored value u_tt
1 - v
2 - q
3 - dqdX
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMigratePoints(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Apply mass operator.
- Parameters:
ctx – [in] QFunction context, not used
Q – [in] Number of quadrature points
in – [in] Input arrays
0 - delta u
out – [out] Output array
0 - point positions (x)
- Returns:
An error code: 0 - success, otherwise - failure
-
int ScaleLumpedDualOutputFieldsTerms(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Apply inverse of lumped mass operator to nodal values.
- Parameters:
ctx – [in] QFunction context, holding the number of components
Q – [in] Number of quadrature points
in – [in] Input arrays
0 - element restriction multiplicity
1 - composite operator nodal multiplicity
2 - dual output fields: nodal volume, other values
out – [out] Output array
0 - lumped dual output fields: nodal volume, other values divided by nodal volume
- Returns:
An error code: 0 - success, otherwise - failure
-
int ScaledMass(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Apply scaled mass operator.
- Parameters:
ctx – [in] QFunction context, holding
RatelScaledMassParamsstructQ – [in] Number of quadrature points
in – [in] Input arrays
0 - volumetric qdata
1 - u
out – [out] Output array
0 - v
- Returns:
An error code: 0 - success, otherwise - failure
-
int ComputeCentroid(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out)¶
Compute face centroid.
- Parameters:
ctx – [in] QFunction context, unused
Q – [in] Number of quadrature points
in – [in] Input arrays
0 - volumetric qdata
1 - quadrature point coordinates
out – [out] Output array
0 - centroid
- Returns:
An error code: 0 - success, otherwise - failure
-
bool RatelIsCloseAtTol(CeedScalar a, CeedScalar b, CeedScalar rtol, CeedScalar atol)¶
-
CeedScalar RatelOrient2DRobustSingle(const CeedScalar ax, const CeedScalar ay, const CeedScalar bx, const CeedScalar by, const CeedScalar cx, const CeedScalar cy)¶
Orient2D with error check from Shewchuk, computes twice the signed area of the triangle ABC.
Positive if CCW.
Note
This function is sometimes unstable when ABC are nearly collinear. Making it stable is expensive.
- Parameters:
ax – [in] x coordinate of vertex A
ay – [in] y coordinate of vertex A
bx – [in] x coordinate of vertex B
by – [in] y coordinate of vertex B
cx – [in] x coordinate of vertex C
cy – [in] y coordinate of vertex C
- Returns:
Twice the area of ABC, positive if CCW, negative if CW
-
CeedScalar RatelOrient2D(const CeedScalar ax, const CeedScalar ay, const CeedScalar bx, const CeedScalar by, const CeedScalar cx, const CeedScalar cy)¶
Orient2D, more stable using bound from from Shewchuk, computes twice the signed area of the triangle ABC.
Positive if CCW.
- Parameters:
ax – [in] x coordinate of vertex A
ay – [in] y coordinate of vertex A
bx – [in] x coordinate of vertex B
by – [in] y coordinate of vertex B
cx – [in] x coordinate of vertex C
cy – [in] y coordinate of vertex C
- Returns:
Twice the area of ABC, positive if CCW, negative if CW
-
bool RatelCoordinatesInBoundingBox(const CeedScalar x[3], const CeedScalar min[3], const CeedScalar max[3])¶
Check if a point is in a bounding box.
- Parameters:
x – [in] Point to check
min – [in] Minimum values of the bounding box
max – [in] Maximum values of the bounding box
-
CeedScalar RatelLog1p(CeedScalar x)¶
Approximation of
log1p().log1p()is not vectorized in libc. This approximation cancels out errors by exploiting IEEE arithmetic.- Parameters:
x – [in] Scalar value
- Returns:
A scalar value:
log1p(x)
-
CeedScalar RatelLog1pMinusx(CeedScalar x)¶
Approximation of
log1p(x) - x.See “Stable numerics for finite-strain elasticity” paper for details.
- Parameters:
x – [in] Scalar value
- Returns:
A scalar value:
log1p(x) - x
-
CeedScalar RatelExpm1Series(CeedScalar x)¶
Series approximation of
expm1()- Parameters:
x – [in] Scalar value
- Returns:
A scalar value:
expm1(x)
-
CeedScalar RatelAtanSeries(CeedScalar x)¶
Approximation of atan(x) with max error 1.95815585968262e-14 on [-1,1].
Computed via Remez algorithm with 31 degree polynomial using github.com/DKenefake/OptimalPoly
- Parameters:
x – [in] Input value
- Returns:
An error code: 0 - success, otherwise - failure
-
CeedInt RatelSign(CeedScalar x)¶
Compute sign of scalar value.
- Parameters:
x – [in] Scalar value
- Returns:
An integer: -1 if
xis negative and 1 ifxis positive
-
int RatelStoredValuesPack(CeedInt Q, CeedInt i, CeedInt start, CeedInt num_comp, const CeedScalar *local, CeedScalar *stored)¶
Pack stored values at quadrature point.
- Parameters:
Q – [in] Number of quadrature points
i – [in] Current quadrature point
start – [in] Starting index to store components
num_comp – [in] Number of components to store
local – [in] Local values for quadrature point i
stored – [out] Stored values
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelStoredValuesUnpack(CeedInt Q, CeedInt i, CeedInt start, CeedInt num_comp, const CeedScalar *stored, CeedScalar *local)¶
Unpack stored values at quadrature point.
- Parameters:
Q – [in] Number of quadrature points
i – [in] Current quadrature point
start – [in] Starting index to store components
num_comp – [in] Number of components to store
stored – [in] Stored values
local – [out] Local values for quadrature point i
- Returns:
An error code: 0 - success, otherwise - failure
-
CeedScalar RatelDot3(const CeedScalar a[3], const CeedScalar b[3])¶
Compute dot product of two length 3 vectors.
- Parameters:
a – [in] First input vector
b – [in] Second input vector
- Returns:
A scalar value:
a . b
-
CeedScalar RatelNorm3(const CeedScalar a[3])¶
Compute norm of a length 3 vector.
- Parameters:
a – [in] Input vector
- Returns:
A scalar value:
|a|
-
int RatelScalarVecMult(CeedScalar alpha, const CeedScalar a[3], CeedScalar b[3])¶
Compute
b = alpha afor a length 3 vector.- Parameters:
alpha – [in] Scaling factor
a – [in] Input vector
b – [out] Output vector
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelVecVecAdd(CeedScalar alpha, const CeedScalar a[3], CeedScalar beta, const CeedScalar b[3], CeedScalar c[3])¶
Compute
c = alpha * a + beta * bfor two length 3 vectors.- Parameters:
alpha – [in] First scaling factor
a – [in] First input vector
beta – [in] Second scaling factor
b – [in] Second input vector
c – [out] Output vector
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelVecVecVecAdd(CeedScalar alpha, const CeedScalar a[3], CeedScalar beta, const CeedScalar b[3], CeedScalar gamma, const CeedScalar c[3], CeedScalar d[3])¶
Compute
d = alpha * a + beta * b + gamma * cfor three length 3 vectors.- Parameters:
alpha – [in] First scaling factor
a – [in] First input vector
beta – [in] Second scaling factor
b – [in] Second input vector
gamma – [in] Third scaling factor
c – [in] Third input vector
d – [out] Output vector
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelVecVecSubtract(const CeedScalar a[3], const CeedScalar b[3], CeedScalar c[3])¶
Compute
c = a - bfor two length 3 vectors.- Parameters:
a – [in] First input vector
b – [in] Second input vector
c – [out] Output vector
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelVecVecCross(const CeedScalar a[3], const CeedScalar b[3], CeedScalar c[3])¶
Compute
c = a x bfor two length 3 vectors.- Parameters:
a – [in] First input vector
b – [in] Second input vector
c – [out] Output vector
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelVecOuterMult(const CeedScalar a[3], CeedScalar A_sym[6])¶
Compute outer product of a vector length 3 with it self results in symmetric matrix
A_sym = a*a^T- Parameters:
a – [in] Input vector
A_sym – [out] Symmetric matrix
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelVecVecOuterMult(const CeedScalar a[3], const CeedScalar b[3], CeedScalar A[3][3])¶
Compute outer product of two vectors of length 3 results in a matrix
A = a*b^T- Parameters:
a – [in] Input vector
b – [in] Input vector
A – [out] Matrix
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelScalarMatMult(CeedScalar alpha, const CeedScalar A[3][3], CeedScalar B[3][3])¶
Compute
B = alpha A- Parameters:
alpha – [in] Scaling factor
A – [in] Input 3x3 matrix
B – [out] Output 3x3 matrixn
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelScalarMatMultSymmetric(CeedScalar alpha, const CeedScalar A_sym[6], CeedScalar B_sym[6])¶
Compute
B_sym = alpha A_sym- Parameters:
alpha – [in] Scaling factor
A_sym – [in] Input 3x3 matrix, in symmetric representation
B_sym – [out] Output 3x3 matrix, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatVecMult(CeedScalar alpha, const CeedScalar A[3][3], const CeedScalar x[3], CeedScalar b[3])¶
Compute
b = alpha A xfor a length 3 vector and a 3x3 matrix.- Parameters:
alpha – [in] Scaling factor
A – [in] Input matrix
x – [in] Input vector
b – [out] Output vector
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatTransposeVecMult(CeedScalar alpha, const CeedScalar A[3][3], const CeedScalar x[3], CeedScalar b[3])¶
Compute
b = alpha A^T xfor a length 3 vector and a 3x3 matrix.- Parameters:
alpha – [in] Scaling factor
A – [in] Input matrix
x – [in] Input vector
b – [out] Output vector
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelSymmetricMatPack(const CeedScalar full[3][3], CeedScalar sym[6])¶
Pack symmetric 3x3 matrix from full to symmetric representation.
Matrix is packed as
\( \begin{vmatrix} s_0 & s_5 & s_4 \\ s_5 & s_1 & s_3 \\ s_4 & s_3 & s_2 \end{vmatrix} \)
where \(s_0, s_1, \dots \) are the indices of the vector in symmetric representation.
- Parameters:
full – [in] Input full 3x3 matrix
sym – [out] Output matrix as length 6 vector, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelSymmetricMatUnpack(const CeedScalar sym[6], CeedScalar full[3][3])¶
Unpack symmetric 3x3 matrix from symmetric to full representation.
Matrix is packed as
\( \begin{vmatrix} s_0 & s_5 & s_4 \\ s_5 & s_1 & s_3 \\ s_4 & s_3 & s_2 \end{vmatrix} \)
where \(s_0, s_1, \dots \) are the indices of the vector in symmetric representation.
- Parameters:
sym – [in] Input matrix as length 6 vector, in symmetric representation
full – [out] Output full 3x3 matrix
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatUnpack(const CeedScalar a[9], CeedScalar A_full[3][3])¶
Unpack symmetric 3x3 matrix from symmetric to full representation.
Matrix is packed as
\( \begin{vmatrix} s_0 & s_5 & s_4 \\ s_8 & s_1 & s_3 \\ s_7 & s_6 & s_2 \end{vmatrix} \)
where \(s_0, s_1, \dots \) are the indices of the vector.
- Parameters:
a – [in] Input matrix as length 9 vector
A_full – [out] Output full 3x3 matrix
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatPack(const CeedScalar A_full[3][3], CeedScalar a[9])¶
Pack 3x3 matrix from full to length 9 vector.
- Parameters:
A_full – [in] Input full 3x3 matrix
a – [out] Output length 9 vector
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelKelvinMandelMatUnpack(const CeedScalar sym[6], CeedScalar full[3][3])¶
Unpack symmetric tensor into full tensor via Kelvin-Mandel normalization.
Matrix is packed as
\( \begin{vmatrix} s_0 & s_5/ \sqrt{2} & s_4/ \sqrt{2} \\ s_5/ \sqrt{2} & s_1 & s_3/ \sqrt{2} \\ s_4/ \sqrt{2} & s_3/ \sqrt{2} & s_2/ \sqrt{2} \end{vmatrix} \)
where \(s_0, s_1, \dots \) are the indices of the vector in symmetric representation.
- Parameters:
sym – [in] Input matrix as length 6 vector, in symmetric representation
full – [out] Output full 3x3 matrix
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelKelvinMandelMatPack(const CeedScalar full[3][3], CeedScalar sym[6])¶
Pack full tensor into symmetric tensor of length 6 via Kelvin-Mandel normalization.
Matrix is packed as
\( \begin{vmatrix} s_0 & s_5/ \sqrt{2} & s_4/ \sqrt{2} \\ s_5/ \sqrt{2} & s_1 & s_3/ \sqrt{2} \\ s_4/ \sqrt{2} & s_3/ \sqrt{2} & s_2/ \sqrt{2} \end{vmatrix} \)
where \(s_0, s_1, \dots \) are the indices of the vector in symmetric representation.
- Parameters:
full – [in] Input full 3x3 matrix
sym – [out] Output matrix as length 6 vector, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
CeedScalar RatelMatTrace(const CeedScalar A[3][3])¶
Compute the trace of a 3x3 matrix.
- Parameters:
A – [in] Input 3x3 matrix
- Returns:
A scalar value:
trace(A)
-
CeedScalar RatelMatTraceSymmetric(const CeedScalar A_sym[6])¶
Compute the trace of a 3x3 matrix.
- Parameters:
A_sym – [in] Input 3x3 matrix, in symmetric representation
- Returns:
A scalar value:
trace(A)
-
int RatelMatMatAdd(CeedScalar alpha, const CeedScalar A[3][3], CeedScalar beta, const CeedScalar B[3][3], CeedScalar C[3][3])¶
Compute
C = alpha A + beta Bfor 3x3 matrices.- Parameters:
alpha – [in] First scaling factor
A – [in] First input matrix
beta – [in] Second scaling factor
B – [in] Second input matrix
C – [out] Output matrix
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatCopy(const CeedScalar A[3][3], CeedScalar B[3][3])¶
Copy B = A for 3x3 matrices.
- Parameters:
A – [in] Input matrix
B – [out] Output matrix
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatMatAddSymmetric(CeedScalar alpha, const CeedScalar A_sym[6], CeedScalar beta, const CeedScalar B_sym[6], CeedScalar C_sym[6])¶
Compute
C = alpha A + beta Bfor 3x3 matrices, in symmetric representation.- Parameters:
alpha – [in] First scaling factor
A_sym – [in] First input matrix, in symmetric representation
beta – [in] Second scaling factor
B_sym – [in] Second input matrix, in symmetric representation
C_sym – [out] Output matrix, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatMatMatAddSymmetric(CeedScalar alpha, const CeedScalar A_sym[6], CeedScalar beta, const CeedScalar B_sym[6], CeedScalar gamma, const CeedScalar C_sym[6], CeedScalar D_sym[6])¶
Compute
D = alpha A + beta B + gamma Cfor 3x3 matrices, in symmetric representation.- Parameters:
alpha – [in] First scaling factor
A_sym – [in] First input matrix, in symmetric representation
beta – [in] Second scaling factor
B_sym – [in] Second input matrix, in symmetric representation
gamma – [in] Third scaling factor
C_sym – [in] Third input matrix, in symmetric representation
D_sym – [out] Output matrix, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatMatMatAdd(CeedScalar alpha, const CeedScalar A[3][3], CeedScalar beta, const CeedScalar B[3][3], CeedScalar gamma, const CeedScalar C[3][3], CeedScalar D[3][3])¶
Compute
D = alpha A + beta B + gamma Cfor 3x3 matrices.- Parameters:
alpha – [in] First scaling factor
A – [in] First input matrix
beta – [in] Second scaling factor
B – [in] Second input matrix
gamma – [in] Third scaling factor
C – [in] Third input matrix
D – [out] Output matrix
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatDeviatoricSymmetric(CeedScalar trace_A, const CeedScalar A_sym[6], CeedScalar A_sym_dev[6])¶
Compute deviatoric part of symmetric matrix;
A_sym_dev = A_sym - (1/3) trace(A) Ifor 3x3 matrix, in symmetric representation.- Parameters:
trace_A – [in] Trace of input matrix
A_sym – [in] Input matrix, in symmetric representation
A_sym_dev – [out] Deviatoric part of input matrix, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelReconstructMatFromDeviatoricSymmetric(CeedScalar trace_A, const CeedScalar A_sym_dev[6], CeedScalar A_sym[6])¶
Reconstruct full symmetric matrix from deviatoric part and trace;
A_sym = A_sym_dev + (1/3) trace(A) Ifor 3x3 matrix, in symmetric representation.- Parameters:
trace_A – [in] Trace of full matrix
A_sym_dev – [in] Deviatoric part of input matrix, in symmetric representation
A_sym – [out] Reconstructed full matrix, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatMatMult(CeedScalar alpha, const CeedScalar A[3][3], const CeedScalar B[3][3], CeedScalar C[3][3])¶
Compute
C = alpha A * Bfor 3x3 matrices.- Parameters:
alpha – [in] Scaling factor
A – [in] First input matrix
B – [in] Second input matrix
C – [out] Output matrix
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatTransposeMatMult(CeedScalar alpha, const CeedScalar A[3][3], const CeedScalar B[3][3], CeedScalar C[3][3])¶
Compute
C = alpha A^T * Bfor 3x3 matrices.- Parameters:
alpha – [in] Scaling factor
A – [in] First input matrix
B – [in] Second input matrix
C – [out] Output matrix
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatMatTransposeMult(CeedScalar alpha, const CeedScalar A[3][3], const CeedScalar B[3][3], CeedScalar C[3][3])¶
Compute
C = alpha A * B^Tfor 3x3 matrices.- Parameters:
alpha – [in] Scaling factor
A – [in] First input matrix
B – [in] Second input matrix
C – [out] Output matrix
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatTransposeMatTransposeMult(CeedScalar alpha, const CeedScalar A[3][3], const CeedScalar B[3][3], CeedScalar C[3][3])¶
Compute
C = alpha A^T * B^Tfor 3x3 matrices.- Parameters:
alpha – [in] Scaling factor
A – [in] First input matrix
B – [in] Second input matrix
C – [out] Output matrix
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatMatMultPlusMatMatMult(const CeedScalar A[3][3], const CeedScalar B[3][3], const CeedScalar C[3][3], const CeedScalar D[3][3], CeedScalar E[3][3])¶
Compute
E = A * B + C * Dfor 3x3 matrices.- Parameters:
A – [in] First input matrix
B – [in] Second input matrix
C – [in] Third input matrix
D – [in] Fourth input matrix
E – [out] Output matrix
- Returns:
An error code: 0 - success, otherwise - failure
-
CeedScalar RatelMatMatContract(CeedScalar alpha, const CeedScalar A[3][3], const CeedScalar B[3][3])¶
Compute
c = alpha A : Bfor 3x3 matrices.- Parameters:
alpha – [in] Scaling factor
A – [in] First input matrix
B – [in] Second input matrix
- Returns:
A scalar value:
alpha A : B
-
CeedScalar RatelMatMatContractSymmetric(CeedScalar alpha, const CeedScalar A_sym[6], const CeedScalar B_sym[6])¶
Compute
c = alpha A_sym : B_symfor 3x3 matrices, in symmetric representation.- Parameters:
alpha – [in] Scaling factor
A_sym – [in] First input matrix, in symmetric representation
B_sym – [in] Second input matrix, in symmetric representation
- Returns:
A scalar value:
alpha A_sym : B_sym
-
CeedScalar RatelMatDetA(const CeedScalar A[3][3])¶
Compute
det(A)for a 3x3 matrix.- Parameters:
A – [in] Input matrix
- Returns:
A scalar value:
det(A)
-
CeedScalar RatelComputeJm1(const CeedScalar grad_u[3][3])¶
Compute
J - 1using 3x3 matrix grad_u.Note that the common way to compute
Jis using deformatioan gradientF = I + grad_u,J = det(F), but for stability reason explained in this paper “Stable numerics for finite-strain elasticity” we computeJ - 1usinggrad_u = F - I. In general, this function here givesdet(B), using matrixA, whereA = B - I`.- Parameters:
grad_u – [in] Gradient of displacement wrt to initial configuration
- Returns:
A scalar value:
J - 1
-
CeedScalar RatelComputeJ2m1(const CeedScalar A_sym[6])¶
Compute
J^2 - 1using symmetric strain tensor 2*E, or 2*e.Note that by providing 2*e = b - I, or 2*E = C - I, we compute det(b) - 1 (or det(C) - 1), where det(b) = det(C) = J^2
- Parameters:
A_sym – [in] Input matrix, in symmetric representation
- Returns:
A scalar value:
J^2 - 1
-
CeedScalar RatelJ2m1m2TraceE(const CeedScalar E_sym[6])¶
Compute
J^2 - 1 - 2 * trace(E)based on initial/current strain tensor (E or e)Note this function is used to make Neo-Hookean energy stable in Enzyme model. For more detail see “Stable numerics for finite-strain elasticity” paper.
- Parameters:
E_sym – [in] Symmetric strain tensor
- Returns:
A scalar value:
J^2 - 1 - 2 * trace(E)
-
int RatelMatMatMultSymmetric(CeedScalar alpha, const CeedScalar A_sym[6], const CeedScalar B_sym[6], CeedScalar C_sym[6])¶
Compute
C_sym = alpha A_sym * B_symfor 3x3 matrices, in symmetric representation.Note
C_symwill not be symmetric in general. Only use this function whenA_symandB_symhave same eigenvectors.- Parameters:
alpha – [in] Scaling factor
A_sym – [in] First input matrix, in symmetric representation
B_sym – [in] Second input matrix, in symmetric representation
C_sym – [out] Output matrix, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
CeedScalar RatelMatNorm(const CeedScalar A[3][3])¶
Compute the Frobenius norm
||A|| = sqrt(sum_ij |a_ij|^2)for a symmetric 3x3 matrix.- Parameters:
A – [in] Input matrix
- Returns:
A scalar value:
||A||
-
int RatelMatMatMatMultSymmetric(CeedScalar alpha, const CeedScalar A_sym[6], const CeedScalar B_sym[6], CeedScalar C_sym[6])¶
Compute
C_sym = A_sym * B_sym * A_symfor 3x3 matrices, in symmetric representation.- Parameters:
alpha – [in] Scaling factor
A_sym – [in] First input matrix, in symmetric representation
B_sym – [in] Second input matrix, in symmetric representation
C_sym – [out] Output matrix, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatMatSymmetricMatTransposeMult(CeedScalar alpha, const CeedScalar A[3][3], const CeedScalar B_sym[6], CeedScalar C_sym[6])¶
Compute
C_sym = A * B_sym * A^Tfor 3x3 matrices, in symmetric representation.- Parameters:
alpha – [in] Scaling factor
A – [in] First input matrix, in 3x3 representation
B_sym – [in] Second input matrix, in symmetric representation
C_sym – [out] Output matrix, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatTransposeMatSymmetricMatMult(CeedScalar alpha, const CeedScalar A[3][3], const CeedScalar B_sym[6], CeedScalar C_sym[6])¶
Compute
C_sym = A^T * B_sym * Afor 3x3 matrices, in symmetric representation.- Parameters:
alpha – [in] Scaling factor
A – [in] First input matrix, in 3x3 representation
B_sym – [in] Second input matrix, in symmetric representation
C_sym – [out] Output matrix, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatInverse(const CeedScalar A[3][3], CeedScalar det_A, CeedScalar A_inv[3][3])¶
Compute
A^-1for a 3x3 matrix.- Parameters:
A – [in] Input matrix
det_A – [in] Determinant of A
A_inv – [out] Output matrix inverse
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatInverseSymmetric(const CeedScalar A[3][3], CeedScalar det_A, CeedScalar A_inv[6])¶
Compute
A^-1for a symmetric 3x3 matrix.- Parameters:
A – [in] Input matrix
det_A – [in] Determinant of A
A_inv – [out] Output matrix inverse, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelScaledMassApplyAtQuadraturePoint(CeedInt Q, CeedInt i, CeedInt num_comp, CeedScalar alpha, const CeedScalar *u, CeedScalar *v)¶
Apply mass matrix for all components at a quadrature point.
- Parameters:
Q – [in] Number of quadrature points
i – [in] Current quadrature point
num_comp – [in] Number of components in u
alpha – [in] Scaling factor
u – [in] Input array
v – [out] Output array
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelCInverse(const CeedScalar E_sym[6], CeedScalar Jm1, CeedScalar C_inv_sym[6])¶
Compute inverse of right Cauchy-Green tensor.
- Parameters:
E_sym – [in] Strain tensor, in symmetric representation
Jm1 – [in] Determinant of deformation gradient(F) - 1; J = det(F)
C_inv_sym – [out] Inverse of right Cauchy-Green tensor, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelCInverse_fwd(const CeedScalar C_inv_sym[6], const CeedScalar dE_sym[6], CeedScalar dC_inv_sym[6])¶
Compute
dC_inv_sym = -2 C_inv_sym * dE_sym * C_inv_sym- Parameters:
C_inv_sym – [in] Inverse of right Cauchy-Green tensor, in symmetric representation
dE_sym – [in] Incremental strain energy tensor, in symmetric representation
dC_inv_sym – [out] Inverse of incremental right Cauchy-Green tensor, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelLinearStrain(const CeedScalar grad_u[3][3], CeedScalar e_sym[6])¶
Compute linear strain
e = (grad_u + grad_u^T) / 2- Parameters:
grad_u – [in] Gradient of u
e_sym – [out] Linear strain, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelLinearStrain_fwd(const CeedScalar grad_du[3][3], CeedScalar de_sym[6])¶
Compute incremental linear strain
de = (grad_du + grad_du^T) / 2- Parameters:
grad_du – [in] Gradient of incremental change to u
de_sym – [out] Incremental linear strain, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelGreenEulerStrain(const CeedScalar grad_u[3][3], CeedScalar e_sym[6])¶
Compute Green Euler strain
e = (b - I) / 2 = (grad_u + grad_u^T + grad_u * grad_u^T) / 2for current configuration.- Parameters:
grad_u – [in] Gradient of u
e_sym – [out] Green Euler strain, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelGreenEulerStrain_fwd(const CeedScalar grad_du[3][3], const CeedScalar b[3][3], CeedScalar de_sym[6])¶
Compute incremental Green Euler strain
de = db / 2 = (grad_du b + b grad_du^T) / 2for current configuration.grad_du = d(du)/dxwherexis physical coordinate in current configuration.- Parameters:
grad_du – [in] Gradient of incremental change to u
b – [in] Left Cauchy-Green deformation tensor
de_sym – [out] Incremental Green Euler strain, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelGreenLagrangeStrain(const CeedScalar grad_u[3][3], CeedScalar E_sym[6])¶
Compute Green Lagrange strain
E = (C - I)/2 = (grad_u + grad_u^T + grad_u^T * grad_u)/2for initial configuration.- Parameters:
grad_u – [in] Gradient of u
E_sym – [out] Green Lagrange strain, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelGreenLagrangeStrain_fwd(const CeedScalar grad_du[3][3], const CeedScalar F[3][3], CeedScalar dE_sym[6])¶
Compute incremental Green Lagrange strain
dE = (grad_du^T * F + F^T * grad_du) / 2for initial configuration.- Parameters:
grad_du – [in] Gradient of incremental change to u
F – [in] Deformation gradient
dE_sym – [out] Incremental Green Lagrange strain, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelLinearStress(CeedScalar two_mu, CeedScalar lambda, CeedScalar trace_e, const CeedScalar e_sym[6], CeedScalar sigma_sym[6])¶
Compute linear stress
sigma = lambda*trace(e)I + 2*mu*e- Parameters:
two_mu – [in] Shear modulus multiplied by 2
lambda – [in] Lame parameter
trace_e – [in] Trace of linear strain
e_sym – [in] Linear strain, in symmetric representation
sigma_sym – [out] Linear stress, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelLinearStressEigenvalues(const CeedScalar two_mu, const CeedScalar lambda, const CeedScalar trace_e, const CeedScalar e_eigenvalues[3], CeedScalar sigma_eigenvalues[3])¶
Compute linear stress sigma eigenvalues.
- Parameters:
two_mu – [in] Shear modulus multiplied by 2
lambda – [in] Lame parameter
trace_e – [in] Trace of linear strain
e_eigenvalues – [in] Linear strain eigenvalues
sigma_eigenvalues – [out] Linear stress eigenvalues
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelLinearStress_fwd(CeedScalar two_mu, CeedScalar lambda, CeedScalar trace_de, const CeedScalar de_sym[6], CeedScalar dsigma_sym[6])¶
Compute incremental linear stress
dsigma = lambda*trace(de)I + 2*mu*de- Parameters:
two_mu – [in] Shear modulus multiplied by 2
lambda – [in] Lame parameter
trace_de – [in] Trace of incremental linear strain
de_sym – [in] Linear strain incremental, in symmetric representation
dsigma_sym – [out] Linear stress incremental, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMixedLinearStress(CeedScalar two_mu, CeedScalar bulk_primal, CeedScalar trace_e, CeedScalar p, const CeedScalar e_dev_sym[6], CeedScalar sigma_sym[6])¶
Compute mixed linear stress
sigma = (bulk_primal * tr(e) - p) * I + 2 * mu * e_dev- Parameters:
two_mu – [in] Shear modulus multiplied by 2
bulk_primal – [in] Primal bulk modulus
trace_e – [in] Trace of linear strain
p – [in] Pressure
e_dev_sym – [in] Deviatoric linear strain, in symmetric representation
sigma_sym – [out] Mixed linear stress, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMixedLinearStress_fwd(CeedScalar two_mu, CeedScalar bulk_primal, CeedScalar trace_de, CeedScalar dp, const CeedScalar de_dev_sym[6], CeedScalar dsigma_sym[6])¶
Compute incremental mixed linear stress
dsigma = (bulk_primal * tr(de) - dp) * I + 2 * mu * de_dev- Parameters:
two_mu – [in] Shear modulus multiplied by 2
bulk_primal – [in] Primal bulk modulus
trace_de – [in] Trace of incremental linear strain
dp – [in] Pressure incremental
de_dev_sym – [in] Deviatoric linear strain incremental, in symmetric representation
dsigma_sym – [out] Mixed linear stress incremental, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelPoromechanicsLinearStress(CeedScalar two_mu_d, CeedScalar lambda_d, CeedScalar B, CeedScalar trace_e, CeedScalar pf, const CeedScalar e_sym[6], CeedScalar sigma_sym[6])¶
Compute poromechanics linear stress
sigma = ((lambda_d * trace_e * I) - (B * pf * I) + (2_mu_d * e_sym)- Parameters:
two_mu_d – [in] Shear modulus (drained) multiplied by 2
lambda_d – [in] First Lame parameter
B – [in] Biot’s coefficient
trace_e – [in] Trace of linear strain
pf – [in] Pore fluid pressure
e_sym – [in] Poromechanics linear strain, in symmetric representation
sigma_sym – [out] Poromechanics linear stress, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelPoromechanicsLinearStress_fwd(CeedScalar two_mu_d, CeedScalar lambda_d, CeedScalar B, CeedScalar trace_de, CeedScalar dpf, const CeedScalar de_sym[6], CeedScalar dsigma_sym[6])¶
Compute incremental poromechanics linear stress
dsigma = (lambda_d trace_de I) - (B dpf I) + (2_mu_d de_sym)- Parameters:
two_mu_d – [in] Shear modulus (drained) multiplied by 2
lambda_d – [in] First Lame parameter
B – [in] Biot’s coefficient
trace_de – [in] Trace of incremental linear strain
dpf – [in] Pore fluid pressure incremental
de_sym – [in] linear strain incremental, in symmetric representation //Deviatoric ?
dsigma_sym – [out] Mixed linear stress incremental, in symmetric representation
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelOrthogonalComplement(const CeedScalar w[3], CeedScalar u[3], CeedScalar v[3])¶
Compute right handed orthonormal set
{w, u, v}for length 3 unit vectors.Ref https://www.geometrictools.com/GTE/Mathematics/SymmetricEigensolver3x3.h
- Parameters:
w – [in] Input vector, unit length
u – [out] First output vector
v – [out] Second output vector
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelComputeEigenvector0(const CeedScalar A_sym[6], CeedScalar e_val_0, CeedScalar e_vec_0[3])¶
Compute unit length eigenvector for the first eigenvalue of 3x3 symmetric matrix
A_sym.Ref https://www.geometrictools.com/GTE/Mathematics/SymmetricEigensolver3x3.h
- Parameters:
A_sym – [in] Symmetric matrix
e_val_0 – [in] First eigenvalue
e_vec_0 – [out] First eigenvector
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelComputeEigenvector1(const CeedScalar A_sym[6], const CeedScalar e_vec_0[3], CeedScalar e_val_1, CeedScalar e_vec_1[3])¶
Compute unit length eigenvector for the second eigenvalue of 3x3 symmetric matrix
A_sym.Ref https://www.geometrictools.com/GTE/Mathematics/SymmetricEigensolver3x3.h
- Parameters:
A_sym – [in] Symmetric matrix
e_vec_0 – [in] First eigenvector
e_val_1 – [in] Second eigenvalue
e_vec_1 – [out] Second eigenvector
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatComputeEigensystemSymmetric(const CeedScalar A_sym[6], CeedScalar e_vals[3], CeedScalar e_vecs[3][3])¶
Compute eigenvalues/vectors of 3x3 symmetric matrix
A_sym.Ref https://onlinelibrary.wiley.com/doi/10.1002/nme.7153?af=R
The rows of
e_vecsare the eigenvectors for each eigenvalue.- Parameters:
A_sym – [in] Symmetric matrix
e_vals – [out] Array of eigenvalues
e_vecs – [out] Array of eigenvectors
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelEigenValue_fwd(const CeedScalar dA_sym[6], const CeedScalar e_vecs[3][3], CeedScalar de_vals[3])¶
Compute eigenvalue’s increment
de_vals[i] = (dA*e_vecs[i], e_vecs[i])for Newton linearization.- Parameters:
dA_sym – [in] Increment of symmetric matrix A
e_vecs – [in] Eigenvectors of A_sym
de_vals – [out] Increment eigenvalues
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelEigenVector_fwd(const CeedScalar dA_sym[6], const CeedScalar e_vals[3], const CeedScalar e_vecs[3][3], CeedInt i, CeedScalar de_vec[3])¶
Compute eigenvector’s increment
de_vec[i] = sum_{j!=i} (dA*e_vecs[i], e_vecs[j]) * e_vecs[j] / (e_vals[i] - e_vals[j])for Newton linearization.- Parameters:
dA_sym – [in] Increment of symmetric matrix A
e_vals – [in] Eigenvalues of A_sym
e_vecs – [in] Eigenvectors of A_sym
i – [in] ith de_vec that we want to return
de_vec – [out] Increment of ith eigenvector
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelPrincipalStretch(const CeedScalar e_vals[3], CeedScalar pr_str[3])¶
Compute principal stretch
pr[i] = sqrt(1 + e_vals[i])where e_vals are eigenvalue of Green-Lagrange strain tensor E (in initial configuration) or Green-Euler strain tensor e (in current configuration)- Parameters:
e_vals – [in] Array of eigenvalues of E or e
pr_str – [out] Array of principal stretch
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelPrincipalStretch_fwd(const CeedScalar dA_sym[6], const CeedScalar e_vecs[3][3], const CeedScalar pr_str[3], CeedScalar dpr_str[3])¶
Compute principal stretch increment
dpr_str[i] = (dA*e_vecs[i], e_vecs[i]) / pr[i]for Newton linearization.- Parameters:
dA_sym – [in] Increment of Green-Lagrange dE (in initial configuration) or Green-Euler de (in current configuration)
e_vecs – [in] Array of eigenvectors of A_sym
pr_str – [in] Array of principal stretch
dpr_str – [out] Array of increment principal stretch
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelEigenVectorOuterMult(const CeedScalar e_vals[3], const CeedScalar e_vecs[3][3], CeedScalar outer_mult[3][6])¶
Compute outer product of eigenvector
outer_mult[i][6] = (N[i] * N[i]^T)for i=0:2.- Parameters:
e_vals – [in] Input eigenvalues
e_vecs – [in] Input eigenvectors 3x3
outer_mult – [out] Matrix of size 3x6
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelEigenVectorOuterMult_fwd(const CeedScalar dA_sym[6], const CeedScalar e_vals[3], const CeedScalar e_vecs[3][3], CeedScalar outer_mult_fwd[3][6])¶
Compute outer product increment of eigenvector
Outer_mult_fwd[i][6] = d(N[i] * N[i]^T)for Newton linearization.- Parameters:
dA_sym – [in] Increment of symmetric matrix A
e_vecs – [in] Eigenvectors of A
e_vals – [in] Eigenvalues of A
outer_mult_fwd – [out] Matrix of size 3x6
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelVecSignum(const CeedScalar x[3], CeedScalar y[3], CeedScalar *norm)¶
Compute signum function of vector, defined by
sgn(x) = x / ||x||or0if||x|| == 0- Parameters:
x – [in] Input vector
y – [out] Output vector,
y = sgn(x)norm – [out] Norm of input vector
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelVecSignum_fwd(const CeedScalar x[3], const CeedScalar dx[3], CeedScalar y[3], CeedScalar dy[3], CeedScalar *norm)¶
Compute increment of signum of vector
d(sgn(x))/dx = (I - (x/||x||)⊗(x/||x||)) / ||x|| * dxor0if||x|| == 0- Parameters:
x – [in] Input vector
dx – [in] Increment of input vector
y – [out] Output vector, d = sgn(x)
dy – [out] Increment of output vector, dy = d(sgn(x))/dx
norm – [out] Norm of input vector
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatFromEigensystemSymmetric(const CeedScalar eigenvalues[3], const CeedScalar n_outer3x6[3][6], CeedScalar A_sym[6])¶
Compute symmetric 3x3 matrix as
A_sym = sum_{i=1}^{3} f(lambda_i) Q_i Q_i^T- Parameters:
eigenvalues – [in] A_sym eigenvalues
n_outer3x6 – [in] eigenvectors outer product
A_sym – [out] A_sym
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelQdataUnpack(CeedInt Q, CeedInt i, const CeedScalar stored[10][CEED_Q_VLA], CeedScalar local[3][3])¶
Unpack qdata at quadrature point.
- Parameters:
Q – [in] Number of quadrature points
i – [in] Current quadrature point
stored – [in] All qdata
local – [out] Qdata for quadrature point i
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelQdataPack(CeedInt Q, CeedInt i, CeedScalar wdetJ, const CeedScalar local[3][3], CeedScalar stored[10][CEED_Q_VLA])¶
Unpack qdata at quadrature point.
- Parameters:
Q – [in] Number of quadrature points
i – [in] Current quadrature point
wdetJ – [in] Quadrature weight
local – [in] Qdata for quadrature point i
stored – [out] All qdata
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelGradUnpack(CeedInt Q, CeedInt i, const CeedScalar grad[3][3][CEED_Q_VLA], CeedScalar local[3][3])¶
Unpack gradient at quadrature point.
- Parameters:
Q – [in] Number of quadrature points
i – [in] Current quadrature point
grad – [in] Gradient of u, x (or du in jacobian) w.r.t X, X is ref coordinate [-1, 1]^3
local – [out] dudX, dxdX (or ddudX in jacobian) for quadrature point i
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatMatMultAtQuadraturePoint(CeedInt Q, CeedInt i, CeedScalar alpha, const CeedScalar A[3][3], const CeedScalar B[3][3], CeedScalar C[3][3][CEED_Q_VLA])¶
Compute
C = alpha A * Bfor 3x3 matrices at a quadrature point.- Parameters:
Q – [in] Number of quadrature points
i – [in] Current quadrature point
alpha – [in] Scaling factor
A – [in] First input matrix
B – [in] Second input matrix
C – [out] Output matrix, stored for quadrature point i
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatMatTransposeMultAtQuadraturePoint(CeedInt Q, CeedInt i, CeedScalar alpha, const CeedScalar A[3][3], const CeedScalar B[3][3], CeedScalar C[3][3][CEED_Q_VLA])¶
Compute
C = alpha A * B^Tfor 3x3 matrices at a quadrature point.- Parameters:
Q – [in] Number of quadrature points
i – [in] Current quadrature point
alpha – [in] Scaling factor
A – [in] First input matrix
B – [in] Second input matrix
C – [out] Output matrix, stored for quadrature point i
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatMatTransposeMultAtQuadraturePoint4x3(CeedInt Q, CeedInt i, CeedScalar alpha, const CeedScalar A[3][3], const CeedScalar B[4][3], CeedScalar C[3][4][CEED_Q_VLA])¶
Compute
C = alpha A * B^Tfor B with size 4x3 at a quadrature point.- Parameters:
Q – [in] Number of quadrature points
i – [in] Current quadrature point
alpha – [in] Scaling factor
A – [in] First input matrix 3x3
B – [in] Second input matrix 4x3
C – [out] Output matrix, stored for quadrature point i
- Returns:
An error code: 0 - success, otherwise - failure
-
int RatelMatVecMultAtQuadraturePoint(CeedInt Q, CeedInt i, CeedScalar alpha, const CeedScalar A[3][3], const CeedScalar x[3], CeedScalar b[3][CEED_Q_VLA])¶
Compute
b = alpha A xfor a length 3 vector and a 3x3 matrix at a quadrature point.- Parameters:
Q – [in] Number of quadrature points
i – [in] Current quadrature point
alpha – [in] Scaling factor
A – [in] First input matrix
x – [in] First input vector
b – [out] Output vector, stored for quadrature point i
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelProcessCommandLineOptions(Ratel ratel)¶
Process general command line options.
Collective across MPI processes.
- Parameters:
ratel – [inout]
Ratelcontext object
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelCheckViewOptions(Ratel ratel, DM dm)¶
Check that the options set by the user to view vectors are valid.
Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [in] Mesh
DM, must be set up
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelIncrementMeshRemapState(Ratel ratel)¶
Increment the state for mesh remapping to invalidate cached data.
Not collective across MPI processes.
- Parameters:
ratel – [inout]
Ratelcontext
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelGetMeshRemapState(Ratel ratel, PetscInt *state)¶
Get the state for mesh remapping.
Not collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextstate – [out] Current mesh remapping state
- Returns:
An error code: 0 - success, otherwise - failure
-
void RatelRemapScale_inner(const PetscInt cdim, const PetscScalar x_prev[], const PetscReal t, const PetscInt num_constants, const PetscScalar constants[], PetscScalar x[])¶
Remap coordinates by scaling in a direction.
Not collective across MPI processes.
- Parameters:
cdim – [in] Coordinate dimension
x_prev – [in] Old coordinates
t – [in] Time
num_constants – [in] Number of constants, should be 6
constants – [in] Array of constants: [direction, z0, h0, hf, h_prev, h]
x – [out] New coordinates
-
void RatelRemapScale(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, const PetscReal x[], PetscInt num_constants, const PetscScalar constants[], PetscScalar f[])¶
Callback function to remap coordinates by scaling in a direction.
Not collective across MPI processes.
Note
This function signature is required by PETSc. See
RatelRemapScale_inner()for the actual remapping logic.- Parameters:
dim – [in] Solution dimension
Nf – [in] Number of fields, 1
NfAux – [in] Number of auxiliary fields, 0
uOff – [in] Offset of this point into local solution vector, [0, cdim]
uOff_x – [in] Unused
u – [in] Previous coordinates at point
u_t – [in] Unused
u_x – [in] Unused
aOff – [in] Unused
aOff_x – [in] Unused
a – [in] Unused
a_t – [in] Unused
a_x – [in] Unused
t – [in] Current time
x – [in] Unused
num_constants – [in] Number of constants, should be 6
constants – [in] Array of constants
f – [out] Remapped coordinates at points
-
PetscErrorCode RatelSetRemapScaleParametersFromOptions(Ratel ratel, DM dm)¶
Set remap scale parameters from command-line options.
Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [inout] Solution mesh
DM
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelRemapScaleCoordinates(Ratel ratel, PetscReal t, DM dm)¶
Remap coordinates by scaling in a direction.
Not collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextt – [in] Current time
dm – [inout] Solution mesh
DM, may have coordinates remapped by scaling
- Returns:
An error code: 0 - success, otherwise - failure
-
static CeedScalar RatelTransition(CeedScalar a, CeedScalar b, CeedScalar x)¶
Transition from a value of “a” for x=0, to a value of “b” for x=1.
Collective across MPI processes.
- Parameters:
a – [in] Scalar value
b – [in] Scalar value
x – [in] Scalar value
- Returns:
a + (b - a) * (x)
-
static CeedScalar RatelTransformRightBoundary_1D(CeedScalar eps, CeedScalar x)¶
1D transformation at the right boundary.
Collective across MPI processes.
- Parameters:
eps – [in] Scalar value in (0, 1]
x – [in] Scalar value
- Returns:
1D transformation at right boundary
-
static CeedScalar RatelTransformLeftBoundary_1D(CeedScalar eps, CeedScalar x)¶
1D transformation at the left boundary.
Collective across MPI processes.
- Parameters:
eps – [in] Scalar value in (0, 1]
x – [in] Scalar value
- Returns:
1D transformation at left boundary
-
PetscErrorCode RatelKershaw(DM dm, PetscScalar eps)¶
Apply 3D Kershaw mesh transformation.
Collective across MPI processes.
- Parameters:
dm – [inout]
DMPlexholding mesheps – [in] Scalar value in (0, 1]. Uniform mesh is recovered for eps=1
- Returns:
An error code: 0 - success, otherwise - failure
-
static PetscErrorCode RatelDMPlexCeedElemRestrictionDestroy(void **ctx)¶
Destroy
ElemRestrictionin aPetscContainer.Not collective across MPI processes.
- Parameters:
ctx – [inout]
CeedElemRestriction
- Returns:
An error code: 0 - success, otherwise - failure
-
static PetscErrorCode RatelDMPlexCeedBasisDestroy(void **ctx)¶
Destroy
CeedBasisin aPetscContainer.Not collective across MPI processes.
- Parameters:
ctx – [inout]
CeedBasis
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMPlexCreateFromOptions(Ratel ratel, VecType vec_type, DM *dm)¶
Read mesh and setup
DMPlexfrom options.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextvec_type – [in] Default vector type (can be changed at run-time using
-dm_vec_type)dm – [out] New distributed
DMPlex
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMSwarmClearCellIds(Ratel ratel, DM dm_swarm)¶
Clear cell IDs for a
DMSwarm.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm_swarm – [inout]
DMSwarmobject to clear the cell IDs of
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMSwarmCreateFromOptions(Ratel ratel, DM dm_mesh, DM *dm)¶
Setup
DMSwarmfrom options.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm_mesh – [out] Existing cell
DMPlexdm – [out] New distributed
DMSwarm
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMSwarmInitializePointLocations(Ratel ratel, RatelMPMOptions mpm_options, DM dm_swarm)¶
Initialize point locations for MPM using
RatelMPMOptionscontext.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextmpm_options – [in]
RatelMPMOptionscontextdm_swarm – [out]
DMSwarmto initialize point locations for
- Returns:
An error code: 0 - success, otherwise - failure
-
static PetscErrorCode RatelDMSwarmLoadField(Ratel ratel, PetscViewer binary_viewer, const char *field, DM dm)¶
Read field data for
DMSwarmfrom binary file.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextbinary_viewer – [in] Viewer to write field data to
field – [in] Field name to write
dm – [inout]
DMSwarmobject
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMSwarmLoadFromCheckpoint(Ratel ratel, RatelCheckpointData data, DM dm_swarm)¶
Load state from checkpoint file for
DMSwarm.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdata – [in]
RatelCheckpointDatacontextdm_swarm – [inout]
DMSwarmobject to load data into. Should already be initialized.
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMGetDomainISLocal(Ratel ratel, DM dm, DMLabel domain_label, PetscInt domain_value, PetscInt height, IS *is)¶
Get the index set for the domain of a given height.
Not collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [in]
DMPlexto get domain index set fromdomain_label – [in]
DMLabelfor domain stratumdomain_value – [in] Value in domain stratum
height – [in] Topological height, e.g., 0 for cells, 1 for faces
is – [out] Output index set for domain and height
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMSwarmCreateReferenceCoordinates(Ratel ratel, DM dm_swarm, DMLabel domain_label, PetscInt domain_value, CeedElemRestriction restriction_x_points_ref, CeedVector *x_points_ref)¶
DMSwarmCreateReferenceCoordinates - Compute the cell reference coordinates for local DMSwarm points.
Not collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm_swarm – [in]
DMSwarmto create reference coordinates fordomain_label – [in] DMLabel for domain in mesh
DMdomain_value – [in] Value for domain label
restriction_x_points_ref – [in] Output
CeedElemRestrictionfor reference coordinatesx_points_ref – [out] Reference coordinates for each local point
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMSwarmCeedElemRestrictionPointsCreate(Ratel ratel, DM dm_swarm, DMLabel domain_label, PetscInt domain_value, CeedElemRestriction *restriction_x_points)¶
Create a
CeedElemRestrictionfor the reference coordinates of theDMSwarmpoints.Not collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm_swarm – [in]
DMSwarmto create reference coordinates fordomain_label – [in] DMLabel for domain in mesh
DMdomain_value – [in] Value for domain label
restriction_x_points – [out] Output
CeedElemRestrictionfor reference coordinates
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMSwarmViewFromOptions(Ratel ratel, DM dm_swarm, const char option[])¶
View
DMSwarmfields from options.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm_swarm – [in]
DMSwarmto view fields fromoption – [in] View option string
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelGetSolutionMeshDM(Ratel ratel, DM *dm)¶
Get the solution mesh
DMPlex.Caller is responsible for destroying the returned
DMPlex.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [out]
DMPlexholding solution mesh
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelGetEnergyDM(Ratel ratel, DM *dm)¶
Get the energy mesh
DMPlex.Caller is responsible for destroying the returned
DMPlex.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [out]
DMPlexholding energy mesh
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMPlexCreateFaceLabel(Ratel ratel, DM dm, RatelMaterial material, PetscInt dm_face, PetscInt *num_label_values, char **face_label_name)¶
Create a label with separate values for the
FEorientations for all cells with this material for theDMPlexface.Collective across MPI processes.
- Parameters:
ratel – [inout]
Ratelcontextdm – [inout]
DMPlexholding meshmaterial – [in]
RatelMaterialto setup operators fordm_face – [in] Face number on
DMPlexnum_label_values – [out] Number of label values for newly created label
face_label_name – [out] Label name for newly created label, or
NULLif no elements match thematerialanddm_face
- Returns:
An error code: 0 - success, otherwise - failure
-
static PetscErrorCode PetscDTUniformTensorQuadrature(PetscInt dim, PetscInt num_comp, PetscInt num_points, PetscReal a, PetscReal b, PetscQuadrature *q)¶
Creates a tensor-product uniform quadrature.
This is only for comparison studies and generally should not be used.
- Parameters:
dim – [in] Spatial dimension
num_comp – [in] Number of components
num_points – [in] Number of points in one dimension
a – [in] Left end of interval (often -1)
b – [in] Right end of interval (often +1)
q – [out]
PetscQuadratureobject
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode PetscFECreateLagrangeFromOptions(MPI_Comm comm, PetscInt dim, PetscInt num_comp, PetscBool is_simplex, PetscInt order, PetscInt q_order, const char prefix[], PetscFE *fem)¶
Setup
DMwith FE space of appropriate degree.- Parameters:
comm – [in] MPI communicator
dim – [in] Spatial dimension
num_comp – [in] Number of components
is_simplex – [in] Flag for simplex or tensor product element
order – [in] Polynomial order of space
q_order – [in] Quadrature order
prefix – [in] The options prefix, or
NULLfem – [out]
PetscFEobject
- Returns:
An error code: 0 - success, otherwise - failure
-
static PetscErrorCode RatelDMFieldToDSField(Ratel ratel, DM dm, DMLabel domain_label, PetscInt dm_field, PetscInt *ds_field)¶
Convert
DMfield toDSfield.Not collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [in]
DMholding meshdomain_label – [in] Label for
DMdomaindm_field – [in] Index of
DMfieldds_field – [out] Index of
DSfield
- Returns:
An error code: 0 - success, otherwise - failure
-
static inline PetscErrorCode RatelGetClosurePermutationAndFieldOffsetAtDepth(Ratel ratel, DM dm, PetscInt depth, PetscInt field, IS *permutation, PetscInt *field_offset)¶
Get the permutation and field offset for a given depth.
Not collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [in]
DMPlexholding meshdepth – [in] Depth of
DMPlextopologyfield – [in] Index of
DMPlexfieldpermutation – [out] Permutation for
DMPlexfieldfield_offset – [out] Offset to
DMPlexfield
- Returns:
An error code: 0 - success, otherwise - failure
-
static inline PetscErrorCode RatelGetQuadratureDataP2C(Ratel ratel, PetscFE fe, PetscQuadrature quadrature, PetscInt *q_dim, PetscInt *num_comp, PetscInt *Q, CeedScalar **q_points, CeedScalar **q_weights)¶
Get quadrature data from
PetscQuadraturefor use with libCEED.Not collective across MPI processes.
Note
q_weightsandq_pointsare allocated usingPetscCalloc1and must be freed by the user.- Parameters:
ratel – [in]
Ratelcontextfe – [in]
PetscFEobjectquadrature – [in] PETSc basis quadrature
q_dim – [out] Quadrature dimension, or NULL if not needed
num_comp – [out] Number of components, or NULL if not needed
Q – [out] Number of quadrature points, or NULL if not needed
q_points – [out] Quadrature points in libCEED orientation, or NULL if not needed
q_weights – [out] Quadrature weights in libCEED orientation, or NULL if not needed
- Returns:
An error code: 0 - success, otherwise - failure
-
static inline PetscErrorCode RatelCreate1DTabulation_Tensor(Ratel ratel, PetscFE fe, PetscTabulation *tabulation, PetscReal **q_points_1d, CeedScalar **q_weights_1d)¶
Create 1D tabulation from
PetscFE.Collective across MPI processes.
Note
q_weightsandq_pointsare allocated usingPetscCalloc1and must be freed by the user.- Parameters:
ratel – [in]
Ratelcontextfe – [in] PETSc basis
FEobjecttabulation – [out] PETSc basis tabulation
q_points_1d – [out] Quadrature points in libCEED orientation
q_weights_1d – [out] Quadrature weights in libCEED orientation
- Returns:
An error code: 0 - success, otherwise - failure
-
static inline PetscErrorCode RatelComputeFieldTabulationP2C(Ratel ratel, DM dm, PetscInt field, PetscInt face, PetscTabulation tabulation, CeedScalar **interp, CeedScalar **grad)¶
Compute field tabulation from
PetscTabulation.Not collective across MPI processes.
Note
interpandgradare allocated usingPetscCalloc1and must be freed by the user.- Parameters:
ratel – [in]
Ratelcontextdm – [in]
DMPlexholding meshfield – [in] Index of
DMPlexfieldface – [in] Index of basis face, or 0
tabulation – [in] PETSc basis tabulation
interp – [out] Interpolation matrix in libCEED orientation
grad – [out] Gradient matrix in libCEED orientation
- Returns:
An error code: 0 - success, otherwise - failure
-
static inline PetscErrorCode RatelGetGlobalDMPolytopeType(Ratel ratel, DM dm, DMLabel domain_label, PetscInt label_value, PetscInt height, DMPolytopeType *cell_type)¶
Get global
DMPlextopology type.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [in]
DMPlexholding meshdomain_label – [in]
DMLabelforDMPlexdomainlabel_value – [in] Stratum value
height – [in] Height of
DMPlextopologycell_type – [out]
DMPlextopology type
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMPlexCeedBasisCreate(Ratel ratel, DM dm, DMLabel domain_label, PetscInt label_value, PetscInt height, PetscInt dm_field, CeedBasis *basis)¶
Create
CeedBasisfromDMPlex.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [in]
DMPlexholding meshdomain_label – [in]
DMLabelforDMPlexdomainlabel_value – [in] Stratum value
height – [in] Height of
DMPlextopologydm_field – [in] Index of
DMPlexfieldbasis – [out]
CeedBasisforDMPlex
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMPlexCeedBasisCoordinateCreate(Ratel ratel, DM dm, DMLabel domain_label, PetscInt label_value, PetscInt height, CeedBasis *basis)¶
Create
CeedBasisfor coordinate space ofDMPlex.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [in]
DMPlexholding meshdomain_label – [in]
DMLabelforDMPlexdomainlabel_value – [in] Stratum value
height – [in] Height of
DMPlextopologybasis – [out]
CeedBasisfor coordinate space ofDMPlex
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMPlexCeedBasisCellToFaceCreate(Ratel ratel, DM dm, DMLabel domain_label, PetscInt label_value, PetscInt face, PetscInt dm_field, CeedBasis *basis)¶
Create
CeedBasisfor cell to face quadrature space evaluation fromDMPlex.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [in]
DMPlexholding meshdomain_label – [in]
DMLabelforDMPlexdomainlabel_value – [in] Stratum value
face – [in] Index of face
dm_field – [in] Index of
DMPlexfieldbasis – [out]
CeedBasisfor cell to face evaluation
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMPlexCeedBasisCellToFaceCoordinateCreate(Ratel ratel, DM dm, DMLabel domain_label, PetscInt label_value, PetscInt face, CeedBasis *basis)¶
Create
CeedBasisfor cell to face quadrature space evaluation on coordinate space ofDMPlex.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [in]
DMPlexholding meshdomain_label – [in]
DMLabelforDMPlexdomainlabel_value – [in] Stratum value
face – [in] Index of face
basis – [out]
CeedBasisfor cell to face evaluation on coordinate space ofDMPlex
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMPlexCeedElemRestrictionCreate(Ratel ratel, DM dm, DMLabel domain_label, PetscInt label_value, PetscInt height, PetscInt dm_field, CeedElemRestriction *restriction)¶
Create
CeedElemRestrictionfromDMPlex.Not collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [in]
DMPlexholding meshdomain_label – [in]
DMLabelforDMPlexdomainlabel_value – [in] Stratum value
height – [in] Height of
DMPlextopologydm_field – [in] Index of
DMPlexfieldrestriction – [out]
CeedElemRestrictionforDMPlex
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMPlexCeedElemRestrictionCoordinateCreate(Ratel ratel, DM dm, DMLabel domain_label, PetscInt label_value, PetscInt height, CeedElemRestriction *restriction)¶
Create
CeedElemRestrictionfromDMPlexdomain for mesh coordinates.Not collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [in]
DMPlexholding meshdomain_label – [in] Label for
DMPlexdomainlabel_value – [in] Stratum value
height – [in] Height of
DMPlextopologyrestriction – [out]
CeedElemRestrictionfor mesh
- Returns:
An error code: 0 - success, otherwise - failure
-
static PetscErrorCode RatelDMPlexCeedElemRestrictionStridedCreate(Ratel ratel, DM dm, DMLabel domain_label, PetscInt label_value, PetscInt height, PetscInt dm_field, PetscInt q_data_size, PetscBool is_collocated, CeedElemRestriction *restriction)¶
Create
CeedElemRestrictionfromDMPlexdomain for auxiliaryQFunctiondata.Not collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [in]
DMPlexholding meshdomain_label – [in] Label for
DMPlexdomainlabel_value – [in] Stratum value
height – [in] Height of
DMPlextopologydm_field – [in] Index of
DMPlexfieldq_data_size – [in] Number of components for
QFunctiondatais_collocated – [in] Boolean flag indicating if the data is collocated on the nodes (
PETSC_TRUE) on on quadrature points (PETSC_FALSE)restriction – [out] Strided
CeedElemRestrictionforQFunctiondata
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMPlexCeedElemRestrictionQDataCreate(Ratel ratel, DM dm, DMLabel domain_label, PetscInt label_value, PetscInt height, PetscInt q_data_size, CeedElemRestriction *restriction)¶
Create
CeedElemRestrictionfromDMPlexdomain for auxiliaryQFunctiondata.Not collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [in]
DMPlexholding meshdomain_label – [in] Label for
DMPlexdomainlabel_value – [in] Stratum value
height – [in] Height of
DMPlextopologyq_data_size – [in] Number of components for
QFunctiondatarestriction – [out] Strided
CeedElemRestrictionforQFunctiondata
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMPlexCeedElemRestrictionCollocatedCreate(Ratel ratel, DM dm, DMLabel domain_label, PetscInt label_value, PetscInt height, PetscInt dm_field, PetscInt q_data_size, CeedElemRestriction *restriction)¶
Create
CeedElemRestrictionfromDMPlexdomain for nodally collocated auxiliaryQFunctiondata.Not collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [in]
DMPlexholding meshdomain_label – [in] Label for
DMPlexdomainlabel_value – [in] Stratum value
height – [in] Height of
DMPlextopologydm_field – [in] Index of
DMPlexfieldq_data_size – [in] Number of components for
QFunctiondatarestriction – [out] Strided
CeedElemRestrictionforQFunctiondata
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMGetFieldISLocal(Ratel ratel, DM dm, PetscInt field, PetscInt *block_size, IS *is)¶
Create index set for each local field DoF in
DM, including constrained and ghost nodes.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [in]
DMholding meshfield – [in] Field index
block_size – [out] Number of components of requested field
is – [out] Output
ISwith one index for each DoF of field
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDMHasFace(Ratel ratel, DM dm, PetscInt face_id, PetscBool *has_face)¶
Check whether a given face id exists in the “Face Sets”
DMLabel.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [in]
DMholding meshface_id – [in] Stratum value of face in “Face Sets”
DM:abelhas_face – [out]
PETSC_TRUEiffaceexists in “Face Sets”DMLabel, otherwisePETSC_FALSE
- Returns:
An error code: 0 - success, otherwise - failure
-
static PetscErrorCode RatelForcingBodyParamsFromOptions(Ratel ratel, const char *option_prefix, const char *option_message, RatelForcingBodyParams *params_forcing)¶
Set forcing parameters from command line options.
Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextoption_prefix – [in] Prefix string for command line options
option_message – [in] Message string for command line options
params_forcing – [out]
RatelForcingBodyParamsto set
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelMaterialForcingBodyDataFromOptions(RatelMaterial material, RatelForcingBodyParams *params_forcing)¶
Read user forcing vectors from options database.
Collective across MPI processes.
- Parameters:
material – [in]
RatelMaterialcontextparams_forcing – [out] Data structure to store traction data
-
PetscErrorCode RatelMaterialSetupForcingSuboperator(RatelMaterial material, CeedOperator op_residual)¶
Add forcing term to residual u term operator.
Collective across MPI processes.
- Parameters:
material – [in]
RatelMaterialcontextop_residual – [out] Composite residual u term
CeedOperatorto addRatelMaterialsub-operator
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelMaterialSetupForcingEnergySuboperator(RatelMaterial material, DM dm_energy, CeedOperator op_external_energy)¶
Add energy of forcing term to external energy operator.
Collective across MPI processes.
- Parameters:
material – [in]
RatelMaterialcontextdm_energy – [in]
DMfor external energy computationop_external_energy – [out] Composite external energy
CeedOperatorto add energy of body force sub-operator
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelCreateSubmatrix(Mat A, IS is_row, IS is_col, MatReuse reuse_submatrix, Mat *A_sub)¶
Create or return a submatrix for a given
MATCEEDcorresponding to a Jacobian matrix from Ratel.By default, this submatrix has a
MatTypeofMATCEED. TheMatTypeof the sub-matrix can be set with the command line option-ceed_field_[index]_mat_typeor-ceed_[field name]_mat_type.Collective across MPI processes.
- Parameters:
A – [in] Jacobian
MATCEEDcreated by Ratelis_row – [in] Parallel
ISfor rows of the submatrix on this processis_col – [in] Parallel
ISfor all columns of the submatrixreuse_submatrix – [in] Either
MAT_INTITIAL_MATRIXorMAT_REUSE_MATRIXA_sub – [out] Submatrix
MATCEED
- Returns:
An error code: 0 - success, otherwise - failure
-
static PetscErrorCode RatelSNESSetJacobianMats(Ratel ratel, SNES snes)¶
Set Ratel
Mats for aSNES.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextsnes – [inout] Non-linear solver
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelSNESFormResidual(SNES snes, Vec X, Vec Y, void *ctx)¶
Compute the non-linear residual for a
SNES.Collective across MPI processes.
- Parameters:
snes – [in] Non-linear solver
X – [in] Current state vector
Y – [out] Residual vector
ctx – [in]
Ratelcontext
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelSNESFormJacobian(SNES snes, Vec X, Mat J, Mat J_pre, void *ctx)¶
Assemble
SNESJacobian.Collective across MPI processes.
- Parameters:
snes – [in] Non-linear solver
X – [in] Current non-linear residual
J – [out] Jacobian operator
J_pre – [out] Jacobian operator for preconditioning
ctx – [inout] Ratel context
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelTSFormIResidual(TS ts, PetscReal time, Vec X, Vec X_t, Vec Y, void *ctx)¶
Compute the non-linear residual for a
TS.Collective across MPI processes.
- Parameters:
ts – [in] Time-stepper
time – [in] Current time
X – [in] Current state vector
X_t – [in] Time derivative of current state vector
Y – [out] Function vector
ctx – [inout]
Ratelcontext
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelTSFormIJacobian(TS ts, PetscReal time, Vec X, Vec X_t, PetscReal v, Mat J, Mat J_pre, void *ctx)¶
Assemble
TSJacobian.Collective across MPI processes.
- Parameters:
ts – [in] Time-stepper
time – [in] Current time
X – [in] Current non-linear residual
X_t – [in] Time derivative of current non-linear residual
v – [in] Shift
J – [out] Jacobian operator
J_pre – [out] Jacobian operator for preconditioning
ctx – [inout] Ratel context
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelTSFormI2Residual(TS ts, PetscReal time, Vec X, Vec X_t, Vec X_tt, Vec Y, void *ctx)¶
Compute the non-linear residual for a
TS.Collective across MPI processes.
- Parameters:
ts – [in] Time-stepper
time – [in] Current time
X – [in] Current state vector
X_t – [in] Time derivative of current state vector
X_tt – [in] Second time derivative of current state vector
Y – [out] Function vector
ctx – [inout] User context struct containing
CeedOperatordata
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelTSFormI2Jacobian(TS ts, PetscReal time, Vec X, Vec X_t, Vec X_tt, PetscReal v, PetscReal a, Mat J, Mat J_pre, void *ctx)¶
Assemble
TSJacobian.Collective across MPI processes.
- Parameters:
ts – [in] Time-stepper
time – [in] Current time
X – [in] Current non-linear residual
X_t – [in] Time derivative of current non-linear residual
X_tt – [in] Second time derivative of current non-linear residual
v – [in] Shift for X_t
a – [in] Shift for X_tt
J – [out] Jacobian operator
J_pre – [out] Jacobian operator for preconditioning
ctx – [inout] Ratel context
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelTSPreStep(TS ts)¶
Migrate from
DMSwarmtoDMPlexbeforeTSstep, if needed.Collective across MPI processes.
- Parameters:
ts – [in] Time-stepper
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelTSPreStage(TS ts, PetscScalar stage_time)¶
Callback which runs before each stage of a time-stepper.
Caches the value of ts->steprestart.
Collective across MPI processes.
- Parameters:
ts – [in]
TSobjectstage_time – [in] Current stage time (unused)
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelTSPostEvaluate(TS ts)¶
TSpost-evaluate routine to accept state values and migrate MPM points, if needed.Collective across MPI processes.
- Parameters:
ts – [in] Time-stepper
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelTSPostStep(TS ts)¶
Callback which runs after each step of a time-stepper.
Restores the cached value of ts->steprestart.
Collective across MPI processes.
- Parameters:
ts – [in]
TSobject
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelSNESFormObjective(SNES snes, Vec X, PetscReal *merit, void *ctx)¶
Compute SNES objective.
Collective across MPI processes.
- Parameters:
snes – [in] Non-linear solver
X – [in] Current state vector
merit – [out] SNES objective
ctx – [in]
Ratelcontext
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelIncrementalize(Ratel ratel, PetscBool scale_dt, CeedInt num_comp, CeedInt *num_times, CeedScalar *vectors, CeedScalar *times, RatelBCInterpolationType *interp_type)¶
Convert flexible loading values to incremental versions by differentiating vectors.
Not collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextscale_dt – [in] Should the time derivative be scaled by the time step?
num_comp – [in] Number of components in
vectorsnum_times – [inout] Length of
timesandvectorsarrays, maybe edited in-placevectors – [inout] Array of size
num_times x num_compcontaining the values of the flexible loading vectors, edited in-placetimes – [inout] Array of size
num_timescontaining the times at which the flexible loading transitions occur, edited in-placeinterp_type – [inout] Type of interpolation to use for the flexible loading vectors, edited in-place
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelGetGitVersion(const char **git_version)¶
Get output of
git describe --dirtyfrom build time.While RatelGetVersion() uniquely identifies the source code for release builds, it does not identify builds from other commits.
Not collective across MPI processes.
- Parameters:
git_version – [out] A static string containing the Git commit description. If
git describe --always --dirtyfails, the string"unknown"will be provided. This could occur if Git is not installed or if Ratel is not being built from a repository, for example.`
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelGetBuildConfiguration(const char **build_config)¶
Get build variables as a multi-line string.
Each line of the string has the format
VARNAME = value.Not collective across MPI processes.
See also
- Parameters:
build_config – [out] A static string containing build variables
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelSetupStrainEnergyEvaluator(Ratel ratel, CeedEvaluator *evaluator_strain_energy)¶
Setup
CeedEvaluatorcomputing strain energy.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextevaluator_strain_energy – [out] Computed strain energy evaluator
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelSetupExternalEnergyEvaluator(Ratel ratel, CeedEvaluator *evaluator_external_energy)¶
Setup
CeedEvaluatorcomputing external energy.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextevaluator_external_energy – [out] Computed external energy evaluator
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelSetupOutputFieldsEvaluators(Ratel ratel, KSP *ksp_output_fields_projection, CeedEvaluator *evaluator_projected_output_fields, CeedEvaluator *evaluator_dual_output_fields, CeedEvaluator *evaluator_dual_nodal_scale)¶
Setup
CeedEvaluatorcomputing model fileds.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextksp_output_fields_projection – [out]
KSPfor solving projectionevaluator_projected_output_fields – [out] Output fields projected values evaluator
evaluator_dual_output_fields – [out] Output fields dual space values evaluator
evaluator_dual_nodal_scale – [out] Output fields dual space nodal scaling evaluator
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelSetupMMSErrorEvaluator(Ratel ratel, CeedEvaluator *evaluator_mms_error)¶
Setup context computing MMS error.
Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextevaluator_mms_error – [out] MMS error computation evaluator
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelSetupSurfaceDisplacementEvaluators(Ratel ratel, CeedEvaluator evaluators_surface_displacement[])¶
Setup
CeedEvaluatorcomputing average surface displacement.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextevaluators_surface_displacement – [out] Average surface displacement computation evaluators
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelSetupFaceRestrictionNodalOperator(Ratel ratel, DM dm, PetscInt face_label_value, const char face_name[], CeedOperator *op_face_restriction)¶
Setup
CeedOperatorrestricting surface forces to specific face.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextdm – [in]
DMPlexcontaining faceface_label_value – [in] Face label value on
dmface_name – [in] Name of face
op_face_restriction – [out]
CeedOperatorrestricting values to face
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelSetupSurfaceForceEvaluator(Ratel ratel, CeedEvaluator *evaluator_surface_force, CeedEvaluator evaluators_surface_force_face[])¶
Setup
CeedEvaluatorfor computing surface forces.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextevaluator_surface_force – [out] Surface force computation evaluator
evaluators_surface_force_face – [out] Surface force face restriction evaluator
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelSetupSurfaceForceCellToFaceEvaluators(Ratel ratel, CeedEvaluator evaluators_surface_force_cell_to_face[])¶
Setup
CeedEvaluatorcomputing surface forces with cell-to-face bases.Collective across MPI processes.
- Parameters:
ratel – [in]
Ratelcontextevaluators_surface_force_cell_to_face – [out] Surface force computation evaluators
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelComputeOutputFields_Internal(Ratel ratel, Vec U, PetscReal time, Vec D)¶
Internal code for computing output fields.
Collective across MPI processes.
- Parameters:
ratel – [in]
RatelcontextU – [in] Computed solution vector
time – [in] Final time value, or
1.0forSNESsolutionD – [out] Computed output fields vector
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelComputeSurfaceForcesCellToFace_Internal(Ratel ratel, Vec U, PetscReal time, PetscScalar *surface_forces)¶
Internal routine for computing output fields on mesh faces.
Collective across MPI processes.
- Parameters:
ratel – [in]
RatelcontextU – [in] Computed solution vector
time – [in] Current time value, or
1.0forSNESsolutionsurface_forces – [out] Computed face forces
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelComputeSurfaceForces_Internal(Ratel ratel, Vec U, PetscReal time, PetscScalar *surface_forces)¶
Internal routine for computing surface forces on mesh faces.
Collective across MPI processes.
- Parameters:
ratel – [in]
RatelcontextU – [in] Computed solution vector
time – [in] Current time value, or
1.0forSNESsolutionsurface_forces – [out] Computed face forces
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelComputeSurfaceCentroids_Internal(Ratel ratel, Vec U, PetscReal time, PetscScalar *surface_centroids)¶
Internal routine for computing centroids of mesh faces.
- Parameters:
ratel – [in]
RatelcontextU – [in] Computed solution vector
time – [in] Current time value, or
1.0forSNESsolutionsurface_centroids – [out] Computed centroids
- Returns:
An error code: 0 - success, otherwise - failure
-
PetscErrorCode RatelDebugImpl256(MPI_Comm comm, PetscBool is_debug, PetscBool all_ranks, PetscInt comm_rank, const unsigned char color, const char *format, ...)¶
Print
Rateldebugging information in color.Forward RatelDebug* declarations & macros.
- Parameters:
comm – [in] MPI communicator for debugging
is_debug – [in] Boolean flag for debugging
all_ranks – [in] Boolean flag to force printing on all ranks
comm_rank – [in] MPI communicator rank
color – [in] Color to print
format – [in] Printing format
-
PetscCallCeed(ceed_, ...)
do { \
int ierr_q_; \
PetscStackUpdateLine; \
ierr_q_ = __VA_ARGS__; \
if (PetscUnlikely(ierr_q_ != CEED_ERROR_SUCCESS)) { \
const char *error_message; \
CeedGetErrorMessage(ceed_, &error_message); \
SETERRQ(PETSC_COMM_SELF, PETSC_ERR_LIB, "%s", error_message); \
} \
} while (0)
¶ Calls a libCEED function and then checks the resulting error code.
If the error code is non-zero, then a PETSc error is set with the libCEED error message.
-
RatelCallCeed(ratel, ...) PetscCallCeed((ratel->ceed), __VA_ARGS__)¶
Calls a libCEED function and then checks the resulting error code.
If the error code is non-zero, then a PETSc error is set with the libCEED error message.
-
RATEL_MAX_FORCE_INTERP_POINTS 16¶
Maximum interpolation points for user-specified forcing function.
-
RATEL_PI_DOUBLE 3.14159265358979323846¶
-
RATEL_EPSILON_DOUBLE 1e-16¶
-
RatelMax(a, b) ((a) > (b) ? (a) : (b))¶
Generic max function.
- Parameters:
a – [in] First value
b – [in] Second value
- Returns:
Maximum of both values
-
RatelMin(a, b) ((a) < (b) ? (a) : (b))¶
Generic min function.
- Parameters:
a – [in] First value
b – [in] Second value
- Returns:
Minimum of both values
-
RatelValueInInterval(value, min, max) ((value) >= (min) && (value) <= (max))¶
Check if a value is in an interval.
- Parameters:
value – [in] Value to check
min – [in] Minimum value of the interval
max – [in] Maximum value of the interval
-
FLOPS_Orient2DRobustSingle 11¶
-
FLOPS_Orient2D (3 * FLOPS_Orient2DRobustSingle)¶
-
FLOPS_dXdxwdetJ (FLOPS_MatMatMult + 9)¶
-
FLOPS_ScaledMass 9¶
-
FLOPS_Log1p 34¶
-
FLOPS_Log1pMinusx 34¶
-
FLOPS_Expm1Series 15¶
-
FLOPS_AtanSeries (15 * 2 + 2)¶
-
FLOPS_Dot3 5¶
-
FLOPS_Norm3 6¶
-
FLOPS_ScalarVecMult 3¶
-
FLOPS_VecVecAdd 3¶
-
FLOPS_VecVecVecAdd 6¶
-
FLOPS_VecVecSubtract 3¶
-
FLOPS_VecVecCross 9¶
-
FLOPS_VecOuterMult 12¶
-
FLOPS_VecVecOuterMult 18¶
-
FLOPS_ScalarMatMult 9¶
-
FLOPS_ScalarMatMultSymmetric 6¶
-
FLOPS_MatVecMult 18¶
-
FLOPS_MatTransposeVecMult 18¶
-
FLOPS_MatTrace 2¶
-
FLOPS_MatMatAdd 9¶
-
FLOPS_MatCopy 0¶
-
FLOPS_MatMatAddSymmetric 6¶
-
FLOPS_MatMatMatAddSymmetric 12¶
-
FLOPS_MatMatMatAdd (9 * 2)¶
-
FLOPS_MatDeviatoricSymmetric 6¶
-
FLOPS_MatReconstructSymmetricFromDeviatoric 6¶
-
FLOPS_MatMatMult 54¶
-
FLOPS_MatMatTransposeMult 54¶
-
FLOPS_MatMatMultPlusMatMatMult 108¶
-
FLOPS_MatMatContractSymmetric 15¶
-
FLOPS_MatDetA 14¶
-
FLOPS_JM1 29¶
-
FLOPS_J2m1m2TraceE 28¶
-
FLOPS_MatMatMultSymmetric 36¶
-
FLOPS_MatNorm 19¶
-
FLOPS_MatMatMatMultSymmetric (FLOPS_MatMatMult + 18)¶
-
FLOPS_MatMatSymmetricMatTransposeMult (FLOPS_MatMatTransposeMult + 18)¶
-
FLOPS_MatTransposeMatSymmetricMatMult (FLOPS_MatMatMult + 18)¶
-
FLOPS_MatInverse 36¶
-
FLOPS_MatInverseSymmetric 24¶
-
FLOPS_CInverse (14 + FLOPS_MatInverseSymmetric)¶
-
FLOPS_CInverse_fwd (FLOPS_MatMatMatMultSymmetric + 6)¶
-
FLOPS_LinearStrain 6¶
-
FLOPS_LinearStrain_fwd 6¶
-
FLOPS_GreenEulerStrain (FLOPS_LinearStrain + 54)¶
-
FLOPS_GreenEulerStrain_fwd 90¶
-
FLOPS_GreenLagrangeStrain (FLOPS_LinearStrain + 54)¶
-
FLOPS_GreenLagrangeStrain_fwd 90¶
-
FLOPS_LinearStress 12¶
-
FLOPS_LinearStress_fwd 12¶
-
FLOPS_MixedLinearStress 15¶
-
FLOPS_MixedLinearStress_fwd 15¶
-
FLOPS_PoromechanicsLinearStress 18¶
-
FLOPS_PoromechanicsLinearStress_fwd 18¶
-
FLOPS_OrthogonalComplement (7 + FLOPS_VecVecCross)¶
-
FLOPS_ComputeEigenvector0 (4 + 3 * FLOPS_VecVecCross + 3 * FLOPS_Dot3 + FLOPS_ScalarVecMult)¶
-
FLOPS_ComputeEigenvector1 (FLOPS_OrthogonalComplement + 2 * FLOPS_MatVecMult + 3 * FLOPS_Dot3 + 2 * FLOPS_ScalarVecMult + FLOPS_VecVecSubtract + 8)¶
-
FLOPS_MatComputeEigenValueSymmetric (FLOPS_MatTrace + 20 + 2 * FLOPS_MatDeviatoricSymmetric + FLOPS_MatMatMultSymmetric + 2 * FLOPS_MatMatAddSymmetric + 12 + 2 * FLOPS_MatNorm + 20 + \
FLOPS_AtanSeries)¶
-
FLOPS_MatComputeEigenVectorSymmetric (FLOPS_ComputeEigenvector0 + FLOPS_ComputeEigenvector1 + FLOPS_VecVecCross)¶
-
FLOPS_MatComputeEigensystemSymmetric (FLOPS_MatComputeEigenValueSymmetric + FLOPS_MatComputeEigenVectorSymmetric)¶
-
FLOPS_EigenValue_fwd (3 * FLOPS_MatVecMult + 3 * FLOPS_Dot3)¶
-
FLOPS_EigenVector_fwd (2 * FLOPS_MatVecMult + 2 * FLOPS_Dot3 + 20)¶
-
FLOPS_PrincipalStretch (9)¶
-
FLOPS_PrincipalStretch_fwd (FLOPS_EigenValue_fwd + 3)¶
-
FLOPS_EigenVectorOuterMult (3 * FLOPS_VecOuterMult)¶
-
FLOPS_EigenVectorOuterMult_fwd (3 * FLOPS_EigenVector_fwd + 6 * FLOPS_VecVecOuterMult + 3 * FLOPS_MatMatAdd)¶
-
FLOPS_VecSignum (3 + 1 + FLOPS_Norm3)¶
-
FLOPS_VecSignum_fwd (3 * 3 + 1 + FLOPS_VecSignum + FLOPS_Dot3)¶
-
FLOPS_MatFromEigensystemSymmetric (2 * FLOPS_MatMatAddSymmetric)¶
-
RATEL_output_fields_PROJECTION_SCALAR_FIELD_NAME "scalar_field"¶
-
RATEL_output_fields_PROJECTION_SCALAR_LABEL_NAME "scalar_field_label"¶
-
RATEL_output_fields_PROJECTION_SCALAR_LABEL_VALUE 42¶
-
RATEL_output_fields_PROJECTION_SCALAR_LABEL_VALUE_STRING "42"¶
-
RATEL_output_fields_PROJECTION_SCALAR_OPTION_NAME "output_fields_projection_scalar_mass_matrix"¶
-
RATEL_output_fields_PROJECTION_FULL_DIAGONAL_NAME "output_fields_projection_full_diagonal"¶
-
struct RatelLammpsPoint¶
- #include <ratel-lammps.h>
Data for a single LAMMPS point.
-
struct RatelForcingBodyParams¶
- #include <forcing.h>
User-specified forcing context.
Public Members
-
CeedScalar rho¶
Density.
-
CeedScalar acceleration[3 * RATEL_MAX_FORCE_INTERP_POINTS]¶
Acceleration vector.
-
CeedScalar times[RATEL_MAX_FORCE_INTERP_POINTS]¶
Transition times.
-
CeedInt num_times¶
Number of transition times.
-
RatelBCInterpolationType interpolation_type¶
Type of interpolation between points.
-
CeedInt num_comp¶
Number of components in field.
-
CeedScalar time¶
Current solver time.
-
CeedScalar dt¶
Current solver time step.
-
CeedScalar rho¶
-
struct RatelScaledMassParams¶
- #include <scaled-mass.h>
Scaled mass context.
Public Members
-
CeedScalar rho¶
Scaling parameter.
-
CeedInt num_fields¶
Number of fields.
-
CeedInt field_sizes[RATEL_MAX_FIELDS]¶
Number of components in each field.
-
CeedScalar rho¶
-
struct RatelPMGContext¶
- #include <ratel-pmg-impl.h>
-
struct RatelVoxel¶
- #include <ratel.h>
Voxel data for MPM.
-
struct RatelMPMStabilization¶
- #include <ratel.h>
Stabilization method for MPM.
-
struct RatelViewers¶
- #include <ratel.h>
Ratel context for wrapping a collection of
RatelViewerobjects.