made better

This commit is contained in:
dino.celebic 2026-01-26 17:56:16 +01:00
commit 1151fb33b2
4 changed files with 56 additions and 14 deletions

View file

@ -88,9 +88,13 @@ int main(int argc, char **argv )
auto t3 = system_clock::now(); // start timer
double average_cup_temperature = u0_mug;
double percentage_temp_reached = 0.0;
double goal_temp = 67.0;
double goal_perc = 60.0;
double time_count = 0;
while (average_cup_temperature < 67.0)
while (average_cup_temperature < goal_temp)
// while (percentage_temp_reached < goal_perc)
//for (int step = 0; step < steps; ++step)
{
vector<double> G(Mdt.Nrows(), 0.0);
@ -106,7 +110,9 @@ int main(int argc, char **argv )
// ----- SK ----- ------ H -------
average_cup_temperature = mesh_c.AverageVectorFunction_perSubdomain(uv, 0);
percentage_temp_reached = mesh_c.CheckTemp_mult(uv, 0, goal_temp);
cout << "Average cup temperature: " << average_cup_temperature << " after " << time_count << " seconds. " << endl;
cout << "% of elements reached temperature " << goal_temp << "ºC: " << percentage_temp_reached << endl;
time_count += dt;
}
auto t4 = system_clock::now(); // stop timer
@ -124,6 +130,7 @@ int main(int argc, char **argv )
t3 = system_clock::now(); // start timer
double average_coffee_temperature = u0_coffee;
percentage_temp_reached = 0.0;
// ------------------------ initialize preCICE ------------------------
int commRank = 0;
@ -162,8 +169,12 @@ int main(int argc, char **argv )
// ------------------------ timestepping ------------------------
goal_temp = 50.0;
goal_perc = 60.0;
time_count = 0;
while (average_coffee_temperature > 50.0)
while (average_cup_temperature > goal_temp)
// while (percentage_temp_reached > goal_perc)
{
preciceDt = participantSolid.getMaxTimeStepSize();
solverDt = 1.0;
@ -190,7 +201,9 @@ int main(int argc, char **argv )
// ----- SK ----- ------ H -------
average_coffee_temperature = mesh_c.AverageVectorFunction_perSubdomain(uv, 1);
percentage_temp_reached = mesh_c.CheckTemp_mult(uv, 0, goal_temp);
cout << "Average coffee temperature: " << average_coffee_temperature << " after " << time_count << " seconds. " << endl;
cout << "% of elements reached temperature " << goal_temp << "ºC: " << percentage_temp_reached << endl;
// ----- write the heat-flux, so openFOAM can read it
{