Skip to content

Commit 8bb0961

Browse files
committed
Update subtree
2 parents a0faf43 + 5444143 commit 8bb0961

File tree

2 files changed

+79
-9
lines changed

2 files changed

+79
-9
lines changed

modules/mpsaw/assembly/coreMpsaAssembly.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@
100100
% Construction of the gradient operator
101101
%
102102

103-
% Construction of gradnodeface_op : nodefacecoltbl -> cellnodecolrowtbl
103+
% Construction of gradnodeface_T : nodefacecoltbl -> cellnodecolrowtbl
104104
%
105105
% The nodefacecol part of the grad operator from nodefacecoltbl to cellnodecolrowtbl is obtained for any u in
106-
% nodefacecoltbl by using v = prod.eval(g, u) where prod is defined below and this is how we set the correspinding
106+
% nodefacecoltbl by using v = prod.eval(g, u) where prod is defined below and this is how we set the corresponding
107107
% tensor.
108108
%
109109
prod = TensorProd();

modules/mpsaw/examples/utils/setupBCpercase.m

Lines changed: 77 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function loadstruct = setupBCpercase(runcase, G, tbls, mappings)
1+
function loadstruct = setupBCpercase(runcase, G, tbls, mappings, extras)
22
% Boundary conditions
33

44
%{
@@ -29,6 +29,7 @@
2929
cellnodefacecoltbl = tbls.cellnodefacecoltbl;
3030
coltbl = tbls.coltbl;
3131
cellcoltbl = tbls.cellcoltbl;
32+
celltbl = tbls.celltbl;
3233

3334
nodeface_from_cellnodeface = mappings.nodeface_from_cellnodeface;
3435

@@ -47,9 +48,9 @@
4748
% in cellnodefacetbl.
4849
facetNormals = reshape(facetNormals', [], 1);
4950

50-
% no volumetric force
51-
force = zeros(cellcoltbl.num, 1);
52-
51+
% force and extforce will be set to zero if nothing is set otherwise
52+
force = [];
53+
extforce = [];
5354

5455
switch runcase
5556

@@ -156,8 +157,9 @@
156157

157158
force = tblmap(force, coltbl, sourcetbl, {'coldim'});
158159
force = tblmap(force, sourcetbl, cellcoltbl, {'cells', 'coldim'});
160+
159161
end
160-
162+
161163
case {'3d-linear', '3d-compaction'}
162164
switch runcase
163165
case '3d-linear'
@@ -222,8 +224,67 @@
222224
map = map.setup();
223225
extforce = map.eval(-extFacetNormals);
224226

227+
case '3d-gravity'
228+
229+
ind = 1;
230+
for i = 1 : 3
231+
for j = 1 : 2
232+
addface = true;
233+
if j == 1
234+
if i == 3
235+
% The bottom face is free. (Note that for geological reservoir, bottom face corresponds to top face.)
236+
addface = false;
237+
else
238+
v = min(G.faces.centroids(:, i));
239+
end
240+
else
241+
v = max(G.faces.centroids(:, i));
242+
end
243+
244+
if addface
245+
246+
extfaces{ind} = find(abs(G.faces.centroids(:, i) - v) < 1e-5);
247+
248+
n = numel(extfaces{ind});
249+
250+
linform = zeros(3, 1);
251+
linform(i) = 1;
252+
linforms{ind} = repmat(linform, n, 1);
253+
254+
linformvals{ind} = zeros(n, 1);
255+
256+
ind = ind + 1;
257+
258+
end
259+
end
260+
end
261+
262+
% for ind = 1 : numel(extfaces)
263+
% figure
264+
% plotGrid(G, 'facecolor', 'none');
265+
% plotFaces(G, extfaces{ind});
266+
% end
267+
268+
vols = G.cells.volumes;
269+
270+
ztbl.coldim = 3;
271+
ztbl = IndexArray(ztbl);
272+
273+
cellztbl = crossIndexArray(celltbl, ztbl, {});
274+
275+
map = TensorMap();
276+
map.fromTbl = cellztbl;
277+
map.toTbl = cellcoltbl;
278+
map.mergefds= {'cells', 'coldim'};
279+
map = map.setup();
280+
281+
rho = extras.rho;
282+
force = map.eval(rho*vols*10);
283+
225284
otherwise
285+
226286
error('runcase not recognized');
287+
227288
end
228289

229290
bc.extfaces = vertcat(extfaces{:});
@@ -232,7 +293,16 @@
232293

233294
bc = setupFaceBC(bc, G, tbls);
234295

235-
loadstruct.bc = bc;
296+
if isempty(force)
297+
force = zeros(cellcoltbl.num, 1);
298+
end
299+
300+
if isempty(extforce)
301+
extforce = zeros(nodefacecoltbl.num, 1);
302+
end
303+
304+
loadstruct.bc = bc;
236305
loadstruct.extforce = extforce;
237-
loadstruct.force = force;
306+
loadstruct.force = force;
307+
238308
end

0 commit comments

Comments
 (0)