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.

Running B-field computation at various frequencies

Please login with a confirmed email address before reporting spam

Hello,

I am using COMSOL Multiphysics 6 on a linux system.

I am trying to calculate the B-field from some current configuration and run my model file at various frequencies, saving some derived quantities to file.

The only caveat is, the max mesh size elements should be adjusted as a function of the frequency such that there are 5 elements per wavelength and the min element size is always kept the same.

Hence, for each frequency, I need to first build the mesh, and also output the derived quantity to a file with name indicating the corresponding frequency. Unless I misunderstand, a naive Parameter Sweep is therefore not suitable.

Since I'm not running on windows, I don't have access to Application Builder, which would apparently make my life easier. I would like to submit a job to my cluster to run this calculation in parallel with each frequency running on a different node.

How would I write the batch script here? To be clear, I am not asking how to submit to various nodes, which depends on my cluster architecture; rather I am asking how to approach this conceptually and what the key comsol (not linux!) commands are. I am thinking of defining the frequency as a global parameter 'freq', using a user-controlled mesh with maximum element size defined as a function in terms of 'freq', and then imposing in Study 1, Step 1: Frequency Domain that we run at frequency 'freq'.

I don't know/am unsure how to do the following.

  1. read in the frequency (from e.g,some job array) and tell comsol to run my model file. I believe something like

comsolbatch -inputfile my_file.mph -pname freq -plist freq_val

should work, where freq_val is passed from some job array.

  1. force the model file execution to rebuild the mesh for every frequency
  2. impose in Study 1, Step 1: Frequency Domain that we run at frequency 'freq'. In Frequency Domain tab, Study Settings doesn't seem to give this option.
  3. output the derived quantity of interest for frequency freq_val to a file with a name of the form 'quantity_freq=freq_val'

If there is an easier way to do all this with Parameter or Batch Sweep, please let me know.

I already read: https://www.comsol.com/blogs/how-to-run-comsol-multiphysics-from-the-command-line/ and https://www.comsol.com/support/knowledgebase/1250 but they don't answer my questions.

Thanks!


0 Replies Last Post Mar 1, 2022, 10:19 p.m. EST
COMSOL Moderator

Hello Joshua Benabou

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.