StabFem Demo script for concentric jets WITH CONSTANT PROFILE.
Here we set Umax,2 = 1 for the outer jet and Umax,1 = 3/4 so that the ratio of MEAN VELOCITIES is the same as in the case of Poiseulle profile with Umax =1 for each jet
The arclength continuation is done in the plane (Re,beta) where beta is the "monitor" defined as beta = 100*int( ur* exp(-(x-2)^2 ). you can also use the energy as a monitor. For this just remove customized definitions of beta and dbetadu in SF_Custom.idp, the solver will switch to default ones.
NB :
- Using new generic interface - postprocessing is done completely from database exploration
Contents
Chapter 0 : Initialization
close all; addpath([fileparts(fileparts(pwd)), '/SOURCES_MATLAB']); SF_Start('verbosity',4,'ffdatadir','./WORK_ArcLength_Constant/'); % NB use verbosity=2 for autopublish mode ; 4 during work % SF_core_arborescence('cleanall'); % uncomment this line to clean database SF_core_setopt('ErrorIfDiverge',false); % recommended option when using continuation mode set(groot, 'defaultAxesTickLabelInterpreter','latex'); set(groot, 'defaultLegendInterpreter','latex');
NOTICE - Initialization already done WARNING - Detected verbosity = 4 in Publish mode ; not recommended ! switching to 2 instead
Chapter 1 : Generate a mesh and initial base flow
Parameters
U1Max= 3/4.; % to have same ratio of mean velocities as for Poiseuille case U2Max=1.; % set to 1 R1=0.5; distance=4.5; D2=1; Lpipe = 0.01; Xmax = 100; YMax = 20; bctype = 0; % select 0 for constant and 1 for Poiseuille and 2 for Tanh % Mesh generation paramMESH = [R1 distance D2 Lpipe Xmax YMax]; ffmesh = SF_Mesh('Mesh_ConcentricJets_Pipes.edp','params',paramMESH,'cleanworkdir','yes'); figure;subplot(2,1,1);SF_Plot(ffmesh,'mesh','title','Initial mesh'); subplot(2,1,2);SF_Plot(ffmesh,'mesh','title','Initial mesh','xlim',[-2 2],'ylim',[0 2]); % Generation of an initial solution bf = SF_BaseFlow(ffmesh,'Re',1,'bctype',bctype,'U1',U1Max,'U2',U2Max,'solver','Newton_Axi.edp'); % Adapt %bf = SF_Adapt(bf,'anisomax',3,'nbjacoby',3); % plots %figure; SF_Plot(bf,'ux','xlim',[-1 8],'ylim',[0 8]); %Xpos = 1; Y=[0:0.01:1.5]; %uxline=SF_ExtractData(bf,'ux',Xpos,Y); %figure; plot(uxline,Y);xlabel('Ux(r,1)');ylabel('r');title('axial velocity at location x=1');
WARNING - Your program uses depreciated syntax 'Params' to pass parameters WARNING - It is advised to switch to new method using 'Options', and modify your Freefem solvers to detect parameters using 'getARGV' WARNING - Folder ./WORK_ArcLength_Constant/MESHBF not found : creating it !
loop with increasing Re
Increasing Reynolds in a structured manner
ReTab = [10,30,50,55,60,65]; for Re = ReTab bf = SF_BaseFlow(bf,'Re',Re); [bf] = SF_Adapt(bf,'anisomax',3,'nbjacoby',10,'Hmax',2); % [bf] = SF_Adapt(bf,'anisomax',3,'nbjacoby',10,'Hmax',5); end
plot last BF after this stage
figure; SF_Plot(bf,'ux','xlim',[-1 8],'ylim',[0 8],'title',['Re = ',num2str(bf.Re),'; E = ',num2str(bf.Energy)] ); hold on; SF_Plot(bf,'psi','contour','only','xlim',[-1 12],'ylim',[0 8],'Clevels',[ - 1:.1:-.1, 0:.01:.0625,.1,.2, .5:.5:10]); figure;subplot(2,1,1);SF_Plot(bf.mesh,'mesh','title','Adapted mesh'); subplot(2,1,2);SF_Plot(bf.mesh,'mesh','title','Initial mesh','xlim',[-2 2],'ylim',[0 2]);
WARNING - Error in SF_Plot : Field psi does not exist
Test Arclength
bf = SF_BFContinue(bf,'step',0.001,'solver','ArcLengthContinuationAxi.edp'); % note that the first step is still backwards and I don't understand why !!!
Arclength continuation loop
Re = bf.Re; ReMax = 80; ReMin = 25; % this is the termination of the loop. Remin is in case the curve does not loop back. stepMax = 2; step = stepMax; %EnerList = []; betaList = []; ReList = []; // NOW USELESS IF USING DATABASE ! while ( bf.Re < ReMax && bf.Re > ReMin && step > 1e-3) bf=SF_BFContinue(bf,'step',step,'solver','ArcLengthContinuationAxi.edp'); if(bf.iter < 0) disp("Not converged. Arc-length step reduced by a factor 2"); step = 0.5*step; bf = SF_BFContinue(bf,'step',step,'solver','ArcLengthContinuationAxi.edp'); if(bf.iter < 0) disp("Not converged. Reducing again by a factor 10"); step = 0.1*step; bf = SF_BFContinue(bf,'step',step,'solver','ArcLengthContinuationAxi.edp'); if bf.iter<0 disp('Arclength continuation failed') break end end end step = min(1.4*step,stepMax); % raise the step for next iteration Re = bf.Re; figure(45);plot(Re,bf.beta,'*'); pause(0.1); hold on; end
echo 2 0.76578 0.6431 | /PRODCOM/Singularity/freefem++/v4.9-20220413/bin/FreeFem++-mpi -nw -v 0 ArcLengthContinuationAxi.edp -U1 0.75 -U2 1 -bctype 0 -Symmetry S : Signal 73 WARNING - SF_core_freefem: Error while using FreeFem++ ; file = ArcLengthContinuationAxi.edp ; error code = 201 : Your Newton iteration did not converge WARNING - SF_BFcontinue computation did not converge Not converged. Arc-length step reduced by a factor 2 echo 1 0.76578 0.6431 | /PRODCOM/Singularity/freefem++/v4.9-20220413/bin/FreeFem++-mpi -nw -v 0 ArcLengthContinuationAxi.edp -U1 0.75 -U2 1 -bctype 0 -Symmetry S : Signal 73 WARNING - SF_core_freefem: Error while using FreeFem++ ; file = ArcLengthContinuationAxi.edp ; error code = 201 : Your Newton iteration did not converge WARNING - SF_BFcontinue computation did not converge Not converged. Reducing again by a factor 10 echo 0.2744 0.95272 0.30386 | /PRODCOM/Singularity/freefem++/v4.9-20220413/bin/FreeFem++-mpi -nw -v 0 ArcLengthContinuationAxi.edp -U1 0.75 -U2 1 -bctype 0 -Symmetry S : Signal 73 WARNING - SF_core_freefem: Error while using FreeFem++ ; file = ArcLengthContinuationAxi.edp ; error code = 201 : Your Newton iteration did not converge WARNING - SF_BFcontinue computation did not converge Not converged. Arc-length step reduced by a factor 2
Generating the summary of Data Base for postprocessing
sfs = SF_Status;
################################################################################ ... SUMMARY OF YOUR DATABASE FOLDER : ./WORK_ArcLength_Constant/ ################################################################################# .... CONTENT OF DIRECTORY ./WORK_ArcLength_Constant/MESHES : (list of meshes previously created/adapted ; couples of .msh/.ff2m files ) Index | Name | generation mode | Date | Nv 1 | FFMESH_000001.msh | initial | 22-mars-2023 16:43:51 | 702 2 | FFMESH_000002.msh | adapted | 22-mars-2023 16:44:03 | 2465 3 | FFMESH_000003.msh | adapted | 22-mars-2023 16:44:19 | 3204 4 | FFMESH_000004.msh | adapted | 22-mars-2023 16:44:40 | 4235 5 | FFMESH_000005.msh | adapted | 22-mars-2023 16:45:01 | 5113 6 | FFMESH_000006.msh | adapted | 22-mars-2023 16:45:25 | 5835 7 | FFMESH_000007.msh | adapted | 22-mars-2023 16:45:52 | 5845 ################################################################################# ################################################################################# .... CONTENT OF DIRECTORY ./WORK_ArcLength_Constant/BASEFLOWS (couples of .txt/.ff2m files ) Index | Name | Type | Date | Mesh file | Re | beta | Energy 1 | FFDATA_000001.txt | BaseFlow | 22-mars-2023 16:43:55 | FFMESH_000001.msh | 1 | 3.8124 | 3.8124 2 | FFDATA_000002.txt | BaseFlow | 22-mars-2023 16:44:02 | FFMESH_000001.msh | 10 | 18.5917 | 18.5917 3 | FFDATA_000003.txt | BaseFlow | 22-mars-2023 16:44:17 | FFMESH_000002.msh | 30 | 106.998 | 106.998 4 | FFDATA_000004.txt | BaseFlow | 22-mars-2023 16:44:38 | FFMESH_000003.msh | 50 | 154.689 | 154.689 5 | FFDATA_000005.txt | BaseFlow | 22-mars-2023 16:44:58 | FFMESH_000004.msh | 55 | 164.412 | 164.412 6 | FFDATA_000006.txt | BaseFlow | 22-mars-2023 16:45:23 | FFMESH_000005.msh | 60 | 171.999 | 171.999 7 | FFDATA_000007.txt | BaseFlow | 22-mars-2023 16:45:50 | FFMESH_000006.msh | 65 | 178.162 | 178.162 8 | FFDATA_000008.txt | BaseFlow | 22-mars-2023 16:46:34 | FFMESH_000007.msh | 64.9474 | 178.205 | 178.205 9 | FFDATA_000009.txt | BaseFlow | 22-mars-2023 16:46:59 | FFMESH_000007.msh | 66.2246 | 179.736 | 179.736 10 | FFDATA_000010.txt | BaseFlow | 22-mars-2023 16:47:22 | FFMESH_000007.msh | 67.5156 | 181.255 | 181.255 11 | FFDATA_000011.txt | BaseFlow | 22-mars-2023 16:47:51 | FFMESH_000007.msh | 68.8181 | 182.765 | 182.765 12 | FFDATA_000012.txt | BaseFlow | 22-mars-2023 16:48:22 | FFMESH_000007.msh | 70.1266 | 184.268 | 184.268 13 | FFDATA_000013.txt | BaseFlow | 22-mars-2023 16:48:54 | FFMESH_000007.msh | 71.4252 | 185.777 | 185.777 14 | FFDATA_000014.txt | BaseFlow | 22-mars-2023 16:49:31 | FFMESH_000007.msh | 72.611 | 187.37 | 187.37 15 | FFDATA_000015.txt | BaseFlow | 22-mars-2023 16:53:05 | FFMESH_000007.msh | 72.6548 | 187.46 | 187.46 16 | FFDATA_000016.txt | BaseFlow | 22-mars-2023 16:53:35 | FFMESH_000007.msh | 72.7057 | 187.59 | 187.59 17 | FFDATA_000017.txt | BaseFlow | 22-mars-2023 16:54:06 | FFMESH_000007.msh | 72.7358 | 187.785 | 187.785 18 | FFDATA_000018.txt | BaseFlow | 22-mars-2023 16:56:13 | FFMESH_000007.msh | 72.6877 | 187.917 | 187.917 19 | FFDATA_000019.txt | BaseFlow | 22-mars-2023 16:56:46 | FFMESH_000007.msh | 72.5046 | 188.014 | 188.014 20 | FFDATA_000020.txt | BaseFlow | 22-mars-2023 16:57:14 | FFMESH_000007.msh | 72.2322 | 188.018 | 188.018 21 | FFDATA_000021.txt | BaseFlow | 22-mars-2023 16:57:45 | FFMESH_000007.msh | 71.8608 | 187.946 | 187.946 22 | FFDATA_000022.txt | BaseFlow | 22-mars-2023 16:58:13 | FFMESH_000007.msh | 71.3572 | 187.784 | 187.784 23 | FFDATA_000023.txt | BaseFlow | 22-mars-2023 16:58:45 | FFMESH_000007.msh | 70.6723 | 187.502 | 187.502 24 | FFDATA_000024.txt | BaseFlow | 22-mars-2023 16:59:16 | FFMESH_000007.msh | 69.7366 | 187.053 | 187.053 25 | FFDATA_000025.txt | BaseFlow | 22-mars-2023 16:59:47 | FFMESH_000007.msh | 68.4518 | 186.371 | 186.371 26 | FFDATA_000026.txt | BaseFlow | 22-mars-2023 17:00:22 | FFMESH_000007.msh | 66.6976 | 185.378 | 185.378 27 | FFDATA_000027.txt | BaseFlow | 22-mars-2023 17:00:57 | FFMESH_000007.msh | 64.9565 | 184.362 | 184.362 28 | FFDATA_000028.txt | BaseFlow | 22-mars-2023 17:01:30 | FFMESH_000007.msh | 63.219 | 183.338 | 183.338 29 | FFDATA_000029.txt | BaseFlow | 22-mars-2023 17:01:59 | FFMESH_000007.msh | 61.4794 | 182.317 | 182.317 30 | FFDATA_000030.txt | BaseFlow | 22-mars-2023 17:02:30 | FFMESH_000007.msh | 59.7317 | 181.307 | 181.307 31 | FFDATA_000031.txt | BaseFlow | 22-mars-2023 17:03:05 | FFMESH_000007.msh | 57.9677 | 180.324 | 180.324 32 | FFDATA_000032.txt | BaseFlow | 22-mars-2023 17:03:41 | FFMESH_000007.msh | 56.1765 | 179.388 | 179.388 33 | FFDATA_000033.txt | BaseFlow | 22-mars-2023 17:04:16 | FFMESH_000007.msh | 54.3444 | 178.53 | 178.53 34 | FFDATA_000034.txt | BaseFlow | 22-mars-2023 17:04:53 | FFMESH_000007.msh | 52.4563 | 177.798 | 177.798 35 | FFDATA_000035.txt | BaseFlow | 22-mars-2023 17:05:30 | FFMESH_000007.msh | 50.5015 | 177.263 | 177.263 36 | FFDATA_000036.txt | BaseFlow | 22-mars-2023 17:06:01 | FFMESH_000007.msh | 48.4907 | 177.026 | 177.026 37 | FFDATA_000037.txt | BaseFlow | 22-mars-2023 17:06:30 | FFMESH_000007.msh | 46.4833 | 177.191 | 177.191 38 | FFDATA_000038.txt | BaseFlow | 22-mars-2023 17:07:04 | FFMESH_000007.msh | 44.5859 | 177.798 | 177.798 39 | FFDATA_000039.txt | BaseFlow | 22-mars-2023 17:07:46 | FFMESH_000007.msh | 42.8819 | 178.785 | 178.785 40 | FFDATA_000040.txt | BaseFlow | 22-mars-2023 17:08:33 | FFMESH_000007.msh | 41.3858 | 180.043 | 180.043 41 | FFDATA_000041.txt | BaseFlow | 22-mars-2023 17:09:20 | FFMESH_000007.msh | 40.0726 | 181.486 | 181.486 42 | FFDATA_000042.txt | BaseFlow | 22-mars-2023 17:10:06 | FFMESH_000007.msh | 38.9096 | 183.052 | 183.052 43 | FFDATA_000043.txt | BaseFlow | 22-mars-2023 17:10:51 | FFMESH_000007.msh | 37.8682 | 184.706 | 184.706 44 | FFDATA_000044.txt | BaseFlow | 22-mars-2023 17:11:29 | FFMESH_000007.msh | 36.926 | 186.421 | 186.421 45 | FFDATA_000045.txt | BaseFlow | 22-mars-2023 17:12:09 | FFMESH_000007.msh | 36.0655 | 188.182 | 188.182 46 | FFDATA_000046.txt | BaseFlow | 22-mars-2023 17:12:51 | FFMESH_000007.msh | 35.2734 | 189.978 | 189.978 47 | FFDATA_000047.txt | BaseFlow | 22-mars-2023 17:13:31 | FFMESH_000007.msh | 34.5394 | 191.802 | 191.802 48 | FFDATA_000048.txt | BaseFlow | 22-mars-2023 17:14:13 | FFMESH_000007.msh | 33.8552 | 193.647 | 193.647 49 | FFDATA_000049.txt | BaseFlow | 22-mars-2023 17:14:56 | FFMESH_000007.msh | 33.2144 | 195.51 | 195.51 50 | FFDATA_000050.txt | BaseFlow | 22-mars-2023 17:15:35 | FFMESH_000007.msh | 32.6117 | 197.387 | 197.387 51 | FFDATA_000051.txt | BaseFlow | 22-mars-2023 17:16:14 | FFMESH_000007.msh | 32.0426 | 199.277 | 199.277 52 | FFDATA_000052.txt | BaseFlow | 22-mars-2023 17:16:52 | FFMESH_000007.msh | 31.5037 | 201.176 | 201.176 53 | FFDATA_000053.txt | BaseFlow | 22-mars-2023 17:17:32 | FFMESH_000007.msh | 30.9919 | 203.085 | 203.085 54 | FFDATA_000054.txt | BaseFlow | 22-mars-2023 17:18:14 | FFMESH_000007.msh | 30.5046 | 205.001 | 205.001 55 | FFDATA_000055.txt | BaseFlow | 22-mars-2023 17:18:54 | FFMESH_000007.msh | 30.0397 | 206.924 | 206.924 56 | FFDATA_000056.txt | BaseFlow | 22-mars-2023 17:19:31 | FFMESH_000007.msh | 29.5952 | 208.853 | 208.853 57 | FFDATA_000057.txt | BaseFlow | 22-mars-2023 17:20:08 | FFMESH_000007.msh | 29.1696 | 210.786 | 210.786 58 | FFDATA_000058.txt | BaseFlow | 22-mars-2023 17:20:41 | FFMESH_000007.msh | 28.7613 | 212.725 | 212.725 59 | FFDATA_000059.txt | BaseFlow | 22-mars-2023 17:21:14 | FFMESH_000007.msh | 28.3691 | 214.667 | 214.667 60 | FFDATA_000060.txt | BaseFlow | 22-mars-2023 17:21:49 | FFMESH_000007.msh | 27.992 | 216.613 | 216.613 61 | FFDATA_000061.txt | BaseFlow | 22-mars-2023 17:22:26 | FFMESH_000007.msh | 27.6289 | 218.562 | 218.562 62 | FFDATA_000062.txt | BaseFlow | 22-mars-2023 17:23:02 | FFMESH_000007.msh | 27.2789 | 220.515 | 220.515 63 | FFDATA_000063.txt | BaseFlow | 22-mars-2023 17:23:38 | FFMESH_000007.msh | 26.9412 | 222.469 | 222.469 64 | FFDATA_000064.txt | BaseFlow | 22-mars-2023 17:24:12 | FFMESH_000007.msh | 26.6151 | 224.427 | 224.427 65 | FFDATA_000065.txt | BaseFlow | 22-mars-2023 17:24:47 | FFMESH_000007.msh | 26.2999 | 226.387 | 226.387 66 | FFDATA_000066.txt | BaseFlow | 22-mars-2023 17:25:21 | FFMESH_000007.msh | 25.9951 | 228.348 | 228.348 67 | FFDATA_000067.txt | BaseFlow | 22-mars-2023 17:25:55 | FFMESH_000007.msh | 25.7 | 230.312 | 230.312 68 | FFDATA_000068.txt | BaseFlow | 22-mars-2023 17:26:26 | FFMESH_000007.msh | 25.4143 | 232.278 | 232.278 69 | FFDATA_000069.txt | BaseFlow | 22-mars-2023 17:27:05 | FFMESH_000007.msh | 25.1373 | 234.245 | 234.245 70 | FFDATA_000070.txt | BaseFlow | 22-mars-2023 17:27:43 | FFMESH_000007.msh | 24.8688 | 236.214 | 236.214 ################################################################################# .... CONTENT OF DIRECTORY ./WORK_ArcLength_Constant/MESHBF (couples of .txt/.ff2m files ) Index | Name | Type | Date | Mesh file | Re | beta | Energy | U1 | U2 | bctype 1 | FFDATA_000001.txt | BaseFlow | 22-mars-2023 16:43:55 | FFMESH_000001.msh | 1 | 3.8124 | 3.8124 | 0.75 | 1 | 0 ################################################################################# .... CONTENT OF DIRECTORY ./WORK_ArcLength_Constant/MISC (couples of .txt/.ff2m files ) NB this directory may contain various secondary files produced by StabFem, such as flowfields projected after adaptation but not recomputed, adaptation masks, etc... Index | Name | Type | Date | Mesh file | Re | beta | Energy | U1 | U2 | bctype 1 | FFDATA_000001.txt | BaseFlow | 22-mars-2023 16:44:05 | FFMESH_000002.msh | 10 | 18.5917 | 18.5917 | 0.75 | 1 | 0 2 | FFDATA_000002.txt | BaseFlow | 22-mars-2023 16:44:22 | FFMESH_000003.msh | 30 | 106.998 | 106.998 | 0.75 | 1 | 0 3 | FFDATA_000003.txt | BaseFlow | 22-mars-2023 16:44:43 | FFMESH_000004.msh | 50 | 154.689 | 154.689 | 0.75 | 1 | 0 4 | FFDATA_000004.txt | BaseFlow | 22-mars-2023 16:45:04 | FFMESH_000005.msh | 55 | 164.412 | 164.412 | 0.75 | 1 | 0 5 | FFDATA_000005.txt | BaseFlow | 22-mars-2023 16:45:29 | FFMESH_000006.msh | 60 | 171.999 | 171.999 | 0.75 | 1 | 0 6 | FFDATA_000006.txt | BaseFlow | 22-mars-2023 16:45:56 | FFMESH_000007.msh | 65 | 178.162 | 178.162 | 0.75 | 1 | 0 #################################################################################
redraw figure from database
figure; plot([sfs.BASEFLOWS.Re],[sfs.BASEFLOWS.beta]);xlabel('Re'); ylabel('\beta');xlim([ReMin,ReMax]); figure; plot([sfs.BASEFLOWS.Re],[sfs.BASEFLOWS.Energy]);xlabel('Re'); ylabel('E');xlim([ReMin,ReMax]);
Plot last Base flow
figure; SF_Plot(bf,'ux','xlim',[-1 8],'ylim',[0 8],'title',['Re = ',num2str(bf.Re),'; E = ',num2str(bf.Energy)] ); hold on; SF_Plot(bf,'psi','contour','only','Clevels',[ - 1:.1:-.1, 0:.01:.0625,.1,.2, .5:.5:10],'xlim',[-1 12],'ylim',[0 8]); % larger range figure; SF_Plot(bf,'ux','xlim',[-1 8],'ylim',[0 8],'title',['Re = ',num2str(bf.Re),'; E = ',num2str(bf.Energy)] ); hold on; SF_Plot(bf,'psi','contour','only','Clevels',[ - 1:.1:-.1, 0:.01:.0625,.1,.2, .5:.5:10],'xlim',[-1 100],'ylim',[0 20]);
Note: To improve runtime build MEX function fftri2gridfast() from fftri2gridfast.c Note: To improve runtime build MEX function fftri2gridfast() from fftri2gridfast.c
compare with base flow for Re=30 from main branch
bf= SF_Load('BASEFLOWS',6); figure; SF_Plot(bf,'ux','xlim',[-1 8],'ylim',[0 8],'title',['Re = ',num2str(bf.Re),'; E = ',num2str(bf.Energy)] ); hold on; SF_Plot(bf,'psi','contour','only','Clevels',[ - 1:.1:-.1, 0:.01:.0625,.1,.2, .5:.5:10],'xlim',[-1 12],'ylim',[0 8]); % larger range figure; SF_Plot(bf,'ux','xlim',[-1 8],'ylim',[0 8],'title',['Re = ',num2str(bf.Re),'; E = ',num2str(bf.Energy)] ); hold on; SF_Plot(bf,'psi','contour','only','Clevels',[ - 1:.1:-.1, 0:.01:.0625,.1,.2, .5:.5:10],'xlim',[-1 100],'ylim',[0 20]); % [[PUBLISH]] % fclose(fopen('ArcLength_Constant.success','w+'));