PDE Boundary Condition only returns 1 evaluation Point

4 visualizaciones (últimos 30 días)
So Im trying to implement a Boundary Condition for the PDE Toolbox by
applyBoundaryCondition(model_Zeo,'Edge',3,'u',@Kanaldruck_v1,'EquationIndex',1,'Vectorized','on');
and the function
function Kanaldruck = Kanaldruck_v1 (region, state)
global p_c t_step time Kzahl j
if(isnan(state.time))
Kanaldruck = NaN;
else
if time ~= round(state.time,6,'significant')
time=round(state.time,6,'significant');
j=ceil(time*Kzahl/t_step);
if j==0
j=1;
elseif j>Kzahl
j=Kzahl;
end
end
Kanaldruck=p_c(:,j)';
end
where p_c ist a 101x18 Matrix and j is a Integer between 1 and 18. So the Kanaldruck is a 1x101 Matrix. Now i get the following error
Boundary condition function "Kanaldruck_v1" was requested to return boundary conditions at 101 points but values at 1 point(s) were returned.
I've put a breakpoint at the last line, noticing, that the error only occures after the second time i run through the function. If i dont transpose the p_c Matrix, the very same error appears after the first runtrough (which makes sense). Maybe i did unterstand the purpose of 'Vectorized''on' falsely... it would be very nice if someone could tell me if my syntax is correct, and where the error could come from.

Respuesta aceptada

Michael Ilewicz
Michael Ilewicz el 1 de Jul. de 2017
i figured it out. It happens if state.time is NaN. Instead of
if(isnan(state.time))
Kanaldruck = NaN;
else
i had to pass
if(isnan(state.time))
Kanaldruck = NaN([1,length(region.x)]);
else

Más respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by