Changeset 1182
- Timestamp:
- 06/23/17 15:01:47 (7 years ago)
- Location:
- XIOS/trunk/doc
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/doc/XIOS_reference_guide.lyx
r1084 r1182 3437 3437 3438 3438 \begin_layout Subsection* 3439 check_if_active: 3440 \emph on 3441 bool 3442 \end_layout 3443 3444 \begin_layout Standard 3445 Fortran: 3446 \end_layout 3447 3448 \begin_layout LyX-Code 3449 LOGICAL :: check_if_active 3450 \end_layout 3451 3452 \begin_layout Standard 3453 Define whether XIOS will automatically check if the field is active at current 3454 timestep when sending data from the model. 3455 Enabling this behavior can sometimes improve the performances by avoiding 3456 unneeded data processing. 3457 This attribute is optional, the default value is 3458 \begin_inset Flex Strong 3459 status collapsed 3460 3461 \begin_layout Plain Layout 3462 false 3463 \end_layout 3464 3465 \end_inset 3466 3467 . 3468 \end_layout 3469 3470 \begin_layout Subsection* 3439 3471 field_ref: 3440 3472 \emph on -
XIOS/trunk/doc/XIOS_user_guide.lyx
r1084 r1182 188 188 \begin_layout Plain Layout 189 189 190 ! Context initialization om mited, see the corresponding section of this190 ! Context initialization omitted, see the corresponding section of this 191 191 user manual and of the reference manual 192 192 \end_layout … … 293 293 \begin_layout Plain Layout 294 294 295 ! Context initialization om mited, see the corresponding section of this295 ! Context initialization omitted, see the corresponding section of this 296 296 user manual and of the reference manual 297 297 \end_layout … … 476 476 \begin_layout Plain Layout 477 477 478 ! Context initialization om mited, see the corresponding section of this478 ! Context initialization omitted, see the corresponding section of this 479 479 user manual and of the reference manual 480 480 \end_layout … … 524 524 \begin_layout Plain Layout 525 525 526 ! Context initialization om mited, see the corresponding section of this526 ! Context initialization omitted, see the corresponding section of this 527 527 user manual and of the reference manual 528 528 \end_layout … … 788 788 \begin_layout Plain Layout 789 789 790 ! Context initialization om mited, see the corresponding section of this790 ! Context initialization omitted, see the corresponding section of this 791 791 user manual and of the reference manual 792 792 \end_layout … … 1330 1330 \begin_layout Plain Layout 1331 1331 1332 <!-- Content of the file om mited for now -->1332 <!-- Content of the file omitted for now --> 1333 1333 \end_layout 1334 1334 … … 1428 1428 \begin_layout Plain Layout 1429 1429 1430 ! Context and calendar initializations om mited, see the corresponding section1430 ! Context and calendar initializations omitted, see the corresponding section 1431 1431 of this user manual and of the reference manual 1432 1432 \end_layout … … 1953 1953 \begin_layout Plain Layout 1954 1954 1955 <!-- Content of the file om mited for now -->1955 <!-- Content of the file omitted for now --> 1956 1956 \end_layout 1957 1957 … … 2195 2195 \begin_layout Plain Layout 2196 2196 2197 <grid id="grid_A"><!-- Definition om mited --></grid>2197 <grid id="grid_A"><!-- Definition omitted --></grid> 2198 2198 \end_layout 2199 2199 … … 2457 2457 \begin_layout Plain Layout 2458 2458 2459 ! Context, calendar and grid initializations om mited, see the corresponding2459 ! Context, calendar and grid initializations omitted, see the corresponding 2460 2460 section of this user manual and of the reference manual 2461 2461 \end_layout … … 2736 2736 \begin_layout Plain Layout 2737 2737 2738 <grid id="grid_A"><!-- Definition om mited --></grid>2738 <grid id="grid_A"><!-- Definition omitted --></grid> 2739 2739 \end_layout 2740 2740 … … 3199 3199 \begin_layout Plain Layout 3200 3200 3201 <grid id="grid_A"><!-- Definition om mited --></grid>3201 <grid id="grid_A"><!-- Definition omitted --></grid> 3202 3202 \end_layout 3203 3203 … … 3309 3309 \begin_layout Plain Layout 3310 3310 3311 <grid id="grid_A"><!-- Definition om mited --></grid>3311 <grid id="grid_A"><!-- Definition omitted --></grid> 3312 3312 \end_layout 3313 3313 … … 3460 3460 \begin_layout Plain Layout 3461 3461 3462 <grid id="grid_A"><!-- Definition om mited --></grid>3462 <grid id="grid_A"><!-- Definition omitted --></grid> 3463 3463 \end_layout 3464 3464 … … 3609 3609 \begin_layout Plain Layout 3610 3610 3611 <grid id="grid_A"><!-- Definition om mited --></grid>3611 <grid id="grid_A"><!-- Definition omitted --></grid> 3612 3612 \end_layout 3613 3613 … … 3801 3801 \begin_layout Plain Layout 3802 3802 3803 <grid id="grid_A"><!-- Definition om mited --></grid>3803 <grid id="grid_A"><!-- Definition omitted --></grid> 3804 3804 \end_layout 3805 3805 … … 3942 3942 \begin_layout Plain Layout 3943 3943 3944 <grid id="grid_A"><!-- Definition om mited --></grid>3944 <grid id="grid_A"><!-- Definition omitted --></grid> 3945 3945 \end_layout 3946 3946 … … 4082 4082 \begin_layout Plain Layout 4083 4083 4084 <grid id="grid_A"><!-- Definition om mited --></grid>4084 <grid id="grid_A"><!-- Definition omitted --></grid> 4085 4085 \end_layout 4086 4086 … … 4278 4278 \begin_layout Plain Layout 4279 4279 4280 <grid id="grid_A"><!-- Definition om mited --></grid>4280 <grid id="grid_A"><!-- Definition omitted --></grid> 4281 4281 \end_layout 4282 4282 … … 4457 4457 \begin_layout Plain Layout 4458 4458 4459 <grid id="grid_A"><!-- Definition om mited --></grid>4459 <grid id="grid_A"><!-- Definition omitted --></grid> 4460 4460 \end_layout 4461 4461 … … 4564 4564 , the requested data will never be available and a deadlock could occur. 4565 4565 In practice, XIOS will detect the problem and throw an error. 4566 \end_layout 4567 4568 \begin_layout Section 4569 How to check whether a field is active or not 4570 \end_layout 4571 4572 \begin_layout Standard 4573 Since XIOS allows modifying the output and input files at runtime, it is 4574 sometimes useful to be able to dynamically query whether a field is active 4575 or not from the model (for example to avoid computing a field that would 4576 not be used anyway for the current run). 4577 \begin_inset Newline newline 4578 \end_inset 4579 4580 4581 \begin_inset Newline newline 4582 \end_inset 4583 4584 This can be done using the 4585 \begin_inset Flex Code 4586 status open 4587 4588 \begin_layout Plain Layout 4589 xios_field_is_active 4590 \end_layout 4591 4592 \end_inset 4593 4594 function. 4595 The following code sample shows how this function could be used in a model: 4596 \end_layout 4597 4598 \begin_layout Standard 4599 \begin_inset listings 4600 lstparams "language=Fortran,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" 4601 inline false 4602 status open 4603 4604 \begin_layout Plain Layout 4605 4606 IF (xios_field_is_active("field_A")) THEN 4607 \end_layout 4608 4609 \begin_layout Plain Layout 4610 4611 ! Computation of field_A 4612 \end_layout 4613 4614 \begin_layout Plain Layout 4615 4616 ! ... 4617 \end_layout 4618 4619 \begin_layout Plain Layout 4620 4621 \end_layout 4622 4623 \begin_layout Plain Layout 4624 4625 CALL xios_send_field("field_A", field_A) 4626 \end_layout 4627 4628 \begin_layout Plain Layout 4629 4630 ENDIF 4631 \end_layout 4632 4633 \end_inset 4634 4635 Note that this function takes into account the possible data dependencies 4636 that can exist between fields. 4637 That is, a field will be considered active if it used to compute another 4638 active field even if it is not directly used in any files. 4639 \begin_inset Newline newline 4640 \end_inset 4641 4642 4643 \begin_inset Newline newline 4644 \end_inset 4645 4646 The 4647 \begin_inset Flex Code 4648 status open 4649 4650 \begin_layout Plain Layout 4651 xios_field_is_active 4652 \end_layout 4653 4654 \end_inset 4655 4656 function accepts an optional boolean argument 4657 \begin_inset Flex Code 4658 status open 4659 4660 \begin_layout Plain Layout 4661 at_current_timestep 4662 \end_layout 4663 4664 \end_inset 4665 4666 which defaults to 4667 \series bold 4668 false 4669 \series default 4670 if omitted. 4671 Setting it to 4672 \series bold 4673 true 4674 \series default 4675 allows checking if an input field is active at the current timestep, taking 4676 into account the data sampling and temporal operations. 4677 \begin_inset Newline newline 4678 \end_inset 4679 4680 4681 \begin_inset Newline newline 4682 \end_inset 4683 4684 Considering the following configuration file: 4685 \begin_inset listings 4686 lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" 4687 inline false 4688 status open 4689 4690 \begin_layout Plain Layout 4691 4692 <?xml version="1.0"?> 4693 \end_layout 4694 4695 \begin_layout Plain Layout 4696 4697 <simulation> 4698 \end_layout 4699 4700 \begin_layout Plain Layout 4701 4702 <context id="test"> 4703 \end_layout 4704 4705 \begin_layout Plain Layout 4706 4707 <calendar type="Gregorian" timestep="1h" /> 4708 \end_layout 4709 4710 \begin_layout Plain Layout 4711 4712 \end_layout 4713 4714 \begin_layout Plain Layout 4715 4716 <grid_definition> 4717 \end_layout 4718 4719 \begin_layout Plain Layout 4720 4721 <grid id="grid_A"><!-- Definition omitted --></grid> 4722 \end_layout 4723 4724 \begin_layout Plain Layout 4725 4726 </grid_definition> 4727 \end_layout 4728 4729 \begin_layout Plain Layout 4730 4731 \end_layout 4732 4733 \begin_layout Plain Layout 4734 4735 <field_definition> 4736 \end_layout 4737 4738 \begin_layout Plain Layout 4739 4740 <field id="field_A" grid_ref="grid_A" operation="instant" /> 4741 \end_layout 4742 4743 \begin_layout Plain Layout 4744 4745 <field id="field_B" grid_ref="grid_A" operation="instant" /> 4746 \end_layout 4747 4748 \begin_layout Plain Layout 4749 4750 <field id="field_C" grid_ref="grid_A" operation="instant">field_A 4751 + field_B</field> 4752 \end_layout 4753 4754 \begin_layout Plain Layout 4755 4756 </field_definition> 4757 \end_layout 4758 4759 \begin_layout Plain Layout 4760 4761 \end_layout 4762 4763 \begin_layout Plain Layout 4764 4765 <file_definition> 4766 \end_layout 4767 4768 \begin_layout Plain Layout 4769 4770 <file name="output" output_freq="10ts"> 4771 \end_layout 4772 4773 \begin_layout Plain Layout 4774 4775 <field field_ref="field_C" /> 4776 \end_layout 4777 4778 \begin_layout Plain Layout 4779 4780 </file> 4781 \end_layout 4782 4783 \begin_layout Plain Layout 4784 4785 </file_definition> 4786 \end_layout 4787 4788 \begin_layout Plain Layout 4789 4790 </context> 4791 \end_layout 4792 4793 \begin_layout Plain Layout 4794 4795 </simulation> 4796 \end_layout 4797 4798 \end_inset 4799 4800 With this configuration file, calling 4801 \begin_inset Flex Code 4802 status open 4803 4804 \begin_layout Plain Layout 4805 xios_field_is_active( 4806 \begin_inset Quotes eld 4807 \end_inset 4808 4809 field_A 4810 \begin_inset Quotes erd 4811 \end_inset 4812 4813 ) 4814 \end_layout 4815 4816 \end_inset 4817 4818 or 4819 \begin_inset Newline newline 4820 \end_inset 4821 4822 4823 \begin_inset Flex Code 4824 status open 4825 4826 \begin_layout Plain Layout 4827 xios_field_is_active( 4828 \begin_inset Quotes eld 4829 \end_inset 4830 4831 field_B 4832 \begin_inset Quotes erd 4833 \end_inset 4834 4835 ) 4836 \end_layout 4837 4838 \end_inset 4839 4840 always returns 4841 \series bold 4842 true 4843 \series default 4844 because 4845 \begin_inset Quotes eld 4846 \end_inset 4847 4848 field_A 4849 \begin_inset Quotes erd 4850 \end_inset 4851 4852 and 4853 \begin_inset Quotes eld 4854 \end_inset 4855 4856 field_B 4857 \begin_inset Quotes erd 4858 \end_inset 4859 4860 are needed to compute 4861 \begin_inset Quotes eld 4862 \end_inset 4863 4864 field_C 4865 \begin_inset Quotes erd 4866 \end_inset 4867 4868 which is outputted. 4869 Since 4870 \begin_inset Quotes eld 4871 \end_inset 4872 4873 field_C 4874 \begin_inset Quotes erd 4875 \end_inset 4876 4877 is outputted every 10 timesteps, setting the 4878 \begin_inset Flex Code 4879 status open 4880 4881 \begin_layout Plain Layout 4882 at_current_timestep 4883 \end_layout 4884 4885 \end_inset 4886 4887 argument to 4888 \series bold 4889 true 4890 \series default 4891 would make a difference. 4892 Calling 4893 \begin_inset Flex Code 4894 status open 4895 4896 \begin_layout Plain Layout 4897 xios_field_is_active( 4898 \begin_inset Quotes eld 4899 \end_inset 4900 4901 field_A 4902 \begin_inset Quotes erd 4903 \end_inset 4904 4905 , .true.) 4906 \end_layout 4907 4908 \end_inset 4909 4910 would return 4911 \series bold 4912 true 4913 \series default 4914 only every 10 timesteps as there is no need to provide 4915 \begin_inset Quotes eld 4916 \end_inset 4917 4918 field_A 4919 \begin_inset Quotes erd 4920 \end_inset 4921 4922 (respectively 4923 \begin_inset Quotes eld 4924 \end_inset 4925 4926 field_B 4927 \begin_inset Quotes erd 4928 \end_inset 4929 4930 ) at timesteps for which 4931 \begin_inset Quotes eld 4932 \end_inset 4933 4934 field_C 4935 \begin_inset Quotes erd 4936 \end_inset 4937 4938 is not written to file. 4939 \begin_inset Newline newline 4940 \end_inset 4941 4942 4943 \begin_inset Newline newline 4944 \end_inset 4945 4946 Additionally, it possible to set the field attribute 4947 \series bold 4948 check_if_active 4949 \series default 4950 to 4951 \begin_inset Quotes eld 4952 \end_inset 4953 4954 4955 \series bold 4956 \emph on 4957 true 4958 \series default 4959 \emph default 4960 4961 \begin_inset Quotes erd 4962 \end_inset 4963 4964 so that XIOS internally check if a field is active before sending any data. 4965 For example, defining the following field: 4966 \end_layout 4967 4968 \begin_layout Standard 4969 \begin_inset listings 4970 lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" 4971 inline false 4972 status open 4973 4974 \begin_layout Plain Layout 4975 4976 <field_definition> 4977 \end_layout 4978 4979 \begin_layout Plain Layout 4980 4981 <field id="field_A" grid_ref="grid_A" operation="instant" check_if_active 4982 \series bold 4983 ="true" 4984 \series default 4985 /> 4986 \end_layout 4987 4988 \begin_layout Plain Layout 4989 4990 </field_definition> 4991 \end_layout 4992 4993 \end_inset 4994 4995 has the same effect as if all calls to 4996 \begin_inset Flex Code 4997 status open 4998 4999 \begin_layout Plain Layout 5000 xios_send_field("field_A", field_A) 5001 \end_layout 5002 5003 \end_inset 5004 5005 were replaced by: 5006 \end_layout 5007 5008 \begin_layout Standard 5009 \begin_inset listings 5010 lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" 5011 inline false 5012 status open 5013 5014 \begin_layout Plain Layout 5015 5016 IF (xios_field_is_active("field_A"), .true.) THEN 5017 \end_layout 5018 5019 \begin_layout Plain Layout 5020 5021 CALL xios_send_field("field_A", field_A) 5022 \end_layout 5023 5024 \begin_layout Plain Layout 5025 5026 ENDIF 5027 \end_layout 5028 5029 \end_inset 5030 5031 4566 5032 \end_layout 4567 5033 … … 4661 5127 \begin_layout Plain Layout 4662 5128 4663 <grid id="grid_A"><!-- Definition om mited --></grid>5129 <grid id="grid_A"><!-- Definition omitted --></grid> 4664 5130 \end_layout 4665 5131 … … 4876 5342 \begin_layout Plain Layout 4877 5343 4878 <!-- Actual context(s) used by the simulation om mited -->5344 <!-- Actual context(s) used by the simulation omitted --> 4879 5345 \end_layout 4880 5346
Note: See TracChangeset
for help on using the changeset viewer.