Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions toolbox/+otp/+allencahn/f_diffusion.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
% Process splitting:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Steven: We need to add these functions to the problem file.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, here is an example

obj.RHSLinear = otp.RHS(@(t, y) otp.brusselator.fLinear(t, y, a, b), ...
'Jacobian', otp.brusselator.jacobianLinear(a, b), ...
'Vectorized', 'on');
obj.RHSNonlinear = otp.RHS(@(t, y) otp.brusselator.fNonlinear(t, y, a, b), ...
'Jacobian', @(t, y) otp.brusselator.jacobianNonlinear(t, y, a, b), ...
'Vectorized', 'on');

% f = f_diffusion + f_reaction
% Jacobian = Jacobian_diffusion + Jacobian_reaction
%
function du = f_diffusion(~, u, L, alpha, ~, ~)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rename to fDiffusion, we do not use underscores in OTP


du = alpha*L*u;

end
8 changes: 8 additions & 0 deletions toolbox/+otp/+allencahn/f_linear.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
% Linear-nonlinear splitting: f = f_linear + f_nonlinear
% f_linear(u) = Jac*u, f_nonlinear(u) = f(u)-Jac*u

function du = f_linear(~, u, L, alpha, beta, ~)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fLinear


du = alpha*L*u + beta * (u - 3*u.^3);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? It looks like it has nonlinear terms.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal is to create the splitting $y' = J(y) y + (f(y) - J(y) y)$ where the linear split term is $y' = J(y) y$. So this is correct given the nonlinear term $f(u) = u - u^3$.
However, we may want separate evaluation of $ J(z) y$ ( e.g. $J(y_{n}) y$) but, I think that maybe out of scope here for now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. In that case, I think the names are ok as long as it is documented. Alternatively, you could consider calling them RHSJacobian and RHSRemainder.


end
8 changes: 8 additions & 0 deletions toolbox/+otp/+allencahn/f_nonlinear.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
% Linear-nonlinear splitting: f = f_linear + f_nonlinear
% f_linear(u) = Jac*u, f_nonlinear(u) = f(u)-Jac*u

function du = f_nonlinear(t, u, ~, ~, beta, forcing)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fNonlinear


du = beta * (u - u.^3) - beta * (u - 3*u.^3) + forcing(t);

end
9 changes: 9 additions & 0 deletions toolbox/+otp/+allencahn/f_reaction.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
% Process splitting:
% f = f_diffusion + f_reaction
% Jacobian = Jacobian_diffusion + Jacobian_reaction
%
function du = f_reaction(t, u, ~, ~, beta, forcing)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fReaction


du = beta * (u - u.^3) + forcing(t);

end
9 changes: 9 additions & 0 deletions toolbox/+otp/+allencahn/jacobian_diffusion.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
% Process splitting:
% f = f_diffusion + f_reaction
% Jacobian = Jacobian_diffusion + Jacobian_reaction
%
function j = jacobian_diffusion(~, ~, L, alpha, ~, ~)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jacobianDiffusion


j = alpha*L;

end
9 changes: 9 additions & 0 deletions toolbox/+otp/+allencahn/jacobian_reaction.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
% Process splitting:
% f = f_diffusion + f_reaction
% Jacobian = Jacobian_diffusion + Jacobian_reaction
%
function j = jacobian_reaction(~, u, L, ~, beta, ~)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jacobianReaction


j = spdiags(beta * (1 - 3*u.^2), 0, size(L, 1), size(L, 2));

end
58 changes: 56 additions & 2 deletions toolboxPackaging.prj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<deployment-project plugin="plugin.toolbox" plugin-version="1.0">
<configuration name="ODE Test Problems" target="target.toolbox" target-name="Package Toolbox">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't commit this file, so please git revert this file

<configuration file="/Users/sandu/GIT/GitHub/ODE-Test-Problems/toolboxPackaging.prj" location="/Users/sandu/GIT/GitHub/ODE-Test-Problems" name="toolboxPackaging" target="target.toolbox" target-name="Package Toolbox">
<param.appname>ODE Test Problems</param.appname>
<param.authnamewatermark>Steven Roberts, Andrey A. Popov, Arash Sarshar, Adrian Sandu</param.authnamewatermark>
<param.email />
Expand All @@ -14,7 +14,7 @@
<param.products.version />
<param.platforms />
<param.guid>0970ed36-a788-484f-beca-105eecd2562a</param.guid>
<param.exclude.filters></param.exclude.filters>
<param.exclude.filters />
<param.exclude.pcodedmfiles>true</param.exclude.pcodedmfiles>
<param.examples />
<param.demosxml />
Expand Down Expand Up @@ -85,5 +85,59 @@
<fileset.depfun.included />
<fileset.depfun.excluded />
<fileset.package />
<build-deliverables>
<file location="${PROJECT_ROOT}" name="ODE Test Problems.mltbx" optional="false">/Users/sandu/GIT/GitHub/ODE-Test-Problems/ODE Test Problems.mltbx</file>
</build-deliverables>
<workflow />
<matlab>
<root>/Applications/MATLAB_R2024b.app</root>
<toolboxes>
<toolbox name="matlabcoder" />
<toolbox name="embeddedcoder" />
<toolbox name="fixedpoint" />
<toolbox name="matlabhdlcoder" />
<toolbox name="neuralnetwork" />
</toolboxes>
<toolbox>
<matlabcoder>
<enabled>true</enabled>
</matlabcoder>
</toolbox>
<toolbox>
<embeddedcoder>
<enabled>true</enabled>
</embeddedcoder>
</toolbox>
<toolbox>
<fixedpoint>
<enabled>true</enabled>
</fixedpoint>
</toolbox>
<toolbox>
<matlabhdlcoder>
<enabled>true</enabled>
</matlabhdlcoder>
</toolbox>
<toolbox>
<neuralnetwork>
<enabled>true</enabled>
</neuralnetwork>
</toolbox>
</matlab>
<platform>
<unix>true</unix>
<mac>true</mac>
<windows>false</windows>
<win2k>false</win2k>
<winxp>false</winxp>
<vista>false</vista>
<linux>false</linux>
<solaris>false</solaris>
<osver>15.5</osver>
<os32>true</os32>
<os64>false</os64>
<arch>maci64</arch>
<matlab>true</matlab>
</platform>
</configuration>
</deployment-project>
Loading