[Nek5000-users] common variables

nek5000-users at lists.mcs.anl.gov nek5000-users at lists.mcs.anl.gov
Thu Aug 7 16:42:47 CDT 2014


Hi Van,

 If your variables are not already defined in the code, either in the
 existing common blocks or as parameters, you can either define them in a
 routine or inside a new common block with a name of your choice. However
 to reduce memory overhead it is good to check whether these new variables
 already exist and if so re-use the internal ones (work arrays etc.). But
 be aware of side effects!

 Usually it is good practice to not change anything in the main part of
 the code, as these files are overwritten with every code update. So
 confine your changes to the user file (as Paul just wrote).

 It is also a question of what you want to do with them. I guess you
 already know about user parameters which already are in common blocks.

 Oana
________________________________________
From: nek5000-users-bounces at lists.mcs.anl.gov [nek5000-users-bounces at lists.mcs.anl.gov] on behalf of nek5000-users at lists.mcs.anl.gov [nek5000-users at lists.mcs.anl.gov]
Sent: Thursday, August 07, 2014 4:09 PM
To: nek5000-users at lists.mcs.anl.gov
Subject: Re: [Nek5000-users] common variables

I would normally define my own common block, that is common between
the routines in the .usr file, e.g.

      common /mystuffi/  i1,i2
      common /mystuffr/  a(lx1*ly1*lz1*lelt)

Note that it's important to segregate declared variables by type (i.e., integers
in the first case and reals in the second) in order to assure proper byte alignment.

Paul

________________________________________
From: nek5000-users-bounces at lists.mcs.anl.gov [nek5000-users-bounces at lists.mcs.anl.gov] on behalf of nek5000-users at lists.mcs.anl.gov [nek5000-users at lists.mcs.anl.gov]
Sent: Thursday, August 07, 2014 3:52 PM
To: nek5000-users at lists.mcs.anl.gov
Subject: [Nek5000-users] common variables

I have a number of parameters, which I use in several subroutines in *usr files,
namely userchk, userbc and userf.
I am still not very familiar with code of nek5000 and fortan, so my question is
what is the best way to define only once the whole set of parameters, which would
be visible for all subroutines.

I saw here in that it is recommended to define local variables as common.
Is it better to define your own common block or to user preexisting in nek like
common /scrns/ ?
and in which subroutine it is better to initialize them?

Thank you in advance,
Van
_______________________________________________
Nek5000-users mailing list
Nek5000-users at lists.mcs.anl.gov
https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users
_______________________________________________
Nek5000-users mailing list
Nek5000-users at lists.mcs.anl.gov
https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users


More information about the Nek5000-users mailing list