Mercurial > repos > public > sbplib
changeset 744:94bd0f3293c8 feature/grids
SBPInTimeSecondOrderForm: Scale the system acording to C by default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 28 Mar 2018 12:47:53 +0200 |
parents | 87436a107d8a |
children | 00eb5db89da5 |
files | +time/SBPInTimeSecondOrderFormImplicit.m |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
diff -r 87436a107d8a -r 94bd0f3293c8 +time/SBPInTimeSecondOrderFormImplicit.m --- a/+time/SBPInTimeSecondOrderFormImplicit.m Tue Mar 20 14:43:04 2018 +0100 +++ b/+time/SBPInTimeSecondOrderFormImplicit.m Wed Mar 28 12:47:53 2018 +0200 @@ -14,11 +14,12 @@ % Solves A*u_tt + B*u_t + C*u = f(t) % A, B can either both be constants or both be function handles, % They can also be omitted by setting them equal to the empty matrix. - function obj = SBPInTimeSecondOrderFormImplicit(A, B, C, f, k, t0, v0, v0t, TYPE, order, blockSize) + function obj = SBPInTimeSecondOrderFormImplicit(A, B, C, f, k, t0, v0, v0t, do_scaling, TYPE, order, blockSize) default_arg('f', []); default_arg('TYPE', []); default_arg('order', []); default_arg('blockSize',[]); + default_arg('do_scaling', true); m = length(v0); @@ -56,7 +57,12 @@ obj.t = t0; obj.n = 0; - obj.firstOrderTimeStepper = time.SBPInTimeImplicitFormulation(obj.AA, obj.BB, obj.ff, obj.k, obj.t, w0, TYPE, order, blockSize); + if do_scaling + scaling = [ones(m,1); sqrt(diag(C))]; + obj.firstOrderTimeStepper = time.SBPInTimeScaled(obj.AA, obj.BB, obj.ff, obj.k, obj.t, w0, scaling, TYPE, order, blockSize); + else + obj.firstOrderTimeStepper = time.SBPInTimeImplicitFormulation(obj.AA, obj.BB, obj.ff, obj.k, obj.t, w0, TYPE, order, blockSize); + end end function [v,t] = getV(obj)