build_FEBCbuf.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This file is part of NS2DDV. %
% %
% Copyright(C) 2011-2018 C. Calgaro (caterina.calgaro@math.univ-lille1.fr) %
% E. Creusé (emmanuel.creuse@math.univ-lille1.fr) %
% T. Goudon (thierry.goudon@inria.fr) %
% A. Mouton (alexandre.mouton@math.univ-lille1.fr) %
% %
% NS2DDV is free software: you can redistribute it and/or modify it under the terms %
% of the GNU General Public License as published by the Free Software Foundation, %
% either version 3 of the License, or (at your option) any later version. %
% %
% NS2DDV is distributed in the hope that it will be useful, but WITHOUT ANY %
% WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A %
% PARTICULAR PURPOSE. See the GNU General Public License for more details. %
% %
% You should have received a copy of the GNU General Public License along with %
% NS2DDV. If not, see <http://www.gnu.org/licenses/>. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function[usrbuf] = build_FEBCbuf(answers)
usrbuf = {};
l = 1;
% Boundary condition parameters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
usrbuf{l} = '';
l = l+1;
usrbuf{l} = '% Boundary condition parameters for velocity';
l = l+1;
usrbuf{l} = '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%';
l = l+1;
usrbuf{l} = '% ''DIRICHLET'' Use Dirichlet boundary condition on the specified part of the boundary';
l = l+1;
if (max(strcmp(answers.TESTCASE, {'RTIN', 'DROP', 'POIS', 'EXACNEU', 'NONA'})) == 1)
usrbuf{l} = '% ''NEUMANN'' Use Neumann boundary condition on the specified part of the boundary';
l = l+1;
end
if (max(strcmp(answers.TESTCASE, {'POIS', 'NONA'})) == 1)
usrbuf{l} = '% ''NATURAL'' Use transparent boundary condition on the specified part of the boundary';
l = l+1;
end
switch answers.GEOM
case {'RECTANGLE'}
switch answers.TESTCASE
case {'RTIN', 'DROP'}
usrbuf{l} = '% Boundary condition on the bottom bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_BOTTOM_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the bottom bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_BOTTOM_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the top bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_TOP_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the top bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_TOP_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the left bound for ux (allowed values: ''SYMMETRY'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_LEFT_UX = ''SYMMETRY'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the left bound for uy (allowed values: ''SYMMETRY'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_LEFT_UY = ''SYMMETRY'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the right bound for ux (allowed values: ''SYMMETRY'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_RIGHT_UX = ''SYMMETRY'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the right bound for uy (allowed values: ''SYMMETRY'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_RIGHT_UY = ''SYMMETRY'';';
l = l+1;
case {'CAEN', 'EXAC'}
usrbuf{l} = '% Boundary condition on the bottom bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_BOTTOM_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the bottom bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_BOTTOM_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the top bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_TOP_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the top bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_TOP_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the left bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_LEFT_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the left bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_LEFT_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the right bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_RIGHT_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the right bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_RIGHT_UY = ''DIRICHLET'';';
l = l+1;
case {'POIS'}
usrbuf{l} = '% Boundary condition on the bottom bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_BOTTOM_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the bottom bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_BOTTOM_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the top bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_TOP_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the top bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_TOP_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the left bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_LEFT_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the left bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_LEFT_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the right bound for ux (allowed values: ''NEUMANN'', ''NATURAL'', ''STRESS_BALANCE'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_RIGHT_UX = ''NEUMANN'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the right bound for uy (allowed values: ''NEUMANN'', ''NATURAL'', ''STRESS_BALANCE'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_RIGHT_UY = ''NEUMANN'';';
l = l+1;
case {'EXACNEU'}
usrbuf{l} = '% Boundary condition on the bottom bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_BOTTOM_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the bottom bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_BOTTOM_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the top bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_TOP_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the top bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_TOP_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the left bound for ux (allowed values: ''NEUMANN'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_LEFT_UX = ''NEUMANN'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the left bound for uy (allowed values: ''NEUMANN'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_LEFT_UY = ''NEUMANN'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the right bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_RIGHT_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the right bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_RIGHT_UY = ''DIRICHLET'';';
l = l+1;
case {'NONA'}
usrbuf{l} = '% Boundary condition on the bottom bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_BOTTOM_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the bottom bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_BOTTOM_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the top bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_TOP_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the top bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_TOP_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the left bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_LEFT_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the left bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_LEFT_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the right bound for ux (allowed values: ''NEUMANN'', ''NATURAL'', ''STRESS_BALANCE'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_RIGHT_UX = ''NEUMANN'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the right bound for uy (allowed values: ''NEUMANN'', ''NATURAL'', ''STRESS_BALANCE'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_RIGHT_UY = ''NEUMANN'';';
l = l+1;
case {'GTPSI'}
usrbuf{l} = '% Boundary condition on the bottom bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_BOTTOM_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the bottom bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_BOTTOM_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the top bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_TOP_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the top bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_TOP_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the left bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_LEFT_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the left bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_LEFT_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the right bound for ux (allowed values: ''NEUMANN'', ''NATURAL'', ''STRESS_BALANCE'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_RIGHT_UX = ''NEUMANN'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the right bound for uy (allowed values: ''NEUMANN'', ''NATURAL'', ''STRESS_BALANCE'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_RIGHT_UY = ''NEUMANN'';';
l = l+1;
otherwise
error('Unknown value of TESTCASE');
end
case {'DIHEDRON'}
switch answers.TESTCASE
case {'NONA'}
usrbuf{l} = '% Boundary condition on the bottom bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_BOTTOM_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the bottom bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_BOTTOM_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the top bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_TOP_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the top bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_TOP_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the left bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_LEFT_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the left bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_LEFT_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the right bound for ux (allowed values: ''NEUMANN'', ''NATURAL'', ''STRESS_BALANCE'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_RIGHT_UX = ''NEUMANN'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the right bound for uy (allowed values: ''NEUMANN'', ''NATURAL'', ''STRESS_BALANCE'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_RIGHT_UY = ''NEUMANN'';';
l = l+1;
case {'EXAC'}
usrbuf{l} = '% Boundary condition on the bottom bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_BOTTOM_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the bottom bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_BOTTOM_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the top bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_TOP_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the top bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_TOP_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the left bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_LEFT_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the left bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_LEFT_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the right bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_RIGHT_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the right bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_RIGHT_UY = ''DIRICHLET'';';
l = l+1;
otherwise
error('Unknown value of TESTCASE');
end
case {'STEP'}
switch answers.TESTCASE
case {'NONA', 'POIS'}
usrbuf{l} = '% Boundary condition on the bottom bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_BOTTOM_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the bottom bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_BOTTOM_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the top bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_TOP_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the top bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_TOP_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the left bound for ux (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_LEFT_UX = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the left bound for uy (allowed values: ''DIRICHLET'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_LEFT_UY = ''DIRICHLET'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the right bound for ux (allowed values: ''NEUMANN'', ''NATURAL'', ''STRESS_BALANCE'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_RIGHT_UX = ''NEUMANN'';';
l = l+1;
usrbuf{l} = '% Boundary condition on the right bound for uy (allowed values: ''NEUMANN'', ''NATURAL'', ''STRESS_BALANCE'')';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_RIGHT_UY = ''NEUMANN'';';
l = l+1;
otherwise
error('Unknown value of TESTCASE');
end
case {'CIRCLE'}
switch answers.TESTCASE
case {'EXAC'}
otherwise
error('Unknown value of TESTCASE');
end
case {'FROM_FILE'}
otherwise
error('Unknown value for GEOM');
end
if (max(strcmp(answers.TESTCASE, {'POIS', 'NONA', 'GTPSI'})) == 1)
usrbuf{l} = '% Non-linear term splitting parameters for ''NATURAL'' boundary conditions';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.ALPHA1 = 0.5;';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.ALPHA2 = 1.;';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.ALPHA3 = 1.;';
l = l+1;
usrbuf{l} = '% Amplitude of the correction in ''NATURAL'' boundary conditions (recommended values: 0, 1, or 2; must be positive)';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BETA = 1.;';
l = l+1;
usrbuf{l} = '% Extension of Dirichlet boundary conditions to the open boundary';
l = l+1;
switch answers.TESTCASE
case {'NONA'}
usrbuf{l} = '% Allowed values: ''BLASIUS'' (default), ''COUETTE''';
l = l+1;
usrbuf{l} = '% ''BLASIUS'' Use a barotropic Blasius profile';
l = l+1;
usrbuf{l} = '% ''COUETTE'' Use a barotropic Couette profile';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_EXTENSIONREF = ''BLASIUS'';';
l = l+1;
case {'POIS'}
usrbuf{l} = '% Allowed values: ''POIS'' (default)';
l = l+1;
usrbuf{l} = '% ''POIS'' Use a Poiseuille profile';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_EXTENSIONREF = ''POIS'';';
l = l+1;
case {'GTPSI'}
usrbuf{l} = '% Allowed values: ''GTPSI'' (default)';
l = l+1;
usrbuf{l} = '% ''GTPSI'' Use the same kind of velocity profile as for the inlet velocity';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_EXTENSIONREF = ''GTPSI'';';
l = l+1;
otherwise
error('Problem in build_FEBCbuf.m');
end
usrbuf{l} = '% Sharpness of the smoothed step function - should be close to 0 (only for ''STRESS_BALANCE'' boundary conditions)';
l = l+1;
usrbuf{l} = 'PARAMETERS.FE.BC_DELTA = 0.05;';
l = l+1;
end
end