Retrieving indices of times for a time-dependent system of PDEs within applyBoundaryCondition()
2 views (last 30 days)
Show older comments
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 Comments
Answers (2)
Ravi Kumar
on 15 May 2019
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 Comment
See Also
Categories
Find more on Geometry and Mesh in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!