Dear Anup,
The simplest explanation that I can give is that, in its original form, the
implementation of the Time class in step-44 is not suitable for your needs
and you need to adjust it accordingly. If you need to change that value of
delta_t, then you should add some function that does it for you. What have
you tried so far that has not worked so far? I've annotated what I think
you'd likely have to do here:
class Time
{
public:
Time (const double time_end,
const double delta_t) // This should now be delta_t_0
:
timestep(0),
time_current(0.0),
time_end(time_end),
delta_t(delta_t) // Needs correct initialisation value
// Need to initialise value of delta_t_0
{}
virtual ~Time()
{}
double current() const
{
return time_current;
}
double end() const
{
return time_end;
}
double get_delta_t() const
{
return delta_t;
}
// Need a new function set_delta_t that changes the timestep size
unsigned int get_timestep() const
{
return timestep;
}
void increment()
{
time_current += delta_t;
++timestep;
}
private:
unsigned int timestep;
double time_current;
const double time_end;
const double delta_t; // This should not be const, as you want to
change its value
// Need a new member delta_t_0
};
Then you'd change the timestep size by calling time.set_delta_t(/*value*/).
Regards,
J-P
On Sunday, September 4, 2016 at 1:41:39 AM UTC+2, Anup Basak wrote:
>
> Dear Jean-Paul,
>
> Thank you for your reply.
>
> I, in fact, have done that way only. I have defined the initial time step
> through .prm file. Now my question is that
> after I update my time step in the run() function how can I pass this new
> time step, say 'delta_t' to the class 'Time'
> to obtain other parameters like current_time etc.
>
> Thanks and regards,
> Anup.
>
> On Wed, Aug 31, 2016 at 12:27 AM, Jean-Paul Pelteret <> wrote:
>
>> Dear Anup,
>>
>> Why don't you reinterpret the parameter passed as "delta_t" to be the
>> initial timestep size "delta_t_0" and then adjust the current timestep size
>> "delta_t" however you want? How you do this adjustment algorithm-wise is,
>> of course, entirely up to you.
>>
>> Regards,
>> J-P
>>
>>
>> On Tuesday, August 30, 2016 at 7:02:41 PM UTC+2, Anup Basak wrote:
>>>
>>> Hello all,
>>>
>>> I was trying to implement an adaptive time step in step44. In the given
>>> example 'delta_t' has been considered to be
>>> fixed and its value is taken from the .prm file. Now let us say one
>>> changes the value of 'delta_t' in the function 'run()'.
>>> What will be the convenient way to replace old value of 'delta_t' by the
>>> new one and use it to obtain current time etc
>>> using the class 'Time'.
>>>
>>> I shall be thankful if someone can help me in this regard.
>>>
>>> Thank you,
>>>
>>> Regards,
>>> Anup.
>>>
>> --
>> The deal.II project is located at http://www.dealii.org/
>> For mailing list/forum options, see
>> https://groups.google.com/d/forum/dealii?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "deal.II User Group" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.