time | calls | line |
---|
| | 1 | function [NodeP, nbcP, Nodeu, nbcu, Nodev, nbcv, NodeRho, nbcrho] = set_bcs(...
|
| | 2 | bcid2type_P, NodeP, bcid2type_u, Nodeu, bcid2type_v, Nodev, bcid2type_Rho, NodeRho)
|
| | 3 | % function [NodeP, nbcP, Nodeu, nbcu, Nodev, nbcv, NodeRho, nbcrho] =...
|
| | 4 | % set_bcs(bcid2type_P, NodeP,...
|
| | 5 | % bcid2type_u, Nodeu, bcid2type_v, Nodev, bcid2type_Rho, NodeRho)
|
| | 6 | %
|
| | 7 | % This function re-numbers the Node-matrices to be consistent with the
|
| | 8 | % solvers boundary-condition rules. The different boundary conditions are:
|
| | 9 | % bcid2type = {'D'} - Dirichlet boundary with a single value on that
|
| | 10 | % segment
|
| | 11 | % bcid2type = {'Dmv'} - Dirichlet boundary with multiple values on that
|
| | 12 | % segment (spatially variable)
|
| | 13 | % bcid2type = {'O'} - Open boundary condition
|
| | 14 | % bcid2type = {'N'} - Neumann boundary with single value on that segment
|
| | 15 | % bcid2type = {'Nmv'} - Neumann boundary with multiple values on that
|
| | 16 | % segment (spatially variable)
|
| | 17 | %
|
| | 18 | % INPUTS:
|
| | 19 | % bcid2type_P: Cell array containing the boundary condition types
|
| | 20 | % for Pressure
|
| | 21 | % NodeP: Node numbering matrix for pressure
|
| | 22 | % bcid2type_u: Cell array containing the boundary condition types
|
| | 23 | % for u-velocity
|
| | 24 | % Nodeu: Node numbering matrix for u-velocity
|
| | 25 | % bcid2type_v: Cell array containing the boundary condition types
|
| | 26 | % for v-velocity
|
| | 27 | % Nodev: Node numbering matrix for v-velocity
|
| | 28 | % bcid2type_rho: Cell array containing the boundary condition types
|
| | 29 | % for density (Optional)
|
| | 30 | % NodeRho: Node numbering matrix for density (Optional)
|
| | 31 | % OUTPUTS:
|
| | 32 | % NodeP: Re-numbered Node numbering matrix for pressure
|
| | 33 | % nbcP: Array giving maximum id of each pressure boundary type.
|
| | 34 | % Used as an input to init_bcs.m
|
| | 35 | % Nodeu: Re-numbered Node numbering matrix for u-velocity
|
| | 36 | % nbcu: Array giving maximum id of each u-velocity boundary type
|
| | 37 | % Used as an input to init_bcs.m
|
| | 38 | % Nodev: Re-numbered Node numbering matrix for v-velocity
|
| | 39 | % nbcv: Array giving maximum id of each v-velocity boundary type
|
| | 40 | % Used as an input to init_bcs.m
|
| | 41 | % NodeRho: Re-numbered Node numbering matrix for density (Optional)
|
| | 42 | % nbcrho: Array giving maximum id of each density boundary type
|
| | 43 | % Used as an input to init_bcs.m (Optional)
|
| | 44 | %
|
| | 45 | % See also: translate_Node.m, bc_maxrule.m, init_bcs.m
|
| | 46 | %
|
| | 47 | % Written by: Matt Ueckermann
|
| | 48 |
|
| | 49 | %%
|
| | 50 |
|
| 1 | 51 | Nbcids = length(bcid2type_P);
|
| 1 | 52 | if (nargin < 7)
|
| | 53 | NodeRho = NodeP;
|
| | 54 | bcid2type_Rho = bcid2type_P;
|
| | 55 | end;
|
| | 56 |
|
| | 57 | %% First we translate the bcid2type arrays to some nice numbers
|
| | 58 |
|
| 1 | 59 | bc_u = zeros(length(bcid2type_u), 1);
|
| 1 | 60 | bc_v = zeros(length(bcid2type_v), 1);
|
| 1 | 61 | bc_P = zeros(length(bcid2type_P), 1);
|
| 1 | 62 | bc_rho = zeros(length(bcid2type_Rho), 1);
|
| | 63 |
|
| 1 | 64 | for i=1 : length(bcid2type_u)
|
| 5 | 65 | bc_u(i) = bc_str2num(bcid2type_u{i});
|
| 5 | 66 | bc_v(i) = bc_str2num(bcid2type_v{i});
|
| 5 | 67 | bc_P(i) = bc_str2num(bcid2type_P{i});
|
| 5 | 68 | bc_rho(i) = bc_str2num(bcid2type_Rho{i});
|
| 5 | 69 | end
|
| | 70 |
|
| | 71 | %% Do the translation to follow the order rules
|
| | 72 |
|
0.02 | 1 | 73 | [Nodeu, maxbcid_u, nbcu] = translate_Node(Nodeu, bc_u, Nbcids);
|
0.01 | 1 | 74 | [Nodev, maxbcid_v, nbcv] = translate_Node(Nodev, bc_v, Nbcids);
|
0.01 | 1 | 75 | [NodeP, maxbcid_P, nbcP] = translate_Node(NodeP, bc_P, Nbcids);
|
0.01 | 1 | 76 | [NodeRho, maxbcid_rho, nbcrho] = translate_Node(NodeRho, bc_rho, Nbcids);
|
| 1 | 77 | maxbcid = max([maxbcid_u, maxbcid_v, maxbcid_P, maxbcid_rho]);
|
| | 78 |
|
| | 79 | %% Do the translation to follow the same number of BCs rule
|
| | 80 |
|
| 1 | 81 | Nodeu = bc_maxrule(Nodeu, maxbcid_u, maxbcid);
|
| 1 | 82 | Nodev = bc_maxrule(Nodev, maxbcid_v, maxbcid);
|
| 1 | 83 | NodeP = bc_maxrule(NodeP, maxbcid_P, maxbcid);
|
| 1 | 84 | NodeRho = bc_maxrule(NodeRho, maxbcid_rho, maxbcid);
|
| 1 | 85 | nbcP(3) = maxbcid;
|
| 1 | 86 | nbcu(3) = maxbcid;
|
| 1 | 87 | nbcv(3) = maxbcid;
|
| 1 | 88 | nbcrho(3) = maxbcid;
|