← Back to team overview

dolfin team mailing list archive

Re: [FFC-dev] long type for constants

 

On Sat, Apr 26, 2008 at 07:45:02AM -0700, Reza Farrahi Moghaddam wrote:
> Here are the two lines in the header file which cause that error.
> I can manually bypass these errors by adding "LL" to the end of all integer
> values in these two line.
> The header file is also attached.
>  
> Reza

There shouldn't really be any integer values in the generated code.

Can you try experimenting with changing lines 176-177 in

    src/ffc/compiler/format/ufcformat.py

in the FFC source code? The "floating point" format string controls
how floats are written to the generated code. Now, they are written as

    "%<n>g"

where <n> is the number of digits of precision. See if it works better
for you by changing from "g" to "e".

Then I can change in FFC.

-- 
Anders


>     // Compute element tensor
>     A[0] = 14629058957.1625*G0_0_0_0_0_0_0 - 2925812906.735*G1_0_0_0_0_0_0 -
> 558466236.0275*G2_0_0_0_0_0_0 - 14629058957.1625*G3_0_0_0_0_0_0 +
> 2925812906.735*G4_0_0_0_0_0_0 + 558466236.0275*G5_0_0_0_0_0_0 +
> 280363028.233182*G6_0_0_0_0 - 93454378.3687879*G7_0_0_0_0 -
> 8918383.04439399*G8_0_0_0_0 - 14629053380.65*G9_0_0_0_0_0_0 +
> 2925810676.13*G10_0_0_0_0_0_0 + 558462890.12*G11_0_0_0_0_0_0 +
> 14629053380.65*G12_0_0_0_0_0_0 - 2925810676.13*G13_0_0_0_0_0_0 -
> 558462890.12*G14_0_0_0_0_0_0 - 280362921.36*G15_0_0_0_0 +
> 93454307.1199999*G16_0_0_0_0 + 8918347.41999999*G17_0_0_0_0 +
> 995018.760969999*G18_0_0 - 177990266.82*G19_0_0_0_0 + 177990266.82*G20_0_0_0_0
> + 1114248.1262*G21_0_0_0 - 530594.35*G22_0_0_0 - 583653.776199999*G23_0_0_0 +
> 132891660*G24_0_0_0_0_0 - 101329890.75*G25_0_0_0_0_0 -
> 134552805.75*G26_0_0_0_0_0 + 101329890.75*G27_0_0_0_0_0 +
> 1661145.75*G28_0_0_0_0_0 - 132891660*G29_0_0_0_0_0 + 134552805.75*G30_0_0_0_0_0
> - 1661145.75*G31_0_0_0_0_0 - 106.873182*G32_0_0_0_0 +
> 71.2487879999999*G33_0_0_0_0 + 35.624394*G34_0_0_0_0 -
> 5576.5125*G35_0_0_0_0_0_0 + 2230.605*G36_0_0_0_0_0_0 +
> 3345.9075*G37_0_0_0_0_0_0 + 5576.5125*G38_0_0_0_0_0_0 -
> 2230.605*G39_0_0_0_0_0_0 - 3345.9075*G40_0_0_0_0_0_0 -
> 11144779814.4*G41_0_0_0_0_0_0 + 213732223831*G42_0_0_0_0_0_0_0_0 -
> 174456373500*G43_0_0_0_0_0_0_0_0 - 30533174833*G44_0_0_0_0_0_0_0_0 -
> 8742675497.99999*G45_0_0_0_0_0_0_0_0 - 213732223831*G46_0_0_0_0_0_0_0_0 +
> 174456373500*G47_0_0_0_0_0_0_0_0 + 30533174833*G48_0_0_0_0_0_0_0_0 +
> 8742675497.99999*G49_0_0_0_0_0_0_0_0 + 2964340087.5*G50_0_0_0_0_0_0_0 -
> 468053712.5*G51_0_0_0_0_0_0_0 - 2496286375*G52_0_0_0_0_0_0_0 -
> 2964340087.5*G53_0_0_0_0_0_0_0 + 468053712.5*G54_0_0_0_0_0_0_0 +
> 2496286375*G55_0_0_0_0_0_0_0 + 11144779814.4*G56_0_0_0_0_0_0 -
> 3120357900*G57_0_0_0_0_0_0_0 + 520059650*G58_0_0_0_0_0_0_0 +
> 2600298250*G59_0_0_0_0_0_0_0 + 3120357900*G60_0_0_0_0_0_0_0 -
> 520059650*G61_0_0_0_0_0_0_0 - 2600298250*G62_0_0_0_0_0_0_0 -
> 31561769.25*G63_0_0_0_0_0 + 33222915*G64_0_0_0_0_0 +
> 156017812.5*G65_0_0_0_0_0_0_0 - 52005937.5*G66_0_0_0_0_0_0_0 -
> 104011875*G67_0_0_0_0_0_0_0 - 156017812.5*G68_0_0_0_0_0_0_0 +
> 52005937.5*G69_0_0_0_0_0_0_0 + 104011875*G70_0_0_0_0_0_0_0 +
> 31561769.25*G71_0_0_0_0_0 - 33222915*G72_0_0_0_0_0;
> 
> and
>  
>    // Compute element tensor
>     A[0] = -995018.760969999*G47_0_0_0 + 947545.037399999*G48_0_0_0 -
> 93454342.7443939*G49_0_0_0_0_0 + 88995133.4099999*G50_0_0_0_0_0 +
> 4459209.334394*G51_0_0_0_0_0 + 93454307.1199999*G52_0_0_0_0_0 -
> 88995133.4099999*G53_0_0_0_0_0 - 4459173.71*G54_0_0_0_0_0 -
> 557124.0631*G55_0_0_0_0 + 557124.0631*G56_0_0_0_0 +
> 93454342.7443939*G57_0_0_0_0_0 - 4459209.334394*G58_0_0_0_0_0 -
> 93454307.1199999*G59_0_0_0_0_0 + 4459173.71*G60_0_0_0_0_0 +
> 530594.35*G61_0_0_0_0 - 530594.35*G62_0_0_0_0 -
> 2925811791.4325*G63_0_0_0_0_0_0_0 + 2786194953.6*G64_0_0_0_0_0_0_0 +
> 139616837.8325*G65_0_0_0_0_0_0_0 + 2925810676.13*G66_0_0_0_0_0_0_0 -
> 2786194953.6*G67_0_0_0_0_0_0_0 - 139615722.53*G68_0_0_0_0_0_0_0 -
> 33222915*G69_0_0_0_0_0_0 + 33222915*G70_0_0_0_0_0_0 +
> 2925811791.4325*G71_0_0_0_0_0_0_0 - 139616837.8325*G72_0_0_0_0_0_0_0 -
> 2925810676.13*G73_0_0_0_0_0_0_0 + 139615722.53*G74_0_0_0_0_0_0_0 -
> 30533174833*G75_0_0_0_0_0_0_0_0_0 + 29076062250*G76_0_0_0_0_0_0_0_0_0 +
> 1457112583*G77_0_0_0_0_0_0_0_0_0 + 30533174833*G78_0_0_0_0_0_0_0_0_0 -
> 29076062250*G79_0_0_0_0_0_0_0_0_0 - 1457112583*G80_0_0_0_0_0_0_0_0_0 -
> 494056681.25*G81_0_0_0_0_0_0_0_0 + 494056681.25*G82_0_0_0_0_0_0_0_0 +
> 520059650*G83_0_0_0_0_0_0_0_0 - 520059650*G84_0_0_0_0_0_0_0_0 -
> 26002968.75*G85_0_0_0_0_0_0_0_0 + 26002968.75*G86_0_0_0_0_0_0_0_0 +
> 1115.3025*G87_0_0_0_0_0_0_0 - 1115.3025*G88_0_0_0_0_0_0_0 +
> 35.624394*G89_0_0_0_0_0 - 35.624394*G90_0_0_0_0_0 + 47473.72357*G91_0_0_0 +
> 26529.7131*G92_0_0_0_0 - 26529.7131*G93_0_0_0_0;
>  
> ----- Original Message ----
> From: Anders Logg <logg@xxxxxxxxx>
> To: ffc-dev@xxxxxxxxxx; dolfin mailing list <dolfin-dev@xxxxxxxxxx>
> Sent: Saturday, April 26, 2008 3:26:17 AM
> Subject: Re: [DOLFIN-dev] [FFC-dev] long type for constants
> 
> Can you attach the relevant portions of the header file?
> 

> # Copyright (C) 2005 Garth N. Wells.
> # Licensed under the GNU LGPL Version 2.1.
> #
> # The linearised bilinear form a(v, U) and linear form L(v) for
> # the nonlinear equation 
> #
> # Compile this form with FFC: ffc NonlinearPoisson.form.
> # u is the solution, delta u is a variation for liniearization, and u0 is the input 
> 
> element = FiniteElement("Discontinuous Lagrange", "triangle", 0)
> 
> # sigmaa=.02;
> 
> # ac = 15.41;bc = 55.0;cc = 49.21;dc = 30.75;ec = 0.;fc = 98.22;
> # ac became 1541.0 based on assumption that there is a parameter of value of 0.1 in the argument.
> 
> # dac = -1691.25;dbc = 0.7254;dcc = 5402.1;ddc = 945.563;dec = 6040.53;dfc = 9647.17;
> 
> # ac = 1541.0;
> # bc = 550.0;
> # cc = 49.21;
> ac = 154.10;
> bc = 55.00;
> cc = 4.921;
> dc = 3075.0;
> ec = 0.;
> fc = 98.22;
> 
> # dac = -169125.0;
> # dbc = 07.254;
> # dcc = 5402.1;
> dac = -16912.50;
> dbc = 0.7254;
> dcc = 540.21;
> ddc = 9455630.0;
> dec = 604053.0;
> dfc = 9647.17;
> 
> v = TestFunction(element)
> deltau = TrialFunction(element)
> u = Function(element)
> u0 = Function(element)
> ub = Function(element)
> ub0 = Function(element)
> sigmaa = Function(element)
> 
> 
> 
> a = dx*(deltau*(2*cc*(dfc + (u - ub)*(ddc*(u - ub)*(u - ub)*(5*u - ub - 4*ub0) + dec*(3*u - ub - 2*ub0))) + 
>     2*dfc*(fc + ec*(2*u - u0 - ub) + (u - ub)*(dc*(3*u - 2*u0 - ub) + ac*(3*u - ub - 2*ub0)) + bc*(2*u - ub - ub0)) + 
>     dcc*(2*fc + ec*(3*u - 2*ub - ub0) + 2*dc*(u - ub)*(2*u - ub - ub0))*(u - ub0) + 
>     dbc*(u - ub0)*(fc*(3*u - 2*ub - ub0) + (u - ub)*(dc*(u - ub)*(5*u - 2*ub - 3*ub0) + ec*(4*u - 2*(ub + ub0)))) + 
>     (u - ub)*(2*ddc*(u - ub)*(u - ub)*(fc*(5*u - 4*u0 - ub) + (u - ub)*(ec*(6*u - 5*u0 - ub) + 
>           (u - ub)*(dc*(7*u - 6*u0 - ub) + ac*(7*u - ub - 6*ub0)) + bc*(6*u - ub - 5*ub0))) + 
>       2*dec*(fc*(3*u - 2*u0 - ub) + (u - ub)*(ec*(4*u - 3*u0 - ub) + (u - ub)*(dc*(5*u - 4*u0 - ub) + ac*(5*u - ub - 4*ub0)) + 
>           bc*(4*u - ub - 3*ub0))) + dac*(u - ub0)*((u - ub)*(ec*(5*u - 2*ub - 3*ub0) + 2*dc*(u - ub)*(3*u - ub - 2*ub0)) + 
>         fc*(4*u - 2*(ub + ub0)))))*v*sigmaa*sigmaa + 
>   2*(2*dfc*(fc*(u - u0) + (u - ub)*(ec*(u - u0) + (u - ub)*(dc*(u - u0) + ac*(u - ub0)) + bc*(u - ub0))) + 
>     (u - ub)*((u - ub)*(2*dec*(fc*(u - u0) + (u - ub)*(ec*(u - u0) + (u - ub)*(dc*(u - u0) + ac*(u - ub0)) + bc*(u - ub0))) + 
>         2*ddc*(u - ub)*(u - ub)*(fc*(u - u0) + (u - ub)*(ec*(u - u0) + (u - ub)*(dc*(u - u0) + ac*(u - ub0)) + bc*(u - ub0))) + 
>         dac*(fc + (ec + dc*(u - ub))*(u - ub))*(u - ub0)*(u - ub0)) + dbc*(fc + (ec + dc*(u - ub))*(u - ub))*(u - ub0)*(u - ub0)) + 
>     2*cc*(dfc + (dec + ddc*(u - ub)*(u - ub))*(u - ub)*(u - ub))*(u - ub0) + dcc*(fc + (ec + dc*(u - ub))*(u - ub))*(u - ub0)*(u - ub0))*v*
>    dot(grad(deltau), grad(u)) + 2*(fc + (ec + dc*(u - ub))*(u - ub))*(dfc + (dec + ddc*(u - ub)*(u - ub))*(u - ub)*(u - ub))*sigmaa*sigmaa*
>    dot(grad(deltau), grad(v)) + deltau*((2*cc*(dfc + (u - ub)*(ddc*(u - ub)*(u - ub)*(5*u - ub - 4*ub0) + dec*(3*u - ub - 2*ub0))) + 
>       2*dfc*(fc + ec*(2*u - u0 - ub) + (u - ub)*(dc*(3*u - 2*u0 - ub) + ac*(3*u - ub - 2*ub0)) + bc*(2*u - ub - ub0)) + 
>       dcc*(2*fc + ec*(3*u - 2*ub - ub0) + 2*dc*(u - ub)*(2*u - ub - ub0))*(u - ub0) + 
>       dbc*(u - ub0)*(fc*(3*u - 2*ub - ub0) + (u - ub)*(dc*(u - ub)*(5*u - 2*ub - 3*ub0) + ec*(4*u - 2*(ub + ub0)))) + 
>       (u - ub)*(2*ddc*(u - ub)*(u - ub)*(fc*(5*u - 4*u0 - ub) + (u - ub)*(ec*(6*u - 5*u0 - ub) + 
>             (u - ub)*(dc*(7*u - 6*u0 - ub) + ac*(7*u - ub - 6*ub0)) + bc*(6*u - ub - 5*ub0))) + 
>         2*dec*(fc*(3*u - 2*u0 - ub) + (u - ub)*(ec*(4*u - 3*u0 - ub) + (u - ub)*(dc*(5*u - 4*u0 - ub) + 
>               ac*(5*u - ub - 4*ub0)) + bc*(4*u - ub - 3*ub0))) + dac*(u - ub0)*
>          ((u - ub)*(ec*(5*u - 2*ub - 3*ub0) + 2*dc*(u - ub)*(3*u - ub - 2*ub0)) + fc*(4*u - 2*(ub + ub0)))))*v*
>      dot(grad(u), grad(u)) + 2*(dfc*(ec + 2*dc*(u - ub)) + (dec*(2*fc + (3*ec + 4*dc*(u - ub))*(u - ub)) + 
>         ddc*(4*fc + (5*ec + 6*dc*(u - ub))*(u - ub))*(u - ub)*(u - ub))*(u - ub))*sigmaa*sigmaa*dot(grad(u), grad(v))))
> 
> 
> L = dx*(-1.0*((2*dfc*(fc*(u - u0) + (u - ub)*(ec*(u - u0) + (u - ub)*(dc*(u - u0) + ac*(u - ub0)) + bc*(u - ub0))) + 
>     (u - ub)*((u - ub)*(2*dec*(fc*(u - u0) + (u - ub)*(ec*(u - u0) + (u - ub)*(dc*(u - u0) + ac*(u - ub0)) + bc*(u - ub0))) + 
>         2*ddc*(u - ub)*(u - ub)*(fc*(u - u0) + (u - ub)*(ec*(u - u0) + (u - ub)*(dc*(u - u0) + ac*(u - ub0)) + bc*(u - ub0))) + 
>         dac*(fc + (ec + dc*(u - ub))*(u - ub))*(u - ub0)*(u - ub0)) + dbc*(fc + (ec + dc*(u - ub))*(u - ub))*(u - ub0)*(u - ub0)) + 
>     2*cc*(dfc + (dec + ddc*(u - ub)*(u - ub))*(u - ub)*(u - ub))*(u - ub0) + dcc*(fc + (ec + dc*(u - ub))*(u - ub))*(u - ub0)*(u - ub0))*v*
>    dot(grad(u), grad(u)) + 
>   sigmaa*sigmaa*((2*dfc*(fc*(u - u0) + (u - ub)*(ec*(u - u0) + (u - ub)*(dc*(u - u0) + ac*(u - ub0)) + bc*(u - ub0))) + 
>       (u - ub)*((u - ub)*(2*dec*(fc*(u - u0) + (u - ub)*(ec*(u - u0) + (u - ub)*(dc*(u - u0) + ac*(u - ub0)) + bc*(u - ub0))) + 
>           2*ddc*(u - ub)*(u - ub)*(fc*(u - u0) + (u - ub)*(ec*(u - u0) + (u - ub)*(dc*(u - u0) + ac*(u - ub0)) + bc*(u - ub0))) + 
>           dac*(fc + (ec + dc*(u - ub))*(u - ub))*(u - ub0)*(u - ub0)) + dbc*(fc + (ec + dc*(u - ub))*(u - ub))*(u - ub0)*(u - ub0)) + 
>       2*cc*(dfc + (dec + ddc*(u - ub)*(u - ub))*(u - ub)*(u - ub))*(u - ub0) + dcc*(fc + (ec + dc*(u - ub))*(u - ub))*(u - ub0)*(u - ub0))*v + 
>     2*(fc + (ec + dc*(u - ub))*(u - ub))*(dfc + (dec + ddc*(u - ub)*(u - ub))*(u - ub)*(u - ub))*dot(grad(u), grad(v)))))
>    

> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev



References