Can I pass local time step to another function?
Afficher commentaires plus anciens
I am using a boundary value solvers to calculate the solution of BVP:
d2u/dx2=-S(x)
The source term is calculated by a complicated function and to make the units consistent and physically meaningful, there is need of a division to local time step (or in my case \delta x) within the source term calculation.
Can anybody please lead me how to pass the time step to derivative function (such as twoode in the help pages)?
Here is the code I am using, please not that the actual code is much longer but I believe this one represent my problem:
% solve the boundary value problem
options = []; % bvpset %place holder
solinit = bvpinit(linspace(0,L_y,n_y),[1 1]);
v_z = bvp5c(@ode_vz,@ode_vz_bc,solinit,options);
% ------------------------------------------------------------
function dydx = ode_vz(x,y) S=calculate_source(x); % see the fucntion below to look at the calcuations for the source term dydx = [ y(2) -S]; end
% ------------------------------------------------------------
function res = ode_vz_bc(ya,yb) res = [ ya(1) yb(1) ]; end
% ------------------------------------------------------------
function force=calculate_source(x) % Calculates source term % more calculations are here
force=f_d* h_c/(d_b * (1+s_p) ) / mu_l / ( (I want to add the local time step here) *d_b*L_z*1e-9); % [N / mu V} or [1 / m s]
end
Réponses (0)
Catégories
En savoir plus sur Boundary Value Problems dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!