Skip to content
Snippets Groups Projects
Commit b6f84c96 authored by François Henrotte's avatar François Henrotte
Browse files

improvements

parent 5ee2362a
No related branches found
No related tags found
No related merge requests found
/* ------------------------------------------------------------------- /* -------------------------------------------------------------------
Tutorial 6 : Potential flow, lift and Magnus effect Tutorial 6 : Potential flow and Magnus effect
Features: Features:
- Potential flow, irrotational flow, lift and Magnus effect - Potential flow, irrotational flow
- Multivalued scalar field - Multivalued scalar field
- Non-linear iteration on an Associated global quantity - Lift and Magnus effect, stagnation points
- Use a run-time variable in a Post-Operation - Run-time variables
- Elementary algorithms in the Resolution section
- Non-linear iteration to achieve Kutta's condition
To compute the solution in a terminal: To compute the solution in a terminal:
getdp magnus.pro -solve PotentialFlow -pos PotentialFlow getdp magnus.pro -solve PotentialFlow -pos PotentialFlow
...@@ -89,8 +91,6 @@ ...@@ -89,8 +91,6 @@
f(V) = argVTrail[ {d phi } ] OnPoint {1.0001,0,0} f(V) = argVTrail[ {d phi } ] OnPoint {1.0001,0,0}
comes below a fixed tolerance. comes below a fixed tolerance.
*/ */
Include "magnus_common.pro"; Include "magnus_common.pro";
...@@ -244,12 +244,22 @@ Resolution{ ...@@ -244,12 +244,22 @@ Resolution{
Generate[A]; Solve[A]; SaveSolution[A]; Generate[A]; Solve[A]; SaveSolution[A];
Else 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] // The run-time variable $newDmdt is used in Generate[A]
// whereas $circ, $dmdt, $argV and $phiTrailing are evaluated // whereas $circ, $dmdt, $argV and $phiTrailing are evaluated
// by the PostOperation[Trailing]. // by the PostOperation[Trailing].
// A file containing "PhiTrailing = $phiTrailing;" is after all // A file containing "PhiTrailing = $phiTrailing;" is
// written on disk to be used for formatting the // after convergence written on disk to be used
// for formatting purposes in the PostOperation section.
DeleteFile["KJiter.txt"]; DeleteFile["KJiter.txt"];
...@@ -265,11 +275,9 @@ Resolution{ ...@@ -265,11 +275,9 @@ Resolution{
Format "iter = %3g Circ = %5.2f Dmdt = %5.2f argV = %5.2e"]; Format "iter = %3g Circ = %5.2f Dmdt = %5.2f argV = %5.2e"];
While[ Norm[ $argV ] > 1e-3 && $syscount < 50] { While[ Norm[ $argV ] > 1e-3 && $syscount < 50] {
Test[ $syscount && Norm[$argV-$argVp] > 1e-3 ] Test[ $syscount && Norm[$argV-$argVp] > 1e-3 ]
{Evaluate[$jac = Min[ ($dmdt-$dmdtp)/($argV-$argVp), 0.2 ] ] ;} {Evaluate[$jac = Min[ ($dmdt-$dmdtp)/($argV-$argVp), 0.2 ] ] ;}
{Evaluate[$jac = 0.2];} {Evaluate[$jac = 0.2];}
Print[{$jac}, Format "Jac = %7.5e"];
Evaluate[$newDmdt = $dmdt - $jac * $argV]; Evaluate[$newDmdt = $dmdt - $jac * $argV];
Evaluate[ $syscount = $syscount + 1 ]; Evaluate[ $syscount = $syscount + 1 ];
...@@ -371,10 +379,10 @@ PostOperation{ ...@@ -371,10 +379,10 @@ PostOperation{
Print[normVelocity, OnElementsOf Vol_rho, File "p.pos"]; Print[normVelocity, OnElementsOf Vol_rho, File "p.pos"];
Echo[ Str["l=PostProcessing.NbViews-1;", Echo[ Str["l=PostProcessing.NbViews-1;",
"View[l].Name = 'stagnation points';", "View[l].Name = 'stagnation points';",
"View[l].ScaleType = 2;"], "View[l].ScaleType = 2; // log scale"],
File "tmp.geo", LastTimeStepOnly] ; File "tmp.geo", LastTimeStepOnly] ;
// Show the isovalue phi=$PhiTrailing // Show the isovalue "phi=$PhiTrailing"
// which should be perpendicular to the airfoil // which should be perpendicular to the airfoil
// if the Kutta condition is fulfilled // if the Kutta condition is fulfilled
Print[phi, OnElementsOf Vol_rho, File "KJ.pos"]; Print[phi, OnElementsOf Vol_rho, File "KJ.pos"];
...@@ -382,8 +390,8 @@ PostOperation{ ...@@ -382,8 +390,8 @@ PostOperation{
"l=PostProcessing.NbViews-1;", "l=PostProcessing.NbViews-1;",
"View[l].Name = 'isovalue phiTrailing';", "View[l].Name = 'isovalue phiTrailing';",
"View[l].IntervalsType = 3;", "View[l].IntervalsType = 3;",
"Mesh.SurfaceEdges = 0;", "Mesh.SurfaceEdges = 0; // hide mesh",
"View[l].RangeType = 2;", "View[l].RangeType = 2; // custom range",
"View[l].CustomMin = PhiTrailing;", "View[l].CustomMin = PhiTrailing;",
"View[l].CustomMax = 1.001*PhiTrailing;", "View[l].CustomMax = 1.001*PhiTrailing;",
"View[l].NbIso = 10;"], "View[l].NbIso = 10;"],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment