Retrieving indices of times for a time-dependent system of PDEs within applyBoundaryCondition()
1 回表示 (過去 30 日間)
古いコメントを表示
I am using the Partial Differential tool box to resolve a time dependent system of N=3 equations. I am using the following code (please suggest improvements when needed, or corrections)
applyBoundaryCondition(model, 'EquationIndex', 2, 'Edge', 3, 'q', 0, 'g', @gBc_coeffunc_Cf);
.....where
function gBc = gBc_coeffunc_Cf(region,state)
% N-by-M matrix, where each column corresponds to one evaluation point,
% and M is the number of evaluation points.
nr = length(region.x);
gBc = zeros(N_EQ,nr);
st = state.time;
if (not(isnan(st)))
for r = 1:nr
gBc(1,r) = 5 * Cf_Nz(r, ??)
end
end
end
... where I have previously obtained Cf_Nz from a solution given by a previous, different system of PDE´s, of also N=3.
Nodes_at_edge_bottom = findNodes(mesh, 'region', 'Edge', 3);
Cf_Nz = squeeze(solution.NodalSolution(Nodes_at_edge_bottom, EQ_Cf, :));
I expect this Cf_Nz to be a matrix which colums are indexed by the iT (which contains the indices of times ' for a time-dependent problem, as mentioned here:
...and use this matrix values to be retrieved from the ?? above. (I know that state.time contains the time at evaluation points. state.time is a scalar, that might be used here somehow, but I do not need the time, but the indices of times). Which should be the function ?? that should be used ?
Also, as a different but somehow related question, region.subdomain() can not be used within gBc_coeffunc_Cf() ? Thank you
0 件のコメント
回答 (2 件)
Ravi Kumar
2019 年 5 月 15 日
You need to create an interpolant object, see for example, griddedInterpolant. Construct interpolant (may be one for each N), and then query it with the time value passed in state.time.
Yes you can use region.subdomain in your funciton.
Regards,
Ravi
1 件のコメント
参考
カテゴリ
Help Center および File Exchange で Geometry and Mesh についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!