Open rmcd-mscb opened 5 years ago
Hello, thanks for your question.
I'm not sure, but I guess we have a solution for such cases. I guess now you use cg_iric_write_sol_real_f, to output result. Please use cg_iric_write_sol_real_mul_f instead, and give different FID values from each models. Each model has different FID values, that it gets when calling cg_open_f.
Thanks, Keisuke
Hi Keisuke, Thanks for your suggestion. Using the *mul_f functions work with one exception. On the second declared object that is writing to cgns with iriclib, it writes a bunch of PolydataSolutionX groups with no data, where X is a number. Otherwise it writes the solution correctly. Would you have any insight? The model has not calls to write PolydataSolutions. I've attached the two cgn files in a zip file.
Thanks, Rich conflicting_instances_test_2.zip
Hi Rich,
Thanks for your information. I've checked the files you've uploaded, and it seems that the files looks invalid, as you've mentioned.
conf_instances_test_1.cgn should have 10 PolydataSolutionX groups, and conf_instances_test_2.cgn should have 10 PolydataSolutionX groups.
But actually, conf_instances_test_1.cgn have no PolydataSolutionX group, and conf_instances_test_2.cgn have 50 PolydataSolutionX groups. Very strange.
I imagined maybe iriclib has a bug. I checked the code of CgnsFile::Impl::addSolutionNode()
, defined at https://github.com/i-RIC/iriclib/blob/master/iriclib_cgnsfile_base.cpp#L704-L732, and it seems right. The code will generate the same number of PolydataSolutionX groups to FlowSolutionX groups etc.
As attached below, I've wrote a test program, and it creates the same number of PolydataSolutionX groups for each CGNS files.
The content of test.c is as below. cg_iRIC_Write_Sol_Time_Mul()
creates PolydataSolutionX groups etc.
#include "cgnslib.h"
#include <iriclib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char* argv) {
int fin1, fin2, ier;
int locked;
int canceled;
char* fname1 = "test1.cgn";
char* fname2 = "test2.cgn";
ier = cg_open(fname1, CG_MODE_MODIFY, &fin1);
if (ier != 0){
printf("*** Open error of CGNS file 1 ***\n");
return 1;
}
ier = cg_open(fname2, CG_MODE_MODIFY, &fin2);
if (ier != 0){
printf("*** Open error of CGNS file 2 ***\n");
return 1;
}
ier = cg_iRIC_Init(fin1);
ier = cg_iRIC_Init(fin2);
for (int i = 0; i < 10; ++i) {
double time = i;
ier = cg_iRIC_Write_Sol_Time_Mul(fin1, time);
ier = cg_iRIC_Write_Sol_Time_Mul(fin2, time);
}
cg_close(fin1);
cg_close(fin2);
return 0;
}
You can test with the following operations. I hope you'll have the same CGNS files that I put into "output" folder in "test_program.zip".
Can you create a simple program like this, to reproduce the issue you have?
Thanks, Keisuke
Would it be possible to make sure the iriclib data are encapsulated? When multiple models are run as in an coupled modeling situation, all output is written to the second initialized model. It maybe as simple as encapsulating the FID of the cgns file.