[MITgcm-support] using a module instead of a common block?
Daniel Goldberg
dan.goldberg at ed.ac.uk
Wed Aug 11 17:07:30 EDT 2021
thanks both!!! ah i see... i've actually used packages with modules but had
never actually noticed them! genmake2 is even more clever than i thought!
OK -- I think this all makes sense, and that the "success" below was not by
luck but by genmake2/f90mkdepend. Ill be wary of the suffix, but this seems
ok for now. thank you!!!
dan
On Wed, Aug 11, 2021 at 7:12 PM Jean-Michel Campin <jmc at mit.edu> wrote:
> Hi Dan,
>
> If I remember well, genmake2 take care of this (or more precisely, "make
> depend")
> with the script "tools/f90mkdepend".
> There might be some rules regarding file name (suffix "_mod.F" or
> "_mod.F90" ?)
> that I forgot about.
>
> Also, there are many modules in pkg/atm_phys and it does work in a robust
> way.
>
> And I think this has been mentioned in the past:
> .F90 suffix is for free-format fortran-90 src file
> and
> .F suffix is for fixed format fortran src file (fortran 90 or earlier)
>
> Cheers,
> Jean-Michel
>
> On Wed, Aug 11, 2021 at 06:42:29PM +0200, Martin Losch wrote:
> > Hi Dan,
> >
> > without knowing too much about this, there???s already at least one
> module file in pkg/ptracers/ptracers_dyn_state_mod.F
> > So I am not sure if it is just ???by luck??? that it works for you too,
> because genmake/makedepend also looks for f90 modules, it seems.
> >
> > Martin
> >
> > > On 11. Aug 2021, at 11:47, Daniel Goldberg <dan.goldberg at ed.ac.uk>
> wrote:
> > >
> > > Hello All
> > >
> > > I have been using the STREAMICE package with wrappers to the PETSc
> library for some time now and the functionality requires global scope for
> some petsc objects; i have discovered that from petsc 3.8.x on,
> declarations in common blocks are no longer supported, and one is required
> to use a code module instead.
> > >
> > > i have created a code module file (streamice_petsc_mod.F) and
> referenced via a "use" statement in
> pkg/streamice/streamice_cg_solve_petsc.F. This compiles, and works! -- but
> i was curious and it seems that, by luck, the module file is complied
> before the code file that references it. I think this is because
> streamice_petsc_mod.F is in a separate code folder. I have tested and if
> the compilation is in the reverse order, there is a compilation error.
> > >
> > > Is there any way to ensure that in the genmake2-generated makefile,
> any module file of interest is compiled first, or before other files of
> interest? Would it involve adding functionality to genmake2?
> > >
> > > Many thanks
> > > Dan
> > >
> > > --
> > > --- PLEASE NOTE THAT I AM CURRENTLY WORKING FROM HOME AS A MEASURE OF
> SOCIAL DISTANCING DURING THE COVID-19 PANDEMIC ---
> > >
> > > Daniel Goldberg, PhD
> > > Reader in Glaciology
> > > School of Geosciences, University of Edinburgh
> > > Geography Building, Drummond Street, Edinburgh EH8 9XP
> > >
> > >
> > > em: dan.goldberg at ed.ac.uk
> > > web: https://www.geos.ed.ac.uk/homes/dgoldber
> > > The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336. Is e buidheann carthannais a
> th??? ann an Oilthigh Dhùn Èideann, clàraichte an Alba, àireamh clàraidh
> SC005336.
> > > _______________________________________________
> > > MITgcm-support mailing list
> > > MITgcm-support at mitgcm.org
> > > http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support
> >
>
>
>
> > _______________________________________________
> > MITgcm-support mailing list
> > MITgcm-support at mitgcm.org
> > http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support
>
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support
>
--
--- PLEASE NOTE THAT I AM CURRENTLY WORKING FROM HOME AS A MEASURE OF
SOCIAL DISTANCING DURING THE COVID-19 PANDEMIC ---
Daniel Goldberg, PhD
Reader in Glaciology
School of Geosciences, University of Edinburgh
Geography Building, Drummond Street, Edinburgh EH8 9XP
em: dan.goldberg at ed.ac.uk
web: https://www.geos.ed.ac.uk/homes/dgoldber
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.mitgcm.org/pipermail/mitgcm-support/attachments/20210811/64422dc4/attachment-0001.html>
More information about the MITgcm-support
mailing list