diff --git a/PotentialFlow/magnus.pro b/PotentialFlow/magnus.pro index c2597cf817c48419aa7eb5bd7de2cf9dc58786a9..8a45487029c4658de826e02883cd350e16ce01be 100644 --- a/PotentialFlow/magnus.pro +++ b/PotentialFlow/magnus.pro @@ -1,11 +1,13 @@ /* ------------------------------------------------------------------- - Tutorial 6 : Potential flow, lift and Magnus effect + Tutorial 6 : Potential flow and Magnus effect Features: - - Potential flow, irrotational flow, lift and Magnus effect + - Potential flow, irrotational flow - Multivalued scalar field - - Non-linear iteration on an Associated global quantity - - Use a run-time variable in a Post-Operation + - Lift and Magnus effect, stagnation points + - Run-time variables + - Elementary algorithms in the Resolution section + - Non-linear iteration to achieve Kutta's condition To compute the solution in a terminal: getdp magnus.pro -solve PotentialFlow -pos PotentialFlow @@ -89,8 +91,6 @@ f(V) = argVTrail[ {d phi } ] OnPoint {1.0001,0,0} comes below a fixed tolerance. - - */ Include "magnus_common.pro"; @@ -244,12 +244,22 @@ Resolution{ Generate[A]; Solve[A]; SaveSolution[A]; Else - // Pseudo-Newton iteration to determine Dmdt in the Airfoil case. + // A resolution can contain elementary algorithms. + // Available commands are: + // Evaluate[] : affectation of a run-time variable + // Test[]{}{} : logical test + // While[]{} : iteration + // Print[{}, Format ..., File ...] : formatted display + + // A pseudo-Newton iteration is implemented here + // to determine the value of Dmdt (in the Airfoil case) + // that verifies Kutta's condition. // The run-time variable $newDmdt is used in Generate[A] // whereas $circ, $dmdt, $argV and $phiTrailing are evaluated // by the PostOperation[Trailing]. - // A file containing "PhiTrailing = $phiTrailing;" is after all - // written on disk to be used for formatting the + // A file containing "PhiTrailing = $phiTrailing;" is + // after convergence written on disk to be used + // for formatting purposes in the PostOperation section. DeleteFile["KJiter.txt"]; @@ -265,11 +275,9 @@ Resolution{ Format "iter = %3g Circ = %5.2f Dmdt = %5.2f argV = %5.2e"]; While[ Norm[ $argV ] > 1e-3 && $syscount < 50] { - Test[ $syscount && Norm[$argV-$argVp] > 1e-3 ] {Evaluate[$jac = Min[ ($dmdt-$dmdtp)/($argV-$argVp), 0.2 ] ] ;} {Evaluate[$jac = 0.2];} - Print[{$jac}, Format "Jac = %7.5e"]; Evaluate[$newDmdt = $dmdt - $jac * $argV]; Evaluate[ $syscount = $syscount + 1 ]; @@ -371,10 +379,10 @@ PostOperation{ Print[normVelocity, OnElementsOf Vol_rho, File "p.pos"]; Echo[ Str["l=PostProcessing.NbViews-1;", "View[l].Name = 'stagnation points';", - "View[l].ScaleType = 2;"], + "View[l].ScaleType = 2; // log scale"], File "tmp.geo", LastTimeStepOnly] ; - // Show the isovalue phi=$PhiTrailing + // Show the isovalue "phi=$PhiTrailing" // which should be perpendicular to the airfoil // if the Kutta condition is fulfilled Print[phi, OnElementsOf Vol_rho, File "KJ.pos"]; @@ -382,8 +390,8 @@ PostOperation{ "l=PostProcessing.NbViews-1;", "View[l].Name = 'isovalue phiTrailing';", "View[l].IntervalsType = 3;", - "Mesh.SurfaceEdges = 0;", - "View[l].RangeType = 2;", + "Mesh.SurfaceEdges = 0; // hide mesh", + "View[l].RangeType = 2; // custom range", "View[l].CustomMin = PhiTrailing;", "View[l].CustomMax = 1.001*PhiTrailing;", "View[l].NbIso = 10;"],