void cnoidalFirstProperties::set( Ostream& os) { scalar m = solve(); // Write the beginning of the sub-dictionary writeBeginning( os ); // Write the already given parameters writeGiven( os, "waveType" ); if (dict_.found( "Tsoft" )) { writeGiven( os, "Tsoft"); } writeGiven( os, "depth"); writeGiven( os, "period"); writeGiven( os, "height"); if (m < 0.0) { Info << "\nPARAMETERS NOT SET\nNo cnoidal wave solution" << " exists for given input\n" << endl; } else { double K = gsl_sf_ellint_Kcomp( Foam::sqrt(m), GSL_PREC_DOUBLE ); double E = gsl_sf_ellint_Ecomp( Foam::sqrt(m), GSL_PREC_DOUBLE ); double A = 2.0/m - 1.0 - 3.0/m*E/K; double L = Foam::sqrt(16.0*m * Foam::pow(K, 2.0)*Foam::pow(d_, 3.0)/(3.0*H_)); double c = Foam::sqrt( G_*d_*(1 + A*H_/d_)); double omega = 2*PI_/T_; if (write_) { writeDerived(os, "omega", omega); writeDerived(os, "length", L); writeDerived(os, "celerity", c); // Locally change the write precision for m to avoid it being // written as 1 instead of 0.9999999999 which makes elliptic // integrals to infinity. unsigned int pre = os.precision( 14 ); writeDerived(os, "m", m); os.precision( pre ); } } writeGiven( os, "direction" ); // Write the relaxation zone writeRelaxationZone( os ); // Write the closing bracket writeEnding( os ); }