Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
Replace NaN values with zero in COMSOL
Posted Feb 7, 2024, 8:38 a.m. EST Interfacing, API, Structural Mechanics Version 5.6 1 Reply
Please login with a confirmed email address before reporting spam
Hello,
I use COMSOL to obtain eigenfrequencies of a 3D crystal with a point defect. I am a beginner with COMSOL.
For each eigenfrequency, I have a mode with a certain mode shape (amplitude). I only consider out-of-plane motion, i.e. w(x, y).
The COMSOL solution (the amplitude w) looks reasonable (from a physics point of view), but contains small numerical artefacts.
This is problematic as I want to calculate second-order derivates: d(d(w, x), x). In particular, evaluating this derivative yiels several NaN values.
My current solution is to export the data to Python, and process it there. I evaluate the derivative on a pretty large grid (5000x5000), so exporting all this data is cumbersome.
I have two ideas where I appreciate your input: Does COMSOL allow to replace NaN values with zeros without using a third-party program? I'm aware that the isnan() operator exists, but unsure if it suits the above purpose.
If not: What's the fastest way to export data from COMSOL (i.e. which program should I use)? I'm aware that links to Matlab and other languages exist, but wonder if they are faster.
Thanks