100 likes | 376 Views
Method of manufactured solutions. The first stage in code verification is to test for problems for which we have analytical solutions. However, often we have codes that are intended for more complex problems than we can solve analytically.
E N D
Method of manufactured solutions • The first stage in code verification is to test for problems for which we have analytical solutions. • However, often we have codes that are intended for more complex problems than we can solve analytically. • Codes typically solve differential equations for applied loadings in the form of right hand sides and boundary conditions. • If we cannot solve the differential equation for some representative loading and boundary condition, we can specify a solution, calculate the corresponding loading and boundary conditions, and use them as input to the code.
Beam example • The general equations of a beam loaded by a transverse load q(x) • We want to verify a code that solves this problem for any distribution of EI. • We can start by comparing the solution for constant EI, since for this case it is easy to obtain an analytical solution. • For example, for constant EI and constant q, integrating to obtain a quartic polynomial is very easy, and solution can be found in Mechanics of Materials textbooks.
Manufactured solution for beam • We next want to test code for varying EI, for example EI=cos(x/L) with clamped boundary conditions • Instead of specifying load and trying to find an analytical solution, we will specify the solution w=x2and calculate the load • We will now apply this load and check whether our code will produce w=x2
General procedure (V&CSC 6.3.1) • Establish the mathematical model in the form L(u)=0, where L() is the differential operator and u is the dependent variable. • Choose the analytic form of the manufactured solution um. • Operate the mathematical model L onto the manufactured solution um and obtain the analytic source term s=L(um). • Obtain the modified mathematical model by including the analytic source term L(u)=s • (Mine) check whether the code produces the manufactured solution under the action of s.
Top Hat question • You wrote a code to solve the algebraic equation cosx+7tan(ln(x))=a For a series of values of a. • What value of a will you test the code on in the spirit of manufactured solutions?
Remarks • Manufactured solutions do not need to be physically realistic, but care must be taken that they do not crash the code (e.g. square root of negative temperature). • When multiple terms appear in the equations, manufactured solutions should not make one term dominant because this will not verify the other terms. • Trigonometric and exponential functions are good for manufactured solutions because they are infinitely differentiable. • Having a manufactured solution that varies slowly will allow convergence with coarse meshes, hence inexpensive.
Example of MMS with order verification • 6.3.4.1 Steady state heat conduction • A discrete solution described in 6.3.4.1 was proven to have second order convergence, which needed to be verified for the code implementing it. • Manufactured solution that was used • What is needed to generate the manufactured solution besides the source term?
Grids • Five grids were used 9x9, 17x17, 33x33, 65x65, and 129x129 nodes. • Grids are non-uniform to cater to how fast solution is changing.
Grid convergence • Observed order of accuracy