Re: [petsc-users] TS_SSP implementation for co-dependent variables

2019-10-23 Thread Jed Brown via petsc-users
Manuel Valera  writes:

> Yes, all of that sounds correct to me,
>
> No I haven't tried embedding the column integral into the RHS, right now I
> am unable to think how to do this without the solution of the previous
> intermediate stage. Any ideas are welcome,

Do you have some technical notes on your present formulation?  I think
it just amounts to performing the integration and then evaluating the
differential operator using results of that integral.

> Thanks,
>
> On Wed, Oct 9, 2019 at 4:18 PM Jed Brown  wrote:
>
>> Manuel Valera  writes:
>>
>> > Sorry, I don't follow this last email, my spatial discretization is
>> fixed,
>> > the problem is caused by the choice of vertical coordinate, in this case
>> > sigma, that calls for an integration of the hydrostatic pressure to
>> correct
>> > for the right velocities.
>>
>> Ah, fine.  To phrase this differently, you are currently solving an
>> integro-differential equation.  With an explicit integrator, you should
>> be able to embed that in the RHS function.  With an implicit integrator,
>> that causes the Jacobian to lose sparsity (the column integral is dense
>> coupling) so it's sometimes preferable to add pressure as an explicit
>> variable (or transform your existing variable set as part of a
>> preconditioner), in which case you get a differential algebraic equation
>> (the incompressible limit).
>>
>> Have you tried embedding the column integral into the RHS function to
>> make a single unsplit formulation?
>>
>> >  I had RK3 working before and SSP is much more stable, i can use way
>> bigger
>> > DTs but then i get this asynchronous time integration. With RK3 I can
>> > operate in the intermediate states and thus I can advance everything in
>> > synchronization, but bigger DTs are not viable, it turns unstable
>> quickly.
>> >
>> > On Wed, Oct 9, 2019 at 3:58 PM Jed Brown  wrote:
>> >
>> >> Is it a problem with the spatial discretization or with the time
>> >> discretization that you've been using thus far?  (This sort of problem
>> >> can occur for either reason.)
>> >>
>> >> Note that an SSP method is merely "preserving" -- the spatial
>> >> discretization needs to be strongly stable for an SSP method to preserve
>> >> it.  It sounds like yours is not, so maybe there is no particular
>> >> benefit to using SSP over any other method (but likely tighter time step
>> >> restriction).
>> >>
>> >> Manuel Valera  writes:
>> >>
>> >> > To correct for the deformation of the sigma coordinate grid... without
>> >> this
>> >> > correction the velocity become unphysical in the zones of high slope
>> of
>> >> the
>> >> > grid. This is very specific of our model and probably will be solved
>> by
>> >> > updating the equations transformation, but that's not nearly close to
>> >> > happening right now.
>> >> >
>> >> > On Wed, Oct 9, 2019 at 3:47 PM Jed Brown  wrote:
>> >> >
>> >> >> Manuel Valera  writes:
>> >> >>
>> >> >> > Thanks,
>> >> >> >
>> >> >> > My time integration schemes are all explicit, sorry if this a very
>> >> >> atypical
>> >> >> > setup. This is similar to the barotropic splitting but not
>> exactly, we
>> >> >> > don't have free surface in the model, this is only to correct for
>> >> sigma
>> >> >> > coordinates deformations in the velocity field.
>> >> >> >
>> >> >> > From how i see it this could be solved by obtaining the
>> intermediate
>> >> >> stages
>> >> >> > and then updating them accordingly, is this not possible to do ?
>> >> >>
>> >> >> Why are you splitting if all components are explicit and not
>> subcycled?
>> >> >>
>> >>
>>


Re: [petsc-users] TS_SSP implementation for co-dependent variables

2019-10-09 Thread Manuel Valera via petsc-users
Yes, all of that sounds correct to me,

No I haven't tried embedding the column integral into the RHS, right now I
am unable to think how to do this without the solution of the previous
intermediate stage. Any ideas are welcome,

Thanks,

On Wed, Oct 9, 2019 at 4:18 PM Jed Brown  wrote:

> Manuel Valera  writes:
>
> > Sorry, I don't follow this last email, my spatial discretization is
> fixed,
> > the problem is caused by the choice of vertical coordinate, in this case
> > sigma, that calls for an integration of the hydrostatic pressure to
> correct
> > for the right velocities.
>
> Ah, fine.  To phrase this differently, you are currently solving an
> integro-differential equation.  With an explicit integrator, you should
> be able to embed that in the RHS function.  With an implicit integrator,
> that causes the Jacobian to lose sparsity (the column integral is dense
> coupling) so it's sometimes preferable to add pressure as an explicit
> variable (or transform your existing variable set as part of a
> preconditioner), in which case you get a differential algebraic equation
> (the incompressible limit).
>
> Have you tried embedding the column integral into the RHS function to
> make a single unsplit formulation?
>
> >  I had RK3 working before and SSP is much more stable, i can use way
> bigger
> > DTs but then i get this asynchronous time integration. With RK3 I can
> > operate in the intermediate states and thus I can advance everything in
> > synchronization, but bigger DTs are not viable, it turns unstable
> quickly.
> >
> > On Wed, Oct 9, 2019 at 3:58 PM Jed Brown  wrote:
> >
> >> Is it a problem with the spatial discretization or with the time
> >> discretization that you've been using thus far?  (This sort of problem
> >> can occur for either reason.)
> >>
> >> Note that an SSP method is merely "preserving" -- the spatial
> >> discretization needs to be strongly stable for an SSP method to preserve
> >> it.  It sounds like yours is not, so maybe there is no particular
> >> benefit to using SSP over any other method (but likely tighter time step
> >> restriction).
> >>
> >> Manuel Valera  writes:
> >>
> >> > To correct for the deformation of the sigma coordinate grid... without
> >> this
> >> > correction the velocity become unphysical in the zones of high slope
> of
> >> the
> >> > grid. This is very specific of our model and probably will be solved
> by
> >> > updating the equations transformation, but that's not nearly close to
> >> > happening right now.
> >> >
> >> > On Wed, Oct 9, 2019 at 3:47 PM Jed Brown  wrote:
> >> >
> >> >> Manuel Valera  writes:
> >> >>
> >> >> > Thanks,
> >> >> >
> >> >> > My time integration schemes are all explicit, sorry if this a very
> >> >> atypical
> >> >> > setup. This is similar to the barotropic splitting but not
> exactly, we
> >> >> > don't have free surface in the model, this is only to correct for
> >> sigma
> >> >> > coordinates deformations in the velocity field.
> >> >> >
> >> >> > From how i see it this could be solved by obtaining the
> intermediate
> >> >> stages
> >> >> > and then updating them accordingly, is this not possible to do ?
> >> >>
> >> >> Why are you splitting if all components are explicit and not
> subcycled?
> >> >>
> >>
>


Re: [petsc-users] TS_SSP implementation for co-dependent variables

2019-10-09 Thread Jed Brown via petsc-users
Manuel Valera  writes:

> Sorry, I don't follow this last email, my spatial discretization is fixed,
> the problem is caused by the choice of vertical coordinate, in this case
> sigma, that calls for an integration of the hydrostatic pressure to correct
> for the right velocities.

Ah, fine.  To phrase this differently, you are currently solving an
integro-differential equation.  With an explicit integrator, you should
be able to embed that in the RHS function.  With an implicit integrator,
that causes the Jacobian to lose sparsity (the column integral is dense
coupling) so it's sometimes preferable to add pressure as an explicit
variable (or transform your existing variable set as part of a
preconditioner), in which case you get a differential algebraic equation
(the incompressible limit).

Have you tried embedding the column integral into the RHS function to
make a single unsplit formulation?

>  I had RK3 working before and SSP is much more stable, i can use way bigger
> DTs but then i get this asynchronous time integration. With RK3 I can
> operate in the intermediate states and thus I can advance everything in
> synchronization, but bigger DTs are not viable, it turns unstable quickly.
>
> On Wed, Oct 9, 2019 at 3:58 PM Jed Brown  wrote:
>
>> Is it a problem with the spatial discretization or with the time
>> discretization that you've been using thus far?  (This sort of problem
>> can occur for either reason.)
>>
>> Note that an SSP method is merely "preserving" -- the spatial
>> discretization needs to be strongly stable for an SSP method to preserve
>> it.  It sounds like yours is not, so maybe there is no particular
>> benefit to using SSP over any other method (but likely tighter time step
>> restriction).
>>
>> Manuel Valera  writes:
>>
>> > To correct for the deformation of the sigma coordinate grid... without
>> this
>> > correction the velocity become unphysical in the zones of high slope of
>> the
>> > grid. This is very specific of our model and probably will be solved by
>> > updating the equations transformation, but that's not nearly close to
>> > happening right now.
>> >
>> > On Wed, Oct 9, 2019 at 3:47 PM Jed Brown  wrote:
>> >
>> >> Manuel Valera  writes:
>> >>
>> >> > Thanks,
>> >> >
>> >> > My time integration schemes are all explicit, sorry if this a very
>> >> atypical
>> >> > setup. This is similar to the barotropic splitting but not exactly, we
>> >> > don't have free surface in the model, this is only to correct for
>> sigma
>> >> > coordinates deformations in the velocity field.
>> >> >
>> >> > From how i see it this could be solved by obtaining the intermediate
>> >> stages
>> >> > and then updating them accordingly, is this not possible to do ?
>> >>
>> >> Why are you splitting if all components are explicit and not subcycled?
>> >>
>>


Re: [petsc-users] TS_SSP implementation for co-dependent variables

2019-10-09 Thread Manuel Valera via petsc-users
Sorry, I don't follow this last email, my spatial discretization is fixed,
the problem is caused by the choice of vertical coordinate, in this case
sigma, that calls for an integration of the hydrostatic pressure to correct
for the right velocities.

 I had RK3 working before and SSP is much more stable, i can use way bigger
DTs but then i get this asynchronous time integration. With RK3 I can
operate in the intermediate states and thus I can advance everything in
synchronization, but bigger DTs are not viable, it turns unstable quickly.

On Wed, Oct 9, 2019 at 3:58 PM Jed Brown  wrote:

> Is it a problem with the spatial discretization or with the time
> discretization that you've been using thus far?  (This sort of problem
> can occur for either reason.)
>
> Note that an SSP method is merely "preserving" -- the spatial
> discretization needs to be strongly stable for an SSP method to preserve
> it.  It sounds like yours is not, so maybe there is no particular
> benefit to using SSP over any other method (but likely tighter time step
> restriction).
>
> Manuel Valera  writes:
>
> > To correct for the deformation of the sigma coordinate grid... without
> this
> > correction the velocity become unphysical in the zones of high slope of
> the
> > grid. This is very specific of our model and probably will be solved by
> > updating the equations transformation, but that's not nearly close to
> > happening right now.
> >
> > On Wed, Oct 9, 2019 at 3:47 PM Jed Brown  wrote:
> >
> >> Manuel Valera  writes:
> >>
> >> > Thanks,
> >> >
> >> > My time integration schemes are all explicit, sorry if this a very
> >> atypical
> >> > setup. This is similar to the barotropic splitting but not exactly, we
> >> > don't have free surface in the model, this is only to correct for
> sigma
> >> > coordinates deformations in the velocity field.
> >> >
> >> > From how i see it this could be solved by obtaining the intermediate
> >> stages
> >> > and then updating them accordingly, is this not possible to do ?
> >>
> >> Why are you splitting if all components are explicit and not subcycled?
> >>
>


Re: [petsc-users] TS_SSP implementation for co-dependent variables

2019-10-09 Thread Jed Brown via petsc-users
Is it a problem with the spatial discretization or with the time
discretization that you've been using thus far?  (This sort of problem
can occur for either reason.)

Note that an SSP method is merely "preserving" -- the spatial
discretization needs to be strongly stable for an SSP method to preserve
it.  It sounds like yours is not, so maybe there is no particular
benefit to using SSP over any other method (but likely tighter time step
restriction).

Manuel Valera  writes:

> To correct for the deformation of the sigma coordinate grid... without this
> correction the velocity become unphysical in the zones of high slope of the
> grid. This is very specific of our model and probably will be solved by
> updating the equations transformation, but that's not nearly close to
> happening right now.
>
> On Wed, Oct 9, 2019 at 3:47 PM Jed Brown  wrote:
>
>> Manuel Valera  writes:
>>
>> > Thanks,
>> >
>> > My time integration schemes are all explicit, sorry if this a very
>> atypical
>> > setup. This is similar to the barotropic splitting but not exactly, we
>> > don't have free surface in the model, this is only to correct for sigma
>> > coordinates deformations in the velocity field.
>> >
>> > From how i see it this could be solved by obtaining the intermediate
>> stages
>> > and then updating them accordingly, is this not possible to do ?
>>
>> Why are you splitting if all components are explicit and not subcycled?
>>


Re: [petsc-users] TS_SSP implementation for co-dependent variables

2019-10-09 Thread Manuel Valera via petsc-users
To correct for the deformation of the sigma coordinate grid... without this
correction the velocity become unphysical in the zones of high slope of the
grid. This is very specific of our model and probably will be solved by
updating the equations transformation, but that's not nearly close to
happening right now.

On Wed, Oct 9, 2019 at 3:47 PM Jed Brown  wrote:

> Manuel Valera  writes:
>
> > Thanks,
> >
> > My time integration schemes are all explicit, sorry if this a very
> atypical
> > setup. This is similar to the barotropic splitting but not exactly, we
> > don't have free surface in the model, this is only to correct for sigma
> > coordinates deformations in the velocity field.
> >
> > From how i see it this could be solved by obtaining the intermediate
> stages
> > and then updating them accordingly, is this not possible to do ?
>
> Why are you splitting if all components are explicit and not subcycled?
>


Re: [petsc-users] TS_SSP implementation for co-dependent variables

2019-10-09 Thread Manuel Valera via petsc-users
Thanks,

My time integration schemes are all explicit, sorry if this a very atypical
setup. This is similar to the barotropic splitting but not exactly, we
don't have free surface in the model, this is only to correct for sigma
coordinates deformations in the velocity field.

>From how i see it this could be solved by obtaining the intermediate stages
and then updating them accordingly, is this not possible to do ?



On Wed, Oct 9, 2019 at 3:40 PM Jed Brown  wrote:

> Manuel Valera  writes:
>
> > Thanks for the answer, I will read the mentioned example, but to clarify
> > for Barry I will schematize the process:
> >
> > At time n, the program need to do all of these at once:
> >
> >1. Solve T as a function of u,v,w
> >2. Solve S as a function of u,v,w
> >3. Solve rho density as a function of T,S
> >4. Derivate a correction of the velocity fields from the density
> >5. Solve u,v,w being corrected by the density field
> >
> > What I have implemented so far:
> >
> >1. Advance TS1 to solve for T
> >2. Advance TS2 to solve for S
> >3. Solve rho and calculate correction
> >4. Advance TS3 to solve for u,v,w
> >
> > Or, altenatively:
> >
> >1. Advance TS to solve for T,S,u,v,w at the same time.
> >2. Solve rho and calculate correction
> >
> > Both implementation are lacking the feedback from the T,S <-> rho <->
> > Velocities interaction, and is creating problems when using a bigger DT.
> >
> > All the systems from the first numeration are different algorithms, and
> > each TS in the 2nd numeration generate a different RHS.
> >
> > What Jed is suggesting is to create an overarching routine that does all
> > that is the first list under one single step?
>
> TSSSP isn't SSP or high order with ad-hoc coupling procedures such as
> the above.  If you're in a parameter regime that is stiff (e.g., typical
> regime in which barotropic splitting is popular), I would suggest
> putting the semi-implicit component into a preconditioner or
> Rosenbrock-W Jacobian approximation so that you can preserve the
> desirable accuracy and stability properties of the method.
>


Re: [petsc-users] TS_SSP implementation for co-dependent variables

2019-10-09 Thread Jed Brown via petsc-users
Manuel Valera  writes:

> Thanks,
>
> My time integration schemes are all explicit, sorry if this a very atypical
> setup. This is similar to the barotropic splitting but not exactly, we
> don't have free surface in the model, this is only to correct for sigma
> coordinates deformations in the velocity field.
>
> From how i see it this could be solved by obtaining the intermediate stages
> and then updating them accordingly, is this not possible to do ?

Why are you splitting if all components are explicit and not subcycled?


Re: [petsc-users] TS_SSP implementation for co-dependent variables

2019-10-09 Thread Jed Brown via petsc-users
Manuel Valera  writes:

> Thanks for the answer, I will read the mentioned example, but to clarify
> for Barry I will schematize the process:
>
> At time n, the program need to do all of these at once:
>
>1. Solve T as a function of u,v,w
>2. Solve S as a function of u,v,w
>3. Solve rho density as a function of T,S
>4. Derivate a correction of the velocity fields from the density
>5. Solve u,v,w being corrected by the density field
>
> What I have implemented so far:
>
>1. Advance TS1 to solve for T
>2. Advance TS2 to solve for S
>3. Solve rho and calculate correction
>4. Advance TS3 to solve for u,v,w
>
> Or, altenatively:
>
>1. Advance TS to solve for T,S,u,v,w at the same time.
>2. Solve rho and calculate correction
>
> Both implementation are lacking the feedback from the T,S <-> rho <->
> Velocities interaction, and is creating problems when using a bigger DT.
>
> All the systems from the first numeration are different algorithms, and
> each TS in the 2nd numeration generate a different RHS.
>
> What Jed is suggesting is to create an overarching routine that does all
> that is the first list under one single step?

TSSSP isn't SSP or high order with ad-hoc coupling procedures such as
the above.  If you're in a parameter regime that is stiff (e.g., typical
regime in which barotropic splitting is popular), I would suggest
putting the semi-implicit component into a preconditioner or
Rosenbrock-W Jacobian approximation so that you can preserve the
desirable accuracy and stability properties of the method.


Re: [petsc-users] TS_SSP implementation for co-dependent variables

2019-10-09 Thread Manuel Valera via petsc-users
Thanks for the answer, I will read the mentioned example, but to clarify
for Barry I will schematize the process:

At time n, the program need to do all of these at once:

   1. Solve T as a function of u,v,w
   2. Solve S as a function of u,v,w
   3. Solve rho density as a function of T,S
   4. Derivate a correction of the velocity fields from the density
   5. Solve u,v,w being corrected by the density field

What I have implemented so far:

   1. Advance TS1 to solve for T
   2. Advance TS2 to solve for S
   3. Solve rho and calculate correction
   4. Advance TS3 to solve for u,v,w

Or, altenatively:

   1. Advance TS to solve for T,S,u,v,w at the same time.
   2. Solve rho and calculate correction

Both implementation are lacking the feedback from the T,S <-> rho <->
Velocities interaction, and is creating problems when using a bigger DT.

All the systems from the first numeration are different algorithms, and
each TS in the 2nd numeration generate a different RHS.

What Jed is suggesting is to create an overarching routine that does all
that is the first list under one single step?

Thanks,










On Wed, Oct 9, 2019 at 3:24 PM Jed Brown  wrote:

> Manuel Valera via petsc-users  writes:
>
> > Hello,
> >
> > I have a set of equations which are co-dependent when integrating in
> time,
> > this means the velocities u,v,w need a component from the Temperature and
> > Salinity integration at the same intermediate step. Same for Temperature
> > and Salinity, which need the current velocities (at the intermediate time
> > stages) to be computed accurately.
>
> There's nothing special about having different fields.  Just evaluate
> the RHS function of the coupled system.  There are examples (e.g.,
> ts/examples/tutorials/ex9.c) of doing this for systems like shallow
> water (momentum coupled with thickness).
>
> > My question is, how to feed the information of the updated temperature
> > inside the velocity, and vice-versa? this would be equivalent, I think,
> to
> > obtaining the intermediate stages of the time integration so they can be
> > the input for the next intermediate stage.
> >
> > Thanks,
>


Re: [petsc-users] TS_SSP implementation for co-dependent variables

2019-10-09 Thread Jed Brown via petsc-users
Manuel Valera via petsc-users  writes:

> Hello,
>
> I have a set of equations which are co-dependent when integrating in time,
> this means the velocities u,v,w need a component from the Temperature and
> Salinity integration at the same intermediate step. Same for Temperature
> and Salinity, which need the current velocities (at the intermediate time
> stages) to be computed accurately.

There's nothing special about having different fields.  Just evaluate
the RHS function of the coupled system.  There are examples (e.g.,
ts/examples/tutorials/ex9.c) of doing this for systems like shallow
water (momentum coupled with thickness).

> My question is, how to feed the information of the updated temperature
> inside the velocity, and vice-versa? this would be equivalent, I think, to
> obtaining the intermediate stages of the time integration so they can be
> the input for the next intermediate stage.
>
> Thanks,


Re: [petsc-users] TS_SSP implementation for co-dependent variables

2019-10-09 Thread Smith, Barry F. via petsc-users


 
  How are you integrating the two sets of variables now? 

 Would it be possible to just integrate all five variables together and not 
have any of these difficulties? 
  
  Barry



> On Oct 9, 2019, at 6:03 PM, Manuel Valera via petsc-users 
>  wrote:
> 
> Hello,
> 
> I have a set of equations which are co-dependent when integrating in time, 
> this means the velocities u,v,w need a component from the Temperature and 
> Salinity integration at the same intermediate step. Same for Temperature and 
> Salinity, which need the current velocities (at the intermediate time stages) 
> to be computed accurately.
> 
> My question is, how to feed the information of the updated temperature inside 
> the velocity, and vice-versa? this would be equivalent, I think, to obtaining 
> the intermediate stages of the time integration so they can be the input for 
> the next intermediate stage. 
> 
> Thanks,



[petsc-users] TS_SSP implementation for co-dependent variables

2019-10-09 Thread Manuel Valera via petsc-users
Hello,

I have a set of equations which are co-dependent when integrating in time,
this means the velocities u,v,w need a component from the Temperature and
Salinity integration at the same intermediate step. Same for Temperature
and Salinity, which need the current velocities (at the intermediate time
stages) to be computed accurately.

My question is, how to feed the information of the updated temperature
inside the velocity, and vice-versa? this would be equivalent, I think, to
obtaining the intermediate stages of the time integration so they can be
the input for the next intermediate stage.

Thanks,