Skip to content
Snippets Groups Projects
Commit ed6a40a1 authored by Izzard, Robert Dr (Maths & Physics)'s avatar Izzard, Robert Dr (Maths & Physics)
Browse files

fixed some things in configure

changed F to |F| in discs ... let's see if it works :)
parent bfaab912
No related branches found
No related tags found
No related merge requests found
......@@ -130,6 +130,12 @@ int main ( int argc, char * * argv )
&store,
&argstring,
-1);
fprintf(stderr,
"stardata[%d] = %p; preferences %p\n",
i,
stardata[i],
stardata[i]->preferences);
/* log to APITEST_OUTPUT_STREAM */
strlcpy(stardata[i]->preferences->log_filename,
......
......@@ -1207,9 +1207,10 @@ sub features
undef,
pkg_config => 'gsl',
backup_libs => '-lgsl -lgslcblas',
version =>
version => undef,
required_version => 2.4,
required_libs => ['gsl','gslcblas'],
warn_string => "binary_c looks for the libgsl shared in the usual places your system looks, as well as \$HOME/gsl (which I think is at $ENV{HOME}/gsl), but you can also set the environment variable GSL_DIR to point to the location of libgsl.\n",
},
have_libbacktrace =>
......@@ -1304,8 +1305,9 @@ sub features
{
check => 1,
version => join('.',($^V=~/v(\d+)\.(\d+)/)),
require_version => 5.16,
warn_version => 5.16,
warn_string => "**** Warning: Perl 5.16 and above is required to use binary_grid : please see doc/binary_grid-flexigrid.pdf for details *****\n",
warn_string => "**** Warning: Perl 5.16 and above is required to use binary_grid and is recommended in general : please see doc/binary_grid-flexigrid.pdf for details *****\n",
},
# CPU frequency information
......@@ -1405,11 +1407,14 @@ sub features
# remove features that fail their checks
foreach my $feature (sort keys %$features)
{
if(!$features->{$feature}->{check})
my $f = $features->{$feature};
if(!($f->{check} ||
defined $f->{required_version} ||
defined $f->{require_libs})
)
{
delete $features->{$feature};
}
my $f = $features->{$feature};
if($f->{required_libs})
{
foreach my $lib (@{$f->{required_libs}})
......@@ -1417,6 +1422,7 @@ sub features
if(!checklib('lib'.$lib))
{
print "library $lib not found: it is required! To solve this problem, either install the library, check it is in your library paths (e.g. LD_LIBRARY_PATH and LIBRARY_PATH) or fix the checklib() function in this configure script so that it works properly on your architecture.\n";
print $f->{warn_string} if($f->{warn_string});
exit;
}
}
......@@ -1455,11 +1461,14 @@ sub features
{
print "you either have an inferior version or do not have this installed\n";
}
print $f->{warn_string} if($f->{warn_string});
}
}
#print "Feature $feature : $f->{required_version}\n";
if(defined $f->{required_version} &&
$f->{version} < $f->{required_version})
$f->{version} < $f->{required_version}
)
{
print "Version $f->{required_version} of $feature is required : ";
if($f->{version}=~/\d/)
......@@ -1470,6 +1479,7 @@ sub features
{
print "you either have an inferior version or do not have this installed\n";
}
print $f->{warn_string} if($f->{warn_string});
exit;
}
......
No preview for this file type
No preview for this file type
......@@ -1267,7 +1267,7 @@
/************************************************************
* 2017 treatment of circumstellar and circumbinary discs
************************************************************/
#define DISCS
//#define DISCS
#ifdef DISCS
......@@ -1355,7 +1355,7 @@
/*
* Logging for individual systems with discs
*/
#define DISC_LOG
//#define DISC_LOG
//#define DISC_LOG_2D
......
......@@ -39,6 +39,11 @@ static int GSL_multiroot(struct stardata_t * stardata,
#endif
static Boolean check_local_minimum(struct stardata_t * stardata,
struct disc_t * disc,
struct binary_system_t * binary);
static int bisection_rooter(struct stardata_t * stardata,
struct disc_t * disc,
......@@ -591,6 +596,14 @@ int disc_calc_disc_structure(struct binary_system_t * binary,
Convergence_status(disc->converged));
disc_convergence_status("calc_structure_return",disc,binary);
Safe_free(discwas);
if(0 && disc->converged)
{
check_local_minimum(stardata,disc,binary);
}
return ret;
}
......@@ -1505,10 +1518,85 @@ static int bisection_rooter(struct stardata_t * stardata,
* Set return values
*/
*return_failed = failed;
if(0 && disc->converged)
{
check_local_minimum(stardata,disc,binary);
}
return converged;
}
static Boolean check_local_minimum(struct stardata_t * stardata,
struct disc_t * disc,
struct binary_system_t * binary)
{
/*
* Check if the disc is at a local minimum in parameter space
*/
/*
* Step size: assume 10 * tolerance, although this
* is a bit rough.
*/
double d = DISC_TOLERANCE * 100.0;
/*
* Make a copy of the input disc
*/
struct disc_t * testdisc = MALLOC(sizeof(struct disc_t));
/*
* epsilons
*/
#define Perturb(V,N) \
double d##V = d * disc->V; \
double xx##V##low[3],xx##V##mid[3],xx##V##hi[3]; \
\
memcpy(testdisc,disc,sizeof(struct disc_t)); \
testdisc->V = disc->V - d##V; \
disc_trisector2(testdisc,binary,xx##V##low); \
PRINTF("LOCAL %s LOW xx##V %g %g %g\n",Stringify(V),xx##V##low[0],xx##V##low[1],xx##V##low[2]); \
\
memcpy(testdisc,disc,sizeof(struct disc_t)); \
testdisc->V = disc->V; \
disc_trisector2(testdisc,binary,xx##V##mid); \
PRINTF("LOCAL %s MID xx##V %g %g %g\n",Stringify(V),xx##V##mid[0],xx##V##mid[1],xx##V##mid[2]); \
\
memcpy(testdisc,disc,sizeof(struct disc_t)); \
testdisc->V = disc->V + d##V; \
disc_trisector2(testdisc,binary,xx##V##hi); \
PRINTF("LOCAL %s HIGH xx##V %g %g %g\n", \
Stringify(V), \
xx##V##hi[0], \
xx##V##hi[1], \
xx##V##hi[2]); \
\
if(fabs(xx##V##low[N]) > fabs(xx##V##mid[N]) && \
fabs(xx##V##hi[N]) > fabs(xx##V##mid[N])) \
{ \
PRINTF("LOCALTEST OK\n"); \
} \
else \
{ \
PRINTF("LOCALTEST FAIL\n"); \
if(0)Exit_binary_c(2,"pants"); \
}
/*
* Perturb variables
*/
Perturb(Tvisc0,0);
Perturb(Rin,1);
Perturb(Rout,2);
Safe_free(testdisc);
return TRUE;
}
#endif // DISCS && DISCS_JERMYN
......@@ -257,6 +257,9 @@ void disc_trisector(const double Tvisc0,
const double Rout,
double *xx,
void * p);
void disc_trisector2(struct disc_t * disc,
struct binary_system_t * binary,
double *xx);
void disc_convergence_status(char * s,
struct disc_t * disc,
......
......@@ -19,6 +19,8 @@
* is converged.
*/
void disc_trisector(const double Tvisc0,
const double Rin,
const double Rout,
......@@ -29,6 +31,11 @@ void disc_trisector(const double Tvisc0,
struct disc_t * disc = va_arg(args, struct disc_t *);
struct binary_system_t * binary = va_arg(args,struct binary_system_t * );
va_end(args);
disc->Tvisc0 = Tvisc0;
disc->Rin = Rin;
disc->Rout = Rout;
Discdebug(2,
"Trisect Rin=%g Rout=%g Tvisc0=%g (disc=%p binary=%p)\n",
Rin,
......@@ -36,10 +43,21 @@ void disc_trisector(const double Tvisc0,
Tvisc0,
disc,
binary);
disc->Tvisc0 = Tvisc0;
disc->Rin = Rin;
disc->Rout = Rout;
disc_trisector2(disc,
binary,
xx);
}
void disc_trisector2(struct disc_t * disc,
struct binary_system_t * binary,
double *xx)
{
/*
*
*/
int status = disc_build_disc_zones(disc,binary);
......@@ -66,7 +84,7 @@ void disc_trisector(const double Tvisc0,
);
xx[0] = M/disc->M - 1.0;
xx[1] = J/disc->J - 1.0;
xx[2] = F/disc->F - 1.0;
xx[2] = fabs(F/disc->F) - 1.0;
}
else
{
......@@ -76,5 +94,4 @@ void disc_trisector(const double Tvisc0,
}
}
#endif // DISCS
......@@ -26,6 +26,6 @@ echo "Making zip file"
ZIPFILE="binary_c-$VERSION.zip"
echo "Big zip file : $ZIPFILE"
zip -u -9 -r -y $ZIPFILE src/*.c src/*/*.c src/*.sh src/*/*.sh src/*.h src/*/*.h src/*/*.plt src/gnuplot/* src/Makefile make Makefile ./configure tbse doc/* zipup TODO README LICENCE CHANGES src/perl/* networks apitest/*.c apitest/*.sh apitest/*.f90 apitest/*.pl apitest/*.so apitest/Make* apitest/README -x \*svn\* -x \*.o
zip -u -9 -r -y $ZIPFILE data_object_list.sh double2bin.c test.c src/*.c src/*/*.c src/*.sh src/*/*.sh src/*.h src/*/*.h src/*/*.plt src/gnuplot/* src/Makefile make Makefile ./configure tbse doc/* zipup TODO README LICENCE CHANGES src/perl/* networks apitest/*.c apitest/*.sh apitest/*.f90 apitest/*.pl apitest/*.so apitest/Make* apitest/README -x \*svn\* -x \*.o
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment