[Users] bug or feature?

Ian Hinder ian.hinder at aei.mpg.de
Mon Sep 7 10:16:45 CDT 2015


On 7 Sep 2015, at 16:40, Comer Duncan <comer.duncan at gmail.com> wrote:

> Hi Ian,
> 
> Thanks for noticing that I don't have the naming correct.  I believe I fixed it. I am attaching the revised script.  However, I still get a crash. Here is the last part of the make with a complaint about sqrtdetg which I don't understand, as it seems that sqrtdetg is properly mentioned and computed in the script. Can you or someone in the list please let me know what's the matter now?

Hi Comer,

(added CC to mailing list which was lost)

The problem is that you are taking a derivative of a shorthand; this isn't possible because shorthands are only defined pointwise.  To take a derivative (finite difference), the variable needs to be a grid function.  sqrtdetg is declared as a shorthand in CT_BrillAnalyticCoefficients.

You could expand the definition of sqrtdetg in terms of the metric, then differentiate it symbolically wrt the metric, and then the required numerical derivatives could be taken of the metric, which is a grid function.  Alternatively, and much more simply, you could add a grid function which you initialise using sqrtdetg in a previous calculation, and then finite-difference it as you are currently doing.  These will have different numerical truncation errors, but this probably doesn't matter in your case.

Kranc should have detected the attempt to use PD on a shorthand.  I have created an issue for this: https://github.com/ianhinder/Kranc/issues/134.

> 
> Checking status of thorn CT_BrillAnalytic
> COMPILING arrangements/Cosmology/CT_Analytic/src/Boundaries.cc
> COMPILING arrangements/Cosmology/CT_Analytic/src/CT_Analytic_BY_Calc.cc
> COMPILING arrangements/Cosmology/CT_BrillAnalytic/src/Boundaries.cc
> COMPILING arrangements/Cosmology/CT_BrillAnalytic/src/CT_BrillAnalyticCoefficients.cc
> COMPILING arrangements/Cosmology/CT_Analytic/src/CT_Analytic_ExactBoundary.cc
> In file included from /Users/comerduncan/Cactus/arrangements/Cosmology/CT_BrillAnalytic/src/CT_BrillAnalyticCoefficients.cc:14:0:
> /Users/comerduncan/Cactus/arrangements/Cosmology/CT_BrillAnalytic/src/CT_BrillAnalyticCoefficients.cc: In function 'void CT_BrillAnalytic::CT_BrillAnalyticCoefficients_Body(const cGH*, int, int, const CCTK_REAL8*, const CCTK_REAL8*, const CCTK_REAL8*, const int*, const int*, int, CCTK_REAL8* const __restrict__*)':
> /Users/comerduncan/Cactus/arrangements/Cosmology/CT_BrillAnalytic/src/CT_BrillAnalyticCoefficients.cc:220:84: error: 'sqrtdetg' was not declared in this scope
>      const CCTK_REAL PDstandardNth1sqrtdetg CCTK_ATTRIBUTE_UNUSED = PDstandardNth1(&sqrtdetg[index]);
>                                                                                     ^
> /Users/comerduncan/Cactus/arrangements/Cosmology/CT_BrillAnalytic/src/Kranc.hh:120:39: note: in definition of macro 'KRANC_GFOFFSET3D'
>    (*(CCTK_REAL const*)&((char const*)(var))[cdi*(i)+cdj*(j)+cdk*(k)])
>                                        ^
> /Users/comerduncan/Cactus/arrangements/Cosmology/CT_BrillAnalytic/src/CT_BrillAnalyticCoefficients.cc:220:68: note: in expansion of macro 'PDstandardNth1'
>      const CCTK_REAL PDstandardNth1sqrtdetg CCTK_ATTRIBUTE_UNUSED = PDstandardNth1(&sqrtdetg[index]);
>                                                                     ^
> make[3]: *** [CT_BrillAnalyticCoefficients.cc.o] Error 1
> make[2]: *** [make.checked] Error 2
> make[1]: *** [/Users/comerduncan/Cactus/configs/sim/lib/libthorn_CT_BrillAnalytic.a] Error 2
> make[1]: *** Waiting for unfinished jobs....
> COMPILING arrangements/Cosmology/CT_Analytic/src/CT_Analytic_Exact_Calc.cc
> COMPILING arrangements/Cosmology/CT_Analytic/src/CT_Analytic_ExpandingLattice_Calc.cc
> COMPILING arrangements/Cosmology/CT_Analytic/src/CT_Analytic_LumpBoundary.cc
> COMPILING arrangements/Cosmology/CT_Analytic/src/CT_Analytic_Lump_Calc.cc
> COMPILING arrangements/Cosmology/CT_Analytic/src/CT_Analytic_Poisson_Calc.cc
> COMPILING arrangements/Cosmology/CT_Analytic/src/Kranc.cc
> COMPILING arrangements/Cosmology/CT_Analytic/src/RegisterMoL.cc
> COMPILING arrangements/Cosmology/CT_Analytic/src/RegisterSymmetries.cc
> COMPILING arrangements/Cosmology/CT_Analytic/src/Startup.cc
> Creating /Users/comerduncan/Cactus/configs/sim/lib/libthorn_CT_Analytic.a
> make: *** [sim] Error 2
> 
> Here is the last
> 
> Thanks for your help.
> 
> Comer
> 
> On Mon, Sep 7, 2015 at 6:21 AM, Ian Hinder <ian.hinder at aei.mpg.de> wrote:
> 
> On 4 Sep 2015, at 16:11, Comer Duncan <comer.duncan at gmail.com> wrote:
> 
>> I have pasted the attempted build to pastebin:  http://pastebin.com/YNDgRKNV
>> 
>> There are several complaints there which may be either due to unseen errors in my Kranc script or other unrelated things.  Please let me know if you see something.  Thanks very much.
> 
> Aha!  You have a calculation with a name which is the same as the thorn name.  Kranc uses the thorn name as a C++ namespace, and calculation names as C++ function names, and these are not allowed to conflict.  This is the error you are seeing:
> 
> 	• In file included from /Users/comerduncan/Cactus/arrangements/Cosmology/CT_BrillAnalytic/src/CT_BrillAnalytic.cc:14:0:
> 	• /Users/comerduncan/Cactus/arrangements/Cosmology/CT_BrillAnalytic/src/Kranc.hh:10:28: error: 'namespace CT_BrillAnalytic { }' redeclared as different kind of symbol
> 	•  namespace CT_BrillAnalytic {
> 	•                             ^
> 	• In file included from /Users/comerduncan/Cactus/configs/sim/bindings/include/CT_BrillAnalytic/cctk.h:6:0,
> 	•                  from /Users/comerduncan/Cactus/arrangements/Cosmology/CT_BrillAnalytic/src/CT_BrillAnalytic.cc:11:
> 	• /Users/comerduncan/Cactus/configs/sim/bindings/include/CT_BrillAnalytic/cctk_ScheduleFunctions.h:35:6: note: previous declaration 'void CT_BrillAnalytic(cGH*)'
> 	•  void CT_BrillAnalytic (CCTK_ARGUMENTS) CCTK_ATTRIBUTE_NONNULL(1);
> 	•       ^
> 
> I had never thought of this issue before; Kranc should prevent you from doing this and give an error at Kranc time.  I just created in issue for this: https://github.com/ianhinder/Kranc/issues/132.  You should just be able to change the name of the calculation from thornName to thornName <> "_<something>".
> 
> In general, I would recommend prefixing all calculation names with the thorn name, to avoid possible conflicts with other thorns.  Cactus doesn't have any thorn-based scoping mechanism, so all scheduled functions are in the same namespace.  You have some calculations called "formgk" and "gupper".  Probably they are fine, but in principle they could conflict with other thorns, so prefixing the names with the thorn name is much safer.
> 
> Ideally, I think I would like Kranc to automatically add such a prefix, but this would break backward compatibility.  Maybe Kranc should print a warning if the calculation name does not start with the thorn name (https://github.com/ianhinder/Kranc/issues/133).
> 
> -- 
> Ian Hinder
> http://members.aei.mpg.de/ianhin
> 
> 
> _______________________________________________
> Users mailing list
> Users at einsteintoolkit.org
> http://lists.einsteintoolkit.org/mailman/listinfo/users
> 
> 
> <CT_BrillAnalytic.m>

-- 
Ian Hinder
http://members.aei.mpg.de/ianhin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.einsteintoolkit.org/pipermail/users/attachments/20150907/2f36658b/attachment-0001.html 


More information about the Users mailing list