Retrieving indices of times for a time-dependent system of PDEs within applyBoundaryCondition()
2 次查看(过去 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!