Error with new variable declaration

Hello,

I declared a variable in module “fields_species_transport” as

double precision,dimension(nx,ny,nz) :: mobility_scalar.

However, when I am compiling, I get the following error:
“An automatic object must not appear in the specification part of a module.”

Is it nor permissible to initialize variables in the fields? If not, then after declaring them, where do we initialize?
Thanks

Hello,
In this module, dimensions are unknows, so you cannot declare fields as you did.
Use allocatable arrays, like it is done for the fields declared in this module:

double precision, dimension(:,:,:,:), allocatable :: species_transport_linear_term

Then allocate the array to the dimension you need into user subroutines (src/lib/user directory)
Regards
Stéphane

Hello,
If I use the relevant module ( grid ) in this module itself, will it be fine? Is this recommended for coding in NOTUS or it is better to do as suggested by you.
Thanks

Sorry I don’t understand the question

Use as much as possible user routines. This way you can switch to more recent notus version ealisy.

In user routines, you can do what you want !

In a function/subroutine:

use variables_grid
double precision, dimension(nx,ny,nz) :: my_cell_scalar

But you cannot and should not do this in a module (like “fields*”).
As @glockner pointed out, you should declare it allocatable (at compilation time) and allocate it as needed when entering the necessary subroutine.

Module defined (“global”) variables and subroutine (“local”) defined variables acts differently.