[petsc-users] PETSc DS Auxiliary Variable Question

Matthew Knepley knepley at gmail.com
Tue May 15 20:08:47 CDT 2018


On Tue, May 15, 2018 at 8:53 PM, Robert Walker <rlwalker at usc.edu> wrote:

> OK, I may as well just say that this is something that has never been
> quite clear to me. From what it looks, the auxiliary terms tend to denote
> material properties, or similar spatial varying terms. However, judging
> from the existence of both the 'constants' vector, as well as the
> derivative vectors of the auxiliary variables with respect to time and
> space in the callback call, I am going to guess that it can be used with
> time dependent terms as well.
>

The auxiliary fields are really for FIELDS, meaning stuff discretized just
like the solution vectors, which can also be time/space dependent. For
constant properties,
use the constants[] array.


> What I am looking to do is find some way to take the gradient of a first
> temporal derivative of a variable (displacement), and access this result
> within one of the residual callback functions that provides input to
> PetscDSSetResidual. Maybe there is another way to do this (probably.) Any
> thoughts would be appreciated.
>

You are right, that is not easy. The information is there, I just have not
made a nice way to access it. It we did everything covariantly
in 4D, it would just be there. I will think about it, and get it done.
However, it will probably take me until the end of the month since
I have a bunch of proposal deadlines. You could conceivably do it yourself
using the discretization tools. Basically, you feed in the
u_t Vec to the EvaluateFieldJet() internal function, which would give
derivatives at a point.

  Thanks,

     Matt


> Robert L. Walker
> MS Petroleum Engineering
> Mork Family Department of Chemicals and Materials Sciences
> University of Southern California
> ----------------------------------------------
> Mobile US: +1 (213) - 290 -7101
> Mobile EU: +34 62 274 66 40
> rlwalker at usc.edu
>
> On Tue, May 15, 2018 at 5:25 PM, Robert Walker <rlwalker at usc.edu> wrote:
>
>> Sounds like a lovely place to look again.
>>
>> sent from an overpriced pocket calculator
>>
>> On Tue, May 15, 2018, 17:21 Matthew Knepley <knepley at gmail.com> wrote:
>>
>>> On Tue, May 15, 2018 at 8:11 PM, Robert Walker <rlwalker at usc.edu> wrote:
>>>
>>>> Hello,
>>>>
>>>> I am writing a program using PETScDS along with PETScFE and PETScTS in
>>>> a similar vein to TS examples 45 - 48. I seek to use the auxiliary
>>>> variables accessed by the pointwise functions in a manner similar to how I
>>>> understand that MOOSE handles auxiliary variables, that is that in the
>>>> following:
>>>>
>>>> f0(PetscInt <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mcs.anl.gov_petsc_petsc-2Dcurrent_docs_manualpages_Sys_PetscInt.html-23PetscInt&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=BWOpUsAp5dvI5cUiP4uZxQ&m=WqHFdWvXkjvOoNncNHem23n6BSEqrB0SuZChLaVmvtw&s=ZdjNjMAEKJBaB6tdYtlF8OtnD_BYW-T126vR8rJ60_Y&e=> dim, PetscInt <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mcs.anl.gov_petsc_petsc-2Dcurrent_docs_manualpages_Sys_PetscInt.html-23PetscInt&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=BWOpUsAp5dvI5cUiP4uZxQ&m=WqHFdWvXkjvOoNncNHem23n6BSEqrB0SuZChLaVmvtw&s=ZdjNjMAEKJBaB6tdYtlF8OtnD_BYW-T126vR8rJ60_Y&e=> Nf, PetscInt <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mcs.anl.gov_petsc_petsc-2Dcurrent_docs_manualpages_Sys_PetscInt.html-23PetscInt&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=BWOpUsAp5dvI5cUiP4uZxQ&m=WqHFdWvXkjvOoNncNHem23n6BSEqrB0SuZChLaVmvtw&s=ZdjNjMAEKJBaB6tdYtlF8OtnD_BYW-T126vR8rJ60_Y&e=> NfAux,
>>>>
>>>>    const PetscInt <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mcs.anl.gov_petsc_petsc-2Dcurrent_docs_manualpages_Sys_PetscInt.html-23PetscInt&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=BWOpUsAp5dvI5cUiP4uZxQ&m=WqHFdWvXkjvOoNncNHem23n6BSEqrB0SuZChLaVmvtw&s=ZdjNjMAEKJBaB6tdYtlF8OtnD_BYW-T126vR8rJ60_Y&e=> uOff[], const PetscInt <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mcs.anl.gov_petsc_petsc-2Dcurrent_docs_manualpages_Sys_PetscInt.html-23PetscInt&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=BWOpUsAp5dvI5cUiP4uZxQ&m=WqHFdWvXkjvOoNncNHem23n6BSEqrB0SuZChLaVmvtw&s=ZdjNjMAEKJBaB6tdYtlF8OtnD_BYW-T126vR8rJ60_Y&e=> uOff_x[], const PetscScalar <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mcs.anl.gov_petsc_petsc-2Dcurrent_docs_manualpages_Sys_PetscScalar.html-23PetscScalar&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=BWOpUsAp5dvI5cUiP4uZxQ&m=WqHFdWvXkjvOoNncNHem23n6BSEqrB0SuZChLaVmvtw&s=AvpfRlVzQ_jVV9WeiPlpWqnfqUWy23WwV8VL8b-0yrU&e=> u[], const PetscScalar <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mcs.anl.gov_petsc_petsc-2Dcurrent_docs_manualpages_Sys_PetscScalar.html-23PetscScalar&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=BWOpUsAp5dvI5cUiP4uZxQ&m=WqHFdWvXkjvOoNncNHem23n6BSEqrB0SuZChLaVmvtw&s=AvpfRlVzQ_jVV9WeiPlpWqnfqUWy23WwV8VL8b-0yrU&e=> u_t[], const PetscScalar <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mcs.anl.gov_petsc_petsc-2Dcurrent_docs_manualpages_Sys_PetscScalar.html-23PetscScalar&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=BWOpUsAp5dvI5cUiP4uZxQ&m=WqHFdWvXkjvOoNncNHem23n6BSEqrB0SuZChLaVmvtw&s=AvpfRlVzQ_jVV9WeiPlpWqnfqUWy23WwV8VL8b-0yrU&e=> u_x[],
>>>>
>>>>    const PetscInt <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mcs.anl.gov_petsc_petsc-2Dcurrent_docs_manualpages_Sys_PetscInt.html-23PetscInt&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=BWOpUsAp5dvI5cUiP4uZxQ&m=WqHFdWvXkjvOoNncNHem23n6BSEqrB0SuZChLaVmvtw&s=ZdjNjMAEKJBaB6tdYtlF8OtnD_BYW-T126vR8rJ60_Y&e=> aOff[], const PetscInt <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mcs.anl.gov_petsc_petsc-2Dcurrent_docs_manualpages_Sys_PetscInt.html-23PetscInt&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=BWOpUsAp5dvI5cUiP4uZxQ&m=WqHFdWvXkjvOoNncNHem23n6BSEqrB0SuZChLaVmvtw&s=ZdjNjMAEKJBaB6tdYtlF8OtnD_BYW-T126vR8rJ60_Y&e=> aOff_x[], const PetscScalar <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mcs.anl.gov_petsc_petsc-2Dcurrent_docs_manualpages_Sys_PetscScalar.html-23PetscScalar&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=BWOpUsAp5dvI5cUiP4uZxQ&m=WqHFdWvXkjvOoNncNHem23n6BSEqrB0SuZChLaVmvtw&s=AvpfRlVzQ_jVV9WeiPlpWqnfqUWy23WwV8VL8b-0yrU&e=> a[], const PetscScalar <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mcs.anl.gov_petsc_petsc-2Dcurrent_docs_manualpages_Sys_PetscScalar.html-23PetscScalar&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=BWOpUsAp5dvI5cUiP4uZxQ&m=WqHFdWvXkjvOoNncNHem23n6BSEqrB0SuZChLaVmvtw&s=AvpfRlVzQ_jVV9WeiPlpWqnfqUWy23WwV8VL8b-0yrU&e=> a_t[], const PetscScalar <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mcs.anl.gov_petsc_petsc-2Dcurrent_docs_manualpages_Sys_PetscScalar.html-23PetscScalar&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=BWOpUsAp5dvI5cUiP4uZxQ&m=WqHFdWvXkjvOoNncNHem23n6BSEqrB0SuZChLaVmvtw&s=AvpfRlVzQ_jVV9WeiPlpWqnfqUWy23WwV8VL8b-0yrU&e=> a_x[],
>>>>
>>>>    PetscReal <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mcs.anl.gov_petsc_petsc-2Dcurrent_docs_manualpages_Sys_PetscReal.html-23PetscReal&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=BWOpUsAp5dvI5cUiP4uZxQ&m=WqHFdWvXkjvOoNncNHem23n6BSEqrB0SuZChLaVmvtw&s=9tKMcRlCN8VCOX2wc7_KpmRHOuXOAnS4-dYYlcHvAXI&e=> t, const PetscReal <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mcs.anl.gov_petsc_petsc-2Dcurrent_docs_manualpages_Sys_PetscReal.html-23PetscReal&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=BWOpUsAp5dvI5cUiP4uZxQ&m=WqHFdWvXkjvOoNncNHem23n6BSEqrB0SuZChLaVmvtw&s=9tKMcRlCN8VCOX2wc7_KpmRHOuXOAnS4-dYYlcHvAXI&e=> x[], PetscScalar <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mcs.anl.gov_petsc_petsc-2Dcurrent_docs_manualpages_Sys_PetscScalar.html-23PetscScalar&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=BWOpUsAp5dvI5cUiP4uZxQ&m=WqHFdWvXkjvOoNncNHem23n6BSEqrB0SuZChLaVmvtw&s=AvpfRlVzQ_jVV9WeiPlpWqnfqUWy23WwV8VL8b-0yrU&e=> f0[])
>>>>
>>>>
>>>> some indices of the a[] array may hold values generated using the
>>>> primary variable values of the prior iteration, or may simply point to the
>>>> primary variables themselves.
>>>>
>>>> What is the best way to go about this? Apologies if this is either
>>>> quite obvious or has been extensively addressed before.
>>>>
>>>
>>> Not sure where I need to start. First, do you understand how the
>>> auxiliary variables are being used in SNES ex12 or ex69?
>>>
>>>   Thanks,
>>>
>>>     Matt
>>>
>>>
>>>> Thank you
>>>>
>>>>
>>>> Robert L. Walker
>>>> MS Petroleum Engineering
>>>> Mork Family Department of Chemicals and Materials Sciences
>>>> University of Southern California
>>>> ----------------------------------------------
>>>> Mobile US: +1 (213) - 290 -7101
>>>> Mobile EU: +34 62 274 66 40
>>>> rlwalker at usc.edu
>>>>
>>>
>>>
>>>
>>> --
>>> What most experimenters take for granted before they begin their
>>> experiments is infinitely more interesting than any results to which their
>>> experiments lead.
>>> -- Norbert Wiener
>>>
>>> https://www.cse.buffalo.edu/~knepley/
>>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.caam.rice.edu_-7Emk51_&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=BWOpUsAp5dvI5cUiP4uZxQ&m=WqHFdWvXkjvOoNncNHem23n6BSEqrB0SuZChLaVmvtw&s=Gti6BLze7sGAVpo0fvZMevH2ptQyOSWf_UwOK3jcxPE&e=>
>>>
>>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180515/428751ed/attachment.html>


More information about the petsc-users mailing list