rbmatlab 0.10.01
|
00001 function rmodel = nonlin_symmetry(steps, combined, M_by_N_ratio, noof_ei_extensions, random, explicit, num_cpus) 00002 % function rbmodel = nonlin_symmetry(steps, combined, M_by_N_ratio, noof_ei_extensions, random, explicit, num_cpus) 00003 % small script demonstrating the burgers equation with explicit fv 00004 % discretization and RB model reduction 00005 % example is meant to demonstrate automatic symmetry detection by 00006 % the algorithm. 00007 % These results are presented at HYP2008 00008 00009 % Bernard Haasdonk 3.6.2008 00010 00011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00012 %%%%%% Select here, what is to be performed with the burgers data %%%%%%%%%% 00013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00014 %step = 1 % single detailed simulation with given data and plot. Run 00015 % this with varying parameters mu until sure that scheme 00016 % is stable. Modify dt or the data-functions accordingly, 00017 % until a nice parameter-domain with uniformly stable 00018 % detailed scheme is obtained. 00019 %step = 2 % generate colateral reduced basis of L_E operator 00020 %step = 3 % compare single detailed simulation with and without 00021 % interpolated space operator 00022 %step = 4 % generate dummy reduced basis from single trajectory and check, if 00023 % ei_interpolation with projection on this space maintains 00024 % result. A simple reduced simulation can also be 00025 % performed. All results should be visually identical. 00026 %step = 5 % generate reduced basis 00027 %step = 6 % time measurement of reduced simulation and demo rb gui 00028 %step = 7 % generate error-landscape over varying N and M. 00029 % This can take several hours!!! 00030 00031 if nargin == 0 00032 steps = [0,6]; 00033 end 00034 00035 %steps = [1,2,3,4,5,7,8]; 00036 00037 if nargin <= 1 00038 combined = true; 00039 M_by_N_ratio = 0; 00040 noof_ei_extensions = 1; 00041 random = false; 00042 explicit = true; 00043 num_cpus = 4; 00044 end 00045 00046 rmodel = []; 00047 00048 for si=1:length(steps) 00049 00050 step = steps(si); 00051 00052 % output-filenames in rbmatlabresult 00053 detailedfname = 'nonlin_symmetry_detailed.mat'; 00054 testdir = 'nonlin_symmetry_test_10'; 00055 results_fname_base = 'nonlin_symmetry_step7_result'; 00056 00057 plot_params.axis_equal = 1; 00058 plot_params.clim = [0,1]; 00059 plot_params.plot = @fv_plot; 00060 00061 params = []; 00062 params.explicit = explicit; 00063 params.model_type = 'nonlin_symmetry'; 00064 params.step7_outputfile = fullfile(rbmatlabresult, [params.model_type, '_step7_output']); 00065 params.step8_outputfile = fullfile(rbmatlabresult, [params.model_type, '_step8_output']); 00066 00067 extrapar.Mstrich = 100; 00068 00069 % grid parameters 00070 switch step 00071 case 0 00072 if ~isempty(getenv('MACHINEFILE')) 00073 machinefile = getenv('MACHINEFILE'); 00074 FakeMPI.MPI_Init(machinefile, fullfile(rbmatlabhome, 'fakeMPI', 'run_parCompErrs.sh')); 00075 FakeMPI.MPI_Run; 00076 end 00077 00078 descr = nonlin_symmetry_descr(params); 00079 00080 if ~combined 00081 descr.RB_Mmax_small = 0; 00082 else 00083 descr.RB_Mmax_small = 20; 00084 end 00085 00086 descr.RB_extension_M_by_N_r = M_by_N_ratio; % 2.5; 00087 descr.RB_refinement_theta = 0.15; 00088 descr.RB_noof_ei_extensions = noof_ei_extensions; 00089 descr.RB_train_num_intervals = 25; 00090 descr.RB_val_size = 4; 00091 descr.RB_stop_Mmax = 600; 00092 descr.RB_stop_Nmax = 250; 00093 descr.RB_stop_timeout = 12*60*60; 00094 descr.RB_stop_epsilon = 1e-9; 00095 descr.RB_epsilon_M_by_N_r = 1e-1; 00096 00097 if random 00098 descr.RB_train_sample_mode = 'random'; 00099 descr.RB_train_num_intervals = 400; 00100 descr.RB_stop_max_val_train_ratio = inf; 00101 end 00102 00103 [dmodel, rmodel] = gen_models(descr); 00104 00105 params.mu_ranges = rmodel.mu_ranges; 00106 params.mu_names = rmodel.mu_names; 00107 00108 dmodel.num_cpus = num_cpus; 00109 00110 model_data = gen_model_data(dmodel); 00111 case 1 % single detailed simulation and plot 00112 step1_detailed_simulation; 00113 case 5 % reduced basis 00114 detailed_data = gen_detailed_data(rmodel, model_data); 00115 save(fullfile(rbmatlabresult, detailedfname), 'detailed_data', 'rmodel'); 00116 FakeMPI.MPI_Finalize; 00117 case 6 00118 load(fullfile(rbmatlabresult, detailedfname), 'detailed_data', 'rmodel'); 00119 step6_demo_rb_gui; 00120 end 00121 00122 end 00123 00124 %| \docupdate