Question about active solution field

24 views
Skip to first unread message

Filipe Brandao

unread,
Jun 13, 2026, 12:12:36 PM (12 days ago) Jun 13
to Nek5000
Hi, from the tutorial we have that each field has  a given ifield assigned to it:

velocity --> ifield=1
temperature --> ifield=2
scalar 1 --> ifield=3
...

and so on. What happens for a case we just have momentum and passive scalar eqn (no temperature involved)? Will the passive scalar still be ifield=3 or it drops to ifield=2?

Also, no ifield is assigned to pressure?

Thanks
Filipe

YuHsiang Lan

unread,
Jun 13, 2026, 12:50:16 PM (12 days ago) Jun 13
to Nek5000
Hi Filipe,

ifield = 2 is preserved for temperature.
Even though it's off, the temperature still occupies t(1,1,1,1,1). 
Therefore, the code sometimes use ifield = 2 for "temperature mesh", which is typically shared by all passive scalar.
You can then setup BC for scalars via temperature.

Have a look at this RANS example.
usr file still keeps the settings for temperature (ifield = 2) but the par file only has scalars starting from ifield = 3
(You will need to add this if using the latest Nek5000
[MESH]
numberOfBCFields = 1
)

pressure is attached to the fluid solver, so it shares ifield = 1.


For fun, here is a response from ChatGPT agent, Nek5000 Assistant (https://chatgpt.com/g/g-68a731e21f7c8191bcc684cc265a1d79-nek5000-assistant):


Hope this helps,
Yu-Hsiang
--

Filipe Brandao

unread,
Jun 16, 2026, 9:56:42 AM (9 days ago) Jun 16
to Nek5000

So, when assigning BCs, I can just do it like it below skipping ifield=2?

cbc(ifc,iel,1) = 'W  '
cbc(ifc,iel,3) = 'I  '

Also, would this work on usrchk? 

if (ifield.eq.3) call gradm1(dphidx,dphidy,dphidz,t) ... or do I need to assign t(lx1,ly1,lz1,lelt,3) into a temporary variable and then pass it to other subroutines?

Thanks

YuHsiang Lan

unread,
Jun 16, 2026, 10:21:08 AM (9 days ago) Jun 16
to Nek5000
Dear Filipe,

> skipping ifield=2?
Yes, that looks right.

You can also check the logfile to confirm whether it's effective:

  Found the following boundary conditions

    for velocity:

            "P  "           14
            "SYM"            3
            "W  "            3

    for scalar 1:

            "I  "            3
            "P  "           14
            "t  "            3

    for scalar 2:

            "I  "            3
            "P  "           14
            "t  "            3

Inside userchk, you can do this to compute the gradient of t(1,1,1,1,3)
  call gradm1(dphidx,dphidy,dphidz,t(1,1,1,1,3))

gradm1 itself doesn't use ifield. It always use "T" mesh with nelt.

Hope this helps,
Yu-Hsiang
--

Filipe Brandao

unread,
Jun 16, 2026, 6:59:20 PM (8 days ago) Jun 16
to Nek5000
Got it. Thanks

Filipe Brandao

unread,
Jun 17, 2026, 1:51:17 PM (7 days ago) Jun 17
to Nek5000
Hey Yu-Hsiang,

I actually have a follow-up question on this topic. Since the temperature field is still present even though .par file does not specify it, do I need to restart the temperature field as well? Do I need to set XUPTS1 or just XUPS1 works for the 'startFrom' flag in the .par file?

Thanks

YuHsiang Lan

unread,
Jun 17, 2026, 2:28:58 PM (7 days ago) Jun 17
to Nek5000
Hi Filipe,

"XUPS1" should work.
However, Nek5000 will read all available variables from the restart file by default. 
Specifying the restart option is not required unless you want to only read a selected list of fields.


Hope this helps,
Yu-Hsiang
--


Reply all
Reply to author
Forward
0 new messages