FEATool Multiphysics
v1.16.1
Finite Element Analysis Toolbox

This is an example showing how to define a custom PDE equation model in the FEATool Multiphysics. In this case the BlackScholes model equation, which is used in financial analytics to model derivatives and options pricing. The nonlinear partial differential equation to be solved reads
\[ \frac{\partial u}{\partial t}  \frac{\partial}{\partial x}(\frac{1}{2}\frac{\partial u}{\partial x})  \frac{\partial u}{\partial x} = u + ( (xt)^5  10(xt)^4  10(xt)^3) \]
with boundary conditions u(0,t) = t^5 and u(x,t) = (xt)^5 on the left and right sides of the domain, respectively. The problem is timedependent with initial condition is u(x,t=0) = x^5. For this problem an exact analytical solution exists, u(x,t) = (xt)^5, which can be used to verify the computed solution. See the Custom Equation section for details on the equation syntax.
This model is available as an automated tutorial by selecting Model Examples and Tutorials... > Classic PDE > BlackScholes Equation from the File menu, viewed as a videotutorial", or alternatively, follow the stepbystep instructions below.
Select the Custom Equation physics mode from the Select Physics dropdown menu.
Press OK to finish and close the dialog box.
Press the Generate button to call the grid generation algorithm.
Enter u'  1/2*ux_x  ux_t + u_t = (xt)^5  10*(xt)^4  10*(xt)^3
into the Equation for u edit field.
Enter x^5
into the Initial condition for u edit field.
The values at the two boundaries should be set to t^5
minus t to the power of 5, at the left boundary, and (1t)^5
to the right, where t
represents time.
Enter t^5
into the Dirichlet/Neumann coefficient edit field.
Enter (1t)^5
into the Dirichlet/Neumann coefficient edit field.
Select TimeDependent from the Solution and solver type dropdown menu.
Press the Solve button.
To visualize the difference between the computed and exact analytical solution, open the Plot Options and postprocessing settings dialog box and enter the expression u  (xt)^5
in the edit field for the Surface Plot expression.
Enter 0 1 5e3 5e3
into the edit field for the Axis limits (for the xmin, xmax, ymin, and ymax limits).
Press OK to finish and close the dialog box.
One can now clearly see that the maximum error has a magnitude of 0.002 around x = 0.25, which can be improved further by using a finer grid and smaller time steps.
The blackscholes equation classic pde model has now been completed and can be saved as a binary (.fea) model file, or exported as a programmable MATLAB mscript text file (available as the example ex_custom_equation1 script file), or GUI script (.fes) file.